Skip to content

feat(connector): list all connected apps with org identity#295

Merged
BlackHole1 merged 2 commits into
mainfrom
feat/connector-apps-list-all
Jul 6, 2026
Merged

feat(connector): list all connected apps with org identity#295
BlackHole1 merged 2 commits into
mainfrom
feat/connector-apps-list-all

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

oo connector apps now 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 --personal flags mirror connector run, with the same precedence — flag > identity.organization config default > personal. A self-hosted connector rejects an explicit --organization and silently ignores any configured default, since the open-source runtime has no organization concept.

Both backends are queried through GET /v1/apps?status=active rather than the open-source /api/connections route the original request suggested. In the self-hosted open-connector, /v1/* is the runtime-token auth scope the CLI already authenticates with, whereas /api/connections is admin-scoped and would 401 whenever the server has an admin token configured. /v1/apps also 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_COLOR output stays plain aligned text — column widths are measured on ANSI-stripped length so the escapes never skew alignment.

Telemetry gains low-cardinality identity_source and list_scope (all/service) dimensions; the organization name is never recorded. Docs (EN + zh-CN) and tests are updated, including a new apps.test.ts unit covering the color and alignment logic.

`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>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ae1cdb88-f6b5-4917-b9b2-335b01e41a90

📥 Commits

Reviewing files that changed from the base of the PR and between 2cfc403 and 938438f.

📒 Files selected for processing (2)
  • src/application/commands/connector/apps.test.ts
  • src/application/commands/connector/apps.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/application/commands/connector/apps.test.ts
  • src/application/commands/connector/apps.ts

Summary by CodeRabbit

  • New Features
    • connector apps now accepts an optional service name to list all connected apps (all services) or apps for a specific service.
    • Added --organization and --personal options to scope listings.
    • Improved text output with a column-aligned, color-aware table (including “Service” column when listing across services).
  • Bug Fixes
    • Empty-state messages now better match the selected listing scope.
    • Missing connection/auth fields display consistently, including proper default status indicators.
  • Documentation
    • Updated English and Chinese command documentation to reflect the new argument and output behavior.
  • Tests
    • Expanded coverage for text/JSON output formatting and scoped behaviors.

Walkthrough

Changes

This PR updates oo connector apps to accept an optional serviceName, adds --organization and --personal identity scoping, and switches the command between service-scoped and all-services listing flows. It adds a shared listConnectorApps path and a unified response schema, rewrites text output formatting with scope-aware columns and colors, expands telemetry fields, and updates English/Chinese docs, i18n, and CLI/test coverage.

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
Loading

Possibly related PRs

  • oomol-lab/oo-cli#283: Modifies the shared connector-app listing/parsing path used by connector apps.
  • oomol-lab/oo-cli#285: Touches formatConnectorAppsAsText and connector app output-field rendering in the same command.
  • oomol-lab/oo-cli#291: Adds self-hosted connector target and identity handling related to this PR’s scoping logic.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required (): format and clearly matches the connector apps changes.
Description check ✅ Passed The description is directly related to the optional service listing, identity flags, text output, telemetry, docs, and tests in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/connector-apps-list-all

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b26006b and 2cfc403.

📒 Files selected for processing (8)
  • docs/commands.md
  • docs/commands.zh-CN.md
  • src/application/commands/connector/apps.test.ts
  • src/application/commands/connector/apps.ts
  • src/application/commands/connector/index.cli.test.ts
  • src/application/commands/connector/shared.ts
  • src/application/commands/telemetry-decisions.test.ts
  • src/i18n/catalog.ts

Comment thread src/application/commands/connector/apps.ts Outdated
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>
@BlackHole1 BlackHole1 merged commit 2c04b6a into main Jul 6, 2026
6 checks passed
@BlackHole1 BlackHole1 deleted the feat/connector-apps-list-all branch July 6, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant