👾 Open Computer Use – Open-Source Alternative to Codex Computer Use
Swift accessibilityai-agentai-agentsclaude-codecodexcodex-computer-usecomputer-usecomputer-use-agentcross-platformcuadesktop-automationgemini-cligui-automationmacosmcpmodel-context-protocolopen-computer-useopen-computer-use-mcpopenai-codexopencode
Use provenance for npm trusted publishing
Leoa8625bea195c
diff --git a/docs/histories/2026-04/20260422-1205-harden-npm-release-retry.md b/docs/histories/2026-04/20260422-1205-harden-npm-release-retry.mdindex 1a935f8..23b9f9e 100644--- a/docs/histories/2026-04/20260422-1205-harden-npm-release-retry.md+++ b/docs/histories/2026-04/20260422-1205-harden-npm-release-retry.md@@ -9,7 +9,7 @@### 变更- **[Publish Recovery]**: `scripts/npm/publish-packages.mjs` 发布每个 staged package 前先用 `npm view <name>@<version>` 检查同版本是否已经存在;存在时直接跳过。-- **[Auth Preference]**: GitHub Actions 暴露 OIDC 时优先走 npm trusted publishing,不再因为存在 `NPM_TOKEN` fallback 就强制清掉 OIDC 环境;token 仅作为 fallback。+- **[Auth Preference]**: GitHub Actions 暴露 OIDC 时优先用 `--provenance` 走 npm trusted publishing,不再因为存在 `NPM_TOKEN` fallback 就强制清掉 OIDC 环境;token 仅作为 fallback。- **[Retry]**: npm publish 失败后最多重试 3 次,并在每次失败后再次检查版本是否已经对 registry 可见,用于覆盖 registry 短暂错误或部分发布成功场景。- **[Release Guide]**: 在发版指南中补充 npm publish 404 的排查方式,以及 tag 重发时脚本如何处理已存在版本。diff --git a/docs/releases/RELEASE_GUIDE.md b/docs/releases/RELEASE_GUIDE.mdindex 7fe0772..0496fc1 100644--- a/docs/releases/RELEASE_GUIDE.md+++ b/docs/releases/RELEASE_GUIDE.md@@ -106,7 +106,7 @@ gh run view -R iFurySt/open-codex-computer-use <run-id> --log-failed- 先回头检查 `plugin.json` 的 `version`,再检查 staging 包实际产出的 `package.json`。- `npm error 404 Not Found - PUT https://registry.npmjs.org/<package>`- 先确认 registry 上目标包旧版本是否仍可见:`npm view <package> versions --json`。- - 当前 publish 脚本会在发布前跳过已经存在的同版本 package,并对 publish 失败做短暂重试;如果 GitHub Actions OIDC 可用,会优先走 trusted publishing,再回退到 `NODE_AUTH_TOKEN`。如果 tag 重发前某个 package 已经部分发布成功,重新跑同一个 release 不会因为该 package 已存在而中断。+ - 当前 publish 脚本会在发布前跳过已经存在的同版本 package,并对 publish 失败做短暂重试;如果 GitHub Actions OIDC 可用,会优先用 `--provenance` 走 trusted publishing,再回退到 `NODE_AUTH_TOKEN`。如果 tag 重发前某个 package 已经部分发布成功,重新跑同一个 release 不会因为该 package 已存在而中断。- 构建阶段失败- 优先看 `Build npm release artifacts`、`Build Cursor Motion DMG` 或 Swift 编译错误。- GitHub Release 资产上传失败diff --git a/scripts/npm/publish-packages.mjs b/scripts/npm/publish-packages.mjsindex a85b866..2cbe078 100644--- a/scripts/npm/publish-packages.mjs+++ b/scripts/npm/publish-packages.mjs@@ -127,6 +127,7 @@ function publishEnvCandidates(baseEnv) {candidates.push({env: oidcEnv,label: "GitHub Actions OIDC trusted publishing",+ provenance: true,});}@@ -138,6 +139,7 @@ function publishEnvCandidates(baseEnv) {candidates.push({env: tokenEnv,label: "NODE_AUTH_TOKEN fallback",+ provenance: false,});}@@ -145,6 +147,7 @@ function publishEnvCandidates(baseEnv) {candidates.push({env: baseEnv,label: "default npm environment",+ provenance: false,});}@@ -159,11 +162,12 @@ function publishWithRetry(args, npmEnvCandidates, packageName, version) {let lastError;- for (const { env, label } of npmEnvCandidates) {+ for (const { env, label, provenance } of npmEnvCandidates) {process.stdout.write(`Publishing ${packageName}@${version} using ${label}.\n`);+ const publishArgs = provenance && !args.includes("--provenance") ? [...args, "--provenance"] : args;for (let attempt = 1; attempt <= maxPublishAttempts; attempt += 1) {- const result = spawnSync("npm", args, {+ const result = spawnSync("npm", publishArgs, {cwd: repoRoot,stdio: "inherit",env,@@ -178,7 +182,7 @@ function publishWithRetry(args, npmEnvCandidates, packageName, version) {return;}- lastError = new Error(`npm ${args.join(" ")} failed with exit code ${result.status ?? "unknown"}`);+ lastError = new Error(`npm ${publishArgs.join(" ")} failed with exit code ${result.status ?? "unknown"}`);if (attempt < maxPublishAttempts) {const delayMs = attempt * 5000;