release-skill 0.1.1 → 0.1.4

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.
Files changed (108) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.codex-plugin/plugin.json +3 -3
  4. package/CHANGELOG.md +89 -0
  5. package/INSTALL.md +216 -5
  6. package/INSTALL.zh-CN.md +358 -0
  7. package/README.md +411 -67
  8. package/README.zh-CN.md +377 -59
  9. package/adapters/claude/.claude-plugin/marketplace.json +1 -1
  10. package/adapters/claude/.claude-plugin/plugin.json +1 -1
  11. package/adapters/claude/bin/release-skill.bundle.mjs +79284 -0
  12. package/adapters/claude/bin/release-skill.mjs +34 -0
  13. package/adapters/claude/native/safe-write/binding.gyp +40 -0
  14. package/adapters/claude/native/safe-write/prebuilds/darwin-arm64/safe_write.node +0 -0
  15. package/adapters/claude/native/safe-write/prebuilds.json +24 -0
  16. package/adapters/claude/native/safe-write/src/safe_write.cc +2032 -0
  17. package/adapters/claude/schemas/.render-manifest.json +37 -0
  18. package/adapters/claude/schemas/approval-record.schema.json +115 -0
  19. package/adapters/claude/schemas/artifact-lock.schema.json +111 -0
  20. package/adapters/claude/schemas/artifact-plan.schema.json +52 -0
  21. package/adapters/claude/schemas/artifact-policy.schema.json +76 -0
  22. package/adapters/claude/schemas/evidence-event.schema.json +89 -0
  23. package/adapters/claude/schemas/release-plan.schema.json +860 -0
  24. package/adapters/claude/schemas/release-project.schema.json +736 -0
  25. package/adapters/claude/schemas/release-run.schema.json +342 -0
  26. package/adapters/claude/skills/release-assess/SKILL.md +5 -6
  27. package/adapters/claude/skills/release-help/SKILL.md +14 -18
  28. package/adapters/claude/skills/release-prepare/SKILL.md +16 -6
  29. package/adapters/claude/skills/release-publish/SKILL.md +7 -7
  30. package/adapters/claude/skills/release-reconcile/SKILL.md +6 -6
  31. package/adapters/claude/skills/release-setup/SKILL.md +95 -0
  32. package/adapters/claude/skills/release-verify/SKILL.md +7 -7
  33. package/adapters/codex/.codex-plugin/plugin.json +2 -2
  34. package/adapters/codex/bin/release-skill.bundle.mjs +79284 -0
  35. package/adapters/codex/bin/release-skill.mjs +34 -0
  36. package/adapters/codex/native/safe-write/binding.gyp +40 -0
  37. package/adapters/codex/native/safe-write/prebuilds/darwin-arm64/safe_write.node +0 -0
  38. package/adapters/codex/native/safe-write/prebuilds.json +24 -0
  39. package/adapters/codex/native/safe-write/src/safe_write.cc +2032 -0
  40. package/adapters/codex/schemas/.render-manifest.json +37 -0
  41. package/adapters/codex/schemas/approval-record.schema.json +115 -0
  42. package/adapters/codex/schemas/artifact-lock.schema.json +111 -0
  43. package/adapters/codex/schemas/artifact-plan.schema.json +52 -0
  44. package/adapters/codex/schemas/artifact-policy.schema.json +76 -0
  45. package/adapters/codex/schemas/evidence-event.schema.json +89 -0
  46. package/adapters/codex/schemas/release-plan.schema.json +860 -0
  47. package/adapters/codex/schemas/release-project.schema.json +736 -0
  48. package/adapters/codex/schemas/release-run.schema.json +342 -0
  49. package/adapters/codex/skills/release-assess/SKILL.md +12 -6
  50. package/adapters/codex/skills/release-help/SKILL.md +21 -18
  51. package/adapters/codex/skills/release-prepare/SKILL.md +23 -6
  52. package/adapters/codex/skills/release-publish/SKILL.md +14 -7
  53. package/adapters/codex/skills/release-reconcile/SKILL.md +13 -6
  54. package/adapters/codex/skills/release-setup/SKILL.md +102 -0
  55. package/adapters/codex/skills/release-verify/SKILL.md +14 -7
  56. package/bin/release-skill-cli.mjs +807 -0
  57. package/bin/release-skill.bundle.mjs +79284 -0
  58. package/bin/release-skill.mjs +23 -732
  59. package/native/safe-write/prebuilds/darwin-arm64/safe_write.node +0 -0
  60. package/native/safe-write/prebuilds.json +22 -2
  61. package/native/safe-write/src/safe_write.cc +11 -2
  62. package/package.json +8 -2
  63. package/references/02-project-config.md +55 -4
  64. package/references/05-evidence-and-errors.md +6 -2
  65. package/schemas/release-plan.schema.json +556 -65
  66. package/schemas/release-project.schema.json +406 -29
  67. package/schemas/release-run.schema.json +165 -18
  68. package/scripts/build-bundle.mjs +133 -0
  69. package/skills/release-assess/SKILL.md +5 -6
  70. package/skills/release-help/SKILL.md +14 -18
  71. package/skills/release-prepare/SKILL.md +16 -6
  72. package/skills/release-publish/SKILL.md +7 -7
  73. package/skills/release-reconcile/SKILL.md +6 -6
  74. package/skills/release-setup/SKILL.md +95 -0
  75. package/skills/release-verify/SKILL.md +7 -7
  76. package/skills-src/release-assess/SKILL.md +5 -6
  77. package/skills-src/release-help/SKILL.md +14 -18
  78. package/skills-src/release-prepare/SKILL.md +16 -6
  79. package/skills-src/release-publish/SKILL.md +7 -7
  80. package/skills-src/release-reconcile/SKILL.md +6 -6
  81. package/skills-src/release-setup/SKILL.md +95 -0
  82. package/skills-src/release-verify/SKILL.md +7 -7
  83. package/src/adapters/contract.mjs +3 -0
  84. package/src/adapters/git-github.mjs +84 -2
  85. package/src/adapters/npm.mjs +5 -13
  86. package/src/adapters/plugin-marketplace.mjs +132 -52
  87. package/src/adapters/push-snapshot.mjs +84 -17
  88. package/src/artifacts/policy.mjs +4 -7
  89. package/src/artifacts/safe-fs-backend-internal.mjs +69 -21
  90. package/src/commands/prepare.mjs +244 -20
  91. package/src/commands/publish.mjs +46 -0
  92. package/src/commands/reconcile.mjs +152 -0
  93. package/src/commands/setup.mjs +1525 -0
  94. package/src/commands/verify.mjs +122 -26
  95. package/src/core/approval.mjs +4 -6
  96. package/src/core/config.mjs +42 -8
  97. package/src/core/errors.mjs +4 -0
  98. package/src/core/pkg-root.mjs +22 -0
  99. package/src/core/plan.mjs +132 -4
  100. package/src/core/previous-public-baseline.mjs +21 -1
  101. package/src/core/run.mjs +4 -4
  102. package/src/core/trusted-resource.mjs +96 -0
  103. package/src/core/verification-gates.mjs +451 -0
  104. package/src/docs/version-gate.mjs +164 -0
  105. package/src/producers/build-adapters.mjs +512 -55
  106. package/src/snapshot/frozen.mjs +221 -7
  107. package/src/snapshot/public-map.mjs +7 -4
  108. package/src/snapshot/scan.mjs +2 -1
