feat(connector): list all connected apps with org identity#295
Conversation
`oo connector apps` now answers "which providers are connected": the service argument is optional, and omitting it lists every connected app under the effective identity. Add `--organization` (alias `--org`) and `--personal` flags mirroring `connector run`, so the listing can be scoped to an organization or forced to the personal identity; a self-hosted connector rejects `--organization` and ignores any configured default. Both backends are queried through `GET /v1/apps?status=active`, not the open-source `/api/connections` route. In the self-hosted open-connector, `/v1/*` is the runtime-token auth scope the CLI already holds, while `/api/connections` requires an admin token the CLI never has; `/v1/apps` also returns the same app-view shape as the hosted service, so one schema parses both. Replace the tab-separated text output with a column-aligned, color-coded table: services use the connector accent color, statuses are green/yellow/red by health, and the default connection is marked with a green check. Colors flow through the writer-aware palette, so piped or `NO_COLOR` output stays plain aligned text. Signed-off-by: Kevin Cui <bh@bugs.cc>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughChangesThis PR updates Sequence Diagram(s)sequenceDiagram
participant User
participant connectorAppsCommand
participant shared.ts
participant formatConnectorAppsAsText
User->>connectorAppsCommand: oo connector apps [serviceName] [--organization|--personal]
connectorAppsCommand->>connectorAppsCommand: validate identity flags
alt serviceName provided
connectorAppsCommand->>shared.ts: listConnectorAppsByService(serviceName, identity)
else no serviceName
connectorAppsCommand->>shared.ts: listConnectorApps(identity)
end
shared.ts-->>connectorAppsCommand: ConnectorAppView[]
alt json output
connectorAppsCommand-->>User: JSON output
else text output
connectorAppsCommand->>formatConnectorAppsAsText: render(apps, listScope, translator, colors)
formatConnectorAppsAsText-->>connectorAppsCommand: table text
connectorAppsCommand-->>User: text output
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/application/commands/connector/apps.ts`:
- Around line 270-272: The visibleWidth helper is using
colors.strip(cell).length, which measures code units rather than rendered width
and can misalign the connector apps table for CJK/emoji text. Update
visibleWidth to use a width-aware measurement for the stripped cell content
instead of .length, and keep the change localized to the visibleWidth function
so the table padding logic uses displayed column width.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f4a519a-4f02-43e4-a0dc-e927fd3602e8
📒 Files selected for processing (8)
docs/commands.mddocs/commands.zh-CN.mdsrc/application/commands/connector/apps.test.tssrc/application/commands/connector/apps.tssrc/application/commands/connector/index.cli.test.tssrc/application/commands/connector/shared.tssrc/application/commands/telemetry-decisions.test.tssrc/i18n/catalog.ts
The `oo connector apps` table padded columns by `colors.strip(cell) .length`, which counts UTF-16 code units. A wide CJK display name or an emoji is one or two code units but occupies two terminal columns, so such a cell was under-padded and pushed the following columns out of alignment. Measure the visible width with `Bun.stringWidth()` instead: it treats ANSI color escapes as zero width and counts wide CJK/emoji glyphs as two columns, so both color codes and multi-cell characters keep the table aligned. The color palette is no longer needed for measurement, so the width helper drops its `colors` parameter. Signed-off-by: Kevin Cui <bh@bugs.cc>
oo connector appsnow answers "which providers are connected". The service argument is optional: omit it to list every connected app under the effective identity, or pass it to scope to a single service as before. New--organization(alias--org) and--personalflags mirrorconnector run, with the same precedence — flag >identity.organizationconfig default > personal. A self-hosted connector rejects an explicit--organizationand silently ignores any configured default, since the open-source runtime has no organization concept.Both backends are queried through
GET /v1/apps?status=activerather than the open-source/api/connectionsroute the original request suggested. In the self-hosted open-connector,/v1/*is the runtime-token auth scope the CLI already authenticates with, whereas/api/connectionsis admin-scoped and would401whenever the server has an admin token configured./v1/appsalso returns the same app-view envelope as the hosted service, so one schema parses both backends and there is no second code path to maintain.Separately, the text output moves from misaligned tab-separated columns to a column-aligned, color-coded table: service names use the connector accent color, statuses are green/yellow/red by health, and the default connection is marked with a green check. Colors flow through the writer-aware palette, so piped or
NO_COLORoutput stays plain aligned text — column widths are measured on ANSI-stripped length so the escapes never skew alignment.Telemetry gains low-cardinality
identity_sourceandlist_scope(all/service) dimensions; the organization name is never recorded. Docs (EN + zh-CN) and tests are updated, including a newapps.test.tsunit covering the color and alignment logic.