@andyqiu/codeforge 0.3.4 → 0.3.5
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/README.md +16 -0
- package/dist/index.js +1 -1
- package/install.ps1 +16 -1
- package/install.sh +44 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -25,6 +25,22 @@ npx @andyqiu/codeforge install
|
|
|
25
25
|
- pending-changes / ast-edit 等代码改动工具
|
|
26
26
|
- Knowledge Hub 集成(需配置 MCP)
|
|
27
27
|
|
|
28
|
+
## 查当前版本
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# macOS / Linux
|
|
32
|
+
cat ~/.config/opencode/codeforge/VERSION
|
|
33
|
+
|
|
34
|
+
# Windows PowerShell
|
|
35
|
+
Get-Content "$env:USERPROFILE\.config\opencode\codeforge\VERSION"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
输出形如 `0.3.5`。如需立即升级:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx @andyqiu/codeforge install --global
|
|
42
|
+
```
|
|
43
|
+
|
|
28
44
|
## Knowledge Hub 配置(团队成员必读)
|
|
29
45
|
|
|
30
46
|
首次安装会在 `~/.config/codeforge/kh.json` 生成模板配置。需要在环境变量中提供 API key:
|
package/dist/index.js
CHANGED
|
@@ -16600,7 +16600,7 @@ import * as zlib from "node:zlib";
|
|
|
16600
16600
|
// lib/version-injected.ts
|
|
16601
16601
|
function getInjectedVersion() {
|
|
16602
16602
|
try {
|
|
16603
|
-
const v = "0.3.
|
|
16603
|
+
const v = "0.3.5";
|
|
16604
16604
|
if (typeof v === "string" && /^\d+\.\d+\.\d+/.test(v)) {
|
|
16605
16605
|
return v;
|
|
16606
16606
|
}
|
package/install.ps1
CHANGED
|
@@ -403,6 +403,21 @@ Invoke-Step "copy $BundleSrcRel -> $BundleDstRel" {
|
|
|
403
403
|
Write-Ok "bundle -> $bundleDst"
|
|
404
404
|
Add-PluginEntry
|
|
405
405
|
|
|
406
|
+
# 写 VERSION marker 文件(用户 cat 一行查版本,不依赖 grep bundle)
|
|
407
|
+
$cfVersion = "unknown"
|
|
408
|
+
try {
|
|
409
|
+
$pkgPath = Join-Path $SourceRoot "package.json"
|
|
410
|
+
if (Test-Path -LiteralPath $pkgPath) {
|
|
411
|
+
$pkg = Get-Content -LiteralPath $pkgPath -Raw | ConvertFrom-Json
|
|
412
|
+
if ($pkg.version) { $cfVersion = $pkg.version }
|
|
413
|
+
}
|
|
414
|
+
} catch { $cfVersion = "unknown" }
|
|
415
|
+
$versionFile = Join-Path $TargetRoot "codeforge/VERSION"
|
|
416
|
+
if (-not $DryRun) {
|
|
417
|
+
Set-Content -LiteralPath $versionFile -Value $cfVersion -NoNewline:$false -Encoding utf8
|
|
418
|
+
}
|
|
419
|
+
Write-Ok "VERSION -> $versionFile ($cfVersion)"
|
|
420
|
+
|
|
406
421
|
# Step 5/7: 装 agents / commands / workflows / context-templates
|
|
407
422
|
Write-Section 'Step 5/7: 装 agents / commands / workflows / context-templates'
|
|
408
423
|
foreach ($entry in $MdCopyMap) {
|
|
@@ -474,7 +489,7 @@ if ($Global) {
|
|
|
474
489
|
|
|
475
490
|
# 验证清单
|
|
476
491
|
Write-Host '────────────────────────────────────────────────' -ForegroundColor DarkGray
|
|
477
|
-
Write-Ok "CodeForge
|
|
492
|
+
Write-Ok "CodeForge v$cfVersion 安装完成"
|
|
478
493
|
Write-Host '────────────────────────────────────────────────' -ForegroundColor DarkGray
|
|
479
494
|
Write-Host @"
|
|
480
495
|
验证清单:
|
package/install.sh
CHANGED
|
@@ -45,6 +45,40 @@ warn() { printf '%b\n' "${C_YELLOW}⚠${C_RESET} $*"; }
|
|
|
45
45
|
err() { printf '%b\n' "${C_RED}✗${C_RESET} $*" >&2; }
|
|
46
46
|
hr() { printf '%b\n' "${C_BOLD}────────────────────────────────────────────────${C_RESET}"; }
|
|
47
47
|
|
|
48
|
+
# ────────────── ADR-0050: WSL 路径错位拒绝(先于参数解析,用原始 $* 检测 --uninstall) ──────────────
|
|
49
|
+
# 防止在 WSL 中 $HOME 落在 /mnt/c|d|e/Users/ 导致 codeforge 配置写到
|
|
50
|
+
# Windows 文件系统(NTFS 性能差、权限模型不同、git/symlink 行为异常)。
|
|
51
|
+
#
|
|
52
|
+
# 触发条件:
|
|
53
|
+
# - 系统真存在 wslpath 命令(WSL 环境标志),或
|
|
54
|
+
# - 测试旁路 CODEFORGE_FORCE_WSL_CHECK=1(CI/单测中强制走分支)
|
|
55
|
+
#
|
|
56
|
+
# 用户逃生口:
|
|
57
|
+
# - CODEFORGE_ALLOW_WSL_WINDOWS_HOME=1 → 强制继续(不推荐)
|
|
58
|
+
# - --uninstall 参数 → guard 整段跳过(用户可能就是要从错位位置清理掉,
|
|
59
|
+
# ADR-0050 / reviewer Phase 3 #3:卸载场景必须能跑通)
|
|
60
|
+
#
|
|
61
|
+
# 这里用 `$*` 原始参数串做模式匹配,**不依赖**下方 while 循环解析出的 ACTION
|
|
62
|
+
# 变量,因为本段必须在参数解析之前执行(错位路径下连参数解析的 set -u 都可能
|
|
63
|
+
# 因为环境异常而炸,guard 必须最早跑)。
|
|
64
|
+
if [[ " $* " != *" --uninstall "* ]]; then
|
|
65
|
+
if command -v wslpath >/dev/null 2>&1 || [[ "${CODEFORGE_FORCE_WSL_CHECK:-}" == "1" ]]; then
|
|
66
|
+
case "$HOME" in
|
|
67
|
+
/mnt/c/*|/mnt/d/*|/mnt/e/*)
|
|
68
|
+
err "在 WSL 中检测到 \$HOME=$HOME 落在 Windows 挂载路径下"
|
|
69
|
+
err "这会导致 codeforge 配置写到 Windows 文件系统,引发权限 / 性能 / 路径转换问题"
|
|
70
|
+
err "请改用 WSL 原生 home(通常是 /home/<user>/),或在 /etc/wsl.conf 中显式设置 default=<linux-user>"
|
|
71
|
+
err "如确实需要继续,设置环境变量 CODEFORGE_ALLOW_WSL_WINDOWS_HOME=1 跳过检查(不推荐)"
|
|
72
|
+
err "如果你是想卸载之前装错位置的 codeforge,加 --uninstall 参数会跳过本检查"
|
|
73
|
+
if [[ "${CODEFORGE_ALLOW_WSL_WINDOWS_HOME:-}" != "1" ]]; then
|
|
74
|
+
exit 1
|
|
75
|
+
fi
|
|
76
|
+
warn "已通过 CODEFORGE_ALLOW_WSL_WINDOWS_HOME=1 跳过 WSL 路径检查(请确保你清楚后果)"
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
fi
|
|
80
|
+
fi
|
|
81
|
+
|
|
48
82
|
# ────────────── 参数 ──────────────
|
|
49
83
|
MODE="project"
|
|
50
84
|
ACTION="install"
|
|
@@ -67,6 +101,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
67
101
|
shift
|
|
68
102
|
done
|
|
69
103
|
|
|
104
|
+
|
|
70
105
|
# ────────────── 路径解析 ──────────────
|
|
71
106
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
72
107
|
SOURCE_ROOT="$SCRIPT_DIR"
|
|
@@ -353,6 +388,14 @@ run "cp -f '$BUNDLE_SRC' '$BUNDLE_DST'"
|
|
|
353
388
|
ok "bundle → $BUNDLE_DST"
|
|
354
389
|
write_plugin_entry
|
|
355
390
|
|
|
391
|
+
# 写 VERSION marker 文件(用户 cat 一行查版本,不依赖 grep bundle)
|
|
392
|
+
CF_VERSION="$(node -e "console.log(require('$SOURCE_ROOT/package.json').version)" 2>/dev/null || echo "unknown")"
|
|
393
|
+
VERSION_FILE="$TARGET_ROOT/codeforge/VERSION"
|
|
394
|
+
if [[ $DRY_RUN -eq 0 ]]; then
|
|
395
|
+
printf "%s\n" "$CF_VERSION" > "$VERSION_FILE"
|
|
396
|
+
fi
|
|
397
|
+
ok "VERSION → ${VERSION_FILE} (${CF_VERSION})"
|
|
398
|
+
|
|
356
399
|
# Step 5/7: 装 agents / commands / workflows / context-templates
|
|
357
400
|
log "Step 5/7: 装 agents / commands / workflows / context-templates"
|
|
358
401
|
for entry in "${MD_COPY_DIRS[@]}"; do
|
|
@@ -407,7 +450,7 @@ fi
|
|
|
407
450
|
|
|
408
451
|
# 验证清单
|
|
409
452
|
hr
|
|
410
|
-
ok "${C_BOLD}CodeForge
|
|
453
|
+
ok "${C_BOLD}CodeForge v${CF_VERSION} 安装完成${C_RESET}"
|
|
411
454
|
hr
|
|
412
455
|
cat <<EOF
|
|
413
456
|
${C_BOLD}验证清单:${C_RESET}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andyqiu/codeforge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "CodeForge — opencode 的零侵入扩展包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"codeforge"
|
|
15
15
|
],
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=20.0.0"
|
|
17
|
+
"node": ">=20.0.0",
|
|
18
|
+
"git": ">=2.28.0"
|
|
18
19
|
},
|
|
19
20
|
"main": "./dist/index.js",
|
|
20
21
|
"exports": {
|
|
@@ -59,6 +60,10 @@
|
|
|
59
60
|
"replay": "node ./scripts/codeforge-replay.mjs",
|
|
60
61
|
"release": "node ./scripts/release.mjs",
|
|
61
62
|
"release:dry": "node ./scripts/release.mjs --dry-run",
|
|
63
|
+
"publish:patch": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/publish.ps1",
|
|
64
|
+
"publish:minor": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/publish.ps1 -Minor",
|
|
65
|
+
"publish:major": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/publish.ps1 -Major",
|
|
66
|
+
"publish:dry": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/publish.ps1 -DryRun",
|
|
62
67
|
"prepublishOnly": "npm run build && npm run typecheck && npm test",
|
|
63
68
|
"prepare": "husky"
|
|
64
69
|
},
|