@@ -4,7 +4,14 @@
4
4
  "title": "Release Run",
5
5
  "description": "Schema for a release run record capturing execution checkpoints",
6
6
  "type": "object",
7
- "required": ["runId", "command", "planDigest", "planPath", "status", "checkpoints"],
7
+ "required": [
8
+ "runId",
9
+ "command",
10
+ "planDigest",
11
+ "planPath",
12
+ "status",
13
+ "checkpoints"
14
+ ],
8
15
  "additionalProperties": false,
9
16
  "properties": {
10
17
  "runId": {
@@ -40,7 +47,13 @@
40
47
  },
41
48
  "command": {
42
49
  "type": "string",
43
- "enum": ["assess", "prepare", "publish", "reconcile", "verify"],
50
+ "enum": [
51
+ "assess",
52
+ "prepare",
53
+ "publish",
54
+ "reconcile",
55
+ "verify"
56
+ ],
44
57
  "description": "The command that initiated this run"
45
58
  },
46
59
  "sourceRunId": {
@@ -91,7 +104,11 @@
91
104
  "type": "array",
92
105
  "items": {
93
106
  "type": "object",
94
- "required": ["actionId", "actionType", "status"],
107
+ "required": [
108
+ "actionId",
109
+ "actionType",
110
+ "status"
111
+ ],
95
112
  "additionalProperties": false,
96
113
  "properties": {
97
114
  "actionId": {
@@ -108,23 +125,38 @@
108
125
  "npm-publish",
109
126
  "github-release",
110
127
  "claude-marketplace-install",
111
- "codex-marketplace-install"
128
+ "codex-marketplace-install",
129
+ "set-default-branch"
112
130
  ],
113
131
  "description": "Type of external action"
114
132
  },
115
133
  "status": {
116
134
  "type": "string",
117
- "enum": ["succeeded", "failed", "skipped", "pending", "uncertain"],
135
+ "enum": [
136
+ "succeeded",
137
+ "failed",
138
+ "skipped",
139
+ "pending",
140
+ "uncertain"
141
+ ],
118
142
  "description": "Result status of this checkpoint (uncertain = started, result unknown)"
119
143
  },
120
144
  "preObserve": {
121
145
  "type": "string",
122
- "enum": ["CONSISTENT", "MISSING", "CONFLICTING"],
146
+ "enum": [
147
+ "CONSISTENT",
148
+ "MISSING",
149
+ "CONFLICTING"
150
+ ],
123
151
  "description": "Remote state before execution"
124
152
  },
125
153
  "postObserve": {
126
154
  "type": "string",
127
- "enum": ["CONSISTENT", "MISSING", "CONFLICTING"],
155
+ "enum": [
156
+ "CONSISTENT",
157
+ "MISSING",
158
+ "CONFLICTING"
159
+ ],
128
160
  "description": "Remote state after execution"
129
161
  },
130
162
  "startedAt": {
@@ -140,10 +172,18 @@
140
172
  "description": "Remote resource identifiers (commit, tag, version, URL)",
141
173
  "additionalProperties": false,
142
174
  "properties": {
143
- "commit": { "type": "string" },
144
- "tag": { "type": "string" },
145
- "version": { "type": "string" },
146
- "url": { "type": "string" }
175
+ "commit": {
176
+ "type": "string"
177
+ },
178
+ "tag": {
179
+ "type": "string"
180
+ },
181
+ "version": {
182
+ "type": "string"
183
+ },
184
+ "url": {
185
+ "type": "string"
186
+ }
147
187
  }
148
188
  },
149
189
  "error": {
@@ -165,30 +205,137 @@
165
205
  "POST_PUBLISH_VERIFY_FAILED"
166
206
  ]
167
207
  },
168
- "message": { "type": "string" }
208
+ "message": {
209
+ "type": "string"
210
+ }
169
211
  }
170
212
  }
