@vibeapi/cli 0.0.42 → 0.0.44
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 +4 -4
- package/dist/commands/setup.d.ts +5 -3
- package/dist/commands/setup.js +1 -1
- package/dist/lib/command.js +1 -1
- package/dist/locales/en_US.json +4 -2
- package/dist/locales/zh_CN.json +4 -2
- package/dist/models.json +1 -1
- package/models.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,10 +36,10 @@ npx --yes --registry https://npm.cnb.cool/vibeapi/npm/-/packages/ @vibeapi/cli@l
|
|
|
36
36
|
vibecli setup --key sk-xxx
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
`--key` 会按令牌能访问的模型分组自动配置:有 Claude 模型配 Claude Code、有 GPT 模型配 Codex、有 Grok 模型配 Grok Build。拿到的是多个分组的令牌(如 Claude 分组 + GPT 分组 + Grok 分组),就各配各的:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
vibecli setup --claudekey sk-a --codexkey sk-b
|
|
42
|
+
vibecli setup --claudekey sk-a --codexkey sk-b --grokkey sk-c
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Codex 同时开启 1M 上下文时,末尾加最短参数 `--1m`;已经配置过的用户无需再次输入 Key。单独执行 `--1m` 只幂等更新上下文字段,不改写 Codex 凭据:
|
|
@@ -50,7 +50,7 @@ vibecli setup --1m
|
|
|
50
50
|
vibecli setup --no-1m
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
配完直接运行 `claude` / `codex` 即可。
|
|
53
|
+
配完直接运行 `claude` / `codex` / `grok` 即可。
|
|
54
54
|
|
|
55
55
|
### 方式 B:交互式向导
|
|
56
56
|
|
|
@@ -78,7 +78,7 @@ vibecli config claude-code clear-model # 模型选择被钉住时,交还给
|
|
|
78
78
|
|
|
79
79
|
- **多工具一键配置**:把当前 API Key / 模型注入 Claude Code、Codex、OpenClaw、Hermes、AtomCode、Grok Build(OpenCode 暂时下架,`vibecli config opencode` 仍可用)。
|
|
80
80
|
- **按工具选模型**:使用默认 / 实时从 API 拉取 / 内置预设 / 手动输入;每个工具可用不同模型。
|
|
81
|
-
- Claude Code 用默认模型时不写 `ANTHROPIC_*_MODEL` 环境变量,顶层 `model` 由 `settings-template.json` 提供(当前为 `opus[1m]`);显式选择其它模型时会覆盖该模板值。Codex 默认 `gpt-6-astra`,其余工具默认 `gpt-5.5`。
|
|
81
|
+
- Claude Code 用默认模型时不写 `ANTHROPIC_*_MODEL` 环境变量,顶层 `model` 由 `settings-template.json` 提供(当前为 `opus[1m]`);显式选择其它模型时会覆盖该模板值。Codex 默认 `gpt-6-astra`,Grok Build 默认 `grok-4.6`,其余工具默认 `gpt-5.5`。
|
|
82
82
|
- Codex 默认启用 1M 上下文窗口(自动压缩阈值 900K);交互配置 Codex 时可取消。
|
|
83
83
|
- **不动你的其它配置**:只改本工具的 provider 字段,你的 hooks、MCP、插件、权限设置原样保留。
|
|
84
84
|
- **改前自动备份 + 一键还原**:覆盖配置前先快照(每文件留 10 份),`vibecli config <tool> restore` 随时回退;还原本身也可再撤销。
|
package/dist/commands/setup.d.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* vibecli setup --key sk-xxx
|
|
5
5
|
* 校验 Key → 用它拉 /v1/models 探测能力:能访问 Claude 模型就配 Claude Code、
|
|
6
|
-
* 能访问 GPT 模型就配 Codex
|
|
6
|
+
* 能访问 GPT 模型就配 Codex、能访问 Grok 模型就配 Grok Build;
|
|
7
|
+
* 哪些可用就配哪些(跳过的打印原因)。
|
|
7
8
|
*
|
|
8
|
-
* vibecli setup --claudekey sk-a --codexkey sk-b
|
|
9
|
-
*
|
|
9
|
+
* vibecli setup --claudekey sk-a --codexkey sk-b --grokkey sk-c
|
|
10
|
+
* 多令牌各配各的(如 Claude 分组 + GPT 分组 + Grok 分组),各自校验 + 能力核对,
|
|
10
11
|
* 明文存入 config.yaml 的工具专属 Key。只给其中一个旗标就只配对应工具。
|
|
11
12
|
*
|
|
12
13
|
* vibecli setup --1m
|
|
@@ -21,6 +22,7 @@ export interface SetupCommandOptions {
|
|
|
21
22
|
key?: string;
|
|
22
23
|
claudekey?: string;
|
|
23
24
|
codexkey?: string;
|
|
25
|
+
grokkey?: string;
|
|
24
26
|
all?: boolean;
|
|
25
27
|
oneMillion?: boolean;
|
|
26
28
|
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"chalk";import{i18n as o}from"../lib/i18n.js";import{configManager as t}from"../lib/config.js";import{toolManager as a,SUPPORTED_TOOLS as
|
|
1
|
+
import e from"chalk";import{i18n as o}from"../lib/i18n.js";import{configManager as t}from"../lib/config.js";import{toolManager as a,SUPPORTED_TOOLS as s}from"../lib/tool-manager.js";import{validateApiKey as l,fetchModels as i}from"../lib/api-validator.js";import{CODEX_ONE_MILLION_CONTEXT_SETTING as n,setCodexOneMillionContext as r}from"../lib/tools/codex.js";async function d(e){const o=await i(e);if(!o.ok)return{hasClaude:!0,hasGpt:!0,hasGrok:!0,probed:!1};const t=o.models.map(e=>e.toLowerCase());return{hasClaude:t.some(e=>e.includes("claude")),hasGpt:t.some(e=>e.startsWith("gpt")||e.includes("gpt-")||/^o\d/.test(e)),hasGrok:t.some(e=>e.includes("grok")),probed:!0}}function p(e,o){return"claude"===o?e.hasClaude:"gpt"===o?e.hasGpt:e.hasGrok}function c(o){console.log(e.green(o))}function u(o){console.log(e.yellow(o))}function m(o){console.error(e.red(o))}async function g(t,a){console.log(e.gray(o.t("setup.validating",{label:t})));const s=await l(a);return!!s.valid||(m(o.t("setup.invalid_key",{label:t,reason:s.message||s.error||"invalid"})),!1)}function f(l,i,r){const d=s[l];try{"codex"===l&&void 0!==r&&t.setToolSetting("codex",n,r),a.loadPrivateConfig(l,i,t.getModelsForTool(l))}catch(e){return m(o.t("setup.apply_failed",{tool:d.displayName,reason:e instanceof Error?e.message:String(e)})),!1}return c(o.t("setup.configured",{tool:d.displayName,command:d.command})),"codex"===l&&void 0!==r&&c(o.t(r?"setup.codex_1m_enabled":"setup.codex_1m_disabled")),a.isToolInstalled(l)||console.log(e.gray(o.t("setup.install_hint",{tool:d.displayName,install:d.installCommand}))),!0}export async function setupCommand(e){const a=e.key?.trim(),l=e.claudekey?.trim(),i=e.codexkey?.trim(),y=e.grokkey?.trim(),k=void 0!==e.oneMillion;if(!a&&!l&&!i&&!y&&k){if(!t.getApiKeyForTool("codex"))return m(o.t("setup.codex_1m_missing_key")),void(process.exitCode=1);try{const a=!0===e.oneMillion;t.setToolSetting("codex",n,a),r(a),c(o.t(a?"setup.codex_1m_enabled":"setup.codex_1m_disabled"))}catch(e){m(o.t("setup.apply_failed",{tool:s.codex.displayName,reason:e instanceof Error?e.message:String(e)})),process.exitCode=1}return}if(!(a||l||i||y))return m(o.t("setup.usage")),void(process.exitCode=1);let b=0,_=0;const h=new Set,x=[];l&&x.push({tool:"claude-code",label:"--claudekey",apiKey:l,need:"claude"}),i&&x.push({tool:"codex",label:"--codexkey",apiKey:i,need:"gpt"}),y&&x.push({tool:"grok",label:"--grokkey",apiKey:y,need:"grok"});for(const a of x){if(!await g(a.label,a.apiKey)){_+=1;continue}const s=await d(a.apiKey);!s.probed||p(s,a.need)?(s.probed||u(o.t("setup.probe_failed",{label:a.label})),t.setToolApiKey(a.tool,a.apiKey),f(a.tool,a.apiKey,e.oneMillion)?(b+=1,h.add(a.tool)):_+=1):(m(o.t(`setup.key_no_${a.need}`,{label:a.label})),_+=1)}if(a){if(!await g("--key",a))return void(process.exitCode=1);t.setApiKey(a);const s=await d(a);if(s.probed||u(o.t("setup.probe_failed",{label:"--key"})),s.probed&&!s.hasClaude&&!s.hasGpt&&!s.hasGrok)return m(o.t("setup.key_no_family")),void(process.exitCode=1);const l=[{tool:"claude-code",capable:s.hasClaude,skipMsg:o.t("setup.skip_no_claude")},{tool:"codex",capable:s.hasGpt,skipMsg:o.t("setup.skip_no_gpt")},{tool:"grok",capable:s.hasGrok,skipMsg:o.t("setup.skip_no_grok")}];for(const o of l)h.has(o.tool)||(o.capable?f(o.tool,a,e.oneMillion)?(b+=1,h.add(o.tool)):_+=1:u(o.skipMsg))}if(b>0){const e=[...h].map(e=>s[e]?.command).filter(Boolean).join(" / ");c("\n"+o.t("setup.done",{count:String(b),commands:e}))}(_>0||0===b)&&(process.exitCode=1)}
|
package/dist/lib/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Command as e}from"commander";import{i18n as o,detectSystemLang as a}from"./i18n.js";import{configManager as t}from"./config.js";import{wizard as
|
|
1
|
+
import{Command as e}from"commander";import{i18n as o,detectSystemLang as a}from"./i18n.js";import{configManager as t}from"./config.js";import{wizard as i}from"./wizard.js";import{langCommand as n,authCommand as r,doctorCommand as s,configCommand as c,statusCommand as m}from"../commands/index.js";import{logsCommand as p}from"../commands/logs.js";import{completionCommand as l}from"../commands/completion.js";import{benchCommand as d}from"../commands/bench.js";import{updateCommand as g}from"../commands/update.js";import{setupCommand as u}from"../commands/setup.js";import h from"chalk";import{readFileSync as y}from"fs";import{join as f,dirname as k}from"path";import{fileURLToPath as b}from"url";import{setRuntimeOptions as v,detectColorPreferenceFromEnv as w,isColorEnabled as $,isJsonMode as j}from"./runtime-options.js";import{cleanupAnthropicEnvVars as x}from"./env-cleanup.js";import{runStartupUpdate as C}from"./auto-update.js";export class Command{program;constructor(){const i=t.isFirstRun()?a():t.getLang();o.loadFromConfig(i),this.program=new e,this.setupProgram()}getVersion(){try{const e=b(import.meta.url),o=k(e),a=f(o,"../../package.json");return JSON.parse(y(a,"utf-8")).version}catch{return"1.0.0"}}setupProgram(){this.program.name("vibecli").description(o.t("cli.title")).version(this.getVersion(),"-v, --version",o.t("commands.version")).helpOption("-h, --help",o.t("commands.help")).option("--base <url>","Custom API base URL").option("--non-interactive","Disable interactive prompts (CI mode)").option("--json","Emit machine-readable JSON output where applicable").option("--yes, -y","Auto-confirm prompts that have a default action").option("--dry-run","Show planned changes without writing anywhere").option("--no-color","Disable colored output"),this.program.command("setup").description(o.t("commands.setup")).option("--key <key>","API key for all capable tools (capability auto-detected)").option("--claudekey <key>","Dedicated API key for Claude Code").option("--codexkey <key>","Dedicated API key for Codex").option("--grokkey <key>","Dedicated API key for Grok Build").option("--1m","Enable the 1M context window for Codex").option("--no-1m","Disable the 1M context window for Codex").option("--all","Configure every tool the key can serve (default behavior)").action(async e=>{await u({key:e.key,claudekey:e.claudekey,codexkey:e.codexkey,grokkey:e.grokkey,all:e.all,oneMillion:e["1m"]})}),this.program.command("init").description(o.t("commands.init")).action(async()=>{await this.handleInitCommand()});const e=this.program.command("lang").description(o.t("commands.lang"));e.command("show").description(o.t("lang.show_usage")).action(async()=>{await n(["show"])}),e.command("set <locale>").description(o.t("lang.set_usage")).action(async e=>{await n(["set",e])});const a=this.program.command("auth").description(o.t("commands.auth"));a.argument("[token]","API token").action(async e=>{const o=[];e&&o.push(e),await r(o)}),a.command("revoke").description("Revoke saved API key").action(async()=>{await r(["revoke"])}),a.command("reload <tool>").description("Reload plan configuration to the specified tool (e.g., claude)").action(async e=>{await r(["reload",e])}),this.program.command("doctor").description(o.t("commands.doctor")).action(async()=>{await s()}),this.program.command("status").description(o.t("commands.status")).action(async()=>{await m()}),this.program.command("logs").description("Inspect vibecli log files").argument("[action]","list|tail|path").argument("[file]","specific log file when using tail").action(async(e,o)=>{const a=[];e&&a.push(e),o&&a.push(o),await p(a)}),this.program.command("completion <shell>").description("Print shell completion script (bash|zsh|fish)").action(async e=>{await l([e])}),this.program.command("update").description("Check for a newer version across CNB and npm mirrors").action(async()=>{await g()}),this.program.command("bench").description("Benchmark the configured API endpoint").option("--samples <n>","number of samples to send","5").action(async e=>{const o=[];e.samples&&o.push("--samples",e.samples),await d(o)}),this.program.command("config").description("Manage profiles, presets, backups, and per-tool config").argument("[args...]","Subcommand and arguments").allowUnknownOption(!0).action(async e=>{await c(e||[])}),this.program.command("enter [option]").description(o.t("commands.enter")).action(async e=>{if(e)switch(e){case"lang":case"language":await i.configLanguage();break;case"apikey":case"api-key":await i.configApiKey();break;case"models":await i.configModels();break;default:{const o=[e];await c(o);break}}else await i.run()}),this.program.action(async()=>{await i.run()}),this.program.configureHelp({sortSubcommands:!0,subcommandTerm:e=>e.name()+" "+e.usage()}),this.program.addHelpText("after",`\n${h.bold(o.t("cli.examples"))}:\n ${h.gray("$ vibecli # Interactive main menu")}\n ${h.gray("$ vibecli init # Run first-time setup wizard")}\n ${h.gray("$ vibecli setup --key sk-xxx # One-shot setup (auto-detect capable tools)")}\n ${h.gray("$ vibecli setup --claudekey sk-a --codexkey sk-b --grokkey sk-c")}\n ${h.gray("$ vibecli status --json # Machine-readable status")}\n ${h.gray("$ vibecli config profile list")}\n ${h.gray("$ vibecli config profile create work")}\n ${h.gray("$ vibecli config profile use work")}\n ${h.gray("$ vibecli config preset save fast")}\n ${h.gray("$ vibecli config backup create snapshot")}\n ${h.gray("$ vibecli auth <token> --non-interactive")}\n ${h.gray("$ vibecli auth revoke --yes")}\n ${h.gray("$ vibecli logs path")}\n ${h.gray("$ vibecli completion bash")}\n ${h.gray("$ vibecli bench --samples 3")}\n ${h.gray("$ vibecli update")}\n ${h.gray('$ vibecli --base "https://custom.api.com" init # Custom base URL')}\n`)}async handleInitCommand(){await i.runFirstTimeSetup()}cleanupLeakedEnvVars(){const e=x();if(0===e.length||j())return;const a=o.t("messages.env_vars_cleared",{vars:e.join(", ")});console.log($()?h.yellow(a):a)}preflightArgs(e){const o=o=>e.includes(o),a=!o("--no-color")&&w();let i;v({nonInteractive:o("--non-interactive"),json:o("--json"),yes:o("--yes")||o("-y"),dryRun:o("--dry-run"),color:a}),a||(h.level=0);for(let o=0;o<e.length;o+=1){const a=e[o];if("--base"===a&&e[o+1]){i=e[o+1];break}if(a.startsWith("--base=")){i=a.slice(7);break}}i&&t.setBaseUrl(i)}async execute(e){try{if(this.preflightArgs(e),this.cleanupLeakedEnvVars(),(await C(e)).handled)return;await this.program.parseAsync(e,{from:"user"})}catch(e){if(e instanceof Error){const a=$()?h.red:e=>e;console.error(a(o.t("cli.error_general")),e.message)}process.exit(1)}}getProgram(){return this.program}}
|
package/dist/locales/en_US.json
CHANGED
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"non_interactive_aborted": "Aborted - missing required input"
|
|
314
314
|
},
|
|
315
315
|
"setup": {
|
|
316
|
-
"usage": "Usage: vibecli setup --key sk-xxx or vibecli setup --claudekey sk-a --codexkey sk-b or vibecli setup --1m|--no-1m",
|
|
316
|
+
"usage": "Usage: vibecli setup --key sk-xxx or vibecli setup --claudekey sk-a --codexkey sk-b --grokkey sk-c or vibecli setup --1m|--no-1m",
|
|
317
317
|
"codex_1m_enabled": "Codex 1M context is enabled",
|
|
318
318
|
"codex_1m_disabled": "Codex 1M context is disabled",
|
|
319
319
|
"codex_1m_missing_key": "No saved Codex API key was found; configure one with --key or --codexkey first",
|
|
@@ -322,9 +322,11 @@
|
|
|
322
322
|
"probe_failed": "Capability probe for {{label}} failed (network); continuing as if all families are available",
|
|
323
323
|
"key_no_claude": "{{label}} cannot access Claude models (token group excludes Claude); skipped Claude Code",
|
|
324
324
|
"key_no_gpt": "{{label}} cannot access GPT models (token group excludes GPT); skipped Codex",
|
|
325
|
-
"
|
|
325
|
+
"key_no_grok": "{{label}} cannot access Grok models (token group excludes Grok); skipped Grok Build",
|
|
326
|
+
"key_no_family": "This key exposes no Claude, GPT or Grok models; check the token group and retry",
|
|
326
327
|
"skip_no_claude": "This key has no Claude model group; skipped Claude Code",
|
|
327
328
|
"skip_no_gpt": "This key has no GPT model group; skipped Codex",
|
|
329
|
+
"skip_no_grok": "This key has no Grok model group; skipped Grok Build",
|
|
328
330
|
"configured": "√ {{tool}} configured (run `{{command}}` to start)",
|
|
329
331
|
"apply_failed": "Failed to write {{tool}} config: {{reason}}",
|
|
330
332
|
"install_hint": " Hint: {{tool}} not detected yet; install via {{install}}",
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"non_interactive_aborted": "已中止 - 缺少必要输入"
|
|
314
314
|
},
|
|
315
315
|
"setup": {
|
|
316
|
-
"usage": "用法: vibecli setup --key sk-xxx 或 vibecli setup --claudekey sk-a --codexkey sk-b 或 vibecli setup --1m|--no-1m",
|
|
316
|
+
"usage": "用法: vibecli setup --key sk-xxx 或 vibecli setup --claudekey sk-a --codexkey sk-b --grokkey sk-c 或 vibecli setup --1m|--no-1m",
|
|
317
317
|
"codex_1m_enabled": "Codex 1M 上下文已开启",
|
|
318
318
|
"codex_1m_disabled": "Codex 1M 上下文已关闭",
|
|
319
319
|
"codex_1m_missing_key": "未找到已保存的 Codex API Key;请先用 --key 或 --codexkey 完成配置",
|
|
@@ -322,9 +322,11 @@
|
|
|
322
322
|
"probe_failed": "{{label}} 的模型能力探测失败(网络原因),按全部可用继续",
|
|
323
323
|
"key_no_claude": "{{label}} 无法访问 Claude 模型(令牌分组不含 Claude),已跳过 Claude Code",
|
|
324
324
|
"key_no_gpt": "{{label}} 无法访问 GPT 模型(令牌分组不含 GPT),已跳过 Codex",
|
|
325
|
-
"
|
|
325
|
+
"key_no_grok": "{{label}} 无法访问 Grok 模型(令牌分组不含 Grok),已跳过 Grok Build",
|
|
326
|
+
"key_no_family": "该 Key 探测不到 Claude / GPT / Grok 模型,请确认令牌分组后重试",
|
|
326
327
|
"skip_no_claude": "该 Key 未开通 Claude 模型分组,已跳过 Claude Code",
|
|
327
328
|
"skip_no_gpt": "该 Key 未开通 GPT 模型分组,已跳过 Codex",
|
|
329
|
+
"skip_no_grok": "该 Key 未开通 Grok 模型分组,已跳过 Grok Build",
|
|
328
330
|
"configured": "√ {{tool}} 配置完成(运行 `{{command}}` 即可使用)",
|
|
329
331
|
"apply_failed": "{{tool}} 配置写入失败: {{reason}}",
|
|
330
332
|
"install_hint": " 提示: 尚未检测到 {{tool}},可运行 {{install}} 安装",
|
package/dist/models.json
CHANGED
package/models.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "CLI tool for managing AI coding assistants (Claude Code, Codex, OpenClaw, Hermes, AtomCode, Grok Build) with one unified config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|