@vibeapi/cli 0.0.41 → 0.0.42
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/dist/lib/tools/grok.js +1 -1
- package/package.json +1 -1
package/dist/lib/tools/grok.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,readFileSync as t}from"fs";import{join as r}from"path";import*as o from"@iarna/toml";import{logger as n}from"../../utils/logger.js";import{BRAND_NAME as i,PROVIDER_KEY as l}from"../brand.js";import{backupBeforeWrite as s,atomicWriteFile as a}from"./backup.js";import{pickModel as m,toolHome as d,withV1 as
|
|
1
|
+
import{existsSync as e,readFileSync as t}from"fs";import{join as r}from"path";import*as o from"@iarna/toml";import{logger as n}from"../../utils/logger.js";import{BRAND_NAME as i,PROVIDER_KEY as l}from"../brand.js";import{backupBeforeWrite as s,atomicWriteFile as a}from"./backup.js";import{pickModel as m,toolHome as d,withV1 as c}from"./types.js";import{getToolDefaultModel as f}from"../model-registry.js";const p=()=>r(r(d(),".grok"),"config.toml"),g=l,u="win32"===process.platform?'powershell -c "irm https://x.ai/cli/install.ps1 | iex"':"curl -fsSL https://x.ai/cli/install.sh | bash";function y(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function k(e,t){return y(e[t])||(e[t]={}),e[t]}function h(){if(!e(p()))return{};const r=t(p(),"utf-8");if(!r.trim())return{};try{const e=o.parse(r);if(!y(e))throw new Error("config.toml root must be a TOML table");return e}catch(e){throw new Error(`Existing ~/.grok/config.toml cannot be parsed, back it up and fix it first: ${e instanceof Error?e.message:String(e)}`)}}export const grokAdapter={name:"grok",displayName:"Grok Build",command:"grok",installCommand:u,configPath:p(),loadPrivateConfig(e){const t=h();k(t,"endpoints").models_base_url=c(e.baseUrl),k(t,"models").default=g;const r=k(t,"model"),n=y(r[g])?{...r[g]}:{};r[g]={...n,name:i,model:m(e.models,f("grok")),api_key:e.apiKey,context_window:5e5,api_backend:"responses",reasoning_summary:"concise"},s(p()),a(p(),o.stringify(t))},unloadPrivateConfig(){if(!e(p()))return;let t;try{t=h()}catch(e){return void n.logError("grokAdapter.unloadPrivateConfig",e)}y(t.model)&&(delete t.model[g],0===Object.keys(t.model).length&&delete t.model),y(t.models)&&t.models.default===g&&(delete t.models.default,0===Object.keys(t.models).length&&delete t.models),y(t.endpoints)&&(delete t.endpoints.models_base_url,0===Object.keys(t.endpoints).length&&delete t.endpoints),s(p()),a(p(),o.stringify(t))},detectCurrentConfig(){try{const e=h(),t=y(e.model)?e.model:{},r=y(t[g])?t[g]:null,o=r?r.api_key:null;return{apiKey:"string"==typeof o&&o.trim()?o:null}}catch{return{apiKey:null}}},getConfig(){try{return h()}catch(e){return n.logError("grokAdapter.getConfig",e),null}}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
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",
|