171
213
  }
172
214
  }
215
+ },
216
+ "gateResults": {
217
+ "type": "array",
218
+ "description": "Consumer verification gate results bound to this verify run",
219
+ "items": {
220
+ "type": "object",
221
+ "required": [
222
+ "id",
223
+ "phase",
224
+ "unitId",
225
+ "distribution",
226
+ "gateDigest",
227
+ "inputDigest",
228
+ "status",
229
+ "startedAt",
230
+ "finishedAt",
231
+ "exitCode",
232
+ "stdoutBytes",
233
+ "stdoutSha256",
234
+ "stderrBytes",
235
+ "stderrSha256"
236
+ ],
237
+ "additionalProperties": false,
238
+ "properties": {
239
+ "id": {
240
+ "type": "string",
241
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
242
+ },
243
+ "phase": {
244
+ "const": "consumer-verify"
245
+ },
246
+ "unitId": {
247
+ "type": "string",
248
+ "minLength": 1
249
+ },
250
+ "distribution": {
251
+ "type": "string",
252
+ "enum": [
253
+ "npm",
254
+ "claude-plugin",
255
+ "codex-plugin"
256
+ ]
257
+ },
258
+ "gateDigest": {
259
+ "type": "string",
260
+ "pattern": "^[a-f0-9]{64}$"
261
+ },
262
+ "inputDigest": {
263
+ "type": "string",
264
+ "pattern": "^[a-f0-9]{64}$",
265
+ "description": "SHA-256 digest of the exact installed consumer tree immediately before gate execution"
266
+ },
267
+ "status": {
268
+ "const": "passed"
269
+ },
270
+ "startedAt": {
271
+ "type": "string",
272
+ "format": "date-time"
273
+ },
274
+ "finishedAt": {
275
+ "type": "string",
276
+ "format": "date-time"
277
+ },
278
+ "exitCode": {
279
+ "const": 0
280
+ },
281
+ "stdoutBytes": {
282
+ "type": "integer",
283
+ "minimum": 0
284
+ },
285
+ "stdoutSha256": {
286
+ "type": "string",
287
+ "pattern": "^[a-f0-9]{64}$"
288
+ },
289
+ "stderrBytes": {
290
+ "type": "integer",
291
+ "minimum": 0
292
+ },
293
+ "stderrSha256": {
294
+ "type": "string",
295
+ "pattern": "^[a-f0-9]{64}$"
296
+ }
297
+ }
298
+ }
173
299
  }
174
300
  },
