@devries-cameron20 / composio-1 / commits / 2a7ac172d
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.

fix(cli): align triggers list/info with established CLI patterns

- Use handleHttpServerError in triggers info for consistent error handling - Use ui.note() instead of ui.log.info() for boxed detail display - Add "next step" hint in triggers list for discoverability - Fix singular/plural grammar in triggers list output - Add toolkit field to triggers list test data Co-Authored-By: Claude <noreply@anthropic.com>

jkomyno committed Feb 24, 2026 at 15:26 UTC 2a7ac172d419a221d33ad89996d8c6465dff1d60
3 files changed +46 -19
ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.ts
+14 -15
@@ -1,6 +1,7 @@
1 import { Args, Command } from '@effect/cli';
2 import { Effect, Option } from 'effect';
3 import { requireAuth } from 'src/effects/require-auth';
4 +import { handleHttpServerError } from 'src/effects/handle-http-error';
5 import { ComposioToolkitsRepository } from 'src/services/composio-clients';
6 import { TerminalUI } from 'src/services/terminal-ui';
7 import { formatTriggerTypeInfo } from '../format';
@@ -34,28 +35,26 @@ export const triggersCmd$Info = Command.make('info', { slug }, ({ slug }) =>
35 }
36
37 const slugValue = slug.value;
37 - const triggerType = yield* ui
38 +
39 + const triggerTypeOpt = yield* ui
40 .withSpinner('Fetching trigger type details...', repo.getTriggerTypeDetailed(slugValue))
41 .pipe(
40 - Effect.catchTag('services/HttpServerError', e =>
41 - Effect.if(e.status === 404, {
42 - onTrue: () =>
43 - ui.log
44 - .error(`Trigger "${slugValue}" not found.`)
45 - .pipe(
46 - Effect.zipRight(
47 - ui.log.step('Browse available trigger types:\n> composio triggers list')
48 - ),
49 - Effect.as(undefined)
50 - ),
51 - onFalse: () => Effect.fail(e),
42 + Effect.asSome,
43 + Effect.catchTag(
44 + 'services/HttpServerError',
45 + handleHttpServerError(ui, {
46 + fallbackMessage: `Trigger "${slugValue}" not found.`,
47 + hint: 'Browse available trigger types:\n> composio triggers list',
48 + fallbackValue: Option.none(),
49 })
50 )
51 );
52
56 - if (!triggerType) return;
53 + if (Option.isNone(triggerTypeOpt)) return;
54 +
55 + const triggerType = triggerTypeOpt.value;
56
58 - yield* ui.log.info(formatTriggerTypeInfo(triggerType));
57 + yield* ui.note(formatTriggerTypeInfo(triggerType), `Trigger: ${triggerType.name}`);
58
59 const toolkitSlug = triggerType.toolkit?.slug?.toLowerCase();
60 if (toolkitSlug) {
ts/packages/cli/src/commands/triggers/commands/triggers.list.cmd.ts
+10 -1
@@ -52,9 +52,18 @@ export const triggersCmd$List = Command.make('list', { toolkits, limit }, ({ too
52 return;
53 }
54
55 + const count = triggerTypes.length;
56 yield* ui.log.info(
56 - `Listing ${triggerTypes.length} trigger types\n\n${formatTriggerTypesTable(triggerTypes)}`
57 + `Listing ${count} trigger type${count === 1 ? '' : 's'}\n\n${formatTriggerTypesTable(triggerTypes)}`
58 );
59 +
60 + const firstSlug = triggerTypes[0]?.slug;
61 + if (firstSlug) {
62 + yield* ui.log.step(
63 + `To view details of a trigger type:\n> composio triggers info "${firstSlug}"`
64 + );
65 + }
66 +
67 yield* ui.output(formatTriggerTypesJson(triggerTypes));
68 })
69 ).pipe(Command.withDescription('List available trigger types.'));
ts/packages/cli/test/src/commands/triggers/triggers.list.cmd.test.ts
+22 -3
@@ -11,6 +11,7 @@ const testTriggerTypes: TriggerTypes = [
11 name: 'NEW_GMAIL_MESSAGE',
12 description: 'Fires when a new message arrives in Gmail',
13 instructions: 'Connect Gmail and subscribe to this trigger',
14 + toolkit: { name: 'Gmail', slug: 'gmail' },
15 type: 'webhook',
16 config: { type: 'object', properties: {} },
17 payload: { type: 'object', properties: {} },
@@ -20,6 +21,7 @@ const testTriggerTypes: TriggerTypes = [
21 name: 'NEW_LABEL',
22 description: 'Fires when a new label is created in Gmail',
23 instructions: 'Connect Gmail and subscribe to this trigger',
24 + toolkit: { name: 'Gmail', slug: 'gmail' },
25 type: 'poll',
26 config: { type: 'object', properties: {} },
27 payload: { type: 'object', properties: {} },
@@ -29,6 +31,7 @@ const testTriggerTypes: TriggerTypes = [
31 name: 'NEW_MESSAGE',
32 description: 'Fires when a new message is posted in Slack',
33 instructions: 'Connect Slack and subscribe to this trigger',
34 + toolkit: { name: 'Slack', slug: 'slack' },
35 type: 'webhook',
36 config: { type: 'object', properties: {} },
37 payload: { type: 'object', properties: {} },
@@ -80,15 +83,31 @@ describe('CLI: composio triggers list', () => {
83 );
84
85 layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(
83 - '[Given] --limit 1 [Then] lists one trigger type',
86 + '[Given] --limit 1 [Then] lists one trigger type with singular grammar',
87 it => {
85 - it.scoped('respects limit', () =>
88 + it.scoped('uses singular form for one result', () =>
89 Effect.gen(function* () {
90 yield* cli(['triggers', 'list', '--limit', '1']);
91 const lines = yield* MockConsole.getLines({ stripAnsi: true });
92 const output = lines.join('\n');
93
91 - expect(output).toContain('Listing 1 trigger types');
94 + expect(output).toContain('Listing 1 trigger type');
95 + expect(output).not.toContain('Listing 1 trigger types');
96 + })
97 + );
98 + }
99 + );
100 +
101 + layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(
102 + '[Given] no flags [Then] shows next step hint',
103 + it => {
104 + it.scoped('shows hint to view trigger details', () =>
105 + Effect.gen(function* () {
106 + yield* cli(['triggers', 'list']);
107 + const lines = yield* MockConsole.getLines({ stripAnsi: true });
108 + const output = lines.join('\n');
109 +
110 + expect(output).toContain('composio triggers info');
111 })
112 );
113 }