@liberseek/boft-cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,22 +64,21 @@ Global options must be placed before the command:
64
64
 
65
65
  ## Configure Codex
66
66
 
67
- The BOFT website can create a short-lived, single-use setup code. Run the command shown by the website:
67
+ The BOFT website can create a short-lived, single-use client access code. Run the command shown by the website, then paste the client access code into the hidden prompt:
68
68
 
69
69
  ```bash
70
- npx --yes @liberseek/boft-cli@latest setup codex --code BOFT-SETUP-CODE
70
+ npx --yes @liberseek/boft-cli@latest setup codex
71
71
  ```
72
72
 
73
73
  The setup command:
74
74
 
75
75
  - detects `CODEX_HOME` and otherwise uses `~/.codex`
76
- - verifies the Codex CLI is installed before consuming the one-time setup code
77
- - preserves the existing `auth.json` and ChatGPT login
78
- - adds an isolated `boft` model provider to `config.toml`
79
- - stores the BOFT API Key outside Codex configuration with owner-only permissions
80
- - installs a local command-backed authentication helper
76
+ - verifies the Codex CLI is installed before consuming the one-time client access code
77
+ - preserves unrelated fields in the existing `auth.json`
78
+ - merges the BOFT API Key into `auth.json` as `OPENAI_API_KEY`
79
+ - configures the `OpenAI` provider exactly like the BOFT website's manual Codex instructions
81
80
  - preserves unrelated TOML settings and comments
82
- - creates a backup before every change
81
+ - creates a backup of `config.toml`, `auth.json`, and prior BOFT CLI state before every change
83
82
 
84
83
  Inspect, diagnose, roll back, or completely remove the integration:
85
84
 
@@ -90,17 +89,51 @@ boft rollback codex
90
89
  boft remove codex
91
90
  ```
92
91
 
93
- For local testing before the website setup-code endpoint is available, pass the API Key over stdin. Never place the key directly in a command argument:
92
+ For local testing before the website client-access-code endpoint is available, pass the API Key over stdin. Never place the key directly in a command argument:
94
93
 
95
94
  ```bash
96
95
  printf '%s\n' "$BOFT_API_KEY" | boft setup codex --api-key-stdin \
