@vibeapi/cli 0.0.152 → 0.0.153
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/telemetry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as o}from"os";import{brand as n,brandEnv as s,CLI_NAME as a}from"./brand.js";import{clientVersion as i,installId as c}from"./client-config.js";import{configManager as l}from"./config.js";import{gatewayAddresses as u}from"./gateway-addresses.js";import{INSTALL_ID_HEADER as
|
|
1
|
+
import{randomUUID as e}from"crypto";import{arch as t,homedir as r,release as o}from"os";import{brand as n,brandEnv as s,CLI_NAME as a}from"./brand.js";import{clientVersion as i,installId as c}from"./client-config.js";import{configManager as l}from"./config.js";import{gatewayAddresses as u}from"./gateway-addresses.js";import{INSTALL_ID_HEADER as p}from"./gateway-protocol.js";const d=e();let f="wizard",m=[];const g=new Set;let h=null,y=S;export function telemetryEnabled(){if(process.env.VITEST&&!w)return!1;const e=s("TELEMETRY")?.trim().toLowerCase();return!("0"===e||"false"===e||"off"===e)}let w=!1;export function setTelemetrySenderForTests(e){y=e??S,w=null!==e,m=[]}export function clientHeaders(){const e=`${a}/${i()} (${process.platform} ${o()}; ${t()}) node/${process.versions.node}`;return telemetryEnabled()?{"User-Agent":e,[p]:c()}:{"User-Agent":e}}export function installClientHeaders(){const e=globalThis.fetch;if(!e||e.gatewayHeaders)return;const t=(t,r)=>{try{const o=new URL("string"==typeof t||t instanceof URL?t.toString():t.url);if(new Set([l.getBaseUrl(),...u().map(e=>e.url)].map(e=>new URL(e).host)).has(o.host)){const o=new Headers(r?.headers??(t instanceof Request?t.headers:void 0));for(const[e,t]of Object.entries(clientHeaders()))o.has(e)||o.set(e,t);return e(t,{...r,headers:o})}}catch{}return e(t,r)};t.gatewayHeaders=!0,globalThis.fetch=t}export function telemetryPending(){return g.size>0}function T(){return{install_id:c(),cli_version:i(),brand:n().id,os:process.platform,os_release:o(),arch:t(),node_version:process.versions.node}}export function maskHome(e){const t=r();if(!t||t.length<2)return e;const o=new Set([t,t.replace(/\\/g,"/")]);let n=e;for(const e of o)n=n.split(e).join("~");return n}export function maskSecrets(e){return maskHome(e).replace(/(sk-[A-Za-z0-9_-]{2})[A-Za-z0-9_-]{8,}([A-Za-z0-9_-]{4})\b/g,"$1…$2").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi,"$1…").replace(/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+(?::[^\s/@]*)?@/gi,"$1…@").replace(/\b((?:api[_-]?key|token|password|passwd|secret|auth)\s*[=:]\s*)("?)[^\s"&;,]{6,}\2/gi,"$1$2…$2")}export function setTelemetryCommand(e){f=e}export function track(e,t,r={}){if(!telemetryEnabled())return;const o=void 0===r.error?void 0:maskSecrets(r.error instanceof Error?r.error.message:String(r.error)).slice(0,2e3);m.push({ts:Date.now(),session:d,command:f,step:e,status:t,...void 0!==r.duration_ms?{duration_ms:Math.round(r.duration_ms)}:{},...o?{error:o}:{},...r.detail?{detail:r.detail}:{}}),"start"===t?b():h||(h=setTimeout(b,500),h.unref())}export async function trackStep(e,t,r){const o=Date.now();track(e,"start",r?{detail:r}:{});try{const r=await t();return track(e,"ok",{duration_ms:Date.now()-o}),r}catch(t){throw track(e,"fail",{duration_ms:Date.now()-o,error:t}),t}}function b(){if(h&&(clearTimeout(h),h=null),0===m.length)return;const e=m.splice(0,50),t=y("/api/platform/vibecode/telemetry",{...T(),events:e},3e3).then(()=>{},()=>{}).finally(()=>g.delete(t));g.add(t),m.length>0&&b()}export async function flushTelemetry(e=1500){b(),0!==g.size&&await Promise.race([Promise.allSettled([...g]),new Promise(t=>setTimeout(t,e).unref())])}export async function uploadReport(e){try{const t=await y("/api/platform/vibecode/report",{...T(),report:e},2e4),r=t?.data?.code;return"string"==typeof r&&r?r:null}catch{return null}}async function S(e,t,r){const o=l.getApiKey()?.trim(),n=await fetch(new URL(e,l.getBaseUrl()).toString(),{method:"POST",headers:{"Content-Type":"application/json",...clientHeaders(),...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify(t),signal:AbortSignal.timeout(r)});if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}
|
package/dist/locales/en_US.json
CHANGED
|
@@ -427,9 +427,9 @@
|
|
|
427
427
|
"claude_code": {
|
|
428
428
|
"plan_env_remove": "Remove {{vars}} pointing at this site from {{location}} (backed up first)",
|
|
429
429
|
"env_removed": "Removed {{vars}} pointing at this site from {{location}}; new terminals pick this up (backed up)",
|
|
430
|
-
"env_foreign": "{{vars}} in {{location}}
|
|
431
|
-
"env_foreign_found": "{{vars}} in {{location}}
|
|
432
|
-
"env_foreign_offer": "
|
|
430
|
+
"env_foreign": "Found the environment variables {{vars}} in {{location}}; they override Claude Code's settings. To use {{brand}} reliably, remove them and open a new terminal",
|
|
431
|
+
"env_foreign_found": "Found the environment variables {{vars}} in {{location}}; they override Claude Code's settings",
|
|
432
|
+
"env_foreign_offer": "Found the environment variables {{where}}; they override Claude Code's settings, and {{brand}} only works reliably without them. Remove them (backed up first)?",
|
|
433
433
|
"env_removed_foreign": "Removed {{vars}} from {{location}} (backed up); open a new terminal for it to take effect",
|
|
434
434
|
"plan_replace_provider": "Replace Claude Code's current endpoint {{url}} (not written by {{product}})",
|
|
435
435
|
"provider_replaced": "Replaced the previous endpoint {{url}}; the old file is backed up",
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -427,9 +427,9 @@
|
|
|
427
427
|
"claude_code": {
|
|
428
428
|
"plan_env_remove": "删除 {{location}} 里指向本站的 {{vars}}(先备份)",
|
|
429
429
|
"env_removed": "已删除 {{location}} 里指向本站的 {{vars}},新开的终端生效(已备份)",
|
|
430
|
-
"env_foreign": "{{location}}
|
|
431
|
-
"env_foreign_found": "{{location}}
|
|
432
|
-
"env_foreign_offer": "
|
|
430
|
+
"env_foreign": "检测到 {{location}} 里已有环境变量 {{vars}},它会盖过 Claude Code 的配置;要稳定使用 {{brand}},请删掉后重新打开终端",
|
|
431
|
+
"env_foreign_found": "检测到 {{location}} 里已有环境变量 {{vars}},它会盖过 Claude Code 的配置",
|
|
432
|
+
"env_foreign_offer": "检测到环境变量 {{where}},它会盖过 Claude Code 的配置,删掉后才能稳定使用 {{brand}}。删除这些环境变量(会先备份)?",
|
|
433
433
|
"env_removed_foreign": "已删除 {{location}} 里的 {{vars}}(已备份),重新打开终端后生效",
|
|
434
434
|
"plan_replace_provider": "替换 Claude Code 现在的接入地址 {{url}}(不是 {{product}} 写的)",
|
|
435
435
|
"provider_replaced": "已替换原来的接入地址 {{url}},修改前的文件已备份",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeapi/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.153",
|
|
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",
|