Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Merge origin/next into haxzie/feat/trigger-status-cmd-2026-02-23

jkomynod7d4a2f7c380
diff --cc ts/packages/cli/src/commands/triggers/format.ts
index 8841d9429,dd46cf8fe..5f1d1ed04
--- a/ts/packages/cli/src/commands/triggers/format.ts
+++ b/ts/packages/cli/src/commands/triggers/format.ts
@@@ -1,7 -1,8 +1,9 @@@
+ import type { TriggerType } from 'src/models/trigger-types';
import type { TriggerListenEvent } from './types';
+import type { TriggerInstanceItem } from 'src/models/triggers';
import { bold, gray } from 'src/ui/colors';
import { truncate } from 'src/ui/truncate';
+ import { extractSchemaProperties } from 'src/ui/extract-schema-properties';
export const formatTriggerListenSummary = (event: TriggerListenEvent): string => {
const userId = event.userId || '-';
@@@ -58,70 -59,97 +60,165 @@@ export const formatTriggerListenTableRo
].join(' ');
};
+ const TRIGGER_TYPES_TABLE = {
+ slug: 35,
+ name: 26,
+ type: 8,
+ } as const;
+
+ export const formatTriggerTypesTable = (triggerTypes: ReadonlyArray<TriggerType>): string => {
+ const header = [
+ bold('Slug'.padEnd(TRIGGER_TYPES_TABLE.slug)),
+ bold('Name'.padEnd(TRIGGER_TYPES_TABLE.name)),
+ bold('Type'.padEnd(TRIGGER_TYPES_TABLE.type)),
+ bold('Description'),
+ ].join(' ');
+
+ const rows = triggerTypes.map(triggerType => {
+ const slug = truncate(triggerType.slug, TRIGGER_TYPES_TABLE.slug).padEnd(
+ TRIGGER_TYPES_TABLE.slug
+ );
+ const name = truncate(triggerType.name, TRIGGER_TYPES_TABLE.name).padEnd(
+ TRIGGER_TYPES_TABLE.name
+ );
+ const type = truncate(triggerType.type, TRIGGER_TYPES_TABLE.type).padEnd(
+ TRIGGER_TYPES_TABLE.type
+ );
+ const description = gray(truncate(triggerType.description, 50));
+ return `${slug} ${name} ${type} ${description}`;
+ });
+
+ return [header, ...rows].join('\n');
+ };
+
+ export const formatTriggerTypesJson = (triggerTypes: ReadonlyArray<TriggerType>): string =>
+ JSON.stringify(
+ triggerTypes.map(triggerType => ({
+ slug: triggerType.slug,
+ name: triggerType.name,
+ type: triggerType.type,
+ description: triggerType.description,
+ })),
+ null,
+ 2
+ );
+
+ function formatSchemaProperties(schema: Record<string, unknown>): string {
+ const entries = extractSchemaProperties(schema);
+ if (entries.length === 0) {
+ return ' (none)';
+ }
+
+ const typeWidth = Math.max(...entries.map(e => e.type.length));
+ const labelWidth = Math.max(...entries.map(e => e.label.length));
+ const metadataLabels = ['description:', 'type:', 'required:', 'default:'] as const;
+ const metadataLabelWidth = Math.max(...metadataLabels.map(label => label.length));
+
+ return entries
+ .map(e => {
+ const lines: string[] = [];
+ lines.push(` ${bold(e.name)}`);
+ lines.push(
+ ` ${'description:'.padEnd(metadataLabelWidth)} ${e.description ? gray(truncate(e.description, 70)) : '-'}`
+ );
+ lines.push(` ${'type:'.padEnd(metadataLabelWidth)} ${e.type.padEnd(typeWidth)}`);
+ lines.push(` ${'required:'.padEnd(metadataLabelWidth)} ${e.label.padEnd(labelWidth)}`);
+ if (e.hasDefault) {
+ lines.push(
+ ` ${'default:'.padEnd(metadataLabelWidth)} ${gray(truncate(JSON.stringify(e.defaultValue), 40))}`
+ );
+ }
+ return lines.join('\n');
+ })
+ .join('\n\n');
+ }
+
+ export const formatTriggerTypeInfo = (triggerType: TriggerType): string => {
+ const lines: string[] = [];
+
+ lines.push(`${bold('Name:')} ${triggerType.name}`);
+ lines.push(`${bold('Slug:')} ${triggerType.slug}`);
+ lines.push(`${bold('Type:')} ${triggerType.type}`);
+ lines.push(`${bold('Description:')} ${triggerType.description}`);
+ lines.push(`${bold('Instructions:')} ${triggerType.instructions}`);
+
+ lines.push('');
+ lines.push(gray('------------------------------'));
+ lines.push(bold('Config Fields:'));
+ lines.push(formatSchemaProperties(triggerType.config));
+
+ lines.push('');
+ lines.push(gray('------------------------------'));
+ lines.push(bold('Payload Fields:'));
+ lines.push(formatSchemaProperties(triggerType.payload));
+
+ return lines.join('\n');
+ };
++
+const TRIGGER_STATUS_TABLE = {
+ id: 20,
+ triggerName: 26,
+ toolkit: 10,
+ userId: 16,
+ connectedAccountId: 22,
+ status: 10,
+} as const;
+
+const toStatus = (item: TriggerInstanceItem): string =>
+ item.disabled_at === null ? 'ACTIVE' : 'DISABLED';
+
+export const toolkitSlugFromTriggerName = (triggerName: string): string => {
+ const prefix = triggerName.split('_')[0];
+ return prefix ? prefix.toLowerCase() : '-';
+};
+
+export const formatTriggersStatusTable = (items: ReadonlyArray<TriggerInstanceItem>): string => {
+ const header = [
+ bold('Trigger Id'.padEnd(TRIGGER_STATUS_TABLE.id)),
+ bold('Trigger Name'.padEnd(TRIGGER_STATUS_TABLE.triggerName)),
+ bold('Toolkit'.padEnd(TRIGGER_STATUS_TABLE.toolkit)),
+ bold('User Id'.padEnd(TRIGGER_STATUS_TABLE.userId)),
+ bold('Connected Account'.padEnd(TRIGGER_STATUS_TABLE.connectedAccountId)),
+ bold('Status'),
+ ].join(' ');
+
+ const rows = items.map(item => {
+ const status = toStatus(item);
+ return [
+ truncate(item.id, TRIGGER_STATUS_TABLE.id).padEnd(TRIGGER_STATUS_TABLE.id),
+ truncate(item.trigger_name, TRIGGER_STATUS_TABLE.triggerName).padEnd(
+ TRIGGER_STATUS_TABLE.triggerName
+ ),
+ truncate(toolkitSlugFromTriggerName(item.trigger_name), TRIGGER_STATUS_TABLE.toolkit).padEnd(
+ TRIGGER_STATUS_TABLE.toolkit
+ ),
+ truncate(item.user_id || '-', TRIGGER_STATUS_TABLE.userId).padEnd(
+ TRIGGER_STATUS_TABLE.userId
+ ),
+ truncate(item.connected_account_id || '-', TRIGGER_STATUS_TABLE.connectedAccountId).padEnd(
+ TRIGGER_STATUS_TABLE.connectedAccountId
+ ),
+ status === 'ACTIVE' ? status : gray(status),
+ ].join(' ');
+ });
+
+ return [header, ...rows].join('\n');
+};
+
+export const formatTriggersStatusJson = (items: ReadonlyArray<TriggerInstanceItem>): string =>
+ JSON.stringify(
+ items.map(item => ({
+ id: item.id,
+ uuid: item.uuid || undefined,
+ trigger_name: item.trigger_name,
+ toolkit_slug: toolkitSlugFromTriggerName(item.trigger_name),
+ user_id: item.user_id || undefined,
+ connected_account_id: item.connected_account_id || undefined,
+ status: toStatus(item),
+ disabled_at: item.disabled_at,
+ updated_at: item.updated_at || undefined,
+ trigger_data: item.trigger_data || undefined,
+ })),
+ null,
+ 2
+ );
diff --cc ts/packages/cli/src/commands/triggers/triggers.cmd.ts
index b38b16e04,cda313099..12ccf2fb1
--- a/ts/packages/cli/src/commands/triggers/triggers.cmd.ts
+++ b/ts/packages/cli/src/commands/triggers/triggers.cmd.ts
@@@ -1,10 -1,7 +1,12 @@@
import { Command } from '@effect/cli';
+ import { triggersCmd$Info } from './commands/triggers.info.cmd';
+ import { triggersCmd$List } from './commands/triggers.list.cmd';
import { triggersCmd$Listen } from './commands/triggers.listen.cmd';
+import { triggersCmd$Status } from './commands/triggers.status.cmd';
+import { triggersCmd$Create } from './commands/triggers.create.cmd';
+import { triggersCmd$Enable } from './commands/triggers.enable.cmd';
+import { triggersCmd$Disable } from './commands/triggers.disable.cmd';
+import { triggersCmd$Delete } from './commands/triggers.delete.cmd';
/**
* CLI entry point for realtime trigger commands.
@@@ -15,13 -12,6 +17,15 @@@
* ```
*/
export const triggersCmd = Command.make('triggers').pipe(
- Command.withDescription('List trigger types and subscribe to realtime trigger events.'),
- Command.withSubcommands([triggersCmd$List, triggersCmd$Info, triggersCmd$Listen])
+ Command.withDescription('Inspect and subscribe to trigger events.'),
+ Command.withSubcommands([
++ triggersCmd$List,
++ triggersCmd$Info,
+ triggersCmd$Listen,
+ triggersCmd$Status,
+ triggersCmd$Create,
+ triggersCmd$Enable,
+ triggersCmd$Disable,
+ triggersCmd$Delete,
+ ])
);
diff --cc ts/packages/cli/test/src/commands/$default.cmd.test.ts
index 94fd9591e,a6489a086..627dd38a6
--- a/ts/packages/cli/test/src/commands/$default.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/$default.cmd.test.ts
@@@ -84,57 -84,53 +84,63 @@@ describe('CLI: composio', () =>
COMPOSIO_TOOLKIT_VERSION_<TOOLKIT> Override toolkit version (e.g., COMPOSIO_TOOLKIT_VERSION_GMAIL=20250901_00)
Use "latest" or unset to use the latest version.
- - toolkits Discover and inspect Composio toolkits.
+ - toolkits Discover and inspect Composio toolkits.
- - toolkits list [--query text] [--limit integer] List available toolkits.
+ - toolkits list [--query text] [--limit integer] List available toolkits.
- - toolkits info [<slug>] View details of a specific toolkit.
+ - toolkits info [<slug>] View details of a specific toolkit.
- - toolkits search [--limit integer] <query> Search toolkits by use case.
+ - toolkits search [--limit integer] <query> Search toolkits by use case.
- - tools Discover and inspect Composio tools.
+ - tools Discover and inspect Composio tools.
- - tools list [--query text] [--toolkits text] [--tags text] [--limit integer] List available tools.
+ - tools list [--query text] [--toolkits text] [--tags text] [--limit integer] List available tools.
- - tools info [<slug>] View details of a specific tool.
+ - tools info [<slug>] View details of a specific tool.
- - tools search [--toolkits text] [--limit integer] <query> Search tools by use case.
+ - tools search [--toolkits text] [--limit integer] <query> Search tools by use case.
- - auth-configs View and manage Composio auth configs.
+ - tools execute [(-d, --data text)] [--user-id text] [--connected-account-id text] [--toolkit-version text] <slug> Execute a tool by slug with JSON arguments.
- - auth-configs list [--toolkits text] [--query text] [--limit integer] List auth configs.
+ - auth-configs View and manage Composio auth configs.
- - auth-configs info [<id>] View details of a specific auth config.
+ - auth-configs list [--toolkits text] [--query text] [--limit integer] List auth configs.
- - auth-configs create --toolkit text [--auth-scheme text] [--scopes text] [--custom-credentials text] [<name>] Create a new auth config.
+ - auth-configs info [<id>] View details of a specific auth config.
- - auth-configs delete [(-y, --yes)] [<id>] Delete an auth config.
+ - auth-configs create --toolkit text [--auth-scheme text] [--scopes text] [--custom-credentials text] [<name>] Create a new auth config.
- - connected-accounts View and manage Composio connected accounts.
+ - auth-configs delete [(-y, --yes)] [<id>] Delete an auth config.
- - connected-accounts list [--toolkits text] [--user-id text] [--status INITIALIZING | INITIATED | ACTIVE | FAILED | EXPIRED | INACTIVE] [--limit integer] List connected accounts.
+ - connected-accounts View and manage Composio connected accounts.
- - connected-accounts info [<id>] View details of a specific connected account.
+ - connected-accounts list [--toolkits text] [--user-id text] [--status INITIALIZING | INITIATED | ACTIVE | FAILED | EXPIRED | INACTIVE] [--limit integer] List connected accounts.
- - connected-accounts whoami [<id>] Show the external account profile for a connected account.
+ - connected-accounts info [<id>] View details of a specific connected account.
- - connected-accounts delete [(-y, --yes)] [<id>] Delete a connected account.
+ - connected-accounts whoami [<id>] Show the external account profile for a connected account.
- - connected-accounts link --auth-config text [--user-id text] [--no-browser] Link an external account via OAuth redirect.
+ - connected-accounts delete [(-y, --yes)] [<id>] Delete a connected account.
- - triggers Inspect and subscribe to trigger events.
+ - connected-accounts link --auth-config text [--user-id text] [--no-browser] Link an external account via OAuth redirect.
- - triggers listen [--toolkits text] [--trigger-id text] [--connected-account-id text] [--trigger-slug text] [--user-id text] [--json] [--table] [--max-events integer] [--forward text] [--out text] Listen to realtime trigger events for your project.
- - triggers List trigger types and subscribe to realtime trigger events.
++ - triggers Inspect and subscribe to trigger events.
- - triggers status [--user-ids text] [--connected-account-ids text] [--toolkits text] [--trigger-ids text] [--trigger-names text] [--show-disabled] [--deprecated-connected-account-uuids text] [--limit integer] Show active triggers with optional filters.
+ - triggers list [--toolkits text] [--limit integer] List available trigger types.
- - triggers create [--connected-account-id text] [--trigger-config text] [<trigger-name>] Create a new trigger instance.
+ - triggers info [<slug>] View details of a specific trigger type.
- - triggers enable [<id>] Enable a trigger instance.
+ - triggers listen [--toolkits text] [--trigger-id text] [--connected-account-id text] [--trigger-slug text] [--user-id text] [--json] [--table] [--max-events integer] [--forward text] [--out text] Listen to realtime trigger events for your project.
+
- - triggers disable [<id>] Disable a trigger instance.
++ - triggers status [--user-ids text] [--connected-account-ids text] [--toolkits text] [--trigger-ids text] [--trigger-names text] [--show-disabled] [--limit integer] Show active triggers with optional filters.
+
- - triggers delete [(-y, --yes)] [<id>] Delete a trigger instance.
++ - triggers create [--connected-account-id text] [--trigger-config text] [<trigger-name>] Create a new trigger instance.
++
++ - triggers enable [<id>] Enable a trigger instance.
++
++ - triggers disable [<id>] Disable a trigger instance.
++
++ - triggers delete [(-y, --yes)] [<id>] Delete a trigger instance.
"
`);
})