Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(cli): add node_modules output dir validation to Python generate path

jkomynoc3fbf0f2dd39
diff --git a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
index cd3e6e927..f192fd005 100644
--- a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+++ b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
@@ -1,3 +1,4 @@
+import path from 'node:path';
import { Command, Options } from '@effect/cli';
import { pipe, Effect, Option, Array } from 'effect';
import { FileSystem } from '@effect/platform';
@@ -63,7 +64,17 @@ export function generatePythonTypeStubs({
onNone: () => pyFindComposioCoreGenerated(cwd),
// If an output directory is specified, validate and create it
- onSome: Effect.succeed,
+ onSome: outputDir => {
+ const normalizedPath = path.normalize(outputDir);
+ if (normalizedPath.includes('node_modules')) {
+ return Effect.fail(
+ new Error(
+ 'Output directory cannot be inside node_modules. Please specify a different directory.'
+ )
+ );
+ }
+ return Effect.succeed(outputDir);
+ },
})
);