Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(cli): align triggers list/info with established CLI patterns
jkomyno2a7ac172d419
diff --git a/ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.ts b/ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.tsindex b7eae9635..e1b2e2801 100644--- a/ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.ts+++ b/ts/packages/cli/src/commands/triggers/commands/triggers.info.cmd.ts@@ -1,6 +1,7 @@import { Args, Command } from '@effect/cli';import { Effect, Option } from 'effect';import { requireAuth } from 'src/effects/require-auth';+import { handleHttpServerError } from 'src/effects/handle-http-error';import { ComposioToolkitsRepository } from 'src/services/composio-clients';import { TerminalUI } from 'src/services/terminal-ui';import { formatTriggerTypeInfo } from '../format';@@ -34,28 +35,26 @@ export const triggersCmd$Info = Command.make('info', { slug }, ({ slug }) =>}const slugValue = slug.value;- const triggerType = yield* ui++ const triggerTypeOpt = yield* ui.withSpinner('Fetching trigger type details...', repo.getTriggerTypeDetailed(slugValue)).pipe(- Effect.catchTag('services/HttpServerError', e =>- Effect.if(e.status === 404, {- onTrue: () =>- ui.log- .error(`Trigger "${slugValue}" not found.`)- .pipe(- Effect.zipRight(- ui.log.step('Browse available trigger types:\n> composio triggers list')- ),- Effect.as(undefined)- ),- onFalse: () => Effect.fail(e),+ Effect.asSome,+ Effect.catchTag(+ 'services/HttpServerError',+ handleHttpServerError(ui, {+ fallbackMessage: `Trigger "${slugValue}" not found.`,+ hint: 'Browse available trigger types:\n> composio triggers list',+ fallbackValue: Option.none(),})));- if (!triggerType) return;+ if (Option.isNone(triggerTypeOpt)) return;++ const triggerType = triggerTypeOpt.value;- yield* ui.log.info(formatTriggerTypeInfo(triggerType));+ yield* ui.note(formatTriggerTypeInfo(triggerType), `Trigger: ${triggerType.name}`);const toolkitSlug = triggerType.toolkit?.slug?.toLowerCase();if (toolkitSlug) {diff --git a/ts/packages/cli/src/commands/triggers/commands/triggers.list.cmd.ts b/ts/packages/cli/src/commands/triggers/commands/triggers.list.cmd.tsindex 1098ee581..0c401e978 100644--- a/ts/packages/cli/src/commands/triggers/commands/triggers.list.cmd.ts+++ b/ts/packages/cli/src/commands/triggers/commands/triggers.list.cmd.ts@@ -52,9 +52,18 @@ export const triggersCmd$List = Command.make('list', { toolkits, limit }, ({ tooreturn;}+ const count = triggerTypes.length;yield* ui.log.info(- `Listing ${triggerTypes.length} trigger types\n\n${formatTriggerTypesTable(triggerTypes)}`+ `Listing ${count} trigger type${count === 1 ? '' : 's'}\n\n${formatTriggerTypesTable(triggerTypes)}`);++ const firstSlug = triggerTypes[0]?.slug;+ if (firstSlug) {+ yield* ui.log.step(+ `To view details of a trigger type:\n> composio triggers info "${firstSlug}"`+ );+ }+yield* ui.output(formatTriggerTypesJson(triggerTypes));})).pipe(Command.withDescription('List available trigger types.'));diff --git a/ts/packages/cli/test/src/commands/triggers/triggers.list.cmd.test.ts b/ts/packages/cli/test/src/commands/triggers/triggers.list.cmd.test.tsindex 0b6669589..3a926f7e6 100644--- a/ts/packages/cli/test/src/commands/triggers/triggers.list.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/triggers/triggers.list.cmd.test.ts@@ -11,6 +11,7 @@ const testTriggerTypes: TriggerTypes = [name: 'NEW_GMAIL_MESSAGE',description: 'Fires when a new message arrives in Gmail',instructions: 'Connect Gmail and subscribe to this trigger',+ toolkit: { name: 'Gmail', slug: 'gmail' },type: 'webhook',config: { type: 'object', properties: {} },payload: { type: 'object', properties: {} },@@ -20,6 +21,7 @@ const testTriggerTypes: TriggerTypes = [name: 'NEW_LABEL',description: 'Fires when a new label is created in Gmail',instructions: 'Connect Gmail and subscribe to this trigger',+ toolkit: { name: 'Gmail', slug: 'gmail' },type: 'poll',config: { type: 'object', properties: {} },payload: { type: 'object', properties: {} },@@ -29,6 +31,7 @@ const testTriggerTypes: TriggerTypes = [name: 'NEW_MESSAGE',description: 'Fires when a new message is posted in Slack',instructions: 'Connect Slack and subscribe to this trigger',+ toolkit: { name: 'Slack', slug: 'slack' },type: 'webhook',config: { type: 'object', properties: {} },payload: { type: 'object', properties: {} },@@ -80,15 +83,31 @@ describe('CLI: composio triggers list', () => {);layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(- '[Given] --limit 1 [Then] lists one trigger type',+ '[Given] --limit 1 [Then] lists one trigger type with singular grammar',it => {- it.scoped('respects limit', () =>+ it.scoped('uses singular form for one result', () =>Effect.gen(function* () {yield* cli(['triggers', 'list', '--limit', '1']);const lines = yield* MockConsole.getLines({ stripAnsi: true });const output = lines.join('\n');- expect(output).toContain('Listing 1 trigger types');+ expect(output).toContain('Listing 1 trigger type');+ expect(output).not.toContain('Listing 1 trigger types');+ })+ );+ }+ );++ layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(+ '[Given] no flags [Then] shows next step hint',+ it => {+ it.scoped('shows hint to view trigger details', () =>+ Effect.gen(function* () {+ yield* cli(['triggers', 'list']);+ const lines = yield* MockConsole.getLines({ stripAnsi: true });+ const output = lines.join('\n');++ expect(output).toContain('composio triggers info');}));}