97
- --endpoint https://supply.boft.ai/v1 \
98
- --model gpt-5.4
96
+ --endpoint https://supply.boft.ai/v1
99
97
  ```
100
98
 
101
- Add `--websocket` for the Codex Responses WebSocket v2 variant. `--dry-run` is available with `--api-key-stdin`; it validates the configuration without writing files. Dry-run intentionally rejects setup codes so it cannot consume a one-time code without applying it.
99
+ Add `--websocket` for the Codex Responses WebSocket v2 variant. `--dry-run` is available with `--api-key-stdin`; it validates the configuration without writing files. Dry-run intentionally rejects client access codes so it cannot consume a one-time code without applying it.
102
100
 
103
- Codex credentials are stored below the BOFT configuration directory, normally `~/.config/boft/codex` on macOS/Linux and `%APPDATA%\\boft\\codex` on Windows. The CLI writes files atomically and uses mode `0700` for private directories/helpers and `0600` for credentials on POSIX systems. The complete API Key is never included in command output or Codex TOML.
101
+ Both Responses variants use `[model_providers.OpenAI]` with `name = "BANK OF TOKEN"`. The WebSocket variant additionally sets `supports_websockets = true` and `responses_websockets_v2 = true`, matching `UserUseKeyModal.vue`.
102
+
103
+ Codex reads the API Key from `~/.codex/auth.json` (or `%USERPROFILE%\\.codex\\auth.json` on Windows). BOFT CLI merges `OPENAI_API_KEY` into that JSON object without removing unrelated fields, writes it atomically with mode `0600` on POSIX systems, and restores the exact previous file during rollback. Backup metadata is kept below the BOFT configuration directory. The complete API Key is never included in command output or `config.toml`.
104
+
105
+ The client access code is not an Agent Token and is not used for later API calls. It is only a fifteen-minute, one-use delivery code that lets BOFT CLI retrieve the selected API Key and endpoint for this local setup.
106
+
107
+ ## Configure Claude Code, Gemini CLI, and OpenCode
108
+
109
+ The BOFT website creates the same short-lived client access code for the other supported clients. The command is target-specific and asks for the client access code interactively:
110
+
111
+ ```bash
112
+ npx --yes @liberseek/boft-cli@latest setup claude
113
+ npx --yes @liberseek/boft-cli@latest setup gemini
114
+ npx --yes @liberseek/boft-cli@latest setup opencode
115
+ ```
116
+
117
+ `--code BOFT-CLIENT-ACCESS-CODE` remains available for controlled automation, but the interactive prompt is the safer default because the code does not enter shell history or process arguments.
118
+
119
+ Claude Code is configured in `~/.claude/settings.json`, Gemini CLI in `~/.gemini/.env`, and OpenCode in its global `opencode.json` (`OPENCODE_CONFIG` is honored when set). Existing unrelated settings are preserved. OpenCode setup uses the provider selected in the BOFT key page, including OpenAI-compatible providers such as DeepSeek, Grok, DashScope, Z.AI, and MiniMax.
120
+
121
+ The same lifecycle commands are available for every target:
122
+
123
+ ```bash
124
+ boft status claude|gemini|opencode
125
+ boft doctor claude|gemini|opencode
126
+ boft rollback claude|gemini|opencode
127
+ boft remove claude|gemini|opencode
128
+ ```
129
+
130
+ For local testing, API Keys are read from stdin and never need to appear in shell history:
131
+
132
+ ```bash
133
+ printf '%s\\n' "$BOFT_API_KEY" | boft setup claude --api-key-stdin --endpoint https://supply.boft.ai
134
+ printf '%s\\n' "$BOFT_API_KEY" | boft setup gemini --api-key-stdin --endpoint https://supply.boft.ai
135
+ printf '%s\\n' "$BOFT_API_KEY" | boft setup opencode --api-key-stdin --provider openai --endpoint https://supply.boft.ai/v1
136
+ ```
104
137
 
105
138
  Account and payment methods:
106
139
 
package/dist/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Account, ApiKeyRecord, AutoKeyRoutePreview, AvailableGroupsResponse, CodexSetupGrant, PaginatedResponse, PaymentOption, PaymentOrder, ProviderGroupConstraint } from './types.js';
1
+ import type { Account, ApiKeyRecord, AutoKeyRoutePreview, AvailableGroupsResponse, CodexSetupGrant, SetupGrant, SetupTarget, PaginatedResponse, PaymentOption, PaymentOrder, ProviderGroupConstraint } from './types.js';
2
2
  interface ApiClientOptions {
3
3
  baseUrl: string;
4
4
  token: string;
@@ -74,6 +74,14 @@ export declare class BoftApiClient {
74
74
  autoKeyRoutePreview(id: number): Promise<AutoKeyRoutePreview>;
75
75
  private request;
76
76
  }
77
+ export declare function exchangeSetupGrant(options: {
78
+ baseUrl: string;
79
+ code: string;
80
+ target: SetupTarget;
81
+ timeoutMs?: number;
82
+ fetchImpl?: typeof fetch;
83
+ machineName?: string;
84
+ }): Promise<SetupGrant>;
77
85
  export declare function exchangeCodexSetupGrant(options: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EAAE,MAAM,EAAE,KAAK,EAAE;QACtC,uBAAuB,CAAC,EAAE,MAAM,CAAA;QAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;QAC7B,0BAA0B,CAAC,EAAE,uBAAuB,EAAE,CAAA;QACtD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;QACjB,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC3B,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAI/C,OAAO;CAiCtB;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,WAAW,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,CAsCtB;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,eAAe,CAAC,CAE3B"}
package/dist/api.js CHANGED
@@ -1,5 +1,10 @@
1
1
  import { redactText } from './redact.js';
2
- const CLI_USER_AGENT = '@liberseek/boft-cli/0.1.0';
2
+ import { CLI_VERSION } from './version.js';
3
+ const CLI_USER_AGENT = `@liberseek/boft-cli/${CLI_VERSION}`;
4
+ const SETUP_OPENCODE_PROVIDERS = new Set([
5
+ 'openai', 'anthropic', 'gemini', 'grok', 'dashscope', 'deepseek', 'mimo', 'zai',
6
+ 'volcengine_ark', 'moonshot', 'minimax',
7
+ ]);
3
8
  export class ApiError extends Error {
4
9
  status;
5
10
  code;
@@ -61,14 +66,7 @@ export class BoftApiClient {
61
66
  });
62
67
  }
63
68
  availableGroups(scope) {
64
- return Promise.all([
65
- this.request('GET', `/api/v1/ee/agent/groups/available${queryString({ scope })}`),
66
- this.request('GET', `/api/v1/ee/agent/groups/rates${queryString({ scope })}`),
67
- ]).then(([groups, user_rates]) => ({
68
- groups,
69
- user_rates,
70
- ...(scope ? { scope } : {}),
71
- }));
69
+ return this.request('GET', `/api/v1/ee/agent/groups/available-with-rates${queryString({ scope })}`);
72
70
  }
73
71
  listAutoKeys(input = {}) {
74
72
  return this.request('GET', `/api/v1/ee/agent/auto-keys${queryString({ page: input.page, page_size: input.pageSize, scope: input.scope })}`);
@@ -130,7 +128,7 @@ export class BoftApiClient {
130
128
  }
131
129
  }
132
130
  }
133
- export async function exchangeCodexSetupGrant(options) {
131
+ export async function exchangeSetupGrant(options) {
134
132
  const timeoutMs = options.timeoutMs ?? 15_000;
135
133
  const controller = new AbortController();
136
134
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -145,7 +143,7 @@ export async function exchangeCodexSetupGrant(options) {
145
143
  },
146
144
  body: JSON.stringify({
147
145
  code: options.code,
148
- target: 'codex',
146
+ target: options.target,
149
147
  ...(options.machineName ? { machine_name: options.machineName } : {}),
150
148
  }),
151
149
  signal: controller.signal,
@@ -155,8 +153,9 @@ export async function exchangeCodexSetupGrant(options) {
155
153
  if (!response.ok)
156
154
  throw errorFromPayload(payload, response.status, response.statusText, options.code);
157
155
  const grant = unwrapEnvelope(payload, response.status);
158
- if (!isCodexSetupGrant(grant))
159
- throw new ApiError('BOFT setup service returned an invalid Codex configuration');
156
+ if (!isSetupGrant(grant, options.target)) {
157
+ throw new ApiError(`BOFT setup service returned an invalid ${options.target} configuration`);
158
+ }
160
159
  return grant;
161
160
  }
162
161
  catch (error) {
@@ -172,6 +171,9 @@ export async function exchangeCodexSetupGrant(options) {
172
171
  clearTimeout(timer);
173
172
  }
174
173
  }
174
+ export async function exchangeCodexSetupGrant(options) {
175
+ return exchangeSetupGrant({ ...options, target: 'codex' });
176
+ }
175
177
  function parsePayload(text, contentType) {
176
178
  if (!text)
177
179
  return undefined;
@@ -231,12 +233,17 @@ function queryString(values) {
231
233
  const query = params.toString();
232
234
  return query ? `?${query}` : '';
233
235
  }
234
- function isCodexSetupGrant(value) {
236
+ function isSetupGrant(value, target) {
235
237
  const record = asRecord(value);
236
- return record !== undefined && record.target === 'codex' &&
237
- typeof record.base_url === 'string' && record.base_url.trim().length > 0 &&
238
- typeof record.model === 'string' && record.model.trim().length > 0 &&
239
- typeof record.api_key === 'string' && record.api_key.trim().length > 0 &&
240
- (record.variant === undefined || record.variant === 'responses' || record.variant === 'websocket');
238
+ if (record === undefined || record.target !== target)
239
+ return false;
240
+ if (typeof record.base_url !== 'string' || !record.base_url.trim() ||
241
+ typeof record.api_key !== 'string' || !record.api_key.trim())
242
+ return false;
243
+ if (target === 'codex')
244
+ return record.variant === 'responses' || record.variant === 'websocket';
245
+ if (target === 'claude' || target === 'gemini')
246
+ return record.variant === 'default';
247
+ return typeof record.variant === 'string' && SETUP_OPENCODE_PROVIDERS.has(record.variant);
241
248
  }
242
249
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAcxC,MAAM,cAAc,GAAG,2BAA2B,CAAA;AAgBlD,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,MAAM,CAAS;IACf,IAAI,CAAkB;IACtB,MAAM,CAAS;IAExB,YAAY,OAAe,EAAE,UAAwE,EAAE;QACrG,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,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,CAAA;IAC/F,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,OAAO,KAAK,SAAS,CAAA;IACnF,OAAO,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,wBAAwB,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3F,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import type { CodexInstallation } from './codex.js';
3
+ import { type AgentPlatformTarget, type PlatformInstallation } from './platforms.js';
3
4
  import type { Credentials, OutputWriter } from './types.js';
4
5
  interface CliDependencies {
5
6
  env?: NodeJS.ProcessEnv;
@@ -8,8 +9,8 @@ interface CliDependencies {
8
9
  promptToken?: () => Promise<string>;
9
10
  promptApiKey?: () => Promise<string>;
10
11
  promptSetupCode?: () => Promise<string>;
11
- nodePath?: string;
12
12
  codexProbe?: (env: NodeJS.ProcessEnv) => Promise<CodexInstallation>;
13
+ platformProbe?: (target: AgentPlatformTarget, env: NodeJS.ProcessEnv) => Promise<PlatformInstallation>;
13
14
  }
14
15
  export declare function createProgram(dependencies?: CliDependencies): Command;
15
16
  export declare function run(argv?: string[], dependencies?: CliDependencies): Promise<number>;
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAA;AAUnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAsBnD,OAAO,KAAK,EAAE,WAAW,EAAiB,YAAY,EAA2B,MAAM,YAAY,CAAA;AAGnG,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,WAA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,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACnE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;CACvG;AAED,wBAAgB,aAAa,CAAC,YAAY,GAAE,eAAoB,GAAG,OAAO,CA0iBzE;AAED,wBAAsB,GAAG,CAAC,IAAI,WAAe,EAAE,YAAY,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlG;AAsBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAE9E"}
package/dist/cli.js CHANGED
@@ -1,19 +1,21 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { Command, CommanderError } from 'commander';
3
- import { ApiError, BoftApiClient, exchangeCodexSetupGrant } from './api.js';
3
+ import { ApiError, BoftApiClient, exchangeSetupGrant } from './api.js';
4
4
  import { codexStatus, detectCodexInstallation, doctorCodex, removeCodex, rollbackCodex, setupCodex, } from './codex.js';
5
+ import { agentPlatformStatus, detectAgentPlatformInstallation, doctorAgentPlatform, removeAgentPlatform, rollbackAgentPlatform, setupAgentPlatform, } from './platforms.js';
5
6
  import { configFilePath, deleteCredentials, readCredentials, resolveBaseUrl, resolveToken, writeCredentials, } from './config.js';
6
7
  import { accountOutput, apiKeysOutput, consoleWriter, groupsOutput, jsonOutput, keyOutput, paymentOptionsOutput, paymentOutput, routePreviewOutput, } from './output.js';
7
8
  import { promptForApiKey, promptForSetupCode, promptForToken } from './prompt.js';
8
9
  import { redactText, tokenHint } from './redact.js';
9
10
  import { parseTimeout, parseWaitSeconds, validateAmount, validateId, validateMethod } from './validate.js';
11
+ import { CLI_VERSION } from './version.js';
10
12
  export function createProgram(dependencies = {}) {
11
13
  const env = dependencies.env ?? process.env;
12
14
  const writer = dependencies.writer ?? consoleWriter;
13
15
  const program = new Command()
14
16
  .name('boft')
15
17
  .description('BOFT account, recharge, key, and Agent platform setup CLI')
16
- .version('0.1.0')
18
+ .version(CLI_VERSION)
17
19
  .option('--json', 'emit machine-readable JSON without terminal decoration')
18
20
  .option('--base-url <url>', 'BOFT API base URL')
19
21
  .option('--timeout <milliseconds>', 'request timeout in milliseconds', '15000')
@@ -68,13 +70,10 @@ export function createProgram(dependencies = {}) {
68
70
  });
69
71
  const setup = program.command('setup').description('configure an Agent platform to use BOFT');
70
72
  setup.command('codex')
71
- .description('configure Codex with a BOFT model provider without changing auth.json')
72
- .option('--code <code>', 'short-lived setup code created by the BOFT website')
73
- .option('--api-key-stdin', 'read a BOFT API Key from stdin instead of exchanging a setup code')
73
+ .description('configure Codex with the BOFT OpenAI-compatible provider')
74
+ .option('--code <code>', 'one-time client access code created by the BOFT website')
75
+ .option('--api-key-stdin', 'read a BOFT API Key from stdin instead of exchanging a client access code')
74
76
  .option('--endpoint <url>', 'BOFT Responses API endpoint; required with --api-key-stdin')
75
- .option('--model <id>', 'Codex model ID; used with --api-key-stdin')
76
- .option('--review-model <id>', 'Codex review model ID; used with --api-key-stdin')
77
- .option('--provider-name <name>', 'provider display name; used with --api-key-stdin')
78
77
  .option('--websocket', 'enable Codex Responses WebSocket v2; used with --api-key-stdin')
79
78
  .option('--dry-run', 'validate and preview local changes without writing files')
80
79
  .action(async (options) => {
@@ -82,7 +81,7 @@ export function createProgram(dependencies = {}) {
82
81
  if (options.code && options.apiKeyStdin)
83
82
  throw new Error('Use either --code or --api-key-stdin, not both');
84
83
  if (options.dryRun && !options.apiKeyStdin) {
85
- throw new Error('--dry-run requires --api-key-stdin so a one-time setup code is not consumed');
84
+ throw new Error('--dry-run requires --api-key-stdin so a one-time client access code is not consumed');
86
85
  }
87
86
  const installation = await (dependencies.codexProbe ?? detectCodexInstallation)(env);
88
87
  if (!installation.detected)
@@ -95,9 +94,6 @@ export function createProgram(dependencies = {}) {
95
94
  setupInput = {
96
95
  apiKey,
97
96
  endpoint: options.endpoint,
98
- model: options.model ?? 'gpt-5.4',
99
- reviewModel: options.reviewModel,
100
- providerName: options.providerName,
101
97
  websocket: options.websocket,
102
98
  };
103
99
  }
@@ -105,19 +101,16 @@ export function createProgram(dependencies = {}) {
105
101
  const code = validateSetupCode(options.code ?? await (dependencies.promptSetupCode ?? promptForSetupCode)());
106
102
  const credentials = await readCredentials(env);
107
103
  const baseUrl = resolveBaseUrl(globals.baseUrl, credentials, env);
108
- const grant = await exchangeCodexSetupGrant({
104
+ const grant = await exchangeSetupGrant({
109
105
  baseUrl,
110
106
  code,
107
+ target: 'codex',
111
108
  timeoutMs: parseTimeout(globals.timeout),
112
109
  fetchImpl: dependencies.fetchImpl,
113
110
  });
114
111
  setupInput = {
115
112
  apiKey: grant.api_key,
116
113
  endpoint: grant.base_url,
117
- model: grant.model,
118
- reviewModel: grant.review_model,
119
- providerName: grant.provider_name,
120
- keyId: grant.key_id,
121
114
  websocket: grant.variant === 'websocket',
122
115
  };
123
116
  }
@@ -125,7 +118,6 @@ export function createProgram(dependencies = {}) {
125
118
  ...setupInput,
126
119
  dryRun: options.dryRun,
127
120
  env,
128
- nodePath: dependencies.nodePath,
129
121
  });
130
122
  if (globals.json)
131
123
  jsonOutput(writer, result);
@@ -143,6 +135,72 @@ export function createProgram(dependencies = {}) {
143
135
  writer.out('Restart Codex to load the new provider configuration.');
144
136
  }
145
137
  });
138
+ for (const target of ['claude', 'gemini', 'opencode']) {
139
+ const command = setup.command(target)
140
+ .description(`configure ${target === 'claude' ? 'Claude Code' : target === 'gemini' ? 'Gemini CLI' : 'OpenCode'} with BOFT`)
141
+ .option('--code <code>', 'one-time client access code created by the BOFT website')
142
+ .option('--api-key-stdin', 'read a BOFT API Key from stdin instead of exchanging a client access code')
143
+ .option('--endpoint <url>', 'provider endpoint; required with --api-key-stdin')
144
+ .option('--provider <id>', 'OpenCode provider ID (required for OpenCode stdin setup)')
145
+ .option('--dry-run', 'validate and preview local changes without writing files');
146
+ command.action(async (options) => {
147
+ const globals = globalOptions(program);
148
+ if (options.code && options.apiKeyStdin)
149
+ throw new Error('Use either --code or --api-key-stdin, not both');
150
+ if (options.dryRun && !options.apiKeyStdin) {
151
+ throw new Error('--dry-run requires --api-key-stdin so a one-time client access code is not consumed');
152
+ }
153
+ const installation = await (dependencies.platformProbe ?? detectAgentPlatformInstallation)(target, env);
154
+ if (!installation.detected) {
155
+ const name = target === 'claude' ? 'Claude Code' : target === 'gemini' ? 'Gemini CLI' : 'OpenCode';
156
+ throw new Error(`${name} CLI was not found in PATH. Install it before running setup.`);
157
+ }
158
+ let apiKey;
159
+ let endpoint;
160
+ let provider = target === 'opencode' ? options.provider : undefined;
161
+ if (options.apiKeyStdin) {
162
+ if (!options.endpoint)
163
+ throw new Error('--endpoint is required with --api-key-stdin');
164
+ if (target === 'opencode' && !provider)
165
+ throw new Error('--provider is required for OpenCode stdin setup');
166
+ apiKey = await (dependencies.promptApiKey ?? promptForApiKey)();
167
+ endpoint = options.endpoint;
168
+ }
169
+ else {
170
+ const code = validateSetupCode(options.code ?? await (dependencies.promptSetupCode ?? promptForSetupCode)());
171
+ const credentials = await readCredentials(env);
172
+ const baseUrl = resolveBaseUrl(globals.baseUrl, credentials, env);
173
+ const grant = await exchangeSetupGrant({
174
+ baseUrl,
175
+ code,
176
+ target,
177
+ timeoutMs: parseTimeout(globals.timeout),
178
+ fetchImpl: dependencies.fetchImpl,
179
+ });
180
+ apiKey = grant.api_key;
181
+ endpoint = grant.base_url;
182
+ provider = target === 'opencode' ? grant.variant : undefined;
183
+ }
184
+ const result = await setupAgentPlatform({ target, apiKey, endpoint, provider, dryRun: options.dryRun, env });
185
+ if (globals.json)
186
+ jsonOutput(writer, result);
187
+ else {
188
+ writer.out(options.dryRun ? `${target} configuration is valid. No files were changed.` : `${target} is configured to use BOFT.`);
189
+ if (result.provider)
190
+ writer.out(`Provider: ${result.provider}`);
191
+ if (result.model)
192
+ writer.out(`Model: ${result.model}`);
193
+ writer.out(`Endpoint: ${result.endpoint}`);
194
+ writer.out(`Config: ${result.config_path}`);
195
+ if (installation.version)
196
+ writer.out(`${target}: ${installation.version}`);
197
+ if (result.backup_path)
198
+ writer.out(`Backup: ${result.backup_path}`);
199
+ if (result.restart_required)
200
+ writer.out(`Restart ${target} to load the new configuration.`);
201
+ }
202
+ });
203
+ }
146
204
  const status = program.command('status').description('show Agent platform configuration status');
147
205
  status.command('codex')
148
206
  .description('show BOFT Codex configuration status without revealing credentials')
@@ -161,9 +219,30 @@ export function createProgram(dependencies = {}) {
161
219
  writer.out(`Config: ${result.config_path}`);
162
220
  }
163
221
  });
222
+ for (const target of ['claude', 'gemini', 'opencode']) {
223
+ status.command(target)
224
+ .description(`show BOFT ${target} configuration status without revealing credentials`)
225
+ .action(async () => {
226
+ const result = await agentPlatformStatus(target, env);
227
+ if (globalOptions(program).json)
228
+ jsonOutput(writer, result);
229
+ else {
230
+ writer.out(`Configured: ${result.configured ? 'yes' : 'no'}`);
231
+ writer.out(`Active: ${result.active ? 'yes' : 'no'}`);
232
+ if (result.provider)
233
+ writer.out(`Provider: ${result.provider}`);
234
+ if (result.model)
235
+ writer.out(`Model: ${result.model}`);
236
+ if (result.endpoint)
237
+ writer.out(`Endpoint: ${result.endpoint}`);
238
+ writer.out(`Credentials: ${result.credentials_present ? 'available' : 'missing'}`);
239
+ writer.out(`Config: ${result.config_path}`);
240
+ }
241
+ });
242
+ }
164
243
  const doctor = program.command('doctor').description('diagnose an Agent platform configuration');
165
244
  doctor.command('codex')
166
- .description('check BOFT Codex provider, credentials, helper, and permissions')
245
+ .description('check the BOFT Codex provider, credentials, and file permissions')
167
246
  .action(async () => {
168
247
  const installation = await (dependencies.codexProbe ?? detectCodexInstallation)(env);
169
248
  const result = await doctorCodex(env, installation);
@@ -175,6 +254,21 @@ export function createProgram(dependencies = {}) {
175
254
  for (const issue of result.issues)
176
255
  writer.error(`Issue: ${issue}`);
177
256
  });
257
+ for (const target of ['claude', 'gemini', 'opencode']) {
258
+ doctor.command(target)
259
+ .description(`check the BOFT ${target} provider, credentials, and file permissions`)
260
+ .action(async () => {
261
+ const installation = await (dependencies.platformProbe ?? detectAgentPlatformInstallation)(target, env);
262
+ const result = await doctorAgentPlatform(target, env, installation);
263
+ if (globalOptions(program).json)
264
+ jsonOutput(writer, result);
265
+ else if (result.healthy)
266
+ writer.out(`BOFT ${target} configuration is healthy.`);
267
+ else
268
+ for (const issue of result.issues)
269
+ writer.error(`Issue: ${issue}`);
270
+ });
271
+ }
178
272
  const rollback = program.command('rollback').description('restore the previous Agent platform configuration');
179
273
  rollback.command('codex')
180
274
  .description('restore the Codex settings saved before the latest BOFT setup')
@@ -185,6 +279,17 @@ export function createProgram(dependencies = {}) {
185
279
  else
186
280
  writer.out(result.restored ? `Codex configuration restored: ${result.config_path}` : 'No BOFT Codex setup is available to roll back.');
187
281
  });
282
+ for (const target of ['claude', 'gemini', 'opencode']) {
283
+ rollback.command(target)
284
+ .description(`restore the previous BOFT ${target} configuration`)
285
+ .action(async () => {
286
+ const result = await rollbackAgentPlatform(target, env);
287
+ if (globalOptions(program).json)
288
+ jsonOutput(writer, result);
289
+ else
290
+ writer.out(result.restored ? `${target} configuration restored: ${result.config_path}` : `No BOFT ${target} setup is available to roll back.`);
291
+ });
292
+ }
188
293
  const remove = program.command('remove').description('remove BOFT from an Agent platform');
189
294
  remove.command('codex')
190
295
  .description('remove all BOFT Codex setup layers and restore the original settings')
@@ -195,6 +300,17 @@ export function createProgram(dependencies = {}) {
195
300
  else
196
301
  writer.out(result.removed ? 'BOFT Codex configuration removed.' : 'BOFT is not configured for Codex.');
197
302
  });
303
+ for (const target of ['claude', 'gemini', 'opencode']) {
304
+ remove.command(target)
305
+ .description(`remove all BOFT ${target} setup layers and restore the original settings`)
306
+ .action(async () => {
307
+ const result = await removeAgentPlatform(target, env);
308
+ if (globalOptions(program).json)
309
+ jsonOutput(writer, result);
310
+ else
311
+ writer.out(result.removed ? `BOFT ${target} configuration removed.` : `BOFT is not configured for ${target}.`);
312
+ });
313
+ }
198
314
  program.command('balance')
199
315
  .description('show the current account balance')
200
316
  .action(async () => {
@@ -524,7 +640,7 @@ function validateName(value) {
524
640
  function validateSetupCode(value) {
525
641
  const normalized = value.trim();
526
642
  if (!/^[A-Za-z0-9][A-Za-z0-9_-]{5,127}$/.test(normalized)) {
527
- throw new Error('Setup code must contain 6-128 letters, numbers, underscores, or hyphens');
643
+ throw new Error('Client access code must contain 6-128 letters, numbers, underscores, or hyphens');
528
644
  }
529
645
  return normalized;
530
646
  }