quantex-cli 0.0.1-beta.10 → 0.0.1-beta.11

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
@@ -34,6 +34,18 @@ bun add -g quantex-cli
34
34
  npm i -g quantex-cli
35
35
  ```
36
36
 
37
+ 也可以从 GitHub Releases 下载对应平台的独立二进制,或使用安装脚本:
38
+
39
+ ```bash
40
+ curl -fsSL https://raw.githubusercontent.com/Drswith/quantex-cli/main/install.sh | sh
41
+ ```
42
+
43
+ Windows PowerShell:
44
+
45
+ ```powershell
46
+ irm https://raw.githubusercontent.com/Drswith/quantex-cli/main/install.ps1 | iex
47
+ ```
48
+
37
49
  安装后可使用 `quantex` 或短别名 `qtx` 命令。
38
50
 
39
51
  ## 使用
@@ -77,7 +89,7 @@ quantex upgrade
77
89
  - 通过 Bun 全局安装的 `quantex-cli`
78
90
  - 通过 npm 全局安装的 `quantex-cli`
79
91
 
80
- 如果当前是源码工作区运行或其他非托管来源,`upgrade` 会明确提示当前来源不支持自动升级。
92
+ 如果当前是源码工作区运行、独立二进制安装或其他非托管来源,`upgrade` 会明确提示当前来源不支持自动升级。
81
93
 
82
94
  ### 卸载 Agent
83
95
 
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./config-B8_x29hh.mjs";import{a as n,c as r,d as i,i as a,l as o,n as ee,o as te,r as ne,s as re,t as ie,u as ae}from"./version-D1hlVnnS.mjs";import{mkdir as oe}from"node:fs/promises";import{join as se}from"node:path";import s from"node:process";function c(e){return{packageName:e,type:`bun`}}function l(e){return{packageName:e,type:`npm`}}function u(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function ce(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function d(e){return{command:e,type:`script`}}const le={name:`claude`,displayName:`Claude Code`,description:`Anthropic 官方 AI 编程助手 CLI`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,update:{commands:[`claude update`,`claude upgrade`]},platforms:{windows:[c(),l(),d(`irm https://claude.ai/install.ps1 | iex`),ce(`Anthropic.ClaudeCode`)],macos:[c(),l(),d(`curl -fsSL https://claude.ai/install.sh | bash`),u(`claude-code`,`cask`)],linux:[c(),l(),d(`curl -fsSL https://claude.ai/install.sh | bash`),u(`claude-code`,`cask`)]}},f={name:`codex`,displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,packages:{npm:`@openai/codex`},binaryName:`codex`,platforms:{windows:[c(),l()],macos:[c(),l(),u(`codex`)],linux:[c(),l(),u(`codex`)]}},p={name:`copilot`,displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[ce(`GitHub.Copilot`)],macos:[c(),l(),d(`curl -fsSL https://gh.io/copilot-install | bash`),u(`copilot-cli`)],linux:[c(),l(),d(`curl -fsSL https://gh.io/copilot-install | bash`),u(`copilot-cli`)]}},m={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,update:{commands:[`agent update`]},platforms:{windows:[d(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[d(`curl https://cursor.com/install -fsS | bash`)],linux:[d(`curl https://cursor.com/install -fsS | bash`)]}},h={name:`droid`,displayName:`Droid`,description:`Factory AI 软件工程 Agent CLI`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,platforms:{windows:[c(),l(),d(`irm https://app.factory.ai/cli/windows | iex`)],macos:[c(),l(),d(`curl -fsSL https://app.factory.ai/cli | sh`),u(`droid`,`cask`)],linux:[c(),l(),d(`curl -fsSL https://app.factory.ai/cli | sh`),u(`droid`,`cask`)]}},g={name:`gemini`,displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[c(),l()],macos:[c(),l(),u(`gemini-cli`)],linux:[c(),l(),u(`gemini-cli`)]}},_={name:`opencode`,displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,platforms:{windows:[c(),l()],macos:[c(),l(),d(`curl -fsSL https://opencode.ai/install | bash`),u(`anomalyco/tap/opencode`)],linux:[c(),l(),d(`curl -fsSL https://opencode.ai/install | bash`),u(`anomalyco/tap/opencode`)]}},v={name:`pi`,displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,platforms:{windows:[c(),l()],macos:[c(),l()],linux:[c(),l()]}},y=[le,f,p,m,h,g,_,v];function b(){return y}function x(e){return y.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function S(e){return x(e)}const ue={installedAgents:{}};function C(){return se(t(),`state.json`)}async function w(){try{return{installedAgents:(await Bun.file(C()).json()).installedAgents??{}}}catch{return{...ue}}}async function T(e){await oe(t(),{recursive:!0}),await Bun.write(C(),`${JSON.stringify(e,null,2)}\n`)}async function E(e){return(await w()).installedAgents[e]}async function D(e){let t=await w();t.installedAgents[e.agentName]=e,await T(t)}async function O(e){let t=await w();delete t.installedAgents[e],await T(t)}function k(){switch(s.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function A(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0}catch{return!1}}async function j(){return A(`bun`)}async function M(){return A(`npm`)}async function N(){return A(`brew`)}async function P(){return A(`winget`)}async function F(e){try{let t=s.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0}catch{return!1}}const de={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},npm:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},script:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},winget:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`}};function I(e){return de[e]}function L(e){return I(e).lifecycle===`managed`}function R(e){return I(e).lifecycle}function z(e){return I(e).canUpdate}function fe(e){return I(e).canUninstall}function B(e){return I(e).canLookupLatestVersion}function V(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function H(e,t){return t.packageName||e.packages?.npm||void 0}function U(e){return e?z(e.installType):!1}function pe(e,t){return U(t)||!!e.update?.commands.length}function me(e){return!!e&&B(e.installType)}function he(e){return e.length>0&&e.every(e=>B(e.type))}function ge(e){return L(e.type)?`${R(e.type)}/${e.type}${V(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function _e(e){return e?L(e.installType)?`managed via ${e.installType}${V(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function ve(e,t){return U(t)?`managed update`:e.update?.commands.length?`command update`:`manual update`}function ye(e,t){if(t.type===`bun`){let n=H(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=H(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function be(e,t,n){if(t)return me(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!he(n)))return e.packages.npm}async function W(e){let t=k(),n=typeof e==`function`?e(t):e;try{let e;return e=s.platform===`win32`?Bun.spawn([`powershell.exe`,`-Command`,n],{stdio:[`inherit`,`inherit`,`inherit`]}):Bun.spawn([`sh`,`-c`,n],{stdio:[`inherit`,`inherit`,`inherit`]}),await e.exited,e.exitCode===0}catch{return!1}}function xe(e){return e===`cask`?[`--cask`]:[]}async function G(e,t,n){try{let r=Bun.spawn([`brew`,e,...xe(n),t],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function Se(e,t){return G(`install`,e,t)}async function K(e,t){return G(`upgrade`,e,t)}async function Ce(e){for(let t of e)if(!await K(t.packageName,t.packageTargetKind))return!1;return!0}async function we(e,t){return G(`uninstall`,e,t)}async function q(e,t){try{let n=Bun.spawn([`winget`,e,`--id`,t,`-e`],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function Te(e){return q(`install`,e)}async function J(e){return q(`upgrade`,e)}async function Ee(e){for(let t of e)if(!await J(t.packageName))return!1;return!0}async function De(e){return q(`uninstall`,e)}const Oe={brew:{type:`brew`,isAvailable:async()=>N(),install:async(e,t)=>Se(e,t),uninstall:async(e,t)=>we(e,t),update:async(e,t)=>K(e,t),updateMany:async e=>Ce(e)},bun:{type:`bun`,isAvailable:async()=>j(),install:async e=>r(e),uninstall:async e=>o(e),update:async(e,t,n)=>ae(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>i(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},npm:{type:`npm`,isAvailable:async()=>M(),install:async e=>a(e),uninstall:async e=>n(e),update:async(e,t,n)=>te(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>re(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>P(),install:async e=>Te(e),uninstall:async e=>De(e),update:async e=>J(e),updateMany:async e=>Ee(e.map(e=>({packageName:e.packageName})))}};function Y(e){return Oe[e]}async function ke(){return(await e()).defaultPackageManager}async function X(){return{npmBunUpdateStrategy:(await e()).npmBunUpdateStrategy}}async function Z(e){let t=k(),n=e.platforms[t];if(!n)return[];let r=await ke();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function Ae(e,t,n,r,i){let a=Y(e);return await a.isAvailable()?r===`install`?a.install(t,n):r===`update`?a.update(t,n,{npmBunUpdateStrategy:i}):a.uninstall(t,n):!1}async function je(e,t,n,r){if(L(t.type)){let i=H(e,t);return i?Ae(t.type,i,t.packageTargetKind,n,r):!1}return n===`update`&&!z(t.type)||!t.command?!1:W(t.command)}async function Me(e,t,n){return L(e.installType)?e.packageName?Ae(e.installType,e.packageName,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:W(e.command)}async function Ne(e){if(!e.update?.commands.length)return!1;for(let t of e.update.commands)if(await W(t))return!0;return!1}async function Pe(e,t){let n={agentName:e.name,installType:t.type,packageName:H(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await D(n),n}async function Fe(e){let t=await Z(e);for(let n of t)if(await je(e,n,`install`))return{success:!0,installedState:await Pe(e,n)};return{success:!1}}async function Ie(e,t){let{npmBunUpdateStrategy:n}=await X();if(t&&await Me(t,`update`,n))return await D(t),{success:!0,installedState:t};if(await Ne(e))return{success:!0};let r=await Z(e);for(let t of r)if(await je(e,t,`update`,n))return{success:!0,installedState:await Pe(e,t)};return{success:!1}}async function Le(e,t){let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=Y(e);return await r.isAvailable()?r.updateMany(n,await X()):!1}async function Re(e){let t=await E(e.name);if(!t)return!1;let n=await Me(t,`uninstall`);return n&&await O(e.name),n}async function Q(e){let[t,n,r]=await Promise.all([Z(e),E(e.name),F(e.binaryName)]),[i,a,o]=await Promise.all([r?ee(e.binaryName):Promise.resolve(void 0),r?ie(e.binaryName):Promise.resolve(void 0),Be(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,sourceLabel:_e(n),updateLabel:ve(e,n),lifecycle:n?R(n.installType):`unmanaged`}}async function ze(e){return Promise.all(e.map(Q))}async function Be(e,t,n){let r=be(e,t,n);if(r)return ne(r)}function $(e){return S(e)}async function Ve(e){let t=$(e);if(t)return{agent:t,inspection:await Q(t)}}async function He(){return ze(b())}export{w as A,h as B,F as C,P as D,M as E,S as F,p as H,b as I,v as L,T as M,D as N,E as O,x as P,_ as R,k as S,j as T,f as U,m as V,le as W,fe as _,ze as a,I as b,Re as c,Y as d,pe as f,B as g,ge as h,Q as i,O as j,C as k,Ie as l,ye as m,$ as n,Z as o,U as p,Ve as r,Fe as s,He as t,Le as u,z as v,N as w,L as x,R as y,g as z};
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{P as e,r as t,s as n}from"./agents-ntqZ6ph3.mjs";import r from"node:process";import{program as i}from"commander";import a from"picocolors";import o from"prompts";async function s(e,r){let i=await t(e);if(!i)return console.log(a.red(`Unknown agent: ${e}`)),1;let{agent:s,inspection:c}=i;if(!c.inPath){if(!(await o({type:`confirm`,name:`install`,message:`${s.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return console.log(a.yellow(`Installation cancelled.`)),1;if(console.log(a.cyan(`Installing ${s.displayName}...`)),!(await n(s)).success)return console.log(a.red(`Failed to install ${s.displayName}.`)),1}try{let e=Bun.spawn([s.binaryName,...r],{stdio:[`inherit`,`inherit`,`inherit`]});return await e.exited,e.exitCode??1}catch(e){return console.log(a.red(`Failed to launch ${s.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}const c=await Bun.file(new URL(`../package.json`,import.meta.url)).json();i.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).version(c.version??`0.0.0`),i.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-C_YWN6yQ.mjs`);await t(e)}),i.command(`update`).argument(`[agent]`,`Agent name or alias`).option(`--all`,`更新所有已安装的 agent`).alias(`u`).description(`更新指定 agent`).action(async(e,t)=>{let{updateCommand:n}=await import(`./update-BHmfjcqN.mjs`);await n(e,t.all??!1)}),i.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-CmsQ6FOV.mjs`);await t(e)}),i.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-DcncPcqj.mjs`);await e()}),i.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-BBsT5f2a.mjs`);await t(e)}),i.command(`config`).argument(`[action]`,`Action: get, set, reset`).argument(`[key]`,`Config key`).argument(`[value]`,`Config value`).description(`配置管理`).action(async(e,t,n)=>{let{configCommand:r}=await import(`./config-BlsH3y9N.mjs`);await r(e,t,n)}),i.command(`upgrade`).description(`升级 Quantex CLI`).action(async()=>{let{upgradeCommand:e}=await import(`./upgrade-VvcM4YUp.mjs`);await e()}),i.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-DPMAPttf.mjs`);await e()});const l=r.argv[2],u=new Set([...i.commands.map(e=>e.name()),...i.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]);if(l&&!l.startsWith(`-`)&&!u.has(l)&&e(l)){let e=await s(l,r.argv.slice(3));r.exit(e)}i.parse();export{};
2
+ import{F as e,r as t,s as n}from"./agents-BqvXaaby.mjs";import r from"node:process";import{program as i}from"commander";import a from"picocolors";import o from"prompts";async function s(e,r){let i=await t(e);if(!i)return console.log(a.red(`Unknown agent: ${e}`)),1;let{agent:s,inspection:c}=i;if(!c.inPath){if(!(await o({type:`confirm`,name:`install`,message:`${s.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return console.log(a.yellow(`Installation cancelled.`)),1;if(console.log(a.cyan(`Installing ${s.displayName}...`)),!(await n(s)).success)return console.log(a.red(`Failed to install ${s.displayName}.`)),1}try{let e=Bun.spawn([s.binaryName,...r],{stdio:[`inherit`,`inherit`,`inherit`]});return await e.exited,e.exitCode??1}catch(e){return console.log(a.red(`Failed to launch ${s.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}const c=await Bun.file(new URL(`../package.json`,import.meta.url)).json();i.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).version(c.version??`0.0.0`),i.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-ByqdsmAY.mjs`);await t(e)}),i.command(`update`).argument(`[agent]`,`Agent name or alias`).option(`--all`,`更新所有已安装的 agent`).alias(`u`).description(`更新指定 agent`).action(async(e,t)=>{let{updateCommand:n}=await import(`./update-TSJ4YzC3.mjs`);await n(e,t.all??!1)}),i.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-BpsxhLQc.mjs`);await t(e)}),i.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-DS5QVFaG.mjs`);await e()}),i.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-DFse72tT.mjs`);await t(e)}),i.command(`config`).argument(`[action]`,`Action: get, set, reset`).argument(`[key]`,`Config key`).argument(`[value]`,`Config value`).description(`配置管理`).action(async(e,t,n)=>{let{configCommand:r}=await import(`./config-BlsH3y9N.mjs`);await r(e,t,n)}),i.command(`upgrade`).description(`升级 Quantex CLI`).action(async()=>{let{upgradeCommand:e}=await import(`./upgrade-OYkZNkGN.mjs`);await e()}),i.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-CgwVG6BK.mjs`);await e()});const l=r.argv[2],u=new Set([...i.commands.map(e=>e.name()),...i.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]);if(l&&!l.startsWith(`-`)&&!u.has(l)&&e(l)){let e=await s(l,r.argv.slice(3));r.exit(e)}i.parse();export{};
@@ -1,3 +1,3 @@
1
- import{C as e,E as t,T as n,t as r,w as i}from"./agents-ntqZ6ph3.mjs";import{r as a}from"./self-Dq9UgWVD.mjs";import o from"picocolors";async function s(){console.log(o.bold(`
1
+ import{D as e,E as t,T as n,t as r,w as i}from"./agents-BqvXaaby.mjs";import{r as a}from"./self-Bt9PJylw.mjs";import o from"picocolors";async function s(){console.log(o.bold(`
2
2
  Quantex CLI Environment Check
3
- `)),console.log(o.bold(`Managed Installers:`));let s=await i();console.log(` Bun: ${s?o.green(`available`):o.red(`not found`)}`);let c=await n();console.log(` npm: ${c?o.green(`available`):o.red(`not found`)}`);let l=await e();console.log(` brew: ${l?o.green(`available`):o.red(`not found`)}`);let u=await t();console.log(` winget:${u?o.green(`available`):o.red(`not found`)}`);let d=await a(),f=d.latestVersion&&d.latestVersion!==d.currentVersion;console.log(`\n${o.bold(`Quantex CLI:`)}`),console.log(` Version: ${d.currentVersion}`),console.log(` Source: ${d.installSource}`),console.log(` Auto-update: ${d.canAutoUpdate?o.green(`supported`):o.yellow(`unsupported`)}`),d.latestVersion&&console.log(` Latest: ${d.latestVersion}${f?o.yellow(` (update available)`):``}`),console.log(`\n${o.bold(`Installed Agents:`)}`);let p=await r(),m=!1;for(let e of p)if(e.inPath){m=!0;let t=e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion;console.log(` ${e.agent.displayName}: ${e.installedVersion??`unknown`} [${e.lifecycle}; ${e.sourceLabel}]${t?o.yellow(` (update available: ${e.latestVersion})`):``}`)}m||console.log(o.dim(` No agents installed`)),console.log(`\n${o.bold(`Issues:`)}`);let h=[];if(!s&&!c&&!l&&!u&&h.push(`No managed installer found. Install bun, npm, brew, or winget.`),h.length===0)console.log(o.green(` No issues found.`));else for(let e of h)console.log(o.yellow(` - ${e}`));console.log()}export{s as doctorCommand};
3
+ `)),console.log(o.bold(`Managed Installers:`));let s=await n();console.log(` Bun: ${s?o.green(`available`):o.red(`not found`)}`);let c=await t();console.log(` npm: ${c?o.green(`available`):o.red(`not found`)}`);let l=await i();console.log(` brew: ${l?o.green(`available`):o.red(`not found`)}`);let u=await e();console.log(` winget:${u?o.green(`available`):o.red(`not found`)}`);let d=await a(),f=d.latestVersion&&d.latestVersion!==d.currentVersion;console.log(`\n${o.bold(`Quantex CLI:`)}`),console.log(` Version: ${d.currentVersion}`),console.log(` Source: ${d.installSource}`),console.log(` Auto-update: ${d.canAutoUpdate?o.green(`supported`):o.yellow(`unsupported`)}`),d.latestVersion&&console.log(` Latest: ${d.latestVersion}${f?o.yellow(` (update available)`):``}`),console.log(`\n${o.bold(`Installed Agents:`)}`);let p=await r(),m=!1;for(let e of p)if(e.inPath){m=!0;let t=e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion;console.log(` ${e.agent.displayName}: ${e.installedVersion??`unknown`} [${e.lifecycle}; ${e.sourceLabel}]${t?o.yellow(` (update available: ${e.latestVersion})`):``}`)}m||console.log(o.dim(` No agents installed`)),console.log(`\n${o.bold(`Issues:`)}`);let h=[];if(!s&&!c&&!l&&!u&&h.push(`No managed installer found. Install bun, npm, brew, or winget.`),h.length===0)console.log(o.green(` No issues found.`));else for(let e of h)console.log(o.yellow(` - ${e}`));console.log()}export{s as doctorCommand};
package/dist/index.d.mts CHANGED
@@ -24,6 +24,9 @@ type InstallMethod = ManagedInstallMethod | ScriptInstallMethod | BinaryInstallM
24
24
  interface AgentPackageMetadata {
25
25
  npm?: string;
26
26
  }
