@devries-cameron20 / composio-1 / commits / e706fe576
Fork 0

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

feat(cli): move py and ts under generate command

Rahul Tarak committed Mar 16, 2026 at 20:04 UTC e706fe576377c95e9bf456d6ff173dfdcfdd1cb5
4 files changed +57 -11
ts/packages/cli/src/commands/generate/generate-py.cmd.ts new
+10
@@ -0,0 +1,10 @@
1 +import { Command } from '@effect/cli';
2 +import { generatePythonTypeStubs, outputOpt, toolkitsOpt } from '../py/commands/py.generate.cmd';
3 +
4 +/**
5 + * `composio generate py` — Generate Python type stubs.
6 + */
7 +export const generateCmd$Py = Command.make('py', { outputOpt, toolkitsOpt }).pipe(
8 + Command.withDescription('Generate Python type stubs for toolkits, tools, and triggers.'),
9 + Command.withHandler(generatePythonTypeStubs)
10 +);
ts/packages/cli/src/commands/generate/generate-ts.cmd.ts new
+31
@@ -0,0 +1,31 @@
1 +import { Command } from '@effect/cli';
2 +import { Option } from 'effect';
3 +import {
4 + generateTypescriptTypeStubs,
5 + outputOpt,
6 + compact,
7 + transpiled,
8 + typeTools,
9 + toolkitsOpt,
10 +} from '../ts/commands/ts.generate.cmd';
11 +
12 +/**
13 + * `composio generate ts` — Generate TypeScript type stubs.
14 + */
15 +export const generateCmd$Ts = Command.make('ts', {
16 + outputOpt,
17 + compact,
18 + transpiled,
19 + typeTools,
20 + toolkitsOpt,
21 +}).pipe(
22 + Command.withDescription('Generate TypeScript type stubs for toolkits, tools, and triggers.'),
23 + Command.withHandler(params => {
24 + const shouldCompile = params.transpiled || !Option.isSome(params.outputOpt);
25 + return generateTypescriptTypeStubs({
26 + ...params,
27 + compact: params.compact,
28 + transpiled: shouldCompile,
29 + });
30 + })
31 +);
ts/packages/cli/src/commands/generate/generate.cmd.ts renamed
+15 -5
@@ -3,8 +3,10 @@ import { Effect, Match } from 'effect';
3 import { ProjectEnvironmentDetector } from 'src/services/project-environment-detector';
4 import { NodeProcess } from 'src/services/node-process';
5 import { TerminalUI } from 'src/services/terminal-ui';
6 -import { generateTypescriptTypeStubs } from './ts/commands/ts.generate.cmd';
7 -import { generatePythonTypeStubs } from './py/commands/py.generate.cmd';
6 +import { generateTypescriptTypeStubs } from '../ts/commands/ts.generate.cmd';
7 +import { generatePythonTypeStubs } from '../py/commands/py.generate.cmd';
8 +import { generateCmd$Py } from './generate-py.cmd';
9 +import { generateCmd$Ts } from './generate-ts.cmd';
10
11 export const outputOpt = Options.optional(
12 Options.directory('output-dir', {
@@ -27,9 +29,17 @@ export const toolkitsOpt = Options.text('toolkits').pipe(
29 );
30
31 /**
32 + * CLI entry point for code generation commands.
33 + *
34 + * When invoked without a subcommand, auto-detects the project language.
35 + * Subcommands `py` and `ts` allow explicit language selection.
36 + *
37 * @example
38 * ```bash
32 - * composio generate <command>
39 + * composio generate
40 + * composio generate py
41 + * composio generate ts
42 + * composio generate ts --type-tools
43 * ```
44 */
45 export const generateCmd = Command.make('generate', { outputOpt, typeTools, toolkitsOpt }).pipe(
@@ -48,7 +58,6 @@ export const generateCmd = Command.make('generate', { outputOpt, typeTools, tool
58 const displayLang = env.kind === 'js' ? 'TypeScript' : 'Python';
59 yield* ui.log.step(`Project type detected: ${displayLang}`);
60
51 - // Redirect to either `ts generate` or `py generate` commands
61 yield* Match.value(env.kind).pipe(
62 Match.when('js', () =>
63 generateTypescriptTypeStubs({
@@ -63,5 +72,6 @@ export const generateCmd = Command.make('generate', { outputOpt, typeTools, tool
72 Match.exhaustive
73 );
74 })
66 - )
75 + ),
76 + Command.withSubcommands([generateCmd$Py, generateCmd$Ts])
77 );
ts/packages/cli/src/commands/index.ts
+1 -6
@@ -10,9 +10,7 @@ import { loginCmd } from './login.cmd';
10 import { logoutCmd } from './logout.cmd';
11 import { installCmd } from './install.cmd';
12 import { initCmd } from './init.cmd';
13 -import { pyCmd } from './py/py.cmd';
14 -import { tsCmd } from './ts/ts.cmd';
15 -import { generateCmd } from './generate.cmd';
13 +import { generateCmd } from './generate/generate.cmd';
14 import { manageCmd } from './manage/manage.cmd';
15 import { showToolsExecuteInputHelp } from './tools/commands/tools.execute.cmd';
16 import { printRootHelp } from './root-help';
@@ -27,12 +25,9 @@ const $cmd = $defaultCmd.pipe(
25 installCmd,
26 initCmd,
27 generateCmd,
30 - pyCmd,
31 - tsCmd,
28 manageCmd,
29 ])
30 );
35 -
31 export const rootCommand = $cmd;
32
33 const parseExecuteInputHelpSlug = (argv: ReadonlyArray<string>): string | undefined => {