quantex-cli 0.0.1-beta.6

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Drswith <https://github.com/Drswith>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # Quantex CLI
2
+
3
+ <div align="center">
4
+
5
+ [![npm version][npm-version-src]][npm-version-href]
6
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
+ [![bundle][bundle-src]][bundle-href]
8
+ [![License][license-src]][license-href]
9
+
10
+ 统一的 AI Agent CLI 管理工具,支持安装、更新、卸载、查询、快捷启动主流 AI 编程助手。
11
+
12
+ </div>
13
+
14
+ ## 支持的 Agent
15
+
16
+ | Agent | 命令 | 别名 | 描述 |
17
+ |-------|------|------|------|
18
+ | **Claude Code** | `quantex claude` / `qtx claude` | - | Anthropic 官方 AI 编程助手 CLI |
19
+ | **Codex** | `quantex codex` / `qtx codex` | - | OpenAI 官方 AI 编程助手 CLI |
20
+ | **Copilot** | `quantex copilot` / `qtx copilot` | - | GitHub Copilot 命令行工具 |
21
+ | **Cursor** | `quantex cursor` / `qtx cursor` | `agent` | Cursor AI 编程助手命令行工具 |
22
+ | **Droid** | `quantex droid` / `qtx droid` | - | Factory AI 软件工程 Agent CLI |
23
+ | **Gemini** | `quantex gemini` / `qtx gemini` | - | Google 开源 AI 编程助手 CLI |
24
+ | **OpenCode** | `quantex opencode` / `qtx opencode` | - | 开源 AI 编程 CLI |
25
+ | **Pi** | `quantex pi` / `qtx pi` | - | 极简可扩展的终端编程 Agent |
26
+
27
+ ## 安装
28
+
29
+ ```bash
30
+ # 使用 Bun
31
+ bun add -g quantex-cli
32
+
33
+ # 使用 npm
34
+ npm i -g quantex-cli
35
+ ```
36
+
37
+ 安装后可使用 `quantex` 或短别名 `qtx` 命令。
38
+
39
+ ## 使用
40
+
41
+ ### 安装 Agent
42
+
43
+ ```bash
44
+ quantex install claude
45
+ # 或使用短别名
46
+ qtx i claude
47
+ ```
48
+
49
+ ### 更新 Agent
50
+
51
+ ```bash
52
+ quantex update claude
53
+ quantex u claude
54
+
55
+ # 更新所有已安装的 agent
56
+ quantex update --all
57
+ ```
58
+
59
+ ### 卸载 Agent
60
+
61
+ ```bash
62
+ quantex uninstall claude
63
+ quantex rm claude
64
+ ```
65
+
66
+ ### 列出所有 Agent
67
+
68
+ ```bash
69
+ quantex list
70
+ quantex ls
71
+ ```
72
+
73
+ ### 查看 Agent 详情
74
+
75
+ ```bash
76
+ quantex info claude
77
+ ```
78
+
79
+ ### 快捷启动 Agent
80
+
81
+ ```bash
82
+ # 直接启动 agent(参数透传)
83
+ quantex claude --dangerously-skip-permissions
84
+
85
+ # 使用短别名启动
86
+ qtx claude --dangerously-skip-permissions
87
+
88
+ # 使用 agent 别名启动
89
+ quantex agent --help
90
+ ```
91
+
92
+ ### 配置管理
93
+
94
+ ```bash
95
+ # 查看配置
96
+ quantex config
97
+
98
+ # 获取配置项
99
+ quantex config get defaultPackageManager
100
+
101
+ # 设置配置项
102
+ quantex config set defaultPackageManager npm
103
+
104
+ # 重置为默认配置
105
+ quantex config reset
106
+ ```
107
+
108
+ ### 环境检查
109
+
110
+ ```bash
111
+ quantex doctor
112
+ ```
113
+
114
+ ## 配置
115
+
116
+ 配置文件位于 `~/.quantex/config.json`,支持以下配置项:
117
+
118
+ ```json
119
+ {
120
+ "defaultPackageManager": "bun"
121
+ }
122
+ ```
123
+
124
+ ## 开发
125
+
126
+ ```bash
127
+ bun install # 安装依赖
128
+ bun run dev # 开发运行
129
+ bun run test # 运行测试
130
+ bun run test:watch # 监听模式运行测试
131
+ bun run lint # 代码检查
132
+ bun run typecheck # 类型检查
133
+ bun run build # 构建
134
+ ```
135
+
136
+ ## License
137
+
138
+ [MIT](./LICENSE) License © [Drswith](https://github.com/Drswith)
139
+
140
+ <!-- Badges -->
141
+
142
+ [npm-version-src]: https://img.shields.io/npm/v/quantex-cli?style=flat&colorA=080f12&colorB=1fa669
143
+ [npm-version-href]: https://npmjs.com/package/quantex-cli
144
+ [npm-downloads-src]: https://img.shields.io/npm/dm/quantex-cli?style=flat&colorA=080f12&colorB=1fa669
145
+ [npm-downloads-href]: https://npmjs.com/package/quantex-cli
146
+ [bundle-src]: https://img.shields.io/bundlephobia/minzip/quantex-cli?style=flat&colorA=080f12&colorB=1fa669&label=minzip
147
+ [bundle-href]: https://bundlephobia.com/result?p=quantex-cli
148
+ [license-src]: https://img.shields.io/github/license/Drswith/quantex-cli.svg?style=flat&colorA=080f12&colorB=1fa669
149
+ [license-href]: https://github.com/Drswith/quantex-cli/blob/main/LICENSE
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.mjs ADDED
@@ -0,0 +1,2 @@
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{};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,3 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,3 @@
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};
@@ -0,0 +1,63 @@
1
+ //#region src/agents/types.d.ts
2
+ type Platform = 'windows' | 'macos' | 'linux';
3
+ type InstallType = 'bun' | 'npm' | 'binary';
4
+ interface InstallMethod {
5
+ type: InstallType;
6
+ command: string;
7
+ priority: number;
8
+ }
9
+ interface AgentDefinition {
10
+ name: string;
11
+ aliases: string[];
12
+ displayName: string;
13
+ description: string;
14
+ homepage: string;
15
+ package: string;
16
+ platforms: Partial<Record<Platform, InstallMethod[]>>;
17
+ binaryName: string;
18
+ }
19
+ //#endregion
20
+ //#region src/agents/claude.d.ts
21
+ declare const claude: AgentDefinition;
22
+ //#endregion
23
+ //#region src/agents/codex.d.ts
24
+ declare const codex: AgentDefinition;
25
+ //#endregion
26
+ //#region src/agents/opencode.d.ts
27
+ declare const opencode: AgentDefinition;
28
+ //#endregion
29
+ //#region src/agents/index.d.ts
30
+ declare function getAllAgents(): AgentDefinition[];
31
+ declare function getAgentByNameOrAlias(name: string): AgentDefinition | undefined;
32
+ //#endregion
33
+ //#region src/config/index.d.ts
34
+ interface QuantexConfig {
35
+ defaultPackageManager: 'bun' | 'npm';
36
+ [key: string]: unknown;
37
+ }
38
+ declare function getConfigDir(): string;
39
+ declare function loadConfig(): Promise<QuantexConfig>;
40
+ //#endregion
41
+ //#region src/package-manager/index.d.ts
42
+ declare function installAgent(agent: AgentDefinition): Promise<boolean>;
43
+ declare function updateAgent(agent: AgentDefinition): Promise<boolean>;
44
+ declare function uninstallAgent(agent: AgentDefinition): Promise<boolean>;
45
+ //#endregion
46
+ //#region src/utils/detect.d.ts
47
+ declare function getPlatform(): Platform;
48
+ declare function isBunAvailable(): Promise<boolean>;
49
+ declare function isNpmAvailable(): Promise<boolean>;
50
+ declare function isBinaryInPath(binaryName: string): Promise<boolean>;
51
+ //#endregion
52
+ //#region src/utils/exec.d.ts
53
+ declare function execCommand(command: string, args: string[]): Promise<{
54
+ success: boolean;
55
+ exitCode: number;
56
+ }>;
57
+ //#endregion
58
+ //#region src/utils/version.d.ts
59
+ declare function getInstalledVersion(binaryName: string): Promise<string | undefined>;
60
+ declare function getLatestVersion(packageName: string): Promise<string | undefined>;
61
+ declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
62
+ //#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 };
package/dist/index.mjs ADDED
@@ -0,0 +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};
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,3 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,2 @@
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};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "quantex-cli",
3
+ "type": "module",
4
+ "version": "0.0.1-beta.6",
5
+ "packageManager": "bun@1.3.11",
6
+ "description": "统一的 AI Agent CLI 管理工具,支持安装、更新、卸载、查询、快捷启动主流 AI 编程助手",
7
+ "author": "Drswith <drswith@outlook.com>",
8
+ "license": "MIT",
9
+ "homepage": "https://github.com/Drswith/quantex-cli#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Drswith/quantex-cli.git"
13
+ },
14
+ "bugs": "https://github.com/Drswith/quantex-cli/issues",
15
+ "keywords": [],
16
+ "sideEffects": false,
17
+ "exports": {
18
+ ".": "./dist/index.mjs",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "main": "./dist/index.mjs",
22
+ "module": "./dist/index.mjs",
23
+ "types": "./dist/index.d.mts",
24
+ "bin": {
25
+ "quantex": "./dist/cli.mjs",
26
+ "qtx": "./dist/cli.mjs"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "scripts": {
32
+ "build": "tsdown",
33
+ "build:bin": "bun run scripts/build-bin.ts",
34
+ "lint:fix": "eslint --fix",
35
+ "lint": "eslint",
36
+ "prepublishOnly": "bun run build",
37
+ "release": "bumpp",
38
+ "dev": "bun run src/cli.ts",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "typecheck": "tsc --noEmit",
42
+ "prepare": "simple-git-hooks"
43
+ },
44
+ "dependencies": {
45
+ "c12": "^3.0.4",
46
+ "commander": "^13.1.0",
47
+ "picocolors": "^1.1.1",
48
+ "prompts": "^2.4.2"
49
+ },
50
+ "devDependencies": {
51
+ "@antfu/eslint-config": "^6.6.1",
52
+ "@types/bun": "^1.3.11",
53
+ "@types/node": "^25.0.1",
54
+ "@types/prompts": "^2.4.9",
55
+ "bumpp": "^10.3.2",
56
+ "eslint": "^9.39.2",
57
+ "lint-staged": "^16.2.7",
58
+ "simple-git-hooks": "^2.13.1",
59
+ "tsdown": "^0.21.7",
60
+ "typescript": "^5.9.3",
61
+ "vitest": "^4.1.3"
62
+ },
63
+ "simple-git-hooks": {
64
+ "pre-commit": "bun install --frozen-lockfile && npx lint-staged"
65
+ },
66
+ "lint-staged": {
67
+ "*": "eslint --fix"
68
+ }
69
+ }