quantex-cli 0.0.1-beta.6 → 0.0.1-beta.9

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
@@ -56,6 +56,29 @@ quantex u claude
56
56
  quantex update --all
57
57
  ```
58
58
 
59
+ `quantex update --all` 会优先使用 Quantex 记录的安装来源进行批量更新:
60
+
61
+ - 通过 Bun 安装的 agent 会合并为一条 `bun update -g --latest ...`
62
+ - 通过 npm 安装的 agent 会合并为一条 `npm install -g ...@latest`
63
+ - 通过 Homebrew 安装的 agent 会按记录的 formula/cask 标识逐个更新
64
+ - 通过 winget 安装的 agent 会按 `winget` 记录的包 ID 逐个更新
65
+ - 通过脚本、直装二进制或仅在 PATH 中探测到的 agent 不会被自动更新
66
+
67
+ 这意味着混合安装场景仍然安全,不会把通过其他方式安装的 agent 错误地塞进 Bun、npm、brew 或 winget 的更新命令;对非托管来源,Quantex 会明确提示需要手动更新。
68
+
69
+ ### 升级 Quantex CLI
70
+
71
+ ```bash
72
+ quantex upgrade
73
+ ```
74
+
75
+ 当前自身升级支持:
76
+
77
+ - 通过 Bun 全局安装的 `quantex-cli`
78
+ - 通过 npm 全局安装的 `quantex-cli`
79
+
80
+ 如果当前是源码工作区运行或其他非托管来源,`upgrade` 会明确提示当前来源不支持自动升级。
81
+
59
82
  ### 卸载 Agent
60
83
 
61
84
  ```bash
@@ -70,12 +93,27 @@ quantex list
70
93
  quantex ls
71
94
  ```
72
95
 
96
+ `list` 会显示每个 agent 的安装状态、当前版本、是否支持托管更新,以及安装来源。例如:
97
+
98
+ - `managed update` 表示 Quantex 能按记录的安装器执行更新
99
+ - `manual update` 表示当前来源不支持自动更新
100
+ - `managed via bun (...)`、`managed via brew (...)` 表示有明确的来源记录
101
+ - `detected in PATH` 表示命令存在,但不是由当前 Quantex 状态文件追踪到的安装
102
+
73
103
  ### 查看 Agent 详情
74
104
 
75
105
  ```bash
76
106
  quantex info claude
77
107
  ```
78
108
 
109
+ `info` 会按当前平台列出安装方式,并明确区分:
110
+
111
+ - `managed/<installer>`,例如 `managed/bun`、`managed/brew`
112
+ - `unmanaged/script`,例如 `curl | bash`、`irm | iex`
113
+ - `unmanaged/binary`,保留给未来真正的二进制直装场景
114
+
115
+ 如果 agent 已安装,`info` 还会显示当前记录的 `Source` 和 `Lifecycle`。
116
+
79
117
  ### 快捷启动 Agent
80
118
 
81
119
  ```bash
@@ -100,6 +138,7 @@ quantex config get defaultPackageManager
100
138
 
101
139
  # 设置配置项
102
140
  quantex config set defaultPackageManager npm
141
+ quantex config set npmBunUpdateStrategy respect-semver
103
142
 
104
143
  # 重置为默认配置
105
144
  quantex config reset
@@ -111,16 +150,58 @@ quantex config reset
111
150
  quantex doctor
112
151
  ```
113
152
 
153
+ `doctor` 会检查:
154
+
155
+ - `bun`、`npm`、`brew`、`winget` 这些托管安装器是否可用
156
+ - Quantex CLI 自身的当前版本、安装来源、是否支持自动升级
157
+ - 已安装 agent 的版本状态
158
+ - 已安装 agent 的生命周期和来源,例如 `managed; managed via bun (...)`
159
+ - 当前环境是否缺少任何可用于托管安装/更新的安装器
160
+
114
161
  ## 配置
115
162
 
116
163
  配置文件位于 `~/.quantex/config.json`,支持以下配置项:
117
164
 
118
165
  ```json
119
166
  {
120
- "defaultPackageManager": "bun"
167
+ "defaultPackageManager": "bun",
168
+ "npmBunUpdateStrategy": "latest-major"
121
169
  }