175
301
  "allOf": [
176
302
  {
177
303
  "if": {
178
- "properties": { "command": { "enum": ["reconcile", "verify"] } },
179
- "required": ["command"]
304
+ "properties": {
305
+ "command": {
306
+ "enum": [
307
+ "reconcile",
308
+ "verify"
309
+ ]
310
+ }
311
+ },
312
+ "required": [
313
+ "command"
314
+ ]
180
315
  },
181
316
  "then": {
182
- "required": ["sourceRunId", "sourceRunDigest", "sourceRunPath"]
317
+ "required": [
318
+ "sourceRunId",
319
+ "sourceRunDigest",
320
+ "sourceRunPath"
321
+ ]
183
322
  }
184
323
  },
185
324
  {
186
325
  "if": {
187
- "properties": { "stateSequence": { "minimum": 1 } },
188
- "required": ["stateSequence"]
326
+ "properties": {
327
+ "stateSequence": {
328
+ "minimum": 1
329
+ }
330
+ },
331
+ "required": [
332
+ "stateSequence"
333
+ ]
189
334
  },
190
335
  "then": {
191
- "required": ["previousStateDigest"]
336
+ "required": [
337
+ "previousStateDigest"
338
+ ]
192
339
  }
193
340
  }
194
341
  ]
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * build-bundle.mjs
4
+ *
5
+ * Deterministic CLI bundle for self-contained plugin execution.
6
+ * Bundles bin/release-skill.mjs + all npm dependencies into a single
7
+ * ESM file that runs without node_modules.
8
+ *
9
+ * Schemas and native addons remain external (loaded at runtime from
10
+ * the plugin root via PKG_ROOT).
11
+ *
12
+ * Usage:
13
+ * node scripts/build-bundle.mjs # build mode
14
+ * node scripts/build-bundle.mjs --check # check-only mode (exit 1 on drift)
15
+ */
16
+
17
+ import { readFile, writeFile, mkdir } from 'node:fs/promises';
18
+ import { dirname, join } from 'node:path';
19
+ import { createHash } from 'node:crypto';
20
+
21
+ const CHECK_MODE = process.argv.includes('--check');
22
+
23
+ const SCRIPT_DIR = dirname(new URL(import.meta.url).pathname);
24
+ const PKG_ROOT = join(SCRIPT_DIR, '..');
25
+ const ENTRY = join(PKG_ROOT, 'bin', 'release-skill-cli.mjs');
26
+ const OUTFILE = join(PKG_ROOT, 'bin', 'release-skill.bundle.mjs');
27
+
28
+ // Banner: compute PKG_ROOT deterministically from the bundle's own path.
29
+ // No env-var override — callers cannot hijack schema/native resolution.
30
+ // Uses import.meta.url only — process.argv[1] is not a reliable resource root.
31
+ const BANNER = `\
32
+ // --- release-skill bundle (deterministic build) ---
33
+ // Compute package root from the bundle's own file location (import.meta.url).
34
+ // The bundle lives at <PKG_ROOT>/bin/release-skill.bundle.mjs, so go up one level.
35
+ import { fileURLToPath as __bundleFileURLToPath } from 'node:url';
36
+ import { dirname as __bundleDirname, resolve as __bundleResolve } from 'node:path';
37
+ import { createRequire as __bundleCreateRequire } from 'node:module';
38
+ const __bundlePkgRoot = __bundleResolve(__bundleDirname(__bundleFileURLToPath(import.meta.url)), '..');
39
+ // Provide a real require() for CJS packages bundled into ESM (e.g. yaml, ajv).
40
+ const __bundleRealRequire = __bundleCreateRequire(import.meta.url);
41
+ `;
42
+
43
+ // Pattern to replace esbuild's broken __require shim with a real require().
44
+ const REQUIRE_SHIM_PATTERN = /var __require = \/\* @__PURE__ \*\/ \(\(x\) => typeof require !== "undefined" \? require : typeof Proxy !== "undefined" \? new Proxy\(x, \{[\s\S]*?\}\) : x\)\(function\(x\) \{[\s\S]*?\}\);/;
45
+
46
+ const REQUIRE_SHIM_REPLACEMENT = `var __require = __bundleRealRequire;`;
47
+
48
+ async function buildBundle() {
49
+ // Dynamic import so the script works even if esbuild is not yet installed.
50
+ let esbuild;
51
+ try {
52
+ esbuild = await import('esbuild');
53
+ } catch {
54
+ console.error('Error: esbuild not installed. Run: npm install');
55
+ process.exit(1);
56
+ }
57
+
58
+ const result = await esbuild.build({
59
+ entryPoints: [ENTRY],
60
+ absWorkingDir: PKG_ROOT,
61
+ bundle: true,
62
+ format: 'esm',
63
+ platform: 'node',
64
+ target: 'node22',
65
+ outfile: OUTFILE,
66
+ banner: { js: BANNER },
67
+ // External: Node.js builtins, native addon loader, and the native addon itself.
68
+ external: [
69
+ 'node:*',
70
+ '*/safe_write.node',
71
+ '*.node',
72
+ ],
73
+ // Keep names for stack traces; deterministic across runs for same input.
74
+ keepNames: true,
75
+ // No minification — preserve readable output for debugging.
76
+ minify: false,
77
+ // Sourcemap not needed for production bundle.
78
+ sourcemap: false,
79
+ // Tree-shake unused code.
80
+ treeShaking: true,
81
+ // Write to outfile.
82
+ write: false,
83
+ });
84
+
85
+ let content = result.outputFiles[0].text;
86
+
87
+ // Replace esbuild's broken __require shim with a real require().
88
+ if (REQUIRE_SHIM_PATTERN.test(content)) {
89
+ content = content.replace(REQUIRE_SHIM_PATTERN, REQUIRE_SHIM_REPLACEMENT);
90
+ }
91
+
92
+ // Generated dependency comments may contain editor-authored trailing spaces.
93
+ // Normalize them so committed bundles pass repository whitespace checks.
94
+ content = content.replace(/[ \t]+$/gm, '');
95
+
96
+ return content;
97
+ }
98
+
99
+ async function main() {
100
+ const content = await buildBundle();
101
+
102
+ if (CHECK_MODE) {
103
+ let existing;
104
+ try {
105
+ existing = await readFile(OUTFILE, 'utf-8');
106
+ } catch {
107
+ console.error('Bundle drift: output file does not exist.');
108
+ process.exit(1);
109
+ }
110
+ if (existing !== content) {
111
+ console.error('Bundle drift: output differs from expected.');
112
+ const existingHash = createHash('sha256').update(existing).digest('hex');
113
+ const expectedHash = createHash('sha256').update(content).digest('hex');
114
+ console.error(` existing: sha256:${existingHash}`);
115
+ console.error(` expected: sha256:${expectedHash}`);
116
+ process.exit(1);
117
+ }
118
+ console.log('Bundle in sync.');
119
+ process.exit(0);
120
+ }
121
+
122
+ await mkdir(dirname(OUTFILE), { recursive: true });
123
+ await writeFile(OUTFILE, content, 'utf-8');
124
+ const hash = createHash('sha256').update(content).digest('hex');
125
+ console.log(`Bundle written: ${OUTFILE}`);
126
+ console.log(` sha256:${hash}`);
127
+ console.log(` size: ${content.length} bytes`);
128
+ }
129
+
130
+ main().catch((err) => {
131
+ console.error(`build-bundle failed: ${err.message}`);
132
+ process.exit(1);
133
+ });
@@ -23,16 +23,15 @@ description: Identify project topology and evaluate gaps in public documentation
23
23
 
