quantex-cli 0.0.1-beta.8 → 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 +24 -3
- package/dist/agents-XO_wlQaK.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/config-BSaCWMm6.mjs +1 -0
- package/dist/config-C2rJ4WWs.mjs +3 -0
- package/dist/doctor-bouD_a6l.mjs +3 -0
- package/dist/index.d.mts +27 -3
- package/dist/index.mjs +1 -1
- package/dist/{info-DeMHOB7s.mjs → info-CLWQ3LOe.mjs} +1 -1
- package/dist/{install-Dq2l4GZ0.mjs → install-BRmU_sNO.mjs} +1 -1
- package/dist/{list-T8JHHWWE.mjs → list-BGWGJspf.mjs} +1 -1
- package/dist/self-Dq9UgWVD.mjs +1 -0
- package/dist/{uninstall-C0tbY6DM.mjs → uninstall-C6ppVzAM.mjs} +1 -1
- package/dist/{update-DIDtiDmr.mjs → update-Bp7c7qR8.mjs} +1 -1
- package/dist/{update-CzN4A4KH.mjs → update-DPMNxmXO.mjs} +1 -1
- package/dist/upgrade-VvcM4YUp.mjs +1 -0
- package/dist/version-lXJ5L5kT.mjs +3 -0
- package/package.json +1 -1
- package/dist/agents-BGk1FtW_.mjs +0 -3
- package/dist/config-D6elxlPI.mjs +0 -3
- package/dist/config-DvtBCQbQ.mjs +0 -1
- package/dist/doctor-DO48gMqu.mjs +0 -3
package/README.md
CHANGED
|
@@ -58,14 +58,27 @@ quantex update --all
|
|
|
58
58
|
|
|
59
59
|
`quantex update --all` 会优先使用 Quantex 记录的安装来源进行批量更新:
|
|
60
60
|
|
|
61
|
-
- 通过 Bun 安装的 agent 会合并为一条 `bun update -g ...`
|
|
62
|
-
- 通过 npm 安装的 agent 会合并为一条 `npm
|
|
61
|
+
- 通过 Bun 安装的 agent 会合并为一条 `bun update -g --latest ...`
|
|
62
|
+
- 通过 npm 安装的 agent 会合并为一条 `npm install -g ...@latest`
|
|
63
63
|
- 通过 Homebrew 安装的 agent 会按记录的 formula/cask 标识逐个更新
|
|
64
64
|
- 通过 winget 安装的 agent 会按 `winget` 记录的包 ID 逐个更新
|
|
65
65
|
- 通过脚本、直装二进制或仅在 PATH 中探测到的 agent 不会被自动更新
|
|
66
66
|
|
|
67
67
|
这意味着混合安装场景仍然安全,不会把通过其他方式安装的 agent 错误地塞进 Bun、npm、brew 或 winget 的更新命令;对非托管来源,Quantex 会明确提示需要手动更新。
|
|
68
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
|
+
|
|
69
82
|
### 卸载 Agent
|
|
70
83
|
|
|
71
84
|
```bash
|
|
@@ -125,6 +138,7 @@ quantex config get defaultPackageManager
|
|
|
125
138
|
|
|
126
139
|
# 设置配置项
|
|
127
140
|
quantex config set defaultPackageManager npm
|
|
141
|
+
quantex config set npmBunUpdateStrategy respect-semver
|
|
128
142
|
|
|
129
143
|
# 重置为默认配置
|
|
130
144
|
quantex config reset
|
|
@@ -139,6 +153,7 @@ quantex doctor
|
|
|
139
153
|
`doctor` 会检查:
|
|
140
154
|
|
|
141
155
|
- `bun`、`npm`、`brew`、`winget` 这些托管安装器是否可用
|
|
156
|
+
- Quantex CLI 自身的当前版本、安装来源、是否支持自动升级
|
|
142
157
|
- 已安装 agent 的版本状态
|
|
143
158
|
- 已安装 agent 的生命周期和来源,例如 `managed; managed via bun (...)`
|
|
144
159
|
- 当前环境是否缺少任何可用于托管安装/更新的安装器
|
|
@@ -149,7 +164,8 @@ quantex doctor
|
|
|
149
164
|
|
|
150
165
|
```json
|
|
151
166
|
{
|
|
152
|
-
"defaultPackageManager": "bun"
|
|
167
|
+
"defaultPackageManager": "bun",
|
|
168
|
+
"npmBunUpdateStrategy": "latest-major"
|
|
153
169
|
}
|
|
154
170
|
```
|
|
155
171
|
|
|
@@ -157,6 +173,11 @@ quantex doctor
|
|
|
157
173
|
|
|
158
174
|
这里的 `defaultPackageManager` 只影响托管安装器的选择顺序,不影响 `script` / `binary` 这类非托管安装方式。
|
|
159
175
|
|
|
176
|
+
`npmBunUpdateStrategy` 控制通过 npm / Bun 安装的 agent 在更新时的版本策略:
|
|
177
|
+
|
|
178
|
+
- `latest-major`:始终升级到 registry 上的最新版本,默认值
|
|
179
|
+
- `respect-semver`:遵循包管理器已有的 semver 更新语义
|
|
180
|
+
|
|
160
181
|
## 状态文件
|
|
161
182
|
|
|
162
183
|
除了配置文件外,Quantex 还会在 `~/.quantex/state.json` 中记录运行时状态,例如 agent 的实际安装来源。
|
|
@@ -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{
|
|
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
|
@@ -65,8 +65,10 @@ declare function getAgentByLookupName(name: string): AgentDefinition | undefined
|
|
|
65
65
|
declare function getAgentByNameOrAlias(name: string): AgentDefinition | undefined;
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/config/index.d.ts
|
|
68
|
+
type NpmBunUpdateStrategy = 'latest-major' | 'respect-semver';
|
|
68
69
|
interface QuantexConfig {
|
|
69
70
|
defaultPackageManager: 'bun' | 'npm';
|
|
71
|
+
npmBunUpdateStrategy: NpmBunUpdateStrategy;
|
|
70
72
|
[key: string]: unknown;
|
|
71
73
|
}
|
|
72
74
|
declare function getConfigDir(): string;
|
|
@@ -113,13 +115,16 @@ interface ManagedPackageSpec {
|
|
|
113
115
|
packageName: string;
|
|
114
116
|
packageTargetKind?: PackageTargetKind;
|
|
115
117
|
}
|
|
118
|
+
interface ManagedInstallerUpdateOptions {
|
|
119
|
+
npmBunUpdateStrategy?: NpmBunUpdateStrategy;
|
|
120
|
+
}
|
|
116
121
|
interface ManagedInstaller {
|
|
117
122
|
type: ManagedInstallType;
|
|
118
123
|
isAvailable: () => Promise<boolean>;
|
|
119
124
|
install: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
120
125
|
uninstall: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
121
|
-
update: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
122
|
-
updateMany: (packages: ManagedPackageSpec[]) => Promise<boolean>;
|
|
126
|
+
update: (packageName: string, packageTargetKind?: PackageTargetKind, options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
|
|
127
|
+
updateMany: (packages: ManagedPackageSpec[], options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
|
|
123
128
|
}
|
|
124
129
|
declare function getManagedInstaller(type: ManagedInstallType): ManagedInstaller;
|
|
125
130
|
//#endregion
|
|
@@ -164,6 +169,25 @@ interface UpdatePlan {
|
|
|
164
169
|
declare function createUpdatePlan(inspections: AgentInspection[]): UpdatePlan;
|
|
165
170
|
declare function isInspectionUpdateAvailable(inspection: Pick<AgentInspection, 'installedVersion' | 'latestVersion'>): boolean;
|
|
166
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
|
|
167
191
|
//#region src/services/agents.d.ts
|
|
168
192
|
interface ResolvedAgentInspection {
|
|
169
193
|
agent: AgentDefinition;
|
|
@@ -215,4 +239,4 @@ declare function getInstalledVersion(binaryName: string): Promise<string | undef
|
|
|
215
239
|
declare function getLatestVersion(packageName: string): Promise<string | undefined>;
|
|
216
240
|
declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
|
|
217
241
|
//#endregion
|
|
218
|
-
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 SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, canLookupLatestVersionForInstallType, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createUpdatePlan, cursor, droid, execCommand, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getOrderedInstallMethods, getPlatform, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, opencode, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, saveConfig, saveState, setInstalledAgentState, uninstallAgent, updateAgent, updateAgentsByType };
|
|
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,B as t,
|
|
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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
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
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,
|
|
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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./agents-
|
|
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
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};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,
|
|
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
package/dist/agents-BGk1FtW_.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./config-DvtBCQbQ.mjs";import{mkdir as n}from"node:fs/promises";import{join as r}from"node:path";import i from"node:process";function a(e){return{packageName:e,type:`bun`}}function o(e){return{packageName:e,type:`npm`}}function s(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function ee(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function c(e){return{command:e,type:`script`}}const l={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:[a(),o(),c(`irm https://claude.ai/install.ps1 | iex`),ee(`Anthropic.ClaudeCode`)],macos:[a(),o(),c(`curl -fsSL https://claude.ai/install.sh | bash`),s(`claude-code`,`cask`)],linux:[a(),o(),c(`curl -fsSL https://claude.ai/install.sh | bash`),s(`claude-code`,`cask`)]}},u={name:`codex`,displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,packages:{npm:`@openai/codex`},binaryName:`codex`,platforms:{windows:[a(),o()],macos:[a(),o(),s(`codex`)],linux:[a(),o(),s(`codex`)]}},d={name:`copilot`,displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[ee(`GitHub.Copilot`)],macos:[a(),o(),c(`curl -fsSL https://gh.io/copilot-install | bash`),s(`copilot-cli`)],linux:[a(),o(),c(`curl -fsSL https://gh.io/copilot-install | bash`),s(`copilot-cli`)]}},te={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,platforms:{windows:[c(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[c(`curl https://cursor.com/install -fsS | bash`)],linux:[c(`curl https://cursor.com/install -fsS | bash`)]}},f={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:[a(),o(),c(`irm https://app.factory.ai/cli/windows | iex`)],macos:[a(),o(),c(`curl -fsSL https://app.factory.ai/cli | sh`),s(`droid`,`cask`)],linux:[a(),o(),c(`curl -fsSL https://app.factory.ai/cli | sh`),s(`droid`,`cask`)]}},p={name:`gemini`,displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[a(),o()],macos:[a(),o(),s(`gemini-cli`)],linux:[a(),o(),s(`gemini-cli`)]}},m={name:`opencode`,displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,platforms:{windows:[a(),o()],macos:[a(),o(),c(`curl -fsSL https://opencode.ai/install | bash`),s(`anomalyco/tap/opencode`)],linux:[a(),o(),c(`curl -fsSL https://opencode.ai/install | bash`),s(`anomalyco/tap/opencode`)]}},h={name:`pi`,displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,platforms:{windows:[a(),o()],macos:[a(),o()],linux:[a(),o()]}},g=[l,u,d,te,f,p,m,h];function _(){return g}function v(e){return g.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function y(e){return v(e)}const ne={installedAgents:{}};function b(){return r(t(),`state.json`)}async function x(){try{return{installedAgents:(await Bun.file(b()).json()).installedAgents??{}}}catch{return{...ne}}}async function S(e){await n(t(),{recursive:!0}),await Bun.write(b(),`${JSON.stringify(e,null,2)}\n`)}async function C(e){return(await x()).installedAgents[e]}async function w(e){let t=await x();t.installedAgents[e.agentName]=e,await S(t)}async function T(e){let t=await x();delete t.installedAgents[e],await S(t)}function E(){switch(i.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function D(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0}catch{return!1}}async function O(){return D(`bun`)}async function k(){return D(`npm`)}async function A(){return D(`brew`)}async function j(){return D(`winget`)}async function M(e){try{let t=i.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0}catch{return!1}}const re={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 N(e){return re[e]}function P(e){return N(e).lifecycle===`managed`}function F(e){return N(e).lifecycle}function I(e){return N(e).canUpdate}function ie(e){return N(e).canUninstall}function L(e){return N(e).canLookupLatestVersion}function R(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function z(e,t){return t.packageName||e.packages?.npm||void 0}function B(e){return e?I(e.installType):!1}function ae(e){return!!e&&L(e.installType)}function oe(e){return e.length>0&&e.every(e=>L(e.type))}function se(e){return P(e.type)?`${F(e.type)}/${e.type}${R(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function ce(e){return e?P(e.installType)?`managed via ${e.installType}${R(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function le(e){return B(e)?`managed update`:`manual update`}function ue(e,t){if(t.type===`bun`){let n=z(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=z(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 de(e,t,n){if(t)return ae(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!oe(n)))return e.packages.npm}async function V(e){let t=E(),n=typeof e==`function`?e(t):e;try{let e;return e=i.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 fe(e){return e===`cask`?[`--cask`]:[]}async function H(e,t,n){try{let r=Bun.spawn([`brew`,e,...fe(n),t],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function pe(e,t){return H(`install`,e,t)}async function U(e,t){return H(`upgrade`,e,t)}async function me(e){for(let t of e)if(!await U(t.packageName,t.packageTargetKind))return!1;return!0}async function he(e,t){return H(`uninstall`,e,t)}async function ge(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 _e(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 ve(e){if(e.length===0)return!0;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 ye(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 be(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 xe(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 Se(e){if(e.length===0)return!0;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 Ce(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function W(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 we(e){return W(`install`,e)}async function G(e){return W(`upgrade`,e)}async function Te(e){for(let t of e)if(!await G(t.packageName))return!1;return!0}async function Ee(e){return W(`uninstall`,e)}const De={brew:{type:`brew`,isAvailable:async()=>A(),install:async(e,t)=>pe(e,t),uninstall:async(e,t)=>he(e,t),update:async(e,t)=>U(e,t),updateMany:async e=>me(e)},bun:{type:`bun`,isAvailable:async()=>O(),install:async e=>ge(e),uninstall:async e=>ye(e),update:async e=>_e(e),updateMany:async e=>ve(e.map(e=>e.packageName))},npm:{type:`npm`,isAvailable:async()=>k(),install:async e=>be(e),uninstall:async e=>Ce(e),update:async e=>xe(e),updateMany:async e=>Se(e.map(e=>e.packageName))},winget:{type:`winget`,isAvailable:async()=>j(),install:async e=>we(e),uninstall:async e=>Ee(e),update:async e=>G(e),updateMany:async e=>Te(e.map(e=>({packageName:e.packageName})))}};function K(e){return De[e]}async function Oe(){return(await e()).defaultPackageManager}async function q(e){let t=E(),n=e.platforms[t];if(!n)return[];let r=await Oe();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function J(e,t,n,r){let i=K(e);return await i.isAvailable()?r===`install`?i.install(t,n):r===`update`?i.update(t,n):i.uninstall(t,n):!1}async function Y(e,t,n){if(P(t.type)){let r=z(e,t);return r?J(t.type,r,t.packageTargetKind,n):!1}return n===`update`&&!I(t.type)||!t.command?!1:V(t.command)}async function X(e,t){return P(e.installType)?e.packageName?J(e.installType,e.packageName,e.packageTargetKind,t):!1:t!==`install`||!e.command?!1:V(e.command)}async function Z(e,t){let n={agentName:e.name,installType:t.type,packageName:z(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await w(n),n}async function ke(e){let t=await q(e);for(let n of t)if(await Y(e,n,`install`))return{success:!0,installedState:await Z(e,n)};return{success:!1}}async function Ae(e,t){if(t&&await X(t,`update`))return await w(t),{success:!0,installedState:t};let n=await q(e);for(let t of n)if(await Y(e,t,`update`))return{success:!0,installedState:await Z(e,t)};return{success:!1}}async function je(e,t){let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=K(e);return await r.isAvailable()?r.updateMany(n):!1}async function Me(e){let t=await C(e.name);if(!t)return!1;let n=await X(t,`uninstall`);return n&&await T(e.name),n}const Ne=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;async function Q(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(Ne);return r?r[1]:n||void 0}catch{return}}async function Pe(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 Fe(e){try{let t=i.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0?(await new Response(n.stdout).text()).trim().split(`
|
|
3
|
-
`)[0]:void 0}catch{return}}async function $(e){let[t,n,r]=await Promise.all([q(e),C(e.name),M(e.binaryName)]),[i,a,o]=await Promise.all([r?Q(e.binaryName):Promise.resolve(void 0),r?Fe(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:ce(n),updateLabel:le(n),lifecycle:n?F(n.installType):`unmanaged`}}async function Ie(e){return Promise.all(e.map($))}async function Le(e,t,n){let r=de(e,t,n);if(r)return Pe(r)}function Re(e){return y(e)}async function ze(e){let t=Re(e);if(t)return{agent:t,inspection:await $(t)}}async function Be(){return Ie(_())}export{C as A,m as B,P as C,O as D,A as E,w as F,u as G,f as H,v as I,l as K,y as L,x as M,T as N,k as O,S as P,_ as R,N as S,M as T,te as U,p as V,d as W,se as _,Ie as a,I as b,Pe as c,Me as d,Ae as f,ue as g,B as h,$ as i,b as j,j as k,q as l,K as m,Re as n,Fe as o,je as p,ze as r,Q as s,Be as t,ke as u,L as v,E as w,F as x,ie as y,h as z};
|
package/dist/config-D6elxlPI.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,r as n}from"./config-DvtBCQbQ.mjs";import r from"picocolors";async function i(i,a,o){if(!i){let e=await n();console.log(r.bold(`
|
|
2
|
-
Current Configuration:
|
|
3
|
-
`)),console.log(JSON.stringify(e,null,2)),console.log();return}switch(i){case`get`:{if(!a){console.log(r.red(`Please specify a key`));return}let e=(await n())[a];console.log(e===void 0?r.gray(`(not set)`):String(e));break}case`set`:{if(!a||o===void 0){console.log(r.red(`Please specify both key and value`));return}let e={};try{e=await n()}catch{}e[a]=o,await t(e),console.log(r.green(`Set ${a} = ${o}`));break}case`reset`:await t(e),console.log(r.green(`Configuration reset to defaults.`));break;default:console.log(r.red(`Unknown action: ${i}`)),console.log(`Available actions: get, set, reset`)}}export{i as configCommand};
|
package/dist/config-DvtBCQbQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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`};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()});return e}async function c(t){await e(a(),{recursive:!0}),await Bun.write(o(),`${JSON.stringify(t,null,2)}\n`)}export{i as a,c as i,o as n,s as r,a as t};
|
package/dist/doctor-DO48gMqu.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,O as n,k as r,t as i}from"./agents-BGk1FtW_.mjs";import a from"picocolors";async function o(){console.log(a.bold(`
|
|
2
|
-
Quantex CLI Environment Check
|
|
3
|
-
`)),console.log(a.bold(`Managed Installers:`));let o=await e();console.log(` Bun: ${o?a.green(`available`):a.red(`not found`)}`);let s=await n();console.log(` npm: ${s?a.green(`available`):a.red(`not found`)}`);let c=await t();console.log(` brew: ${c?a.green(`available`):a.red(`not found`)}`);let l=await r();console.log(` winget:${l?a.green(`available`):a.red(`not found`)}`),console.log(`\n${a.bold(`Installed Agents:`)}`);let u=await i(),d=!1;for(let e of u)if(e.inPath){d=!0;let t=e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion;console.log(` ${e.agent.displayName}: ${e.installedVersion??`unknown`} [${e.lifecycle}; ${e.sourceLabel}]${t?a.yellow(` (update available: ${e.latestVersion})`):``}`)}d||console.log(a.dim(` No agents installed`)),console.log(`\n${a.bold(`Issues:`)}`);let f=[];if(!o&&!s&&!c&&!l&&f.push(`No managed installer found. Install bun, npm, brew, or winget.`),f.length===0)console.log(a.green(` No issues found.`));else for(let e of f)console.log(a.yellow(` - ${e}`));console.log()}export{o as doctorCommand};
|