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
The TypeScript generate path validated --output-dir to reject node_modules paths, but the Python path did not. Add the same check for consistency.
jkomyno committed
Mar 17, 2026 at 16:04 UTC
c3fbf0f2dd39e22c638e422a32ee4f717ce70f1b
1 file changed
+12
-1
ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+12
-1
@@ -1,3 +1,4 @@
1
+import path from 'node:path';
2
import { Command, Options } from '@effect/cli';
3
import { pipe, Effect, Option, Array } from 'effect';
4
import { FileSystem } from '@effect/platform';
@@ -63,7 +64,17 @@ export function generatePythonTypeStubs({
64
onNone: () => pyFindComposioCoreGenerated(cwd),
65
66
// If an output directory is specified, validate and create it
66
- onSome: Effect.succeed,
67
+ onSome: outputDir => {
68
+ const normalizedPath = path.normalize(outputDir);
69
+ if (normalizedPath.includes('node_modules')) {
70
+ return Effect.fail(
71
+ new Error(
72
+ 'Output directory cannot be inside node_modules. Please specify a different directory.'
73
+ )
74
+ );
75
+ }
76
+ return Effect.succeed(outputDir);
77
+ },
78
})
79
);
80