24
24
  ## 正向执行路径
25
25
 
26
- 1. 复用 `release-help` 已解析的 CLI 数组:registry 已有受支持版本且 PATH 可用时为 `CLI=(release-skill)`;否则为 `CLI=(node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs")`
27
- 2. 运行 `"${CLI[@]}" assess --root <path> --offline --json`
28
- 3. 检查 exit code:0 = 成功,非 0 = 根据错误码处理
29
- 4. 读取 JSON 报告中的 `status` 字段(`ASSESSED` / `NEEDS_INPUT` / `BLOCKED`)
30
- 5. 若 `NEEDS_INPUT`,根据报告补充配置后重跑,使用最新输出作为唯一证据
26
+ 1. 使用插件根相对路径运行 CLI:`node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" assess --root <path> --offline --json`
27
+ 2. 检查 exit code:0 = 成功,非 0 = 根据错误码处理
28
+ 3. 读取 JSON 报告中的 `status` 字段(`ASSESSED` / `NEEDS_INPUT` / `BLOCKED`)
29
+ 4. `NEEDS_INPUT`,根据报告补充配置后重跑,使用最新输出作为唯一证据
31
30
 
32
31
  ## 确定性脚本调用
33
32
 
34
33
  ```bash
35
- "${CLI[@]}" assess --root <path> --offline --json
34
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" assess --root <path> --offline --json
36
35
  # 输出到文件: 加 --output <report-path>
37
36
  ```
38
37
 
@@ -12,34 +12,29 @@ description: "Discoverable entry point for release-skill: dependency and environ
12
12
  ## 职责
13
13
 
14
14
  - 依赖和环境检查:Node.js >= 22、Git 决定本地准备就绪度;npm/gh 另行决定生产依赖就绪度
15
- - 能力说明:安全默认路径是 `help → assess → prepare --offline`;已有公开版本的生产闭环是显式的 `prepare --online --production → approve → publish → verify`
15
+ - 能力说明:缺少配置时走 `help → setup → assess`;已有配置的安全默认路径是 `help assess → prepare --offline`;已有公开版本的生产闭环是显式的 `prepare --online --production → approve → publish → verify`
16
16
  - 最小示例:展示从 release-help 到 release-assess 的最短路径
17
17
  - 只读诊断:运行 dry-run 检查,不修改任何文件
18
18
  - 故障引导:根据错误码指向对应的修复 Skill
19
19
 
20
20
  **阶段通过规则**: `status` 与 `readiness.localPreparation.status` 只判断本地 help/assess/prepare;其充要条件是 `READY` 且 exit code 为 0。`missingRequired` 列出缺失的 Node/Git。生产发布必须另外读取 `readiness.productionPublish`:缺少 npm/gh 时为 `NOT_READY`,依赖存在时仍是 `AUTH_CHECK_REQUIRED`,因为 help 不访问网络、不验证认证。Agent 无权把本地就绪解释为生产就绪。
21
21
 
22
- **边界**: help 不修改文件系统、不执行外部写操作、不生成发布计划。优先探测 PATH 上的全局安装命令 `release-skill`,不可用时回退到源码路径。每个 unit 必须配置 `previousPublicBaseline`:首次发布且确认无前序版本用 none,已有版本用 bound + repo/ref/commit;none 不是绕过 publish 唯一性预检的开关。GitHub/npmClaude/Codex marketplace 隔离安装、精确 npm 安装 smoke 与最终 VERIFIED 已通过真实 release-skill CLI + 本地 bare Git + fake gh/npm/Claude/Codex 的生产等价协议沙箱;另有隔离的已安装消费者 CLI 探针。测试未做 OS 级禁网,也未访问真实 marketplace;真实认证/API canary 尚未执行。
22
+ **边界**: help 不修改文件系统、不执行外部写操作、不生成发布计划。优先探测 PATH 上的全局安装命令 `release-skill`,不可用时回退到源码路径。每个 unit 必须配置 `previousPublicBaseline`:首次发布且确认无前序版本用 none,已有版本用 bound + repo/ref/commit;none 不是绕过 publish 唯一性预检的开关。v0.1.1 已完成 GitHub/npm 真实生产发布、冻结 Git ref 的 Claude/Codex 消费者安装、精确 npm 安装 smoke 与最终 VERIFIED;生产等价本地协议套件继续覆盖 fake gh/npm/Claude/Codex 和本地 bare Git。测试未做 OS 级禁网,且一次成功发布不能证明其他项目的认证、权限、限流或最终一致性行为;每个项目的首次生产发布仍应作为受监控 canary
23
23
 
