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): name the mistyped command in `composio help` errors
Drop the `help` token and redundant --help/-h flags before routing, so unknown targets get the framework's "Did you mean?" suggestion and `composio help --help` renders the curated root page. Document the `install` flags.
jkomyno committed
Sep 16, 2026 at 15:21 UTC
84e7fde93bb2f3fb316822f5fb2589f68e7d41c9
3 files changed
+56
-4
ts/packages/cli/src/commands/index.ts
+6
-3
@@ -571,7 +571,9 @@ export const runWithConfig = Effect.gen(function* () {
571
// `composio help [command] [level]` — the framework has no builtin help command, so
572
// route it through the same curated pages as `composio <command> --help`.
573
if (args[0] === 'help') {
574
- const rest = args.slice(1);
574
+ // `help` already asks for help, so a redundant `--help`/`-h` (`composio help --help`,
575
+ // `composio help orgs full --help`) must not reach the framework parser.
576
+ const rest = args.slice(1).filter(arg => !EXPLICIT_STDOUT_FLAGS.has(arg));
577
const last = rest[rest.length - 1];
578
const helpLevel = parseHelpLevel(last) ?? 'default';
579
const cmdParts = parseHelpLevel(last) !== undefined ? rest.slice(0, -1) : rest;
@@ -591,8 +593,9 @@ export const runWithConfig = Effect.gen(function* () {
593
}
594
// Unknown target: fall through to the framework parser so the failure
595
// matches every other unknown command (stderr rendering, "Did you mean?",
594
- // exit 1) instead of an exit-0 stdout line scripts would read as success.
595
- return runCli(args);
596
+ // exit 1) instead of an exit-0 stdout line scripts would read as success. The
597
+ // `help` token is dropped so the error and suggestion name the mistyped command.
598
+ return runCli(cmdParts);
599
}
600
const subHelp = matchSubcommandHelp(normalizedArgv, visibility);
601
if (subHelp) {
ts/packages/cli/src/commands/root-help.ts
+12
-1
@@ -1085,9 +1085,20 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
1085
description: 'Print the cwd-scoped session artifact directory.',
1086
},
1087
install: {
1088
- usage: 'composio install [--completions] [--no-completions] [--shell text]',
1088
+ usage: 'composio install [--completions] [--shell zsh|bash|fish]',
1089
description:
1090
'Set up shell integration (PATH and completions). Set COMPOSIO_BIN_DIR to choose the directory added to PATH; it otherwise defaults to ~/.local/bin when that holds this executable, and to the directory of the running binary.',
1091
+ options: [
1092
+ { name: '--completions', description: 'Also install shell completions (skipped by default)' },
1093
+ {
1094
+ name: '--shell <shell>',
1095
+ description: 'Override automatic shell detection: zsh, bash, or fish',
1096
+ },
1097
+ {
1098
+ name: '--no-completions',
1099
+ description: 'Deprecated: shell completions are skipped by default',
1100
+ },
1101
+ ],
1102
},
1103
1104
// ── Tools commands ──────────────────────────────────────────────────────
ts/packages/cli/test/src/commands/root-help-consistency.test.ts
+38
@@ -215,6 +215,44 @@ describe('subcommand help registry consistency', () => {
215
expect(stdout).not.toContain('Unknown command');
216
expect(output).not.toContain('Unknown command');
217
expect(output).toContain('generate');
218
+ expect(output).toContain('Unknown subcommand "frobnicate"');
219
+ expect(output).not.toContain('Unknown subcommand "help"');
220
+ })
221
+ );
222
+ });
223
+
224
+ layer(TestLive())(it => {
225
+ it.effect('`composio help <typo>` suggests the closest command', () =>
226
+ Effect.gen(function* () {
227
+ yield* cli(['help', 'orgz']).pipe(Effect.catch(() => Effect.void));
228
+ const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
229
+
230
+ expect(output).toContain('Unknown subcommand "orgz"');
231
+ expect(output).toContain('Did you mean this?');
232
+ })
233
+ );
234
+ });
235
+
236
+ layer(TestLive())(it => {
237
+ it.effect('`composio help --help` renders the curated root help', () =>
238
+ Effect.gen(function* () {
239
+ yield* cli(['help', '--help']);
240
+ const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
241
+
242
+ expect(output).not.toContain('--log-level');
243
+ expect(output).not.toContain('Unknown subcommand');
244
+ })
245
+ );
246
+ });
247
+
248
+ layer(TestLive())(it => {
249
+ it.effect('`composio help orgs full --help` keeps the requested level', () =>
250
+ Effect.gen(function* () {
251
+ yield* cli(['help', 'orgs', 'full', '--help']);
252
+ const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
253
+
254
+ expect(output).toContain('composio orgs <subcommand>');
255
+ expect(output).toContain('SEE ALSO');
256
})
257
);
258
});