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.

feat(cli): add logs commands for triggers and tools (#2742)

Musthaq Ahamad2648fcaa1820
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9309cf851..4d49e17a8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -25,8 +25,8 @@ catalogs:
specifier: ^4.20250917.0
version: 4.20260218.0
'@composio/client':
- specifier: 0.1.0-alpha.57
- version: 0.1.0-alpha.57
+ specifier: 0.1.0-alpha.60
+ version: 0.1.0-alpha.60
'@effect/cli':
specifier: ^0.73.2
version: 0.73.2
@@ -680,16 +680,16 @@ importers:
version: link:../../packages/providers/llamaindex
'@llamaindex/openai':
specifier: ^0.4.20
- version: 0.4.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
+ version: 0.4.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
'@llamaindex/workflow':
specifier: ^1.1.24
- version: 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ version: 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
dotenv:
specifier: ^16.4.1
version: 16.6.1
llamaindex:
specifier: ^0.12.0
devDependencies:
'@types/bun':
specifier: ^1.2.9
@@ -1019,7 +1019,7 @@ importers:
version: 1.0.1
'@composio/client':
specifier: 'catalog:'
- version: 0.1.0-alpha.57
+ version: 0.1.0-alpha.60
'@composio/core':
specifier: workspace:*
version: link:../core
@@ -1116,7 +1116,7 @@ importers:
dependencies:
'@composio/client':
specifier: 'catalog:'
- version: 0.1.0-alpha.57
+ version: 0.1.0-alpha.60
'@composio/json-schema-to-zod':
specifier: workspace:*
version: link:../json-schema-to-zod
@@ -1289,7 +1289,7 @@ importers:
dependencies:
llamaindex:
specifier: ^0.12.0
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -1763,8 +1763,8 @@ packages:
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
engines: {node: '>=0.1.90'}
- '@composio/[email protected]':
- resolution: {integrity: sha512-XCTGa/zwfofRaJA33UcJ2SSx/F/cWnedTNhaDZeWYyIliSGZ1CLEnqzTA8ip01Y3YNFXoWugKPnT07FslXnvpg==}
+ '@composio/[email protected]':
+ resolution: {integrity: sha512-i1/S+GX7ATzdQK0UzoaPdWqP4lmn/sCWF4ojGdq26k+cyEiq3aWN4HZFKYBp1jmwD1Sxn02RX9iTL09YAPn3Rg==}
'@cspotcode/[email protected]':
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
@@ -6856,7 +6856,7 @@ snapshots:
'@colors/[email protected]':
optional: true
- '@composio/[email protected]': {}
+ '@composio/[email protected]': {}
'@cspotcode/[email protected]':
dependencies:
@@ -7551,43 +7551,26 @@ snapshots:
tree-sitter: 0.22.4
web-tree-sitter: 0.24.7
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
transitivePeerDependencies:
- ws
- zod
optionalDependencies:
- '@modelcontextprotocol/sdk': 1.26.0(@cfworker/[email protected])([email protected])
+ '@modelcontextprotocol/sdk': 1.26.0(@cfworker/[email protected])([email protected])
hono: 4.11.9
- zod: 3.25.76
-
- optionalDependencies:
zod: 4.3.6
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
- '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
- transitivePeerDependencies:
- - '@modelcontextprotocol/sdk'
- - hono
- - next
- - p-retry
- - rxjs
- - zod
-
- dependencies:
- '@llamaindex/core': 0.6.22
- '@llamaindex/env': 0.1.30
- '@llamaindex/workflow-core': 1.3.3([email protected])
+ '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- '@modelcontextprotocol/sdk'
- hono
@@ -8572,14 +8555,6 @@ snapshots:
optionalDependencies:
- dependencies:
- '@vitest/spy': 3.2.4
- estree-walker: 3.0.3
- magic-string: 0.30.21
- optionalDependencies:
-
'@vitest/[email protected]':
dependencies:
tinyrainbow: 2.0.0
@@ -8609,7 +8584,7 @@ snapshots:
sirv: 3.0.2
tinyglobby: 0.2.15
tinyrainbow: 2.0.0
'@vitest/[email protected]':
dependencies:
@@ -9976,34 +9951,12 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 9.0.2
dependencies:
'@llamaindex/core': 0.6.22
'@llamaindex/env': 0.1.30
'@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
- '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
- '@types/lodash': 4.17.23
- '@types/node': 24.10.13
- lodash: 4.17.23
- magic-bytes.js: 1.13.0
- transitivePeerDependencies:
- - '@huggingface/transformers'
- - '@modelcontextprotocol/sdk'
- - gpt-tokenizer
- - hono
- - next
- - p-retry
- - rxjs
- - tree-sitter
- - web-tree-sitter
- - zod
-
- dependencies:
- '@llamaindex/core': 0.6.22
- '@llamaindex/env': 0.1.30
- '@llamaindex/node-parser': 2.0.22(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])([email protected])
- '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])([email protected])
+ '@llamaindex/workflow': 1.1.24(@llamaindex/[email protected])(@llamaindex/[email protected])(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
'@types/lodash': 4.17.23
'@types/node': 24.10.13
lodash: 4.17.23
@@ -10283,11 +10236,6 @@ snapshots:
is-inside-container: 1.0.0
wsl-utils: 0.1.0
- optionalDependencies:
- ws: 8.19.0
- zod: 3.25.76
-
optionalDependencies:
ws: 8.19.0
@@ -11385,7 +11333,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.3
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index d348c27fc..7b28a8ec9 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -20,7 +20,7 @@ catalog:
'@clack/prompts': '^1.0.1'
'@cloudflare/vitest-pool-workers': ^0.9.2
'@cloudflare/workers-types': ^4.20250917.0
- '@composio/client': 0.1.0-alpha.57
+ '@composio/client': 0.1.0-alpha.60
'@effect/cli': ^0.73.2
'@effect/eslint-plugin': ^0.3.2
'@effect/language-service': ^0.74.0
diff --git a/ts/packages/cli/src/commands/index.ts b/ts/packages/cli/src/commands/index.ts
index 578fbf4ff..fe705ea0c 100644
--- a/ts/packages/cli/src/commands/index.ts
+++ b/ts/packages/cli/src/commands/index.ts
@@ -17,6 +17,7 @@ import { toolsCmd } from './tools/tools.cmd';
import { authConfigsCmd } from './auth-configs/auth-configs.cmd';
import { connectedAccountsCmd } from './connected-accounts/connected-accounts.cmd';
import { triggersCmd } from './triggers/triggers.cmd';
+import { logsCmd } from './logs-cmd/logs.cmd';
const $cmd = $defaultCmd.pipe(
Command.withSubcommands([
@@ -34,6 +35,7 @@ const $cmd = $defaultCmd.pipe(
authConfigsCmd,
connectedAccountsCmd,
triggersCmd,
+ logsCmd,
])
);
diff --git a/ts/packages/cli/src/commands/logs-cmd/commands/logs.tools.cmd.ts b/ts/packages/cli/src/commands/logs-cmd/commands/logs.tools.cmd.ts
new file mode 100644
index 000000000..7e527810a
--- /dev/null
+++ b/ts/packages/cli/src/commands/logs-cmd/commands/logs.tools.cmd.ts
@@ -0,0 +1,238 @@
+import { Args, Command, Options } from '@effect/cli';
+import { Effect, Option } from 'effect';
+import { requireAuth } from 'src/effects/require-auth';
+import { TerminalUI } from 'src/services/terminal-ui';
+import { ComposioClientSingleton } from 'src/services/composio-clients';
+import { clampLimit } from 'src/ui/clamp-limit';
+import { parseCsv } from 'src/commands/triggers/parse-csv';
+import { formatToolLogInfo, formatToolLogsTable } from '../format';
+import { toSearchParam } from '../utils';
+
+type ToolLogFilterInput = {
+ tool?: string;
+ toolkit?: string;
+ connectedAccountId?: string;
+ authConfigId?: string;
+ status?: string;
+ userId?: string;
+ logId?: string;
+ toolRouterSessionId?: string;
+ sessionId?: string;
+};
+
+const toSearchParams = (value: string | undefined, field: string) =>
+ value === undefined ? [] : parseCsv(value).map(item => toSearchParam(field, item));
+
+export const buildToolLogShorthandSearchParams = (
+ filters: ToolLogFilterInput
+): Array<ReturnType<typeof toSearchParam>> => [
+ ...toSearchParams(filters.tool, 'action_key'),
+ ...toSearchParams(filters.toolkit, 'toolkit_key'),
+ ...toSearchParams(filters.connectedAccountId, 'connected_account_id'),
+ ...toSearchParams(filters.authConfigId, 'auth_config_id'),
+ ...toSearchParams(filters.status, 'execution_status'),
+ ...toSearchParams(filters.userId, 'user_id'),
+ ...toSearchParams(filters.logId, 'log_id'),
+ ...toSearchParams(filters.toolRouterSessionId, 'tool_router_session_id'),
+ ...toSearchParams(filters.sessionId, 'session_id'),
+];
+
+const cursor = Options.integer('cursor').pipe(
+ Options.optional,
+ Options.withDescription('Cursor for pagination')
+);
+
+const from = Options.integer('from').pipe(
+ Options.withDescription('Start timestamp (epoch milliseconds)'),
+ Options.optional
+);
+
+const to = Options.integer('to').pipe(
+ Options.withDescription('End timestamp (epoch milliseconds)'),
+ Options.optional
+);
+
+const limit = Options.integer('limit').pipe(
+ Options.withDefault(30),
+ Options.withDescription('Number of logs to fetch (1-1000)')
+);
+
+const caseSensitive = Options.boolean('case-sensitive').pipe(
+ Options.withDefault(false),
+ Options.withDescription('Whether search params are case-sensitive')
+);
+
+const toolkit = Options.text('toolkit').pipe(
+ Options.withDescription('Filter by toolkit key(s), comma-separated (e.g. "gmail,slack")'),
+ Options.optional
+);
+
+const tool = Options.text('tool').pipe(
+ Options.withDescription('Filter by tool key(s), comma-separated (e.g. "GMAIL_SEND_EMAIL")'),
+ Options.optional
+);
+
+const connectedAccountId = Options.text('connected-account-id').pipe(
+ Options.withDescription('Filter by connected account id(s), comma-separated'),
+ Options.optional
+);
+
+const authConfigId = Options.text('auth-config-id').pipe(
+ Options.withDescription('Filter by auth config id(s), comma-separated'),
+ Options.optional
+);
+
+const status = Options.text('status').pipe(
+ Options.withDescription('Filter by execution status value(s), comma-separated'),
+ Options.optional
+);
+
+const userId = Options.text('user-id').pipe(
+ Options.withDescription('Filter by user id(s), comma-separated'),
+ Options.optional
+);
+
+const logIdFilter = Options.text('log-id').pipe(
+ Options.withDescription('Filter by log id(s), comma-separated'),
+ Options.optional
+);
+
+const toolRouterSessionId = Options.text('tool-router-session-id').pipe(
+ Options.withDescription('Filter by tool router session id(s), comma-separated'),
+ Options.optional
+);
+
+const sessionId = Options.text('session-id').pipe(
+ Options.withDescription('Filter by session id(s), comma-separated'),
+ Options.optional
+);
+
+const logId = Args.text({ name: 'log_id' }).pipe(
+ Args.withDescription('Tool log ID'),
+ Args.optional
+);
+
+/**
+ * List tool execution logs with optional filters.
+ *
+ * @example
+ * ```bash
+ * composio logs tools --limit 50
+ * composio logs tools <log_id>
+ * composio logs tools --toolkit gmail --tool GMAIL_SEND_EMAIL
+ * composio logs tools --connected-account-id con_123 --user-id user_123
+ * composio logs tools --status success --auth-config-id ac_123
+ * composio logs tools --from 1735689600000 --to 1735776000000
+ * ```
+ */
+export const logsCmd$Tools = Command.make(
+ 'tools',
+ {
+ logId,
+ cursor,
+ from,
+ to,
+ limit,
+ caseSensitive,
+ toolkit,
+ tool,
+ connectedAccountId,
+ authConfigId,
+ status,
+ userId,
+ logIdFilter,
+ toolRouterSessionId,
+ sessionId,
+ },
+ ({
+ logId,
+ cursor,
+ from,
+ to,
+ limit,
+ caseSensitive,
+ toolkit,
+ tool,
+ connectedAccountId,
+ authConfigId,
+ status,
+ userId,
+ logIdFilter,
+ toolRouterSessionId,
+ sessionId,
+ }) =>
+ Effect.gen(function* () {
+ if (!(yield* requireAuth)) return;
+
+ const ui = yield* TerminalUI;
+ const clientSingleton = yield* ComposioClientSingleton;
+ const client = yield* clientSingleton.get();
+ const clampedLimit = clampLimit(limit);
+ const shorthandSearchParams = buildToolLogShorthandSearchParams({
+ tool: Option.getOrUndefined(tool),
+ toolkit: Option.getOrUndefined(toolkit),
+ connectedAccountId: Option.getOrUndefined(connectedAccountId),
+ authConfigId: Option.getOrUndefined(authConfigId),
+ status: Option.getOrUndefined(status),
+ userId: Option.getOrUndefined(userId),
+ logId: Option.getOrUndefined(logIdFilter),
+ toolRouterSessionId: Option.getOrUndefined(toolRouterSessionId),
+ sessionId: Option.getOrUndefined(sessionId),
+ });
+ const toolLogId = Option.getOrUndefined(logId);
+
+ if (toolLogId) {
+ const toolLog = yield* ui.withSpinner(
+ `Fetching tool log "${toolLogId}"...`,
+ Effect.tryPromise(() => client.logs.tools.retrieve(toolLogId))
+ );
+
+ yield* ui.log.info(
+ `${formatToolLogInfo(toolLog)}\n\nPayload:\n${JSON.stringify(toolLog.payloadReceived, null, 2)}\n\nResponse:\n${JSON.stringify(toolLog.response, null, 2)}`
+ );
+ yield* ui.output(JSON.stringify(toolLog, null, 2));
+ return;
+ }
+
+ const response = yield* ui.withSpinner(
+ 'Fetching tool logs...',
+ Effect.tryPromise(() =>
+ client.logs.tools.list({
+ cursor: Option.getOrUndefined(cursor) ?? null,
+ from: Option.getOrUndefined(from),
+ to: Option.getOrUndefined(to),
+ limit: clampedLimit,
+ case_sensitive: caseSensitive,
+ search_params: shorthandSearchParams.length > 0 ? shorthandSearchParams : undefined,
+ })
+ )
+ );
+
+ const logs = response.data ?? [];
+
+ if (logs.length === 0) {
+ yield* ui.log.warn('No tool logs found for the given filters.');
+ yield* ui.output(JSON.stringify(response, null, 2));
+ return;
+ }
+
+ yield* ui.log.info(
+ `Listing ${logs.length} tool log${logs.length === 1 ? '' : 's'}\n\n${formatToolLogsTable(logs)}`
+ );
+
+ const firstLogId = logs[0]?.id;
+ if (firstLogId) {
+ yield* ui.log.step(
+ `To view full details for a log:\n> composio logs tools "${firstLogId}"`
+ );
+ }
+
+ if (response.nextCursor !== null && response.nextCursor !== undefined) {
+ yield* ui.log.step(`Next cursor: ${response.nextCursor}`);
+ }
+
+ yield* ui.output(JSON.stringify(response, null, 2));
+ })
+).pipe(
+ Command.withDescription('List tool execution logs, or pass a log_id to fetch a specific log.')
+);
diff --git a/ts/packages/cli/src/commands/logs-cmd/commands/logs.triggers.cmd.ts b/ts/packages/cli/src/commands/logs-cmd/commands/logs.triggers.cmd.ts
new file mode 100644
index 000000000..04ba9d53f
--- /dev/null
+++ b/ts/packages/cli/src/commands/logs-cmd/commands/logs.triggers.cmd.ts
@@ -0,0 +1,253 @@
+import { Args, Command, Options } from '@effect/cli';
+import { Effect, Option } from 'effect';
+import { requireAuth } from 'src/effects/require-auth';
+import { TerminalUI } from 'src/services/terminal-ui';
+import { ComposioClientSingleton } from 'src/services/composio-clients';
+import { clampLimit } from 'src/ui/clamp-limit';
+import { parseCsv } from 'src/commands/triggers/parse-csv';
+import { formatTriggerLogInfo, formatTriggerLogsTable } from '../format';
+import { toSearchParam } from '../utils';
+
+const cursor = Options.text('cursor').pipe(
+ Options.withDescription('Cursor for pagination'),
+ Options.optional
+);
+
+const userId = Options.text('user-id').pipe(
+ Options.withDescription('Filter by user id'),
+ Options.optional
+);
+
+const connectedAccountId = Options.text('connected-account-id').pipe(
+ Options.withDescription('Filter by connected account id'),
+ Options.optional
+);
+
+const trigger = Options.text('trigger').pipe(
+ Options.withDescription('Filter by trigger name'),
+ Options.optional
+);
+
+const triggerId = Options.text('trigger-id').pipe(
+ Options.withDescription('Filter by trigger id'),
+ Options.optional
+);
+
+const logIdFilter = Options.text('log-id').pipe(
+ Options.withDescription('Filter by log id'),
+ Options.optional
+);
+
+const logId = Args.text({ name: 'log_id' }).pipe(
+ Args.withDescription('Trigger log ID'),
+ Args.optional
+);
+
+const from = Options.integer('from').pipe(
+ Options.withDescription('Start timestamp (epoch milliseconds)'),
+ Options.optional
+);
+
+const to = Options.integer('to').pipe(
+ Options.withDescription('End timestamp (epoch milliseconds)'),
+ Options.optional
+);
+
+const limit = Options.integer('limit').pipe(
+ Options.withDefault(30),
+ Options.withDescription('Number of logs to fetch (1-1000)')
+);
+
+const time = Options.choice('time', ['5m', '30m', '6h', '1d', '1w', '1month', '1y'] as const).pipe(
+ Options.optional,
+ Options.withDescription('Show logs from a relative time window')
+);
+
+const search = Options.text('search').pipe(
+ Options.withDescription('Full-text search query'),
+ Options.optional
+);
+
+const includePayload = Options.boolean('include-payload').pipe(
+ Options.withDefault(false),
+ Options.withDescription('Include payload fields in response')
+);
+
+/**
+ * List trigger logs with optional filters.
+ *
+ * @example
+ * ```bash
+ * composio logs triggers <log_id>
+ * composio logs triggers --trigger GMAIL_NEW_GMAIL_MESSAGE
+ * composio logs triggers --trigger-id 77ac1dbf-6db0-4039-8dbe-e903b3f2057e
+ * composio logs triggers --connected-account-id ca_123 --user-id user_123
+ * composio logs triggers --log-id log_123
+ * ```
+ */
+export const logsCmd$Triggers = Command.make(
+ 'triggers',
+ {
+ logId,
+ cursor,
+ userId,
+ connectedAccountId,
+ trigger,
+ triggerId,
+ logIdFilter,
+ from,
+ to,
+ limit,
+ time,
+ search,
+ includePayload,
+ },
+ ({
+ logId,
+ cursor,
+ userId,
+ connectedAccountId,
+ trigger,
+ triggerId,
+ logIdFilter,
+ from,
+ to,
+ limit,
+ time,
+ search,
+ includePayload,
+ }) =>
+ Effect.gen(function* () {
+ if (!(yield* requireAuth)) return;
+
+ const ui = yield* TerminalUI;
+ const clientSingleton = yield* ComposioClientSingleton;
+ const client = yield* clientSingleton.get();
+ const clampedLimit = clampLimit(limit);
+ const shorthandSearchParams = [
+ ...(Option.isSome(trigger)
+ ? parseCsv(trigger.value).map(value => toSearchParam('trigger_name', value))
+ : []),
+ ...(Option.isSome(triggerId)
+ ? parseCsv(triggerId.value).map(value => toSearchParam('trigger_id', value))
+ : []),
+ ...(Option.isSome(userId)
+ ? parseCsv(userId.value).map(value => toSearchParam('user_id', value))
+ : []),
+ ...(Option.isSome(connectedAccountId)
+ ? parseCsv(connectedAccountId.value).map(value =>
+ toSearchParam('connected_account_id', value)
+ )
+ : []),
+ ...(Option.isSome(logIdFilter)
+ ? parseCsv(logIdFilter.value).map(value => toSearchParam('log_id', value))
+ : []),
+ ];
+ const triggerLogId = Option.getOrUndefined(logId);
+
+ if (triggerLogId) {
+ const triggerLog = yield* ui.withSpinner(
+ `Fetching trigger log "${triggerLogId}"...`,
+ Effect.tryPromise(() => client.logs.triggers.retrieve(triggerLogId))
+ );
+ const triggerLogData = triggerLog as unknown as Record<string, unknown>;
+ const normalizedLogData = getTriggerLogRecord(triggerLogData);
+ const payload = getTriggerPayload(normalizedLogData);
+ const response = getTriggerResponse(normalizedLogData);
+
+ yield* ui.log.info(
+ `${formatTriggerLogInfo(triggerLog)}\n\nPayload:\n${JSON.stringify(payload, null, 2)}\n\nResponse:\n${JSON.stringify(response, null, 2)}`
+ );
+ yield* ui.output(JSON.stringify(triggerLog, null, 2));
+ return;
+ }
+
+ const response = yield* ui.withSpinner(
+ 'Fetching trigger logs...',
+ Effect.tryPromise(() =>
+ client.logs.triggers.list({
+ cursor: Option.getOrUndefined(cursor),
+ from: Option.getOrUndefined(from),
+ to: Option.getOrUndefined(to),
+ limit: clampedLimit,
+ time: Option.getOrUndefined(time),
+ search: Option.getOrUndefined(search),
+ include_payload: includePayload,
+ search_params: shorthandSearchParams.length > 0 ? shorthandSearchParams : undefined,
+ })
+ )
+ );
+
+ const logs = response.data ?? [];
+
+ if (logs.length === 0) {
+ yield* ui.log.warn('No trigger logs found for the given filters.');
+ yield* ui.output(JSON.stringify(response, null, 2));
+ return;
+ }
+
+ yield* ui.log.info(
+ `Listing ${logs.length} trigger log${logs.length === 1 ? '' : 's'}\n\n${formatTriggerLogsTable(logs)}`
+ );
+
+ const firstLogId = logs[0]?.id;
+ if (firstLogId) {
+ yield* ui.log.step(
+ `To view full details for a log:\n> composio logs triggers "${firstLogId}"`
+ );
+ }
+
+ if (response.nextCursor) {
+ yield* ui.log.step(`Next cursor: ${response.nextCursor}`);
+ }
+
+ yield* ui.output(JSON.stringify(response, null, 2));
+ })
+).pipe(Command.withDescription('List trigger logs.'));
+
+export const getTriggerLogRecord = (record: Record<string, unknown>): Record<string, unknown> => {
+ const log = record.log;
+ if (log && typeof log === 'object') return log as Record<string, unknown>;
+ return record;
+};
+
+export const getTriggerPayload = (record: Record<string, unknown>): unknown => {
+ const meta = record.meta;
+ const metaRecord = meta && typeof meta === 'object' ? (meta as Record<string, unknown>) : {};
+ const rawPayload =
+ metaRecord.triggerProviderPayload ??
+ metaRecord.triggerClientPayload ??
+ record.payloadReceived ??
+ record.payload ??
+ null;
+
+ return parseMaybeJson(rawPayload);
+};
+
+export const getTriggerResponse = (record: Record<string, unknown>): unknown => {
+ const meta = record.meta;
+ const metaRecord = meta && typeof meta === 'object' ? (meta as Record<string, unknown>) : {};
+ const rawResponse =
+ metaRecord.triggerClientResponse ??
+ metaRecord.triggerProviderResponse ??
+ record.response ??
+ null;
+
+ return parseMaybeJson(rawResponse);
+};
+
+export const parseMaybeJson = (value: unknown): unknown => {
+ if (typeof value !== 'string') return value;
+ const trimmed = value.trim();
+ if (
+ (trimmed.startsWith('{') && trimmed.endsWith('}')) ||
+ (trimmed.startsWith('[') && trimmed.endsWith(']'))
+ ) {
+ try {
+ return JSON.parse(trimmed);
+ } catch {
+ return value;
+ }
+ }
+ return value;
+};
diff --git a/ts/packages/cli/src/commands/logs-cmd/format.ts b/ts/packages/cli/src/commands/logs-cmd/format.ts
new file mode 100644
index 000000000..a96e47998
--- /dev/null
+++ b/ts/packages/cli/src/commands/logs-cmd/format.ts
@@ -0,0 +1,268 @@
+import type { Logs } from '@composio/client/resources/logs/logs';
+import { bold, gray, green, red } from 'src/ui/colors';
+import { truncate } from 'src/ui/truncate';
+
+type TriggerLog = Logs.TriggerListResponse.Data;
+type ToolLog = Logs.ToolListResponse.Data;
+type ToolLogDetailed = Logs.ToolRetrieveResponse;
+
+const TRIGGER_LOG_TABLE = {
+ createdAt: 24,
+ id: 18,
+ triggerId: 18,
+ app: 12,
+ triggerName: 28,
+ triggerUserId: 16,
+ connectedAccountId: 20,
+} as const;
+
+const TOOL_LOG_TABLE = {
+ createdAt: 24,
+ id: 18,
+ status: 8,
+ app: 12,
+ actionKey: 28,
+ executionMs: 12,
+ connectedAccountId: 20,
+} as const;
+
+export const formatTriggerLogsTable = (logs: ReadonlyArray<TriggerLog>): string => {
+ const header = [
+ bold('Created At'.padEnd(TRIGGER_LOG_TABLE.createdAt)),
+ bold('Log Id'.padEnd(TRIGGER_LOG_TABLE.id)),
+ bold('Trigger Id'.padEnd(TRIGGER_LOG_TABLE.triggerId)),
+ bold('Toolkit'.padEnd(TRIGGER_LOG_TABLE.app)),
+ bold('Trigger'.padEnd(TRIGGER_LOG_TABLE.triggerName)),
+ bold('User Id'.padEnd(TRIGGER_LOG_TABLE.triggerUserId)),
+ bold('Connected Account Id'),
+ ].join(' ');
+
+ const rows = logs.map(log => {
+ const createdAt = gray(
+ truncate(formatCreatedAt(log.createdAt), TRIGGER_LOG_TABLE.createdAt).padEnd(
+ TRIGGER_LOG_TABLE.createdAt
+ )
+ );
+ const id = (log.id ?? '-').padEnd(TRIGGER_LOG_TABLE.id);
+ const triggerId = truncate(getTriggerId(log), TRIGGER_LOG_TABLE.triggerId).padEnd(
+ TRIGGER_LOG_TABLE.triggerId
+ );
+ const app = truncate(log.appName ?? '-', TRIGGER_LOG_TABLE.app).padEnd(TRIGGER_LOG_TABLE.app);
+ const triggerName = truncate(getTriggerName(log), TRIGGER_LOG_TABLE.triggerName).padEnd(
+ TRIGGER_LOG_TABLE.triggerName
+ );
+ const triggerUserId = truncate(log.entityId ?? '-', TRIGGER_LOG_TABLE.triggerUserId).padEnd(
+ TRIGGER_LOG_TABLE.triggerUserId
+ );
+ const connectedAccountId = truncate(
+ log.connectionId ?? '-',
+ TRIGGER_LOG_TABLE.connectedAccountId
+ );
+
+ return [createdAt, id, triggerId, app, triggerName, triggerUserId, connectedAccountId].join(
+ ' '
+ );
+ });
+
+ return [header, ...rows].join('\n');
+};
+
+export const formatToolLogsTable = (logs: ReadonlyArray<ToolLog>): string => {
+ const header = [
+ bold('Created At'.padEnd(TOOL_LOG_TABLE.createdAt)),
+ bold('Log Id'.padEnd(TOOL_LOG_TABLE.id)),
+ bold('Status'.padEnd(TOOL_LOG_TABLE.status)),
+ bold('Toolkit'.padEnd(TOOL_LOG_TABLE.app)),
+ bold('Tool'.padEnd(TOOL_LOG_TABLE.actionKey)),
+ bold('Exec Time'.padEnd(TOOL_LOG_TABLE.executionMs)),
+ bold('Connected Account'),
+ ].join(' ');
+
+ const rows = logs.map(log => {
+ const createdAt = gray(
+ truncate(formatCreatedAt(log.createdAt), TOOL_LOG_TABLE.createdAt).padEnd(
+ TOOL_LOG_TABLE.createdAt
+ )
+ );
+ // Keep log ids untruncated for copy/paste workflows.
+ const id = (log.id ?? '-').padEnd(TOOL_LOG_TABLE.id);
+ const status = formatLogStatus(log.status, TOOL_LOG_TABLE.status);
+ const app = truncate(log.app?.name ?? '-', TOOL_LOG_TABLE.app).padEnd(TOOL_LOG_TABLE.app);
+ const actionKey = truncate(log.actionKey ?? '-', TOOL_LOG_TABLE.actionKey).padEnd(
+ TOOL_LOG_TABLE.actionKey
+ );
+ const executionMs = `${log.executionTime ?? 0}ms`.padEnd(TOOL_LOG_TABLE.executionMs);
+ const connectedAccountId = truncate(
+ valueOrDash(log.connectedAccountId),
+ TOOL_LOG_TABLE.connectedAccountId
+ );
+
+ return [createdAt, id, status, app, actionKey, executionMs, connectedAccountId].join(' ');
+ });
+
+ return [header, ...rows].join('\n');
+};
+
+const formatLogStatus = (status: string | null | undefined, width: number): string => {
+ const label = truncate(valueOrDash(status), width).padEnd(width);
+ const normalizedStatus = status?.trim().toLowerCase();
+
+ if (normalizedStatus === 'success') return green(label);
+ if (normalizedStatus === 'failure' || normalizedStatus === 'failed') return red(label);
+ return label;
+};
+
+const valueOrDash = (value: string | null | undefined): string => {
+ if (value == null) return '-';
+ const normalizedValue = value.trim();
+ return normalizedValue.length > 0 ? normalizedValue : '-';
+};
+
+const getTriggerId = (log: TriggerLog): string => {
+ const dynamicLog = log as unknown as Record<string, unknown>;
+ const dynamicMeta = (dynamicLog.meta ?? {}) as Record<string, unknown>;
+ const triggerId =
+ typeof dynamicMeta.triggerNanoId === 'string'
+ ? dynamicMeta.triggerNanoId
+ : typeof dynamicMeta.trigger_nano_id === 'string'
+ ? dynamicMeta.trigger_nano_id
+ : typeof dynamicMeta.triggerId === 'string'
+ ? dynamicMeta.triggerId
+ : typeof dynamicMeta.trigger_id === 'string'
+ ? dynamicMeta.trigger_id
+ : typeof dynamicLog.triggerNanoId === 'string'
+ ? dynamicLog.triggerNanoId
+ : typeof dynamicLog.trigger_nano_id === 'string'
+ ? dynamicLog.trigger_nano_id
+ : typeof dynamicLog.triggerId === 'string'
+ ? dynamicLog.triggerId
+ : typeof dynamicLog.trigger_id === 'string'
+ ? dynamicLog.trigger_id
+ : null;
+ return valueOrDash(triggerId);
+};
+
+const getTriggerName = (log: TriggerLog): string => {
+ const dynamicLog = log as unknown as Record<string, unknown>;
+ const dynamicMeta = (dynamicLog.meta ?? {}) as Record<string, unknown>;
+ const triggerName =
+ typeof dynamicMeta.triggerName === 'string'
+ ? dynamicMeta.triggerName
+ : typeof dynamicMeta.trigger_name === 'string'
+ ? dynamicMeta.trigger_name
+ : typeof dynamicLog.triggerName === 'string'
+ ? dynamicLog.triggerName
+ : typeof dynamicLog.trigger_name === 'string'
+ ? dynamicLog.trigger_name
+ : null;
+ return valueOrDash(triggerName);
+};
+
+const formatEpoch = (value: number): string => {
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return '-';
+ return date.toISOString();
+};
+
+const formatCreatedAt = (value: number | string | null | undefined): string => {
+ if (typeof value === 'number') return formatEpoch(value);
+ if (typeof value === 'string') return value;
+ return '-';
+};
+
+export const formatToolLogInfo = (toolLog: ToolLogDetailed): string => {
+ const lines: string[] = [];
+ lines.push(`${bold('logId:')} ${toolLog.actionLogId}`);
+ lines.push(`${bold('toolSlug:')} ${toolLog.actionId}`);
+ lines.push(`${bold('Status:')} ${toolLog.status}`);
+ lines.push(`${bold('toolkit:')} ${toolLog.app?.name ?? '-'}`);
+ lines.push(`${bold('Connection ID:')} ${toolLog.connection?.id ?? '-'}`);
+ lines.push(`${bold('Entity:')} ${toolLog.connection?.entity ?? '-'}`);
+ lines.push(`${bold('Start Time:')} ${formatCreatedAt(toolLog.startTime)}`);
+ lines.push(`${bold('End Time:')} ${formatCreatedAt(toolLog.endTime)}`);
+ lines.push(`${bold('Total Duration:')} ${toolLog.totalDuration}`);
+ lines.push(`${bold('Version:')} ${toolLog.version}`);
+ lines.push(`${bold('Steps:')} ${toolLog.steps?.length ?? 0}`);
+ return lines.join('\n');
+};
+
+export const formatTriggerLogInfo = (triggerLog: unknown): string => {
+ const rawLog = triggerLog as Record<string, unknown>;
+ const logCandidate = rawLog.log;
+ const log =
+ logCandidate && typeof logCandidate === 'object'
+ ? (logCandidate as Record<string, unknown>)
+ : rawLog;
+ const lines: string[] = [];
+
+ lines.push(`${bold('logId:')} ${valueOrDash(getRecordString(log, ['id', 'logId', 'log_id']))}`);
+ lines.push(
+ `${bold('triggerId:')} ${valueOrDash(getRecordString(log, ['triggerId', 'trigger_id']))}`
+ );
+ lines.push(
+ `${bold('triggerNanoId:')} ${valueOrDash(
+ getRecordString(log, ['triggerNanoId', 'trigger_nano_id'])
+ )}`
+ );
+ lines.push(
+ `${bold('trigger:')} ${valueOrDash(getRecordString(log, ['triggerName', 'trigger_name']))}`
+ );
+ lines.push(`${bold('Status:')} ${valueOrDash(getRecordString(log, ['status']))}`);
+ lines.push(
+ `${bold('toolkit:')} ${valueOrDash(getRecordString(log, ['appName', 'toolkit', 'toolkit_key']))}`
+ );
+ lines.push(
+ `${bold('Connection ID:')} ${valueOrDash(
+ getRecordString(log, ['connectionId', 'connection_id', 'connectedAccountId'])
+ )}`
+ );
+ lines.push(
+ `${bold('Entity:')} ${valueOrDash(getRecordString(log, ['entityId', 'entity_id', 'userId']))}`
+ );
+ lines.push(
+ `${bold('Created At:')} ${formatCreatedAt(
+ getRecordNumberOrString(log, ['createdAt', 'created_at'])
+ )}`
+ );
+
+ return lines.join('\n');
+};
+
+const getRecordString = (record: Record<string, unknown>, keys: ReadonlyArray<string>) => {
+ for (const key of keys) {
+ const value = record[key];
+ if (typeof value === 'string') return value;
+ }
+
+ const meta = record.meta;
+ if (meta && typeof meta === 'object') {
+ const metaRecord = meta as Record<string, unknown>;
+ for (const key of keys) {
+ const value = metaRecord[key];
+ if (typeof value === 'string') return value;
+ }
+ }
+
+ return null;
+};
+
+const getRecordNumberOrString = (
+ record: Record<string, unknown>,
+ keys: ReadonlyArray<string>
+): number | string | null => {
+ for (const key of keys) {
+ const value = record[key];
+ if (typeof value === 'number' || typeof value === 'string') return value;
+ }
+
+ const meta = record.meta;
+ if (meta && typeof meta === 'object') {
+ const metaRecord = meta as Record<string, unknown>;
+ for (const key of keys) {
+ const value = metaRecord[key];
+ if (typeof value === 'number' || typeof value === 'string') return value;
+ }
+ }
+
+ return null;
+};
diff --git a/ts/packages/cli/src/commands/logs-cmd/logs.cmd.ts b/ts/packages/cli/src/commands/logs-cmd/logs.cmd.ts
new file mode 100644
index 000000000..52bcafbc4
--- /dev/null
+++ b/ts/packages/cli/src/commands/logs-cmd/logs.cmd.ts
@@ -0,0 +1,16 @@
+import { Command } from '@effect/cli';
+import { logsCmd$Tools } from './commands/logs.tools.cmd';
+import { logsCmd$Triggers } from './commands/logs.triggers.cmd';
+
+/**
+ * CLI entry point for logs commands.
+ *
+ * @example
+ * ```bash
+ * composio logs <command>
+ * ```
+ */
+export const logsCmd = Command.make('logs').pipe(
+ Command.withDescription('Inspect trigger and tool execution logs.'),
+ Command.withSubcommands([logsCmd$Triggers, logsCmd$Tools])
+);
diff --git a/ts/packages/cli/src/commands/logs-cmd/utils.ts b/ts/packages/cli/src/commands/logs-cmd/utils.ts
new file mode 100644
index 000000000..ff0a18d1a
--- /dev/null
+++ b/ts/packages/cli/src/commands/logs-cmd/utils.ts
@@ -0,0 +1,11 @@
+export type SearchParam = {
+ field?: string;
+ operation?: string;
+ value?: string;
+};
+
+export const toSearchParam = (field: string, value: string): SearchParam => ({
+ field,
+ operation: '==',
+ value,
+});
diff --git a/ts/packages/cli/test/__utils__/services/test-layer.ts b/ts/packages/cli/test/__utils__/services/test-layer.ts
index 9dba22ec2..85981ba8f 100644
--- a/ts/packages/cli/test/__utils__/services/test-layer.ts
+++ b/ts/packages/cli/test/__utils__/services/test-layer.ts
@@ -898,9 +898,9 @@ export const TestLayer = (input?: TestLiveInput) =>
NodeProcessTest,
UpgradeBinaryTest,
ComposioUserContextTest,
+ ComposioClientSingletonTest,
ComposioSessionRepositoryTest,
TriggersRealtimeTest,
- ComposioClientSingletonTest,
ComposioToolkitsRepositoryTest,
JsPackageManagerDetector.Default,
ProjectEnvironmentDetector.Default,
@@ -1083,6 +1083,22 @@ function breakSymlinksInNodeModules(
return;
}
+ // Some fixtures can contain node_modules as a symlink (often broken in temp copies).
+ // Normalize it first so tests can safely create nested paths like node_modules/@scope/pkg.
+ const nodeModulesLink = yield* fs.readLink(nodeModulesPath).pipe(
+ Effect.map(() => true),
+ Effect.catchAll(() => Effect.succeed(false))
+ );
+
+ if (nodeModulesLink) {
+ yield* fs
+ .remove(nodeModulesPath, { recursive: true })
+ .pipe(Effect.catchAll(() => Effect.void));
+ yield* fs
+ .makeDirectory(nodeModulesPath, { recursive: true })
+ .pipe(Effect.catchAll(() => Effect.void));
+ }
+
const isWindows = process.platform === 'win32';
if (isWindows) {
diff --git a/ts/packages/cli/test/src/commands/$default.cmd.test.ts b/ts/packages/cli/test/src/commands/$default.cmd.test.ts
index 363f1d1b9..58e0ee6af 100644
--- a/ts/packages/cli/test/src/commands/$default.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/$default.cmd.test.ts
@@ -15,7 +15,7 @@ describe('CLI: composio', () => {
expect(result).toEqual(
ValidationError.commandMismatch(
HelpDoc.p(
- "Invalid subcommand for composio - use one of 'version', 'upgrade', 'whoami', 'login', 'logout', 'init', 'generate', 'py', 'ts', 'toolkits', 'tools', 'auth-configs', 'connected-accounts', 'triggers'"
+ "Invalid subcommand for composio - use one of 'version', 'upgrade', 'whoami', 'login', 'logout', 'init', 'generate', 'py', 'ts', 'toolkits', 'tools', 'auth-configs', 'connected-accounts', 'triggers', 'logs'"
)
)
);
@@ -30,7 +30,6 @@ describe('CLI: composio', () => {
yield* cli(args);
const lines = yield* MockConsole.getLines();
const output = lines.join('\n');
-
expect(yield* sanitize(output)).toMatchSnapshot();
})
);
diff --git a/ts/packages/cli/test/src/commands/__snapshots__/$default.cmd.test.ts.snap b/ts/packages/cli/test/src/commands/__snapshots__/$default.cmd.test.ts.snap
index 12726b544..12dbf3275 100644
--- a/ts/packages/cli/test/src/commands/__snapshots__/$default.cmd.test.ts.snap
+++ b/ts/packages/cli/test/src/commands/__snapshots__/$default.cmd.test.ts.snap
@@ -25,92 +25,98 @@ Composio CLI - A tool for managing Python and TypeScript composio.dev projects.
COMMANDS
- - version Display the current Composio CLI version.
+ - version Display the current Composio CLI version.
- - upgrade Upgrade your Composio CLI to the latest available version.
+ - upgrade Upgrade your Composio CLI to the latest available version.
- - whoami Display your account information.
+ - whoami Display your account information.
- - login [--no-browser] [--api-key text] [--org-id text] [--project-id text] Log in to the Composio SDK.
+ - login [--no-browser] [--api-key text] [--org-id text] [--project-id text] Log in to the Composio SDK.
- - logout Log out from the Composio SDK.
+ - logout Log out from the Composio SDK.
- - init [--org-id text] [--project-id text] [--no-browser] [--dry-run] [--force] [(-y, --yes)] [--no-skills] Initialize a Composio project in the current directory.
+ - init [--org-id text] [--project-id text] [--no-browser] [--dry-run] [--force] [(-y, --yes)] [--no-skills] Initialize a Composio project in the current directory.
- - generate [(-o, --output-dir directory)] [--type-tools] --toolkits text... Generate type stubs for toolkits, tools, and triggers, auto-detecting project language (TypeScript | Python)
+ - generate [(-o, --output-dir directory)] [--type-tools] --toolkits text... Generate type stubs for toolkits, tools, and triggers, auto-detecting project language (TypeScript | Python)
- - py Handle Python projects.
+ - py Handle Python projects.
- - py generate [(-o, --output-dir directory)] --toolkits text... Generate Python type stubs for toolkits, tools, and triggers from the Composio API.
+ - py generate [(-o, --output-dir directory)] --toolkits text... Generate Python type stubs for toolkits, tools, and triggers from the Composio API.
Environment Variables:
COMPOSIO_TOOLKIT_VERSION_<TOOLKIT> Override toolkit version (e.g., COMPOSIO_TOOLKIT_VERSION_GMAIL=20250901_00)
Use "latest" or unset to use the latest version.
- - ts Handle TypeScript projects.
+ - ts Handle TypeScript projects.
- - ts generate [(-o, --output-dir directory)] [--compact] [--transpiled] [--type-tools] --toolkits text... Generate TypeScript types for toolkits, tools, and triggers from the Composio API.
+ - ts generate [(-o, --output-dir directory)] [--compact] [--transpiled] [--type-tools] --toolkits text... Generate TypeScript types for toolkits, tools, and triggers from the Composio API.
Environment Variables:
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] [--connected] [--user-id text] List available toolkits with connection status.
+ - toolkits list [--query text] [--limit integer] [--connected] [--user-id text] List available toolkits with connection status.
- - toolkits info [--user-id text] [<slug>] View details of a specific toolkit.
+ - toolkits info [--user-id text] [<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.
- - tools execute [(-d, --data text)] [--user-id text] <slug> Execute a tool by slug with JSON arguments.
+ - tools execute [(-d, --data text)] [--user-id text] <slug> Execute a tool by slug with JSON arguments.
- - auth-configs View and manage Composio auth configs.
+ - auth-configs View and manage Composio auth configs.
- - auth-configs list [--toolkits text] [--query text] [--limit integer] List auth configs.
+ - auth-configs list [--toolkits text] [--query text] [--limit integer] List auth configs.
- - auth-configs info [<id>] View details of a specific auth config.
+ - auth-configs info [<id>] View details of a specific auth config.
- - auth-configs create --toolkit text [--auth-scheme text] [--scopes text] [--custom-credentials text] [<name>] Create a new auth config.
+ - auth-configs create --toolkit text [--auth-scheme text] [--scopes text] [--custom-credentials text] [<name>] Create a new auth config.
- - auth-configs delete [(-y, --yes)] [<id>] Delete an auth config.
+ - auth-configs delete [(-y, --yes)] [<id>] Delete an auth config.
- - connected-accounts View and manage Composio connected accounts.
+ - connected-accounts View and manage Composio connected accounts.
- - connected-accounts list [--toolkits text] [--user-id text] [--status INITIALIZING | INITIATED | ACTIVE | FAILED | EXPIRED | INACTIVE] [--limit integer] List connected accounts.
+ - connected-accounts list [--toolkits text] [--user-id text] [--status INITIALIZING | INITIATED | ACTIVE | FAILED | EXPIRED | INACTIVE] [--limit integer] List connected accounts.
- - connected-accounts info [<id>] View details of a specific connected account.
+ - connected-accounts info [<id>] View details of a specific connected account.
- - connected-accounts whoami [<id>] Show the external account profile for a connected account.
+ - connected-accounts whoami [<id>] Show the external account profile for a connected account.
- - connected-accounts delete [(-y, --yes)] [<id>] Delete a connected account.
+ - connected-accounts delete [(-y, --yes)] [<id>] Delete a connected account.
- - connected-accounts link [--auth-config text] [--user-id text] [--no-browser] [<toolkit>] Link an external account via OAuth redirect.
+ - connected-accounts link [--auth-config text] [--user-id text] [--no-browser] [<toolkit>] Link an external account via OAuth redirect.
- - triggers Inspect and subscribe to trigger events.
+ - triggers Inspect and subscribe to trigger events.
- - triggers list [--toolkits text] [--limit integer] List available trigger types.
+ - triggers list [--toolkits text] [--limit integer] List available trigger types.
- - triggers info [<slug>] View details of a specific trigger type.
+ - triggers info [<slug>] View details of a specific trigger type.
- - 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 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 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 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 create [--connected-account-id text] [--trigger-config text] [<trigger-name>] Create a new 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 enable [<id>] Enable a trigger instance.
- - triggers disable [<id>] Disable a trigger instance.
+ - triggers disable [<id>] Disable a trigger instance.
- - triggers delete [(-y, --yes)] [<id>] Delete a trigger instance.
+ - triggers delete [(-y, --yes)] [<id>] Delete a trigger instance.
+
+ - logs Inspect trigger and tool execution logs.
+
+ - logs triggers [--cursor text] [--user-id text] [--connected-account-id text] [--trigger text] [--trigger-id text] [--log-id text] [--from integer] [--to integer] [--limit integer] [--time 5m | 30m | 6h | 1d | 1w | 1month | 1y] [--search text] [--include-payload] [<log_id>] List trigger logs.
+
+ - logs tools [--cursor integer] [--from integer] [--to integer] [--limit integer] [--case-sensitive] [--toolkit text] [--tool text] [--connected-account-id text] [--auth-config-id text] [--status text] [--user-id text] [--log-id text] [--tool-router-session-id text] [--session-id text] [<log_id>] List tool execution logs, or pass a log_id to fetch a specific log.
"
`;
diff --git a/ts/packages/cli/test/src/commands/logs-cmd/format.test.ts b/ts/packages/cli/test/src/commands/logs-cmd/format.test.ts
new file mode 100644
index 000000000..c71596015
--- /dev/null
+++ b/ts/packages/cli/test/src/commands/logs-cmd/format.test.ts
@@ -0,0 +1,218 @@
+import type { Logs } from '@composio/client/resources/logs/logs';
+import { describe, expect, it } from 'vitest';
+import {
+ formatTriggerLogInfo,
+ formatToolLogInfo,
+ formatToolLogsTable,
+ formatTriggerLogsTable,
+} from 'src/commands/logs-cmd/format';
+import { green, red } from 'src/ui/colors';
+
+type TriggerLog = Logs.TriggerListResponse.Data;
+type ToolLog = Logs.ToolListResponse.Data;
+type ToolLogDetailed = Logs.ToolRetrieveResponse;
+
+const makeTriggerLog = (createdAt: TriggerLog['createdAt'] | number): TriggerLog =>
+ ({
+ id: 'trigger_log_1',
+ clientId: 'client_1',
+ type: 'trigger',
+ createdAt: createdAt as TriggerLog['createdAt'],
+ status: 'success',
+ appName: 'gmail',
+ meta: {
+ triggerId: 'trigger_123',
+ triggerNanoId: 'ti_123',
+ triggerName: 'NEW_GMAIL_MESSAGE',
+ },
+ entityId: 'entity_123',
+ connectionId: 'conn_123',
+ }) as unknown as TriggerLog;
+
+const makeToolLog = (
+ createdAt: ToolLog['createdAt'] | null,
+ overrides: {
+ status?: string;
+ connectedAccountId?: string | null;
+ } = {}
+): ToolLog =>
+ ({
+ id: 'tool_log_1',
+ createdAt,
+ status: overrides.status ?? 'success',
+ app: { name: 'gmail' },
+ actionKey: 'GMAIL_SEND_EMAIL',
+ executionTime: 20,
+ connectedAccountId:
+ overrides.connectedAccountId === undefined ? 'conn_123' : overrides.connectedAccountId,
+ }) as ToolLog;
+
+const makeToolLogDetailed = (
+ overrides: Partial<{ startTime: number | null; endTime: number | null }> = {}
+): ToolLogDetailed =>
+ ({
+ actionLogId: 'tool_log_1',
+ actionId: 'GMAIL_SEND_EMAIL',
+ status: 'success',
+ app: null,
+ connection: null,
+ startTime: overrides.startTime === undefined ? 0 : overrides.startTime,
+ endTime: overrides.endTime === undefined ? 0 : overrides.endTime,
+ totalDuration: '20ms',
+ version: '20260101_00',
+ steps: null,
+ }) as unknown as ToolLogDetailed;
+
+describe('formatTriggerLogsTable', () => {
+ it('[Given] createdAt is epoch number [Then] it formats without crashing', () => {
+ const output = formatTriggerLogsTable([makeTriggerLog(0)]);
+ expect(output).toContain('1970-01-01T00:00:00.000Z');
+ expect(output).toContain('ti_123');
+ expect(output).toContain('NEW_GMAIL_MESSAGE');
+ });
+
+ it('[Given] createdAt is string [Then] it preserves previous behavior', () => {
+ const output = formatTriggerLogsTable([makeTriggerLog('2026-02-24T12:34:56.000Z')]);
+ expect(output).toContain('2026-02-24T12:34:56.000Z');
+ });
+
+ it('[Given] rendering table [Then] it uses Trigger Id and Toolkit headers', () => {
+ const output = stripAnsi(formatTriggerLogsTable([makeTriggerLog(0)]));
+ const [headerLine] = output.split('\n');
+
+ expect(headerLine).toContain('Log Id');
+ expect(headerLine).toContain('Trigger Id');
+ expect(headerLine).toContain('Toolkit');
+ expect(headerLine).toContain('Trigger');
+ expect(headerLine).toContain('User Id');
+ expect(headerLine).toContain('Connected Account Id');
+ expect(headerLine).not.toContain('Status');
+ expect(headerLine).not.toContain('App');
+ });
+});
+
+describe('formatToolLogsTable', () => {
+ it('[Given] createdAt is null [Then] it renders dash instead of epoch zero', () => {
+ const output = formatToolLogsTable([makeToolLog(null)]);
+ expect(output).toContain('tool_log_1');
+ expect(output).not.toContain('1970-01-01T00:00:00.000Z');
+ });
+
+ it('[Given] rendering table [Then] it shows Created At before Log Id', () => {
+ const output = stripAnsi(formatToolLogsTable([makeToolLog(0)]));
+ const [headerLine] = output.split('\n');
+
+ expect(headerLine.indexOf('Created At')).toBeLessThan(headerLine.indexOf('Log Id'));
+ });
+
+ it('[Given] rendering table [Then] it uses Toolkit and Tool headers', () => {
+ const output = stripAnsi(formatToolLogsTable([makeToolLog(0)]));
+ const [headerLine] = output.split('\n');
+
+ expect(headerLine).toContain('Toolkit');
+ expect(headerLine).toContain('Tool');
+ expect(headerLine).not.toContain('App');
+ expect(headerLine).not.toContain('Action');
+ });
+
+ it('[Given] success and failure statuses [Then] it colors them green and red', () => {
+ const output = formatToolLogsTable([
+ makeToolLog(0, { status: 'success' }),
+ makeToolLog(0, { status: 'failed' }),
+ ]);
+
+ expect(output).toContain(green('success '.padEnd(8)));
+ expect(output).toContain(red('failed '.padEnd(8)));
+ });
+
+ it('[Given] null connected account [Then] it renders dash', () => {
+ const output = stripAnsi(formatToolLogsTable([makeToolLog(0, { connectedAccountId: null })]));
+ const [, rowLine] = output.split('\n');
+
+ expect(rowLine).toMatch(/\s-\s*$/);
+ });
+});
+
+const stripAnsi = (value: string): string => value.replace(/\u001B\[[0-9;]*m/g, '');
+
+describe('formatToolLogInfo', () => {
+ it('[Given] nullable app/connection/steps [Then] it renders fallback values', () => {
+ const output = formatToolLogInfo(makeToolLogDetailed());
+ const plain = output.replace(/\x1b\[[0-9;]*m/g, '');
+ expect(plain).toContain('toolkit: -');
+ expect(plain).toContain('Connection ID: -');
+ expect(plain).toContain('Entity: -');
+ expect(plain).toContain('Steps: 0');
+ });
+
+ it('[Given] null start/end time [Then] it renders dashes for timestamps', () => {
+ const output = formatToolLogInfo(makeToolLogDetailed({ startTime: null, endTime: null }));
+ const plain = output.replace(/\x1b\[[0-9;]*m/g, '');
+ expect(plain).toContain('Start Time: -');
+ expect(plain).toContain('End Time: -');
+ expect(plain).not.toContain('1970-01-01T00:00:00.000Z');
+ });
+});
+
+describe('formatTriggerLogInfo', () => {
+ it('[Given] trigger detailed log [Then] it renders key fields', () => {
+ const output = formatTriggerLogInfo({
+ id: 'trigger_log_1',
+ createdAt: 0,
+ status: 'success',
+ appName: 'gmail',
+ meta: {
+ triggerId: 'trigger_123',
+ triggerNanoId: 'ti_123',
+ triggerName: 'NEW_GMAIL_MESSAGE',
+ },
+ entityId: 'user_123',
+ connectionId: 'conn_123',
+ });
+
+ expect(output).toContain('logId:');
+ expect(output).toContain('trigger_log_1');
+ expect(output).toContain('triggerId:');
+ expect(output).toContain('trigger_123');
+ expect(output).toContain('triggerNanoId:');
+ expect(output).toContain('ti_123');
+ expect(output).toContain('trigger:');
+ expect(output).toContain('NEW_GMAIL_MESSAGE');
+ expect(output).toContain('toolkit:');
+ expect(output).toContain('gmail');
+ });
+
+ it('[Given] missing fields [Then] it renders fallback dashes', () => {
+ const output = formatTriggerLogInfo({});
+ const plain = output.replace(/\x1b\[[0-9;]*m/g, '');
+ expect(plain).toContain('logId: -');
+ expect(plain).toContain('triggerId: -');
+ expect(plain).toContain('triggerNanoId: -');
+ expect(plain).toContain('trigger: -');
+ expect(plain).toContain('Created At: -');
+ });
+
+ it('[Given] retrieve response wrapped under log [Then] it unwraps and renders values', () => {
+ const output = formatTriggerLogInfo({
+ log: {
+ id: 'log_QNzKGStH-ruD',
+ status: 'info',
+ appName: 'gmail',
+ createdAt: '2026-02-25T22:01:22.865Z',
+ entityId: 'pg-test-37ee710c-d5be-4775-91f2-a8e06b937d9b',
+ connectionId: 'ca_zkX9njO68E8A',
+ meta: {
+ triggerId: '77ac1dbf-6db0-4039-8dbe-e903b3f2057e',
+ triggerNanoId: 'ti_-nGUzD9N6JNf',
+ triggerName: 'GMAIL_NEW_GMAIL_MESSAGE',
+ },
+ },
+ });
+
+ expect(output).toContain('log_QNzKGStH-ruD');
+ expect(output).toContain('77ac1dbf-6db0-4039-8dbe-e903b3f2057e');
+ expect(output).toContain('ti_-nGUzD9N6JNf');
+ expect(output).toContain('GMAIL_NEW_GMAIL_MESSAGE');
+ expect(output).toContain('gmail');
+ });
+});
diff --git a/ts/packages/cli/test/src/commands/logs-cmd/logs.tools.cmd.test.ts b/ts/packages/cli/test/src/commands/logs-cmd/logs.tools.cmd.test.ts
new file mode 100644
index 000000000..b00994714
--- /dev/null
+++ b/ts/packages/cli/test/src/commands/logs-cmd/logs.tools.cmd.test.ts
@@ -0,0 +1,54 @@
+import { describe, expect, it } from 'vitest';
+import { buildToolLogShorthandSearchParams } from 'src/commands/logs-cmd/commands/logs.tools.cmd';
+
+describe('buildToolLogShorthandSearchParams', () => {
+ it('[Given] no filters [Then] returns empty search params', () => {
+ expect(buildToolLogShorthandSearchParams({})).toEqual([]);
+ });
+
+ it('[Given] all supported filters [Then] maps each one to the expected backend key', () => {
+ const output = buildToolLogShorthandSearchParams({
+ tool: 'GMAIL_SEND_EMAIL',
+ toolkit: 'gmail',
+ connectedAccountId: 'ca_123',
+ authConfigId: 'ac_123',
+ status: 'success',
+ userId: 'user_123',
+ logId: 'log_123',
+ toolRouterSessionId: 'trs_123',
+ sessionId: 'sess_123',
+ });
+
+ expect(output).toEqual([
+ { field: 'action_key', operation: '==', value: 'GMAIL_SEND_EMAIL' },
+ { field: 'toolkit_key', operation: '==', value: 'gmail' },
+ { field: 'connected_account_id', operation: '==', value: 'ca_123' },
+ { field: 'auth_config_id', operation: '==', value: 'ac_123' },
+ { field: 'execution_status', operation: '==', value: 'success' },
+ { field: 'user_id', operation: '==', value: 'user_123' },
+ { field: 'log_id', operation: '==', value: 'log_123' },
+ { field: 'tool_router_session_id', operation: '==', value: 'trs_123' },
+ { field: 'session_id', operation: '==', value: 'sess_123' },
+ ]);
+ });
+
+ it('[Given] comma-separated filter values [Then] expands each value into separate search params', () => {
+ const output = buildToolLogShorthandSearchParams({
+ tool: 'GMAIL_SEND_EMAIL,SLACK_SEND_MESSAGE',
+ toolkit: 'gmail,slack',
+ status: 'success,failed',
+ logId: 'log_1,log_2',
+ });
+
+ expect(output).toEqual([
+ { field: 'action_key', operation: '==', value: 'GMAIL_SEND_EMAIL' },
+ { field: 'action_key', operation: '==', value: 'SLACK_SEND_MESSAGE' },
+ { field: 'toolkit_key', operation: '==', value: 'gmail' },
+ { field: 'toolkit_key', operation: '==', value: 'slack' },
+ { field: 'execution_status', operation: '==', value: 'success' },
+ { field: 'execution_status', operation: '==', value: 'failed' },
+ { field: 'log_id', operation: '==', value: 'log_1' },
+ { field: 'log_id', operation: '==', value: 'log_2' },
+ ]);
+ });
+});
diff --git a/ts/packages/cli/test/src/commands/logs-cmd/logs.triggers.cmd.test.ts b/ts/packages/cli/test/src/commands/logs-cmd/logs.triggers.cmd.test.ts
new file mode 100644
index 000000000..8ac1faebd
--- /dev/null
+++ b/ts/packages/cli/test/src/commands/logs-cmd/logs.triggers.cmd.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from 'vitest';
+import {
+ getTriggerLogRecord,
+ getTriggerPayload,
+ getTriggerResponse,
+ parseMaybeJson,
+} from 'src/commands/logs-cmd/commands/logs.triggers.cmd';
+
+describe('logs triggers detail helpers', () => {
+ it('[Given] retrieve response wrapper [Then] unwraps nested log record', () => {
+ const wrapped = {
+ log: {
+ id: 'log_123',
+ meta: { triggerId: 'trigger_123' },
+ },
+ } as Record<string, unknown>;
+
+ expect(getTriggerLogRecord(wrapped)).toEqual({
+ id: 'log_123',
+ meta: { triggerId: 'trigger_123' },
+ });
+ });
+
+ it('[Given] trigger payload in meta JSON string [Then] parses it to object', () => {
+ const payload = getTriggerPayload({
+ meta: {
+ triggerProviderPayload: '{"foo":"bar","count":2}',
+ },
+ });
+
+ expect(payload).toEqual({ foo: 'bar', count: 2 });
+ });
+
+ it('[Given] trigger response in meta JSON string [Then] parses it to object', () => {
+ const response = getTriggerResponse({
+ meta: {
+ triggerClientResponse: '{"status":"CANCELED"}',
+ },
+ });
+
+ expect(response).toEqual({ status: 'CANCELED' });
+ });
+
+ it('[Given] non-JSON string [Then] parseMaybeJson returns original value', () => {
+ expect(parseMaybeJson('not-json')).toBe('not-json');
+ });
+});
diff --git a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
index b37b9c323..6896b445b 100644
--- a/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/ts/ts.generate.cmd.test.ts
@@ -31,6 +31,59 @@ describe('CLI: composio ts generate', () => {
triggerTypesAsEnums: [...TRIGGER_TYPES_GMAIL.slice(0, 3).map(triggerType => triggerType.slug)],
} satisfies TestLiveInput['toolkitsData'];
+ const setupMockComposioCorePackage = ({
+ cwd,
+ fs,
+ withGenerated = false,
+ }: {
+ cwd: string;
+ fs: FileSystem.FileSystem;
+ withGenerated?: boolean;
+ }) =>
+ Effect.gen(function* () {
+ const nodeModulesRoot = path.join(cwd, 'node_modules');
+ const nodeModulesDir = path.join(nodeModulesRoot, '@composio', 'core');
+
+ // Some fixtures may carry broken node_modules links after copying; reset to a real directory.
+ yield* fs
+ .remove(nodeModulesRoot, { recursive: true })
+ .pipe(Effect.catchAll(() => Effect.void));
+ yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
+
+ if (withGenerated) {
+ yield* fs.makeDirectory(path.join(nodeModulesDir, 'generated'), { recursive: true });
+ }
+
+ // Create a mock package.json to resolve @composio/core imports in transpilation paths.
+ yield* fs.writeFileString(
+ path.join(nodeModulesDir, 'package.json'),
+ JSON.stringify(
+ {
+ name: '@composio/core',
+ type: 'module',
+ exports: {
+ '.': {
+ types: './index.d.ts',
+ default: './index.js',
+ },
+ './generated': {
+ types: './generated/index.d.ts',
+ default: './generated/index.js',
+ },
+ },
+ },
+ null,
+ 2
+ )
+ );
+
+ yield* fs.writeFileString(
+ path.join(nodeModulesDir, 'index.d.ts'),
+ 'export type TriggerEvent<T> = { payload: T };'
+ );
+ yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');
+ });
+
describe('[Given] valid fetched app data', () => {
layer(
TestLive({
@@ -47,43 +100,7 @@ describe('CLI: composio ts generate', () => {
const cwd = process.cwd;
const fs = yield* FileSystem.FileSystem;
- // Create the @composio/core/generated directory structure as if installed
- const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
- const generatedDir = path.join(nodeModulesDir, 'generated');
- yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
- yield* fs.makeDirectory(generatedDir, { recursive: true });
-
- // Create a mock package.json to override the symlink resolution for ESM imports.
- // This is necessary because we're using symlinks in test-layer.ts to isolate the test environment.
- const corePackageJson = path.join(nodeModulesDir, 'package.json');
- yield* fs.writeFileString(
- corePackageJson,
- JSON.stringify(
- {
- name: '@composio/core',
- type: 'module',
- exports: {
- '.': {
- types: './index.d.ts',
- default: './index.js',
- },
- './generated': {
- types: './generated/index.d.ts',
- default: './generated/index.js',
- },
- },
- },
- null,
- 2
- )
- );
-
- // Create minimal type stubs for @composio/core root exports (needed for transpilation)
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'index.d.ts'),
- 'export type TriggerEvent<T> = { payload: T };'
- );
- yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');
+ yield* setupMockComposioCorePackage({ cwd, fs, withGenerated: true });
const outputDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');
const args = ['ts', 'generate'];
@@ -288,42 +305,7 @@ describe('CLI: composio ts generate', () => {
const cwd = process.cwd;
const fs = yield* FileSystem.FileSystem;
- // Create the @composio/core/generated directory structure as if installed
- const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
- const generatedDir = path.join(nodeModulesDir, 'generated');
- yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
- yield* fs.makeDirectory(generatedDir, { recursive: true });
-
- // Create a mock package.json to override the symlink resolution for ESM imports
- const corePackageJson = path.join(nodeModulesDir, 'package.json');
- yield* fs.writeFileString(
- corePackageJson,
- JSON.stringify(
- {
- name: '@composio/core',
- type: 'module',
- exports: {
- '.': {
- types: './index.d.ts',
- default: './index.js',
- },
- './generated': {
- types: './generated/index.d.ts',
- default: './generated/index.js',
- },
- },
- },
- null,
- 2
- )
- );
-
- // Create minimal type stubs for @composio/core root exports (needed for transpilation)
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'index.d.ts'),
- 'export type TriggerEvent<T> = { payload: T };'
- );
- yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');
+ yield* setupMockComposioCorePackage({ cwd, fs, withGenerated: true });
const outputDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');
const args = ['ts', 'generate', '--type-tools'];
@@ -777,22 +759,7 @@ describe('CLI: composio ts generate', () => {
const fs = yield* FileSystem.FileSystem;
const outputDir = path.join(cwd, 'generated-compiled');
- // Create mock @composio/core for transpilation to resolve imports
- const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
- yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'package.json'),
- JSON.stringify({
- name: '@composio/core',
- type: 'module',
- exports: { '.': { types: './index.d.ts', default: './index.js' } },
- })
- );
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'index.d.ts'),
- 'export type TriggerEvent<T> = { payload: T };'
- );
- yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');
+ yield* setupMockComposioCorePackage({ cwd, fs });
const args = ['ts', 'generate', '--transpiled', '--output-dir', outputDir];
yield* cli(args);
@@ -825,33 +792,9 @@ describe('CLI: composio ts generate', () => {
const process = yield* NodeProcess;
const cwd = process.cwd;
const fs = yield* FileSystem.FileSystem;
+ const generatedDir = path.join(cwd, 'node_modules', '@composio', 'core', 'generated');
- // Set up @composio/core/generated directory
- const nodeModulesDir = path.join(cwd, 'node_modules', '@composio', 'core');
- const generatedDir = path.join(nodeModulesDir, 'generated');
- yield* fs.makeDirectory(nodeModulesDir, { recursive: true });
- yield* fs.makeDirectory(generatedDir, { recursive: true });
-
- // Create mock package.json and type stubs for transpilation
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'package.json'),
- JSON.stringify({
- name: '@composio/core',
- type: 'module',
- exports: {
- '.': { types: './index.d.ts', default: './index.js' },
- './generated': {
- types: './generated/index.d.ts',
- default: './generated/index.js',
- },
- },
- })
- );
- yield* fs.writeFileString(
- path.join(nodeModulesDir, 'index.d.ts'),
- 'export type TriggerEvent<T> = { payload: T };'
- );
- yield* fs.writeFileString(path.join(nodeModulesDir, 'index.js'), 'export {};');
+ yield* setupMockComposioCorePackage({ cwd, fs, withGenerated: true });
const args = ['ts', 'generate'];
yield* cli(args);
@@ -903,6 +846,7 @@ describe('CLI: composio ts generate', () => {
const process = yield* NodeProcess;
const cwd = process.cwd;
const fs = yield* FileSystem.FileSystem;
+ yield* setupMockComposioCorePackage({ cwd, fs });
// Run the command
const args = ['ts', 'generate', '--compact'];