@devries-cameron20 / composio Mirror · read-only / commits / 30e4b18e4
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 12:15 UTC

fix(cli): bare --stream, dead Slack slug in help, tools info exit code, unknown listen slug (#4344)

Fixes for four `composio` CLI issues found while using the released binary (v0.4.0). Each item below was reproduced from source on `next` before the change and re-run after it. All commands were run with stdin from `/dev/null`. ## 1. Bare `--stream` on `composio listen` is rejected **Repro (before):** ``` $ composio listen GMAIL_NEW_GMAIL_MESSAGE --stream Received unknown argument: '--stream=' <usage text> exit=1 ``` The command's own EXAMPLES block shows `composio listen GMAIL_NEW_GMAIL_MESSAGE -p @trigger.json --stream`, and `--stream=.data.text` / `--stream '.data.text'` both work. **Cause:** `normalizeListenStreamFlag` in `src/commands/index.ts` rewrites a valueless `--stream` to `--stream=`. `@effect/cli` only recognises `--flag=value` when the value is non-empty (`FLAG_REGEX = /^(--[^=]+)(?:=(.+))?$/`), so `--stream=` is treated as an unknown argument. **Change:** rewrite bare `--stream` to the two tokens `--stream ''` instead. The listen handler already treats an empty path as "stream the whole payload", so no handler change is needed. **After:** `composio listen GMAIL_NEW_GMAIL_MESSAGE --stream` and `... --stream --max-events 1` both parse and proceed to trigger creation. Tests added in `listen.cmd.test.ts` cover bare `--stream` at the end of argv and followed by another option. ## 2. Help examples reference a tool slug that no longer exists **Repro (before):** ``` $ composio --help full | grep SLACK_ SLACK_SEND_A_MESSAGE_TO_A_SLACK_CHANNEL -d '{ channel: "general", text: "Hello" }' $ composio execute SLACK_SEND_A_MESSAGE_TO_A_SLACK_CHANNEL --dry-run -d '{ channel: "general", text: "Hello team" }' services/HttpServerError Caused by: 404 {"error":{"message":"Tool SLACK_SEND_A_MESSAGE_TO_A_SLACK_CHANNEL not found","code":2401,"slug":"Tool_ToolNotFound",...}} exit=1 ``` The current slug is `SLACK_SEND_MESSAGE`. Its input schema (`composio tools info SLACK_SEND_MESSAGE`) has `channel`, `markdown_text`, `blocks`, `thread_ts`, ... and no `text` key. **Change:** the three occurrences in `src/commands/root-help.ts` (execute examples, the `run` script example, and the root help snippet) now use `SLACK_SEND_MESSAGE` with `markdown_text`. No other file in the repo references the old slug. ## 3. `composio tools info <bad-slug>` prints nothing and exits 0 **Repro (before):** ``` $ composio tools info BOGUS_TOOL_XYZ; echo exit=$? exit=0 $ composio tools info BOGUS_TOOL_XYZ 2>/dev/null | wc -c 0 ``` `tools info` catches the 404 with the shared `handleHttpServerError` helper, which logs through `ui.log.error` (rendered only when stderr is a TTY) and returns a fallback value, so the command completes successfully with no output when piped. **Change:** `src/effects/handle-http-error.ts` now sets `process.exitCode = 1` (the convention used elsewhere in the CLI, e.g. `toolkits search`) and, when stderr is not a TTY, writes the error message plainly via `ui.error` so it is still visible. The decorated log/hint/suggestion flow is unchanged. This helper is shared by the `info`/`create`/`enable`/`disable`/`status` commands for tools, triggers, auth configs and connected accounts, all of which return early on the same failure path, so they now exit non-zero on an API error as well. **After:** ``` $ composio tools info BOGUS_TOOL_XYZ; echo exit=$? Tool "BOGUS_TOOL_XYZ" not found. exit=1 ``` Tests added in `tools.info.cmd.test.ts` assert the exit code and message for an unknown slug, and that a valid slug leaves the exit code untouched. ## 4. `composio listen <unknown-slug>` reports a missing connection instead of an unknown slug **Repro (before):** ``` $ composio listen BOGUS_SLUG_XYZ commands/ListenCommandError • No active connected account found for toolkit "bogus" and consumer user "...". Run `composio link bogus` first. exit=1 ``` The toolkit is inferred from the slug prefix and the connected-account lookup runs without checking that the trigger type exists, so a typo sends the user to link an account for a toolkit that does not exist. **Change:** in `src/commands/listen.cmd.ts`, when no active connected account matches, the command now retrieves the trigger type first. A 404 fails with a new `unknown_trigger` reason; any other outcome falls through to the existing connected-account error. The same lookup runs when creating the temporary trigger fails, because an active account for the inferred toolkit (e.g. `GMAIL_NEW_GMAIL_MESAGE` with Gmail linked) skips the first check; a 404 there replaces the generic `create_trigger` error. The happy path makes no additional request. **After:** ``` $ composio listen BOGUS_SLUG_XYZ commands/ListenCommandError • Unknown trigger slug "BOGUS_SLUG_XYZ". List available slugs with `composio triggers list <toolkit>`. exit=1 ``` The test layer gained a `triggersTypes.retrieve` mock (the base client would otherwise hit the network), and `listen.cmd.test.ts` covers the unknown-slug case both without an account and with an active account for the inferred toolkit (the test layer's `triggerInstances.upsert` can now reject unknown slugs via `triggersData.rejectUnknownTriggerSlugs`). The existing missing-connection test now provides a `GMAIL_NEW_GMAIL_MESSAGE` trigger-type fixture so it still exercises the connected-account branch. ## Also: `listen` example used a trigger with an empty config While updating the help examples above, the `-p` example `composio listen SLACK_RECEIVE_MESSAGE -p '{ trigger_config: { channel: "C123" } }'` was replaced. `composio triggers info SLACK_RECEIVE_MESSAGE` returns `"config": {"properties": {}, ...}`, so that example configures nothing. `SLACK_CHANNEL_MESSAGE_RECEIVED` takes `channel_id`, so the example now uses that trigger and key. Same one-line change in `skills-src/composio-cli/index.ts`, which is the source for the generated CLI skill. ## Changelog All four fixes are recorded under Unreleased in `ts/packages/cli/CHANGELOG.md` (the CLI is excluded from Changesets). ## Verification - `pnpm typecheck` (src + test) in `ts/packages/cli` - `pnpm test` in `ts/packages/cli` (validate:skills, validate:boundaries, vitest) - `oxlint` and `prettier --check` on the changed files - Live re-runs of each repro above against the API from source

Alberto Schiabel committed Sep 15, 2026 at 13:10 UTC 30e4b18e4a5e6a36b4cd47e40464a83bfb7cffbe

No changes.