@andyqiu/codeforge 0.8.12 → 0.8.14

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 CHANGED
@@ -255,7 +255,7 @@ async function cmdUpgrade(args) {
255
255
  const installTarget = latestVersion
256
256
  ? `@andyqiu/codeforge@${latestVersion}`
257
257
  : "@andyqiu/codeforge@latest"
258
- const npmArgs = ["install", "-g", installTarget]
258
+ const npmArgs = ["install", "-g", installTarget, "--no-audit", "--no-fund", "--prefer-offline"]
259
259
 
260
260
  if (dryRun) {
261
261
  const displayNew = latestVersion ?? "未知(版本查询失败)"
@@ -264,20 +264,21 @@ async function cmdUpgrade(args) {
264
264
  return 0
265
265
  }
266
266
 
267
- const r = spawnSync(npmCmd, npmArgs, { stdio: "pipe" })
267
+ const r = spawnSync(npmCmd, npmArgs, {
268
+ stdio: "inherit",
269
+ env: {
270
+ ...process.env,
271
+ npm_config_audit: "false",
272
+ npm_config_fund: "false",
273
+ },
274
+ })
268
275
  if (r.status !== 0) {
269
- if (r.stderr) process.stderr.write(r.stderr)
270
- if (r.stdout) process.stderr.write(r.stdout)
271
276
  err(`npm install 失败 (exit=${r.status ?? 1})`)
272
277
  err(`提示:可手动跑 npm install -g ${installTarget}`)
273
278
  return 1
274
279
  }
275
280
 
276
- const code = installOpencode({ scope: "global", dryRun: false, extraArgs: ["--skip-build"], quiet: true })
277
- if (code !== 0) {
278
- err(`install --global 失败 (exit=${code})`)
279
- return 1
280
- }
281
+ // postinstall 已自动跑 codeforge install --global,无需重复执行
281
282
 
282
283
  // 升级后读取新版本(npm install 成功后本地 package.json 已更新)
283
284
  const newVersion = latestVersion ?? getVersion()
package/dist/index.js CHANGED
@@ -32690,7 +32690,7 @@ import * as https from "node:https";
32690
32690
  // lib/version-injected.ts
32691
32691
  function getInjectedVersion() {
32692
32692
  try {
32693
- const v = "0.8.12";
32693
+ const v = "0.8.14";
32694
32694
  if (typeof v === "string" && /^\d+\.\d+\.\d+/.test(v)) {
32695
32695
  return v;
32696
32696
  }
package/install.mjs CHANGED
@@ -198,7 +198,7 @@ function rmrf(p) {
198
198
 
199
199
  function commandExists(cmd) {
200
200
  try {
201
- const r = spawnSync(cmd, ["--version"], { stdio: "pipe", shell: IS_WIN })
201
+ const r = spawnSync(cmd, ["--version"], { stdio: "pipe", shell: IS_WIN, timeout: 5000 })
202
202
  return r.status === 0 || (r.error == null && r.status != null)
203
203
  } catch {
204
204
  return false
@@ -342,6 +342,7 @@ function ensureGlobalPluginDeps() {
342
342
  cwd: opencodeDir,
343
343
  stdio: VERBOSE ? "inherit" : "pipe",
344
344
  shell: IS_WIN,
345
+ timeout: 30000,
345
346
  })
346
347
  if (r.status !== 0) {
347
348
  if (!VERBOSE) {
@@ -440,7 +441,7 @@ function restoreDefaultAgent({ mode }) {
440
441
  // E. 文件分发(全 vlog,不进 summary)
441
442
  // ────────────────────────────────────────────────────────────────────
442
443
  function detectOpencode() {
443
- const r = spawnSync("opencode", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN })
444
+ const r = spawnSync("opencode", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN, timeout: 8000 })
444
445
  if (r.status === 0) {
445
446
  vok(`检测到 opencode: ${(r.stdout ?? "").trim()}`)
446
447
  } else {
@@ -455,7 +456,7 @@ function buildBundle({ skipBuild }) {
455
456
  } else if (DRY_RUN) {
456
457
  vlog(`[dry-run] npm run build`)
457
458
  } else {
458
- const r = spawnSync("npm", ["run", "build"], { cwd: SOURCE_ROOT, stdio: VERBOSE ? "inherit" : "pipe", shell: IS_WIN })
459
+ const r = spawnSync("npm", ["run", "build"], { cwd: SOURCE_ROOT, stdio: VERBOSE ? "inherit" : "pipe", shell: IS_WIN, timeout: 120000 })
459
460
  if (r.status !== 0) {
460
461
  if (!VERBOSE) {
461
462
  if (r.stdout) process.stderr.write(r.stdout)
@@ -780,7 +781,7 @@ function regenerateDevShim() {
780
781
  vlog(`[dry-run] node scripts/dev-sync.mjs --no-build`)
781
782
  return
782
783
  }
783
- spawnSync(process.execPath, [devSync, "--no-build"], { cwd: SOURCE_ROOT, stdio: "pipe" })
784
+ spawnSync(process.execPath, [devSync, "--no-build"], { cwd: SOURCE_ROOT, stdio: "pipe", timeout: 10000 })
784
785
  vlog(`dev shim regenerated (.opencode/plugins/codeforge-dev.js)`)
785
786
  }
786
787
 
@@ -807,7 +808,7 @@ function installKhConfig({ mode, codeforgeCfgDir }) {
807
808
  function verifyInstall({ mode, targetRoot }) {
808
809
  // 1. git 版本 >= 2.5
809
810
  if (commandExists("git")) {
810
- const r = spawnSync("git", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN })
811
+ const r = spawnSync("git", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN, timeout: 5000 })
811
812
  const m = /(\d+)\.(\d+)/.exec(r.stdout ?? "")
812
813
  const major = m ? parseInt(m[1], 10) : 0
813
814
  const minor = m ? parseInt(m[2], 10) : 0
@@ -822,7 +823,7 @@ function verifyInstall({ mode, targetRoot }) {
822
823
 
823
824
  // 1b. git rev-parse --git-dir
824
825
  if (commandExists("git")) {
825
- const r = spawnSync("git", ["rev-parse", "--git-dir"], { stdio: "pipe", shell: IS_WIN })
826
+ const r = spawnSync("git", ["rev-parse", "--git-dir"], { stdio: "pipe", shell: IS_WIN, timeout: 5000 })
826
827
  if (r.status === 0) {
827
828
  vok(`当前目录是 git 仓库(git rev-parse --git-dir ✓)`)
828
829
  } else if (mode === "project") {
@@ -834,7 +835,7 @@ function verifyInstall({ mode, targetRoot }) {
834
835
 
835
836
  // 2. opencode 已安装
836
837
  if (commandExists("opencode")) {
837
- const r = spawnSync("opencode", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN })
838
+ const r = spawnSync("opencode", ["--version"], { stdio: "pipe", encoding: "utf8", shell: IS_WIN, timeout: 8000 })
838
839
  vok(`opencode ${(r.stdout ?? "").trim() || "unknown"}`)
839
840
  } else {
840
841
  addWarn(`opencode 未在 PATH 中;CodeForge 无入口可用(请先安装 opencode)`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andyqiu/codeforge",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "description": "CodeForge — opencode 的零侵入扩展包",
5
5
  "type": "module",
6
6
  "private": false,