@devries-cameron20 / composio Mirror · read-only / commits / 9a6f1a0ab
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, 23:30 UTC

Add help verbosity modes to CLI help output (#3205)

## Summary - Added `simple`, `default`, and `verbose` help levels to the CLI help renderer and visibility filtering. - Updated root and subcommand help matching so `--help <mode>` is recognized and routed correctly. - Expanded root help content to show a compact simple mode and a more detailed verbose mode, including additional commands. - Added coverage for help-level parsing, root help rendering, and subcommand help behavior. ## Testing - Added/updated Vitest checks for `--help simple` and `--help verbose` output. - Added tests covering help-mode suffix parsing in subcommand matching. - Added tests verifying simple subcommand help omits examples and injected helpers. - Not run locally in this session. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Rahul Tarak committed Apr 14, 2026 at 04:07 UTC 9a6f1a0abc1ce4904777f2698da2129bc9ac5369
9 files changed +489 -144
ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.list.cmd.ts
+27 -10
@@ -1,10 +1,17 @@
1 import { Command, Options } from '@effect/cli';
2 -import { Effect, Option } from 'effect';
3 -import { ComposioToolkitsRepository } from 'src/services/composio-clients';
2 +import { Effect, Option, Schema } from 'effect';
3 +import {
4 + ComposioClientSingleton,
5 + ConnectedAccountListResponse,
6 +} from 'src/services/composio-clients';
7 import { TerminalUI } from 'src/services/terminal-ui';
8 import { requireAuth } from 'src/effects/require-auth';
9 import { clampLimit } from 'src/ui/clamp-limit';
10 import { redact } from 'src/ui/redact';
11 +import {
12 + formatResolveCommandProjectError,
13 + resolveCommandProject,
14 +} from 'src/services/command-project';
15 import { formatConnectedAccountsTable, formatConnectedAccountsJson } from '../format';
16
17 const toolkits = Options.text('toolkits').pipe(
@@ -51,21 +58,31 @@ export const connectedAccountsCmd$List = Command.make(
58 if (!(yield* requireAuth)) return;
59
60 const ui = yield* TerminalUI;
54 - const repo = yield* ComposioToolkitsRepository;
61 + const clientSingleton = yield* ComposioClientSingleton;
62
63 const toolkitSlugs = Option.isSome(toolkits)
64 ? toolkits.value.split(',').map(s => s.trim())
65 : undefined;
66 + const resolvedProject = yield* resolveCommandProject({
67 + mode: 'developer',
68 + }).pipe(Effect.mapError(formatResolveCommandProjectError));
69 + const client = yield* clientSingleton.getFor({
70 + orgId: resolvedProject.orgId,
71 + projectId: resolvedProject.projectId,
72 + });
73
60 - const result = yield* ui.withSpinner(
74 + const rawResult = yield* ui.withSpinner(
75 'Fetching connected accounts...',
62 - repo.listConnectedAccounts({
63 - toolkit_slugs: toolkitSlugs,
64 - user_ids: Option.isSome(userId) ? [userId.value] : undefined,
65 - statuses: Option.isSome(status) ? [status.value] : undefined,
66 - limit: clampLimit(limit),
67 - })
76 + Effect.tryPromise(() =>
77 + client.connectedAccounts.list({
78 + toolkit_slugs: toolkitSlugs,
79 + user_ids: Option.isSome(userId) ? [userId.value] : undefined,
80 + statuses: Option.isSome(status) ? [status.value] : undefined,
81 + limit: clampLimit(limit),
82 + })
83 + )
84 );
85 + const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult);
86
87 if (result.items.length === 0) {
88 let hint: string;
ts/packages/cli/src/commands/connections/commands/connections.list.cmd.ts
+47 -24
@@ -1,8 +1,15 @@
1 import { Command, Options } from '@effect/cli';
2 -import { Effect, Option } from 'effect';
2 +import { Effect, Option, Schema } from 'effect';
3 import { requireAuth } from 'src/effects/require-auth';
4 import type { ConnectedAccountItem } from 'src/models/connected-accounts';
5 -import { ComposioToolkitsRepository } from 'src/services/composio-clients';
5 +import {
6 + ComposioClientSingleton,
7 + ConnectedAccountListResponse,
8 +} from 'src/services/composio-clients';
9 +import {
10 + formatResolveCommandProjectError,
11 + resolveCommandProject,
12 +} from 'src/services/command-project';
13 import { TerminalUI } from 'src/services/terminal-ui';
14
15 const toolkit = Options.text('toolkit').pipe(
@@ -16,22 +23,23 @@ const formatConnectionsJson = (items: ReadonlyArray<ConnectedAccountItem>): stri
23 return acc;
24 }, new Map());
25
19 - const grouped = items.reduce<Record<string, Array<{ status: string; alias?: string | null }>>>(
20 - (acc, item) => {
21 - const toolkit = item.toolkit.slug;
22 - const entry = {
23 - status: item.status,
24 - ...(toolkitCounts.get(toolkit)! > 1 ? { alias: item.alias ?? null } : {}),
25 - };
26 -
27 - if (!acc[toolkit]) {
28 - acc[toolkit] = [];
29 - }
30 - acc[toolkit].push(entry);
31 - return acc;
32 - },
33 - {}
34 - );
26 + const grouped = items.reduce<
27 + Record<string, Array<{ status: string; alias?: string | null; word_id?: string | null }>>
28 + >((acc, item) => {
29 + const toolkit = item.toolkit.slug;
30 + const includeAlias = toolkitCounts.get(toolkit)! > 1;
31 + const entry = {
32 + status: item.status,
33 + ...(includeAlias ? { alias: item.alias ?? null } : {}),
34 + ...(item.word_id != null ? { word_id: item.word_id } : {}),
35 + };
36 +
37 + if (!acc[toolkit]) {
38 + acc[toolkit] = [];
39 + }
40 + acc[toolkit].push(entry);
41 + return acc;
42 + }, {});
43
44 return JSON.stringify(grouped, null, 2);
45 };
@@ -41,21 +49,36 @@ export const connectionsCmd$List = Command.make('list', { toolkit }, ({ toolkit
49 if (!(yield* requireAuth)) return;
50
51 const ui = yield* TerminalUI;
44 - const repo = yield* ComposioToolkitsRepository;
52 + const clientSingleton = yield* ComposioClientSingleton;
53 const toolkitSlug = Option.getOrUndefined(toolkit);
54 + const resolvedProject = yield* resolveCommandProject({
55 + mode: 'consumer',
56 + }).pipe(Effect.mapError(formatResolveCommandProjectError));
57 +
58 + const consumerUserId = resolvedProject.consumerUserId;
59 + if (!consumerUserId) {
60 + return yield* Effect.fail(
61 + new Error('Missing consumer user id. Run `composio login` and try again.')
62 + );
63 + }
64
47 - const result = yield* ui.withSpinner(
48 - 'Fetching connections...',
49 - repo.listConnectedAccounts({
65 + const client = yield* clientSingleton.getFor({
66 + orgId: resolvedProject.orgId,
67 + projectId: resolvedProject.projectId,
68 + });
69 + const rawResult = yield* Effect.tryPromise(() =>
70 + client.connectedAccounts.list({
71 toolkit_slugs: toolkitSlug ? [toolkitSlug] : undefined,
72 + user_ids: [consumerUserId],
73 limit: 1000,
74 })
75 );
76 + const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult);
77
55 - yield* ui.output(formatConnectionsJson(result.items));
78 + yield* ui.output(formatConnectionsJson(result.items), { force: true });
79 })
80 ).pipe(
81 Command.withDescription(
59 - 'List connection statuses as JSON. Includes aliases when a toolkit has multiple connections.'
82 + 'List connection statuses as JSON. Includes aliases for duplicate toolkits and word_ids when available.'
83 )
84 );
ts/packages/cli/src/commands/feature-tags.ts
+34 -2
@@ -1,8 +1,10 @@
1 export type CliFeatureTag = string;
2 +export type HelpLevel = 'simple' | 'default' | 'full';
3
4 export type TaggedValue<T> = {
5 readonly value: T;
6 readonly tags?: ReadonlyArray<CliFeatureTag>;
7 + readonly helpLevel?: HelpLevel;
8 };
9
10 export type CommandVisibility = {
@@ -15,11 +17,34 @@ export const tagged = <T>(value: T, tags?: ReadonlyArray<CliFeatureTag>): Tagged
17 tags,
18 });
19
20 +export const simple = <T>(value: T, tags?: ReadonlyArray<CliFeatureTag>): TaggedValue<T> => ({
21 + value,
22 + tags,
23 + helpLevel: 'simple',
24 +});
25 +
26 +export const full = <T>(value: T, tags?: ReadonlyArray<CliFeatureTag>): TaggedValue<T> => ({
27 + value,
28 + tags,
29 + helpLevel: 'full',
30 +});
31 +
32 export const experimental = <T>(feature: string, value: T): TaggedValue<T> => ({
33 value,
34 tags: [feature],
35 });
36
37 +const HELP_LEVEL_ORDER: Record<HelpLevel, number> = {
38 + simple: 0,
39 + default: 1,
40 + full: 2,
41 +};
42 +
43 +export const isTaggedValueVisibleForHelpLevel = <T>(
44 + entry: TaggedValue<T>,
45 + helpLevel: HelpLevel = 'default'
46 +): boolean => HELP_LEVEL_ORDER[helpLevel] >= HELP_LEVEL_ORDER[entry.helpLevel ?? 'default'];
47 +
48 export const isTaggedValueVisible = <T>(
49 entry: TaggedValue<T>,
50 visibility: CommandVisibility
@@ -33,6 +58,13 @@ export const isTaggedValueVisible = <T>(
58
59 export const visibleValues = <T>(
60 entries: ReadonlyArray<TaggedValue<T>>,
36 - visibility: CommandVisibility
61 + visibility: CommandVisibility,
62 + helpLevel: HelpLevel = 'default'
63 ): Array<T> =>
38 - entries.filter(entry => isTaggedValueVisible(entry, visibility)).map(entry => entry.value);
64 + entries
65 + .filter(
66 + entry =>
67 + isTaggedValueVisible(entry, visibility) &&
68 + isTaggedValueVisibleForHelpLevel(entry, helpLevel)
69 + )
70 + .map(entry => entry.value);
ts/packages/cli/src/commands/index.ts
+16 -4
@@ -19,7 +19,12 @@ import {
19 runParallelToolsExecuteFromArgv,
20 showToolsExecuteInputHelp,
21 } from './tools/commands/tools.execute.cmd';
22 -import { printRootHelp, matchSubcommandHelp, printSubcommandHelp } from './root-help';
22 +import {
23 + printRootHelp,
24 + matchSubcommandHelp,
25 + parseHelpLevel,
26 + printSubcommandHelp,
27 +} from './root-help';
28 import { rootToolsCmd$Search } from './tools/commands/tools.search.cmd';
29 import { rootToolsCmd$Execute } from './tools/commands/tools.execute.cmd';
30 import { rootToolsCmd } from './tools/tools.cmd';
@@ -413,7 +418,13 @@ const normalizeHiddenDebugFlags = (argv: ReadonlyArray<string>): ReadonlyArray<s
418
419 const isRootHelp = (argv: ReadonlyArray<string>): boolean => {
420 const args = argv.slice(2);
416 - return args.length === 0 || (args.length === 1 && (args[0] === '--help' || args[0] === '-h'));
421 + return (
422 + args.length === 0 ||
423 + (args.length >= 1 &&
424 + args.length <= 2 &&
425 + (args[0] === '--help' || args[0] === '-h') &&
426 + (args.length === 1 || parseHelpLevel(args[1]) !== undefined))
427 + );
428 };
429
430 const isGenerateGraph = (argv: ReadonlyArray<string>): boolean => {
@@ -503,11 +514,12 @@ export const runWithConfig = Effect.gen(function* () {
514 });
515 }
516 if (isRootHelp(normalizedArgv)) {
506 - return printRootHelp(visibility);
517 + return printRootHelp(visibility, parseHelpLevel(normalizedArgv[3]) ?? 'default');
518 }
519 const subHelp = matchSubcommandHelp(normalizedArgv, visibility);
520 if (subHelp) {
510 - return printSubcommandHelp(subHelp, visibility);
521 + const helpLevel = parseHelpLevel(normalizedArgv[normalizedArgv.length - 1]) ?? 'default';
522 + return printSubcommandHelp(subHelp, visibility, helpLevel);
523 }
524 const nestedMismatch = findNestedSubcommandMismatch(normalizedArgv, rootCommand);
525 if (nestedMismatch) {
ts/packages/cli/src/commands/root-help.ts
+177 -86
@@ -4,6 +4,11 @@ import { bold, dim, gray } from 'src/ui/colors';
4 import {
5 type CommandVisibility,
6 experimental,
7 + type HelpLevel,
8 + full,
9 + isTaggedValueVisible,
10 + isTaggedValueVisibleForHelpLevel,
11 + simple,
12 tagged,
13 visibleValues,
14 type TaggedValue,
@@ -24,7 +29,7 @@ type CompactCommand = {
29 // ── Core workflow commands ──────────────────────────────────────────────
30
31 const CORE_COMMANDS: ReadonlyArray<TaggedValue<DetailedCommand>> = [
27 - tagged({
32 + simple({
33 name: 'search',
34 description: 'Find tools by use case across all toolkits/apps.',
35 usage: 'search <query...> [--toolkits text] [--limit integer] [--human]',
@@ -38,7 +43,7 @@ const CORE_COMMANDS: ReadonlyArray<TaggedValue<DetailedCommand>> = [
43 { name: '--human', description: 'Show formatted output instead of default JSON' },
44 ],
45 }),
41 - tagged({
46 + simple({
47 name: 'execute',
48 description:
49 'Execute a tool. Validates inputs and connections automatically; use it aggressively.',
@@ -63,7 +68,7 @@ const CORE_COMMANDS: ReadonlyArray<TaggedValue<DetailedCommand>> = [
68 { name: '--get-schema', description: 'Fetch and print the CLI-facing input schema' },
69 ],
70 }),
66 - tagged({
71 + simple({
72 name: 'link',
73 description: 'Connect your account for a toolkit/app.',
74 usage: 'link [<toolkit>]',
@@ -143,10 +148,6 @@ const OTHER_COMMANDS: ReadonlyArray<TaggedValue<CompactCommand>> = [
148 name: 'composio triggers list <toolkit>',
149 description: 'List available trigger types in a toolkit',
150 }),
146 - tagged({
147 - name: 'composio connections list',
148 - description: 'Print toolkit connection statuses as JSON',
149 - }),
151 tagged({
152 name: 'composio artifacts cwd',
153 description: 'Print the cwd-scoped session artifact directory',
@@ -170,6 +171,32 @@ const ACCOUNT_COMMANDS: ReadonlyArray<TaggedValue<CompactCommand>> = [
171 tagged({ name: 'config', description: 'View and manage CLI configuration' }),
172 ];
173
174 +const FULL_COMMANDS: ReadonlyArray<TaggedValue<CompactCommand>> = [
175 + full({
176 + name: 'files',
177 + description: 'Show where CLI config, cache, and session artifacts live',
178 + }),
179 + full({ name: 'tools list', description: 'List tools for a toolkit with query/tag filters' }),
180 + full({ name: 'tools info', description: 'Inspect a tool summary and cached schema details' }),
181 + full({ name: 'triggers list', description: 'List trigger types for a toolkit' }),
182 + full({ name: 'triggers info', description: 'Inspect a trigger type and schema summary' }),
183 + full({ name: 'connections list', description: 'Print toolkit connection statuses as JSON' }),
184 + full({ name: 'generate ts', description: 'Generate TypeScript stubs for selected toolkits' }),
185 + full({ name: 'generate py', description: 'Generate Python stubs for selected toolkits' }),
186 + full({
187 + name: 'dev init',
188 + description: 'Initialize a developer project in the current directory',
189 + }),
190 + full({
191 + name: 'dev playground-execute',
192 + description: 'Execute tools against developer playground users and auth configs',
193 + }),
194 + full({
195 + name: 'dev listen',
196 + description: 'Stream developer-project realtime trigger events with optional forwarding',
197 + }),
198 +];
199 +
200 // ── Render helpers ─────────────────────────────────────────────────────
201
202 function renderDetailedCommands(name: string, commands: ReadonlyArray<DetailedCommand>): string[] {
@@ -193,7 +220,7 @@ function renderCompactCommands(commands: ReadonlyArray<CompactCommand>): string[
220 return commands.map(cmd => ` ${cmd.name.padEnd(maxLen + 2)}${cmd.description}`);
221 }
222
196 -function renderDevHelp(visibility: CommandVisibility): string {
223 +function renderDevHelp(visibility: CommandVisibility, helpLevel: HelpLevel = 'default'): string {
224 const lines: string[] = [
225 '',
226 bold('USAGE'),
@@ -212,15 +239,17 @@ function renderDevHelp(visibility: CommandVisibility): string {
239 ];
240
241 if (!visibility.isDevModeEnabled) {
215 - lines.push(bold('EXAMPLES'));
216 - lines.push(' composio dev --mode on');
217 - lines.push(' composio dev --mode off');
218 - lines.push('');
219 - lines.push(bold('NOTE'));
220 - lines.push(
221 - ' Developer mode is for engineers building with the CLI. It unlocks more advanced commands like creating or updating auth configs and connected accounts.'
222 - );
223 - lines.push('');
242 + if (helpLevel !== 'simple') {
243 + lines.push(bold('EXAMPLES'));
244 + lines.push(' composio dev --mode on');
245 + lines.push(' composio dev --mode off');
246 + lines.push('');
247 + lines.push(bold('NOTE'));
248 + lines.push(
249 + ' Developer mode is for engineers building with the CLI. It unlocks more advanced commands like creating or updating auth configs and connected accounts.'
250 + );
251 + lines.push('');
252 + }
253 return lines.join('\n');
254 }
255
@@ -275,15 +304,46 @@ function renderDevHelp(visibility: CommandVisibility): string {
304 ' This requires `developer.destructive_actions: true` in `~/.composio/config.json` and `--dangerously-allow` on the command line.'
305 );
306 lines.push('');
278 - lines.push(bold('EXAMPLES'));
279 - lines.push(' composio dev --mode off');
280 - lines.push(' composio dev toolkits list');
281 - lines.push(
282 - ' composio dev playground-execute GMAIL_SEND_EMAIL --dangerously-allow -d \'{ recipient_email: "a@b.com" }\''
283 - );
284 - lines.push('');
307 + if (helpLevel !== 'simple') {
308 + lines.push(bold('EXAMPLES'));
309 + lines.push(' composio dev --mode off');
310 + lines.push(' composio dev toolkits list');
311 + lines.push(
312 + ' composio dev playground-execute GMAIL_SEND_EMAIL --dangerously-allow -d \'{ recipient_email: "a@b.com" }\''
313 + );
314 + lines.push('');
315 + }
316 return lines.join('\n');
317 }
318 +export const HELP_LEVELS = [
319 + 'simple',
320 + 'default',
321 + 'full',
322 +] as const satisfies ReadonlyArray<HelpLevel>;
323 +
324 +export const parseHelpLevel = (token: string | undefined): HelpLevel | undefined => {
325 + if (!token) {
326 + return undefined;
327 + }
328 + if (token === 'verbose') {
329 + return 'full';
330 + }
331 + return HELP_LEVELS.find(level => level === token);
332 +};
333 +
334 +const splitTrailingHelpLevel = (
335 + args: ReadonlyArray<string>
336 +): { args: ReadonlyArray<string>; helpLevel: HelpLevel } => {
337 + const trailingLevel = parseHelpLevel(args[args.length - 1]);
338 + if (!trailingLevel) {
339 + return { args, helpLevel: 'default' };
340 + }
341 +
342 + return {
343 + args: args.slice(0, -1),
344 + helpLevel: trailingLevel,
345 + };
346 +};
347
348 // ── Subcommand help definitions ────────────────────────────────────────
349
@@ -1061,7 +1121,8 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
1121
1122 const getVisibleSubcommandHelp = (
1123 cmd: string,
1064 - visibility: CommandVisibility
1124 + visibility: CommandVisibility,
1125 + helpLevel: HelpLevel = 'default'
1126 ): Option.Option<SubcommandHelp> => {
1127 if (cmd === 'dev') {
1128 return Option.some({
@@ -1083,16 +1144,13 @@ const getVisibleSubcommandHelp = (
1144 return Option.some(entry);
1145 }
1146
1086 - if (!entry.tags || entry.tags.length === 0) {
1087 - return Option.some(entry.value);
1088 - }
1089 -
1090 - return entry.tags.every(tag => visibility.isExperimentalFeatureEnabled(tag))
1147 + return isTaggedValueVisible(entry, visibility) &&
1148 + isTaggedValueVisibleForHelpLevel(entry, helpLevel)
1149 ? Option.some(entry.value)
1150 : Option.none();
1151 };
1152
1095 -function renderSubcommandHelp(cmd: SubcommandHelp): string {
1153 +function renderSubcommandHelp(cmd: SubcommandHelp, helpLevel: HelpLevel): string {
1154 const lines: string[] = [
1155 '',
1156 bold('USAGE'),
@@ -1127,7 +1185,7 @@ function renderSubcommandHelp(cmd: SubcommandHelp): string {
1185 lines.push('');
1186 }
1187
1130 - if (cmd.injectedHelpers && cmd.injectedHelpers.length > 0) {
1188 + if (helpLevel !== 'simple' && cmd.injectedHelpers && cmd.injectedHelpers.length > 0) {
1189 lines.push(bold('INJECTED HELPERS'));
1190 const maxLen = Math.max(...cmd.injectedHelpers.map(h => h.name.length));
1191 for (const helper of cmd.injectedHelpers) {
@@ -1136,7 +1194,7 @@ function renderSubcommandHelp(cmd: SubcommandHelp): string {
1194 lines.push('');
1195 }
1196
1139 - if (cmd.examples && cmd.examples.length > 0) {
1197 + if (helpLevel !== 'simple' && cmd.examples && cmd.examples.length > 0) {
1198 lines.push(bold('EXAMPLES'));
1199 for (const ex of cmd.examples) {
1200 lines.push(` ${ex}`);
@@ -1144,7 +1202,7 @@ function renderSubcommandHelp(cmd: SubcommandHelp): string {
1202 lines.push('');
1203 }
1204
1147 - if (cmd.seeAlso && cmd.seeAlso.length > 0) {
1205 + if (helpLevel !== 'simple' && cmd.seeAlso && cmd.seeAlso.length > 0) {
1206 lines.push(bold('SEE ALSO'));
1207 for (const sa of cmd.seeAlso) {
1208 lines.push(` ${sa}`);
@@ -1163,7 +1221,7 @@ export function matchSubcommandHelp(
1221 argv: ReadonlyArray<string>,
1222 visibility: CommandVisibility
1223 ): string | undefined {
1166 - const args = argv.slice(2);
1224 + const { args } = splitTrailingHelpLevel(argv.slice(2));
1225 if (args.length < 2) return undefined;
1226 const last = args[args.length - 1];
1227 if (last !== '--help' && last !== '-h') return undefined;
@@ -1179,12 +1237,13 @@ export function matchSubcommandHelp(
1237
1238 export function printSubcommandHelp(
1239 cmd: string,
1182 - visibility: CommandVisibility
1240 + visibility: CommandVisibility,
1241 + helpLevel: HelpLevel = 'default'
1242 ): Effect.Effect<void> {
1184 - if (cmd === 'dev') return Console.log(renderDevHelp(visibility));
1185 - const help = getVisibleSubcommandHelp(cmd, visibility);
1243 + if (cmd === 'dev') return Console.log(renderDevHelp(visibility, helpLevel));
1244 + const help = getVisibleSubcommandHelp(cmd, visibility, helpLevel);
1245 if (Option.isNone(help)) return Console.log(`Unknown command: ${cmd}`);
1187 - return Console.log(renderSubcommandHelp(help.value));
1246 + return Console.log(renderSubcommandHelp(help.value, helpLevel));
1247 }
1248
1249 /**
@@ -1195,7 +1254,8 @@ export function matchCommandFromArgv(
1254 argv: ReadonlyArray<string>,
1255 visibility: CommandVisibility
1256 ): string | undefined {
1198 - const args = argv.slice(2).filter(a => a !== '--help' && a !== '-h' && !a.startsWith('--'));
1257 + const { args: helpArgs } = splitTrailingHelpLevel(argv.slice(2));
1258 + const args = helpArgs.filter(a => a !== '--help' && a !== '-h' && !a.startsWith('--'));
1259 // Try longest match first: "dev toolkits list" → "dev toolkits" → "dev"
1260 for (let len = Math.min(args.length, 3); len > 0; len--) {
1261 const key = args.slice(0, len).join(' ');
@@ -1211,7 +1271,7 @@ export function getCommandHelpText(cmd: string, visibility: CommandVisibility):
1271 if (cmd === 'dev') return renderDevHelp(visibility);
1272 return Option.match(getVisibleSubcommandHelp(cmd, visibility), {
1273 onNone: () => undefined,
1214 - onSome: help => renderSubcommandHelp(help),
1274 + onSome: help => renderSubcommandHelp(help, 'default'),
1275 });
1276 }
1277
@@ -1222,7 +1282,10 @@ export function getCommandHelpText(cmd: string, visibility: CommandVisibility):
1282 * Core workflow commands are shown first with full usage/options.
1283 * Housekeeping and developer commands are shown compactly at the bottom.
1284 */
1225 -export function printRootHelp(visibility: CommandVisibility): Effect.Effect<void> {
1285 +export function printRootHelp(
1286 + visibility: CommandVisibility,
1287 + helpLevel: HelpLevel = 'default'
1288 +): Effect.Effect<void> {
1289 const name = 'composio';
1290 const developerCommands: ReadonlyArray<CompactCommand> = [
1291 {
@@ -1233,6 +1296,59 @@ export function printRootHelp(visibility: CommandVisibility): Effect.Effect<void
1296 },
1297 GENERATE_COMMAND.value,
1298 ];
1299 + const coreCommands = visibleValues(CORE_COMMANDS, visibility, helpLevel);
1300 + const otherCommands = visibleValues(OTHER_COMMANDS, visibility, helpLevel);
1301 + const accountCommands = visibleValues(ACCOUNT_COMMANDS, visibility, helpLevel);
1302 + const fullCommands = visibleValues(FULL_COMMANDS, visibility, helpLevel);
1303 + const exampleLines =
1304 + helpLevel === 'simple'
1305 + ? [
1306 + ` ${dim('# Find tools')}`,
1307 + ` ${name} search "send an email"`,
1308 + '',
1309 + ` ${dim('# Execute a tool')}`,
1310 + ` ${name} execute GITHUB_CREATE_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'`,
1311 + '',
1312 + ` ${dim('# Connect an account when execute tells you to')}`,
1313 + ` ${name} link github`,
1314 + '',
1315 + ]
1316 + : [
1317 + ` ${dim('# Find tools — supports multiple queries at once')}`,
1318 + ` ${name} search "send an email" "create github issue"`,
1319 + ` ${name} search "list calendar events" --toolkits google_calendar --limit 5`,
1320 + '',
1321 + ` ${dim('# Connect your account for a toolkit')}`,
1322 + ` ${name} link github`,
1323 + '',
1324 + ` ${dim('# Execute a tool')}`,
1325 + ` ${name} execute GITHUB_CREATE_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'`,
1326 + '',
1327 + ` ${dim('# Execute multiple tools in parallel')}`,
1328 + ` ${name} execute -p GMAIL_SEND_EMAIL -d '{ recipient_email: "a@b.com", subject: "Hi" }' \\`,
1329 + ` SLACK_SEND_A_MESSAGE_TO_A_SLACK_CHANNEL -d '{ channel: "general", text: "Hello" }'`,
1330 + '',
1331 + ` ${dim('# Call an API directly through proxy')}`,
1332 + ` ${name} proxy https://gmail.googleapis.com/gmail/v1/users/me/profile --toolkit gmail`,
1333 + '',
1334 + ` ${dim('# Run a script with injected helpers')}`,
1335 + ` ${name} run 'const me = await execute("GITHUB_GET_THE_AUTHENTICATED_USER"); console.log(me)'`,
1336 + '',
1337 + ` ${dim('# Manually install the composio skill when auto-install fails')}`,
1338 + ` ${name} --instal-skill claude`,
1339 + ` ${name} --instal-skill composio-cli codex`,
1340 + '',
1341 + ` ${dim('# Run a multi-step script with Promise.all')}`,
1342 + ` ${name} run '`,
1343 + ` const [emails, issues] = await Promise.all([`,
1344 + ` execute("GMAIL_FETCH_EMAILS", { max_results: 5 }),`,
1345 + ` execute("GITHUB_LIST_REPOSITORY_ISSUES", { owner: "acme", repo: "app", state: "open" }),`,
1346 + ` ]);`,
1347 + ` const brief = await experimental_subAgent(\`Summarize:\\n\${emails.prompt()}\\n\${issues.prompt()}\`);`,
1348 + ` console.log(brief);`,
1349 + ` '`,
1350 + '',
1351 + ];
1352
1353 const lines: string[] = [
1354 '',
@@ -1250,55 +1366,30 @@ export function printRootHelp(visibility: CommandVisibility): Effect.Effect<void
1366 '',
1367 bold('USAGE'),
1368 ` ${name} <command> [options]`,
1369 + ` ${name} --help [simple|default|full]`,
1370 + '',
1371 + bold('MODE'),
1372 + ` ${helpLevel} help`,
1373 '',
1374 bold('CORE COMMANDS'),
1255 - ...renderDetailedCommands(name, visibleValues(CORE_COMMANDS, visibility)),
1375 + ...renderDetailedCommands(name, coreCommands),
1376 gray(' Typical flow: search → execute (link and tools when needed)'),
1377 '',
1258 - bold('TOOLS'),
1259 - ...renderCompactCommands(visibleValues(OTHER_COMMANDS, visibility)),
1378 + ...(otherCommands.length > 0
1379 + ? [bold('TOOLS'), ...renderCompactCommands(otherCommands), '']
1380 + : []),
1381 '',
1382 bold('EXAMPLES'),
1262 - ` ${dim('# Find tools — supports multiple queries at once')}`,
1263 - ` ${name} search "send an email" "create github issue"`,
1264 - ` ${name} search "list calendar events" --toolkits google_calendar --limit 5`,
1265 - '',
1266 - ` ${dim('# Connect your account for a toolkit')}`,
1267 - ` ${name} link github`,
1268 - '',
1269 - ` ${dim('# Execute a tool')}`,
1270 - ` ${name} execute GITHUB_CREATE_ISSUE -d '{ owner: "acme", repo: "app", title: "Bug" }'`,
1271 - '',
1272 - ` ${dim('# Execute multiple tools in parallel')}`,
1273 - ` ${name} execute -p GMAIL_SEND_EMAIL -d '{ recipient_email: "a@b.com", subject: "Hi" }' \\`,
1274 - ` SLACK_SEND_A_MESSAGE_TO_A_SLACK_CHANNEL -d '{ channel: "general", text: "Hello" }'`,
1275 - '',
1276 - ` ${dim('# Call an API directly through proxy')}`,
1277 - ` ${name} proxy https://gmail.googleapis.com/gmail/v1/users/me/profile --toolkit gmail`,
1278 - '',
1279 - ` ${dim('# Run a script with injected helpers')}`,
1280 - ` ${name} run 'const me = await execute("GITHUB_GET_THE_AUTHENTICATED_USER"); console.log(me)'`,
1281 - '',
1282 - ` ${dim('# Manually install the composio skill when auto-install fails')}`,
1283 - ` ${name} --instal-skill claude`,
1284 - ` ${name} --instal-skill composio-cli codex`,
1285 - '',
1286 - ` ${dim('# Run a multi-step script with Promise.all')}`,
1287 - ` ${name} run '`,
1288 - ` const [emails, issues] = await Promise.all([`,
1289 - ` execute("GMAIL_FETCH_EMAILS", { max_results: 5 }),`,
1290 - ` execute("GITHUB_LIST_REPOSITORY_ISSUES", { owner: "acme", repo: "app", state: "open" }),`,
1291 - ` ]);`,
1292 - ` const brief = await experimental_subAgent(\`Summarize:\\n\${emails.prompt()}\\n\${issues.prompt()}\`);`,
1293 - ` console.log(brief);`,
1294 - ` '`,
1295 - '',
1296 - bold('DEVELOPER COMMANDS'),
1297 - ...renderCompactCommands(developerCommands),
1298 - '',
1299 - bold('ACCOUNT'),
1300 - ...renderCompactCommands(visibleValues(ACCOUNT_COMMANDS, visibility)),
1301 - '',
1383 + ...exampleLines,
1384 + ...(developerCommands.length > 0
1385 + ? [bold('DEVELOPER COMMANDS'), ...renderCompactCommands(developerCommands), '']
1386 + : []),
1387 + ...(accountCommands.length > 0
1388 + ? [bold('ACCOUNT'), ...renderCompactCommands(accountCommands), '']
1389 + : []),
1390 + ...(fullCommands.length > 0
1391 + ? [bold('MORE COMMANDS'), ...renderCompactCommands(fullCommands), '']
1392 + : []),
1393 bold('FILES') + dim(' (composio files --help)'),
1394 ` ${bold('~/.composio/')}`,
1395 ` CLI configuration and cache directory. Contains your auth state`,
@@ -1315,7 +1406,7 @@ export function printRootHelp(visibility: CommandVisibility): Effect.Effect<void
1406 ` the current directory's session.`,
1407 '',
1408 bold('FLAGS'),
1318 - ' -h, --help Show help for command',
1409 + ' -h, --help [mode] Show help for command (simple, default, full)',
1410 ` --version Show ${name} version`,
1411 ' --instal-skill [skill-name] <claude|codex|openclaw>',
1412 ' Manually install the composio skill for a supported agent',
ts/packages/cli/test/src/commands/$default.cmd.test.ts
+33 -1
@@ -71,7 +71,7 @@ describe('CLI: composio', () => {
71 const output = lines.join('\n');
72 expect(output).toContain('Usage:');
73 expect(output).toContain('composio');
74 - expect(output).toContain('composio connections list');
74 + expect(output).not.toContain('composio connections list');
75 })
76 );
77 });
@@ -85,6 +85,38 @@ describe('CLI: composio', () => {
85 const output = lines.join('\n');
86 expect(output.trim().length).toBeGreaterThan(0);
87 expect(output).toContain('config.json');
88 + expect(output).not.toContain('connections list');
89 + })
90 + );
91 + });
92 +
93 + layer(TestLive())(it => {
94 + it.scoped('[Given] --help simple [Then] prints the compact root help mode', () =>
95 + Effect.gen(function* () {
96 + yield* cli(['--help', 'simple']);
97 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
98 + const output = lines.join('\n');
99 +
100 + expect(output).toContain('simple help');
101 + expect(output).toContain('composio --help [simple|default|full]');
102 + expect(output).not.toContain('composio run');
103 + expect(output).not.toContain('MORE COMMANDS');
104 + })
105 + );
106 + });
107 +
108 + layer(TestLive())(it => {
109 + it.scoped('[Given] --help full [Then] prints the expanded root help mode', () =>
110 + Effect.gen(function* () {
111 + yield* cli(['--help', 'full']);
112 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
113 + const output = lines.join('\n');
114 +
115 + expect(output).toContain('full help');
116 + expect(output).toContain('MORE COMMANDS');
117 + expect(output).toContain('dev playground-execute');
118 + expect(output).toContain('generate ts');
119 + expect(output).toContain('connections list');
120 })
121 );
122 });
ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.list.cmd.test.ts
+42 -7
@@ -1,6 +1,7 @@
1 import { describe, expect, layer } from '@effect/vitest';
2 import { ConfigProvider, Effect } from 'effect';
3 import { extendConfigProvider } from 'src/services/config';
4 +import { ComposioUserContext } from 'src/services/user-context';
5 import { cli, TestLive, MockConsole } from 'test/__utils__';
6 import type { TestLiveInput } from 'test/__utils__/services/test-layer';
7 import type { ConnectedAccountItem } from 'src/models/connected-accounts';
@@ -67,12 +68,22 @@ const testConfigProvider = ConfigProvider.fromMap(
68 new Map([['COMPOSIO_USER_API_KEY', 'test_api_key']])
69 ).pipe(extendConfigProvider);
70
71 +const testDevConfigProvider = ConfigProvider.fromMap(
72 + new Map([
73 + ['COMPOSIO_USER_API_KEY', 'test_api_key'],
74 + ['COMPOSIO_ORG_ID', 'dev_org_test'],
75 + ['COMPOSIO_PROJECT_ID', 'dev_project_test'],
76 + ])
77 +).pipe(extendConfigProvider);
78 +
79 describe('CLI: composio dev connected-accounts list', () => {
71 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
80 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
81 '[Given] no flags [Then] lists all connected accounts',
82 it => {
83 it.scoped('lists all connected accounts with table', () =>
84 Effect.gen(function* () {
85 + const userContext = yield* ComposioUserContext;
86 + yield* userContext.login('test_api_key', 'org_test');
87 yield* cli(['dev', 'connected-accounts', 'list']);
88 const lines = yield* MockConsole.getLines({ stripAnsi: true });
89 const output = lines.join('\n');
@@ -86,11 +97,13 @@ describe('CLI: composio dev connected-accounts list', () => {
97 }
98 );
99
89 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
100 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
101 '[Given] --toolkits "gmail" [Then] lists only gmail connected accounts',
102 it => {
103 it.scoped('filters by toolkit', () =>
104 Effect.gen(function* () {
105 + const userContext = yield* ComposioUserContext;
106 + yield* userContext.login('test_api_key', 'org_test');
107 yield* cli(['dev', 'connected-accounts', 'list', '--toolkits', 'gmail']);
108 const lines = yield* MockConsole.getLines({ stripAnsi: true });
109 const output = lines.join('\n');
@@ -103,11 +116,13 @@ describe('CLI: composio dev connected-accounts list', () => {
116 }
117 );
118
106 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
119 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
120 '[Given] --user-id "default" [Then] lists only default user accounts',
121 it => {
122 it.scoped('filters by user ID', () =>
123 Effect.gen(function* () {
124 + const userContext = yield* ComposioUserContext;
125 + yield* userContext.login('test_api_key', 'org_test');
126 yield* cli(['dev', 'connected-accounts', 'list', '--user-id', 'default']);
127 const lines = yield* MockConsole.getLines({ stripAnsi: true });
128 const output = lines.join('\n');
@@ -121,11 +136,13 @@ describe('CLI: composio dev connected-accounts list', () => {
136 }
137 );
138
124 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
139 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
140 '[Given] --status ACTIVE [Then] lists only active accounts',
141 it => {
142 it.scoped('filters by status', () =>
143 Effect.gen(function* () {
144 + const userContext = yield* ComposioUserContext;
145 + yield* userContext.login('test_api_key', 'org_test');
146 yield* cli(['dev', 'connected-accounts', 'list', '--status', 'ACTIVE']);
147 const lines = yield* MockConsole.getLines({ stripAnsi: true });
148 const output = lines.join('\n');
@@ -139,11 +156,13 @@ describe('CLI: composio dev connected-accounts list', () => {
156 }
157 );
158
142 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
159 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
160 '[Given] --limit 1 [Then] respects limit',
161 it => {
162 it.scoped('respects limit', () =>
163 Effect.gen(function* () {
164 + const userContext = yield* ComposioUserContext;
165 + yield* userContext.login('test_api_key', 'org_test');
166 yield* cli(['dev', 'connected-accounts', 'list', '--limit', '1']);
167 const lines = yield* MockConsole.getLines({ stripAnsi: true });
168 const output = lines.join('\n');
@@ -154,6 +173,18 @@ describe('CLI: composio dev connected-accounts list', () => {
173 }
174 );
175
176 + layer(TestLive({ baseConfigProvider: testDevConfigProvider }))(
177 + '[Given] no org in user context [Then] warns user to login',
178 + it => {
179 + it.scoped('warns user to login', () =>
180 + Effect.gen(function* () {
181 + const error = yield* Effect.flip(cli(['dev', 'connected-accounts', 'list']));
182 + expect(String(error)).toContain('No default org configured');
183 + })
184 + );
185 + }
186 + );
187 +
188 layer(TestLive())('[Given] no API key [Then] warns user to login', it => {
189 it.scoped('warns user to login', () =>
190 Effect.gen(function* () {
@@ -166,11 +197,13 @@ describe('CLI: composio dev connected-accounts list', () => {
197 );
198 });
199
169 - layer(TestLive({ baseConfigProvider: testConfigProvider }))(
200 + layer(TestLive({ baseConfigProvider: testDevConfigProvider }))(
201 '[Given] empty results [Then] shows no connected accounts found',
202 it => {
203 it.scoped('shows no connected accounts found', () =>
204 Effect.gen(function* () {
205 + const userContext = yield* ComposioUserContext;
206 + yield* userContext.login('test_api_key', 'org_test');
207 yield* cli(['dev', 'connected-accounts', 'list']);
208 const lines = yield* MockConsole.getLines({ stripAnsi: true });
209 const output = lines.join('\n');
@@ -181,11 +214,13 @@ describe('CLI: composio dev connected-accounts list', () => {
214 }
215 );
216
184 - layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(
217 + layer(TestLive({ baseConfigProvider: testDevConfigProvider, connectedAccountsData }))(
218 '[Given] --toolkits "nonexistent" [Then] shows hint about toolkit slug',
219 it => {
220 it.scoped('shows toolkit hint', () =>
221 Effect.gen(function* () {
222 + const userContext = yield* ComposioUserContext;
223 + yield* userContext.login('test_api_key', 'org_test');
224 yield* cli(['dev', 'connected-accounts', 'list', '--toolkits', 'nonexistent']);
225 const lines = yield* MockConsole.getLines({ stripAnsi: true });
226 const output = lines.join('\n');
ts/packages/cli/test/src/commands/connections/connections.list.cmd.test.ts
+84 -9
@@ -2,6 +2,7 @@ import { describe, expect, layer } from '@effect/vitest';
2 import { ConfigProvider, Effect } from 'effect';
3 import type { ConnectedAccountItem } from 'src/models/connected-accounts';
4 import { extendConfigProvider } from 'src/services/config';
5 +import { ComposioUserContext } from 'src/services/user-context';
6 import { cli, TestLive, MockConsole } from 'test/__utils__';
7 import type { TestLiveInput } from 'test/__utils__/services/test-layer';
8
@@ -26,7 +27,7 @@ const testConnections: ConnectedAccountItem[] = [
27 status: 'ACTIVE',
28 status_reason: null,
29 is_disabled: false,
29 - user_id: 'default',
30 + user_id: 'consumer-user-org_test',
31 toolkit: { slug: 'gmail' },
32 auth_config: {
33 id: 'ac_gmail_oauth',
@@ -41,11 +42,11 @@ const testConnections: ConnectedAccountItem[] = [
42 {
43 id: 'con_github_work',
44 alias: 'work',
44 - word_id: null,
45 + word_id: 'castle',
46 status: 'ACTIVE',
47 status_reason: null,
48 is_disabled: false,
48 - user_id: 'default',
49 + user_id: 'consumer-user-org_test',
50 toolkit: { slug: 'github' },
51 auth_config: {
52 id: 'ac_github_oauth',
@@ -60,11 +61,11 @@ const testConnections: ConnectedAccountItem[] = [
61 {
62 id: 'con_github_personal',
63 alias: 'personal',
63 - word_id: null,
64 + word_id: 'forest',
65 status: 'FAILED',
66 status_reason: 'Token expired',
67 is_disabled: false,
67 - user_id: 'default',
68 + user_id: 'consumer-user-org_test',
69 toolkit: { slug: 'github' },
70 auth_config: {
71 id: 'ac_github_oauth_2',
@@ -90,6 +91,8 @@ describe('CLI: composio connections list', () => {
91 layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(it => {
92 it.scoped('[Given] no filter [Then] prints connection JSON with aliases for duplicates', () =>
93 Effect.gen(function* () {
94 + const userContext = yield* ComposioUserContext;
95 + yield* userContext.login('test_api_key', 'org_test');
96 yield* cli(['connections', 'list']);
97
98 const lines = yield* MockConsole.getLines({ stripAnsi: true });
@@ -98,8 +101,35 @@ describe('CLI: composio connections list', () => {
101 expect(parsed).toEqual({
102 gmail: [{ status: 'ACTIVE' }],
103 github: [
101 - { status: 'ACTIVE', alias: 'work' },
102 - { status: 'FAILED', alias: 'personal' },
104 + { status: 'ACTIVE', alias: 'work', word_id: 'castle' },
105 + { status: 'FAILED', alias: 'personal', word_id: 'forest' },
106 + ],
107 + });
108 + })
109 + );
110 + });
111 +
112 + layer(
113 + TestLive({
114 + baseConfigProvider: testConfigProvider,
115 + connectedAccountsData,
116 + stdin: { isTTY: true, data: '' },
117 + })
118 + )(it => {
119 + it.scoped('[Given] interactive stdout [Then] still prints the JSON payload', () =>
120 + Effect.gen(function* () {
121 + const userContext = yield* ComposioUserContext;
122 + yield* userContext.login('test_api_key', 'org_test');
123 + yield* cli(['connections', 'list']);
124 +
125 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
126 + const parsed = parseJsonFromLines(lines);
127 +
128 + expect(parsed).toEqual({
129 + gmail: [{ status: 'ACTIVE' }],
130 + github: [
131 + { status: 'ACTIVE', alias: 'work', word_id: 'castle' },
132 + { status: 'FAILED', alias: 'personal', word_id: 'forest' },
133 ],
134 });
135 })
@@ -109,6 +139,8 @@ describe('CLI: composio connections list', () => {
139 layer(TestLive({ baseConfigProvider: testConfigProvider, connectedAccountsData }))(it => {
140 it.scoped('[Given] --toolkit github [Then] filters the JSON output', () =>
141 Effect.gen(function* () {
142 + const userContext = yield* ComposioUserContext;
143 + yield* userContext.login('test_api_key', 'org_test');
144 yield* cli(['connections', 'list', '--toolkit', 'github']);
145
146 const lines = yield* MockConsole.getLines({ stripAnsi: true });
@@ -116,11 +148,54 @@ describe('CLI: composio connections list', () => {
148
149 expect(parsed).toEqual({
150 github: [
119 - { status: 'ACTIVE', alias: 'work' },
120 - { status: 'FAILED', alias: 'personal' },
151 + { status: 'ACTIVE', alias: 'work', word_id: 'castle' },
152 + { status: 'FAILED', alias: 'personal', word_id: 'forest' },
153 ],
154 });
155 })
156 );
157 });
158 +
159 + layer(
160 + TestLive({
161 + baseConfigProvider: testConfigProvider,
162 + connectedAccountsData: {
163 + items: [
164 + ...testConnections,
165 + {
166 + id: 'con_slack_dev_only',
167 + alias: null,
168 + word_id: null,
169 + status: 'ACTIVE',
170 + status_reason: null,
171 + is_disabled: false,
172 + user_id: 'developer-user-org_test',
173 + toolkit: { slug: 'slack' },
174 + auth_config: {
175 + id: 'ac_slack_oauth',
176 + auth_scheme: 'OAUTH2',
177 + is_composio_managed: true,
178 + is_disabled: false,
179 + },
180 + created_at: '2026-03-01T00:00:00Z',
181 + updated_at: '2026-03-05T00:00:00Z',
182 + test_request_endpoint: '',
183 + },
184 + ],
185 + },
186 + })
187 + )(it => {
188 + it.scoped('[Given] mixed user scopes [Then] only consumer-project connections are listed', () =>
189 + Effect.gen(function* () {
190 + const userContext = yield* ComposioUserContext;
191 + yield* userContext.login('test_api_key', 'org_test');
192 + yield* cli(['connections', 'list']);
193 +
194 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
195 + const parsed = parseJsonFromLines(lines);
196 +
197 + expect(parsed).not.toHaveProperty('slack');
198 + })
199 + );
200 + });
201 });
ts/packages/cli/test/src/commands/feature-visibility.test.ts
+29 -1
@@ -1,12 +1,15 @@
1 import { CommandDescriptor } from '@effect/cli';
2 -import { HashMap } from 'effect';
2 +import { layer } from '@effect/vitest';
3 +import { Effect, HashMap } from 'effect';
4 import { describe, expect, it } from 'vitest';
5 import { buildRootCommand } from 'src/commands';
6 import {
7 getCommandHelpText,
8 matchCommandFromArgv,
9 matchSubcommandHelp,
10 + printSubcommandHelp,
11 } from 'src/commands/root-help';
12 +import { MockConsole, TestLive } from 'test/__utils__';
13
14 const stableVisibility = {
15 isDevModeEnabled: true,
@@ -44,4 +47,29 @@ describe('CLI experimental feature visibility', () => {
47 expect(getCommandHelpText('listen', stableVisibility)).toBe(undefined);
48 expect(getCommandHelpText('listen', betaVisibility)).toContain('composio listen');
49 });
50 +
51 + it('accepts help mode suffixes when matching subcommand help', () => {
52 + expect(
53 + matchSubcommandHelp(['bun', 'composio', 'search', '--help', 'simple'], stableVisibility)
54 + ).toBe('search');
55 + expect(
56 + matchSubcommandHelp(['bun', 'composio', 'search', '--help', 'full'], stableVisibility)
57 + ).toBe('search');
58 + });
59 +});
60 +
61 +describe('CLI help levels', () => {
62 + layer(TestLive())(it => {
63 + it.scoped('renders compact subcommand help in simple mode', () =>
64 + Effect.gen(function* () {
65 + yield* printSubcommandHelp('run', stableVisibility, 'simple');
66 + const output = (yield* MockConsole.getLines({ stripAnsi: true })).join('\n');
67 +
68 + expect(output).toContain('USAGE');
69 + expect(output).toContain('DESCRIPTION');
70 + expect(output).not.toContain('EXAMPLES');
71 + expect(output).not.toContain('INJECTED HELPERS');
72 + })
73 + );
74 + });
75 });