27
+ interface AgentSelfUpdate {
28
+ commands: string[];
29
+ }
27
30
  interface AgentDefinition {
28
31
  name: string;
29
32
  lookupAliases?: string[];
@@ -33,6 +36,7 @@ interface AgentDefinition {
33
36
  packages?: AgentPackageMetadata;
34
37
  platforms: Partial<Record<Platform, InstallMethod[]>>;
35
38
  binaryName: string;
39
+ update?: AgentSelfUpdate;
36
40
  }
37
41
  //#endregion
38
42
  //#region src/agents/definitions/claude.d.ts
@@ -164,6 +168,7 @@ interface UpdatePlan {
164
168
  entries: UpdatePlanEntry[];
165
169
  grouped: Record<ManagedInstallType, UpdatePlanEntry[]>;
166
170
  manual: UpdatePlanEntry[];
171
+ skippedManualCheck: AgentInspection[];
167
172
  upToDate: AgentInspection[];
168
173
  }
169
174
  declare function createUpdatePlan(inspections: AgentInspection[]): UpdatePlan;
@@ -212,6 +217,7 @@ interface PlannedAgentUpdates {
212
217
  entries: PendingAgentUpdate[];
213
218
  grouped: ManagedUpdateBucket[];
214
219
  manual: PendingAgentUpdate[];
220
+ skippedManualCheck: AgentInspection[];
215
221
  upToDate: AgentInspection[];
216
222
  }
217
223
  interface SingleAgentUpdateStatus {
@@ -239,4 +245,4 @@ declare function getInstalledVersion(binaryName: string): Promise<string | undef
239
245
  declare function getLatestVersion(packageName: string): Promise<string | undefined>;
240
246
  declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
241
247
  //#endregion
242
- export { type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type BinaryInstallMethod, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createUpdatePlan, cursor, detectSelfInstallSource, droid, execCommand, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getOrderedInstallMethods, getPlatform, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, opencode, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, saveConfig, saveState, setInstalledAgentState, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf };
248
+ export { type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type AgentSelfUpdate, type BinaryInstallMethod, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createUpdatePlan, cursor, detectSelfInstallSource, droid, execCommand, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getOrderedInstallMethods, getPlatform, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, opencode, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, saveConfig, saveState, setInstalledAgentState, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{A as e,B as t,D as n,F as r,H as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,U as m,V as h,_ as g,a as _,b as v,c as y,d as b,g as x,h as S,i as C,j as w,k as T,l as E,n as D,o as O,r as k,s as A,t as j,u as M,v as N,w as P,x as F,y as I,z as L}from"./agents-ntqZ6ph3.mjs";import{a as R,i as z,n as B,t as V}from"./config-B8_x29hh.mjs";import{n as H,r as U,t as W}from"./version-lXJ5L5kT.mjs";import{i as G,n as K,r as q,t as J}from"./update-BFFLxqvm.mjs";import{i as Y,n as X,r as Z,t as Q}from"./self-Dq9UgWVD.mjs";async function $(e,t){try{let n=Bun.spawn([e,...t],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,{success:n.exitCode===0,exitCode:n.exitCode??1}}catch{return{success:!1,exitCode:1}}}export{Q as canAutoUpdateSelf,S as canLookupLatestVersionForInstallType,x as canUninstallInstallType,g as canUpdateInstallType,m as claude,i as codex,h as copilot,q as createUpdatePlan,t as cursor,X as detectSelfInstallSource,L as droid,$ as execCommand,d as gemini,c as getAgentByLookupName,u as getAgentByNameOrAlias,r as getAllAgents,W as getBinaryPath,V as getConfigDir,B as getConfigFilePath,N as getInstallLifecycle,n as getInstalledAgentState,H as getInstalledVersion,I as getInstallerCapabilities,U as getLatestVersion,b as getManagedInstaller,O as getOrderedInstallMethods,F as getPlatform,J as getSingleAgentUpdateStatus,l as getStateFilePath,C as inspectAgent,_ as inspectAllAgents,j as inspectRegisteredAgents,Z as inspectSelf,A as installAgent,f as isBinaryInPath,P as isBunAvailable,G as isInspectionUpdateAvailable,v as isManagedInstallType,p as isNpmAvailable,z as loadConfig,T as loadState,o as opencode,a as pi,K as planAgentUpdates,e as removeInstalledAgentState,D as resolveAgent,k as resolveAgentInspection,R as saveConfig,w as saveState,s as setInstalledAgentState,y as uninstallAgent,E as updateAgent,M as updateAgentsByType,Y as upgradeSelf};
1
+ import{A as e,B as t,C as n,E as r,F as i,H as a,I as o,L as s,M as c,N as l,O as u,P as d,R as f,S as p,T as m,U as h,V as g,W as _,_ as v,a as y,b,c as x,d as S,g as C,i as w,j as T,k as E,l as D,n as O,o as k,r as A,s as j,t as M,u as N,v as P,x as F,y as I,z as L}from"./agents-BqvXaaby.mjs";import{a as R,i as z,n as B,t as V}from"./config-B8_x29hh.mjs";import{n as H,r as U,t as W}from"./version-D1hlVnnS.mjs";import{i as G,n as K,r as q,t as J}from"./update-1metr7-9.mjs";import{i as Y,n as X,r as Z,t as Q}from"./self-Bt9PJylw.mjs";async function $(e,t){try{let n=Bun.spawn([e,...t],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,{success:n.exitCode===0,exitCode:n.exitCode??1}}catch{return{success:!1,exitCode:1}}}export{Q as canAutoUpdateSelf,C as canLookupLatestVersionForInstallType,v as canUninstallInstallType,P as canUpdateInstallType,_ as claude,h as codex,a as copilot,q as createUpdatePlan,g as cursor,X as detectSelfInstallSource,t as droid,$ as execCommand,L as gemini,d as getAgentByLookupName,i as getAgentByNameOrAlias,o as getAllAgents,W as getBinaryPath,V as getConfigDir,B as getConfigFilePath,I as getInstallLifecycle,u as getInstalledAgentState,H as getInstalledVersion,b as getInstallerCapabilities,U as getLatestVersion,S as getManagedInstaller,k as getOrderedInstallMethods,p as getPlatform,J as getSingleAgentUpdateStatus,E as getStateFilePath,w as inspectAgent,y as inspectAllAgents,M as inspectRegisteredAgents,Z as inspectSelf,j as installAgent,n as isBinaryInPath,m as isBunAvailable,G as isInspectionUpdateAvailable,F as isManagedInstallType,r as isNpmAvailable,z as loadConfig,e as loadState,f as opencode,s as pi,K as planAgentUpdates,T as removeInstalledAgentState,O as resolveAgent,A as resolveAgentInspection,R as saveConfig,c as saveState,l as setInstalledAgentState,x as uninstallAgent,D as updateAgent,N as updateAgentsByType,Y as upgradeSelf};
@@ -1,2 +1,2 @@
1
- import{m as e,p as t,r as n}from"./agents-ntqZ6ph3.mjs";import r from"picocolors";async function i(i){let a=await n(i);if(!a){console.log(r.red(`Unknown agent: ${i}`));return}let{agent:o,inspection:s}=a;console.log(r.bold(`\n${o.displayName}\n`)),console.log(` Name: ${o.name}`),console.log(` Aliases: ${o.lookupAliases?.join(`, `)??`-`}`),console.log(` Description: ${o.description}`),console.log(` Package: ${o.packages?.npm??`-`}`),console.log(` Binary: ${o.binaryName}`),console.log(` Installed: ${s.inPath?r.green(`Yes`):r.red(`No`)}`),s.inPath&&console.log(` Source: ${s.sourceLabel}`),s.installedState&&console.log(` Lifecycle: ${s.lifecycle}`),s.installedVersion&&console.log(` Version: ${s.installedVersion}`),s.latestVersion&&console.log(` Latest: ${s.latestVersion}`),s.binaryPath&&console.log(` Path: ${s.binaryPath}`),console.log(r.bold(`
1
+ import{h as e,m as t,r as n}from"./agents-BqvXaaby.mjs";import r from"picocolors";async function i(i){let a=await n(i);if(!a){console.log(r.red(`Unknown agent: ${i}`));return}let{agent:o,inspection:s}=a;console.log(r.bold(`\n${o.displayName}\n`)),console.log(` Name: ${o.name}`),console.log(` Aliases: ${o.lookupAliases?.join(`, `)??`-`}`),console.log(` Description: ${o.description}`),console.log(` Package: ${o.packages?.npm??`-`}`),console.log(` Binary: ${o.binaryName}`),console.log(` Update: ${o.update?.commands.join(` || `)??`-`}`),console.log(` Installed: ${s.inPath?r.green(`Yes`):r.red(`No`)}`),s.inPath&&console.log(` Source: ${s.sourceLabel}`),s.installedState&&console.log(` Lifecycle: ${s.lifecycle}`),s.installedVersion&&console.log(` Version: ${s.installedVersion}`),s.latestVersion&&console.log(` Latest: ${s.latestVersion}`),s.binaryPath&&console.log(` Path: ${s.binaryPath}`),console.log(r.bold(`
2
2
  Install Methods:`));for(let n of s.methods)console.log(` ${r.green(`+`)} [${e(n)}] ${t(o,n)}`);console.log()}export{i as infoCommand};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./agents-ntqZ6ph3.mjs";import n from"picocolors";async function r(r){let i=await e(r);if(!i){console.log(n.red(`Unknown agent: ${r}`));return}let{agent:a,inspection:o}=i;if(o.inPath){console.log(n.yellow(`${a.displayName} is already installed.`));return}console.log(n.cyan(`Installing ${a.displayName}...`)),(await t(a)).success?console.log(n.green(`${a.displayName} installed successfully!`)):console.log(n.red(`Failed to install ${a.displayName}.`))}export{r as installCommand};
1
+ import{r as e,s as t}from"./agents-BqvXaaby.mjs";import n from"picocolors";async function r(r){let i=await e(r);if(!i){console.log(n.red(`Unknown agent: ${r}`));return}let{agent:a,inspection:o}=i;if(o.inPath){console.log(n.yellow(`${a.displayName} is already installed.`));return}console.log(n.cyan(`Installing ${a.displayName}...`)),(await t(a)).success?console.log(n.green(`${a.displayName} installed successfully!`)):console.log(n.red(`Failed to install ${a.displayName}.`))}export{r as installCommand};
@@ -1,3 +1,3 @@
1
- import{t as e}from"./agents-ntqZ6ph3.mjs";import t from"picocolors";async function n(){let n=await e();console.log(t.bold(`
1
+ import{t as e}from"./agents-BqvXaaby.mjs";import t from"picocolors";async function n(){let n=await e();console.log(t.bold(`
2
2
  AI Agents:
3
3
  `));for(let e of n){let n=e.agent.displayName.padEnd(18),r=e.inPath?t.green(`installed`):t.gray(`not installed`),i=e.inPath?t.dim(e.installedVersion??`unknown version`):``,a=e.inPath?t.cyan(e.updateLabel):``,o=e.inPath?t.dim(e.sourceLabel):``;console.log(` ${n} ${r} ${i}${a?` ${a}`:``}${o?` ${o}`:``}`)}console.log()}export{n as listCommand};
@@ -1 +1 @@
1
- import{o as e,r as t,u as n}from"./version-lXJ5L5kT.mjs";import{dirname as r}from"node:path";import{fileURLToPath as i}from"node:url";const a=`quantex-cli`,o=`/node_modules/${a}`;async function s(){let e=f(),n=await d(),r=await t(a),i=u(e);return{canAutoUpdate:l(i),currentVersion:n,installSource:i,latestVersion:r,packageRoot:e,recommendedUpgradeCommand:l(i)?`quantex upgrade`:void 0}}async function c(t){let r=t??await s();return r.installSource===`bun`?{installSource:r.installSource,success:await n(a)}:r.installSource===`npm`?{installSource:r.installSource,success:await e(a)}:{installSource:r.installSource,success:!1}}function l(e){return e===`bun`||e===`npm`}function u(e){let t=p(e);return t.includes(`/.bun/install/global/`)?`bun`:t.includes(o)?`npm`:t?`source`:`unknown`}async function d(){return(await Bun.file(new URL(`../../package.json`,import.meta.url)).json()).version??`0.0.0`}function f(){return r(i(new URL(`../../package.json`,import.meta.url)))}function p(e){return e.replaceAll(`\\`,`/`).toLowerCase()}export{c as i,u as n,s as r,l as t};
1
+ import{o as e,r as t,u as n}from"./version-D1hlVnnS.mjs";import{dirname as r}from"node:path";import{fileURLToPath as i}from"node:url";const a=`quantex-cli`,o=`/node_modules/${a}`;async function s(){let e=f(),n=await d(),r=await t(a),i=u(e);return{canAutoUpdate:l(i),currentVersion:n,installSource:i,latestVersion:r,packageRoot:e,recommendedUpgradeCommand:l(i)?`quantex upgrade`:void 0}}async function c(t){let r=t??await s();return r.installSource===`bun`?{installSource:r.installSource,success:await n(a)}:r.installSource===`npm`?{installSource:r.installSource,success:await e(a)}:{installSource:r.installSource,success:!1}}function l(e){return e===`bun`||e===`npm`}function u(e){let t=p(e);return t.includes(`/.bun/install/global/`)?`bun`:t.includes(o)?`npm`:t?`source`:`unknown`}async function d(){return(await Bun.file(new URL(`../../package.json`,import.meta.url)).json()).version??`0.0.0`}function f(){return r(i(new URL(`../../package.json`,import.meta.url)))}function p(e){return e.replaceAll(`\\`,`/`).toLowerCase()}export{c as i,u as n,s as r,l as t};
@@ -1 +1 @@
1
- import{c as e,n as t}from"./agents-ntqZ6ph3.mjs";import n from"picocolors";async function r(r){let i=t(r);if(!i){console.log(n.red(`Unknown agent: ${r}`));return}console.log(n.cyan(`Uninstalling ${i.displayName}...`)),await e(i)?console.log(n.green(`${i.displayName} uninstalled successfully!`)):console.log(n.red(`Failed to uninstall ${i.displayName}.`))}export{r as uninstallCommand};
1
+ import{c as e,n as t}from"./agents-BqvXaaby.mjs";import n from"picocolors";async function r(r){let i=t(r);if(!i){console.log(n.red(`Unknown agent: ${r}`));return}console.log(n.cyan(`Uninstalling ${i.displayName}...`)),await e(i)?console.log(n.green(`${i.displayName} uninstalled successfully!`)):console.log(n.red(`Failed to uninstall ${i.displayName}.`))}export{r as uninstallCommand};
@@ -0,0 +1 @@
1
+ import{f as e,i as t,p as n,t as r,x as i}from"./agents-BqvXaaby.mjs";function a(e){let t={bun:[],npm:[],brew:[],winget:[]},n=[],r=[],i=[];for(let a of e){if(!a.inPath)continue;if(s(a)){r.push(a);continue}if(!o(a)){i.push(a);continue}let e=c(a);if(e){let n={inspection:a,installerType:e,strategy:`grouped`};t[e].push(n);continue}n.push({inspection:a,strategy:`manual`})}return{entries:[...t.bun,...t.npm,...t.brew,...t.winget,...n],grouped:t,manual:n,skippedManualCheck:r,upToDate:i}}function o(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function s(t){return!t.latestVersion&&!e(t.agent,t.installedState)}function c(e){if(!(!e.installedState||!e.installedState.packageName)&&n(e.installedState)&&i(e.installedState.installType))return e.installedState.installType}const l=[`bun`,`npm`,`brew`,`winget`];async function u(e){let n=await t(e);return{agent:e,inspection:n,updateAvailable:o(n)}}async function d(){let e=a(await r()),t=l.map(t=>f(t,e.grouped[t])).filter(e=>e!==void 0);return{entries:e.entries.map(e=>p(e.inspection)),grouped:t,manual:e.manual.map(e=>p(e.inspection)),skippedManualCheck:e.skippedManualCheck,upToDate:e.upToDate}}function f(e,t){if(t.length===0)return;let n=t.map(e=>p(e.inspection));return{type:e,packages:n.flatMap(e=>e.state?.packageName?[{packageName:e.state.packageName,packageTargetKind:e.state.packageTargetKind}]:[]),updates:n}}function p(e){return{agent:e.agent,inspection:e,state:e.installedState}}export{o as i,d as n,a as r,u as t};
@@ -0,0 +1 @@
1
+ import{f as e,l as t,n,u as r,v as i}from"./agents-BqvXaaby.mjs";import{n as a,t as o}from"./update-1metr7-9.mjs";import s from"picocolors";async function c(e,t){if(t){await l();return}if(!e){console.log(s.red(`Please specify an agent name or use --all flag`));return}let r=n(e);if(!r){console.log(s.red(`Unknown agent: ${e}`));return}await d(r)}async function l(){let e=await a();for(let t of e.upToDate)console.log(s.green(`${t.agent.displayName} is up to date (${t.installedVersion??`unknown`})`));for(let t of e.skippedManualCheck)console.log(s.yellow(`${t.agent.displayName} uses a manually managed install source. Please check for updates manually.`));for(let t of e.entries){let e=t.inspection;console.log(s.cyan(`Updating ${e.agent.displayName}...${p(e.installedVersion,e.latestVersion)}`))}for(let t of e.grouped)await u(t.type,t.packages,t.updates);for(let t of e.manual)await f(t.agent,t.state,t.inspection.methods,!1)}async function u(e,t,n){if(n.length!==0){if(await r(e,t)){for(let{agent:e}of n)console.log(s.green(`${e.displayName} updated successfully!`));return}for(let{agent:e,state:t}of n)await f(e,t,void 0,!1)}}async function d(e){let{inspection:t,updateAvailable:n}=await o(e);if(!t.inPath){console.log(s.red(`${e.displayName} is not installed.`));return}if(!n){console.log(s.green(`${e.displayName} is up to date (${t.installedVersion??`unknown`})`));return}console.log(s.cyan(`Updating ${e.displayName}...${p(t.installedVersion,t.latestVersion)}`)),await f(e,t.installedState,t.methods,!1)}async function f(n,r,a,c=!0){if(c){let{inspection:e}=await o(n);console.log(s.cyan(`Updating ${n.displayName}...${p(e.installedVersion,e.latestVersion)}`)),a=e.methods}if(!e(n,r)&&!a?.some(e=>i(e.type))){console.log(s.yellow(`${n.displayName} uses an unmanaged install source and cannot be updated automatically.`));return}(await t(n,r)).success?console.log(s.green(`${n.displayName} updated successfully!`)):console.log(s.red(`Failed to update ${n.displayName}.`))}function p(e,t){return e?` (${e} -> ${t??`latest`})`:``}export{c as updateCommand};
@@ -1 +1 @@
1
- import{i as e,r as t}from"./self-Dq9UgWVD.mjs";import n from"picocolors";async function r(){let r=await t();if(r.latestVersion&&r.latestVersion===r.currentVersion){console.log(n.green(`Quantex CLI is already up to date (${r.currentVersion}).`));return}if(!r.canAutoUpdate){console.log(n.yellow(`Quantex CLI cannot auto-update from the current install source: ${r.installSource}.`));return}let i=r.latestVersion?` (${r.currentVersion} -> ${r.latestVersion})`:` (${r.currentVersion})`;console.log(n.cyan(`Upgrading Quantex CLI...${i}`)),(await e(r)).success?console.log(n.green(`Quantex CLI upgraded successfully.`)):console.log(n.red(`Failed to upgrade Quantex CLI.`))}export{r as upgradeCommand};
1
+ import{i as e,r as t}from"./self-Bt9PJylw.mjs";import n from"picocolors";async function r(){let r=await t();if(r.latestVersion&&r.latestVersion===r.currentVersion){console.log(n.green(`Quantex CLI is already up to date (${r.currentVersion}).`));return}if(!r.canAutoUpdate){console.log(n.yellow(`Quantex CLI cannot auto-update from the current install source: ${r.installSource}.`));return}let i=r.latestVersion?` (${r.currentVersion} -> ${r.latestVersion})`:` (${r.currentVersion})`;console.log(n.cyan(`Upgrading Quantex CLI...${i}`)),(await e(r)).success?console.log(n.green(`Quantex CLI upgraded successfully.`)):console.log(n.red(`Failed to upgrade Quantex CLI.`))}export{r as upgradeCommand};
@@ -0,0 +1,4 @@
1
+ import e from"node:process";async function t(e){try{return await a([`bun`,`add`,`-g`,e],[e])}catch{return!1}}async function n(e,t=`latest-major`){try{return await a([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],e],[e])}catch{return!1}}async function r(e,t=`latest-major`){if(e.length===0)return!0;try{return await a([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function i(e){try{let t=Bun.spawn([`bun`,`remove`,`-g`,e],{stdio:l()});return await t.exited,t.exitCode===0}catch{return!1}}async function a(e,t){let n=Bun.spawn(e,{stdio:l()});return await n.exited,n.exitCode===0?o(t):!1}async function o(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await s();if(!n)return!0;let r=c(n),i=t.filter(e=>r.has(e));if(i.length===0)return!0;let a=Bun.spawn([`bun`,`pm`,`-g`,`trust`,...i],{stdio:l()});return await a.exited,a.exitCode===0}async function s(){try{let e=Bun.spawn([`bun`,`pm`,`-g`,`untrusted`],{stdio:u()}),t=await new Response(e.stdout).text();return await e.exited,e.exitCode===0?t:void 0}catch{return}}function c(e){let t=new Set;for(let n of e.split(`
2
+ `)){let e=n.match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function l(){return[`inherit`,`inherit`,`inherit`]}function u(){return[`ignore`,`pipe`,`ignore`]}async function d(e){try{let t=Bun.spawn([`npm`,`i`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function f(e,t=`latest-major`){try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@latest`]:[`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function p(e,t=`latest-major`){if(e.length===0)return!0;try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function m(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}const h=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;async function g(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});if(await t.exited,t.exitCode!==0)return;let n=(await new Response(t.stdout).text()).trim().split(`
3
+ `)[0],r=n.match(h);return r?r[1]:n||void 0}catch{return}}async function _(e){try{let t=await fetch(`https://registry.npmjs.org/${e}/latest`);return t.ok?(await t.json()).version:void 0}catch{return}}async function v(t){try{let n=e.platform===`win32`?`where`:`which`,r=Bun.spawn([n,t],{stdout:`pipe`,stderr:`pipe`});return await r.exited,r.exitCode===0?(await new Response(r.stdout).text()).trim().split(`
4
+ `)[0]:void 0}catch{return}}export{m as a,t as c,r as d,d as i,i as l,g as n,f as o,_ as r,p as s,v as t,n as u};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quantex-cli",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.10",
4
+ "version": "0.0.1-beta.11",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "description": "统一的 AI Agent CLI 管理工具,支持安装、更新、卸载、查询、快捷启动主流 AI 编程助手",
7
7
  "author": "Drswith <drswith@outlook.com>",
@@ -1 +0,0 @@
1
- import{i as e,t}from"./config-B8_x29hh.mjs";import{a as n,c as r,d as i,i as a,l as o,n as ee,o as te,r as ne,s as re,t as ie,u as ae}from"./version-lXJ5L5kT.mjs";import{mkdir as oe}from"node:fs/promises";import{join as se}from"node:path";import s from"node:process";function c(e){return{packageName:e,type:`bun`}}function l(e){return{packageName:e,type:`npm`}}function u(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function d(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function f(e){return{command:e,type:`script`}}const p={name:`claude`,displayName:`Claude Code`,description:`Anthropic 官方 AI 编程助手 CLI`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,platforms:{windows:[c(),l(),f(`irm https://claude.ai/install.ps1 | iex`),d(`Anthropic.ClaudeCode`)],macos:[c(),l(),f(`curl -fsSL https://claude.ai/install.sh | bash`),u(`claude-code`,`cask`)],linux:[c(),l(),f(`curl -fsSL https://claude.ai/install.sh | bash`),u(`claude-code`,`cask`)]}},m={name:`codex`,displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,packages:{npm:`@openai/codex`},binaryName:`codex`,platforms:{windows:[c(),l()],macos:[c(),l(),u(`codex`)],linux:[c(),l(),u(`codex`)]}},h={name:`copilot`,displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[d(`GitHub.Copilot`)],macos:[c(),l(),f(`curl -fsSL https://gh.io/copilot-install | bash`),u(`copilot-cli`)],linux:[c(),l(),f(`curl -fsSL https://gh.io/copilot-install | bash`),u(`copilot-cli`)]}},g={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,platforms:{windows:[f(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[f(`curl https://cursor.com/install -fsS | bash`)],linux:[f(`curl https://cursor.com/install -fsS | bash`)]}},_={name:`droid`,displayName:`Droid`,description:`Factory AI 软件工程 Agent CLI`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,platforms:{windows:[c(),l(),f(`irm https://app.factory.ai/cli/windows | iex`)],macos:[c(),l(),f(`curl -fsSL https://app.factory.ai/cli | sh`),u(`droid`,`cask`)],linux:[c(),l(),f(`curl -fsSL https://app.factory.ai/cli | sh`),u(`droid`,`cask`)]}},v={name:`gemini`,displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[c(),l()],macos:[c(),l(),u(`gemini-cli`)],linux:[c(),l(),u(`gemini-cli`)]}},y={name:`opencode`,displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,platforms:{windows:[c(),l()],macos:[c(),l(),f(`curl -fsSL https://opencode.ai/install | bash`),u(`anomalyco/tap/opencode`)],linux:[c(),l(),f(`curl -fsSL https://opencode.ai/install | bash`),u(`anomalyco/tap/opencode`)]}},b={name:`pi`,displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,platforms:{windows:[c(),l()],macos:[c(),l()],linux:[c(),l()]}},x=[p,m,h,g,_,v,y,b];function ce(){return x}function S(e){return x.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function C(e){return S(e)}const le={installedAgents:{}};function w(){return se(t(),`state.json`)}async function T(){try{return{installedAgents:(await Bun.file(w()).json()).installedAgents??{}}}catch{return{...le}}}async function E(e){await oe(t(),{recursive:!0}),await Bun.write(w(),`${JSON.stringify(e,null,2)}\n`)}async function D(e){return(await T()).installedAgents[e]}async function O(e){let t=await T();t.installedAgents[e.agentName]=e,await E(t)}async function k(e){let t=await T();delete t.installedAgents[e],await E(t)}function A(){switch(s.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function j(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0}catch{return!1}}async function M(){return j(`bun`)}async function N(){return j(`npm`)}async function P(){return j(`brew`)}async function F(){return j(`winget`)}async function I(e){try{let t=s.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0}catch{return!1}}const ue={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},npm:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},script:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},winget:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`}};function L(e){return ue[e]}function R(e){return L(e).lifecycle===`managed`}function z(e){return L(e).lifecycle}function B(e){return L(e).canUpdate}function de(e){return L(e).canUninstall}function V(e){return L(e).canLookupLatestVersion}function H(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function U(e,t){return t.packageName||e.packages?.npm||void 0}function W(e){return e?B(e.installType):!1}function fe(e){return!!e&&V(e.installType)}function pe(e){return e.length>0&&e.every(e=>V(e.type))}function me(e){return R(e.type)?`${z(e.type)}/${e.type}${H(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function he(e){return e?R(e.installType)?`managed via ${e.installType}${H(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function ge(e){return W(e)?`managed update`:`manual update`}function _e(e,t){if(t.type===`bun`){let n=U(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=U(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function ve(e,t,n){if(t)return fe(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!pe(n)))return e.packages.npm}async function G(e){let t=A(),n=typeof e==`function`?e(t):e;try{let e;return e=s.platform===`win32`?Bun.spawn([`powershell.exe`,`-Command`,n],{stdio:[`inherit`,`inherit`,`inherit`]}):Bun.spawn([`sh`,`-c`,n],{stdio:[`inherit`,`inherit`,`inherit`]}),await e.exited,e.exitCode===0}catch{return!1}}function ye(e){return e===`cask`?[`--cask`]:[]}async function K(e,t,n){try{let r=Bun.spawn([`brew`,e,...ye(n),t],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function be(e,t){return K(`install`,e,t)}async function q(e,t){return K(`upgrade`,e,t)}async function xe(e){for(let t of e)if(!await q(t.packageName,t.packageTargetKind))return!1;return!0}async function Se(e,t){return K(`uninstall`,e,t)}async function J(e,t){try{let n=Bun.spawn([`winget`,e,`--id`,t,`-e`],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function Ce(e){return J(`install`,e)}async function Y(e){return J(`upgrade`,e)}async function we(e){for(let t of e)if(!await Y(t.packageName))return!1;return!0}async function Te(e){return J(`uninstall`,e)}const Ee={brew:{type:`brew`,isAvailable:async()=>P(),install:async(e,t)=>be(e,t),uninstall:async(e,t)=>Se(e,t),update:async(e,t)=>q(e,t),updateMany:async e=>xe(e)},bun:{type:`bun`,isAvailable:async()=>M(),install:async e=>r(e),uninstall:async e=>o(e),update:async(e,t,n)=>ae(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>i(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},npm:{type:`npm`,isAvailable:async()=>N(),install:async e=>a(e),uninstall:async e=>n(e),update:async(e,t,n)=>te(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>re(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>F(),install:async e=>Ce(e),uninstall:async e=>Te(e),update:async e=>Y(e),updateMany:async e=>we(e.map(e=>({packageName:e.packageName})))}};function X(e){return Ee[e]}async function De(){return(await e()).defaultPackageManager}async function Z(){return{npmBunUpdateStrategy:(await e()).npmBunUpdateStrategy}}async function Q(e){let t=A(),n=e.platforms[t];if(!n)return[];let r=await De();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function Oe(e,t,n,r,i){let a=X(e);return await a.isAvailable()?r===`install`?a.install(t,n):r===`update`?a.update(t,n,{npmBunUpdateStrategy:i}):a.uninstall(t,n):!1}async function ke(e,t,n,r){if(R(t.type)){let i=U(e,t);return i?Oe(t.type,i,t.packageTargetKind,n,r):!1}return n===`update`&&!B(t.type)||!t.command?!1:G(t.command)}async function Ae(e,t,n){return R(e.installType)?e.packageName?Oe(e.installType,e.packageName,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:G(e.command)}async function je(e,t){let n={agentName:e.name,installType:t.type,packageName:U(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await O(n),n}async function Me(e){let t=await Q(e);for(let n of t)if(await ke(e,n,`install`))return{success:!0,installedState:await je(e,n)};return{success:!1}}async function Ne(e,t){let{npmBunUpdateStrategy:n}=await Z();if(t&&await Ae(t,`update`,n))return await O(t),{success:!0,installedState:t};let r=await Q(e);for(let t of r)if(await ke(e,t,`update`,n))return{success:!0,installedState:await je(e,t)};return{success:!1}}async function Pe(e,t){let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=X(e);return await r.isAvailable()?r.updateMany(n,await Z()):!1}async function Fe(e){let t=await D(e.name);if(!t)return!1;let n=await Ae(t,`uninstall`);return n&&await k(e.name),n}async function $(e){let[t,n,r]=await Promise.all([Q(e),D(e.name),I(e.binaryName)]),[i,a,o]=await Promise.all([r?ee(e.binaryName):Promise.resolve(void 0),r?ie(e.binaryName):Promise.resolve(void 0),Le(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,sourceLabel:he(n),updateLabel:ge(n),lifecycle:n?z(n.installType):`unmanaged`}}async function Ie(e){return Promise.all(e.map($))}async function Le(e,t,n){let r=ve(e,t,n);if(r)return ne(r)}function Re(e){return C(e)}async function ze(e){let t=Re(e);if(t)return{agent:t,inspection:await $(t)}}async function Be(){return Ie(ce())}export{k as A,g as B,P as C,D,F as E,ce as F,m as H,b as I,y as L,O as M,S as N,w as O,C as P,v as R,I as S,N as T,p as U,h as V,B as _,Ie as a,R as b,Fe as c,X as d,W as f,de as g,V as h,$ as i,E as j,T as k,Ne as l,me as m,Re as n,Q as o,_e as p,ze as r,Me as s,Be as t,Pe as u,z as v,M as w,A as x,L as y,_ as z};
@@ -1 +0,0 @@
1
- import{b as e,f as t,i as n,t as r}from"./agents-ntqZ6ph3.mjs";function i(e){let t={bun:[],npm:[],brew:[],winget:[]},n=[],r=[];for(let i of e){if(!i.inPath)continue;if(!a(i)){r.push(i);continue}let e=o(i);if(e){let n={inspection:i,installerType:e,strategy:`grouped`};t[e].push(n);continue}n.push({inspection:i,strategy:`manual`})}return{entries:[...t.bun,...t.npm,...t.brew,...t.winget,...n],grouped:t,manual:n,upToDate:r}}function a(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function o(n){if(!(!n.installedState||!n.installedState.packageName)&&t(n.installedState)&&e(n.installedState.installType))return n.installedState.installType}const s=[`bun`,`npm`,`brew`,`winget`];async function c(e){let t=await n(e);return{agent:e,inspection:t,updateAvailable:a(t)}}async function l(){let e=i(await r()),t=s.map(t=>u(t,e.grouped[t])).filter(e=>e!==void 0);return{entries:e.entries.map(e=>d(e.inspection)),grouped:t,manual:e.manual.map(e=>d(e.inspection)),upToDate:e.upToDate}}function u(e,t){if(t.length===0)return;let n=t.map(e=>d(e.inspection));return{type:e,packages:n.flatMap(e=>e.state?.packageName?[{packageName:e.state.packageName,packageTargetKind:e.state.packageTargetKind}]:[]),updates:n}}function d(e){return{agent:e.agent,inspection:e,state:e.installedState}}export{a as i,l as n,i as r,c as t};
@@ -1 +0,0 @@
1
- import{f as e,l as t,n,u as r}from"./agents-ntqZ6ph3.mjs";import{n as i,t as a}from"./update-BFFLxqvm.mjs";import o from"picocolors";async function s(e,t){if(t){await c();return}if(!e){console.log(o.red(`Please specify an agent name or use --all flag`));return}let r=n(e);if(!r){console.log(o.red(`Unknown agent: ${e}`));return}await u(r)}async function c(){let e=await i();for(let t of e.upToDate)console.log(o.green(`${t.agent.displayName} is up to date (${t.installedVersion??`unknown`})`));for(let t of e.entries){let e=t.inspection;console.log(o.cyan(`Updating ${e.agent.displayName}...${f(e.installedVersion,e.latestVersion)}`))}for(let t of e.grouped)await l(t.type,t.packages,t.updates);for(let t of e.manual)await d(t.agent,t.state,!1)}async function l(e,t,n){if(n.length!==0){if(await r(e,t)){for(let{agent:e}of n)console.log(o.green(`${e.displayName} updated successfully!`));return}for(let{agent:e,state:t}of n)await d(e,t,!1)}}async function u(e){let{inspection:t,updateAvailable:n}=await a(e);if(!t.inPath){console.log(o.red(`${e.displayName} is not installed.`));return}if(!n){console.log(o.green(`${e.displayName} is up to date (${t.installedVersion??`unknown`})`));return}console.log(o.cyan(`Updating ${e.displayName}...${f(t.installedVersion,t.latestVersion)}`)),await d(e,t.installedState,!1)}async function d(n,r,i=!0){if(i){let{inspection:e}=await a(n);console.log(o.cyan(`Updating ${n.displayName}...${f(e.installedVersion,e.latestVersion)}`))}if(r&&!e(r)){console.log(o.yellow(`${n.displayName} uses an unmanaged install source and cannot be updated automatically.`));return}(await t(n,r)).success?console.log(o.green(`${n.displayName} updated successfully!`)):console.log(o.red(`Failed to update ${n.displayName}.`))}function f(e,t){return e?` (${e} -> ${t??`latest`})`:``}export{s as updateCommand};
@@ -1,3 +0,0 @@
1
- import e from"node:process";async function t(e){try{let t=Bun.spawn([`bun`,`add`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function n(e,t=`latest-major`){try{let n=Bun.spawn([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function r(e,t=`latest-major`){if(e.length===0)return!0;try{let n=Bun.spawn([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function i(e){try{let t=Bun.spawn([`bun`,`remove`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function a(e){try{let t=Bun.spawn([`npm`,`i`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function o(e,t=`latest-major`){try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@latest`]:[`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function s(e,t=`latest-major`){if(e.length===0)return!0;try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function c(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}const l=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;async function u(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});if(await t.exited,t.exitCode!==0)return;let n=(await new Response(t.stdout).text()).trim().split(`
2
- `)[0],r=n.match(l);return r?r[1]:n||void 0}catch{return}}async function d(e){try{let t=await fetch(`https://registry.npmjs.org/${e}/latest`);return t.ok?(await t.json()).version:void 0}catch{return}}async function f(t){try{let n=e.platform===`win32`?`where`:`which`,r=Bun.spawn([n,t],{stdout:`pipe`,stderr:`pipe`});return await r.exited,r.exitCode===0?(await new Response(r.stdout).text()).trim().split(`
3
- `)[0]:void 0}catch{return}}export{c as a,t as c,r as d,a as i,i as l,u as n,o,d as r,s,f as t,n as u};