24
24
  ## 正向执行路径
25
25
 
26
- 1. `npm view release-skill version` 已返回当前支持版本,探测 PATH 全局安装并运行 `release-skill help --json`
27
- 2. registry 尚未发布当前版本或 PATH 不可用时,回退到源码路径:设置 `RELEASE_SKILL_HOME` 并运行 `node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs" help --json`
28
- 3. 检查 `readiness.localPreparation`;需要生产发布时再检查 `readiness.productionPublish`
29
- 4. 若环境就绪,运行 `release-assess` 识别项目拓扑
30
- 5. 默认在审阅本地计划和快照后停止;只有用户明确要求且完成摘要审批时才路由到 `release-publish`
26
+ 1. 使用插件根相对路径运行 CLI:`node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" help --json`
27
+ 2. 检查 `readiness.localPreparation`;需要生产发布时再检查 `readiness.productionPublish`
28
+ 3. 若环境就绪且缺少 `.release-skill/project.yaml`,先路由 `release-setup`;配置已存在才运行 `release-assess`
29
+ 4. 默认在审阅本地计划和快照后停止;只有用户明确要求且完成摘要审批时才路由到 `release-publish`
31
30
 
32
31
  ## 确定性脚本调用
33
32
 
34
33
  ```bash
35
- # 已确认 registry 存在当前版本后,从 npm 全局安装(推荐)
36
- release-skill help --json # PATH 全局安装
37
- release-skill assess --root <path> --offline --json # PATH 全局安装
38
-
39
- # 从源码 checkout 运行
40
- RELEASE_SKILL_HOME=/path/to/release-skill
41
- node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs" help --json
42
- node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs" assess --root <path> --offline --json
34
+ # 从插件根运行(自包含 bundle,无需 node_modules)
35
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" help --json
36
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" setup --root <path> --json
37
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" assess --root <path> --offline --json
43
38
  ```
44
39
 
45
40
  ## 故障路由
@@ -51,10 +46,11 @@ node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs" assess -
51
46
  | pnpm 未安装 | 不影响本地准备;仅出现在 recommendations 中 |
52
47
  | npm/gh 未安装 | 本地准备仍可就绪,但 `readiness.productionPublish.status` 为 `NOT_READY` |
53
48
  | npm/gh 已安装 | 生产状态仍为 `AUTH_CHECK_REQUIRED`;发布前验证 `gh auth`、Git HTTPS credential 和 npm auth |
54
- | CLI 入口不存在 | 先检查 registry 是否已有当前支持版本;存在则安装 `npm install -g release-skill`,尚未发布则设置 `RELEASE_SKILL_HOME` 使用源码路径 |
55
- | assess 失败 | 运行 `node "$RELEASE_SKILL_HOME/..." assess --offline --json` 获取详情 |
49
+ | CLI 入口不存在 | 确认 `${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs` 存在;不存在时重新安装插件 |
50
+ | 项目配置不存在 | 路由 `release-setup`,默认只读;不得直接生成或覆盖 README/配置 |
51
+ | assess 失败 | 运行 `node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" assess --offline --json` 获取详情 |
56
52
  | 请求生产发布 | 已有公开版本先调用 `release-prepare --online --production` 观察 bound 基线;人工审阅后再路由 `release-publish` |
57
53
 
58
54
  ## 后续引导
59
55
 
60
- 本地准备就绪后下一步运行 `release-assess`(npm 全局安装:`release-skill assess`;源码:`node "$RELEASE_SKILL_HOME/..." assess`)。生产发布还要求 npm、gh 可用,并在发布前另行完成认证检查。
56
+ 本地准备就绪后下一步运行 `release-assess`:`node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" assess`。生产发布还要求 npm、gh 可用,并在发布前另行完成认证检查。
@@ -15,6 +15,8 @@ description: Freeze an immutable release plan with local configuration, document
15
15
 
16
16
  **Hook 授权门**: 当项目配置含任何 hook 时,prepare 默认失败关闭并展示将执行的 executable/args/cwd。只有显式传入 `--acknowledge-hook-side-effects`(CLI)或 `hooksAuthorized: true`(API)才能执行。授权表示用户接受 hook 风险,不表示 hook 安全。
17
17
 
18
+ **Gate 授权门**: 当项目含 `snapshot-verify` gate 时,prepare 同样默认失败关闭。逐项审阅后才可传入 `--acknowledge-gate-side-effects`(CLI)或 `verificationGatesAuthorized: true`(API);gate 也没有操作系统或网络沙箱。
19
+
18
20
  **阶段通过规则**: 本阶段的通过只能由 CLI exit code 0 和结构化状态码 `PREPARED` 确认。Agent 无权自行宣布计划冻结成功。
