@ranger1/dx 0.1.92 → 0.1.94
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/codex-initial.js
CHANGED
|
@@ -4,6 +4,8 @@ import os from 'node:os'
|
|
|
4
4
|
|
|
5
5
|
import { logger } from './logger.js'
|
|
6
6
|
|
|
7
|
+
const DEPRECATED_SKILL_DIRS = ['pr-review-loop', 'git-commit-and-pr']
|
|
8
|
+
|
|
7
9
|
async function collectAllFiles(dir) {
|
|
8
10
|
const out = []
|
|
9
11
|
|
|
@@ -65,6 +67,12 @@ async function copyDirMerge({ srcDir, dstDir }) {
|
|
|
65
67
|
return { fileCount: files.length }
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
async function removeDeprecatedSkillDirs(skillsDir) {
|
|
71
|
+
for (const dirName of DEPRECATED_SKILL_DIRS) {
|
|
72
|
+
await fs.rm(join(skillsDir, dirName), { recursive: true, force: true })
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
export async function runCodexInitial(options = {}) {
|
|
69
77
|
const packageRoot = options.packageRoot
|
|
70
78
|
if (!packageRoot) throw new Error('runCodexInitial: 缺少 packageRoot')
|
|
@@ -81,6 +89,7 @@ export async function runCodexInitial(options = {}) {
|
|
|
81
89
|
const stats = []
|
|
82
90
|
for (const target of targets) {
|
|
83
91
|
await ensureDir(target.dir)
|
|
92
|
+
await removeDeprecatedSkillDirs(target.dir)
|
|
84
93
|
const copyStats = await copyDirMerge({ srcDir: srcSkillsDir, dstDir: target.dir })
|
|
85
94
|
stats.push({ ...target, ...copyStats })
|
|
86
95
|
}
|
package/package.json
CHANGED
package/skills/doctor/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: doctor
|
|
3
|
-
description: Use when 需要在本机一次性体检并修复 Codex 开发环境,包括 python3/python 别名、dx 初始化、agent-browser+Chromium
|
|
3
|
+
description: Use when 需要在本机一次性体检并修复 Codex 开发环境,包括 python3/python 别名、dx 初始化、agent-browser+Chromium 与 ripgrep。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Doctor
|
|
@@ -14,7 +14,6 @@ description: Use when 需要在本机一次性体检并修复 Codex 开发环境
|
|
|
14
14
|
|
|
15
15
|
- 新机器初始化 Codex 开发环境。
|
|
16
16
|
- 发现命令缺失或版本漂移,希望一次性修复。
|
|
17
|
-
- 需要确认 `codex features list` 中 `multi_agent` 为 `experimental true`。
|
|
18
17
|
|
|
19
18
|
## 执行步骤
|
|
20
19
|
|
|
@@ -52,7 +51,7 @@ bash "$CODEX_HOME/skills/doctor/scripts/doctor.sh" --max-rounds 3
|
|
|
52
51
|
|
|
53
52
|
## 脚本职责
|
|
54
53
|
|
|
55
|
-
- 并行检测:`python3`、`python` 别名、`pnpm`、`dx`、`agent-browser`、`rg
|
|
54
|
+
- 并行检测:`python3`、`python` 别名、`pnpm`、`dx`、`agent-browser`、`rg`。
|
|
56
55
|
- 自动修复:按平台选择安装器修复缺失项。
|
|
57
56
|
- 强制执行:每轮都运行 `pnpm add -g @ranger1/dx@latest && dx initial`。
|
|
58
57
|
- agent-browser:安装/升级并执行 Chromium 安装。
|
|
@@ -205,18 +205,6 @@ ensure_agent_browser() {
|
|
|
205
205
|
fi
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
ensure_multi_agent() {
|
|
209
|
-
if ! command -v codex >/dev/null 2>&1; then
|
|
210
|
-
echo "codex 命令不存在" >&2
|
|
211
|
-
return 1
|
|
212
|
-
fi
|
|
213
|
-
codex features enable multi_agent >/dev/null 2>&1 || true
|
|
214
|
-
local line
|
|
215
|
-
line="$(codex features list 2>/dev/null | awk '$1=="multi_agent" {print $0}')"
|
|
216
|
-
[[ -n "$line" ]] || return 1
|
|
217
|
-
echo "$line" | grep -E "experimental[[:space:]]+true" >/dev/null 2>&1
|
|
218
|
-
}
|
|
219
|
-
|
|
220
208
|
force_dx() {
|
|
221
209
|
local pnpm_bin dx_installed dx_cmd
|
|
222
210
|
if ! install_pnpm; then
|
|
@@ -348,26 +336,12 @@ run_parallel_checks() {
|
|
|
348
336
|
fi
|
|
349
337
|
) &
|
|
350
338
|
|
|
351
|
-
(
|
|
352
|
-
if command -v codex >/dev/null 2>&1; then
|
|
353
|
-
local line
|
|
354
|
-
line="$(codex features list 2>/dev/null | awk '$1=="multi_agent" {print $0}')"
|
|
355
|
-
if [[ -n "$line" ]] && echo "$line" | grep -E "experimental[[:space:]]+true" >/dev/null 2>&1; then
|
|
356
|
-
write_check_file "multi_agent" "1" "$line" "ok" "$dir/multi_agent.res"
|
|
357
|
-
else
|
|
358
|
-
write_check_file "multi_agent" "0" "${line:-missing}" "multi_agent 不是 experimental true" "$dir/multi_agent.res"
|
|
359
|
-
fi
|
|
360
|
-
else
|
|
361
|
-
write_check_file "multi_agent" "0" "" "codex 命令不存在" "$dir/multi_agent.res"
|
|
362
|
-
fi
|
|
363
|
-
) &
|
|
364
|
-
|
|
365
339
|
wait
|
|
366
340
|
LAST_CHECK_DIR="$dir"
|
|
367
341
|
}
|
|
368
342
|
|
|
369
343
|
all_good() {
|
|
370
|
-
local keys="python3 python_alias pnpm dx agent_browser rg
|
|
344
|
+
local keys="python3 python_alias pnpm dx agent_browser rg"
|
|
371
345
|
local k
|
|
372
346
|
for k in $keys; do
|
|
373
347
|
if ! check_ok "$k"; then
|
|
@@ -384,7 +358,7 @@ print_report() {
|
|
|
384
358
|
printf '%-14s | %-4s | %-40s | %s\n' "检查项" "状态" "版本" "说明"
|
|
385
359
|
printf '%-14s-+-%-4s-+-%-40s-+-%s\n' "--------------" "----" "----------------------------------------" "------------------------------"
|
|
386
360
|
|
|
387
|
-
local keys="python3 python_alias pnpm dx agent_browser rg
|
|
361
|
+
local keys="python3 python_alias pnpm dx agent_browser rg"
|
|
388
362
|
local k ok txt ver msg
|
|
389
363
|
for k in $keys; do
|
|
390
364
|
ok="$(read_field "$k" 2)"
|
|
@@ -438,11 +412,6 @@ for round in $(seq 1 "$MAX_ROUNDS"); do
|
|
|
438
412
|
ensure_agent_browser || true
|
|
439
413
|
fi
|
|
440
414
|
|
|
441
|
-
if ! check_ok "multi_agent"; then
|
|
442
|
-
echo "[doctor] 修正 multi_agent 特性开关"
|
|
443
|
-
ensure_multi_agent || true
|
|
444
|
-
fi
|
|
445
|
-
|
|
446
415
|
echo "[doctor] 强制执行 dx 安装与初始化"
|
|
447
416
|
force_dx || true
|
|
448
417
|
|