@devries-cameron20 / composio Mirror · read-only / commits / 41764296d
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 13:30 UTC

fix(cli): resolve help-command targets like --help and curate agent children

Review follow-ups on the help consistency work: - route composio help <unknown> through the framework parser so unknown targets fail like every other unknown command (stderr, did-you-mean, exit 1) instead of an exit-0 'Unknown command' line on stdout - resolve help-spelling targets with the same longest-prefix scan --help uses, so composio help dev toolkits renders the curated dev page rather than an unknown-command line - add curated SUBCOMMAND_HELP entries for agent signup/login/whoami/ inbox/claim, mirroring the orgs list/switch pattern - make the two rendering tests actually execute (layer(TestLive()) + it.effect); they previously returned a bare Effect from a plain it and passed vacuously - add routing tests for every composio help path: bare, family, child, level suffixes, trailing --help, deep-path fallback, unknown target - drop tools from the newly-curated changelog list; its entry already existed at the PR base

jkomyno committed Sep 10, 2026 at 19:15 UTC 41764296d4d375aa8f956ae060ec0aaed5b25bad
4 files changed +249 -30
ts/packages/cli/CHANGELOG.md
+9 -7
@@ -41,13 +41,15 @@
41 `https://staging-dashboard.composio.dev/`.
42 - `composio dev auth-configs create` now sends custom OAuth credentials and scopes
43 in the API's expected shape instead of failing validation.
44 -- `composio orgs --help`, `composio signup --help`, and the group help pages for
45 - `connections`, `triggers`, `tools`, `artifacts`, and `install` now render the same
46 - curated, styled help page as every other command family, instead of falling back to
47 - the framework's raw flag dump. `composio help <command>` is now a supported spelling
48 - of command help (`composio help orgs` shows the same page as `composio orgs --help`),
49 - and the `orgs` description in contextual error help matches the command's actual
50 - description.
44 +- `composio orgs --help`, `composio signup --help`, the `agent` family pages (signup,
45 + login, whoami, inbox, claim), and the group help pages for `connections`, `triggers`,
46 + `artifacts`, and `install` now render the same curated, styled help page as every
47 + other command family, instead of falling back to the framework's raw flag dump.
48 + `composio help <command>` is now a supported spelling of command help (`composio help
49 +orgs` shows the same page as `composio orgs --help`, with the same longest-prefix
50 + fallback for deeper paths); an unknown target fails through the framework parser like
51 + any other unknown command. The `orgs` description in contextual error help now matches
52 + the command's actual description.
53
54 ## 0.3.3
55
ts/packages/cli/src/commands/index.ts
+15 -1
@@ -573,7 +573,21 @@ export const runWithConfig = Effect.gen(function* () {
573 if (cmdParts.length === 0) {
574 return printRootHelp(visibility, helpLevel);
575 }
576 - return printSubcommandHelp(cmdParts.join(' '), visibility, helpLevel);
576 + // Resolve with the same longest-prefix scan the `--help` spelling uses, so
577 + // `composio help dev toolkits` renders the curated dev page instead of an
578 + // unknown-command line for a path that exists. `matchSubcommandHelp` reads a
579 + // full argv with a trailing --help token, hence the synthetic prefix.
580 + const subHelp = matchSubcommandHelp(
581 + ['composio', 'composio', ...cmdParts, '--help'],
582 + visibility
583 + );
584 + if (subHelp) {
585 + return printSubcommandHelp(subHelp, visibility, helpLevel);
586 + }
587 + // Unknown target: fall through to the framework parser so the failure
588 + // matches every other unknown command (stderr rendering, "Did you mean?",
589 + // exit 1) instead of an exit-0 stdout line scripts would read as success.
590 + return runCli(args);
591 }
592 const subHelp = matchSubcommandHelp(normalizedArgv, visibility);
593 if (subHelp) {
ts/packages/cli/src/commands/root-help.ts
+52
@@ -874,6 +874,58 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
874 'composio agent claim',
875 ],
876 },
877 + 'agent signup': {
878 + usage: 'composio agent signup [-f, --force] [--no-wait] [--no-login]',
879 + description: 'Sign up and optionally log in as a Composio agent.',
880 + options: [
881 + {
882 + name: '-f, --force',
883 + description: 'Create a new agent identity even if ~/.composio/agent.json already exists',
884 + },
885 + {
886 + name: '--no-wait',
887 + description: 'Start agent signup and exit without waiting for credentials',
888 + },
889 + {
890 + name: '--no-login',
891 + description: 'Create or verify the agent identity without logging the CLI in',
892 + },
893 + ],
894 + },
895 + 'agent login': {
896 + usage: 'composio agent login <composio_agent_key>',
897 + description: 'Log in with an existing Composio agent key.',
898 + args: [
899 + {
900 + name: '<composio_agent_key>',
901 + description: 'Composio agent key for an existing agent identity',
902 + },
903 + ],
904 + },
905 + 'agent whoami': {
906 + usage: 'composio agent whoami',
907 + description: 'Show the stored Composio agent identity.',
908 + },
909 + 'agent inbox': {
910 + usage: 'composio agent inbox [--limit integer]',
911 + description: 'Read the stored Composio agent inbox.',
912 + options: [
913 + {
914 + name: '--limit <integer>',
915 + description: 'Maximum number of inbox messages to fetch (default: 50)',
916 + },
917 + ],
918 + },
919 + 'agent claim': {
920 + usage: 'composio agent claim <email>',
921 + description: 'Invite a human admin to claim this agent org.',
922 + args: [
923 + {
924 + name: '<email>',
925 + description: 'Human email address to invite as an admin for this agent org',
926 + },
927 + ],
928 + },
929 signup: {
930 usage: 'composio signup [-f, --force] [--no-wait] [--no-login]',
931 description: 'Sign up and optionally log in as a Composio agent.',
ts/packages/cli/test/src/commands/root-help-consistency.test.ts
+173 -22
@@ -1,13 +1,13 @@
1 import { layer } from '@effect/vitest';
2 import { Effect } from 'effect';
3 -import { describe, expect, it } from 'vitest';
3 +import { afterEach, describe, expect, it } from 'vitest';
4 import { buildRootCommand } from 'src/commands';
5 import {
6 getCommandHelpText,
7 matchSubcommandHelp,
8 printSubcommandHelp,
9 } from 'src/commands/root-help';
10 -import { MockConsole, TestLive } from 'test/__utils__';
10 +import { cli, MockConsole, TestLive } from 'test/__utils__';
11
12 const stableVisibility = {
13 isDevModeEnabled: true,
@@ -20,6 +20,10 @@ const getVisibleRootCommandNames = () =>
20 );
21
22 describe('subcommand help registry consistency', () => {
23 + afterEach(() => {
24 + process.exitCode = undefined;
25 + });
26 +
27 it('has a curated help entry for every visible root command', () => {
28 for (const name of getVisibleRootCommandNames()) {
29 const matched = matchSubcommandHelp(['bun', 'composio', name, '--help'], stableVisibility);
@@ -42,30 +46,177 @@ describe('subcommand help registry consistency', () => {
46 ).toBe('orgs');
47 });
48
45 - it('renders the curated orgs page', () =>
46 - Effect.gen(function* () {
47 - yield* printSubcommandHelp('orgs', stableVisibility);
48 - const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
49 -
50 - expect(output).toContain('USAGE');
51 - expect(output).toContain('composio orgs <subcommand>');
52 - expect(output).toContain('SEE ALSO');
53 - expect(output).toContain('composio orgs list');
54 - expect(output).toContain('composio orgs switch');
55 - }));
56 -
57 - it('renders curated pages for formerly raw-fallback groups', () =>
58 - Effect.gen(function* () {
59 - for (const cmd of ['connections', 'triggers', 'tools', 'artifacts', 'install']) {
60 - yield* printSubcommandHelp(cmd, stableVisibility);
61 - const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
62 - expect(output, `\`composio ${cmd}\` help page`).toContain('USAGE');
63 - }
64 - }));
49 + it('matches every agent family invocation', () => {
50 + expect(matchSubcommandHelp(['bun', 'composio', 'agent', '--help'], stableVisibility)).toBe(
51 + 'agent'
52 + );
53 + for (const child of ['signup', 'login', 'whoami', 'inbox', 'claim']) {
54 + expect(
55 + matchSubcommandHelp(['bun', 'composio', 'agent', child, '--help'], stableVisibility),
56 + `missing curated help for \`composio agent ${child}\``
57 + ).toBe(`agent ${child}`);
58 + }
59 + });
60
61 it('uses the current orgs description in contextual help', () => {
62 expect(getCommandHelpText('orgs', stableVisibility)).toContain(
63 'Manage default global organization/project context.'
64 );
65 });
66 +
67 + layer(TestLive())(it => {
68 + it.effect('renders the curated orgs page', () =>
69 + Effect.gen(function* () {
70 + yield* printSubcommandHelp('orgs', stableVisibility);
71 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
72 +
73 + expect(output).toContain('USAGE');
74 + expect(output).toContain('composio orgs <subcommand>');
75 + expect(output).toContain('SEE ALSO');
76 + expect(output).toContain('composio orgs list');
77 + expect(output).toContain('composio orgs switch');
78 + })
79 + );
80 + });
81 +
82 + layer(TestLive())(it => {
83 + it.effect('renders curated pages for formerly raw-fallback groups', () =>
84 + Effect.gen(function* () {
85 + for (const cmd of ['connections', 'triggers', 'tools', 'artifacts', 'install']) {
86 + yield* printSubcommandHelp(cmd, stableVisibility);
87 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
88 + expect(output, `\`composio ${cmd}\` help page`).toContain('USAGE');
89 + }
90 + })
91 + );
92 + });
93 +
94 + layer(TestLive())(it => {
95 + it.effect('renders the curated agent signup page', () =>
96 + Effect.gen(function* () {
97 + yield* printSubcommandHelp('agent signup', stableVisibility);
98 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
99 +
100 + expect(output).toContain('USAGE');
101 + expect(output).toContain('composio agent signup');
102 + expect(output).toContain('--no-wait');
103 + expect(output).toContain('Sign up and optionally log in as a Composio agent.');
104 + })
105 + );
106 + });
107 +
108 + describe('composio help routing', () => {
109 + layer(TestLive())(it => {
110 + it.effect('bare `composio help` prints the root help page', () =>
111 + Effect.gen(function* () {
112 + yield* cli(['help']);
113 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
114 +
115 + expect(output).toContain('USAGE');
116 + expect(output).toContain('LEARN MORE');
117 + })
118 + );
119 + });
120 +
121 + layer(TestLive())(it => {
122 + it.effect('`composio help orgs` matches `composio orgs --help`', () =>
123 + Effect.gen(function* () {
124 + yield* cli(['help', 'orgs']);
125 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
126 +
127 + expect(output).toContain('USAGE');
128 + expect(output).toContain('composio orgs <subcommand>');
129 + expect(output).toContain('composio orgs list');
130 + })
131 + );
132 + });
133 +
134 + layer(TestLive())(it => {
135 + it.effect('`composio help orgs list` prints the orgs list page', () =>
136 + Effect.gen(function* () {
137 + yield* cli(['help', 'orgs', 'list']);
138 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
139 +
140 + expect(output).toContain('composio orgs list [--limit integer]');
141 + })
142 + );
143 + });
144 +
145 + layer(TestLive())(it => {
146 + it.effect('`composio help agent signup` prints the agent signup page', () =>
147 + Effect.gen(function* () {
148 + yield* cli(['help', 'agent', 'signup']);
149 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
150 +
151 + expect(output).toContain('composio agent signup');
152 + expect(output).toContain('--no-wait');
153 + })
154 + );
155 + });
156 +
157 + layer(TestLive())(it => {
158 + it.effect('`composio help orgs simple` applies the simple level', () =>
159 + Effect.gen(function* () {
160 + yield* cli(['help', 'orgs', 'simple']);
161 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
162 +
163 + expect(output).toContain('USAGE');
164 + expect(output).not.toContain('SEE ALSO');
165 + })
166 + );
167 + });
168 +
169 + layer(TestLive())(it => {
170 + it.effect('`composio help orgs full` applies the full level', () =>
171 + Effect.gen(function* () {
172 + yield* cli(['help', 'orgs', 'full']);
173 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
174 +
175 + expect(output).toContain('composio orgs <subcommand>');
176 + expect(output).toContain('SEE ALSO');
177 + })
178 + );
179 + });
180 +
181 + layer(TestLive())(it => {
182 + it.effect('`composio help orgs --help` tolerates a trailing help flag', () =>
183 + Effect.gen(function* () {
184 + yield* cli(['help', 'orgs', '--help']);
185 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
186 +
187 + expect(output).toContain('composio orgs <subcommand>');
188 + })
189 + );
190 + });
191 +
192 + layer(TestLive())(it => {
193 + it.effect('`composio help dev toolkits` falls back to the curated dev page', () =>
194 + Effect.gen(function* () {
195 + yield* cli(['help', 'dev', 'toolkits']);
196 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
197 +
198 + expect(output).toContain('GUARDED');
199 + })
200 + );
201 + });
202 +
203 + layer(TestLive())(it => {
204 + it.effect('`composio help <unknown>` fails like any unknown command', () =>
205 + Effect.gen(function* () {
206 + yield* cli(['help', 'frobnicate']).pipe(Effect.catch(() => Effect.void));
207 + const stdout = (yield* MockConsole.getLines({ stripAnsi: true, stream: 'stdout' })).join(
208 + '\n'
209 + );
210 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
211 +
212 + // The framework renders its unknown-subcommand failure (stderr channel,
213 + // "Did you mean?", exit 1 via CliError.ShowHelp) instead of an exit-0
214 + // "Unknown command" line on the stdout data channel.
215 + expect(stdout).not.toContain('Unknown command');
216 + expect(output).not.toContain('Unknown command');
217 + expect(output).toContain('generate');
218 + })
219 + );
220 + });
221 + });
222 });