quantex-cli 0.0.1-beta.9 → 0.0.1

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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -34,6 +34,18 @@ bun add -g quantex-cli
34
34
  npm i -g quantex-cli
35
35
  ```
36
36
 
37
+ 也可以从 GitHub Releases 下载对应平台的独立二进制,或使用安装脚本:
38
+
39
+ ```bash
40
+ curl -fsSL https://raw.githubusercontent.com/Drswith/quantex-cli/main/install.sh | sh
41
+ ```
42
+
43
+ Windows PowerShell:
44
+
45
+ ```powershell
46
+ irm https://raw.githubusercontent.com/Drswith/quantex-cli/main/install.ps1 | iex
47
+ ```
48
+
37
49
  安装后可使用 `quantex` 或短别名 `qtx` 命令。
38
50
 
39
51
  ## 使用
@@ -42,7 +54,6 @@ npm i -g quantex-cli
42
54
 
43
55
  ```bash
44
56
  quantex install claude
45
- # 或使用短别名
46
57
  qtx i claude
47
58
  ```
48
59
 
@@ -52,32 +63,52 @@ qtx i claude
52
63
  quantex update claude
53
64
  quantex u claude
54
65
 
55
- # 更新所有已安装的 agent
56
66
  quantex update --all
57
67
  ```
58
68
 
59
- `quantex update --all` 会优先使用 Quantex 记录的安装来源进行批量更新:
69
+ `quantex update` 和 `quantex update --all` 现在共用同一套更新策略层:
60
70
 
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 不会被自动更新
71
+ - `managed`:优先按 Quantex 已记录的安装来源更新
72
+ - `self-update`:使用 agent 自带的更新命令
73
+ - `manual-hint`:不自动更新,只给出明确提示
66
74
 
67
- 这意味着混合安装场景仍然安全,不会把通过其他方式安装的 agent 错误地塞进 Bun、npm、brew winget 的更新命令;对非托管来源,Quantex 会明确提示需要手动更新。
75
+ `quantex update --all` 会优先使用 `~/.quantex/state.json` 里记录的实际安装来源进行批量更新:
76
+
77
+ - `bun` 会批量合并为一条 `bun update -g --latest ...`
78
+ - `npm` 会批量合并为一条 `npm install -g ...@latest`
79
+ - `brew`、`winget` 会按记录的安装器标识逐个更新
80
+ - `script`、`binary` 或仅在 PATH 中探测到但没有可自动更新能力的 agent 不会被错误并入托管更新命令
81
+
82
+ 对于支持自更新的 agent,`list`、`info`、`update` 输出会明确显示 `command update` 或 `self-update`。
68
83
 
69
84
  ### 升级 Quantex CLI
70
85
 
71
86
  ```bash
72
87
  quantex upgrade
88
+
89
+ # 只检查是否有更新
90
+ quantex upgrade --check
91
+
92
+ # 使用 beta channel
93
+ quantex upgrade --channel beta
73
94
  ```
74
95
 
75
96
  当前自身升级支持:
76
97
 
77
98
  - 通过 Bun 全局安装的 `quantex-cli`
78
99
  - 通过 npm 全局安装的 `quantex-cli`
100
+ - 通过独立二进制安装的 `quantex`
79
101
 
80
- 如果当前是源码工作区运行或其他非托管来源,`upgrade` 会明确提示当前来源不支持自动升级。
102
+ Binary 自升级具备:
103
+
104
+ - release manifest 解析
105
+ - SHA256 checksum 校验
106
+ - 升级锁
107
+ - post-upgrade verify
108
+ - `.bak` 最小回滚
109
+ - Windows 延迟替换
110
+
111
+ 如果升级失败,`upgrade` 和 `doctor` 都会给出与安装来源匹配的恢复方式。
81
112
 
82
113
  ### 卸载 Agent
83
114
 
@@ -90,15 +121,16 @@ quantex rm claude
90
121
 
91
122
  ```bash
92
123
  quantex list
93
- quantex ls
124
+ qtx ls
94
125
  ```
95
126
 
96
- `list` 会显示每个 agent 的安装状态、当前版本、是否支持托管更新,以及安装来源。例如:
127
+ `list` 会显示每个 agent 的安装状态、当前版本、更新方式和安装来源。例如:
97
128
 
98
129
  - `managed update` 表示 Quantex 能按记录的安装器执行更新
130
+ - `command update` 表示当前 agent 支持自更新
99
131
  - `manual update` 表示当前来源不支持自动更新
100
- - `managed via bun (...)`、`managed via brew (...)` 表示有明确的来源记录
101
- - `detected in PATH` 表示命令存在,但不是由当前 Quantex 状态文件追踪到的安装
132
+ - `managed via bun (...)`、`managed via brew (...)` 表示有明确来源记录
133
+ - `detected in PATH` 表示命令存在,但不是由当前 Quantex 状态追踪到的安装
102
134
 
103
135
  ### 查看 Agent 详情
104
136
 
@@ -106,41 +138,31 @@ quantex ls
106
138
  quantex info claude
107
139
  ```
108
140
 
109
- `info` 会按当前平台列出安装方式,并明确区分:
110
-
111
- - `managed/<installer>`,例如 `managed/bun`、`managed/brew`
112
- - `unmanaged/script`,例如 `curl | bash`、`irm | iex`
113
- - `unmanaged/binary`,保留给未来真正的二进制直装场景
141
+ `info` 会显示:
114
142
 
115
- 如果 agent 已安装,`info` 还会显示当前记录的 `Source` 和 `Lifecycle`。
143
+ - 当前平台可用的安装方式
144
+ - 当前记录的安装来源与生命周期
145
+ - 当前版本和可检测到的最新版本
146
+ - agent 自带的自更新命令
116
147
 
117
148
  ### 快捷启动 Agent
118
149
 
119
150
  ```bash
120
- # 直接启动 agent(参数透传)
121
151
  quantex claude --dangerously-skip-permissions
122
-
123
- # 使用短别名启动
124
152
  qtx claude --dangerously-skip-permissions
125
-
126
- # 使用 agent 别名启动
127
153
  quantex agent --help
128
154
  ```
129
155
 
156
+ 如果 agent 未安装,Quantex 会提示是否先安装再启动。
157
+
130
158
  ### 配置管理
131
159
 
132
160
  ```bash
133
- # 查看配置
134
161
  quantex config
135
-
136
- # 获取配置项
137
162
  quantex config get defaultPackageManager
138
-
139
- # 设置配置项
140
163
  quantex config set defaultPackageManager npm
141
164
  quantex config set npmBunUpdateStrategy respect-semver
142
-
143
- # 重置为默认配置
165
+ quantex config set selfUpdateChannel beta
144
166
  quantex config reset
145
167
  ```
146
168
 
@@ -152,71 +174,74 @@ quantex doctor
152
174
 
153
175
  `doctor` 会检查:
154
176
 
155
- - `bun`、`npm`、`brew`、`winget` 这些托管安装器是否可用
156
- - Quantex CLI 自身的当前版本、安装来源、是否支持自动升级
177
+ - `bun`、`npm`、`brew`、`winget` 是否可用
178
+ - Quantex CLI 自身的版本、安装来源、是否支持自动升级
179
+ - Quantex CLI 是否有新版本以及对应恢复方式
157
180
  - 已安装 agent 的版本状态
158
- - 已安装 agent 的生命周期和来源,例如 `managed; managed via bun (...)`
159
181
  - 当前环境是否缺少任何可用于托管安装/更新的安装器
160
182
 
161
183
  ## 配置
162
184
 
163
- 配置文件位于 `~/.quantex/config.json`,支持以下配置项:
185
+ 配置文件位于 `~/.quantex/config.json`,当前支持:
164
186
 
165
187
  ```json
166
188
  {
167
189
  "defaultPackageManager": "bun",
168
- "npmBunUpdateStrategy": "latest-major"
190
+ "npmBunUpdateStrategy": "latest-major",
191
+ "selfUpdateChannel": "stable",
192
+ "networkRetries": 2,
193
+ "networkTimeoutMs": 10000,
194
+ "versionCacheTtlHours": 6
169
195
  }
170
196
  ```
171
197
 
172
- `defaultPackageManager` 会影响托管安装方式的尝试顺序。比如某个 agent 同时支持 Bun 和 npm 时,设置为 `npm` 后,Quantex 会先尝试 npm,再按 agent 定义中的其余安装方式顺序回退。
173
-
174
- 这里的 `defaultPackageManager` 只影响托管安装器的选择顺序,不影响 `script` / `binary` 这类非托管安装方式。
198
+ 配置项说明:
175
199
 
176
- `npmBunUpdateStrategy` 控制通过 npm / Bun 安装的 agent 在更新时的版本策略:
177
-
178
- - `latest-major`:始终升级到 registry 上的最新版本,默认值
179
- - `respect-semver`:遵循包管理器已有的 semver 更新语义
200
+ - `defaultPackageManager`:控制托管安装器的优先尝试顺序
201
+ - `npmBunUpdateStrategy`:
202
+ - `latest-major`:升级到 registry 最新版本,默认值
203
+ - `respect-semver`:保留包管理器默认的 semver 更新语义
204
+ - `selfUpdateChannel`:Quantex CLI 自升级默认 channel,支持 `stable` / `beta`
205
+ - `networkRetries`:版本查询和 release 元数据请求重试次数
206
+ - `networkTimeoutMs`:网络请求超时时间
207
+ - `versionCacheTtlHours`:版本与 release 元数据缓存 TTL
180
208
 
181
209
  ## 状态文件
182
210
 
183
- 除了配置文件外,Quantex 还会在 `~/.quantex/state.json` 中记录运行时状态,例如 agent 的实际安装来源。
184
-
185
- 当前安装来源会区分为:
211
+ Quantex 会在 `~/.quantex/state.json` 中记录运行时状态,例如:
186
212
 
187
- - 托管安装器:`bun`、`npm`、`brew`、`winget`
188
- - 非托管安装:`script`
189
- - 预留类型:`binary`
213
+ - agent 的实际安装来源
214
+ - Quantex CLI 自身的安装来源
190
215
 
191
216
  这个状态文件主要用于:
192
217
 
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` 就可以复用批量更新路径。
218
+ - 让 `update --all` 能先生成更新计划,再按安装来源分组执行
219
+ - 避免混合安装场景下误用错误的更新方式
220
+ - 支撑 `list`、`info`、`doctor`、`upgrade` 的来源判断和恢复提示
204
221
 
