refactor(team)!: rename organization to team across the CLI#300
Conversation
The product renamed the organization concept to team, and the gateway
already shipped the wire-side rename ahead of us: `relation-control`
is now the canonical host with `org-control` retained only as a legacy
alias, and the policy layer reads `x-oo-team-name`. The CLI was the
last un-migrated caller, still speaking the old vocabulary end to end.
Rename the concept wholesale rather than layering aliases over it. The
`oo org` command group becomes `oo team`; `--organization` and its
`--org` alias collapse into a single `--team`; the config key
`identity.organization` becomes `identity.team`. Membership lookups now
target `relation-control.{endpoint}/v1/me/teams` and read a `teams`
response array, and execution requests send `x-oo-team-name`. The
English and Chinese catalogs, the docs, and the bundled skill guidance
follow the same rename.
Backwards compatibility is dropped deliberately: the old command,
flags, and config key are removed rather than deprecated. A lingering
`identity.organization` in settings.toml is ignored — logged as an
unknown key — and connector commands fall back to the personal
identity.
The GitHub-organization references in `contrib/ci/` are a different
concept and are left untouched.
BREAKING CHANGE: `oo org` is now `oo team`. `--organization` / `--org`
is now `--team`. The `identity.organization` config key is now
`identity.team`; update settings.toml, since the old key is ignored and
the run silently falls back to the personal identity.
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 (5)
🚧 Files skipped from review as they are similar to previous changes (5)
Summary by CodeRabbit
WalkthroughThe CLI replaces organization identity with team identity across settings, configuration, connector commands, headers, telemetry, localization, and documentation. New Sequence Diagram(s)sequenceDiagram
participant CLI
participant IdentityResolver
participant Connector
CLI->>IdentityResolver: Resolve --team, identity.team, or --personal
IdentityResolver-->>CLI: Resolved identity
CLI->>Connector: Send request with x-oo-team-name when applicable
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/application/commands/connector/run.ts (1)
160-195: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winExtract the duplicated team-identity resolution flow into a shared helper.
run.ts,apps.ts, andproxy.tseach reimplement the identical sequence:--personal/--teamconflict check,teamFlagtrim/empty validation, self-hosted rejection, thensettingsread +resolveConnectorIdentityternary.identity.tsalready centralizesresolveConnectorIdentity/connectorIdentityHeaders, so it's the natural home for a single helper (e.g.resolveCommandConnectorIdentity(input, context, target)) that performs all four steps once and returns{ identity, source }or throws. This removes ~25 duplicated lines per command and prevents the three handlers from silently drifting apart on identity validation as new commands are added.
src/application/commands/connector/run.ts#L160-L195: replace the conflict check,teamFlagvalidation, self-hosted rejection, and settings/resolve block with a call to the new shared helper.src/application/commands/connector/apps.ts#L89-L118: replace the identical block with the same shared helper call.src/application/commands/connector/proxy.ts#L141-L167: replace the identical block with the same shared helper call.As per coding guidelines, "When identical logic appears in 2+ files, extract it to a shared module."
🤖 Prompt for 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. In `@src/application/commands/connector/run.ts` around lines 160 - 195, Extract the duplicated connector identity validation and resolution flow into a shared helper in identity.ts, such as resolveCommandConnectorIdentity, covering personal/team conflicts, team trimming and empty validation, self-hosted rejection, settings retrieval, and resolveConnectorIdentity; return the existing identity/source pair. Replace the duplicated blocks in src/application/commands/connector/run.ts lines 160-195, src/application/commands/connector/apps.ts lines 89-118, and src/application/commands/connector/proxy.ts lines 141-167 with calls to this helper, preserving existing errors and behavior at each site.Source: Coding guidelines
src/application/commands/config/index.cli.test.ts (1)
316-344: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd a nested
identity.organizationcase here. This test only covers a top-level unknown key; addidentity.organizationso the legacy migration path is exercised too.🤖 Prompt for 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. In `@src/application/commands/config/index.cli.test.ts` around lines 316 - 344, Add a nested identity.organization entry to the persisted settings fixture in the test “ignores unknown persisted settings keys and logs a warning,” then update the warning assertions to verify that this nested unknown path is reported alongside updateNotifier, exercising the legacy migration path.
🧹 Nitpick comments (1)
src/application/commands/team/index.cli.test.ts (1)
34-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the recurring CLI test setup into a local factory.
These tests repeatedly create a sandbox and write the same auth fixture. Add a local factory at the bottom of this file and use it across the suite. As per coding guidelines, “In test files, extract repeated setup (mock, stub, or setup objects) into a local factory function at the bottom of the file.”
Also applies to: 79-85, 100-106, 118-123, 139-144, 176-183, 201-207, 220-225, 238-244
🤖 Prompt for 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. In `@src/application/commands/team/index.cli.test.ts` around lines 34 - 39, The team CLI tests repeat sandbox creation and auth-fixture setup; extract this into a local factory at the bottom of the test file. Update each affected test to use the factory, preserving any test-specific configuration such as setting identity.team after the shared setup.Source: Coding guidelines
🤖 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 `@contrib/skills/shared/oo/references/connector-execution.md`:
- Around line 171-172: Update the guidance near the identity.team behavior to
state that omitting both flags uses the configured team when identity.team is
set, while only --personal forces a personal run; retain the default
personal-identity behavior when no team is configured.
In `@docs/commands.md`:
- Around line 217-224: Update the Teams documentation section in
docs/commands.md (lines 217-224) and docs/commands.zh-CN.md (lines 191-196) to
scope the OOMOL/self-hosted restriction only to account-backed team lookup/use
commands, specifically oo team list and oo team use. Clarify that oo team
current and oo team clear are offline/local commands and remain available
without OOMOL access.
In `@docs/self-hosted-connector.md`:
- Around line 180-183: Update the team identity restriction documentation in
docs/self-hosted-connector.md lines 180-183 to state that oo connector apps
--team is rejected with exit code 2, alongside the existing run and proxy
commands. Add equivalent Chinese wording in docs/self-hosted-connector.zh-CN.md
lines 161-163.
---
Outside diff comments:
In `@src/application/commands/config/index.cli.test.ts`:
- Around line 316-344: Add a nested identity.organization entry to the persisted
settings fixture in the test “ignores unknown persisted settings keys and logs a
warning,” then update the warning assertions to verify that this nested unknown
path is reported alongside updateNotifier, exercising the legacy migration path.
In `@src/application/commands/connector/run.ts`:
- Around line 160-195: Extract the duplicated connector identity validation and
resolution flow into a shared helper in identity.ts, such as
resolveCommandConnectorIdentity, covering personal/team conflicts, team trimming
and empty validation, self-hosted rejection, settings retrieval, and
resolveConnectorIdentity; return the existing identity/source pair. Replace the
duplicated blocks in src/application/commands/connector/run.ts lines 160-195,
src/application/commands/connector/apps.ts lines 89-118, and
src/application/commands/connector/proxy.ts lines 141-167 with calls to this
helper, preserving existing errors and behavior at each site.
---
Nitpick comments:
In `@src/application/commands/team/index.cli.test.ts`:
- Around line 34-39: The team CLI tests repeat sandbox creation and auth-fixture
setup; extract this into a local factory at the bottom of the test file. Update
each affected test to use the factory, preserving any test-specific
configuration such as setting identity.team after the shared setup.
🪄 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: 431af796-b67b-4769-888e-b8129c2d5ef8
⛔ Files ignored due to path filters (3)
src/application/bootstrap/__snapshots__/run-cli.test.ts.snapis excluded by!**/*.snapsrc/application/commands/config/__snapshots__/index.cli.test.ts.snapis excluded by!**/*.snapsrc/application/commands/connector/__snapshots__/index.cli.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (32)
contrib/skills/shared/oo/references/connector-execution.mddocs/commands.mddocs/commands.zh-CN.mddocs/self-hosted-connector.mddocs/self-hosted-connector.zh-CN.mdsrc/application/commands/catalog.tssrc/application/commands/config/index.cli.test.tssrc/application/commands/config/shared.tssrc/application/commands/connector/apps.tssrc/application/commands/connector/identity.test.tssrc/application/commands/connector/identity.tssrc/application/commands/connector/index.cli.test.tssrc/application/commands/connector/proxy.tssrc/application/commands/connector/run.tssrc/application/commands/connector/shared.test.tssrc/application/commands/org/clear.tssrc/application/commands/org/current.tssrc/application/commands/org/index.tssrc/application/commands/org/shared.tssrc/application/commands/org/use.tssrc/application/commands/team/clear.tssrc/application/commands/team/current.tssrc/application/commands/team/index.cli.test.tssrc/application/commands/team/index.tssrc/application/commands/team/list.test.tssrc/application/commands/team/list.tssrc/application/commands/team/shared.test.tssrc/application/commands/team/shared.tssrc/application/commands/team/use.tssrc/application/commands/telemetry-decisions.test.tssrc/application/schemas/settings.tssrc/i18n/catalog.ts
💤 Files with no reviewable changes (5)
- src/application/commands/org/shared.ts
- src/application/commands/org/clear.ts
- src/application/commands/org/use.ts
- src/application/commands/org/index.ts
- src/application/commands/org/current.ts
| - **Team identity is not supported.** `--team` is rejected with exit code `2` on | ||
| `oo connector run` and `oo connector proxy`, and any configured `identity.team` | ||
| default is ignored. `--personal` is accepted (it is already the effective | ||
| behavior). |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Document the oo connector apps restriction in both self-hosted guides.
docs/self-hosted-connector.md#L180-L183: includeoo connector apps --teamas rejected with exit code2.docs/self-hosted-connector.zh-CN.md#L161-L163: add the equivalent Chinese wording.
📍 Affects 2 files
docs/self-hosted-connector.md#L180-L183(this comment)docs/self-hosted-connector.zh-CN.md#L161-L163
🤖 Prompt for 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.
In `@docs/self-hosted-connector.md` around lines 180 - 183, Update the team
identity restriction documentation in docs/self-hosted-connector.md lines
180-183 to state that oo connector apps --team is rejected with exit code 2,
alongside the existing run and proxy commands. Add equivalent Chinese wording in
docs/self-hosted-connector.zh-CN.md lines 161-163.
CodeRabbit caught three inaccuracies in the prose the rename touched. All three predate this PR but are worth fixing while the lines are already in the diff. The skill guidance told agents that omitting `--team` and `--personal` runs under the personal identity. It does not: `resolveConnectorIdentity` falls back to the `identity.team` config default first, so an agent following that advice would execute under the wrong identity whenever a default team is configured. Only `--personal` forces a personal run. The Teams section claimed the whole command group needs an OOMOL account. Only `oo team list` and `oo team use` do — they query membership. `oo team current` and `oo team clear` just read and write local settings and work with no account at all. The self-hosted guides listed `--team` as rejected on `oo connector run` and `oo connector proxy` but omitted `oo connector apps`, which rejects it the same way. Signed-off-by: Kevin Cui <bh@bugs.cc>
The product renamed the organization concept to team, and the gateway already shipped the wire-side rename ahead of us:
relation-controlis now the canonical host withorg-controlretained only as a legacy alias, and the policy layer readsx-oo-team-name. The CLI was the last un-migrated caller, still speaking the old vocabulary end to end.Rename the concept wholesale rather than layering aliases over it. The
oo orgcommand group becomesoo team;--organizationand its--orgalias collapse into a single--team; the config keyidentity.organizationbecomesidentity.team. Membership lookups now targetrelation-control.{endpoint}/v1/me/teamsand read ateamsresponse array, and execution requests sendx-oo-team-name. The English and Chinese catalogs, the docs, and the bundled skill guidance follow the same rename.Backwards compatibility is dropped deliberately: the old command, flags, and config key are removed rather than deprecated. A lingering
identity.organizationin settings.toml is ignored — logged as an unknown key — and connector commands fall back to the personal identity.The GitHub-organization references in
contrib/ci/are a different concept and are left untouched.BREAKING CHANGE:
oo orgis nowoo team.--organization/--orgis now--team. Theidentity.organizationconfig key is nowidentity.team; update settings.toml, since the old key is ignored and the run silently falls back to the personal identity.