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

refactor(cli): move `triggers status` into the directory shape (#4991)

This PR: - moves `dev triggers status` to `triggers/status/triggers.status.{cmd,handler}.ts`; the `.cmd.ts` keeps the flags, description and `Command.make('status', flags, runTriggersStatus)` only - builds the toolkit filter as an `Option` of a non-empty list and renders the page with `Option.match`/`Array.match`, with the same request params, messages, streams and exit codes - moves the argv suite to `test/src/commands/triggers/status/triggers.status.cmd.test.ts` and adds a handler suite (11 cases: comma-separated and uppercased request params, clamped limit, toolkit post-filter and its `Listing N of M` total, empty warnings with and without `--show-disabled`, API error fallback with exit 1 and no stdout, stdout JSON) - leaves `triggers listen` in `triggers/commands/` (U8, blocked on #4804); `validate:command-tests` stays at 2 exemptions - part of the CLI command-layout series (legacy-shape cleanup before U10); no user-visible change, so no CHANGELOG entry ## Context Verified: `pnpm --filter @composio/cli test` (188 files, 2052 passed, 1 skipped; `validate:command-tests` 2 exemptions remaining; includes `root-help-consistency.test.ts`), CLI `typecheck`, `lint:effect` (0 errors), oxlint (no new warnings), prettier, root `pnpm typecheck`. Binary smoke: built `dist/composio` on this branch and on `origin/next`, ran 29 invocations with an isolated `HOME` (`--help`/`help` pages for `dev`, `dev triggers`, `dev triggers status`, `triggers`, plus logged-out `dev triggers status` runs with filters, a shared `--user-id`, and an invalid `--limit`); stdout, stderr and exit codes are byte-identical.

Alberto Schiabel committed Oct 20, 2026 at 19:05 UTC 6ab1ac65f7a741b820a97a801e0c14692b26cf57
6 files changed +441 -134
ts/packages/cli/src/commands/triggers/commands/triggers.status.cmd.ts deleted
-133
@@ -1,133 +0,0 @@
1 -import { Command, Flag } from 'effect/cli';
2 -import { Effect, Option } from 'effect';
3 -import { handleClientApiError } from 'src/effects/handle-http-error';
4 -import { CLIENT_API_ERROR_TAGS } from 'src/services/composio-errors';
5 -import { ComposioToolkitsRepository } from 'src/services/composio-clients';
6 -import { TerminalUI } from 'src/services/terminal-ui';
7 -import { clampLimit } from 'src/ui/clamp-limit';
8 -import {
9 - formatTriggersStatusJson,
10 - formatTriggersStatusTable,
11 - toolkitSlugFromTriggerName,
12 -} from '../format';
13 -import { parseCsv } from '../parse-csv';
14 -
15 -const userIds = Flag.String('user-ids').pipe(
16 - Flag.withDescription('Filter by user IDs, comma-separated'),
17 - Flag.optional
18 -);
19 -
20 -const connectedAccountIds = Flag.String('connected-account-ids').pipe(
21 - Flag.withDescription('Filter by connected account IDs, comma-separated'),
22 - Flag.optional
23 -);
24 -
25 -const toolkits = Flag.String('toolkits').pipe(
26 - Flag.withDescription('Filter by toolkit slugs, comma-separated (e.g. "gmail" or "gmail,slack")'),
27 - Flag.optional
28 -);
29 -
30 -const triggerIds = Flag.String('trigger-ids').pipe(
31 - Flag.withDescription('Filter by trigger instance IDs, comma-separated'),
32 - Flag.optional
33 -);
34 -
35 -const triggerNames = Flag.String('trigger-names').pipe(
36 - Flag.withDescription(
37 - 'Filter by trigger names, comma-separated (case-insensitive; normalized to uppercase)'
38 - ),
39 - Flag.optional
40 -);
41 -
42 -const showDisabled = Flag.Boolean('show-disabled').pipe(
43 - Flag.withDefault(false),
44 - Flag.withDescription('Include disabled triggers in the response')
45 -);
46 -
47 -const limit = Flag.Int('limit').pipe(
48 - Flag.withDefault(30),
49 - Flag.withDescription('Number of results per page (1-1000)')
50 -);
51 -
52 -const csvOption = (opt: Option.Option<string>): string[] | undefined =>
53 - Option.getOrUndefined(Option.map(opt, parseCsv));
54 -
55 -/**
56 - * Display active trigger instances with optional filters.
57 - */
58 -export const triggersCmd$Status = Command.make(
59 - 'status',
60 - {
61 - userIds,
62 - connectedAccountIds,
63 - toolkits,
64 - triggerIds,
65 - triggerNames,
66 - showDisabled,
67 - limit,
68 - },
69 - ({ userIds, connectedAccountIds, toolkits, triggerIds, triggerNames, showDisabled, limit }) =>
70 - Effect.gen(function* () {
71 - const ui = yield* TerminalUI;
72 - const repo = yield* ComposioToolkitsRepository;
73 -
74 - const connectedAccountIdsList = csvOption(connectedAccountIds);
75 - const triggerNamesList = csvOption(triggerNames)?.map(name => name.toUpperCase());
76 - const toolkitsList = csvOption(toolkits)?.map(slug => slug.toLowerCase());
77 -
78 - const resultOpt = yield* ui
79 - .withSpinner(
80 - 'Fetching trigger status...',
81 - repo.listActiveTriggers({
82 - user_ids: csvOption(userIds),
83 - connected_account_ids: connectedAccountIdsList,
84 - trigger_ids: csvOption(triggerIds),
85 - trigger_names: triggerNamesList,
86 - show_disabled: showDisabled,
87 - limit: clampLimit(limit),
88 - })
89 - )
90 - .pipe(
91 - Effect.asSome,
92 - Effect.catchTag(
93 - CLIENT_API_ERROR_TAGS,
94 - handleClientApiError(ui, {
95 - fallbackMessage: 'Failed to fetch trigger status.',
96 - hint: 'Retry with:\n> composio dev triggers status --show-disabled',
97 - fallbackValue: Option.none(),
98 - })
99 - )
100 - );
101 -
102 - if (Option.isNone(resultOpt)) {
103 - return;
104 - }
105 -
106 - const result = resultOpt.value;
107 -
108 - const filteredItems =
109 - toolkitsList && toolkitsList.length > 0
110 - ? result.items.filter(item =>
111 - toolkitsList.includes(toolkitSlugFromTriggerName(item.trigger_name))
112 - )
113 - : result.items;
114 -
115 - if (filteredItems.length === 0) {
116 - yield* ui.log.warn(
117 - showDisabled
118 - ? 'No triggers found for the provided filters.'
119 - : 'No active triggers found for the provided filters.'
120 - );
121 - return;
122 - }
123 -
124 - const showing = filteredItems.length;
125 - const total =
126 - toolkitsList && toolkitsList.length > 0 ? result.items.length : result.total_items;
127 -
128 - yield* ui.log.info(
129 - `Listing ${showing} of ${total} triggers\n\n${formatTriggersStatusTable(filteredItems)}`
130 - );
131 - yield* ui.output(formatTriggersStatusJson(filteredItems));
132 - })
133 -).pipe(Command.withDescription('Show active triggers with optional filters.'));
ts/packages/cli/src/commands/triggers/status/triggers.status.cmd.ts new
+53
@@ -0,0 +1,53 @@
1 +import { Command, Flag } from 'effect/cli';
2 +import { runTriggersStatus } from './triggers.status.handler';
3 +
4 +const userIds = Flag.String('user-ids').pipe(
5 + Flag.withDescription('Filter by user IDs, comma-separated'),
6 + Flag.optional
7 +);
8 +
9 +const connectedAccountIds = Flag.String('connected-account-ids').pipe(
10 + Flag.withDescription('Filter by connected account IDs, comma-separated'),
11 + Flag.optional
12 +);
13 +
14 +const toolkits = Flag.String('toolkits').pipe(
15 + Flag.withDescription('Filter by toolkit slugs, comma-separated (e.g. "gmail" or "gmail,slack")'),
16 + Flag.optional
17 +);
18 +
19 +const triggerIds = Flag.String('trigger-ids').pipe(
20 + Flag.withDescription('Filter by trigger instance IDs, comma-separated'),
21 + Flag.optional
22 +);
23 +
24 +const triggerNames = Flag.String('trigger-names').pipe(
25 + Flag.withDescription(
26 + 'Filter by trigger names, comma-separated (case-insensitive; normalized to uppercase)'
27 + ),
28 + Flag.optional
29 +);
30 +
31 +const showDisabled = Flag.Boolean('show-disabled').pipe(
32 + Flag.withDefault(false),
33 + Flag.withDescription('Include disabled triggers in the response')
34 +);
35 +
36 +const limit = Flag.Int('limit').pipe(
37 + Flag.withDefault(30),
38 + Flag.withDescription('Number of results per page (1-1000)')
39 +);
40 +
41 +export const triggersCmd$Status = Command.make(
42 + 'status',
43 + {
44 + userIds,
45 + connectedAccountIds,
46 + toolkits,
47 + triggerIds,
48 + triggerNames,
49 + showDisabled,
50 + limit,
51 + },
52 + runTriggersStatus
53 +).pipe(Command.withDescription('Show active triggers with optional filters.'));
ts/packages/cli/src/commands/triggers/status/triggers.status.handler.ts new
+129
@@ -0,0 +1,129 @@
1 +import { Array as Arr, Effect, Option } from 'effect';
2 +import { handleClientApiError } from 'src/effects/handle-http-error';
3 +import { CLIENT_API_ERROR_TAGS } from 'src/services/composio-errors';
4 +import {
5 + ComposioToolkitsRepository,
6 + type ComposioToolkitsRepositoryShape,
7 +} from 'src/services/composio-clients';
8 +import { TerminalUI } from 'src/services/terminal-ui';
9 +import { clampLimit } from 'src/ui/clamp-limit';
10 +import {
11 + formatTriggersStatusJson,
12 + formatTriggersStatusTable,
13 + toolkitSlugFromTriggerName,
14 +} from '../format';
15 +import { parseCsv } from '../parse-csv';
16 +
17 +export type TriggersStatusParams = {
18 + readonly userIds: Option.Option<string>;
19 + readonly connectedAccountIds: Option.Option<string>;
20 + readonly toolkits: Option.Option<string>;
21 + readonly triggerIds: Option.Option<string>;
22 + readonly triggerNames: Option.Option<string>;
23 + readonly showDisabled: boolean;
24 + readonly limit: number;
25 +};
26 +
27 +type ActiveTriggersPage = Effect.Success<
28 + ReturnType<ComposioToolkitsRepositoryShape['listActiveTriggers']>
29 +>;
30 +
31 +/** The comma-separated values of a filter flag, or `undefined` when the flag is absent. */
32 +const csvOption = (opt: Option.Option<string>): string[] | undefined =>
33 + Option.getOrUndefined(Option.map(opt, parseCsv));
34 +
35 +/**
36 + * The page's triggers whose toolkit is in `toolkits`, and the total the listing reports:
37 + * the API's count without a toolkit filter, the size of the page with one, since the API
38 + * does not filter by toolkit.
39 + */
40 +const filterByToolkits = (
41 + page: ActiveTriggersPage,
42 + toolkits: Option.Option<Arr.NonEmptyReadonlyArray<string>>
43 +) =>
44 + Option.match(toolkits, {
45 + onNone: () => ({ items: page.items, total: page.total_items }),
46 + onSome: slugs => ({
47 + items: page.items.filter(item =>
48 + slugs.includes(toolkitSlugFromTriggerName(item.trigger_name))
49 + ),
50 + total: page.items.length,
51 + }),
52 + });
53 +
54 +/**
55 + * Display active trigger instances with optional filters.
56 + *
57 + * @example
58 + * ```bash
59 + * composio dev triggers status
60 + * composio dev triggers status --toolkits gmail,slack --show-disabled
61 + * ```
62 + */
63 +export const runTriggersStatus = ({
64 + userIds,
65 + connectedAccountIds,
66 + toolkits,
67 + triggerIds,
68 + triggerNames,
69 + showDisabled,
70 + limit,
71 +}: TriggersStatusParams) =>
72 + Effect.gen(function* () {
73 + const ui = yield* TerminalUI;
74 + const repo = yield* ComposioToolkitsRepository;
75 +
76 + // An empty list (`--toolkits ","`) filters nothing.
77 + const toolkitFilter = Option.flatMap(toolkits, csv =>
78 + Arr.match(parseCsv(csv), {
79 + onEmpty: () => Option.none<Arr.NonEmptyReadonlyArray<string>>(),
80 + onNonEmpty: slugs => Option.some(Arr.map(slugs, slug => slug.toLowerCase())),
81 + })
82 + );
83 +
84 + const page = yield* ui
85 + .withSpinner(
86 + 'Fetching trigger status...',
87 + repo.listActiveTriggers({
88 + user_ids: csvOption(userIds),
89 + connected_account_ids: csvOption(connectedAccountIds),
90 + trigger_ids: csvOption(triggerIds),
91 + trigger_names: csvOption(triggerNames)?.map(name => name.toUpperCase()),
92 + show_disabled: showDisabled,
93 + limit: clampLimit(limit),
94 + })
95 + )
96 + .pipe(
97 + Effect.asSome,
98 + Effect.catchTag(
99 + CLIENT_API_ERROR_TAGS,
100 + handleClientApiError(ui, {
101 + fallbackMessage: 'Failed to fetch trigger status.',
102 + hint: 'Retry with:\n> composio dev triggers status --show-disabled',
103 + fallbackValue: Option.none(),
104 + })
105 + )
106 + );
107 +
108 + yield* Option.match(page, {
109 + onNone: () => Effect.void,
110 + onSome: result => {
111 + const { items, total } = filterByToolkits(result, toolkitFilter);
112 + return Arr.match(items, {
113 + onEmpty: () =>
114 + ui.log.warn(
115 + showDisabled
116 + ? 'No triggers found for the provided filters.'
117 + : 'No active triggers found for the provided filters.'
118 + ),
119 + onNonEmpty: shown =>
120 + Effect.gen(function* () {
121 + yield* ui.log.info(
122 + `Listing ${shown.length} of ${total} triggers\n\n${formatTriggersStatusTable(shown)}`
123 + );
124 + yield* ui.output(formatTriggersStatusJson(shown));
125 + }),
126 + });
127 + },
128 + });
129 + });
ts/packages/cli/src/commands/triggers/triggers.cmd.ts
+1 -1
@@ -3,7 +3,7 @@ import { Command } from 'effect/cli';
3 import { rejectsSharedFlags } from 'src/commands/surface';
4 import { triggersCmd$Info } from './info/triggers.info.cmd';
5 import { triggersCmd$List } from './list/triggers.list.cmd';
6 -import { triggersCmd$Status } from './commands/triggers.status.cmd';
6 +import { triggersCmd$Status } from './status/triggers.status.cmd';
7 import { triggersCmd$Create } from './create/triggers.create.cmd';
8 import { triggersCmd$Enable } from './enable/triggers.enable.cmd';
9 import { triggersCmd$Disable } from './disable/triggers.disable.cmd';
ts/packages/cli/test/src/commands/triggers/status/triggers.status.cmd.test.ts renamed
ts/packages/cli/test/src/commands/triggers/status/triggers.status.handler.test.ts new
+258
@@ -0,0 +1,258 @@
1 +import type { TriggerInstanceListActiveParams } from '@composio/client/resources/trigger-instances';
2 +import { describe, expect, it } from '@effect/vitest';
3 +import { Console, Effect, Layer, Option } from 'effect';
4 +import {
5 + runTriggersStatus,
6 + type TriggersStatusParams,
7 +} from 'src/commands/triggers/status/triggers.status.handler';
8 +import type { TriggerInstanceItem } from 'src/models/triggers';
9 +import { ComposioToolkitsRepository } from 'src/services/composio-clients';
10 +import { TerminalUI } from 'src/services/terminal-ui';
11 +import { MockConsole } from 'test/__utils__';
12 +import { notFoundError } from 'test/__utils__/layers/not-found';
13 +import { recordingNodeProcess } from 'test/__utils__/services/node-process-test';
14 +import { terminalUITestImpl } from 'test/__utils__/services/terminal-ui-test';
15 +import { makeToolkitsRepositoryStub } from 'test/__utils__/services/toolkits-repository-stub';
16 +
17 +const trigger = (id: string, triggerName: string): TriggerInstanceItem => ({
18 + id,
19 + uuid: `uuid-${id}`,
20 + trigger_name: triggerName,
21 + connected_account_id: `ca_${id}`,
22 + auth_config_id: `ac_${id}`,
23 + user_id: 'user_1',
24 + disabled_at: null,
25 + updated_at: '2026-02-01T00:00:00Z',
26 + trigger_data: '',
27 + state: {},
28 + trigger_config: {},
29 +});
30 +
31 +const GMAIL = trigger('trg_gmail', 'GMAIL_NEW_GMAIL_MESSAGE');
32 +const SLACK = trigger('trg_slack', 'SLACK_NEW_MESSAGE');
33 +
34 +const noFilters: TriggersStatusParams = {
35 + userIds: Option.none(),
36 + connectedAccountIds: Option.none(),
37 + toolkits: Option.none(),
38 + triggerIds: Option.none(),
39 + triggerNames: Option.none(),
40 + showDisabled: false,
41 + limit: 30,
42 +};
43 +
44 +interface TriggersStatusFixture {
45 + readonly items?: ReadonlyArray<TriggerInstanceItem>;
46 + /** The API's `total_items`, which can exceed the page it returned. */
47 + readonly totalItems?: number;
48 + readonly fails?: boolean;
49 +}
50 +
51 +/**
52 + * What `runTriggersStatus` reads: a repository whose `listActiveTriggers` records its params
53 + * and answers one page, and a headless terminal whose stdout data lands in `outputs`.
54 + */
55 +const triggersStatusTest = (fixture: TriggersStatusFixture = {}) => {
56 + const outputs: Array<string> = [];
57 + const requests: Array<TriggerInstanceListActiveParams> = [];
58 + const items = [...(fixture.items ?? [GMAIL, SLACK])];
59 + const proc = recordingNodeProcess();
60 +
61 + const layer = Layer.mergeAll(
62 + Layer.effect(Console.Console, MockConsole.make),
63 + proc.layer,
64 + Layer.succeed(
65 + TerminalUI,
66 + TerminalUI.of({
67 + ...terminalUITestImpl,
68 + output: data =>
69 + Effect.sync(() => {
70 + outputs.push(data);
71 + }),
72 + })
73 + ),
74 + Layer.succeed(
75 + ComposioToolkitsRepository,
76 + makeToolkitsRepositoryStub({
77 + listActiveTriggers: params =>
78 + Effect.suspend(() => {
79 + requests.push(params);
80 + return fixture.fails
81 + ? Effect.fail(notFoundError('no trigger instances'))
82 + : Effect.succeed({
83 + items,
84 + total_items: fixture.totalItems ?? items.length,
85 + total_pages: 1,
86 + current_page: 1,
87 + next_cursor: null,
88 + });
89 + }),
90 + })
91 + )
92 + );
93 + return { layer, outputs, requests, exitCode: proc.exitCode };
94 +};
95 +
96 +const stderr = MockConsole.getLines({ stream: 'stderr', stripAnsi: true });
97 +const allLines = MockConsole.getLines({ stripAnsi: true });
98 +
99 +describe('runTriggersStatus', () => {
100 + it.effect('[Given] no filters [Then] requests active triggers only, with no id filters', () => {
101 + const { layer, requests } = triggersStatusTest();
102 + return Effect.gen(function* () {
103 + yield* runTriggersStatus(noFilters);
104 +
105 + expect(requests).toEqual([
106 + {
107 + user_ids: undefined,
108 + connected_account_ids: undefined,
109 + trigger_ids: undefined,
110 + trigger_names: undefined,
111 + show_disabled: false,
112 + limit: 30,
113 + },
114 + ]);
115 + }).pipe(Effect.provide(layer));
116 + });
117 +
118 + it.effect(
119 + '[Given] every id filter [Then] splits each on commas and uppercases trigger names',
120 + () => {
121 + const { layer, requests } = triggersStatusTest();
122 + return Effect.gen(function* () {
123 + yield* runTriggersStatus({
124 + ...noFilters,
125 + userIds: Option.some('user_1, user_2'),
126 + connectedAccountIds: Option.some('ca_1,ca_2'),
127 + triggerIds: Option.some('ti_1'),
128 + triggerNames: Option.some('gmail_new_gmail_message,Slack_New_Message'),
129 + showDisabled: true,
130 + });
131 +
132 + expect(requests).toEqual([
133 + {
134 + user_ids: ['user_1', 'user_2'],
135 + connected_account_ids: ['ca_1', 'ca_2'],
136 + trigger_ids: ['ti_1'],
137 + trigger_names: ['GMAIL_NEW_GMAIL_MESSAGE', 'SLACK_NEW_MESSAGE'],
138 + show_disabled: true,
139 + limit: 30,
140 + },
141 + ]);
142 + }).pipe(Effect.provide(layer));
143 + }
144 + );
145 +
146 + it.effect.each([
147 + { limit: 0, expected: 1 },
148 + { limit: 1001, expected: 1000 },
149 + ])('[Given] limit $limit [Then] requests $expected triggers', ({ limit, expected }) => {
150 + const { layer, requests } = triggersStatusTest();
151 + return Effect.gen(function* () {
152 + yield* runTriggersStatus({ ...noFilters, limit });
153 +
154 + expect(requests.map(request => request.limit)).toEqual([expected]);
155 + }).pipe(Effect.provide(layer));
156 + });
157 +
158 + it.effect('[Given] no toolkit filter [Then] reports the API total and prints the page', () => {
159 + const { layer, outputs } = triggersStatusTest({ totalItems: 42 });
160 + return Effect.gen(function* () {
161 + yield* runTriggersStatus(noFilters);
162 +
163 + expect((yield* allLines).join('\n')).toContain('Listing 2 of 42 triggers');
164 + expect(outputs).toHaveLength(1);
165 + expect(JSON.parse(outputs[0] ?? '[]')).toEqual([
166 + {
167 + id: 'trg_gmail',
168 + uuid: 'uuid-trg_gmail',
169 + trigger_name: 'GMAIL_NEW_GMAIL_MESSAGE',
170 + toolkit_slug: 'gmail',
171 + user_id: 'user_1',
172 + connected_account_id: 'ca_trg_gmail',
173 + status: 'ACTIVE',
174 + disabled_at: null,
175 + updated_at: '2026-02-01T00:00:00Z',
176 + },
177 + {
178 + id: 'trg_slack',
179 + uuid: 'uuid-trg_slack',
180 + trigger_name: 'SLACK_NEW_MESSAGE',
181 + toolkit_slug: 'slack',
182 + user_id: 'user_1',
183 + connected_account_id: 'ca_trg_slack',
184 + status: 'ACTIVE',
185 + disabled_at: null,
186 + updated_at: '2026-02-01T00:00:00Z',
187 + },
188 + ]);
189 + }).pipe(Effect.provide(layer));
190 + });
191 +
192 + it.effect(
193 + '[Given] a toolkit filter [Then] keeps matching triggers and reports the page size as total',
194 + () => {
195 + const { layer, outputs, requests } = triggersStatusTest({ totalItems: 42 });
196 + return Effect.gen(function* () {
197 + yield* runTriggersStatus({ ...noFilters, toolkits: Option.some('SLACK') });
198 +
199 + expect(requests[0]).not.toHaveProperty('toolkits');
200 + expect((yield* allLines).join('\n')).toContain('Listing 1 of 2 triggers');
201 + expect(JSON.parse(outputs[0] ?? '[]')).toMatchObject([{ id: 'trg_slack' }]);
202 + }).pipe(Effect.provide(layer));
203 + }
204 + );
205 +
206 + it.effect('[Given] an empty toolkit filter [Then] applies no toolkit filter', () => {
207 + const { layer } = triggersStatusTest({ totalItems: 42 });
208 + return Effect.gen(function* () {
209 + yield* runTriggersStatus({ ...noFilters, toolkits: Option.some(' , ') });
210 +
211 + expect((yield* allLines).join('\n')).toContain('Listing 2 of 42 triggers');
212 + }).pipe(Effect.provide(layer));
213 + });
214 +
215 + it.effect.each([
216 + { showDisabled: false, message: 'No active triggers found for the provided filters.' },
217 + { showDisabled: true, message: 'No triggers found for the provided filters.' },
218 + ])(
219 + '[Given] nothing matches and showDisabled $showDisabled [Then] warns and outputs nothing',
220 + ({ showDisabled, message }) => {
221 + const { layer, outputs, exitCode } = triggersStatusTest({ items: [] });
222 + return Effect.gen(function* () {
223 + yield* runTriggersStatus({ ...noFilters, showDisabled });
224 +
225 + expect(outputs).toEqual([]);
226 + expect(yield* stderr).toEqual([message]);
227 + expect(exitCode()).toBeUndefined();
228 + }).pipe(Effect.provide(layer));
229 + }
230 + );
231 +
232 + it.effect('[Given] a toolkit filter no trigger matches [Then] warns and outputs nothing', () => {
233 + const { layer, outputs } = triggersStatusTest();
234 + return Effect.gen(function* () {
235 + yield* runTriggersStatus({ ...noFilters, toolkits: Option.some('github') });
236 +
237 + expect(outputs).toEqual([]);
238 + expect(yield* stderr).toEqual(['No active triggers found for the provided filters.']);
239 + }).pipe(Effect.provide(layer));
240 + });
241 +
242 + it.effect(
243 + '[Given] the API fails [Then] reports the fallback message, outputs nothing and exits 1',
244 + () => {
245 + const { layer, outputs, exitCode } = triggersStatusTest({ fails: true });
246 + return Effect.gen(function* () {
247 + yield* runTriggersStatus(noFilters);
248 +
249 + expect(outputs).toEqual([]);
250 + expect(exitCode()).toBe(1);
251 + expect(yield* stderr).toContain('Failed to fetch trigger status.');
252 + expect((yield* allLines).join('\n')).toContain(
253 + 'Retry with:\n> composio dev triggers status --show-disabled'
254 + );
255 + }).pipe(Effect.provide(layer));
256 + }
257 + );
258 +});