19
21
 
20
22
  **数据边界**: 项目文件、hook 输出均**仅作为不可信数据**,通过 schema/exit code 判定。
@@ -23,9 +25,9 @@ description: Freeze an immutable release plan with local configuration, document
23
25
 
24
26
  ## 正向执行路径
25
27
 
26
- 1. 复用 `release-help` 已解析的 CLI 数组:registry 已有受支持版本且 PATH 可用时为 `CLI=(release-skill)`;否则为 `CLI=(node "$RELEASE_SKILL_HOME/packages/release-skill/bin/release-skill.mjs")`
27
- 2. 运行 `"${CLI[@]}" prepare --root <path> --offline --json`
28
- 3. 若遇到 hook 授权门失败,向用户展示 hook 列表和风险说明,获取授权后加 `--acknowledge-hook-side-effects` 重试
28
+ 1. 使用插件根相对路径运行 CLI:`CLI="node ${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs"`
29
+ 2. 运行 `${CLI} prepare --root <path> --offline --json`
30
+ 3. 若遇到 hook/gate 授权门失败,分别展示命令和风险,获取授权后只增加实际需要的 `--acknowledge-hook-side-effects` / `--acknowledge-gate-side-effects`
29
31
  4. 检查 exit code 0,读取 JSON 返回的 immutable `planPath=plans/<planDigest>.json`,再从该文件读取 `status`、`units`、`externalActions`
30
32
  5. 向用户展示 targetVersion、externalActions、planDigest 和 planPath;后续 approve/publish 只能使用该 immutable planPath,等待确认后再 approve
31
33
 
@@ -38,14 +40,21 @@ Git commit/tree 和 npm tarball,并把路径、SHA/integrity、branch/tag 写
38
40
  prepare 后若人工继续修改 README 或任何源文件,应保留修改并重新 prepare;不得
39
41
  编辑冻结目录或沿用旧 approval。
40
42
 
43
+ 分支策略必须来自 unit 的显式配置:`create-release-branch` 只创建不存在的发布分支;
44
+ `advance-existing-branch` 要求 bound ref 精确等于目标分支并只做普通快进;
45
+ `initialize-default-branch` 要求目标分支不存在,并冻结当前默认分支和目标精确 commit
46
+ 后才生成独立的默认分支切换 action。不得假定目标一定是 `release/<tag>`。
47
+
41
48
  ## 确定性脚本调用
42
49
 
43
50
  ```bash
44
- "${CLI[@]}" prepare --root <path> --offline --json
51
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" prepare --root <path> --offline --json
45
52
  # 生产 happy end:bound 基线必须 online;远端目标唯一性仍由 publish 全局预检
46
- "${CLI[@]}" prepare --root <path> --online --production --json
53
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" prepare --root <path> --online --production --json
47
54
  # 项目含 hook 时需显式授权:
48
- "${CLI[@]}" prepare --root <path> --offline --acknowledge-hook-side-effects --json
55
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" prepare --root <path> --offline --acknowledge-hook-side-effects --json
56
+ # 项目含 snapshot gate 时另行显式授权:
57
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" prepare --root <path> --offline --acknowledge-gate-side-effects --json
49
58
  ```
50
59
 
51
60
  ## 执行顺序
@@ -58,6 +67,7 @@ prepare 后若人工继续修改 README 或任何源文件,应保留修改并
58
67
  | 错误码 | 处理 |
59
68
  |---|---|
60
69
  | GATE_FAILED (hook 授权) | 向用户展示 hook 命令和风险,获得授权后加 `--acknowledge-hook-side-effects` 重试 |
70
+ | GATE_FAILED (gate 授权) | 向用户展示 snapshot gate 命令和风险,获得授权后加 `--acknowledge-gate-side-effects` 重试 |
61
71
  | GATE_FAILED (bound + offline) | 改用 `--online --production`,不得把 unobserved-offline plan 交给 publish |
62
72
  | GATE_FAILED (前序基线漂移) | 先取得并比较实际远端内容;人工选择 merge/adopt/reject。merge/adopt 都必须把接受内容落回 human-owned 权威源,并把 `previousPublicBaseline` 更新为接受状态的精确 repo/ref/commit 后重新 online production prepare;reject 停止调查,禁止改 `mode: none` 绕过 |
63
73
  | GATE_FAILED (其他) | 修复门失败原因后重试;以 CLI exit code 为准 |
@@ -18,7 +18,8 @@ description: 从已批准且摘要确认的生产计划发布冻结 Git branch/t
18
18
 
19
19
  只发布 `prepare --production` 封存的 Git object 和 npm tarball,不从活动工作区重新
20
20
  打包,不生成或覆盖 README。远端 branch/tag/Release/npm version 已存在、查询不确定、
21
- 认证失败或摘要漂移时,在全局预检阶段停止并交给人工。禁止 force、删除和自动回滚。
21
+ 认证失败或摘要漂移时,在全局预检阶段停止并交给人工。禁止覆盖、删除和自动回滚;
22
+ 新建 ref 的 create-only CAS(`--force-with-lease=<ref>:`)只断言目标不存在,不授权覆盖。
22
23
 
