@andyqiu/codeforge 0.6.0 → 0.6.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/bin/codeforge.mjs +0 -13
- package/dist/index.js +1 -1
- package/install.mjs +8 -5
- package/package.json +1 -1
package/bin/codeforge.mjs
CHANGED
|
@@ -146,12 +146,6 @@ function cmdInstall(args) {
|
|
|
146
146
|
if (args.flags["enable-legacy-tools"]) extraArgs.push("--enable-legacy-tools")
|
|
147
147
|
if (args.flags["skip-build"] || autoSkipBuild) extraArgs.push("--skip-build")
|
|
148
148
|
|
|
149
|
-
log(`CodeForge installer v${getVersion()}`)
|
|
150
|
-
log(` scope : ${scope}`)
|
|
151
|
-
log(` source : ${fromNpm ? "npm (prebuilt)" : "git clone (will build)"}`)
|
|
152
|
-
log(` dry-run : ${dryRun}`)
|
|
153
|
-
hr()
|
|
154
|
-
|
|
155
149
|
// npm 场景:dist/index.js 必须已经被 prepack 打好;找不到就直接报错并提示
|
|
156
150
|
if (fromNpm && !dryRun) {
|
|
157
151
|
const distEntry = path.join(REPO_ROOT, "dist", "index.js")
|
|
@@ -164,12 +158,10 @@ function cmdInstall(args) {
|
|
|
164
158
|
}
|
|
165
159
|
|
|
166
160
|
const code = installOpencode({ scope, dryRun, extraArgs, verbose })
|
|
167
|
-
hr()
|
|
168
161
|
if (code !== 0) {
|
|
169
162
|
err(`opencode 安装失败 (exit=${code})`)
|
|
170
163
|
return 1
|
|
171
164
|
}
|
|
172
|
-
ok(`opencode 安装完成`)
|
|
173
165
|
return 0
|
|
174
166
|
}
|
|
175
167
|
|
|
@@ -178,12 +170,7 @@ function cmdInstall(args) {
|
|
|
178
170
|
// ────────────────────────────────────────────────────────────────────
|
|
179
171
|
function cmdUninstall(args) {
|
|
180
172
|
const scope = "global"
|
|
181
|
-
log(`CodeForge uninstaller`)
|
|
182
|
-
log(` scope : ${scope}`)
|
|
183
|
-
hr()
|
|
184
173
|
uninstallOpencode({ scope })
|
|
185
|
-
hr()
|
|
186
|
-
ok("卸载流程完成")
|
|
187
174
|
return 0
|
|
188
175
|
}
|
|
189
176
|
|
package/dist/index.js
CHANGED
|
@@ -19759,7 +19759,7 @@ import * as zlib from "node:zlib";
|
|
|
19759
19759
|
// lib/version-injected.ts
|
|
19760
19760
|
function getInjectedVersion() {
|
|
19761
19761
|
try {
|
|
19762
|
-
const v = "0.6.
|
|
19762
|
+
const v = "0.6.1";
|
|
19763
19763
|
if (typeof v === "string" && /^\d+\.\d+\.\d+/.test(v)) {
|
|
19764
19764
|
return v;
|
|
19765
19765
|
}
|
package/install.mjs
CHANGED
|
@@ -155,7 +155,10 @@ function shouldCopyMd(base) {
|
|
|
155
155
|
// B. 路径 / 常量(照搬两脚本并集)
|
|
156
156
|
// ────────────────────────────────────────────────────────────────────
|
|
157
157
|
function xdgConfigHome() {
|
|
158
|
-
|
|
158
|
+
if (process.env.XDG_CONFIG_HOME) return process.env.XDG_CONFIG_HOME
|
|
159
|
+
// Windows:opencode 默认用 %APPDATA%\opencode(与 XDG 不同)
|
|
160
|
+
if (IS_WIN && process.env.APPDATA) return process.env.APPDATA
|
|
161
|
+
return path.join(os.homedir(), ".config")
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
function resolvePaths({ mode }) {
|
|
@@ -452,7 +455,7 @@ function installMdDirs({ targetRoot }) {
|
|
|
452
455
|
const srcPath = path.join(SOURCE_ROOT, srcName)
|
|
453
456
|
const dstPath = path.join(targetRoot, dstName)
|
|
454
457
|
if (!fs.existsSync(srcPath) || !fs.statSync(srcPath).isDirectory()) {
|
|
455
|
-
|
|
458
|
+
vlog(`源目录不存在,跳过: ${srcPath}`)
|
|
456
459
|
continue
|
|
457
460
|
}
|
|
458
461
|
if (fs.existsSync(dstPath) || isSymlink(dstPath)) rmrf(dstPath)
|
|
@@ -487,7 +490,7 @@ function installCopyDirs({ targetRoot }) {
|
|
|
487
490
|
const srcPath = path.join(SOURCE_ROOT, srcName)
|
|
488
491
|
const dstPath = path.join(targetRoot, dstName)
|
|
489
492
|
if (!fs.existsSync(srcPath) || !fs.statSync(srcPath).isDirectory()) {
|
|
490
|
-
|
|
493
|
+
vlog(`源目录不存在,跳过: ${srcPath}`)
|
|
491
494
|
continue
|
|
492
495
|
}
|
|
493
496
|
ensureDir(dstPath)
|
|
@@ -500,7 +503,7 @@ function installSkills({ targetRoot }) {
|
|
|
500
503
|
const skillsSrc = path.join(SOURCE_ROOT, "skills")
|
|
501
504
|
const skillsDst = path.join(targetRoot, "skills")
|
|
502
505
|
if (!fs.existsSync(skillsSrc) || !fs.statSync(skillsSrc).isDirectory()) {
|
|
503
|
-
|
|
506
|
+
vlog(`skills/ 目录不存在,跳过(发布包未含 skills)`)
|
|
504
507
|
return
|
|
505
508
|
}
|
|
506
509
|
ensureDir(skillsDst)
|
|
@@ -525,7 +528,7 @@ function installAssets({ targetRoot }) {
|
|
|
525
528
|
const assetsSrc = path.join(SOURCE_ROOT, "assets")
|
|
526
529
|
const assetsDst = path.join(targetRoot, "assets")
|
|
527
530
|
if (!fs.existsSync(assetsSrc) || !fs.statSync(assetsSrc).isDirectory()) {
|
|
528
|
-
|
|
531
|
+
vlog(`assets/ 目录不存在,跳过(发布包未含 assets)`)
|
|
529
532
|
return
|
|
530
533
|
}
|
|
531
534
|
ensureDir(assetsDst)
|