Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(ts/cli): fix package resolution issues
jkomynod1e08a145e32
diff --git a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.tsindex 1b220c4cf..c0cf1a8cb 100644--- a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts@@ -53,6 +53,38 @@ describe('CLI: composio ts generate', () => {yield* fs.makeDirectory(nodeModulesDir, { recursive: true });yield* fs.makeDirectory(generatedDir, { recursive: true });+ // Create a mock package.json to override the symlink resolution for ESM imports.+ // This is necessary because we're using symlinks in test-layer.ts to isolate the test environment.+ const corePackageJson = path.join(nodeModulesDir, 'package.json');+ yield* fs.writeFileString(+ corePackageJson,+ JSON.stringify(+ {+ name: '@composio/core',+ type: 'module',+ exports: {+ '.': {+ types: './index.d.ts',+ default: './index.js',+ },+ './generated': {+ types: './generated/index.d.ts',+ default: './generated/index.js',+ },+ },+ },+ null,+ 2+ )+ );++ // Create minimal type stubs for @composio/core root exports (needed for transpilation)+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'index.d.ts'),+ 'export type TriggerEvent<T> = { payload: T };'+ );+ yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');+const outputDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');const args = ['ts', 'generate'];yield* cli(args);@@ -262,6 +294,37 @@ describe('CLI: composio ts generate', () => {yield* fs.makeDirectory(nodeModulesDir, { recursive: true });yield* fs.makeDirectory(generatedDir, { recursive: true });+ // Create a mock package.json to override the symlink resolution for ESM imports+ const corePackageJson = path.join(nodeModulesDir, 'package.json');+ yield* fs.writeFileString(+ corePackageJson,+ JSON.stringify(+ {+ name: '@composio/core',+ type: 'module',+ exports: {+ '.': {+ types: './index.d.ts',+ default: './index.js',+ },+ './generated': {+ types: './generated/index.d.ts',+ default: './generated/index.js',+ },+ },+ },+ null,+ 2+ )+ );++ // Create minimal type stubs for @composio/core root exports (needed for transpilation)+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'index.d.ts'),+ 'export type TriggerEvent<T> = { payload: T };'+ );+ yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');+const outputDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');const args = ['ts', 'generate', '--type-tools'];yield* cli(args);@@ -714,6 +777,23 @@ describe('CLI: composio ts generate', () => {const fs = yield* FileSystem.FileSystem;const outputDir = path.join(cwd, 'generated-compiled');+ // Create mock @composio/core for transpilation to resolve imports+ const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');+ yield* fs.makeDirectory(nodeModulesDir, { recursive: true });+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'package.json'),+ JSON.stringify({+ name: '@composio/core',+ type: 'module',+ exports: { '.': { types: './index.d.ts', default: './index.js' } },+ })+ );+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'index.d.ts'),+ 'export type TriggerEvent<T> = { payload: T };'+ );+ yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');+const args = ['ts', 'generate', '--transpiled', '--output-dir', outputDir];yield* cli(args);@@ -752,6 +832,27 @@ describe('CLI: composio ts generate', () => {yield* fs.makeDirectory(nodeModulesDir, { recursive: true });yield* fs.makeDirectory(generatedDir, { recursive: true });+ // Create mock package.json and type stubs for transpilation+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'package.json'),+ JSON.stringify({+ name: '@composio/core',+ type: 'module',+ exports: {+ '.': { types: './index.d.ts', default: './index.js' },+ './generated': {+ types: './generated/index.d.ts',+ default: './generated/index.js',+ },+ },+ })+ );+ yield* fs.writeFileString(+ path.join(nodeModulesDir, 'index.d.ts'),+ 'export type TriggerEvent<T> = { payload: T };'+ );+ yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');+const args = ['ts', 'generate'];yield* cli(args);