23
24
  ## 授权门
24
25
 
@@ -30,15 +31,14 @@ description: 从已批准且摘要确认的生产计划发布冻结 Git branch/t
30
31
  ## 确定性执行
31
32
 
32
33
  ```bash
33
- "${CLI[@]}" publish --root <path> --plan <plan-path> \
34
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" publish --root <path> --plan <plan-path> \
34
35
  --approval <approval-path> --confirm-production <planDigest> --json
35
36
  ```
36
37
 
37
- `CLI` 必须复用 `release-help` 已解析的入口:registry 已有受支持版本且 PATH 可用时
38
- `CLI=(release-skill)`;否则为源码 checkout node 数组。
39
-
40
- 执行顺序:全局只读预检 → `release/<tag>` 公开分支 → tag → npm tarball →
38
+ 执行顺序:全局只读预检 配置的公开分支(按三种 `branchStrategy` 执行)→ 必要时
39
+ 单独切换默认分支 tag npm tarball →
41
40
  GitHub Release → Claude/Codex marketplace 隔离安装。每步 execute 后立即 observe;
41
+ 默认分支 action 同时绑定名称和目标精确 commit;末尾再次核对分支/默认分支一致性。
42
42
  失败停止后续动作并记录 PARTIAL。PUBLISHED 后运行 verify 复核全新消费者安装。
43
43
 
44
44
  ## 故障路由
@@ -47,7 +47,7 @@ GitHub Release → Claude/Codex marketplace 隔离安装。每步 execute 后立
47
47
  |---|---|
48
48
  | `BASELINE_CHANGED` | 保留人工修改,重新 prepare、审阅和 approve;不要覆盖修改。 |
49
49
  | 摘要/制品不匹配 | 停止;重新 prepare,不修补冻结目录。 |
50
- | 远端对象已存在 | 人工判断版本或远端状态;不得 force 或覆盖。 |
50
+ | 远端对象已存在 | 人工判断版本或远端状态;不得覆盖。create-only CAS 也必须失败关闭。 |
51
51
  | 认证/网络/未知查询错误 | 失败关闭,修复环境后基于同一证据判断是否 reconcile。 |
52
52
  | `PARTIAL` | 检查 `release-run.json`,不重跑整套发布、不删除成功对象。 |
53
53
 
@@ -29,8 +29,8 @@ marketplace 隔离消费者 checkpoint,但只恢复到 `PUBLISHED`;最终 np
29
29
 
30
30
  ## 正向执行路径
31
31
 
32
- 1. 复用 `release-help` 已解析的 CLI 数组,并确认有 `--run` 路径(必需),且源 run 状态为 `PARTIAL`
33
- 2. 运行 `"${CLI[@]}" reconcile --root <path> --plan <plan-path> --run <run-path> --json`
32
+ 1. 使用插件根相对路径运行 CLI,确认有 `--run` 路径(必需),且源 run 状态为 `PARTIAL`
33
+ 2. 运行 `node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" reconcile --root <path> --plan <plan-path> --run <run-path> --json`
34
34
  3. 检查 exit code 和结构化状态:`PUBLISHED`(恢复完成,待 verify)/ `PARTIAL`(需重试)/ `BLOCKED`(需人工决策)
35
35
  4. 若 PARTIAL 且需重试,加 `--approval`;生产计划还必须加 `--confirm-production <planDigest>`
36
36
 
@@ -38,16 +38,16 @@ marketplace 隔离消费者 checkpoint,但只恢复到 `PUBLISHED`;最终 np
38
38
 
39
39
  ```bash
40
40
  # reconcile
41
- "${CLI[@]}" reconcile --root <path> --plan <plan-path> --run <run-path> --json
41
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" reconcile --root <path> --plan <plan-path> --run <run-path> --json
42
42
  # verify
43
- "${CLI[@]}" verify --root <path> --plan <plan-path> --run <reconcile-run-path> --json
43
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" verify --root <path> --plan <plan-path> --run <reconcile-run-path> --json
44
44
  # 重试(需 --approval)
45
- "${CLI[@]}" reconcile --root <path> --plan <plan-path> --run <run-path> --approval <approval-path> --confirm-production <planDigest> --json
45
+ node "${CLAUDE_PLUGIN_ROOT}/bin/release-skill.mjs" reconcile --root <path> --plan <plan-path> --run <run-path> --approval <approval-path> --confirm-production <planDigest> --json
46
46
  ```
47
47
 
48
48
  ## 幂等跳过逻辑
49
49
 
50
- 对每个 action: observe 远端状态 → 完全一致则跳过 → 不存在且在 approval 范围内则重试 → 不一致则 REMOTE_CONFLICT 错误停止。
50
+ 对每个 action: observe 远端状态 → 完全一致则跳过 → 不存在且在 approval 范围内则重试 → 不一致则 REMOTE_CONFLICT 错误停止。`advance-existing-branch` 额外区分“冻结旧 commit”(可重试)、“计划新 commit”(已推进)和第三方 commit(冲突);不得把自己已成功的推进误判为前序基线漂移。
51
51
 
52
52
  ## 故障路由
53
53