205
222
  ## 开发
206
223
 
207
224
  ```bash
208
- bun install # 安装依赖
209
- bun run dev # 开发运行
210
- bun run test # 运行测试
211
- bun run test:watch # 监听模式运行测试
212
- bun run lint # 代码检查
213
- bun run typecheck # 类型检查
214
- bun run build # 构建
225
+ bun install
226
+ bun run dev
227
+ bun run test
228
+ bun run test:watch
229
+ bun run lint
230
+ bun run lint:fix
231
+ bun run typecheck
232
+ bun run build
233
+ bun run build:bin
234
+ bun run release:artifacts
215
235
  ```
216
236
 
237
+ `release:artifacts` 会统一生成并校验:
238
+
239
+ - `dist/bin/SHA256SUMS.txt`
240
+ - `dist/bin/manifest.json`
241
+
217
242
  ## License
218
243
 
219
- [MIT](./LICENSE) License © [Drswith](https://github.com/Drswith)
244
+ [Apache License 2.0](./LICENSE) © [Drswith](https://github.com/Drswith)
220
245
 
221
246
  <!-- Badges -->
222
247
 
@@ -0,0 +1 @@
1
+ import{i as e}from"./config-DWeRAIFV.mjs";import{_ as t,a as n,c as r,d as i,f as a,l as o,n as ee,o as te,p as s,r as ne,s as re,t as ie,u as ae,y as c}from"./version-CrMPGstC.mjs";import l from"node:process";const oe={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 u(e){return oe[e]}function d(e){return u(e).lifecycle===`managed`}function f(e){return u(e).lifecycle}function p(e){return u(e).canUpdate}function se(e){return u(e).canUninstall}function m(e){return u(e).canLookupLatestVersion}function ce(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function h(e,t){return t.packageName||e.packages?.npm||void 0}function le(e){return e?p(e.installType):!1}function ue(e,t){return le(t)||!!e.selfUpdate}function de(e){return!!e&&m(e.installType)}function fe(e){return e.length>0&&e.every(e=>m(e.type))}function pe(e){return d(e.type)?`${f(e.type)}/${e.type}${ce(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function me(e){return e?d(e.installType)?`managed via ${e.installType}${ce(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function he(e,t){let n=b({agent:e,installedState:t,methods:[]});return n===`managed`?`managed update`:n===`self-update`?`command update`:`manual update`}function ge(e,t){if(t.type===`bun`){let n=h(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=h(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function _e(e,t,n){if(t)return de(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!fe(n)))return e.packages.npm}function g(e){if(e.installedState&&d(e.installedState.installType))return e.installedState.installType;for(let t of e.methods)if(d(t.type)&&p(t.type))return t.type}const ve={strategy:`managed`,canHandle:e=>!!g(e),getManagedInstallerType:e=>g(e)},ye={strategy:`self-update`,canHandle:e=>!le(e.installedState)&&!!e.agent.selfUpdate},_={strategy:`manual-hint`,canHandle:()=>!0},v=[ve,ye,_];function y(e){return v.find(t=>t.canHandle(e))??_}function b(e){return y(e).strategy}function be(e){return ue(e.agent,e.installedState)}function x(e){return{packageName:e,type:`bun`}}function S(e){return{packageName:e,type:`npm`}}function C(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function w(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function T(e){return{command:e,type:`script`}}const E={name:`claude`,displayName:`Claude Code`,description:`Anthropic 官方 AI 编程助手 CLI`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,selfUpdate:{command:[`claude`,`update`],fallbackCommands:[[`claude`,`upgrade`]]},platforms:{windows:[x(),S(),T(`irm https://claude.ai/install.ps1 | iex`),w(`Anthropic.ClaudeCode`)],macos:[x(),S(),T(`curl -fsSL https://claude.ai/install.sh | bash`),C(`claude-code`,`cask`)],linux:[x(),S(),T(`curl -fsSL https://claude.ai/install.sh | bash`),C(`claude-code`,`cask`)]}},D={name:`codex`,displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,packages:{npm:`@openai/codex`},binaryName:`codex`,platforms:{windows:[x(),S()],macos:[x(),S(),C(`codex`)],linux:[x(),S(),C(`codex`)]}},O={name:`copilot`,displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[w(`GitHub.Copilot`)],macos:[x(),S(),T(`curl -fsSL https://gh.io/copilot-install | bash`),C(`copilot-cli`)],linux:[x(),S(),T(`curl -fsSL https://gh.io/copilot-install | bash`),C(`copilot-cli`)]}},k={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,selfUpdate:{command:[`agent`,`update`]},versionProbe:{command:[`agent`,`--version`]},platforms:{windows:[T(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[T(`curl https://cursor.com/install -fsS | bash`)],linux:[T(`curl https://cursor.com/install -fsS | bash`)]}},A={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:[x(),S(),T(`irm https://app.factory.ai/cli/windows | iex`)],macos:[x(),S(),T(`curl -fsSL https://app.factory.ai/cli | sh`),C(`droid`,`cask`)],linux:[x(),S(),T(`curl -fsSL https://app.factory.ai/cli | sh`),C(`droid`,`cask`)]}},j={name:`gemini`,displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[x(),S()],macos:[x(),S(),C(`gemini-cli`)],linux:[x(),S(),C(`gemini-cli`)]}},M={name:`opencode`,displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,platforms:{windows:[x(),S()],macos:[x(),S(),T(`curl -fsSL https://opencode.ai/install | bash`),C(`anomalyco/tap/opencode`)],linux:[x(),S(),T(`curl -fsSL https://opencode.ai/install | bash`),C(`anomalyco/tap/opencode`)]}},N={name:`pi`,displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,platforms:{windows:[x(),S()],macos:[x(),S()],linux:[x(),S()]}},xe=[E,D,O,k,A,j,M,N];function P(){return xe}function F(e){return xe.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function I(e){return F(e)}function L(){switch(l.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function R(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0}catch{return!1}}async function z(){return R(`bun`)}async function B(){return R(`npm`)}async function V(){return R(`brew`)}async function H(){return R(`winget`)}async function U(e){try{let t=l.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0}catch{return!1}}async function W(e){let t=L(),n=typeof e==`function`?e(t):e;try{let e;return e=l.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 Se(e){return e===`cask`?[`--cask`]:[]}async function G(e,t,n){try{let r=Bun.spawn([`brew`,e,...Se(n),t],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function Ce(e,t){return G(`install`,e,t)}async function K(e,t){return G(`upgrade`,e,t)}async function we(e){for(let t of e)if(!await K(t.packageName,t.packageTargetKind))return!1;return!0}async function Te(e,t){return G(`uninstall`,e,t)}async function q(e,t){try{let n=Bun.spawn([`winget`,e,`--id`,t,`-e`],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function Ee(e){return q(`install`,e)}async function De(e){return q(`upgrade`,e)}async function Oe(e){for(let t of e)if(!await De(t.packageName))return!1;return!0}async function ke(e){return q(`uninstall`,e)}const Ae={brew:{type:`brew`,isAvailable:async()=>V(),install:async(e,t)=>Ce(e,t),uninstall:async(e,t)=>Te(e,t),update:async(e,t)=>K(e,t),updateMany:async e=>we(e)},bun:{type:`bun`,isAvailable:async()=>z(),install:async e=>o(e),uninstall:async e=>ae(e),update:async(e,t,n)=>i(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>a(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},npm:{type:`npm`,isAvailable:async()=>B(),install:async e=>n(e),uninstall:async e=>te(e),update:async(e,t,n)=>re(e,n?.npmBunUpdateStrategy),updateMany:async(e,t)=>r(e.map(e=>e.packageName),t?.npmBunUpdateStrategy)},winget:{type:`winget`,isAvailable:async()=>H(),install:async e=>Ee(e),uninstall:async e=>ke(e),update:async e=>De(e),updateMany:async e=>Oe(e.map(e=>({packageName:e.packageName})))}};function J(e){return Ae[e]}async function je(){return(await e()).defaultPackageManager}async function Me(){return{npmBunUpdateStrategy:(await e()).npmBunUpdateStrategy}}async function Y(e){let t=L(),n=e.platforms[t];if(!n)return[];let r=await je();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function Ne(e,t,n,r,i){let a=J(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 X(e,t,n,r){if(d(t.type)){let i=h(e,t);return i?Ne(t.type,i,t.packageTargetKind,n,r):!1}return n===`update`&&!p(t.type)||!t.command?!1:W(t.command)}async function Pe(e,t,n){return d(e.installType)?e.packageName?Ne(e.installType,e.packageName,e.packageTargetKind,t,n):!1:t!==`install`||!e.command?!1:W(e.command)}async function Fe(e){if(!e.selfUpdate)return!1;let t=[e.selfUpdate.command,...e.selfUpdate.fallbackCommands??[]];for(let e of t)if(await W(e.join(` `)))return!0;return!1}async function Z(e,t){let n={agentName:e.name,installType:t.type,packageName:h(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await c(n),n}async function Ie(e){let t=await Y(e);for(let n of t)if(await X(e,n,`install`))return{success:!0,installedState:await Z(e,n)};return{success:!1}}async function Le(e,t){let{npmBunUpdateStrategy:n}=await Me(),r=await Y(e);if(t&&await Pe(t,`update`,n))return await c(t),{success:!0,installedState:t};if(!t){for(let t of r)if(await X(e,t,`update`,n))return{success:!0,installedState:await Z(e,t)}}if(await Fe(e))return{success:!0};if(t){for(let t of r)if(await X(e,t,`update`,n))return{success:!0,installedState:await Z(e,t)}}return{success:!1}}async function Re(e,t){let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=J(e);return await r.isAvailable()?r.updateMany(n,await Me()):!1}async function ze(e){let n=await s(e.name);if(!n)return!1;let r=await Pe(n,`uninstall`);return r&&await t(e.name),r}async function Q(e){let[t,n,r]=await Promise.all([Y(e),s(e.name),U(e.binaryName)]),[i,a,o]=await Promise.all([r?ee(e.binaryName,e.versionProbe):Promise.resolve(void 0),r?ie(e.binaryName):Promise.resolve(void 0),Ve(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,sourceLabel:me(n),updateLabel:he(e,n),lifecycle:n?f(n.installType):`unmanaged`}}async function Be(e){return Promise.all(e.map(Q))}async function Ve(e,t,n){let r=_e(e,t,n);if(r)return ne(r)}function $(e){return I(e)}async function He(e){let t=$(e);if(t)return{agent:t,inspection:await Q(t)}}async function Ue(){return Be(P())}export{be as A,f as B,j as C,D,O as E,pe as F,d as H,h as I,m as L,y as M,ue as N,E as O,ge as P,se as R,M as S,k as T,u as V,H as _,Be as a,P as b,ze as c,J as d,L as f,B as g,z as h,Q as i,b as j,v as k,Le as l,V as m,$ as n,Y as o,U as p,He as r,Ie as s,Ue as t,Re as u,F as v,A as w,N as x,I as y,p as z};
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{P as e,r as t,s as n}from"./agents-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{};
2
+ import{r as e,s as t,y as n}from"./agents-BALRvoqc.mjs";import{i as r}from"./self-Bj9L_tIu.mjs";import i from"node:process";import{program as a}from"commander";import o from"picocolors";import s from"prompts";async function c(n,r){let i=await e(n);if(!i)return console.log(o.red(`Unknown agent: ${n}`)),1;let{agent:a,inspection:c}=i;if(!c.inPath){if(!(await s({type:`confirm`,name:`install`,message:`${a.displayName} is not installed. Would you like to install it?`,initial:!0})).install)return console.log(o.yellow(`Installation cancelled.`)),1;if(console.log(o.cyan(`Installing ${a.displayName}...`)),!(await t(a)).success)return console.log(o.red(`Failed to install ${a.displayName}.`)),1}try{let e=Bun.spawn([a.binaryName,...r],{stdio:[`inherit`,`inherit`,`inherit`]});return await e.exited,e.exitCode??1}catch(e){return console.log(o.red(`Failed to launch ${a.displayName}: ${e instanceof Error?e.message:String(e)}`)),1}}a.name(`quantex`).description(`统一的 AI Agent CLI 管理工具`).version(r()),a.command(`install <agent>`).alias(`i`).description(`安装指定 agent`).action(async e=>{let{installCommand:t}=await import(`./install-LlwsPjcI.mjs`);await t(e)}),a.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-DTqFneka.mjs`);await n(e,t.all??!1)}),a.command(`uninstall <agent>`).alias(`rm`).description(`卸载指定 agent`).action(async e=>{let{uninstallCommand:t}=await import(`./uninstall-BYGbg7Kt.mjs`);await t(e)}),a.command(`list`).alias(`ls`).description(`列出所有支持的 agent`).action(async()=>{let{listCommand:e}=await import(`./list-C3iiju9D.mjs`);await e()}),a.command(`info <agent>`).description(`查看 agent 详细信息`).action(async e=>{let{infoCommand:t}=await import(`./info-m8Pm4m7N.mjs`);await t(e)}),a.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-B1BACpEg.mjs`);await r(e,t,n)}),a.command(`upgrade`).description(`升级 Quantex CLI`).option(`--channel <channel>`,`Update channel: stable or beta`).option(`--check`,`Only check whether an update is available`).action(async e=>{let{upgradeCommand:t}=await import(`./upgrade-CTQyBekz.mjs`);i.exitCode=await t({channel:e.channel===`beta`?`beta`:void 0,check:e.check??!1})}),a.command(`doctor`).description(`检查环境`).action(async()=>{let{doctorCommand:e}=await import(`./doctor-C3MeTdcd.mjs`);await e()});const l=i.argv[2],u=new Set([...a.commands.map(e=>e.name()),...a.commands.flatMap(e=>e.aliases()),`help`,`--help`,`--version`,`-v`]);if(l&&!l.startsWith(`-`)&&!u.has(l)&&n(l)){let e=await c(l,i.argv.slice(3));i.exit(e)}a.parse();export{};
@@ -0,0 +1,3 @@
1
+ import{a as e,i as t,o as n,r}from"./config-DWeRAIFV.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}if(o===`selfUpdateChannel`&&s!==`stable`&&s!==`beta`){console.log(i.red(`selfUpdateChannel must be stable or beta`));return}if([`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(o)){let e=Number.parseInt(s,10);if(!Number.isInteger(e)||e<=0){console.log(i.red(`${o} must be a positive integer`));return}s=`${e}`}let n={};try{n=await t()}catch{}n[o]=[`networkRetries`,`networkTimeoutMs`,`versionCacheTtlHours`].includes(o)?Number.parseInt(s,10):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 @@
1
+ import{mkdir as e,readFile as t}from"node:fs/promises";import{homedir as n}from"node:os";import{join as r}from"node:path";import i from"node:process";import{pathToFileURL as a}from"node:url";import{loadConfig as o}from"c12";const s={defaultPackageManager:`bun`,networkRetries:2,networkTimeoutMs:1e4,npmBunUpdateStrategy:`latest-major`,selfUpdateChannel:`stable`,versionCacheTtlHours:6};function c(){return r(i.env.HOME||i.env.USERPROFILE||n(),`.quantex`)}function l(){return r(c(),`config.json`)}async function u(){let{config:e}=await o({name:`quantex`,defaults:s,configFile:l(),jiti:{import:async(e,n)=>{if(e.endsWith(`.json`))return JSON.parse(await t(e,`utf8`));let r=await(e.startsWith(`file:`)?import(e):import(a(e).href));return n?.default?r.default??r:r}}}),n=e;return{...n,defaultPackageManager:n.defaultPackageManager===`npm`?`npm`:`bun`,networkRetries:p(n.networkRetries,2),networkTimeoutMs:p(n.networkTimeoutMs,1e4),npmBunUpdateStrategy:n.npmBunUpdateStrategy===`respect-semver`?`respect-semver`:`latest-major`,selfUpdateChannel:n.selfUpdateChannel===`beta`?`beta`:`stable`,versionCacheTtlHours:p(n.versionCacheTtlHours,6)}}function d(e){return e===`latest-major`||e===`respect-semver`}async function f(t){await e(c(),{recursive:!0}),await Bun.write(l(),`${JSON.stringify(t,null,2)}\n`)}function p(e,t){if(typeof e==`number`&&Number.isInteger(e)&&e>0)return e;if(typeof e==`string`){let t=Number.parseInt(e,10);if(Number.isInteger(t)&&t>0)return t}return t}export{f as a,u as i,l as n,s as o,d as r,c as t};
@@ -0,0 +1,3 @@
1
+ import{_ as e,g as t,h as n,m as r,t as i}from"./agents-BALRvoqc.mjs";import{a,c as o}from"./self-Bj9L_tIu.mjs";import s from"picocolors";async function c(){console.log(s.bold(`
2
+ Quantex CLI Environment Check
3
+ `)),console.log(s.bold(`Managed Installers:`));let c=await n();console.log(` Bun: ${c?s.green(`available`):s.red(`not found`)}`);let l=await t();console.log(` npm: ${l?s.green(`available`):s.red(`not found`)}`);let u=await r();console.log(` brew: ${u?s.green(`available`):s.red(`not found`)}`);let d=await e();console.log(` winget:${d?s.green(`available`):s.red(`not found`)}`);let f=await a(),p=f.latestVersion&&f.latestVersion!==f.currentVersion;if(console.log(`\n${s.bold(`Quantex CLI:`)}`),console.log(` Version: ${f.currentVersion}`),console.log(` Source: ${f.installSource}`),console.log(` Auto-update: ${f.canAutoUpdate?s.green(`supported`):s.yellow(`unsupported`)}`),f.latestVersion&&console.log(` Latest: ${f.latestVersion}${p?s.yellow(` (update available)`):``}`),p){let e=o(f);e&&console.log(` Recovery: ${e}`)}console.log(`\n${s.bold(`Installed Agents:`)}`);let m=await i(),h=!1;for(let e of m)if(e.inPath){h=!0;let t=e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion;console.log(` ${e.agent.displayName}: ${e.installedVersion??`unknown`} [${e.lifecycle}; ${e.sourceLabel}]${t?s.yellow(` (update available: ${e.latestVersion})`):``}`)}h||console.log(s.dim(` No agents installed`)),console.log(`\n${s.bold(`Issues:`)}`);let g=[];if(!c&&!l&&!u&&!d&&g.push(`No managed installer found. Install bun, npm, brew, or winget.`),g.length===0)console.log(s.green(` No issues found.`));else for(let e of g)console.log(s.yellow(` - ${e}`));console.log()}export{c as doctorCommand};
package/dist/index.d.mts CHANGED
@@ -24,6 +24,15 @@ type InstallMethod = ManagedInstallMethod | ScriptInstallMethod | BinaryInstallM
24
24
  interface AgentPackageMetadata {
25
25
  npm?: string;
26
26
  }
27
+ interface AgentSelfUpdate {
28
+ command: string[];
29
+ fallbackCommands?: string[][];
30
+ versionAfter?: 'same-process' | 'respawn';
31
+ }
32
+ interface AgentVersionProbe {
33
+ command?: string[];
34
+ parser?: (stdout: string) => string | undefined;
35
+ }
27
36
  interface AgentDefinition {
28
37
  name: string;
29
38
  lookupAliases?: string[];
@@ -33,6 +42,8 @@ interface AgentDefinition {
33
42
  packages?: AgentPackageMetadata;
34
43
  platforms: Partial<Record<Platform, InstallMethod[]>>;
35
44
  binaryName: string;
45
+ selfUpdate?: AgentSelfUpdate;
46
+ versionProbe?: AgentVersionProbe;
36
47
  }
37
48
  //#endregion
38
49
  //#region src/agents/definitions/claude.d.ts
@@ -64,17 +75,31 @@ declare function getAllAgents(): AgentDefinition[];
64
75
  declare function getAgentByLookupName(name: string): AgentDefinition | undefined;
65
76
  declare function getAgentByNameOrAlias(name: string): AgentDefinition | undefined;
66
77
  //#endregion
67
- //#region src/config/index.d.ts
68
- type NpmBunUpdateStrategy = 'latest-major' | 'respect-semver';
69
- interface QuantexConfig {
70
- defaultPackageManager: 'bun' | 'npm';
71
- npmBunUpdateStrategy: NpmBunUpdateStrategy;
72
- [key: string]: unknown;
78
+ //#region src/self/types.d.ts
79
+ type SelfInstallSource = 'binary' | 'bun' | 'npm' | 'source' | 'unknown';
80
+ type SelfUpdateChannel = 'beta' | 'stable';
81
+ interface SelfInspection {
82
+ canAutoUpdate: boolean;
83
+ currentVersion: string;
84
+ executablePath: string;
85
+ installSource: SelfInstallSource;
86
+ latestVersion?: string;
87
+ packageRoot: string;
88
+ recommendedUpgradeCommand?: string;
89
+ updateChannel: SelfUpdateChannel;
90
+ }
91
+ type SelfUpgradeErrorKind = 'checksum' | 'locked' | 'network' | 'permission' | 'unknown' | 'unsupported' | 'verify';
92
+ interface SelfUpgradeError {
93
+ detail?: unknown;
94
+ kind: SelfUpgradeErrorKind;
95
+ message: string;
96
+ }
97
+ interface SelfUpdateResult {
98
+ error?: SelfUpgradeError;
99
+ installSource: SelfInstallSource;
100
+ newVersion?: string;
101
+ success: boolean;
73
102
  }
74
- declare function getConfigDir(): string;
75
- declare function getConfigFilePath(): string;
76
- declare function loadConfig(): Promise<QuantexConfig>;
77
- declare function saveConfig(config: Record<string, unknown>): Promise<void>;
78
103
  //#endregion
79
104
  //#region src/state/index.d.ts
80
105
  interface InstalledAgentState {
@@ -84,8 +109,12 @@ interface InstalledAgentState {
84
109
  packageTargetKind?: PackageTargetKind;
85
110
  command?: string;
86
111
  }
112
+ interface SelfState {
113
+ installSource?: SelfInstallSource;
114
+ }
87
115
  interface QuantexState {
88
116
  installedAgents: Record<string, InstalledAgentState>;
117
+ self: SelfState;
89
118
  }
90
119
  declare function getStateFilePath(): string;
91
120
  declare function loadState(): Promise<QuantexState>;
@@ -93,6 +122,47 @@ declare function saveState(state: QuantexState): Promise<void>;
93
122
  declare function getInstalledAgentState(agentName: string): Promise<InstalledAgentState | undefined>;
94
123
  declare function setInstalledAgentState(agentState: InstalledAgentState): Promise<void>;
95
124
  declare function removeInstalledAgentState(agentName: string): Promise<void>;
125
+ declare function getSelfState(): Promise<SelfState>;
126
+ declare function setSelfInstallSource(installSource: SelfInstallSource): Promise<void>;
127
+ //#endregion
128
+ //#region src/agent-update/types.d.ts
129
+ type AgentUpdateStrategy = 'managed' | 'manual-hint' | 'self-update';
130
+ interface AgentUpdateContext {
131
+ agent: Pick<AgentDefinition, 'packages' | 'selfUpdate'>;
132
+ methods: InstallMethod[];
133
+ installedState?: Pick<InstalledAgentState, 'installType' | 'packageName'>;
134
+ }
135
+ interface AgentUpdateProvider {
136
+ canHandle: (context: AgentUpdateContext) => boolean;
137
+ getManagedInstallerType?: (context: AgentUpdateContext) => ManagedInstallType | undefined;
138
+ strategy: AgentUpdateStrategy;
139
+ }
140
+ //#endregion
141
+ //#region src/agent-update/messages.d.ts
142
+ declare function getManualAgentUpdateMessage(agent: Pick<AgentDefinition, 'displayName'>): string;
143
+ declare function getAgentUpdateFailureHint(agent: Pick<AgentDefinition, 'displayName' | 'homepage' | 'selfUpdate'>, strategy: AgentUpdateStrategy): string | undefined;
144
+ //#endregion
145
+ //#region src/agent-update/providers.d.ts
146
+ declare const agentUpdateProviders: AgentUpdateProvider[];
147
+ declare function resolveAgentUpdateProvider(context: AgentUpdateContext): AgentUpdateProvider;
148
+ declare function getAgentUpdateStrategy(context: AgentUpdateContext): AgentUpdateProvider['strategy'];
149
+ declare function canResolveAgentUpdate(context: AgentUpdateContext): boolean;
150
+ //#endregion
151
+ //#region src/config/index.d.ts
152
+ type NpmBunUpdateStrategy = 'latest-major' | 'respect-semver';
153
+ interface QuantexConfig {
154
+ defaultPackageManager: 'bun' | 'npm';
155
+ networkRetries: number;
156
+ networkTimeoutMs: number;
157
+ npmBunUpdateStrategy: NpmBunUpdateStrategy;
158
+ selfUpdateChannel: SelfUpdateChannel;
159
+ versionCacheTtlHours: number;
160
+ [key: string]: unknown;
161
+ }
162
+ declare function getConfigDir(): string;
163
+ declare function getConfigFilePath(): string;
164
+ declare function loadConfig(): Promise<QuantexConfig>;
165
+ declare function saveConfig(config: Record<string, unknown>): Promise<void>;
96
166
  //#endregion
97
167
  //#region src/inspection/agents.d.ts
98
168
  interface AgentInspection {
@@ -158,35 +228,71 @@ declare function canLookupLatestVersionForInstallType(type: InstallType): boolea
158
228
  interface UpdatePlanEntry {
159
229
  inspection: AgentInspection;
160
230
  installerType?: ManagedInstallType;
161
- strategy: 'grouped' | 'manual';
231
+ strategy: 'grouped' | 'manual' | 'self-update';
162
232
  }
163
233
  interface UpdatePlan {
164
234
  entries: UpdatePlanEntry[];
165
235
  grouped: Record<ManagedInstallType, UpdatePlanEntry[]>;
166
236
  manual: UpdatePlanEntry[];
237
+ skippedManualCheck: AgentInspection[];
167
238
  upToDate: AgentInspection[];
168
239
  }
169
240
  declare function createUpdatePlan(inspections: AgentInspection[]): UpdatePlan;
170
241
  declare function isInspectionUpdateAvailable(inspection: Pick<AgentInspection, 'installedVersion' | 'latestVersion'>): boolean;
171
242
  //#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;
243
+ //#region src/release-artifacts/index.d.ts
244
+ type ReleaseChannel = 'beta' | 'stable';
245
+ interface ReleaseArtifactTarget {
246
+ arch: 'arm64' | 'x64';
247
+ platform: 'darwin' | 'linux' | 'win32';
181
248
  }
182
- interface SelfUpdateResult {
183
- installSource: SelfInstallSource;
184
- success: boolean;
249
+ interface ReleaseManifestAsset extends ReleaseArtifactTarget {
250
+ checksum: string;
251
+ downloadUrl: string;
252
+ name: string;
253
+ size: number;
185
254
  }
186
- declare function inspectSelf(): Promise<SelfInspection>;
255
+ interface ReleaseManifest {
256
+ assets: ReleaseManifestAsset[];
257
+ channel: ReleaseChannel;
258
+ version: string;
259
+ }
260
+ declare function formatChecksums(entries: Array<{
261
+ checksum: string;
262
+ name: string;
263
+ }>): string;
264
+ declare function parseChecksums(contents: string): Map<string, string>;
265
+ declare function parseBinaryTarget(name: string): ReleaseArtifactTarget | undefined;
266
+ declare function normalizeRepositoryUrl(repositoryUrl?: string): string;
267
+ declare function resolveReleaseChannel(version: string): ReleaseChannel;
268
+ declare function createReleaseManifest(input: {
269
+ checksums: Map<string, string>;
270
+ files: Array<{
271
+ name: string;
272
+ size: number;
273
+ }>;
274
+ repositoryUrl?: string;
275
+ version: string;
276
+ }): ReleaseManifest;
277
+ declare function validateReleaseManifest(manifest: ReleaseManifest, checksums: Map<string, string>): void;
278
+ //#endregion
279
+ //#region src/self/recovery.d.ts
280
+ declare function getSelfUpgradeRecoveryHint(installSource: SelfInstallSource, executablePath: string, updateChannel?: SelfUpdateChannel, result?: SelfUpdateResult): string | undefined;
281
+ declare function getSelfUpgradeRecoveryHintForInspection(inspection: SelfInspection, result?: SelfUpdateResult): string | undefined;
282
+ //#endregion
283
+ //#region src/self/release.d.ts
284
+ declare function getBinaryReleaseAssetName(executablePath?: string): string | undefined;
285
+ declare function getBinaryReleaseDownloadUrl(executablePath?: string): string | undefined;
286
+ //#endregion
287
+ //#region src/self/index.d.ts
288
+ declare function inspectSelf(options?: {
289
+ updateChannel?: SelfUpdateChannel;
290
+ }): Promise<SelfInspection>;
187
291
  declare function upgradeSelf(inspection?: SelfInspection): Promise<SelfUpdateResult>;
188
292
  declare function canAutoUpdateSelf(installSource: SelfInstallSource): boolean;
189
- declare function detectSelfInstallSource(packageRoot: string): SelfInstallSource;
293
+ declare function detectSelfInstallSource(packageRoot: string, executablePath?: string): SelfInstallSource;
294
+ declare function getSelfVersion(): string;
295
+ declare function getManualSelfUpgradeCommand(installSource: SelfInstallSource, executablePath?: string): string | undefined;
190
296
  //#endregion
191
297
  //#region src/services/agents.d.ts
192
298
  interface ResolvedAgentInspection {
@@ -201,7 +307,10 @@ declare function inspectRegisteredAgents(): Promise<AgentInspection[]>;
201
307
  interface PendingAgentUpdate {
202
308
  agent: AgentDefinition;
203
309
  inspection: AgentInspection;
310
+ installerType?: ManagedInstallType;
311
+ package?: ManagedPackageSpec;
204
312
  state?: InstalledAgentState;
313
+ strategy: AgentUpdateStrategy;
205
314
  }
206
315
  interface ManagedUpdateBucket {
207
316
  type: ManagedInstallType;
@@ -212,6 +321,7 @@ interface PlannedAgentUpdates {
212
321
  entries: PendingAgentUpdate[];
213
322
  grouped: ManagedUpdateBucket[];
214
323
  manual: PendingAgentUpdate[];
324
+ skippedManualCheck: AgentInspection[];
215
325
  upToDate: AgentInspection[];
216
326
  }
217
327
  interface SingleAgentUpdateStatus {
@@ -235,8 +345,8 @@ declare function execCommand(command: string, args: string[]): Promise<{
235
345
  }>;
236
346
  //#endregion
237
347
  //#region src/utils/version.d.ts
238
- declare function getInstalledVersion(binaryName: string): Promise<string | undefined>;
239
- declare function getLatestVersion(packageName: string): Promise<string | undefined>;
348
+ declare function getInstalledVersion(binaryName: string, versionProbe?: AgentVersionProbe): Promise<string | undefined>;
349
+ declare function getLatestVersion(packageName: string, distTag?: string): Promise<string | undefined>;
240
350
  declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
241
351
  //#endregion
242
- export { type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type BinaryInstallMethod, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createUpdatePlan, cursor, detectSelfInstallSource, droid, execCommand, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getOrderedInstallMethods, getPlatform, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, opencode, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, saveConfig, saveState, setInstalledAgentState, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf };
352
+ export { type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type AgentSelfUpdate, type AgentUpdateContext, type AgentUpdateProvider, type AgentUpdateStrategy, type AgentVersionProbe, 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 ReleaseArtifactTarget, type ReleaseChannel, type ReleaseManifest, type ReleaseManifestAsset, type ResolvedAgentInspection, type ScriptInstallMethod, type SelfInspection, type SelfInstallSource, type SelfState, type SelfUpdateResult, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, agentUpdateProviders, canAutoUpdateSelf, canLookupLatestVersionForInstallType, canResolveAgentUpdate, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createReleaseManifest, createUpdatePlan, cursor, detectSelfInstallSource, droid, execCommand, formatChecksums, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAgentUpdateFailureHint, getAgentUpdateStrategy, getAllAgents, getBinaryPath, getBinaryReleaseAssetName, getBinaryReleaseDownloadUrl, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getManualAgentUpdateMessage, getManualSelfUpgradeCommand, getOrderedInstallMethods, getPlatform, getSelfState, getSelfUpgradeRecoveryHint, getSelfUpgradeRecoveryHintForInspection, getSelfVersion, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, inspectSelf, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, normalizeRepositoryUrl, opencode, parseBinaryTarget, parseChecksums, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, resolveAgentUpdateProvider, resolveReleaseChannel, saveConfig, saveState, setInstalledAgentState, setSelfInstallSource, uninstallAgent, updateAgent, updateAgentsByType, upgradeSelf, validateReleaseManifest };
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
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
+ import{a as e,i as t,n,o as r,s as i,t as a}from"./update-C6oNB0Kw.mjs";import{A as ee,B as te,C as ne,D as re,E as o,H as s,L as c,M as l,O as u,R as d,S as f,T as p,V as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,n as E,o as D,p 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-BALRvoqc.mjs";import{a as R,i as z,n as B,t as V}from"./config-DWeRAIFV.mjs";import{_ as ie,b as H,g as U,h as W,m as G,n as K,p as q,r as J,t as Y,v as ae,y as oe}from"./version-CrMPGstC.mjs";import{a as se,c as ce,i as le,l as ue,n as de,o as fe,r as pe,s as me,t as he,u as ge}from"./self-Bj9L_tIu.mjs";function X(e){return`${e.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>`${e.checksum} ${e.name}`).join(`
2
+ `)}\n`}function _e(e){let t=new Map;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let[r,i]=e.split(/\s+/,2),a=i?.replace(/^\*/,``);r&&a&&t.set(a,r)}return t}function Z(e){let t=e.match(/^quantex-(darwin|linux|windows)-(arm64|x64)(?:\.exe)?$/);if(t)return{arch:t[2]===`arm64`?`arm64`:`x64`,platform:t[1]===`windows`?`win32`:t[1]===`darwin`?`darwin`:`linux`}}function Q(e){return e?e.startsWith(`git+`)?e.slice(4).replace(/\.git$/,``):e.startsWith(`git@github.com:`)?e.replace(`git@github.com:`,`https://github.com/`).replace(/\.git$/,``):e.replace(/\.git$/,``):`https://github.com/Drswith/quantex-cli`}function $(e){return e.includes(`beta`)?`beta`:`stable`}function ve(e){let t=Q(e.repositoryUrl),n=$(e.version),r=e.files.map(n=>{let r=Z(n.name);if(!r)return;let i=e.checksums.get(n.name);if(!i)throw Error(`Missing checksum entry for ${n.name}.`);return{arch:r.arch,checksum:i,downloadUrl:`${t}/releases/download/v${e.version}/${n.name}`,name:n.name,platform:r.platform,size:n.size}}).filter(e=>e!==void 0).sort((e,t)=>e.name.localeCompare(t.name));if(r.length===0)throw Error(`No release binaries were found when creating manifest.json.`);return{assets:r,channel:n,version:e.version}}function ye(e,t){if(e.assets.length===0)throw Error(`manifest.json must contain at least one binary asset.`);for(let n of e.assets){let e=t.get(n.name);if(!e)throw Error(`manifest.json references ${n.name}, but it is missing from SHA256SUMS.txt.`);if(n.checksum!==e)throw Error(`manifest.json checksum mismatch for ${n.name}.`);if(!Z(n.name))throw Error(`manifest.json contains an invalid binary asset name: ${n.name}.`)}}async function be(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{w as agentUpdateProviders,he as canAutoUpdateSelf,c as canLookupLatestVersionForInstallType,ee as canResolveAgentUpdate,d as canUninstallInstallType,L as canUpdateInstallType,u as claude,re as codex,o as copilot,ve as createReleaseManifest,t as createUpdatePlan,p as cursor,de as detectSelfInstallSource,P as droid,be as execCommand,X as formatChecksums,ne as gemini,N as getAgentByLookupName,I as getAgentByNameOrAlias,r as getAgentUpdateFailureHint,C as getAgentUpdateStrategy,g as getAllAgents,Y as getBinaryPath,ue as getBinaryReleaseAssetName,ge as getBinaryReleaseDownloadUrl,V as getConfigDir,B as getConfigFilePath,te as getInstallLifecycle,q as getInstalledAgentState,K as getInstalledVersion,m as getInstallerCapabilities,J as getLatestVersion,v as getManagedInstaller,i as getManualAgentUpdateMessage,pe as getManualSelfUpgradeCommand,D as getOrderedInstallMethods,y as getPlatform,G as getSelfState,me as getSelfUpgradeRecoveryHint,ce as getSelfUpgradeRecoveryHintForInspection,le as getSelfVersion,a as getSingleAgentUpdateStatus,W as getStateFilePath,S as inspectAgent,h as inspectAllAgents,j as inspectRegisteredAgents,se as inspectSelf,A as installAgent,O as isBinaryInPath,x as isBunAvailable,e as isInspectionUpdateAvailable,s as isManagedInstallType,b as isNpmAvailable,z as loadConfig,U as loadState,Q as normalizeRepositoryUrl,f as opencode,Z as parseBinaryTarget,_e as parseChecksums,F as pi,n as planAgentUpdates,ie as removeInstalledAgentState,E as resolveAgent,k as resolveAgentInspection,l as resolveAgentUpdateProvider,$ as resolveReleaseChannel,R as saveConfig,ae as saveState,oe as setInstalledAgentState,H as setSelfInstallSource,_ as uninstallAgent,T as updateAgent,M as updateAgentsByType,fe as upgradeSelf,ye as validateReleaseManifest};
@@ -0,0 +1,2 @@
1
+ import{F as e,P as t,r as n}from"./agents-BALRvoqc.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}`);let c=o.selfUpdate?[o.selfUpdate.command,...o.selfUpdate.fallbackCommands??[]].map(e=>e.join(` `)).join(` || `):`-`;console.log(` Update: ${c}`),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};
@@ -1 +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};
1
+ import{r as e,s as t}from"./agents-BALRvoqc.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-XO_wlQaK.mjs";import t from"picocolors";async function n(){let n=await e();console.log(t.bold(`
1
+ import{t as e}from"./agents-BALRvoqc.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
+ export { };
@@ -0,0 +1 @@
1
+ import{mkdir as e,readFile as t,writeFile as n}from"node:fs/promises";import{homedir as r}from"node:os";import{dirname as i,join as a}from"node:path";import o from"node:process";function s(e=o.env){if(!f(e))return;let t=e.npm_config_user_agent?.toLowerCase()??``;if(t.startsWith(`bun/`))return`bun`;if(t.startsWith(`npm/`))return`npm`}async function c(e=o.env){let t=s(e);return t?(await l(t,e),!0):!1}async function l(t,r=o.env){let a=u(r),s=await m(a);s.installedAgents??={},s.self??={},s.self.installSource=t,await e(i(a),{recursive:!0}),await n(a,`${JSON.stringify(s,null,2)}\n`,`utf8`)}function u(e=o.env){return a(d(e),`state.json`)}function d(e=o.env){return a(p(e),`.quantex`)}function f(e){return e.npm_config_global===`true`||e.npm_config_location===`global`}function p(e){return e.HOME||e.USERPROFILE||r()}async function m(e){try{return JSON.parse(await t(e,`utf8`))}catch{return{}}}h();async function h(){try{await c(o.env)}catch{}}export{};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./config-DWeRAIFV.mjs";import{b as n,d as r,i,m as a,r as o,s}from"./version-CrMPGstC.mjs";import{chmod as c,mkdir as l,mkdtemp as u,readFile as d,rename as f,rm as p,stat as m,writeFile as h}from"node:fs/promises";import{basename as g,dirname as _,join as v}from"node:path";import y from"node:process";import{fileURLToPath as b}from"node:url";import{Buffer as x}from"node:buffer";import{createHash as S}from"node:crypto";const C=`quantex-cli`,w=`https://github.com/Drswith/quantex-cli`,T=`0.0.1`;function E(){return v(t(),`locks`,`self-upgrade.lock`)}async function D(){let e=E();await l(_(e),{recursive:!0});try{await l(e,{recursive:!1})}catch(e){if(typeof e==`object`&&e&&`code`in e&&e.code===`EEXIST`)return;throw e}return async()=>{await p(e,{force:!0,recursive:!0})}}async function ee(e,t,n,r){let i;try{i=await fetch(e)}catch(t){return A(`network`,`Failed to download ${e}.`,t)}if(!i.ok)return A(`network`,`Failed to download ${e}: HTTP ${i.status}.`);let a=await u(v(_(t),`.quantex-upgrade-`)),o=v(a,g(t)),s=`${t}.bak`;try{let l=x.from(await i.arrayBuffer()),u=await te(t),d=ie(l);if(d!==N(n))return A(`checksum`,`Checksum mismatch for ${e}. Expected ${N(n)}, got ${d}.`);if(await h(o,l),y.platform===`win32`)return ne(o,t,s,a,r);await c(o,u),await p(s,{force:!0}),await f(t,s),await f(o,t);let m=await re(t,r);return m.success?(await p(s,{force:!0}),{success:!0}):(await M(s,t),m)}catch(e){return A(j(e),`Failed to replace the current Quantex binary.`,e)}finally{y.platform!==`win32`&&await p(a,{recursive:!0,force:!0})}}async function te(e){try{return(await m(e)).mode&511}catch{return 493}}function ne(e,t,n,r,i){try{let a=O(e,t,n,r,y.pid,i);return Bun.spawn([`powershell.exe`,`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-WindowStyle`,`Hidden`,`-Command`,a],{stdio:[`ignore`,`ignore`,`ignore`],windowsHide:!0}).unref?.(),{success:!0}}catch(e){return A(`locked`,`Failed to schedule Windows binary replacement.`,e)}}function O(e,t,n,r,i,a){let o=k(e),s=k(t),c=k(n),l=k(r),u=k(a??``);return[`$pidToWait = ${i}`,`$tempPath = '${o}'`,`$targetPath = '${s}'`,`$backupPath = '${c}'`,`$tempDir = '${l}'`,`$expectedVersion = '${u}'`,`while (Get-Process -Id $pidToWait -ErrorAction SilentlyContinue) { Start-Sleep -Milliseconds 200 }`,`for ($attempt = 0; $attempt -lt 50; $attempt++) {`,` try {`,` if (Test-Path -LiteralPath $backupPath) { Remove-Item -LiteralPath $backupPath -Force -ErrorAction SilentlyContinue }`,` Move-Item -LiteralPath $targetPath -Destination $backupPath -Force -ErrorAction Stop`,` break`,` }`,` catch {`,` Start-Sleep -Milliseconds 200`,` }`,`}`,`Move-Item -LiteralPath $tempPath -Destination $targetPath -Force`,`if ($expectedVersion -ne '') {`,` $output = & $targetPath --version 2>$null`,` if ($LASTEXITCODE -ne 0 -or ($output -notmatch [regex]::Escape($expectedVersion))) {`,` Remove-Item -LiteralPath $targetPath -Force -ErrorAction SilentlyContinue`,` Move-Item -LiteralPath $backupPath -Destination $targetPath -Force`,` Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`,` exit 1`,` }`,`}`,`Remove-Item -LiteralPath $backupPath -Force -ErrorAction SilentlyContinue`,`Remove-Item -LiteralPath $tempDir -Force -Recurse -ErrorAction SilentlyContinue`].join(`; `)}function k(e){return e.replaceAll(`'`,`''`)}function A(e,t,n){return{error:{detail:n,kind:e,message:t},success:!1}}function j(e){let t=typeof e==`object`&&e&&`code`in e?String(e.code):``;return t===`EACCES`||t===`EPERM`?`permission`:t===`EBUSY`?`locked`:`unknown`}async function M(e,t){await p(t,{force:!0}),await f(e,t)}async function re(e,t){if(!t)return{success:!0};try{let n=Bun.spawn([e,`--version`],{stdio:[`ignore`,`pipe`,`ignore`]}),r=n.stdout?await new Response(n.stdout).text():``,i=await n.exited;return i===0?r.includes(t)?{success:!0}:A(`verify`,`The upgraded Quantex binary reported an unexpected version during verification.`):A(`verify`,`The upgraded Quantex binary exited with code ${i} during verification.`)}catch(e){return A(`verify`,`Failed to execute the upgraded Quantex binary for verification.`,e)}}function ie(e){return S(`sha256`).update(e).digest(`hex`)}function N(e){return e.trim().toLowerCase()}function P(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function F(e=y.execPath){if(g(P(e)).endsWith(`.exe`))return`quantex-windows-x64.exe`;if(y.platform===`darwin`)return y.arch===`arm64`?`quantex-darwin-arm64`:`quantex-darwin-x64`;if(y.platform===`linux`)return y.arch===`arm64`?`quantex-linux-arm64`:`quantex-linux-x64`}function I(e=y.execPath){let t=F(e);if(t)return`${w}/releases/latest/download/${t}`}function L(e,t,n=y.env){return e||(n.QUANTEX_UPDATE_CHANNEL===`beta`?`beta`:n.QUANTEX_UPDATE_CHANNEL===`stable`?`stable`:t===`beta`?`beta`:`stable`)}async function R(e){let t=await i(await z(e),`self:manifest:${e}`);if(!t)throw Error(`Failed to download release manifest.`);return t}async function z(e){if(e===`stable`)return`${w}/releases/latest/download/manifest.json`;let t=(await B(e)).assets.find(e=>e.name===`manifest.json`);if(!t?.browser_download_url)throw Error(`No manifest.json asset was found for the ${e} release channel.`);return t.browser_download_url}async function B(e){let t=H();if(!t)throw Error(`Failed to resolve the GitHub repository slug for Quantex releases.`);let n=await i(`https://api.github.com/repos/${t}/releases?per_page=20`,`self:github-releases`);if(!n)throw Error(`Failed to query GitHub releases.`);let r=n.find(t=>e===`beta`?t.prerelease:!t.prerelease);if(!r)throw Error(`No GitHub release was found for the ${e} channel.`);return r}function V(e,t=y.execPath){let n=y.platform,r=y.arch===`arm64`?`arm64`:`x64`,i=F(t);return e.assets.find(e=>e.platform===n&&e.arch===r&&(!i||e.name===i))}function H(){return w.match(/github\.com\/([^/]+\/[^/]+)$/)?.[1]}const U={source:`binary`,canHandle:e=>e.installSource===`binary`,getRecoveryHint:(e,t)=>{let n=t?.error?.detail&&typeof t.error.detail==`object`&&`downloadUrl`in t.error.detail?String(t.error.detail.downloadUrl):I(e.executablePath);if(n)return t?.error?.kind===`locked`?`close other qtx processes and retry, or download and replace the binary from ${n}`:t?.error?.kind===`permission`?`check write permission for the current binary path, or download and replace the binary from ${n}`:t?.error?.kind===`network`?`check network access and retry, or download and replace the binary from ${n}`:`download and replace the binary from ${n}`},async upgrade(e){if(!F(e.executablePath))return{error:{kind:`unsupported`,message:`No release artifact is available for the current platform and architecture.`},installSource:e.installSource,success:!1};let t;try{t=await R(e.updateChannel)}catch(t){return{error:{detail:t,kind:`network`,message:`Failed to resolve the ${e.updateChannel} release manifest.`},installSource:e.installSource,success:!1}}let n=V(t,e.executablePath);if(!n)return{error:{detail:{channel:e.updateChannel},kind:`unsupported`,message:`No binary asset is available for the current platform on the ${e.updateChannel} channel.`},installSource:e.installSource,success:!1};let r=await ee(n.downloadUrl,e.executablePath,n.checksum,t.version);return{...!r.success&&r.error?{...r,error:{...r.error,detail:{...typeof r.error.detail==`object`&&r.error.detail?r.error.detail:{},downloadUrl:n.downloadUrl}}}:r,installSource:e.installSource,newVersion:r.success?t.version:void 0}}},W={source:`bun`,canHandle:e=>e.installSource===`bun`,getRecoveryHint:e=>`bun add -g ${C}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await r(C,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${C} through Bun.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}},G={source:`npm`,canHandle:e=>e.installSource===`npm`,getRecoveryHint:e=>`npm install -g ${C}@${e.updateChannel===`beta`?`beta`:`latest`}`,async upgrade(e){let t=await s(C,`latest-major`,e.updateChannel===`beta`?`beta`:`latest`);return{error:t?void 0:{kind:`unknown`,message:`Failed to update ${C} through npm.`},installSource:e.installSource,newVersion:t?e.latestVersion:void 0,success:t}}},K={source:`source`,canHandle:e=>e.installSource===`source`||e.installSource===`unknown`,getRecoveryHint:()=>void 0,async upgrade(e){return{error:{kind:`unsupported`,message:`Install source "${e.installSource}" does not support auto-update.`},installSource:e.installSource,success:!1}}},q=[W,G,U,K];function ae(e){return q.find(t=>t.canHandle(e))??K}function J(e,t,n=`stable`,r){if(r?.error?.kind===`locked`)return`another qtx upgrade is already running; wait for it to finish and retry`;if(e===`bun`)return`bun add -g ${C}@${n===`beta`?`beta`:`latest`}`;if(e===`npm`)return`npm install -g ${C}@${n===`beta`?`beta`:`latest`}`;if(e===`binary`){let e=I(t);return e?r?.error?.kind===`permission`?`check write permission for the current binary path, or download and replace the binary from ${e}`:r?.error?.kind===`network`?`check network access and retry, or download and replace the binary from ${e}`:`download and replace the binary from ${e}`:void 0}}function oe(e,t){return J(e.installSource,e.executablePath,e.updateChannel,t)}const Y=C,se=`/node_modules/${Y}`;async function X(t){let n=await ue(),r=y.execPath,i=n.foundPackageJson?Q(n.packageRoot):Q(``,r),o=await le((await a()).installSource,i),s=await e(),c=L(t?.updateChannel,s.selfUpdateChannel),l=await pe(o,r,c);return{canAutoUpdate:Z(o),currentVersion:n.version||`0.0.1`,executablePath:r,installSource:o,latestVersion:l,packageRoot:n.packageRoot,recommendedUpgradeCommand:Z(o)?`quantex upgrade`:void 0,updateChannel:c}}async function ce(e){let t=e??await X(),n=await D();if(!n)return{error:{kind:`locked`,message:`Another qtx upgrade is already running.`},installSource:t.installSource,success:!1};try{return await ae(t).upgrade(t)}finally{await n()}}function Z(e){return e===`binary`||e===`bun`||e===`npm`}async function le(e,t){return t!==`unknown`&&e!==t?(await n(t),t):e??t}function Q(e,t=y.execPath){let n=$(e);return n.includes(`/.bun/install/global/`)?`bun`:n.includes(se)?`npm`:n?`source`:he(t)?`binary`:`unknown`}async function ue(e=import.meta.url){let t=ge(e),n=_(t);for(;;){let e=v(n,`package.json`),t=await me(e);if(t?.name===Y)return{foundPackageJson:!0,packageJsonPath:e,packageRoot:n,version:t.version??`0.0.1`};let r=_(n);if(r===n)break;n=r}return{foundPackageJson:!1,packageJsonPath:v(_(t),`package.json`),packageRoot:_(t),version:T}}function de(){return T}function fe(e,t=y.execPath){return J(e,t)}async function pe(e,t,n){if(e===`binary`)try{let e=await R(n);return V(e,t)?e.version:void 0}catch{return}return o(Y,n===`beta`?`beta`:`latest`)}async function me(e){try{return JSON.parse(await d(e,`utf8`))}catch{return}}function $(e){return e.replaceAll(`\\`,`/`).toLowerCase()}function he(e){let t=g($(e));return t!==`bun`&&t!==`bun.exe`}function ge(e){try{return b(e)}catch{return y.execPath}}export{X as a,oe as c,de as i,F as l,Q as n,ce as o,fe as r,J as s,Z as t,I as u};
@@ -1 +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};
1
+ import{c as e,n as t}from"./agents-BALRvoqc.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{I as e,M as t,N as n,i as r,t as i}from"./agents-BALRvoqc.mjs";function a(e){return`${e.displayName} uses a manually managed install source. Please check for updates manually.`}function o(e,t){if(t===`self-update`&&e.selfUpdate)return`Try running ${e.selfUpdate.command.join(` `)} directly.`;if(t===`manual-hint`)return`Check ${e.homepage} for the recommended update path.`}function s(e){let n={bun:[],npm:[],brew:[],winget:[]},r=[],i=[],a=[];for(let o of e){if(!o.inPath)continue;if(l(o)){i.push(o);continue}if(!c(o)){a.push(o);continue}let e=t({agent:o.agent,installedState:o.installedState,methods:o.methods}),s=e.strategy===`managed`?e.getManagedInstallerType?.({agent:o.agent,installedState:o.installedState,methods:o.methods}):void 0;if(s){let e={inspection:o,installerType:s,strategy:`grouped`};n[s].push(e);continue}r.push({inspection:o,strategy:e.strategy===`self-update`?`self-update`:`manual`})}return{entries:[...n.bun,...n.npm,...n.brew,...n.winget,...r],grouped:n,manual:r,skippedManualCheck:i,upToDate:a}}function c(e){return e.installedVersion&&e.latestVersion?e.installedVersion!==e.latestVersion:!0}function l(e){return!e.latestVersion&&!n(e.agent,e.installedState)}const u=[`bun`,`npm`,`brew`,`winget`];async function d(e){let t=await r(e);return{agent:e,inspection:t,updateAvailable:c(t)}}async function f(){return m(await i())}async function p(e){let t=await r(e);return{inspection:t,plan:m([t])}}function m(e){let t=s(e),n=u.map(e=>h(e,t.grouped[e])).filter(e=>e!==void 0);return{entries:t.entries.map(e=>g(e.inspection)),grouped:n,manual:t.manual.map(e=>g(e.inspection)),skippedManualCheck:t.skippedManualCheck,upToDate:t.upToDate}}function h(e,t){if(t.length===0)return;let n=t.map(e=>g(e.inspection));return{type:e,packages:n.flatMap(e=>e.package?.packageName?[e.package]:[]),updates:n}}function g(e){let n=t({agent:e.agent,installedState:e.installedState,methods:e.methods}),r=n.getManagedInstallerType?.({agent:e.agent,installedState:e.installedState,methods:e.methods});return{agent:e.agent,inspection:e,installerType:r,package:r?_(e.agent,e.installedState,e.methods,r):void 0,state:e.installedState,strategy:n.strategy}}function _(t,n,r,i){if(n?.packageName&&n.installType===i)return{packageName:n.packageName,packageTargetKind:n.packageTargetKind};let a=r.find(e=>e.type===i);if(!a)return;let o=e(t,a);if(o)return{packageName:o,packageTargetKind:a.packageTargetKind}}export{c as a,s as i,f as n,o,p as r,a as s,d as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,r as n,s as r,t as i}from"./update-C6oNB0Kw.mjs";import{N as a,j as o,l as s,n as c,u as l,z as u}from"./agents-BALRvoqc.mjs";import d from"picocolors";async function f(e,t){if(t){await p();return}if(!e){console.log(d.red(`Please specify an agent name or use --all flag`));return}let n=c(e);if(!n){console.log(d.red(`Unknown agent: ${e}`));return}await g(n)}async function p(){await m(await e())}async function m(e){for(let t of e.upToDate)console.log(d.green(`${t.agent.displayName} is up to date (${t.installedVersion??`unknown`})`));for(let t of e.skippedManualCheck)console.log(d.yellow(r(t.agent)));for(let t of e.entries)console.log(d.cyan(`Updating ${t.agent.displayName} via ${y(t)}...${v(t.inspection.installedVersion,t.inspection.latestVersion)}`));for(let t of e.grouped)await h(t.type,t.packages,t.updates);for(let t of e.manual)await _(t.agent,t.state,t.inspection.methods,!1)}async function h(e,t,n){if(n.length!==0){if(await l(e,t)){for(let{agent:e}of n)console.log(d.green(`${e.displayName} updated successfully!`));return}for(let{agent:e,state:t}of n)await _(e,t,void 0,!1)}}async function g(e){let{inspection:t,plan:i}=await n(e);if(!t.inPath){console.log(d.red(`${e.displayName} is not installed.`));return}if(i.upToDate.length>0){console.log(d.green(`${e.displayName} is up to date (${t.installedVersion??`unknown`})`));return}if(i.skippedManualCheck.length>0){console.log(d.yellow(r(e)));return}await m(i)}async function _(e,n,c,l=!0){if(l){let{inspection:t}=await i(e);console.log(d.cyan(`Updating ${e.displayName}...${v(t.installedVersion,t.latestVersion)}`)),c=t.methods}let f=o({agent:e,installedState:n,methods:c??[]});if(f===`manual-hint`&&!a(e,n)&&!c?.some(e=>u(e.type))){console.log(d.yellow(r(e)));return}if((await s(e,n)).success)console.log(d.green(`${e.displayName} updated successfully!`));else{console.log(d.red(`Failed to update ${e.displayName}.`));let n=t(e,f);n&&console.log(d.yellow(n))}}function v(e,t){return e?` (${e} -> ${t??`latest`})`:``}function y(e){return e.strategy===`managed`?`managed/${e.installerType??e.state?.installType??`unknown`}`:e.strategy===`self-update`?`self-update`:`manual-hint`}export{f as updateCommand};
@@ -0,0 +1 @@
1
+ import{a as e,c as t,o as n}from"./self-Bj9L_tIu.mjs";import r from"picocolors";async function i(i={}){let a=await e({updateChannel:i.channel});if(a.latestVersion&&a.latestVersion===a.currentVersion)return console.log(r.green(`Quantex CLI is already up to date (${a.currentVersion}).`)),0;if(i.check)return a.latestVersion?(console.log(r.yellow(`Update available for Quantex CLI: ${a.currentVersion} -> ${a.latestVersion} (${a.updateChannel}).`)),1):(console.log(r.yellow(`Unable to determine the latest Quantex CLI version.`)),2);if(!a.canAutoUpdate){console.log(r.yellow(`Quantex CLI cannot auto-update from the current install source: ${a.installSource}.`));let e=t(a);return e&&console.log(r.cyan(`Manual upgrade: ${e}`)),2}let o=a.latestVersion?` (${a.currentVersion} -> ${a.latestVersion})`:` (${a.currentVersion})`;console.log(r.cyan(`Upgrading Quantex CLI...${o}`));let s=await n(a);if(s.success)return console.log(r.green(`Quantex CLI upgraded successfully.`)),0;{console.log(r.red(`Failed to upgrade Quantex CLI.`)),s.error?.message&&console.log(r.yellow(`Reason: ${s.error.message}`));let e=t(a,s);return e&&console.log(r.cyan(`Manual recovery: ${e}`)),2}}export{i as upgradeCommand};
@@ -0,0 +1,4 @@
1
+ import{i as e,t}from"./config-DWeRAIFV.mjs";import{mkdir as n,readFile as r,writeFile as i}from"node:fs/promises";import{join as a}from"node:path";import o from"node:process";const s={installedAgents:{},self:{}};function c(){return a(t(),`state.json`)}async function l(){try{let e=await Bun.file(c()).json();return{installedAgents:e.installedAgents??{},self:e.self??{}}}catch{return{...s}}}async function u(e){await n(t(),{recursive:!0}),await Bun.write(c(),`${JSON.stringify(e,null,2)}\n`)}async function d(e){return(await l()).installedAgents[e]}async function f(e){let t=await l();t.installedAgents[e.agentName]=e,await u(t)}async function p(e){let t=await l();delete t.installedAgents[e],await u(t)}async function m(){return(await l()).self}async function h(e){let t=await l();t.self.installSource=e,await u(t)}async function g(e){try{return await b([`bun`,`add`,`-g`,e],[e])}catch{return!1}}async function _(e,t=`latest-major`,n=`latest`){try{let r=n===`latest`?e:`${e}@${n}`;return await b([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],r],[e])}catch{return!1}}async function v(e,t=`latest-major`){if(e.length===0)return!0;try{return await b([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],e)}catch{return!1}}async function y(e){try{let t=Bun.spawn([`bun`,`remove`,`-g`,e],{stdio:w()});return await t.exited,t.exitCode===0}catch{return!1}}async function b(e,t){let n=Bun.spawn(e,{stdio:w()});return await n.exited,n.exitCode===0?x(t):!1}async function x(e){let t=[...new Set(e)];if(t.length===0)return!0;let n=await S();if(!n)return!0;let r=C(n),i=t.filter(e=>r.has(e));if(i.length===0)return!0;let a=Bun.spawn([`bun`,`pm`,`-g`,`trust`,...i],{stdio:w()});return await a.exited,a.exitCode===0}async function S(){try{let e=Bun.spawn([`bun`,`pm`,`-g`,`untrusted`],{stdio:T()}),t=await new Response(e.stdout).text();return await e.exited,e.exitCode===0?t:void 0}catch{return}}function C(e){let t=new Set;for(let n of e.split(`
2
+ `)){let e=n.match(/^\.\/node_modules\/(.+?) @/);e?.[1]&&t.add(e[1])}return t}function w(){return[`inherit`,`inherit`,`inherit`]}function T(){return[`ignore`,`pipe`,`ignore`]}async function E(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 D(e,t=`latest-major`,n=`latest`){try{let r=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@${n}`]:[`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function O(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 k(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 A(e,t){let n=await j(e,t,`json`);if(n)try{return JSON.parse(n)}catch{return}}async function j(t,n,r=`text`){let i=await e(),a=await N(),o=a.entries[n],s=Date.now();if(o&&o.expiresAt>s)return o.body;let c=await M(t,{headers:o?.etag?{"If-None-Match":o.etag}:void 0,retries:i.networkRetries,timeoutMs:i.networkTimeoutMs});if(!c)return o?.body;if(c.status===304&&o)return a.entries[n]={...o,expiresAt:s+i.versionCacheTtlHours*60*60*1e3},await P(a),o.body;if(!c.ok)return o?.body;let l=await c.text();if(r===`json`)try{JSON.parse(l)}catch{return o?.body}return a.entries[n]={body:l,etag:c.headers.get(`etag`)??void 0,expiresAt:s+i.versionCacheTtlHours*60*60*1e3},await P(a),l}async function M(e,t){for(let n=0;n<=t.retries;n++){let r=new AbortController,i=setTimeout(()=>r.abort(),t.timeoutMs);try{return await fetch(e,{headers:t.headers,signal:r.signal})}catch{if(n===t.retries)return}finally{clearTimeout(i)}}}async function N(){try{return JSON.parse(await r(F(),`utf8`))}catch{return{entries:{}}}}async function P(e){await n(a(t(),`cache`),{recursive:!0}),await i(F(),`${JSON.stringify(e,null,2)}\n`,`utf8`)}function F(){return a(t(),`cache`,`versions.json`)}const I=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;function L(e,t){if(t)return t(e);let n=e.trim().split(`
3
+ `)[0],r=n.match(I);return r?r[1]:n||void 0}async function R(e,t){let n=t?.command??[e,`--version`];try{let e=Bun.spawn(n,{stdout:`pipe`,stderr:`pipe`});return await e.exited,e.exitCode===0?L(await new Response(e.stdout).text(),t?.parser):void 0}catch{return}}async function z(e,t=`latest`){try{return(await A(`https://registry.npmjs.org/${e}/${t}`,`npm:${e}:${t}`))?.version}catch{return}}async function B(e){try{let t=o.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(`
4
+ `)[0]:void 0}catch{return}}export{p as _,E as a,h as b,O as c,_ as d,v as f,l as g,c as h,A as i,g as l,m,R as n,k as o,d as p,z as r,D as s,B as t,y as u,u as v,f as y};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "quantex-cli",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.9",
4
+ "version": "0.0.1",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "description": "统一的 AI Agent CLI 管理工具,支持安装、更新、卸载、查询、快捷启动主流 AI 编程助手",
7
7
  "author": "Drswith <drswith@outlook.com>",
8
- "license": "MIT",
8
+ "license": "Apache-2.0",
9
9
  "homepage": "https://github.com/Drswith/quantex-cli#readme",
10
10
  "repository": {
11
11
  "type": "git",
@@ -26,15 +26,19 @@
26
26
  "qtx": "./dist/cli.mjs"
27
27
  },
28
28
  "files": [
29
- "dist"
29
+ "dist",
30
+ "scripts/postinstall.cjs"
30
31
  ],
31
32
  "scripts": {
33
+ "prebuild": "bun run scripts/write-build-metadata.ts",
32
34
  "build": "tsdown",
33
- "build:bin": "bun run scripts/build-bin.ts",
35
+ "build:bin": "bun run scripts/write-build-metadata.ts && bun run scripts/build-bin.ts",
34
36
  "lint:fix": "eslint --fix",
35
37
  "lint": "eslint",
36
38
  "prepublishOnly": "bun run build",
39
+ "postinstall": "node scripts/postinstall.cjs",
37
40
  "release": "bumpp",
41
+ "release:artifacts": "bun run scripts/write-release-checksums.ts && bun run scripts/generate-release-manifest.ts && bun run scripts/verify-release-artifacts.ts",
38
42
  "dev": "bun run src/cli.ts",
39
43
  "test": "vitest run",
40
44
  "test:watch": "vitest",
@@ -0,0 +1,9 @@
1
+ const { existsSync } = require('node:fs')
2
+ const { resolve } = require('node:path')
3
+ const { pathToFileURL } = require('node:url')
4
+
5
+ const entryPath = resolve(__dirname, '..', 'dist', 'postinstall.mjs')
6
+
7
+ if (existsSync(entryPath)) {
8
+ import(pathToFileURL(entryPath).href).catch(() => {})
9
+ }
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
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.
@@ -1 +0,0 @@
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};
@@ -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`,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};
@@ -1,3 +0,0 @@
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};
@@ -1,3 +0,0 @@
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};
@@ -1,2 +0,0 @@
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};
@@ -1 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./self-Dq9UgWVD.mjs";import n from"picocolors";async function r(){let r=await t();if(r.latestVersion&&r.latestVersion===r.currentVersion){console.log(n.green(`Quantex CLI is already up to date (${r.currentVersion}).`));return}if(!r.canAutoUpdate){console.log(n.yellow(`Quantex CLI cannot auto-update from the current install source: ${r.installSource}.`));return}let i=r.latestVersion?` (${r.currentVersion} -> ${r.latestVersion})`:` (${r.currentVersion})`;console.log(n.cyan(`Upgrading Quantex CLI...${i}`)),(await e(r)).success?console.log(n.green(`Quantex CLI upgraded successfully.`)):console.log(n.red(`Failed to upgrade Quantex CLI.`))}export{r as upgradeCommand};
@@ -1,3 +0,0 @@
1
- import e from"node:process";async function t(e){try{let t=Bun.spawn([`bun`,`add`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function n(e,t=`latest-major`){try{let n=Bun.spawn([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function r(e,t=`latest-major`){if(e.length===0)return!0;try{let n=Bun.spawn([`bun`,`update`,`-g`,...t===`latest-major`?[`--latest`]:[],...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function i(e){try{let t=Bun.spawn([`bun`,`remove`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function a(e){try{let t=Bun.spawn([`npm`,`i`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function o(e,t=`latest-major`){try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,`${e}@latest`]:[`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function s(e,t=`latest-major`){if(e.length===0)return!0;try{let n=Bun.spawn(t===`latest-major`?[`npm`,`install`,`-g`,...e.map(e=>`${e}@latest`)]:[`npm`,`update`,`-g`,...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function c(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}const l=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;async function u(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});if(await t.exited,t.exitCode!==0)return;let n=(await new Response(t.stdout).text()).trim().split(`
2
- `)[0],r=n.match(l);return r?r[1]:n||void 0}catch{return}}async function d(e){try{let t=await fetch(`https://registry.npmjs.org/${e}/latest`);return t.ok?(await t.json()).version:void 0}catch{return}}async function f(t){try{let n=e.platform===`win32`?`where`:`which`,r=Bun.spawn([n,t],{stdout:`pipe`,stderr:`pipe`});return await r.exited,r.exitCode===0?(await new Response(r.stdout).text()).trim().split(`
3
- `)[0]:void 0}catch{return}}export{c as a,t as c,r as d,a as i,i as l,u as n,o,d as r,s,f as t,n as u};