a24z 1.0.51 → 1.0.52
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/index.js +4 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ ${BFD}
|
|
|
159
159
|
Try running with %s or get access `,M.cyan("sudo"))+`
|
|
160
160
|
to the local update config store via
|
|
161
161
|
`+M.cyan(p$(" sudo chown -R $USER:$(id -gn $USER) %s ",O4));W6.on("exit",()=>{console.error(w7(F,{textAlignment:"center"}))})}}check(){if(!this.config||this.config.get("optOut")||this.#Z)return;if(this.update=this.config.get("update"),this.update)this.update.current=this.#J,this.config.delete("update");if(Date.now()-this.config.get("lastUpdateCheck")<this.#Y)return;R2D(W6.execPath,[Rk.join(I2D,"check.js"),JSON.stringify(this.#D)],{detached:!0,stdio:"ignore"}).unref()}async fetchInfo(){let{distTag:D}=this.#D,F=await w$(this._packageName,{version:D});return{latest:F,current:this.#J,type:Tk.default(this.#J,F)??D,name:this._packageName}}notify(D){let F=!this._shouldNotifyInNpmScript&&vS;if(!W6.stdout.isTTY||F||!this.update||!Ik.default(this.update.latest,this.update.current))return this;D={isGlobal:cS,...D};let Z=D.isGlobal?`npm i -g ${this._packageName}`:`npm i ${this._packageName}`,J="Update available "+M.dim("{currentVersion}")+M.reset(" → ")+M.green("{latestVersion}")+`
|
|
162
|
-
Run `+M.cyan("{updateCommand}")+" to update",Y=D.message||J;D.boxenOptions??={padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let X=w7(d$(Y,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:Z}),D.boxenOptions);if(D.defer===!1)console.error(X);else W6.on("exit",()=>{console.error(X)});return this}}function l$(D){let F=new j7(D);return F.check(),F}var w3=d(Ox(),1);import PZD from"zlib";import{promisify as wZD}from"util";import{execSync as Sx}from"child_process";var Px={name:"a24z",version:"1.0.
|
|
162
|
+
Run `+M.cyan("{updateCommand}")+" to update",Y=D.message||J;D.boxenOptions??={padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let X=w7(d$(Y,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:Z}),D.boxenOptions);if(D.defer===!1)console.error(X);else W6.on("exit",()=>{console.error(X)});return this}}function l$(D){let F=new j7(D);return F.check(),F}var w3=d(Ox(),1);import PZD from"zlib";import{promisify as wZD}from"util";import{execSync as Sx}from"child_process";var Px={name:"a24z",version:"1.0.52",description:"AI Agent Observability CLI - Monitor and analyze your AI tool performance",main:"dist/index.js",bin:{a24z:"bin/a24z.js"},type:"module",files:["bin/","dist/","README.md"],scripts:{build:"rm -rf dist && NODE_ENV=production bun run build.ts","build:dev":"rm -rf dist && NODE_ENV=development bun run build.ts",prepublishOnly:"bun run build","perf:test":"node scripts/perf-test.js"},keywords:["claude","ai","observability","monitoring","cli","tools","analytics","performance"],author:"a24z",homepage:"https://a24z.ai",devDependencies:{"@iarna/toml":"^2.2.5","@types/bun":"latest","@types/iarna__toml":"^2.0.5","@types/inquirer":"^9.0.7","@types/node":"^20.10.0","@types/update-notifier":"^6.0.8",chalk:"^5.3.0",commander:"^11.1.0",inquirer:"^9.2.12",open:"^9.1.0",ora:"^7.0.1",typescript:"^5.3.2","update-notifier":"^7.3.1"},engines:{node:">=16.0.0"}};var jZD=wZD(PZD.gzip);function SZD(){return{apiUrl:"https://api.a24z.ai",clientId:"client_01K4ZPKT6DNRF3FZFVHXZVWVJ8"}}var kZD=OZD(import.meta.url),xZD=fD.dirname(kZD),n7=fD.join(_8.homedir(),".a24z"),H0=fD.join(n7,"settings.json"),kx=fD.join(_8.homedir(),".claude"),x8=fD.join(kx,"settings.json"),yZD=fD.join(_8.homedir(),".gemini"),y8=fD.join(yZD,"settings.json"),vZD=fD.join(_8.homedir(),".codex"),v8=fD.join(vZD,"config.toml"),l7=fD.join(kx,"a24z-config.json"),KQ=["claude-code","gemini-cli","codex"],EQ={"claude-code":!0,"gemini-cli":!1,codex:!0},_ZD=KQ.filter((D)=>EQ[D]);function c7(D){let F=D.toLowerCase().trim();if(!KQ.includes(F))throw console.error(M.red(`
|
|
163
163
|
❌ Unknown tool: '${D}'`)),console.log(M.cyan(`
|
|
164
164
|
\uD83D\uDCE6 Available tools:`)),console.log(M.white(" • claude-code")+M.gray(" - Anthropic's Claude Code editor")),console.log(M.white(" • codex")+M.gray(" - OpenAI Codex CLI")),console.log(M.cyan(`
|
|
165
165
|
\uD83D\uDCA1 Example:`)),console.log(M.yellow(" a24z install claude-code")),console.log(""),Error(`Unknown tool: '${D}'. Available tools: ${KQ.join(", ")}`);if(!EQ[F]){console.error(M.red(`
|
|
@@ -168,7 +168,7 @@ Run `+M.cyan("{updateCommand}")+" to update",Y=D.message||J;D.boxenOptions??={pa
|
|
|
168
168
|
\uD83D\uDCE6 Currently available tools:`));for(let Z of _ZD)console.log(M.white(` • ${Z}`)+M.gray(` - ${j3(Z)}`));throw console.log(""),Error(`Tool '${D}' is currently disabled`)}return F}function j3(D){switch(D){case"claude-code":return"Anthropic's Claude Code editor";case"gemini-cli":return"Google's Gemini CLI";case"codex":return"OpenAI Codex CLI";default:return""}}var hZD=[{tool:"claude-code",command:"claude",directory:".claude"},{tool:"codex",command:"codex",directory:".codex"}];function xx(D){try{let Z=process.platform==="win32"?"where":"which",Y=Sx(`${Z} ${D}`,{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:5000}).trim().split(`
|
|
169
169
|
`)[0];return Y&&Y.length>0?Y:null}catch(F){return null}}function wx(){return xx("a24z")!==null}async function jx(){try{return Sx("npm install -g a24z",{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:120000}),!0}catch(D){return!1}}function uZD(D){try{return JD.statSync(D).isDirectory()}catch(F){return!1}}function fZD(D){let F=xx(D.command),Z=fD.join(_8.homedir(),D.directory),J=uZD(Z),Y="none";if(F&&J)Y="both";else if(F)Y="command";else if(J)Y="directory";return{tool:D.tool,detected:Boolean(F)||J,detectionMethod:Y,commandPath:F,directoryPath:J?Z:null}}function yx(){return hZD.filter((D)=>EQ[D.tool]).map(fZD)}function gZD(D){switch(D.detectionMethod){case"both":return`command found at ${D.commandPath} and config directory exists`;case"command":return`command found at ${D.commandPath}`;case"directory":return`config directory found at ${D.directoryPath}`;case"none":default:return"not detected"}}function mZD(D,F=500){if(typeof D!=="string")throw Error("Input must be a string");return D.trim().substring(0,F)}class vx{config;constructor(){this.config=this.loadConfig()}loadConfig(){let D=SZD(),F={apiUrl:D.apiUrl,clientId:D.clientId,accessToken:null,refreshToken:null,apiKey:null,apiKeyId:null,userEmail:null,installedAt:null,tools:[]};try{if(JD.existsSync(H0)){let Z=JD.readFileSync(H0,"utf8").trim();if(!Z){console.warn(M.yellow("⚠️ Settings file is empty, using defaults"));try{JD.unlinkSync(H0)}catch($){}return F}let J=JSON.parse(Z),Y=!1;if(J.tool&&typeof J.tool==="string")J.tools=[J.tool],delete J.tool,Y=!0;if(!Array.isArray(J.tools))J.tools=[],Y=!0;let X={...F,...J};if(Y)try{JD.writeFileSync(H0,JSON.stringify(X,null,2)),console.log(M.green('✅ Migrated configuration from "tool" to "tools" array'))}catch($){console.warn(M.yellow("Warning: Could not save migrated configuration"))}return X}if(JD.existsSync(l7)){let Z=JD.readFileSync(l7,"utf8").trim();if(!Z){console.warn(M.yellow("⚠️ Legacy settings file is empty, using defaults"));try{JD.unlinkSync(l7)}catch(X){}return F}let J=JSON.parse(Z);if(J.tool&&typeof J.tool==="string")J.tools=[J.tool],delete J.tool;let Y={...F,...J};JD.mkdirSync(n7,{recursive:!0}),JD.writeFileSync(H0,JSON.stringify(Y,null,2));try{JD.unlinkSync(l7)}catch(X){}return console.log(M.green("✅ Migrated configuration to ~/.a24z/settings.json")),Y}}catch(Z){if(Z instanceof SyntaxError){console.warn(M.yellow("⚠️ Settings file is corrupted, using defaults"));try{if(JD.existsSync(H0))JD.unlinkSync(H0)}catch(J){}}else console.error(M.red("Error loading configuration:"),Z)}if(!JD.existsSync(H0))try{JD.mkdirSync(n7,{recursive:!0}),JD.writeFileSync(H0,JSON.stringify(F,null,2)),console.log(M.green("✅ Initialized configuration at ~/.a24z/settings.json"))}catch(Z){console.warn(M.yellow("⚠️ Could not create settings file, using defaults"))}return F}saveConfig(){try{JD.mkdirSync(n7,{recursive:!0}),JD.writeFileSync(H0,JSON.stringify(this.config,null,2))}catch(D){console.error(M.red("Error saving configuration:"),D)}}getInstalledTools(){try{if(JD.existsSync(H0)){let D=JD.readFileSync(H0,"utf8").trim();if(!D)return[];let F=JSON.parse(D);if(F.tool&&typeof F.tool==="string"&&!F.tools)return[F.tool];return Array.isArray(F.tools)?F.tools:[]}}catch(D){}return[]}async install(D,F={}){if(!wx()){console.log(M.cyan(`
|
|
170
170
|
\uD83D\uDCE6 Installing a24z CLI globally...
|
|
171
|
-
`)),console.log(M.gray(
|
|
171
|
+
`)),console.log(M.gray(` Running: npm install -g a24z
|
|
172
172
|
`));let Y=G1("Installing a24z globally...").start();if(await jx())Y.succeed("a24z CLI installed globally");else{Y.fail("Failed to install a24z globally"),console.log(M.yellow(`
|
|
173
173
|
⚠️ Could not install a24z globally.`)),console.log(M.white(" Please run manually:"),M.cyan("npm install -g a24z")),console.log(M.white(" Then run:"),M.cyan(`a24z install ${D}
|
|
174
174
|
`)),console.log(M.gray(" Note: If you see permission errors, you may need to:")),console.log(M.gray(" • Use sudo: sudo npm install -g a24z")),console.log(M.gray(" • Or configure npm prefix: npm config set prefix ~/.npm-global")),console.log(M.gray(` and add ~/.npm-global/bin to your PATH
|
|
@@ -194,7 +194,7 @@ Run "a24z org list" for more details.`)),process.exit(1)}}else{console.log(M.cya
|
|
|
194
194
|
\uD83D\uDD10 Revoking previous API key...`)),await this.revokeApiKey(this.config.apiKeyId);console.log(M.cyan(`\uD83D\uDD11 Creating new API key for ${Z.name}...`));let Y=_8.hostname(),X=await this.createApiKeyForCLI(this.config.accessToken||"",Y,Z.id);if(!X||!X.apiKey||!X.id)throw Error("Failed to create new API key");this.config.apiKey=X.apiKey,this.config.apiKeyId=X.id,this.config.activeOrganization={id:Z.id,name:Z.name,apiKeyCreatedAt:new Date().toISOString()},this.saveConfig();let $=this.config.tools;if($.length>0){console.log(M.cyan("\uD83D\uDCDD Updating tool settings..."));for(let Q of $)if(Q==="claude-code")this.updateClaudeSettings();else if(Q==="gemini-cli")this.updateGeminiSettings();else if(Q==="codex")this.updateCodexSettings()}console.log(M.green(`
|
|
195
195
|
✅ Successfully switched to ${Z.name}!`)),console.log(M.white(` Plan: ${Z.plan}`)),console.log(M.white(` Role: ${Z.role}`)),console.log("")}catch(F){console.error(M.red("❌ Failed to switch organization:"),F instanceof Error?F.message:String(F)),process.exit(1)}}async init(D={}){if(!wx()){console.log(M.cyan(`
|
|
196
196
|
\uD83D\uDCE6 Installing a24z CLI globally...
|
|
197
|
-
`)),console.log(M.gray(
|
|
197
|
+
`)),console.log(M.gray(` Running: npm install -g a24z
|
|
198
198
|
`));let q=G1("Installing a24z globally...").start();if(await jx())q.succeed("a24z CLI installed globally");else{q.fail("Failed to install a24z globally"),console.log(M.yellow(`
|
|
199
199
|
⚠️ Could not install a24z globally.`)),console.log(M.white(" Please run manually:"),M.cyan("npm install -g a24z")),console.log(M.white(" Then run:"),M.cyan(`a24z init
|
|
200
200
|
`)),console.log(M.gray(" Note: If you see permission errors, you may need to:")),console.log(M.gray(" • Use sudo: sudo npm install -g a24z")),console.log(M.gray(" • Or configure npm prefix: npm config set prefix ~/.npm-global")),console.log(M.gray(` and add ~/.npm-global/bin to your PATH
|
|
@@ -280,4 +280,4 @@ Examples:
|
|
|
280
280
|
$ a24z org switch <org-id> # Switch by ID
|
|
281
281
|
`).action(async(D)=>{await X1.switchOrganization(D)});WQ.command("current").description("Display currently active organization").action(async()=>{await X1.getCurrentOrganization()});x0.parse();export{SZD as getDefaultUrls};
|
|
282
282
|
|
|
283
|
-
//# debugId=
|
|
283
|
+
//# debugId=EFC3DCDD388A877B64756E2164756E21
|