122
170
  ```
123
171
 
172
+ `defaultPackageManager` 会影响托管安装方式的尝试顺序。比如某个 agent 同时支持 Bun 和 npm 时,设置为 `npm` 后,Quantex 会先尝试 npm,再按 agent 定义中的其余安装方式顺序回退。
173
+
174
+ 这里的 `defaultPackageManager` 只影响托管安装器的选择顺序,不影响 `script` / `binary` 这类非托管安装方式。
175
+
176
+ `npmBunUpdateStrategy` 控制通过 npm / Bun 安装的 agent 在更新时的版本策略:
177
+
178
+ - `latest-major`:始终升级到 registry 上的最新版本,默认值
179
+ - `respect-semver`:遵循包管理器已有的 semver 更新语义
180
+
181
+ ## 状态文件
182
+
183
+ 除了配置文件外,Quantex 还会在 `~/.quantex/state.json` 中记录运行时状态,例如 agent 的实际安装来源。
184
+
185
+ 当前安装来源会区分为:
186
+
187
+ - 托管安装器:`bun`、`npm`、`brew`、`winget`
188
+ - 非托管安装:`script`
189
+ - 预留类型:`binary`
190
+
191
+ 这个状态文件主要用于:
192
+
193
+ - 让 `update --all` 先生成更新计划,再按 Bun、npm、brew、winget 分组执行
194
+ - 在混合安装场景下避免误用错误的更新方式
195
+ - 支撑 `list`、`info`、`doctor` 输出安装来源和是否可托管更新
196
+ - 为后续的卸载、诊断和迁移能力保留扩展空间
197
+
198
+ 术语约定:
199
+
200
+ - `packages.npm` 指 agent 对应的 npm 包名
201
+ - 安装方法里的 `packageName` 指安装器专用标识;对 npm/bun 是包名,对 Homebrew 是 formula/cask 标识,对 winget 是 package ID
202
+
203
+ 如果某个 agent 是在旧版本 Quantex 中安装的,或者不是通过 Quantex 安装的,首次更新时可能仍会走逐个更新;一旦 Quantex 成功更新并记录来源,后续 `update --all` 就可以复用批量更新路径。
204
+
124
205
  ## 开发
125
206
 
126
207
  ```bash
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./config-BSaCWMm6.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};
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{a as e,n as t}from"./detect-BJHrcpbU.mjs";import{t as n}from"./package-manager-DmASCUc5.mjs";import r from"node:process";import{program as i}from"commander";import a from"picocolors";import o from"prompts";async function s(r,i){let s=e(r);if(!s)return console.log(a.red(`Unknown agent: ${r}`)),1;if(!await t(s.binaryName)){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))return console.log(a.red(`Failed to install ${s.displayName}.`)),1}try{let e=Bun.spawn([s.binaryName,...i],{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=r.argv[2],l=new Set([`install`,`i`,`update`,`u`,`uninstall`,`rm`,`list`,`ls`,`info`,`config`,`doctor`,`help`,`--help`,`--version`,`-v`]);if(c&&!c.startsWith(`-`)&&!l.has(c)&&e(c)){let e=await s(c,r.argv.slice(3));r.exit(e)}i.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).version(`0.0.0`),i.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-BLn1aiE5.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-DoBRq8gT.mjs`);await n(e,t.all??!1)}),i.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-D29UTIoi.mjs`);await t(e)}),i.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-COKEGeC4.mjs`);await e()}),i.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-C0nvLNok.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-qSZAkW83.mjs`);await r(e,t,n)}),i.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-C3rLMGrs.mjs`);await e()}),i.parse();export{};
2
+ import{P as e,r as t,s as n}from"./agents-XO_wlQaK.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-BRmU_sNO.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-DPMNxmXO.mjs`);await n(e,t.all??!1)}),i.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-C6ppVzAM.mjs`);await t(e)}),i.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-BGWGJspf.mjs`);await e()}),i.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-CLWQ3LOe.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-C2rJ4WWs.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-bouD_a6l.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{};
@@ -0,0 +1 @@
1
+ import{mkdir as e}from"node:fs/promises";import{homedir as t}from"node:os";import{join as n}from"node:path";import{loadConfig as r}from"c12";const i={defaultPackageManager:`bun`,npmBunUpdateStrategy:`latest-major`};function a(){return n(t(),`.quantex`)}function o(){return n(a(),`config.json`)}async function s(){let{config:e}=await r({name:`quantex`,defaults:i,configFile:o()}),t=e;return{...t,defaultPackageManager:t.defaultPackageManager===`npm`?`npm`:`bun`,npmBunUpdateStrategy:t.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`}}function c(e){return e===`latest-major`||e===`respect-semver`}async function l(t){await e(a(),{recursive:!0}),await Bun.write(o(),`${JSON.stringify(t,null,2)}\n`)}export{l as a,s as i,o as n,i as o,c as r,a as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,i as t,o as n,r}from"./config-BSaCWMm6.mjs";import i from"picocolors";async function a(a,o,s){if(!a){let e=await t();console.log(i.bold(`
2
+ Current Configuration:
3
+ `)),console.log(JSON.stringify(e,null,2)),console.log();return}switch(a){case`get`:{if(!o){console.log(i.red(`Please specify a key`));return}let e=(await t())[o];console.log(e===void 0?i.gray(`(not set)`):String(e));break}case`set`:{if(!o||s===void 0){console.log(i.red(`Please specify both key and value`));return}if(o===`defaultPackageManager`&&s!==`bun`&&s!==`npm`){console.log(i.red(`defaultPackageManager must be bun or npm`));return}if(o===`npmBunUpdateStrategy`&&!r(s)){console.log(i.red(`npmBunUpdateStrategy must be latest-major or respect-semver`));return}let n={};try{n=await t()}catch{}n[o]=s,await e(n),console.log(i.green(`Set ${o} = ${s}`));break}case`reset`:await e(n),console.log(i.green(`Configuration reset to defaults.`));break;default:console.log(i.red(`Unknown action: ${a}`)),console.log(`Available actions: get, set, reset`)}}export{a as configCommand};
@@ -0,0 +1,3 @@
1
+ import{C as e,E as t,T as n,t as r,w as i}from"./agents-XO_wlQaK.mjs";import{r as a}from"./self-Dq9UgWVD.mjs";import o from"picocolors";async function s(){console.log(o.bold(`
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};
package/dist/index.d.mts CHANGED
@@ -1,48 +1,227 @@
1
1
  //#region src/agents/types.d.ts
2
2
  type Platform = 'windows' | 'macos' | 'linux';
3
- type InstallType = 'bun' | 'npm' | 'binary';
4
- interface InstallMethod {
5
- type: InstallType;
3
+ type ManagedInstallType = 'bun' | 'npm' | 'brew' | 'winget';
4
+ type InstallType = ManagedInstallType | 'script' | 'binary';
5
+ type PackageTargetKind = 'package' | 'cask' | 'id';
6
+ interface BaseInstallMethod {
7
+ command?: string;
8
+ packageName?: string;
9
+ packageTargetKind?: PackageTargetKind;
10
+ }
11
+ interface ManagedInstallMethod extends BaseInstallMethod {
12
+ command?: never;
13
+ type: ManagedInstallType;
14
+ }
15
+ interface ScriptInstallMethod extends BaseInstallMethod {
6
16
  command: string;
7
- priority: number;
17
+ type: 'script';
18
+ }
19
+ interface BinaryInstallMethod extends BaseInstallMethod {
20
+ command: string;
21
+ type: 'binary';
22
+ }
23
+ type InstallMethod = ManagedInstallMethod | ScriptInstallMethod | BinaryInstallMethod;
24
+ interface AgentPackageMetadata {
25
+ npm?: string;
8
26
  }
9
27
  interface AgentDefinition {
10
28
  name: string;
11
- aliases: string[];
29
+ lookupAliases?: string[];
12
30
  displayName: string;
13
31
  description: string;
14
32
  homepage: string;
15
- package: string;
33
+ packages?: AgentPackageMetadata;
16
34
  platforms: Partial<Record<Platform, InstallMethod[]>>;
17
35
  binaryName: string;
18
36
  }
19
37
  //#endregion
20
- //#region src/agents/claude.d.ts
38
+ //#region src/agents/definitions/claude.d.ts
21
39
  declare const claude: AgentDefinition;
22
40
  //#endregion
23
- //#region src/agents/codex.d.ts
41
+ //#region src/agents/definitions/codex.d.ts
24
42
  declare const codex: AgentDefinition;
25
43
  //#endregion
26
- //#region src/agents/opencode.d.ts
44
+ //#region src/agents/definitions/copilot.d.ts
45
+ declare const copilot: AgentDefinition;
46
+ //#endregion
47
+ //#region src/agents/definitions/cursor.d.ts
48
+ declare const cursor: AgentDefinition;
49
+ //#endregion
50
+ //#region src/agents/definitions/droid.d.ts
51
+ declare const droid: AgentDefinition;
52
+ //#endregion
53
+ //#region src/agents/definitions/gemini.d.ts
54
+ declare const gemini: AgentDefinition;
55
+ //#endregion
56
+ //#region src/agents/definitions/opencode.d.ts
27
57
  declare const opencode: AgentDefinition;
28
58
  //#endregion
59
+ //#region src/agents/definitions/pi.d.ts
60
+ declare const pi: AgentDefinition;
61
+ //#endregion
29
62
  //#region src/agents/index.d.ts
30
63
  declare function getAllAgents(): AgentDefinition[];
64
+ declare function getAgentByLookupName(name: string): AgentDefinition | undefined;
31
65
  declare function getAgentByNameOrAlias(name: string): AgentDefinition | undefined;
32
66
  //#endregion
33
67
  //#region src/config/index.d.ts
68
+ type NpmBunUpdateStrategy = 'latest-major' | 'respect-semver';
34
69
  interface QuantexConfig {
35
70
  defaultPackageManager: 'bun' | 'npm';
71
+ npmBunUpdateStrategy: NpmBunUpdateStrategy;
36
72
  [key: string]: unknown;
37
73
  }
38
74
  declare function getConfigDir(): string;
75
+ declare function getConfigFilePath(): string;
39
76
  declare function loadConfig(): Promise<QuantexConfig>;
77
+ declare function saveConfig(config: Record<string, unknown>): Promise<void>;
78
+ //#endregion
79
+ //#region src/state/index.d.ts
80
+ interface InstalledAgentState {
81
+ agentName: string;
82
+ installType: InstallType;
83
+ packageName?: string;
84
+ packageTargetKind?: PackageTargetKind;
85
+ command?: string;
86
+ }
87
+ interface QuantexState {
88
+ installedAgents: Record<string, InstalledAgentState>;
89
+ }
90
+ declare function getStateFilePath(): string;
91
+ declare function loadState(): Promise<QuantexState>;
92
+ declare function saveState(state: QuantexState): Promise<void>;
93
+ declare function getInstalledAgentState(agentName: string): Promise<InstalledAgentState | undefined>;
94
+ declare function setInstalledAgentState(agentState: InstalledAgentState): Promise<void>;
95
+ declare function removeInstalledAgentState(agentName: string): Promise<void>;
96
+ //#endregion
97
+ //#region src/inspection/agents.d.ts
98
+ interface AgentInspection {
99
+ agent: AgentDefinition;
100
+ methods: InstallMethod[];
101
+ installedState?: InstalledAgentState;
102
+ inPath: boolean;
103
+ installedVersion?: string;
104
+ latestVersion?: string;
105
+ binaryPath?: string;
106
+ sourceLabel: string;
107
+ updateLabel: string;
108
+ lifecycle: 'managed' | 'unmanaged';
109
+ }
110
+ declare function inspectAgent(agent: AgentDefinition): Promise<AgentInspection>;
111
+ declare function inspectAllAgents(agents: AgentDefinition[]): Promise<AgentInspection[]>;
112
+ //#endregion
113
+ //#region src/package-manager/installers.d.ts
114
+ interface ManagedPackageSpec {
115
+ packageName: string;
116
+ packageTargetKind?: PackageTargetKind;
117
+ }
118
+ interface ManagedInstallerUpdateOptions {
119
+ npmBunUpdateStrategy?: NpmBunUpdateStrategy;
120
+ }
121
+ interface ManagedInstaller {
122
+ type: ManagedInstallType;
123
+ isAvailable: () => Promise<boolean>;
124
+ install: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
125
+ uninstall: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
126
+ update: (packageName: string, packageTargetKind?: PackageTargetKind, options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
127
+ updateMany: (packages: ManagedPackageSpec[], options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
128
+ }
129
+ declare function getManagedInstaller(type: ManagedInstallType): ManagedInstaller;
40
130
  //#endregion
41
131
  //#region src/package-manager/index.d.ts
42
- declare function installAgent(agent: AgentDefinition): Promise<boolean>;
43
- declare function updateAgent(agent: AgentDefinition): Promise<boolean>;
132
+ interface AgentOperationResult {
133
+ success: boolean;
134
+ installedState?: InstalledAgentState;
135
+ }
136
+ declare function getOrderedInstallMethods(agent: AgentDefinition): Promise<InstallMethod[]>;
137
+ declare function installAgent(agent: AgentDefinition): Promise<AgentOperationResult>;
138
+ declare function updateAgent(agent: AgentDefinition, preferredState?: InstalledAgentState): Promise<AgentOperationResult>;
139
+ declare function updateAgentsByType(type: ManagedInstallType, packages: ManagedPackageSpec[]): Promise<boolean>;
44
140
  declare function uninstallAgent(agent: AgentDefinition): Promise<boolean>;
45
141
  //#endregion
142
+ //#region src/package-manager/capabilities.d.ts
143
+ interface InstallerCapabilities {
144
+ canInstall: true;
145
+ canLookupLatestVersion: boolean;
146
+ canUninstall: boolean;
147
+ canUpdate: boolean;
148
+ lifecycle: 'managed' | 'unmanaged';
149
+ }
150
+ declare function getInstallerCapabilities(type: InstallType): InstallerCapabilities;
151
+ declare function isManagedInstallType(type: InstallType): type is ManagedInstallType;
152
+ declare function getInstallLifecycle(type: InstallType): 'managed' | 'unmanaged';
153
+ declare function canUpdateInstallType(type: InstallType): boolean;
154
+ declare function canUninstallInstallType(type: InstallType): boolean;
155
+ declare function canLookupLatestVersionForInstallType(type: InstallType): boolean;
156
+ //#endregion
157
+ //#region src/planning/updates.d.ts
158
+ interface UpdatePlanEntry {
159
+ inspection: AgentInspection;
160
+ installerType?: ManagedInstallType;
161
+ strategy: 'grouped' | 'manual';
162
+ }
163
+ interface UpdatePlan {
164
+ entries: UpdatePlanEntry[];
165
+ grouped: Record<ManagedInstallType, UpdatePlanEntry[]>;
166
+ manual: UpdatePlanEntry[];
167
+ upToDate: AgentInspection[];
168
+ }
169
+ declare function createUpdatePlan(inspections: AgentInspection[]): UpdatePlan;
170
+ declare function isInspectionUpdateAvailable(inspection: Pick<AgentInspection, 'installedVersion' | 'latestVersion'>): boolean;
171
+ //#endregion
172
+ //#region src/self/index.d.ts
173
+ type SelfInstallSource = 'bun' | 'npm' | 'source' | 'unknown';
174
+ interface SelfInspection {
175
+ canAutoUpdate: boolean;
176
+ currentVersion: string;
177
+ installSource: SelfInstallSource;
178
+ latestVersion?: string;
179
+ packageRoot: string;
180
+ recommendedUpgradeCommand?: string;
181
+ }
182
+ interface SelfUpdateResult {
183
+ installSource: SelfInstallSource;
184
+ success: boolean;
185
+ }
186
+ declare function inspectSelf(): Promise<SelfInspection>;
187
+ declare function upgradeSelf(inspection?: SelfInspection): Promise<SelfUpdateResult>;
188
+ declare function canAutoUpdateSelf(installSource: SelfInstallSource): boolean;
189
+ declare function detectSelfInstallSource(packageRoot: string): SelfInstallSource;
190
+ //#endregion
191
+ //#region src/services/agents.d.ts
192
+ interface ResolvedAgentInspection {
193
+ agent: AgentDefinition;
194
+ inspection: AgentInspection;
195
+ }
196
+ declare function resolveAgent(agentName: string): AgentDefinition | undefined;
197
+ declare function resolveAgentInspection(agentName: string): Promise<ResolvedAgentInspection | undefined>;
198
+ declare function inspectRegisteredAgents(): Promise<AgentInspection[]>;
199
+ //#endregion
200
+ //#region src/services/update.d.ts
201
+ interface PendingAgentUpdate {
202
+ agent: AgentDefinition;
203
+ inspection: AgentInspection;
204
+ state?: InstalledAgentState;
205
+ }
206
+ interface ManagedUpdateBucket {
207
+ type: ManagedInstallType;
208
+ packages: ManagedPackageSpec[];
209
+ updates: PendingAgentUpdate[];
210
+ }
211
+ interface PlannedAgentUpdates {
212
+ entries: PendingAgentUpdate[];
213
+ grouped: ManagedUpdateBucket[];
214
+ manual: PendingAgentUpdate[];
215
+ upToDate: AgentInspection[];
216
+ }
217
+ interface SingleAgentUpdateStatus {
218
+ agent: AgentDefinition;
219
+ inspection: AgentInspection;
220
+ updateAvailable: boolean;
221
+ }
222
+ declare function getSingleAgentUpdateStatus(agent: AgentDefinition): Promise<SingleAgentUpdateStatus>;
223
+ declare function planAgentUpdates(): Promise<PlannedAgentUpdates>;
224
+ //#endregion
46
225
  //#region src/utils/detect.d.ts
47
226
  declare function getPlatform(): Platform;
48
227
  declare function isBunAvailable(): Promise<boolean>;
@@ -60,4 +239,4 @@ declare function getInstalledVersion(binaryName: string): Promise<string | undef
60
239
  declare function getLatestVersion(packageName: string): Promise<string | undefined>;
61
240
  declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
62
241
  //#endregion
63
- export { type AgentDefinition, type InstallMethod, type Platform, type QuantexConfig, claude, codex, execCommand, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getInstalledVersion, getLatestVersion, getPlatform, installAgent, isBinaryInPath, isBunAvailable, isNpmAvailable, loadConfig, opencode, uninstallAgent, updateAgent };
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 };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./detect-BJHrcpbU.mjs";import{n as l,t as u}from"./config-DthGTKaK.mjs";import{n as d,r as f,t as p}from"./package-manager-DmASCUc5.mjs";import{n as m,r as h,t as g}from"./version-G_0-W0JG.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{r as claude,t as codex,_ as execCommand,e as getAgentByNameOrAlias,a as getAllAgents,g as getBinaryPath,u as getConfigDir,m as getInstalledVersion,h as getLatestVersion,c as getPlatform,p as installAgent,i as isBinaryInPath,o as isBunAvailable,n as isNpmAvailable,l as loadConfig,s as opencode,d as uninstallAgent,f as updateAgent};
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-XO_wlQaK.mjs";import{a as R,i as z,n as B,t as V}from"./config-BSaCWMm6.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-Bp7c7qR8.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};
@@ -0,0 +1,2 @@
1
+ import{m as e,p as t,r as n}from"./agents-XO_wlQaK.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(`
2
+ Install Methods:`));for(let n of s.methods)console.log(` ${r.green(`+`)} [${e(n)}] ${t(o,n)}`);console.log()}export{i as infoCommand};
@@ -0,0 +1 @@
1
+ import{r as e,s as t}from"./agents-XO_wlQaK.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};
@@ -0,0 +1,3 @@
1
+ import{t as e}from"./agents-XO_wlQaK.mjs";import t from"picocolors";async function n(){let n=await e();console.log(t.bold(`
2
+ AI Agents:
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};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ import{c as e,n as t}from"./agents-XO_wlQaK.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{b as e,f as t,i as n,t as r}from"./agents-XO_wlQaK.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};
@@ -0,0 +1 @@
1
+ import{f as e,l as t,n,u as r}from"./agents-XO_wlQaK.mjs";import{n as i,t as a}from"./update-Bp7c7qR8.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};
@@ -0,0 +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};
@@ -0,0 +1,3 @@
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};
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.6",
4
+ "version": "0.0.1-beta.9",
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{homedir as e}from"node:os";import{join as t}from"node:path";import{loadConfig as n}from"c12";const r={defaultPackageManager:`bun`};function i(){return t(e(),`.quantex`)}async function a(){let{config:e}=await n({name:`quantex`,defaults:r,configFile:t(i(),`config.json`)});return e}export{a as n,r,i as t};
@@ -1,3 +0,0 @@
1
- import{n as e,r as t,t as n}from"./config-DthGTKaK.mjs";import{join as r}from"node:path";import i from"picocolors";async function a(a,o,s){if(!a){let t=await e();console.log(i.bold(`
2
- Current Configuration:
3
- `)),console.log(JSON.stringify(t,null,2)),console.log();return}switch(a){case`get`:{if(!o){console.log(i.red(`Please specify a key`));return}let t=(await e())[o];console.log(t===void 0?i.gray(`(not set)`):String(t));break}case`set`:{if(!o||s===void 0){console.log(i.red(`Please specify both key and value`));return}let e=r(n(),`config.json`),t={};try{t=await Bun.file(e).json()}catch{}t[o]=s,await Bun.write(e,JSON.stringify(t,null,2)),console.log(i.green(`Set ${o} = ${s}`));break}case`reset`:{let e=r(n(),`config.json`);await Bun.write(e,JSON.stringify(t,null,2)),console.log(i.green(`Configuration reset to defaults.`));break}default:console.log(i.red(`Unknown action: ${a}`)),console.log(`Available actions: get, set, reset`)}}export{a as configCommand};
@@ -1 +0,0 @@
1
- import e from"node:process";const t={name:`claude`,aliases:[`claude`],displayName:`Claude Code`,description:`Anthropic 官方 AI 编程助手 CLI`,homepage:`https://code.claude.com/docs`,package:`@anthropic-ai/claude-code`,binaryName:`claude`,platforms:{windows:[{type:`bun`,command:`bun add -g @anthropic-ai/claude-code`,priority:1},{type:`npm`,command:`npm i -g @anthropic-ai/claude-code`,priority:2},{type:`binary`,command:`irm https://claude.ai/install.ps1 | iex`,priority:3},{type:`binary`,command:`winget install Anthropic.ClaudeCode`,priority:4}],macos:[{type:`bun`,command:`bun add -g @anthropic-ai/claude-code`,priority:1},{type:`npm`,command:`npm i -g @anthropic-ai/claude-code`,priority:2},{type:`binary`,command:`curl -fsSL https://claude.ai/install.sh | bash`,priority:3},{type:`binary`,command:`brew install --cask claude-code`,priority:4}],linux:[{type:`bun`,command:`bun add -g @anthropic-ai/claude-code`,priority:1},{type:`npm`,command:`npm i -g @anthropic-ai/claude-code`,priority:2},{type:`binary`,command:`curl -fsSL https://claude.ai/install.sh | bash`,priority:3},{type:`binary`,command:`brew install --cask claude-code`,priority:4}]}},n={name:`codex`,aliases:[`codex`],displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,package:`@openai/codex`,binaryName:`codex`,platforms:{windows:[{type:`bun`,command:`bun add -g @openai/codex`,priority:1},{type:`npm`,command:`npm i -g @openai/codex`,priority:2}],macos:[{type:`bun`,command:`bun add -g @openai/codex`,priority:1},{type:`npm`,command:`npm i -g @openai/codex`,priority:2},{type:`binary`,command:`brew install codex`,priority:3}],linux:[{type:`bun`,command:`bun add -g @openai/codex`,priority:1},{type:`npm`,command:`npm i -g @openai/codex`,priority:2},{type:`binary`,command:`brew install codex`,priority:3}]}},r={name:`copilot`,aliases:[`copilot`],displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,package:`@github/copilot`,binaryName:`copilot`,platforms:{windows:[{type:`binary`,command:`winget install GitHub.Copilot`,priority:3}],macos:[{type:`bun`,command:`bun add -g @github/copilot`,priority:1},{type:`npm`,command:`npm i -g @github/copilot`,priority:2},{type:`binary`,command:`curl -fsSL https://gh.io/copilot-install | bash`,priority:3},{type:`binary`,command:`brew install copilot-cli`,priority:4}],linux:[{type:`bun`,command:`bun add -g @github/copilot`,priority:1},{type:`npm`,command:`npm i -g @github/copilot`,priority:2},{type:`binary`,command:`curl -fsSL https://gh.io/copilot-install | bash`,priority:3},{type:`binary`,command:`brew install copilot-cli`,priority:4}]}},i={name:`cursor`,aliases:[`cursor`,`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,package:``,binaryName:`agent`,platforms:{windows:[{type:`binary`,command:`irm 'https://cursor.com/install?win32=true' | iex`,priority:1}],macos:[{type:`binary`,command:`curl https://cursor.com/install -fsS | bash`,priority:1}],linux:[{type:`binary`,command:`curl https://cursor.com/install -fsS | bash`,priority:1}]}},a={name:`droid`,aliases:[`droid`],displayName:`Droid`,description:`Factory AI 软件工程 Agent CLI`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,package:`droid`,binaryName:`droid`,platforms:{windows:[{type:`bun`,command:`bun add -g droid`,priority:1},{type:`npm`,command:`npm i -g droid`,priority:2},{type:`binary`,command:`irm https://app.factory.ai/cli/windows | iex`,priority:3}],macos:[{type:`bun`,command:`bun add -g droid`,priority:1},{type:`npm`,command:`npm i -g droid`,priority:2},{type:`binary`,command:`curl -fsSL https://app.factory.ai/cli | sh`,priority:3},{type:`binary`,command:`brew install --cask droid`,priority:4}],linux:[{type:`bun`,command:`bun add -g droid`,priority:1},{type:`npm`,command:`npm i -g droid`,priority:2},{type:`binary`,command:`curl -fsSL https://app.factory.ai/cli | sh`,priority:3},{type:`binary`,command:`brew install --cask droid`,priority:4}]}},o={name:`gemini`,aliases:[`gemini`],displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,package:`@google/gemini-cli`,binaryName:`gemini`,platforms:{windows:[{type:`bun`,command:`bun add -g @google/gemini-cli`,priority:1},{type:`npm`,command:`npm i -g @google/gemini-cli`,priority:2}],macos:[{type:`bun`,command:`bun add -g @google/gemini-cli`,priority:1},{type:`npm`,command:`npm i -g @google/gemini-cli`,priority:2},{type:`binary`,command:`brew install gemini-cli`,priority:3}],linux:[{type:`bun`,command:`bun add -g @google/gemini-cli`,priority:1},{type:`npm`,command:`npm i -g @google/gemini-cli`,priority:2},{type:`binary`,command:`brew install gemini-cli`,priority:3}]}},s={name:`opencode`,aliases:[`opencode`],displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,package:`opencode-ai`,binaryName:`opencode`,platforms:{windows:[{type:`bun`,command:`bun add -g opencode-ai`,priority:1},{type:`npm`,command:`npm i -g opencode-ai`,priority:2}],macos:[{type:`bun`,command:`bun add -g opencode-ai`,priority:1},{type:`npm`,command:`npm i -g opencode-ai`,priority:2},{type:`binary`,command:`curl -fsSL https://opencode.ai/install | bash`,priority:3},{type:`binary`,command:`brew install anomalyco/tap/opencode`,priority:4}],linux:[{type:`bun`,command:`bun add -g opencode-ai`,priority:1},{type:`npm`,command:`npm i -g opencode-ai`,priority:2},{type:`binary`,command:`curl -fsSL https://opencode.ai/install | bash`,priority:3},{type:`binary`,command:`brew install anomalyco/tap/opencode`,priority:4}]}},c=[t,n,r,i,a,o,s,{name:`pi`,aliases:[`pi`],displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,package:`@mariozechner/pi-coding-agent`,binaryName:`pi`,platforms:{windows:[{type:`bun`,command:`bun add -g @mariozechner/pi-coding-agent`,priority:1},{type:`npm`,command:`npm i -g @mariozechner/pi-coding-agent`,priority:2}],macos:[{type:`bun`,command:`bun add -g @mariozechner/pi-coding-agent`,priority:1},{type:`npm`,command:`npm i -g @mariozechner/pi-coding-agent`,priority:2}],linux:[{type:`bun`,command:`bun add -g @mariozechner/pi-coding-agent`,priority:1},{type:`npm`,command:`npm i -g @mariozechner/pi-coding-agent`,priority:2}]}}];function l(){return c}function u(e){return c.find(t=>t.name===e||t.aliases.includes(e))}function d(){switch(e.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function f(){try{let e=Bun.spawn([`bun`,`--version`],{stdout:`pipe`,stderr:`pipe`});return await e.exited,e.exitCode===0}catch{return!1}}async function p(){try{let e=Bun.spawn([`npm`,`--version`],{stdout:`pipe`,stderr:`pipe`});return await e.exited,e.exitCode===0}catch{return!1}}async function m(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}catch{return!1}}export{u as a,n as c,p as i,t as l,m as n,l as o,f as r,s,d as t};
@@ -1,3 +0,0 @@
1
- import{i as e,n as t,o as n,r}from"./detect-BJHrcpbU.mjs";import{n as i,r as a}from"./version-G_0-W0JG.mjs";import o from"picocolors";async function s(){console.log(o.bold(`
2
- Silver CLI Environment Check
3
- `)),console.log(o.bold(`Package Managers:`));let s=await r();console.log(` Bun: ${s?o.green(`available`):o.red(`not found`)}`);let c=await e();console.log(` npm: ${c?o.green(`available`):o.red(`not found`)}`),console.log(`\n${o.bold(`Installed Agents:`)}`);let l=n(),u=!1;for(let e of l)if(await t(e.binaryName)){u=!0;let t=await i(e.binaryName),n=await a(e.package),r=t&&n&&t!==n;console.log(` ${e.displayName}: ${t??`unknown`}${r?o.yellow(` (update available: ${n})`):``}`)}u||console.log(o.dim(` No agents installed`)),console.log(`\n${o.bold(`Issues:`)}`);let d=[];if(!s&&!c&&d.push(`No package manager found. Install bun or npm.`),d.length===0)console.log(o.green(` No issues found.`));else for(let e of d)console.log(o.yellow(` - ${e}`));console.log()}export{s as doctorCommand};
@@ -1,2 +0,0 @@
1
- import{a as e,n as t,t as n}from"./detect-BJHrcpbU.mjs";import{n as r,r as i,t as a}from"./version-G_0-W0JG.mjs";import o from"picocolors";async function s(s){let c=e(s);if(!c){console.log(o.red(`Unknown agent: ${s}`));return}let l=await t(c.binaryName),u=l?await r(c.binaryName):void 0,d=await i(c.package),f=l?await a(c.binaryName):void 0,p=n();console.log(o.bold(`\n${c.displayName}\n`)),console.log(` Name: ${c.name}`),console.log(` Aliases: ${c.aliases.join(`, `)}`),console.log(` Description: ${c.description}`),console.log(` Package: ${c.package}`),console.log(` Binary: ${c.binaryName}`),console.log(` Installed: ${l?o.green(`Yes`):o.red(`No`)}`),u&&console.log(` Version: ${u}`),d&&console.log(` Latest: ${d}`),f&&console.log(` Path: ${f}`),console.log(o.bold(`
2
- Install Methods:`));let m=c.platforms[p]??[];for(let e of m)console.log(` ${o.green(`+`)} [${e.type}] ${e.command}`);console.log()}export{s as infoCommand};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./detect-BJHrcpbU.mjs";import{t as n}from"./package-manager-DmASCUc5.mjs";import r from"picocolors";async function i(i){let a=e(i);if(!a){console.log(r.red(`Unknown agent: ${i}`));return}if(await t(a.binaryName)){console.log(r.yellow(`${a.displayName} is already installed.`));return}console.log(r.cyan(`Installing ${a.displayName}...`)),await n(a)?console.log(r.green(`${a.displayName} installed successfully!`)):console.log(r.red(`Failed to install ${a.displayName}.`))}export{i as installCommand};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t}from"./detect-BJHrcpbU.mjs";import{n}from"./version-G_0-W0JG.mjs";import r from"picocolors";async function i(){let i=t();console.log(r.bold(`
2
- AI Agents:
3
- `));for(let t of i){let i=await e(t.binaryName),a=i?await n(t.binaryName):void 0,o=t.displayName.padEnd(16),s=i?r.green(`installed`):r.gray(`not installed`),c=a?r.dim(a):``;console.log(` ${o} ${s} ${c}`)}console.log()}export{i as listCommand};
@@ -1 +0,0 @@
1
- import{i as e,r as t,t as n}from"./detect-BJHrcpbU.mjs";import r from"node:process";async function i(e){let t=n(),i=typeof e==`function`?e(t):e;try{let e;return e=r.platform===`win32`?Bun.spawn([`powershell.exe`,`-Command`,i],{stdio:[`inherit`,`inherit`,`inherit`]}):Bun.spawn([`sh`,`-c`,i],{stdio:[`inherit`,`inherit`,`inherit`]}),await e.exited,e.exitCode===0}catch{return!1}}async function a(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 o(e){try{let t=Bun.spawn([`bun`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function s(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 c(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 l(e){try{let t=Bun.spawn([`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function u(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}function d(e){let t=n(),r=e.platforms[t];return r?[...r].sort((e,t)=>e.priority-t.priority):[]}async function f(n){let r=d(n);for(let o of r)if(o.type===`bun`){if(!await t())continue;if(await a(n.package))return!0}else if(o.type===`npm`){if(!await e())continue;if(await c(n.package))return!0}else if(o.type===`binary`&&await i(o.command))return!0;return!1}async function p(n){let r=d(n);for(let a of r)if(a.type===`bun`){if(!await t())continue;if(await o(n.package))return!0}else if(a.type===`npm`){if(!await e())continue;if(await l(n.package))return!0}else if(a.type===`binary`&&await i(a.command))return!0;return!1}async function m(n){let r=!1;if(await t()){let e=await s(n.package);r||=e}if(await e()){let e=await u(n.package);r||=e}return r}export{m as n,p as r,f as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./detect-BJHrcpbU.mjs";import{n as t}from"./package-manager-DmASCUc5.mjs";import n from"picocolors";async function r(r){let i=e(r);if(!i){console.log(n.red(`Unknown agent: ${r}`));return}console.log(n.cyan(`Uninstalling ${i.displayName}...`)),await t(i)?console.log(n.green(`${i.displayName} uninstalled successfully!`)):console.log(n.red(`Failed to uninstall ${i.displayName}.`))}export{r as uninstallCommand};
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n}from"./detect-BJHrcpbU.mjs";import{r}from"./package-manager-DmASCUc5.mjs";import{n as i,r as a}from"./version-G_0-W0JG.mjs";import o from"picocolors";async function s(r,i){if(i){let e=n();for(let n of e)await t(n.binaryName)&&await c(n);return}if(!r){console.log(o.red(`Please specify an agent name or use --all flag`));return}let a=e(r);if(!a){console.log(o.red(`Unknown agent: ${r}`));return}await c(a)}async function c(e){let t=await i(e.binaryName),n=await a(e.package);if(t&&n&&t===n){console.log(o.green(`${e.displayName} is up to date (${t})`));return}let s=t?` (${t} -> ${n??`latest`})`:``;console.log(o.cyan(`Updating ${e.displayName}...${s}`)),await r(e)?console.log(o.green(`${e.displayName} updated successfully!`)):console.log(o.red(`Failed to update ${e.displayName}.`))}export{s as updateCommand};
@@ -1,2 +0,0 @@
1
- import e from"node:process";async function t(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0&&(await new Response(t.stdout).text()).trim()||void 0}catch{return}}async function n(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 r(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(`
2
- `)[0]:void 0}catch{return}}export{t as n,n as r,r as t};