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): show account id, alias, and display name in connections list (#4946)
## Summary A UI that lists a person's connections with `composio connections list` can't label an account that is the only one for its toolkit, and can't show which provider account a connection is: - `alias` was printed only when a toolkit had more than one account, so the alias of a toolkit's only account was dropped. - The connected account `id` wasn't printed, although `execute --account`, `proxy --account` and `connections remove` accept it. - The provider identity Composio fills in for an active connection, `state.val.displayName` (documented in #4503), never reached the output, because the connected-account allowlist excludes all of `state` to keep credentials out of CLI output. Designated PR reviewer: @jkomyno Fixes #4808 ## Changes - `connections list` prints `id` on every entry, `alias` whenever the account has one (several accounts for one toolkit keep `alias: null` on entries without one, as before), and `display_name` when Composio has filled in a provider identity. - `ConnectedAccountItem`, the connected-account allowlist, gains `display_name`. It is decoded from the raw `state` key (`Schema.encodeKeys`) through a narrow schema that keeps only `state.val.displayName`: trimmed, non-empty, at most 200 characters (a longer value is left out rather than cut). It never fails the item — a missing, blank, non-string, or too long value leaves the key out — and encoding drops it, so `state` is never rebuilt from it. - The raw-response fallback in `decodeConnectedAccountListWithFallback` applies the same rule: each raw item gets the `display_name` decoded from its `state`, and any top-level `display_name` from the server is dropped, so an unchecked value can't reach the output. - Updated the command description, the CLI README command list, and an `Unreleased` entry in `ts/packages/cli/CHANGELOG.md` (`@composio/cli` is ignored by Changesets). Privacy: `state` carries OAuth tokens, refresh tokens, and API keys. The allowlist keeps excluding it; `display_name` reads exactly one value through a struct decode that drops every other key of `state` and `val`. Decoded items have no `state` key. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactor/Chore - [ ] Documentation - [ ] Breaking change ## How Has This Been Tested? New and updated vitest cases in `ts/packages/cli`: - `test/src/commands/connections/connections.list.cmd.test.ts`: every entry prints `id`; the only account of a toolkit prints its alias; with `state.val.displayName` plus credentials in `state`, `data`, and `params`, the output contains the trimmed display name and none of the credentials. - `test/src/effects/decode-connected-account-list.test.ts`: the allowlist keeps only the trimmed display name from `state` (including exactly 200 characters) and leaves the key out for null/non-object `state`, no `val`, no/blank/non-string/over-long `displayName`, or a top-level `display_name` without `state`. The raw fallback after an envelope-only mismatch derives `display_name` from `state` only. Commands (Node 24.20.0, pnpm 11.8.0, Windows): - Focused: `vitest run test/src/effects/decode-connected-account-list.test.ts test/src/commands/connections/connections.list.cmd.test.ts` — 26 passed. - `pnpm --filter @composio/cli run typecheck` — passes. `oxlint` on the changed files — 0 warnings, 0 errors. `prettier --check` on the changed files — clean. `pnpm --filter @composio/cli build` — passes. `validate:skills`, `validate:boundaries`, `validate:command-tests` — pass. - Full `@composio/cli` vitest suite on this Windows machine: 1656 passed / 176 failed, vs 1644 passed / 175 failed on the untouched base — the failures are pre-existing Windows-environment failures (e.g. no system Python, process/path handling in unrelated suites); the two files that swapped between runs pass when re-run. The repo's vitest config also assumes POSIX paths on Windows, so the suite was run with an equivalent local config (not included in this PR). Not run against the live API. The field location follows the docs from #4503 and the v3.1 OpenAPI schema, where `displayName` appears only under `state.val`. ## Screenshots (if applicable) None; the output is JSON. ## Checklist - [x] I have read the Code of Conduct and this PR adheres to it - [x] I have read and understand every line of this diff, including any LLM-generated code - [x] Any third-party docs links or promotional content follow the third-party links policy - [x] I ran linters/tests locally and they passed - [x] I updated documentation as needed - [x] I added tests or explain why not applicable - [ ] I added a changeset if this change affects published packages (not applicable: `@composio/cli` is in Changesets' `ignore` list, so the note is in `ts/packages/cli/CHANGELOG.md`) ## Additional context This follows the approach discussed on the earlier attempt in #4809 (closed unmerged), including the review note about sanitizing `display_name` on the raw-fallback path. Claimed under the Greenlight Claim Protocol on #4808. --------- Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com> Co-authored-by: jkomyno <alberto@composio.dev>