Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions __tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export interface AuthAccountFixture {
readonly name: string;
readonly apiKey: string;
readonly endpoint: string;
readonly team?: string;
readonly teamId?: string;
}

export interface PrintedAuthLoginOptions {
Expand Down Expand Up @@ -449,6 +451,10 @@ export async function writeAuthFile(
`name = "${account.name}"`,
`api_key = "${account.apiKey}"`,
`endpoint = "${account.endpoint}"`,
...(account.team === undefined ? [] : [`team = "${account.team}"`]),
...(account.teamId === undefined
? []
: [`team_id = "${account.teamId}"`]),
"",
]),
].join("\n");
Expand All @@ -458,6 +464,29 @@ export async function writeAuthFile(
return filePath;
}

// Seeds a saved account whose default team is already chosen — the state
// every team-aware command reads. Written straight into auth.toml because the
// commands that would otherwise set it (`oo team use`, `oo auth login`) need a
// membership request of their own.
export async function writeAuthFileWithDefaultTeam(
sandbox: CliSandbox,
team: string,
options: { teamId?: string } = {},
): Promise<string> {
return await writeAuthFile(sandbox, {
accounts: [
{
id: "user-1",
name: "Alice",
apiKey: "secret-1",
endpoint: defaultAuthEndpoint,
team,
...(options.teamId === undefined ? {} : { teamId: options.teamId }),
},
],
});
}

export function createConnectorTargetFixture(
overrides: Partial<OomolConnectorTarget> = {},
): OomolConnectorTarget {
Expand Down
6 changes: 3 additions & 3 deletions contrib/skills/shared/oo/references/connector-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ the user said:

- If the user does not mention any team, add nothing extra. The run then uses
the team selected by the `OO_TEAM_ID` / `OO_TEAM_NAME` environment variables
when set, then the `identity.team` config default when one is set, and their
personal identity otherwise — omitting the flags does not force a personal
run. Check `oo team current` when you need to know which one applies.
when set, then the default team saved on their account when one is set, and
their personal identity otherwise — omitting the flags does not force a
personal run. Check `oo team current` when you need to know which one applies.
- If the user asks to run as a specific team (for example "run this as Acme" or
"use my Acme team"), add `--team "<name>"`, using the team name the user gave:

Expand Down
148 changes: 83 additions & 65 deletions docs/commands.md

Large diffs are not rendered by default.

116 changes: 66 additions & 50 deletions docs/commands.zh-CN.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/self-hosted-connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ adapts as follows:

- **Team identity is not supported.** `--team` is rejected with exit code `2` on
`oo connector run`, `oo connector proxy`, and `oo connector apps`, and any
configured `identity.team` default and the `OO_TEAM_ID` / `OO_TEAM_NAME`
saved account default team and the `OO_TEAM_ID` / `OO_TEAM_NAME`
environment variables are ignored. `--personal` is accepted (it is already
the effective behavior).
- **Async lifecycle waiting is unavailable.** `--wait` and `--wait-result` fail
Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosted-connector.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ oo connector run gmail --action send_email --data '@payload.json'
自部署运行时暴露的能力比 OOMOL 服务更小,CLI 会做如下适配:

- **不支持团队身份。** `oo connector run`、`oo connector proxy` 与 `oo connector
apps` 上的 `--team` 会以退出码 `2` 被拒绝,任何已配置的 `identity.team` 默认值
apps` 上的 `--team` 会以退出码 `2` 被拒绝,账号保存的默认团队
和 `OO_TEAM_ID` / `OO_TEAM_NAME` 环境变量都会被忽略;`--personal` 可以使用
(它本就是实际行为)。
- **无法等待异步生命周期。** `--wait` 与 `--wait-result` 会以既有的「不支持」
Expand Down
Loading
Loading