@ranger1/dx 0.1.112 → 0.1.113
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/lib/cli/commands/core.js +36 -0
- package/package.json +1 -1
- package/skills/doctor/SKILL.md +7 -5
package/lib/cli/commands/core.js
CHANGED
|
@@ -5,6 +5,8 @@ import { confirmManager } from '../../confirm.js'
|
|
|
5
5
|
import { execManager } from '../../exec.js'
|
|
6
6
|
import { showHelp, showCommandHelp } from '../help.js'
|
|
7
7
|
|
|
8
|
+
const DEFAULT_TEST_WORKERS = 8
|
|
9
|
+
|
|
8
10
|
export function handleHelp(cli, args = []) {
|
|
9
11
|
if (args[0]) showCommandHelp(args[0], cli)
|
|
10
12
|
else showHelp(cli)
|
|
@@ -177,6 +179,11 @@ export async function handleTest(cli, args) {
|
|
|
177
179
|
logger.step(`运行 ${type} 测试`)
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
testConfig = {
|
|
183
|
+
...testConfig,
|
|
184
|
+
command: appendDefaultTestWorkers(testConfig.command, type),
|
|
185
|
+
}
|
|
186
|
+
|
|
180
187
|
await cli.executeCommand(testConfig)
|
|
181
188
|
}
|
|
182
189
|
|
|
@@ -208,6 +215,35 @@ function shouldUseDirectPathArg(command) {
|
|
|
208
215
|
)
|
|
209
216
|
}
|
|
210
217
|
|
|
218
|
+
function appendDefaultTestWorkers(command, type) {
|
|
219
|
+
const flag = getDefaultWorkerFlag(type)
|
|
220
|
+
if (!flag) return command
|
|
221
|
+
|
|
222
|
+
const text = String(command || '').trim()
|
|
223
|
+
if (!text || hasWorkerFlag(text, flag)) return command
|
|
224
|
+
|
|
225
|
+
if (isNodeEvalCommandWithoutArgSeparator(text)) {
|
|
226
|
+
return `${text} -- ${flag}=${DEFAULT_TEST_WORKERS}`
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return `${text} ${flag}=${DEFAULT_TEST_WORKERS}`
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function getDefaultWorkerFlag(type) {
|
|
233
|
+
if (type === 'e2e') return '--workers'
|
|
234
|
+
if (type === 'unit') return '--maxWorkers'
|
|
235
|
+
return null
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function hasWorkerFlag(command, flag) {
|
|
239
|
+
const escapedFlag = flag.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
240
|
+
return new RegExp(`(^|[\\s'"])${escapedFlag}(=|\\s|['"]|$)`).test(String(command || ''))
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function isNodeEvalCommandWithoutArgSeparator(command) {
|
|
244
|
+
return /(^|\s)node\s+-e\s/.test(String(command || '')) && !/\s--(\s|$)/.test(String(command || ''))
|
|
245
|
+
}
|
|
246
|
+
|
|
211
247
|
function normalizeUnitTestPathForCommand(cli, command, testPath) {
|
|
212
248
|
const rawPath = String(testPath || '')
|
|
213
249
|
if (!rawPath) return rawPath
|
package/package.json
CHANGED
package/skills/doctor/SKILL.md
CHANGED
|
@@ -22,7 +22,8 @@ description: 仅在用户显式调用 $doctor 或明确要求使用 doctor 技
|
|
|
22
22
|
- `agent-browser` 可用,且 Chromium/浏览器依赖已安装到可运行状态。
|
|
23
23
|
- `rg`(rip grep)可用。
|
|
24
24
|
- `gh`(GitHub CLI)可用;若当前工作流需要 GitHub 操作,还应完成认证。
|
|
25
|
-
- `rtk`
|
|
25
|
+
- `rtk` 可用,且明确是 [rtk-ai/rtk](https://github.com/rtk-ai/rtk);不能把其他同名二进制当作通过。
|
|
26
|
+
- [rtk-ai/rtk](https://github.com/rtk-ai/rtk) 已分别完成 Codex CLI 与 Claude Code 的初始化。
|
|
26
27
|
- 常用 PATH 配置在当前 shell 中可生效;若需要持久化,说明写入了哪个 shell 配置文件。
|
|
27
28
|
|
|
28
29
|
## 执行原则
|
|
@@ -41,7 +42,7 @@ description: 仅在用户显式调用 $doctor 或明确要求使用 doctor 技
|
|
|
41
42
|
- 当前 shell 与 PATH
|
|
42
43
|
- `python3`、`python`、`node`、`npm`、`pnpm`、`dx`、`agent-browser`、`rg`、`gh`、`rtk` 的存在性与版本
|
|
43
44
|
- `gh` 的认证状态(例如 `gh auth status`)
|
|
44
|
-
- `rtk`
|
|
45
|
+
- `rtk` 是否为 [rtk-ai/rtk](https://github.com/rtk-ai/rtk),以及它对 Codex CLI 与 Claude Code 的初始化状态
|
|
45
46
|
2. 对照目标状态判断缺口。
|
|
46
47
|
3. 制定最小修复动作并执行。
|
|
47
48
|
4. 每次修复后重新验证相关项。
|
|
@@ -56,9 +57,10 @@ description: 仅在用户显式调用 $doctor 或明确要求使用 doctor 技
|
|
|
56
57
|
- 每个目标命令的版本或基本健康输出。
|
|
57
58
|
- `dx` 的初始化结果或当前初始化状态。
|
|
58
59
|
- `gh --version` 能正常运行;若需要 GitHub 操作,`gh auth status` 应显示可用账号,否则报告未认证原因。
|
|
59
|
-
- `rtk --version
|
|
60
|
-
-
|
|
61
|
-
-
|
|
60
|
+
- `rtk` 必须确认来源为 [rtk-ai/rtk](https://github.com/rtk-ai/rtk)。至少用 `rtk --version`、`rtk --help`、安装来源或命令特征交叉验证;若发现同名非 rtk-ai/rtk 工具,判定为未通过。
|
|
61
|
+
- [rtk-ai/rtk](https://github.com/rtk-ai/rtk) 的 `rtk gain` 能正常运行。
|
|
62
|
+
- [rtk-ai/rtk](https://github.com/rtk-ai/rtk) 的 Codex CLI 初始化必须有明确证据。优先使用 `rtk init --show --codex`,确认全局或本地 Codex 配置已包含 `RTK.md` 与 `AGENTS.md` 引用;若当前 `rtk` 版本命令不同,使用等价的只读检查并在报告中说明。
|
|
63
|
+
- [rtk-ai/rtk](https://github.com/rtk-ai/rtk) 的 Claude Code 初始化必须有明确证据。优先使用 `rtk init --show --agent claude`,确认 Claude Code hook、`RTK.md`、`CLAUDE.md` 引用与 `settings.json` hook 配置处于健康状态;若当前 `rtk` 版本命令不同,使用等价的只读检查并在报告中说明。
|
|
62
64
|
- `agent-browser` 是否能找到并使用已安装的浏览器依赖。
|
|
63
65
|
- 对未通过项给出失败原因、已尝试动作和下一步建议。
|
|
64
66
|
|