feat(cli): select and remove any saved agent account from orca account (#38944)

* feat(cli): select and remove any saved agent account from `orca account`

`orca account select` and `orca account rm` accepted only OpenCode and
Devin. They now cover every provider with saved accounts — Claude, Codex,
OpenCode, Devin and Antigravity — through the runtime methods the
status-bar switcher and Settings already use (accounts.selectClaude,
selectCodex/selectCodexForTarget, selectData, antigravitySelect and the
matching remove methods). No runtime or wire change.

`--account` takes an id, an email/label (case-insensitive) or `system`.
A name shared by several accounts is refused with their ids rather than
guessing which subscription to bill. `system` is refused for Antigravity
(no system default), for Claude from the WSL bridge (the RPC has no
target and would reset the Windows host), and always for `rm`.

`orca account list` now prints each account's id and a `system` row,
accepts `--agent` for every provider, and adds the Antigravity block when
the host can read it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cli): assert the host refusal for Antigravity accounts from WSL

The host rejects every client-selected WSL target for Antigravity account
management, reads included, so the test now mirrors that refusal and checks
that no select call is made instead of asserting an impossible success path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cli): keep only the account-selection tests that guard this change

Moves the guards into account.test.ts (the handler layer that owns them) and
drops layer-duplicating, copy-pinning, Cartesian and mock-only cases per
AGENTS.md test rules; un-exports resolveAccountId (test-only export).

---------

