quantex-cli 0.0.1-beta.8 → 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 +201 -0
- package/README.md +108 -62
- package/dist/agents-BALRvoqc.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/config-B1BACpEg.mjs +3 -0
- package/dist/config-DWeRAIFV.mjs +1 -0
- package/dist/doctor-C3MeTdcd.mjs +3 -0
- package/dist/index.d.mts +148 -14
- package/dist/index.mjs +2 -1
- package/dist/info-m8Pm4m7N.mjs +2 -0
- package/dist/{install-Dq2l4GZ0.mjs → install-LlwsPjcI.mjs} +1 -1
- package/dist/{list-T8JHHWWE.mjs → list-C3iiju9D.mjs} +1 -1
- package/dist/postinstall.d.mts +1 -0
- package/dist/postinstall.mjs +1 -0
- package/dist/self-Bj9L_tIu.mjs +1 -0
- package/dist/{uninstall-C0tbY6DM.mjs → uninstall-BYGbg7Kt.mjs} +1 -1
- package/dist/update-C6oNB0Kw.mjs +1 -0
- package/dist/update-DTqFneka.mjs +1 -0
- package/dist/upgrade-CTQyBekz.mjs +1 -0
- package/dist/version-CrMPGstC.mjs +4 -0
- package/package.json +8 -4
- package/scripts/postinstall.cjs +9 -0
- package/LICENSE.md +0 -21
- package/dist/agents-BGk1FtW_.mjs +0 -3
- package/dist/config-D6elxlPI.mjs +0 -3
- package/dist/config-DvtBCQbQ.mjs +0 -1
- package/dist/doctor-DO48gMqu.mjs +0 -3
- package/dist/info-DeMHOB7s.mjs +0 -2
- package/dist/update-CzN4A4KH.mjs +0 -1
- package/dist/update-DIDtiDmr.mjs +0 -1
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,19 +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`
|
|
69
|
+
`quantex update` 和 `quantex update --all` 现在共用同一套更新策略层:
|
|
70
|
+
|
|
71
|
+
- `managed`:优先按 Quantex 已记录的安装来源更新
|
|
72
|
+
- `self-update`:使用 agent 自带的更新命令
|
|
73
|
+
- `manual-hint`:不自动更新,只给出明确提示
|
|
74
|
+
|
|
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`。
|
|
83
|
+
|
|
84
|
+
### 升级 Quantex CLI
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
quantex upgrade
|
|
88
|
+
|
|
89
|
+
# 只检查是否有更新
|
|
90
|
+
quantex upgrade --check
|
|
91
|
+
|
|
92
|
+
# 使用 beta channel
|
|
93
|
+
quantex upgrade --channel beta
|
|
94
|
+
```
|
|
60
95
|
|
|
61
|
-
|
|
62
|
-
- 通过 npm 安装的 agent 会合并为一条 `npm update -g ...`
|
|
63
|
-
- 通过 Homebrew 安装的 agent 会按记录的 formula/cask 标识逐个更新
|
|
64
|
-
- 通过 winget 安装的 agent 会按 `winget` 记录的包 ID 逐个更新
|
|
65
|
-
- 通过脚本、直装二进制或仅在 PATH 中探测到的 agent 不会被自动更新
|
|
96
|
+
当前自身升级支持:
|
|
66
97
|
|
|
67
|
-
|
|
98
|
+
- 通过 Bun 全局安装的 `quantex-cli`
|
|
99
|
+
- 通过 npm 全局安装的 `quantex-cli`
|
|
100
|
+
- 通过独立二进制安装的 `quantex`
|
|
101
|
+
|
|
102
|
+
Binary 自升级具备:
|
|
103
|
+
|
|
104
|
+
- release manifest 解析
|
|
105
|
+
- SHA256 checksum 校验
|
|
106
|
+
- 升级锁
|
|
107
|
+
- post-upgrade verify
|
|
108
|
+
- `.bak` 最小回滚
|
|
109
|
+
- Windows 延迟替换
|
|
110
|
+
|
|
111
|
+
如果升级失败,`upgrade` 和 `doctor` 都会给出与安装来源匹配的恢复方式。
|
|
68
112
|
|
|
69
113
|
### 卸载 Agent
|
|
70
114
|
|
|
@@ -77,15 +121,16 @@ quantex rm claude
|
|
|
77
121
|
|
|
78
122
|
```bash
|
|
79
123
|
quantex list
|
|
80
|
-
|
|
124
|
+
qtx ls
|
|
81
125
|
```
|
|
82
126
|
|
|
83
|
-
`list` 会显示每个 agent
|
|
127
|
+
`list` 会显示每个 agent 的安装状态、当前版本、更新方式和安装来源。例如:
|
|
84
128
|
|
|
85
129
|
- `managed update` 表示 Quantex 能按记录的安装器执行更新
|
|
130
|
+
- `command update` 表示当前 agent 支持自更新
|
|
86
131
|
- `manual update` 表示当前来源不支持自动更新
|
|
87
|
-
- `managed via bun (...)`、`managed via brew (...)`
|
|
88
|
-
- `detected in PATH` 表示命令存在,但不是由当前 Quantex
|
|
132
|
+
- `managed via bun (...)`、`managed via brew (...)` 表示有明确来源记录
|
|
133
|
+
- `detected in PATH` 表示命令存在,但不是由当前 Quantex 状态追踪到的安装
|
|
89
134
|
|
|
90
135
|
### 查看 Agent 详情
|
|
91
136
|
|
|
@@ -93,40 +138,31 @@ quantex ls
|
|
|
93
138
|
quantex info claude
|
|
94
139
|
```
|
|
95
140
|
|
|
96
|
-
`info`
|
|
97
|
-
|
|
98
|
-
- `managed/<installer>`,例如 `managed/bun`、`managed/brew`
|
|
99
|
-
- `unmanaged/script`,例如 `curl | bash`、`irm | iex`
|
|
100
|
-
- `unmanaged/binary`,保留给未来真正的二进制直装场景
|
|
141
|
+
`info` 会显示:
|
|
101
142
|
|
|
102
|
-
|
|
143
|
+
- 当前平台可用的安装方式
|
|
144
|
+
- 当前记录的安装来源与生命周期
|
|
145
|
+
- 当前版本和可检测到的最新版本
|
|
146
|
+
- agent 自带的自更新命令
|
|
103
147
|
|
|
104
148
|
### 快捷启动 Agent
|
|
105
149
|
|
|
106
150
|
```bash
|
|
107
|
-
# 直接启动 agent(参数透传)
|
|
108
151
|
quantex claude --dangerously-skip-permissions
|
|
109
|
-
|
|
110
|
-
# 使用短别名启动
|
|
111
152
|
qtx claude --dangerously-skip-permissions
|
|
112
|
-
|
|
113
|
-
# 使用 agent 别名启动
|
|
114
153
|
quantex agent --help
|
|
115
154
|
```
|
|
116
155
|
|
|
156
|
+
如果 agent 未安装,Quantex 会提示是否先安装再启动。
|
|
157
|
+
|
|
117
158
|
### 配置管理
|
|
118
159
|
|
|
119
160
|
```bash
|
|
120
|
-
# 查看配置
|
|
121
161
|
quantex config
|
|
122
|
-
|
|
123
|
-
# 获取配置项
|
|
124
162
|
quantex config get defaultPackageManager
|
|
125
|
-
|
|
126
|
-
# 设置配置项
|
|
127
163
|
quantex config set defaultPackageManager npm
|
|
128
|
-
|
|
129
|
-
|
|
164
|
+
quantex config set npmBunUpdateStrategy respect-semver
|
|
165
|
+
quantex config set selfUpdateChannel beta
|
|
130
166
|
quantex config reset
|
|
131
167
|
```
|
|
132
168
|
|
|
@@ -138,64 +174,74 @@ quantex doctor
|
|
|
138
174
|
|
|
139
175
|
`doctor` 会检查:
|
|
140
176
|
|
|
141
|
-
- `bun`、`npm`、`brew`、`winget`
|
|
177
|
+
- `bun`、`npm`、`brew`、`winget` 是否可用
|
|
178
|
+
- Quantex CLI 自身的版本、安装来源、是否支持自动升级
|
|
179
|
+
- Quantex CLI 是否有新版本以及对应恢复方式
|
|
142
180
|
- 已安装 agent 的版本状态
|
|
143
|
-
- 已安装 agent 的生命周期和来源,例如 `managed; managed via bun (...)`
|
|
144
181
|
- 当前环境是否缺少任何可用于托管安装/更新的安装器
|
|
145
182
|
|
|
146
183
|
## 配置
|
|
147
184
|
|
|
148
|
-
配置文件位于 `~/.quantex/config.json
|
|
185
|
+
配置文件位于 `~/.quantex/config.json`,当前支持:
|
|
149
186
|
|
|
150
187
|
```json
|
|
151
188
|
{
|
|
152
|
-
"defaultPackageManager": "bun"
|
|
189
|
+
"defaultPackageManager": "bun",
|
|
190
|
+
"npmBunUpdateStrategy": "latest-major",
|
|
191
|
+
"selfUpdateChannel": "stable",
|
|
192
|
+
"networkRetries": 2,
|
|
193
|
+
"networkTimeoutMs": 10000,
|
|
194
|
+
"versionCacheTtlHours": 6
|
|
153
195
|
}
|
|
154
196
|
```
|
|
155
197
|
|
|
156
|
-
|
|
198
|
+
配置项说明:
|
|
157
199
|
|
|
158
|
-
|
|
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
|
|
159
208
|
|
|
160
209
|
## 状态文件
|
|
161
210
|
|
|
162
|
-
|
|
211
|
+
Quantex 会在 `~/.quantex/state.json` 中记录运行时状态,例如:
|
|
163
212
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- 托管安装器:`bun`、`npm`、`brew`、`winget`
|
|
167
|
-
- 非托管安装:`script`
|
|
168
|
-
- 预留类型:`binary`
|
|
213
|
+
- agent 的实际安装来源
|
|
214
|
+
- Quantex CLI 自身的安装来源
|
|
169
215
|
|
|
170
216
|
这个状态文件主要用于:
|
|
171
217
|
|
|
172
|
-
- 让 `update --all`
|
|
173
|
-
-
|
|
174
|
-
- 支撑 `list`、`info`、`doctor`
|
|
175
|
-
- 为后续的卸载、诊断和迁移能力保留扩展空间
|
|
176
|
-
|
|
177
|
-
术语约定:
|
|
178
|
-
|
|
179
|
-
- `packages.npm` 指 agent 对应的 npm 包名
|
|
180
|
-
- 安装方法里的 `packageName` 指安装器专用标识;对 npm/bun 是包名,对 Homebrew 是 formula/cask 标识,对 winget 是 package ID
|
|
181
|
-
|
|
182
|
-
如果某个 agent 是在旧版本 Quantex 中安装的,或者不是通过 Quantex 安装的,首次更新时可能仍会走逐个更新;一旦 Quantex 成功更新并记录来源,后续 `update --all` 就可以复用批量更新路径。
|
|
218
|
+
- 让 `update --all` 能先生成更新计划,再按安装来源分组执行
|
|
219
|
+
- 避免混合安装场景下误用错误的更新方式
|
|
220
|
+
- 支撑 `list`、`info`、`doctor`、`upgrade` 的来源判断和恢复提示
|
|
183
221
|
|
|
184
222
|
## 开发
|
|
185
223
|
|
|
186
224
|
```bash
|
|
187
|
-
bun install
|
|
188
|
-
bun run dev
|
|
189
|
-
bun run test
|
|
190
|
-
bun run test:watch
|
|
191
|
-
bun run lint
|
|
192
|
-
bun run
|
|
193
|
-
bun run
|
|
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
|
|
194
235
|
```
|
|
195
236
|
|
|
237
|
+
`release:artifacts` 会统一生成并校验:
|
|
238
|
+
|
|
239
|
+
- `dist/bin/SHA256SUMS.txt`
|
|
240
|
+
- `dist/bin/manifest.json`
|
|
241
|
+
|
|
196
242
|
## License
|
|
197
243
|
|
|
198
|
-
[
|
|
244
|
+
[Apache License 2.0](./LICENSE) © [Drswith](https://github.com/Drswith)
|
|
199
245
|
|
|
200
246
|
<!-- Badges -->
|
|
201
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{
|
|
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,15 +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/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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;
|
|
71
102
|
}
|
|
72
|
-
declare function getConfigDir(): string;
|
|
73
|
-
declare function getConfigFilePath(): string;
|
|
74
|
-
declare function loadConfig(): Promise<QuantexConfig>;
|
|
75
|
-
declare function saveConfig(config: Record<string, unknown>): Promise<void>;
|
|
76
103
|
//#endregion
|
|
77
104
|
//#region src/state/index.d.ts
|
|
78
105
|
interface InstalledAgentState {
|
|
@@ -82,8 +109,12 @@ interface InstalledAgentState {
|
|
|
82
109
|
packageTargetKind?: PackageTargetKind;
|
|
83
110
|
command?: string;
|
|
84
111
|
}
|
|
112
|
+
interface SelfState {
|
|
113
|
+
installSource?: SelfInstallSource;
|
|
114
|
+
}
|
|
85
115
|
interface QuantexState {
|
|
86
116
|
installedAgents: Record<string, InstalledAgentState>;
|
|
117
|
+
self: SelfState;
|
|
87
118
|
}
|
|
88
119
|
declare function getStateFilePath(): string;
|
|
89
120
|
declare function loadState(): Promise<QuantexState>;
|
|
@@ -91,6 +122,47 @@ declare function saveState(state: QuantexState): Promise<void>;
|
|
|
91
122
|
declare function getInstalledAgentState(agentName: string): Promise<InstalledAgentState | undefined>;
|
|
92
123
|
declare function setInstalledAgentState(agentState: InstalledAgentState): Promise<void>;
|
|
93
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>;
|
|
94
166
|
//#endregion
|
|
95
167
|
//#region src/inspection/agents.d.ts
|
|
96
168
|
interface AgentInspection {
|
|
@@ -113,13 +185,16 @@ interface ManagedPackageSpec {
|
|
|
113
185
|
packageName: string;
|
|
114
186
|
packageTargetKind?: PackageTargetKind;
|
|
115
187
|
}
|
|
188
|
+
interface ManagedInstallerUpdateOptions {
|
|
189
|
+
npmBunUpdateStrategy?: NpmBunUpdateStrategy;
|
|
190
|
+
}
|
|
116
191
|
interface ManagedInstaller {
|
|
117
192
|
type: ManagedInstallType;
|
|
118
193
|
isAvailable: () => Promise<boolean>;
|
|
119
194
|
install: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
120
195
|
uninstall: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
121
|
-
update: (packageName: string, packageTargetKind?: PackageTargetKind) => Promise<boolean>;
|
|
122
|
-
updateMany: (packages: ManagedPackageSpec[]) => Promise<boolean>;
|
|
196
|
+
update: (packageName: string, packageTargetKind?: PackageTargetKind, options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
|
|
197
|
+
updateMany: (packages: ManagedPackageSpec[], options?: ManagedInstallerUpdateOptions) => Promise<boolean>;
|
|
123
198
|
}
|
|
124
199
|
declare function getManagedInstaller(type: ManagedInstallType): ManagedInstaller;
|
|
125
200
|
//#endregion
|
|
@@ -153,17 +228,72 @@ declare function canLookupLatestVersionForInstallType(type: InstallType): boolea
|
|
|
153
228
|
interface UpdatePlanEntry {
|
|
154
229
|
inspection: AgentInspection;
|
|
155
230
|
installerType?: ManagedInstallType;
|
|
156
|
-
strategy: 'grouped' | 'manual';
|
|
231
|
+
strategy: 'grouped' | 'manual' | 'self-update';
|
|
157
232
|
}
|
|
158
233
|
interface UpdatePlan {
|
|
159
234
|
entries: UpdatePlanEntry[];
|
|
160
235
|
grouped: Record<ManagedInstallType, UpdatePlanEntry[]>;
|
|
161
236
|
manual: UpdatePlanEntry[];
|
|
237
|
+
skippedManualCheck: AgentInspection[];
|
|
162
238
|
upToDate: AgentInspection[];
|
|
163
239
|
}
|
|
164
240
|
declare function createUpdatePlan(inspections: AgentInspection[]): UpdatePlan;
|
|
165
241
|
declare function isInspectionUpdateAvailable(inspection: Pick<AgentInspection, 'installedVersion' | 'latestVersion'>): boolean;
|
|
166
242
|
//#endregion
|
|
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';
|
|
248
|
+
}
|
|
249
|
+
interface ReleaseManifestAsset extends ReleaseArtifactTarget {
|
|
250
|
+
checksum: string;
|
|
251
|
+
downloadUrl: string;
|
|
252
|
+
name: string;
|
|
253
|
+
size: number;
|
|
254
|
+
}
|
|
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>;
|
|
291
|
+
declare function upgradeSelf(inspection?: SelfInspection): Promise<SelfUpdateResult>;
|
|
292
|
+
declare function canAutoUpdateSelf(installSource: SelfInstallSource): boolean;
|
|
293
|
+
declare function detectSelfInstallSource(packageRoot: string, executablePath?: string): SelfInstallSource;
|
|
294
|
+
declare function getSelfVersion(): string;
|
|
295
|
+
declare function getManualSelfUpgradeCommand(installSource: SelfInstallSource, executablePath?: string): string | undefined;
|
|
296
|
+
//#endregion
|
|
167
297
|
//#region src/services/agents.d.ts
|
|
168
298
|
interface ResolvedAgentInspection {
|
|
169
299
|
agent: AgentDefinition;
|
|
@@ -177,7 +307,10 @@ declare function inspectRegisteredAgents(): Promise<AgentInspection[]>;
|
|
|
177
307
|
interface PendingAgentUpdate {
|
|
178
308
|
agent: AgentDefinition;
|
|
179
309
|
inspection: AgentInspection;
|
|
310
|
+
installerType?: ManagedInstallType;
|
|
311
|
+
package?: ManagedPackageSpec;
|
|
180
312
|
state?: InstalledAgentState;
|
|
313
|
+
strategy: AgentUpdateStrategy;
|
|
181
314
|
}
|
|
182
315
|
interface ManagedUpdateBucket {
|
|
183
316
|
type: ManagedInstallType;
|
|
@@ -188,6 +321,7 @@ interface PlannedAgentUpdates {
|
|
|
188
321
|
entries: PendingAgentUpdate[];
|
|
189
322
|
grouped: ManagedUpdateBucket[];
|
|
190
323
|
manual: PendingAgentUpdate[];
|
|
324
|
+
skippedManualCheck: AgentInspection[];
|
|
191
325
|
upToDate: AgentInspection[];
|
|
192
326
|
}
|
|
193
327
|
interface SingleAgentUpdateStatus {
|
|
@@ -211,8 +345,8 @@ declare function execCommand(command: string, args: string[]): Promise<{
|
|
|
211
345
|
}>;
|
|
212
346
|
//#endregion
|
|
213
347
|
//#region src/utils/version.d.ts
|
|
214
|
-
declare function getInstalledVersion(binaryName: string): Promise<string | undefined>;
|
|
215
|
-
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>;
|
|
216
350
|
declare function getBinaryPath(binaryName: string): Promise<string | undefined>;
|
|
217
351
|
//#endregion
|
|
218
|
-
export { type AgentDefinition, type AgentInspection, type AgentOperationResult, type AgentPackageMetadata, type BinaryInstallMethod, type InstallMethod, type InstallType, type InstalledAgentState, type ManagedInstallMethod, type ManagedInstallType, type ManagedInstaller, type ManagedPackageSpec, type ManagedUpdateBucket, type PackageTargetKind, type PendingAgentUpdate, type PlannedAgentUpdates, type Platform, type QuantexConfig, type QuantexState, type ResolvedAgentInspection, type ScriptInstallMethod, type SingleAgentUpdateStatus, type UpdatePlan, type UpdatePlanEntry, canLookupLatestVersionForInstallType, canUninstallInstallType, canUpdateInstallType, claude, codex, copilot, createUpdatePlan, cursor, droid, execCommand, gemini, getAgentByLookupName, getAgentByNameOrAlias, getAllAgents, getBinaryPath, getConfigDir, getConfigFilePath, getInstallLifecycle, getInstalledAgentState, getInstalledVersion, getInstallerCapabilities, getLatestVersion, getManagedInstaller, getOrderedInstallMethods, getPlatform, getSingleAgentUpdateStatus, getStateFilePath, inspectAgent, inspectAllAgents, inspectRegisteredAgents, installAgent, isBinaryInPath, isBunAvailable, isInspectionUpdateAvailable, isManagedInstallType, isNpmAvailable, loadConfig, loadState, opencode, pi, planAgentUpdates, removeInstalledAgentState, resolveAgent, resolveAgentInspection, saveConfig, saveState, setInstalledAgentState, uninstallAgent, updateAgent, updateAgentsByType };
|
|
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{
|
|
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,
|
|
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-
|
|
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{
|
|
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
|
|
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": "
|
|
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.
|
package/dist/agents-BGk1FtW_.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./config-DvtBCQbQ.mjs";import{mkdir as n}from"node:fs/promises";import{join as r}from"node:path";import i from"node:process";function a(e){return{packageName:e,type:`bun`}}function o(e){return{packageName:e,type:`npm`}}function s(e,t){return{packageName:e,packageTargetKind:t,type:`brew`}}function ee(e){return{packageName:e,packageTargetKind:`id`,type:`winget`}}function c(e){return{command:e,type:`script`}}const l={name:`claude`,displayName:`Claude Code`,description:`Anthropic 官方 AI 编程助手 CLI`,homepage:`https://code.claude.com/docs`,packages:{npm:`@anthropic-ai/claude-code`},binaryName:`claude`,platforms:{windows:[a(),o(),c(`irm https://claude.ai/install.ps1 | iex`),ee(`Anthropic.ClaudeCode`)],macos:[a(),o(),c(`curl -fsSL https://claude.ai/install.sh | bash`),s(`claude-code`,`cask`)],linux:[a(),o(),c(`curl -fsSL https://claude.ai/install.sh | bash`),s(`claude-code`,`cask`)]}},u={name:`codex`,displayName:`Codex CLI`,description:`OpenAI 官方 AI 编程助手 CLI`,homepage:`https://developers.openai.com/codex`,packages:{npm:`@openai/codex`},binaryName:`codex`,platforms:{windows:[a(),o()],macos:[a(),o(),s(`codex`)],linux:[a(),o(),s(`codex`)]}},d={name:`copilot`,displayName:`GitHub Copilot CLI`,description:`GitHub Copilot 命令行工具`,homepage:`https://github.com/features/copilot/cli`,packages:{npm:`@github/copilot`},binaryName:`copilot`,platforms:{windows:[ee(`GitHub.Copilot`)],macos:[a(),o(),c(`curl -fsSL https://gh.io/copilot-install | bash`),s(`copilot-cli`)],linux:[a(),o(),c(`curl -fsSL https://gh.io/copilot-install | bash`),s(`copilot-cli`)]}},te={name:`cursor`,lookupAliases:[`agent`],displayName:`Cursor CLI`,description:`Cursor AI 编程助手命令行工具`,homepage:`https://cursor.com/docs/cli`,binaryName:`agent`,platforms:{windows:[c(`irm 'https://cursor.com/install?win32=true' | iex`)],macos:[c(`curl https://cursor.com/install -fsS | bash`)],linux:[c(`curl https://cursor.com/install -fsS | bash`)]}},f={name:`droid`,displayName:`Droid`,description:`Factory AI 软件工程 Agent CLI`,homepage:`https://docs.factory.ai/cli/getting-started/overview`,packages:{npm:`droid`},binaryName:`droid`,platforms:{windows:[a(),o(),c(`irm https://app.factory.ai/cli/windows | iex`)],macos:[a(),o(),c(`curl -fsSL https://app.factory.ai/cli | sh`),s(`droid`,`cask`)],linux:[a(),o(),c(`curl -fsSL https://app.factory.ai/cli | sh`),s(`droid`,`cask`)]}},p={name:`gemini`,displayName:`Gemini CLI`,description:`Google 开源 AI 编程助手 CLI`,homepage:`https://geminicli.com`,packages:{npm:`@google/gemini-cli`},binaryName:`gemini`,platforms:{windows:[a(),o()],macos:[a(),o(),s(`gemini-cli`)],linux:[a(),o(),s(`gemini-cli`)]}},m={name:`opencode`,displayName:`OpenCode`,description:`开源 AI 编程 CLI`,homepage:`https://opencode.ai`,packages:{npm:`opencode-ai`},binaryName:`opencode`,platforms:{windows:[a(),o()],macos:[a(),o(),c(`curl -fsSL https://opencode.ai/install | bash`),s(`anomalyco/tap/opencode`)],linux:[a(),o(),c(`curl -fsSL https://opencode.ai/install | bash`),s(`anomalyco/tap/opencode`)]}},h={name:`pi`,displayName:`Pi`,description:`极简可扩展的终端编程 Agent`,homepage:`https://pi.dev`,packages:{npm:`@mariozechner/pi-coding-agent`},binaryName:`pi`,platforms:{windows:[a(),o()],macos:[a(),o()],linux:[a(),o()]}},g=[l,u,d,te,f,p,m,h];function _(){return g}function v(e){return g.find(t=>t.name===e||(t.lookupAliases?.includes(e)??!1))}function y(e){return v(e)}const ne={installedAgents:{}};function b(){return r(t(),`state.json`)}async function x(){try{return{installedAgents:(await Bun.file(b()).json()).installedAgents??{}}}catch{return{...ne}}}async function S(e){await n(t(),{recursive:!0}),await Bun.write(b(),`${JSON.stringify(e,null,2)}\n`)}async function C(e){return(await x()).installedAgents[e]}async function w(e){let t=await x();t.installedAgents[e.agentName]=e,await S(t)}async function T(e){let t=await x();delete t.installedAgents[e],await S(t)}function E(){switch(i.platform){case`win32`:return`windows`;case`darwin`:return`macos`;default:return`linux`}}async function D(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});return await t.exited,t.exitCode===0}catch{return!1}}async function O(){return D(`bun`)}async function k(){return D(`npm`)}async function A(){return D(`brew`)}async function j(){return D(`winget`)}async function M(e){try{let t=i.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0}catch{return!1}}const re={binary:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},brew:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},bun:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},npm:{canInstall:!0,canLookupLatestVersion:!0,canUninstall:!0,canUpdate:!0,lifecycle:`managed`},script:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!1,canUpdate:!1,lifecycle:`unmanaged`},winget:{canInstall:!0,canLookupLatestVersion:!1,canUninstall:!0,canUpdate:!0,lifecycle:`managed`}};function N(e){return re[e]}function P(e){return N(e).lifecycle===`managed`}function F(e){return N(e).lifecycle}function I(e){return N(e).canUpdate}function ie(e){return N(e).canUninstall}function L(e){return N(e).canLookupLatestVersion}function R(e,t){return e?t===`cask`?` (${e} cask)`:t===`id`?` (${e} id)`:` (${e})`:``}function z(e,t){return t.packageName||e.packages?.npm||void 0}function B(e){return e?I(e.installType):!1}function ae(e){return!!e&&L(e.installType)}function oe(e){return e.length>0&&e.every(e=>L(e.type))}function se(e){return P(e.type)?`${F(e.type)}/${e.type}${R(e.packageName,e.packageTargetKind)}`:e.type===`script`?`unmanaged/script`:`unmanaged/binary`}function ce(e){return e?P(e.installType)?`managed via ${e.installType}${R(e.packageName,e.packageTargetKind)}`:e.installType===`script`?`script installer`:`binary installer`:`detected in PATH`}function le(e){return B(e)?`managed update`:`manual update`}function ue(e,t){if(t.type===`bun`){let n=z(e,t);return n?`bun add -g ${n}`:``}if(t.type===`npm`){let n=z(e,t);return n?`npm i -g ${n}`:``}return t.type===`brew`?t.packageName?t.packageTargetKind===`cask`?`brew install --cask ${t.packageName}`:`brew install ${t.packageName}`:``:t.type===`winget`?t.packageName?`winget install --id ${t.packageName} -e`:``:t.command??``}function de(e,t,n){if(t)return ae(t)&&(t.packageName||e.packages?.npm)||void 0;if(!(!e.packages?.npm||!oe(n)))return e.packages.npm}async function V(e){let t=E(),n=typeof e==`function`?e(t):e;try{let e;return e=i.platform===`win32`?Bun.spawn([`powershell.exe`,`-Command`,n],{stdio:[`inherit`,`inherit`,`inherit`]}):Bun.spawn([`sh`,`-c`,n],{stdio:[`inherit`,`inherit`,`inherit`]}),await e.exited,e.exitCode===0}catch{return!1}}function fe(e){return e===`cask`?[`--cask`]:[]}async function H(e,t,n){try{let r=Bun.spawn([`brew`,e,...fe(n),t],{stdio:[`inherit`,`inherit`,`inherit`]});return await r.exited,r.exitCode===0}catch{return!1}}async function pe(e,t){return H(`install`,e,t)}async function U(e,t){return H(`upgrade`,e,t)}async function me(e){for(let t of e)if(!await U(t.packageName,t.packageTargetKind))return!1;return!0}async function he(e,t){return H(`uninstall`,e,t)}async function ge(e){try{let t=Bun.spawn([`bun`,`add`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function _e(e){try{let t=Bun.spawn([`bun`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function ve(e){if(e.length===0)return!0;try{let t=Bun.spawn([`bun`,`update`,`-g`,...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function ye(e){try{let t=Bun.spawn([`bun`,`remove`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function be(e){try{let t=Bun.spawn([`npm`,`i`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function xe(e){try{let t=Bun.spawn([`npm`,`update`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function Se(e){if(e.length===0)return!0;try{let t=Bun.spawn([`npm`,`update`,`-g`,...e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function Ce(e){try{let t=Bun.spawn([`npm`,`uninstall`,`-g`,e],{stdio:[`inherit`,`inherit`,`inherit`]});return await t.exited,t.exitCode===0}catch{return!1}}async function W(e,t){try{let n=Bun.spawn([`winget`,e,`--id`,t,`-e`],{stdio:[`inherit`,`inherit`,`inherit`]});return await n.exited,n.exitCode===0}catch{return!1}}async function we(e){return W(`install`,e)}async function G(e){return W(`upgrade`,e)}async function Te(e){for(let t of e)if(!await G(t.packageName))return!1;return!0}async function Ee(e){return W(`uninstall`,e)}const De={brew:{type:`brew`,isAvailable:async()=>A(),install:async(e,t)=>pe(e,t),uninstall:async(e,t)=>he(e,t),update:async(e,t)=>U(e,t),updateMany:async e=>me(e)},bun:{type:`bun`,isAvailable:async()=>O(),install:async e=>ge(e),uninstall:async e=>ye(e),update:async e=>_e(e),updateMany:async e=>ve(e.map(e=>e.packageName))},npm:{type:`npm`,isAvailable:async()=>k(),install:async e=>be(e),uninstall:async e=>Ce(e),update:async e=>xe(e),updateMany:async e=>Se(e.map(e=>e.packageName))},winget:{type:`winget`,isAvailable:async()=>j(),install:async e=>we(e),uninstall:async e=>Ee(e),update:async e=>G(e),updateMany:async e=>Te(e.map(e=>({packageName:e.packageName})))}};function K(e){return De[e]}async function Oe(){return(await e()).defaultPackageManager}async function q(e){let t=E(),n=e.platforms[t];if(!n)return[];let r=await Oe();return r?[...n.filter(e=>e.type===r),...n.filter(e=>e.type!==r)]:[...n]}async function J(e,t,n,r){let i=K(e);return await i.isAvailable()?r===`install`?i.install(t,n):r===`update`?i.update(t,n):i.uninstall(t,n):!1}async function Y(e,t,n){if(P(t.type)){let r=z(e,t);return r?J(t.type,r,t.packageTargetKind,n):!1}return n===`update`&&!I(t.type)||!t.command?!1:V(t.command)}async function X(e,t){return P(e.installType)?e.packageName?J(e.installType,e.packageName,e.packageTargetKind,t):!1:t!==`install`||!e.command?!1:V(e.command)}async function Z(e,t){let n={agentName:e.name,installType:t.type,packageName:z(e,t),packageTargetKind:t.packageTargetKind,command:`command`in t?t.command:void 0};return await w(n),n}async function ke(e){let t=await q(e);for(let n of t)if(await Y(e,n,`install`))return{success:!0,installedState:await Z(e,n)};return{success:!1}}async function Ae(e,t){if(t&&await X(t,`update`))return await w(t),{success:!0,installedState:t};let n=await q(e);for(let t of n)if(await Y(e,t,`update`))return{success:!0,installedState:await Z(e,t)};return{success:!1}}async function je(e,t){let n=[...new Map(t.filter(e=>e.packageName).map(e=>[`${e.packageTargetKind??`package`}:${e.packageName}`,e])).values()],r=K(e);return await r.isAvailable()?r.updateMany(n):!1}async function Me(e){let t=await C(e.name);if(!t)return!1;let n=await X(t,`uninstall`);return n&&await T(e.name),n}const Ne=/v?(\d+\.\d+\.\d+(?:-[a-z0-9.]+)?)/i;async function Q(e){try{let t=Bun.spawn([e,`--version`],{stdout:`pipe`,stderr:`pipe`});if(await t.exited,t.exitCode!==0)return;let n=(await new Response(t.stdout).text()).trim().split(`
|
|
2
|
-
`)[0],r=n.match(Ne);return r?r[1]:n||void 0}catch{return}}async function Pe(e){try{let t=await fetch(`https://registry.npmjs.org/${e}/latest`);return t.ok?(await t.json()).version:void 0}catch{return}}async function Fe(e){try{let t=i.platform===`win32`?`where`:`which`,n=Bun.spawn([t,e],{stdout:`pipe`,stderr:`pipe`});return await n.exited,n.exitCode===0?(await new Response(n.stdout).text()).trim().split(`
|
|
3
|
-
`)[0]:void 0}catch{return}}async function $(e){let[t,n,r]=await Promise.all([q(e),C(e.name),M(e.binaryName)]),[i,a,o]=await Promise.all([r?Q(e.binaryName):Promise.resolve(void 0),r?Fe(e.binaryName):Promise.resolve(void 0),Le(e,n,t)]);return{agent:e,methods:t,installedState:n,inPath:r,installedVersion:i,latestVersion:o,binaryPath:a,sourceLabel:ce(n),updateLabel:le(n),lifecycle:n?F(n.installType):`unmanaged`}}async function Ie(e){return Promise.all(e.map($))}async function Le(e,t,n){let r=de(e,t,n);if(r)return Pe(r)}function Re(e){return y(e)}async function ze(e){let t=Re(e);if(t)return{agent:t,inspection:await $(t)}}async function Be(){return Ie(_())}export{C as A,m as B,P as C,O as D,A as E,w as F,u as G,f as H,v as I,l as K,y as L,x as M,T as N,k as O,S as P,_ as R,N as S,M as T,te as U,p as V,d as W,se as _,Ie as a,I as b,Pe as c,Me as d,Ae as f,ue as g,B as h,$ as i,b as j,j as k,q as l,K as m,Re as n,Fe as o,je as p,ze as r,Q as s,Be as t,ke as u,L as v,E as w,F as x,ie as y,h as z};
|
package/dist/config-D6elxlPI.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,r as n}from"./config-DvtBCQbQ.mjs";import r from"picocolors";async function i(i,a,o){if(!i){let e=await n();console.log(r.bold(`
|
|
2
|
-
Current Configuration:
|
|
3
|
-
`)),console.log(JSON.stringify(e,null,2)),console.log();return}switch(i){case`get`:{if(!a){console.log(r.red(`Please specify a key`));return}let e=(await n())[a];console.log(e===void 0?r.gray(`(not set)`):String(e));break}case`set`:{if(!a||o===void 0){console.log(r.red(`Please specify both key and value`));return}let e={};try{e=await n()}catch{}e[a]=o,await t(e),console.log(r.green(`Set ${a} = ${o}`));break}case`reset`:await t(e),console.log(r.green(`Configuration reset to defaults.`));break;default:console.log(r.red(`Unknown action: ${i}`)),console.log(`Available actions: get, set, reset`)}}export{i as configCommand};
|
package/dist/config-DvtBCQbQ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{mkdir as e}from"node:fs/promises";import{homedir as t}from"node:os";import{join as n}from"node:path";import{loadConfig as r}from"c12";const i={defaultPackageManager:`bun`};function a(){return n(t(),`.quantex`)}function o(){return n(a(),`config.json`)}async function s(){let{config:e}=await r({name:`quantex`,defaults:i,configFile:o()});return e}async function c(t){await e(a(),{recursive:!0}),await Bun.write(o(),`${JSON.stringify(t,null,2)}\n`)}export{i as a,c as i,o as n,s as r,a as t};
|
package/dist/doctor-DO48gMqu.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,O as n,k as r,t as i}from"./agents-BGk1FtW_.mjs";import a from"picocolors";async function o(){console.log(a.bold(`
|
|
2
|
-
Quantex CLI Environment Check
|
|
3
|
-
`)),console.log(a.bold(`Managed Installers:`));let o=await e();console.log(` Bun: ${o?a.green(`available`):a.red(`not found`)}`);let s=await n();console.log(` npm: ${s?a.green(`available`):a.red(`not found`)}`);let c=await t();console.log(` brew: ${c?a.green(`available`):a.red(`not found`)}`);let l=await r();console.log(` winget:${l?a.green(`available`):a.red(`not found`)}`),console.log(`\n${a.bold(`Installed Agents:`)}`);let u=await i(),d=!1;for(let e of u)if(e.inPath){d=!0;let t=e.installedVersion&&e.latestVersion&&e.installedVersion!==e.latestVersion;console.log(` ${e.agent.displayName}: ${e.installedVersion??`unknown`} [${e.lifecycle}; ${e.sourceLabel}]${t?a.yellow(` (update available: ${e.latestVersion})`):``}`)}d||console.log(a.dim(` No agents installed`)),console.log(`\n${a.bold(`Issues:`)}`);let f=[];if(!o&&!s&&!c&&!l&&f.push(`No managed installer found. Install bun, npm, brew, or winget.`),f.length===0)console.log(a.green(` No issues found.`));else for(let e of f)console.log(a.yellow(` - ${e}`));console.log()}export{o as doctorCommand};
|
package/dist/info-DeMHOB7s.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,g as t,r as n}from"./agents-BGk1FtW_.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};
|
package/dist/update-CzN4A4KH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e,h as t,n,p as r}from"./agents-BGk1FtW_.mjs";import{n as i,t as a}from"./update-DIDtiDmr.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&&!t(r)){console.log(o.yellow(`${n.displayName} uses an unmanaged install source and cannot be updated automatically.`));return}(await e(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};
|
package/dist/update-DIDtiDmr.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,h as t,i as n,t as r}from"./agents-BGk1FtW_.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};
|