Co-authored-by: Maxime AUBURTIN <m@hellomax.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Neil
2026-11-06 03:03:51 -08:00
committed by GitHub
co-authored by Maxime AUBURTIN Claude Opus 5.5
parent f0b71c9368
commit 352e69f09c
11 changed files with 531 additions and 45 deletions
+12
View File
@@ -389,6 +389,18 @@ orca account add --agent codex
`account add` runs `claude login` / `codex login` in **this** terminal on the host, then registers the captured credentials with the local runtime. Codex uses device authorization so the browser can finish on another machine. Run these on the machine that owns the accounts — not through a client-only remote session.
Switch which saved account new agents launch with, for any provider with saved accounts (Claude, Codex, OpenCode, Devin, Antigravity):
```bash
orca account list # ids, emails/labels, and the active one
orca account select --agent claude --account you@example.com # id, email or label
orca worktree create --name task --agent claude --prompt "..."
orca account select --agent claude --account system # back to your own sign-in
orca account rm --agent codex --account old@example.com # forget a saved account
```
A selection applies to every agent of that provider launched on the host after it — the same switch as the status-bar account menu — not to a single workspace. An email shared by several accounts (one sign-in in two organizations) is refused; pass the id instead. Antigravity has no `system` default, and `account rm` never removes system credentials.
## Artifacts
Publish HTML or Markdown through the signed-in Orca account. Viewing a public link does not require sign-in; create/list/update/delete do. **Publishing is off by default** — a human must enable **Settings → Artifacts → Allow publishing public artifact links** on the device. There is no CLI flag that grants the gate. `list`, `unshare`, and `delete` stay available so you can audit or revoke links after turning publishing off.
+22 -3
View File
@@ -1,3 +1,4 @@
import type { AntigravityAccountState } from '../../shared/antigravity-account-types'
import type { ManagedDataAccountsState } from '../../shared/managed-account-types'
type AccountsBlock = {
@@ -23,19 +24,37 @@ export function formatDataAccounts(label: string, state: ManagedDataAccountsStat
}
export function formatAccountsBlock(label: string, block: AccountsBlock): string {
const hostAccountId = block.activeAccountIdsByRuntime?.host ?? block.activeAccountId
const system = ` system System default${hostAccountId === null ? ' (active)' : ''}`
if (block.accounts.length === 0) {
return `No managed ${label} accounts.`
return `No managed ${label} accounts.\n${system}`
}
const activeAccountIds = new Set([
block.activeAccountId,
block.activeAccountIdsByRuntime?.host,
...Object.values(block.activeAccountIdsByRuntime?.wsl ?? {})
])
// Why the id: `orca account select --account` needs it when one email signs into several orgs.
const lines = block.accounts.map(
(account) =>
` ${account.email}${activeAccountIds.has(account.id) ? ' (active)' : ''}${
` ${account.id} ${account.email}${activeAccountIds.has(account.id) ? ' (active)' : ''}${
account.needsSignIn ? ' (sign in again in Orca Settings > AI Provider Accounts)' : ''
}`
)
return `Managed ${label} accounts (${block.accounts.length}):\n${lines.join('\n')}`
return `Managed ${label} accounts (${block.accounts.length}):\n${system}\n${lines.join('\n')}`
}
/** Antigravity has no system default: one saved account always owns the native login. */
export function formatAntigravityAccounts(state: AntigravityAccountState): string {
if (state.accounts.length === 0) {
return 'No managed Antigravity accounts.'
}
return `Managed Antigravity accounts (${state.accounts.length}):\n${state.accounts
.map(
(account) =>
` ${account.id} ${account.email ?? account.subject ?? account.id}${
account.id === state.activeAccountId ? ' (active)' : ''
}`
)
.join('\n')}`
}
+349
View File
@@ -0,0 +1,349 @@
import type { HandlerContext } from '../dispatch'
import { printResult } from '../format'
import { RuntimeClientError } from '../runtime-client'
import { ANTIGRAVITY_ACCOUNTS_RUNTIME_CAPABILITY } from '../../shared/account-runtime-capabilities'
import type {
AntigravityAccountState,
AntigravityAccountTarget
} from '../../shared/antigravity-account-types'
import type {
ClaudeRateLimitAccountsState,
CodexRateLimitAccountsState,
ManagedDataAccountProvider,
ManagedDataAccountsState
} from '../../shared/managed-account-types'
import type { RuntimeStatus } from '../../shared/runtime-types'
import { getWslAccountTarget } from './account-wsl-location'
import {
formatAccountsBlock,
formatAntigravityAccounts,
formatDataAccounts
} from './account-list-format'
import { assertDataAccountsSupported, listDataAccounts } from './data-account-commands'
const ACCOUNT_AGENTS = ['claude', 'codex', 'opencode', 'devin', 'antigravity'] as const
type AccountAgent = (typeof ACCOUNT_AGENTS)[number]
const AGENT_FLAG_HINT = 'Use --agent claude|codex|opencode|devin|antigravity.'
const ACCOUNT_FLAG_HINT = 'Use --account <id|email|label|system> from `orca account list`.'
/** One saved account and the names `--account` may call it by (email, label, subject). */
type AccountChoice = { id: string; names: readonly (string | null | undefined)[] }
/**
* Every provider with saved accounts, behind one shape so select and rm resolve
* `--account` the same way. Each operation prints its own result, which keeps the
* per-provider state types out of the shared code.
*/
type ProviderAccounts = {
label: string
/** Whether `system` (the provider's own sign-in, outside Orca's vault) can be selected. */
hasSystemDefault: boolean
choices: () => Promise<AccountChoice[]>
list: () => Promise<void>
select: (accountId: string | null) => Promise<void>
remove: (accountId: string) => Promise<void>
}
type ClaudeCodexSnapshot = {
claude: ClaudeRateLimitAccountsState
codex: CodexRateLimitAccountsState
}
function emailChoices(state: { accounts: readonly { id: string; email: string }[] }) {
return state.accounts.map((account) => ({ id: account.id, names: [account.email] }))
}
function claudeAccounts({ client, json }: HandlerContext): ProviderAccounts {
const read = () => client.call<ClaudeCodexSnapshot>('accounts.list', { refreshUsage: false })
const print = async (method: string, accountId: string | null) =>
printResult(
await client.call<ClaudeRateLimitAccountsState>(method, { accountId }),
json,
(state) => formatAccountsBlock('Claude', state)
)
return {
label: 'Claude',
hasSystemDefault: true,
choices: async () => emailChoices((await read()).result.claude),
list: async () => {
const response = await read()
printResult({ ...response, result: response.result.claude }, json, (state) =>
formatAccountsBlock('Claude', state)
)
},
select: (accountId) => print('accounts.selectClaude', accountId),
remove: (accountId) => print('accounts.removeClaude', accountId)
}
}
function codexAccounts({ client, cwd, json }: HandlerContext): ProviderAccounts {
const read = () => client.call<ClaudeCodexSnapshot>('accounts.list', { refreshUsage: false })
const format = (state: CodexRateLimitAccountsState) => formatAccountsBlock('Codex', state)
const wslTarget = getWslAccountTarget(cwd)
return {
label: 'Codex',
hasSystemDefault: true,
choices: async () => emailChoices((await read()).result.codex),
list: async () => {
const response = await read()
printResult({ ...response, result: response.result.codex }, json, format)
},
// Why ForTarget from WSL: plain selectCodex always writes the Windows host slot.
select: async (accountId) =>
printResult(
wslTarget
? await client.call<CodexRateLimitAccountsState>('accounts.selectCodexForTarget', {
accountId,
target: wslTarget
})
: await client.call<CodexRateLimitAccountsState>('accounts.selectCodex', { accountId }),
json,
format
),
remove: async (accountId) =>
printResult(
await client.call<CodexRateLimitAccountsState>('accounts.removeCodex', { accountId }),
json,
format
)
}
}
function dataAccounts(ctx: HandlerContext, provider: ManagedDataAccountProvider): ProviderAccounts {
const { client, json } = ctx
const label = provider === 'opencode' ? 'OpenCode' : 'Devin'
const read = async () => {
await assertDataAccountsSupported(ctx)
const response =
await client.call<Partial<Record<ManagedDataAccountProvider, ManagedDataAccountsState>>>(
'accounts.listData'
)
const state = response.result[provider]
if (!state) {
throw new RuntimeClientError(
'incompatible_runtime',
'Managed accounts are unavailable on this host.'
)
}
return { ...response, result: state }
}
const print = async (method: string, accountId: string | null) =>
printResult(
await client.call<ManagedDataAccountsState>(method, { provider, accountId }),
json,
(state) => formatDataAccounts(label, state)
)
return {
label,
hasSystemDefault: true,
choices: async () =>
(await read()).result.accounts.map((account) => ({ id: account.id, names: [account.label] })),
list: () => listDataAccounts(ctx, provider),
select: (accountId) => print('accounts.selectData', accountId),
remove: (accountId) => print('accounts.removeData', accountId)
}
}
async function supportsAntigravityAccounts({ client }: HandlerContext): Promise<boolean> {
const status = await client.call<RuntimeStatus>('status.get')
return status.result.capabilities?.includes(ANTIGRAVITY_ACCOUNTS_RUNTIME_CAPABILITY) ?? false
}
function antigravityTarget(cwd: string): AntigravityAccountTarget {
return getWslAccountTarget(cwd) ?? { runtime: 'host' }
}
function antigravityAccounts(ctx: HandlerContext): ProviderAccounts {
const { client, cwd, json } = ctx
const target = antigravityTarget(cwd)
const read = async () => {
if (!(await supportsAntigravityAccounts(ctx))) {
throw new RuntimeClientError(
'incompatible_runtime',
'Update or restart this Orca host to manage Antigravity accounts.'
)
}
return client.call<AntigravityAccountState>('accounts.antigravityList', target)
}
const print = async (method: string, accountId: string) =>
printResult(
await client.call<AntigravityAccountState>(method, { target, accountId }),
json,
formatAntigravityAccounts
)
return {
label: 'Antigravity',
// Why: the native `agy` login is always one of the saved accounts; there is no
// separate system sign-in to fall back to.
hasSystemDefault: false,
choices: async () =>
(await read()).result.accounts.map((account) => ({
id: account.id,
names: [account.email, account.subject]
})),
list: async () => printResult(await read(), json, formatAntigravityAccounts),
select: async (accountId) => {
if (accountId === null) {
throw new RuntimeClientError('invalid_argument', 'Antigravity has no system default.')
}
await print('accounts.antigravitySelect', accountId)
},
remove: (accountId) => print('accounts.antigravityRemove', accountId)
}
}
function providerAccounts(ctx: HandlerContext, agent: AccountAgent): ProviderAccounts {
switch (agent) {
case 'claude':
return claudeAccounts(ctx)
case 'codex':
return codexAccounts(ctx)
case 'opencode':
case 'devin':
return dataAccounts(ctx, agent)
case 'antigravity':
return antigravityAccounts(ctx)
}
}
function isAccountAgent(value: string): value is AccountAgent {
return ACCOUNT_AGENTS.some((agent) => agent === value)
}
// Why required: switching or removing an account decides which subscription is billed,
// so the provider is never guessed.
function readAgentFlag(ctx: HandlerContext): AccountAgent {
const agent = ctx.flags.get('agent')
if (typeof agent !== 'string') {
throw new RuntimeClientError('invalid_argument', AGENT_FLAG_HINT)
}
if (!isAccountAgent(agent)) {
throw new RuntimeClientError(
'invalid_argument',
`Unsupported --agent "${agent}". ${AGENT_FLAG_HINT}`
)
}
return agent
}
function readAccountFlag(ctx: HandlerContext): string {
const account = ctx.flags.get('account')
if (typeof account !== 'string' || !account.trim()) {
throw new RuntimeClientError('invalid_argument', ACCOUNT_FLAG_HINT)
}
return account.trim()
}
/**
* Resolves `--account` to a saved account id: an exact id first, then a
* case-insensitive email, label or subject. `system` is the provider's own sign-in
* (null). A name shared by several accounts — one email in two organizations — is
* refused with their ids rather than guessing which subscription to bill.
*/
function resolveAccountId(
label: string,
accounts: readonly AccountChoice[],
query: string,
{ allowSystem }: { allowSystem: boolean }
): string | null {
if (query === 'system') {
if (!allowSystem) {
throw new RuntimeClientError('invalid_argument', `${label} has no system default.`)
}
return null
}
return resolveSavedAccountId(label, accounts, query)
}
function resolveSavedAccountId(
label: string,
accounts: readonly AccountChoice[],
query: string
): string {
const byId = accounts.find((account) => account.id === query)
if (byId) {
return byId.id
}
const needle = query.toLowerCase()
const byName = accounts.filter((account) =>
account.names.some((name) => name?.toLowerCase() === needle)
)
if (byName.length === 1) {
return byName[0].id
}
if (byName.length > 1) {
throw new RuntimeClientError(
'invalid_argument',
`Several ${label} accounts match "${query}"; pass one of their ids: ${byName
.map((account) => account.id)
.join(', ')}.`
)
}
throw new RuntimeClientError(
'invalid_argument',
`No managed ${label} account matches "${query}". Run \`orca account list\` to see the saved accounts.`
)
}
/** `orca account select`: the account new launches of that agent use on this host. */
export async function selectAgentAccount(ctx: HandlerContext): Promise<void> {
const agent = readAgentFlag(ctx)
const query = readAccountFlag(ctx)
// Why: accounts.selectClaude carries no target, so `system` from the WSL bridge
// would reset the Windows host's selection instead of the distro's.
if (agent === 'claude' && query === 'system' && getWslAccountTarget(ctx.cwd)) {
throw new RuntimeClientError(
'invalid_argument',
'Select the Claude system default for a WSL distro in Orca Settings > AI Provider Accounts.'
)
}
const provider = providerAccounts(ctx, agent)
const accountId = resolveAccountId(provider.label, await provider.choices(), query, {
allowSystem: provider.hasSystemDefault
})
await provider.select(accountId)
}
/** `orca account rm`: forgets a saved account; the provider's own sign-in is never touched. */
export async function removeAgentAccount(ctx: HandlerContext): Promise<void> {
const agent = readAgentFlag(ctx)
const query = readAccountFlag(ctx)
if (query === 'system') {
throw new RuntimeClientError(
'invalid_argument',
'System credentials are never removed; pass a saved account from `orca account list`.'
)
}
const provider = providerAccounts(ctx, agent)
await provider.remove(resolveSavedAccountId(provider.label, await provider.choices(), query))
}
/** `orca account list --agent <id>`: one provider's saved accounts. */
export async function listAgentAccounts(ctx: HandlerContext, agentFlag: unknown): Promise<void> {
if (typeof agentFlag !== 'string' || !isAccountAgent(agentFlag)) {
throw new RuntimeClientError('invalid_argument', AGENT_FLAG_HINT)
}
await providerAccounts(ctx, agentFlag).list()
}
/** The Antigravity block for the full `orca account list`, or null on a host that cannot read it. */
export async function readAntigravityAccountsForList(
ctx: HandlerContext
): Promise<AntigravityAccountState | null> {
if (!(await supportsAntigravityAccounts(ctx))) {
return null
}
// Why: a host can advertise the capability yet have no native credential adapter
// (Linux Secret Service today). The overview must still show every other provider;
// `orca account list --agent antigravity` keeps reporting the reason.
try {
const response = await ctx.client.call<AntigravityAccountState>(
'accounts.antigravityList',
antigravityTarget(ctx.cwd)
)
return response.result
} catch {
return null
}
}
+94
View File
@@ -67,6 +67,7 @@ import type { HandlerContext } from '../dispatch'
import { RuntimeClientError, type RuntimeClient } from '../runtime-client'
import {
ACCOUNT_IMPORT_RUNTIME_CAPABILITY,
ANTIGRAVITY_ACCOUNTS_RUNTIME_CAPABILITY,
CLAUDE_SIGN_IN_RUNTIME_CAPABILITY,
DATA_ACCOUNT_RUNTIME_CAPABILITY
} from '../../shared/account-runtime-capabilities'
@@ -739,4 +740,97 @@ describe('account CLI handlers', () => {
)
expect(spawnMock).not.toHaveBeenCalled()
})
describe('select and rm by --account', () => {
const antigravityAccounts = {
accounts: [
{ id: 'agy-1', email: 'me@gmail.example', subject: 'sub-1' },
{ id: 'agy-2', email: null, subject: 'sub-2' }
],
activeAccountId: 'agy-1'
}
const claudeAccounts = {
accounts: [
{ id: 'claude-org-a', email: 'shared@example.com' },
{ id: 'claude-org-b', email: 'shared@example.com' }
],
activeAccountId: null
}
function selectionContext(agent: string, account: string): HandlerContext {
return {
client,
cwd: process.cwd(),
flags: new Map([
['agent', agent],
['account', account]
]),
json: false,
rawArgs: []
}
}
function mutatingCalls(): string[] {
return callMock.mock.calls
.map(([method]) => String(method))
.filter((method) => /\.(select|remove|antigravitySelect|antigravityRemove)/.test(method))
}
beforeEach(() => {
callMock.mockImplementation((method: string) =>
Promise.resolve({
id: 'test',
ok: true,
result:
method === 'status.get'
? { capabilities: [ANTIGRAVITY_ACCOUNTS_RUNTIME_CAPABILITY] }
: method.startsWith('accounts.antigravity')
? antigravityAccounts
: { claude: claudeAccounts, codex: { accounts: [], activeAccountId: null } },
_meta: { runtimeId: 'test-runtime' }
})
)
})
it('selects and removes Antigravity accounts by email or subject on the host', async () => {
await ACCOUNT_HANDLERS['account select'](selectionContext('antigravity', 'ME@gmail.example'))
await ACCOUNT_HANDLERS['account rm'](selectionContext('antigravity', 'sub-2'))
expect(callMock).toHaveBeenCalledWith('accounts.antigravitySelect', {
target: { runtime: 'host' },
accountId: 'agy-1'
})
expect(callMock).toHaveBeenCalledWith('accounts.antigravityRemove', {
target: { runtime: 'host' },
accountId: 'agy-2'
})
})
it('refuses an email shared by several accounts without switching or removing', async () => {
await expect(
ACCOUNT_HANDLERS['account select'](selectionContext('claude', 'shared@example.com'))
).rejects.toThrow('claude-org-a, claude-org-b')
await expect(
ACCOUNT_HANDLERS['account rm'](selectionContext('claude', 'shared@example.com'))
).rejects.toThrow('claude-org-a, claude-org-b')
expect(mutatingCalls()).toEqual([])
})
it('refuses the Antigravity system default, which its vault does not have', async () => {
await expect(
ACCOUNT_HANDLERS['account select'](selectionContext('antigravity', 'system'))
).rejects.toThrow('Antigravity has no system default')
expect(mutatingCalls()).toEqual([])
})
it('refuses the Claude system default from WSL rather than resetting the Windows host', async () => {
Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' })
process.env.ORCA_CLI_WSL_DISTRO = 'Ubuntu'
await expect(
ACCOUNT_HANDLERS['account select'](selectionContext('claude', 'system'))
).rejects.toThrow('Select the Claude system default for a WSL distro in Orca Settings')
expect(callMock).not.toHaveBeenCalled()
})
})
})
+24 -9
View File
@@ -34,19 +34,29 @@ import {
import { getWslAccountTarget } from './account-wsl-location'
import {
addDataAccount,
listDataAccounts,
mutateDataAccount,
redactLoginAnswers,
rejectOpenCodeLoginFlagsForAgent
} from './data-account-commands'
import { formatAccountsBlock, formatDataAccounts } from './account-list-format'
import {
formatAccountsBlock,
formatAntigravityAccounts,
formatDataAccounts
} from './account-list-format'
import { resolveOpenCodeLoginCommand } from './opencode-account-login-command'
import {
listAgentAccounts,
readAntigravityAccountsForList,
removeAgentAccount,
selectAgentAccount
} from './account-selection'
import type { AntigravityAccountState } from '../../shared/antigravity-account-types'
type AccountsListSnapshot = {
opencode?: ManagedDataAccountsState
devin?: ManagedDataAccountsState
claude: ClaudeRateLimitAccountsState
codex: CodexRateLimitAccountsState
antigravity?: AntigravityAccountState
}
function addAgentNodePaths(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
@@ -261,30 +271,35 @@ export const ACCOUNT_HANDLERS: Record<string, CommandHandler> = {
rejectAccountRemoteSelectionFlags(ctx, 'orca account list')
const provider = ctx.flags.get('agent')
if (provider !== undefined) {
await listDataAccounts(ctx, provider)
await listAgentAccounts(ctx, provider)
return
}
const { client, json } = ctx
// JSON carries usage: refresh stale windows within throttles; a forced refresh bypasses Retry-After.
const result = await client.call<AccountsListSnapshot>('accounts.list', {
const response = await client.call<AccountsListSnapshot>('accounts.list', {
refreshUsage: false,
...(json ? { refreshStaleUsage: true } : {})
})
printResult(result, json, (snapshot) =>
// Why separate: Antigravity accounts live in their own native vault, not in the
// accounts.list snapshot, and an older host simply has none to show.
const antigravity = await readAntigravityAccountsForList(ctx)
const result = antigravity ? { ...response.result, antigravity } : response.result
printResult({ ...response, result }, json, (snapshot) =>
[
formatAccountsBlock('Claude', snapshot.claude),
formatAccountsBlock('Codex', snapshot.codex),
...(snapshot.opencode ? [formatDataAccounts('OpenCode', snapshot.opencode)] : []),
...(snapshot.devin ? [formatDataAccounts('Devin', snapshot.devin)] : [])
...(snapshot.devin ? [formatDataAccounts('Devin', snapshot.devin)] : []),
...(snapshot.antigravity ? [formatAntigravityAccounts(snapshot.antigravity)] : [])
].join('\n\n')
)
},
'account select': async (ctx) => {
rejectAccountRemoteSelectionFlags(ctx, 'orca account select')
await mutateDataAccount(ctx, 'select')
await selectAgentAccount(ctx)
},
'account rm': async (ctx) => {
rejectAccountRemoteSelectionFlags(ctx, 'orca account rm')
await mutateDataAccount(ctx, 'remove')
await removeAgentAccount(ctx)
}
}
-20
View File
@@ -182,23 +182,3 @@ export async function listDataAccounts(ctx: HandlerContext, provider: unknown):
return formatDataAccounts(provider, state)
})
}
export async function mutateDataAccount(
ctx: HandlerContext,
action: 'select' | 'remove'
): Promise<void> {
const provider = ctx.flags.get('agent')
const id = ctx.flags.get('account')
if ((provider !== 'opencode' && provider !== 'devin') || typeof id !== 'string' || !id) {
throw new RuntimeClientError(
'invalid_argument',
'Use --agent opencode|devin and --account <id> (system for the default selection).'
)
}
await assertDataAccountsSupported(ctx)
const result = await ctx.client.call<ManagedDataAccountsState>(`accounts.${action}Data`, {
provider,
accountId: action === 'select' && id === 'system' ? null : id
})
printResult(result, ctx.json, (state) => formatDataAccounts(provider, state))
}
+1 -1
View File
@@ -188,7 +188,7 @@ function formatCommandFlagHelp(flag: string, commandPath: string[]): string {
return '--agent <id> Account provider: claude, codex, opencode, or devin (default claude)'
}
if (command.startsWith('account ') && flag === 'agent') {
return '--agent <id> Account provider: opencode or devin'
return '--agent <id> Account provider: claude, codex, opencode, devin, or antigravity'
}
if (command === 'chat rename' && flag === 'session') {
return '--session <id> Chat session id (defaults to the chat this runs in)'
+2 -2
View File
@@ -26,8 +26,8 @@ export const ROOT_HELP_TEXT_PRIMARY = [
'Accounts:',
' account add Add a managed agent account on this Orca host',
' account list List managed agent accounts on this Orca host',
' account select Select an OpenCode or Devin account for new launches',
' account rm Remove an OpenCode or Devin account and its private data',
' account select Select the account new agent launches use',
' account rm Remove a managed agent account and its private data',
'',
'Skills:',
' skills installed List installed skill selectors',
+1
View File
@@ -44,6 +44,7 @@ export const ROOT_HELP_TEXT_SECONDARY = [
' orca search --index-status [--json]',
' orca account add [--agent claude|codex] [--json]',
' orca account list [--json]',
' orca account select --agent claude --account <id|email|system> [--json]',
' orca host list [--json]',
' orca environment add --name <name> --pairing-code <code> [--json]',
' orca environment list [--json]',
+3 -1
View File
@@ -49,7 +49,9 @@ describe('account command specs', () => {
const canonical = spec('account rm')
expect(findCommandSpec(ACCOUNT_COMMAND_SPECS, ['account', 'remove'])).toBe(canonical)
expect(formatCommandHelp(canonical)).toContain('orca account rm --agent opencode|devin')
expect(formatCommandHelp(canonical)).toContain(
'orca account rm --agent claude|codex|opencode|devin|antigravity'
)
expect(HANDLER_COMMAND_KEYS.has('account remove')).toBe(false)
})
+23 -9
View File
@@ -15,6 +15,7 @@ export const ACCOUNT_COMMAND_SPECS: CommandSpec[] = [
'OpenCode 2 uses `opencode auth login --standalone` in private XDG directories. Devin uses `devin auth login --force-manual-token-flow`.',
'Use --integration <id> to skip the OpenCode integration picker; --label names the saved OpenCode or Devin profile.',
'Use --method <id> and repeated --answer <key=value> to pass OpenCode its login method and form answers, so sign-in can finish without an interactive terminal.',
'Antigravity accounts are saved from the current `agy` login in Orca Settings > AI Provider Accounts.',
'OpenCode and Devin profiles apply to new explicit host agent launches. Direct SSH relay and Windows-hosted WSL selection are not supported; run the command on a headless Orca runtime on that host.',
'Sign in with the account you want to add (e.g. use a private/incognito browser window for a second account).',
'--agent defaults to claude. Requires the Orca runtime to be running on this machine.'
@@ -28,28 +29,41 @@ export const ACCOUNT_COMMAND_SPECS: CommandSpec[] = [
{
path: ['account', 'list'],
summary: 'List managed agent accounts on this Orca host',
usage: 'orca account list [--agent opencode|devin] [--json]',
usage: 'orca account list [--agent claude|codex|opencode|devin|antigravity] [--json]',
allowedFlags: [...LOCAL_COMMAND_FLAGS, 'agent'],
notes: [
'Lists the accounts on this machine. `--environment` / `--pairing-code` are rejected rather than ignored; run it on the host whose accounts you want to see.'
"Lists the accounts on this machine with the ids `orca account select` and `orca account rm` accept. `system` is the provider's own sign-in outside Orca.",
'`--environment` / `--pairing-code` are rejected rather than ignored; run it on the host whose accounts you want to see.'
],
examples: ['orca account list']
examples: ['orca account list', 'orca account list --agent claude']
},
{
path: ['account', 'select'],
summary: 'Select an OpenCode or Devin profile for new agent launches',
usage: 'orca account select --agent opencode|devin --account <id|system> [--json]',
allowedFlags: [...LOCAL_COMMAND_FLAGS, 'agent', 'account']
summary: 'Select the account new agent launches use on this Orca host',
usage:
'orca account select --agent claude|codex|opencode|devin|antigravity --account <id|email|label|system> [--json]',
allowedFlags: [...LOCAL_COMMAND_FLAGS, 'agent', 'account'],
notes: [
"--account takes an id, email or label from `orca account list`, or `system` for the provider's own sign-in. An email shared by several accounts is refused; pass the id.",
'The selection applies to agents launched on this host after it, like the status-bar account switcher. Antigravity has no `system` default.'
],
examples: [
'orca account select --agent claude --account me@work.example',
'orca account select --agent codex --account system',
'orca account select --agent antigravity --account me@gmail.example'
]
},
{
path: ['account', 'rm'],
aliases: [['account', 'remove']],
destructive: true,
summary: 'Remove a managed OpenCode or Devin profile and its private data',
usage: 'orca account rm --agent opencode|devin --account <id> [--json]',
summary: 'Remove a managed agent account and its private data',
usage:
'orca account rm --agent claude|codex|opencode|devin|antigravity --account <id|email|label> [--json]',
allowedFlags: [...LOCAL_COMMAND_FLAGS, 'agent', 'account'],
notes: [
'Deletes credentials and conversation data in the managed profile. Stop its running agents first. System credentials are never removed.'
'Deletes the credentials Orca saved for that account (and, for OpenCode and Devin, the conversation data in its profile). Stop its running agents first. System credentials are never removed.',
'Select another Antigravity account before removing the one in use.'
]
}
]