@t275005746/gse 0.1.0 → 0.1.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.
Files changed (180) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -42
  2. package/.github/ISSUE_TEMPLATE/change_request.yml +50 -50
  3. package/.github/ISSUE_TEMPLATE/config.yml +5 -5
  4. package/.github/PULL_REQUEST_TEMPLATE.md +38 -38
  5. package/.github/workflows/validate-gse.yml +33 -33
  6. package/.gse/README.md +18 -18
  7. package/.gse/gse-development-protocol.md +50 -50
  8. package/.gse/project-profile.md +29 -29
  9. package/.gse/quality-gates.md +25 -25
  10. package/.gse/releases/public-registry-publication-npm.md +49 -0
  11. package/.gse/releases/public-release-owner-required.md +65 -65
  12. package/.gse/releases/public-security-contact-owner-required.md +45 -45
  13. package/.gse/state.json +3 -4
  14. package/CHANGELOG.md +24 -24
  15. package/CONTRIBUTING.md +64 -64
  16. package/LICENSE +21 -21
  17. package/README.md +1 -1
  18. package/README.zh-CN.md +1 -1
  19. package/SECURITY.md +41 -41
  20. package/SUPPORT.md +38 -38
  21. package/assets/marketplace/README.md +7 -7
  22. package/assets/marketplace/gse-listing.json +75 -75
  23. package/assets/templates/acceptance-execution-packet.md +73 -73
  24. package/assets/templates/adr.md +14 -14
  25. package/assets/templates/change-brief.md +16 -16
  26. package/assets/templates/design.md +18 -18
  27. package/assets/templates/dispatch-packet.md +104 -104
  28. package/assets/templates/evidence.md +14 -14
  29. package/assets/templates/execution-quality-pack.md +65 -65
  30. package/assets/templates/goal-map.md +21 -21
  31. package/assets/templates/host-adapter.md +48 -48
  32. package/assets/templates/host-ui-invocation-record.md +42 -42
  33. package/assets/templates/incident-review.md +60 -60
  34. package/assets/templates/public-channel-publication-record.md +49 -49
  35. package/assets/templates/public-ci-run-record.md +53 -53
  36. package/assets/templates/public-release-record.md +65 -65
  37. package/assets/templates/public-repository-settings-record.md +59 -59
  38. package/assets/templates/public-security-contact-record.md +45 -45
  39. package/assets/templates/release-trust-record.md +32 -32
  40. package/assets/templates/review.md +18 -18
  41. package/assets/templates/spec.md +16 -16
  42. package/assets/templates/target-adoption-evidence.md +29 -29
  43. package/assets/templates/tasks.md +17 -17
  44. package/assets/templates/update-release-acceptance-record.md +58 -58
  45. package/examples/README.md +22 -22
  46. package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -6
  47. package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -7
  48. package/examples/agent-runtime-host/.gse/goal-map.md +7 -7
  49. package/examples/agent-runtime-host/.gse/project-profile.md +27 -27
  50. package/examples/agent-runtime-host/.gse/tooling.md +5 -5
  51. package/examples/agent-runtime-host/.mcp.json +9 -9
  52. package/examples/agent-runtime-host/AGENTS.md +5 -5
  53. package/examples/agent-runtime-host/README.md +10 -10
  54. package/examples/agent-runtime-host/docs/model-routing.md +5 -5
  55. package/examples/cli-tool/.gse/project-profile.md +21 -21
  56. package/examples/cli-tool/AGENTS.md +5 -5
  57. package/examples/cli-tool/README.md +12 -12
  58. package/examples/cli-tool/package.json +21 -21
  59. package/examples/small-app/.env.example +2 -2
  60. package/examples/small-app/.github/workflows/ci.yml +8 -8
  61. package/examples/small-app/AGENTS.md +5 -5
  62. package/examples/small-app/README.md +12 -12
  63. package/examples/small-app/package.json +26 -26
  64. package/examples/small-app/playwright.config.ts +4 -4
  65. package/package.json +53 -53
  66. package/references/adoption-recipes.md +171 -171
  67. package/references/agent-roles.md +49 -49
  68. package/references/architecture-health.md +101 -101
  69. package/references/benchmark-audit.md +73 -73
  70. package/references/community-channels.md +46 -46
  71. package/references/compatibility.md +70 -70
  72. package/references/design-basis.md +38 -38
  73. package/references/domain-model.md +129 -129
  74. package/references/domain-quality-gates.md +75 -75
  75. package/references/drift-audit.md +81 -81
  76. package/references/evidence-taxonomy.md +123 -123
  77. package/references/file-ownership.md +107 -107
  78. package/references/final-readiness.md +84 -84
  79. package/references/forward-test.md +133 -133
  80. package/references/goal-map.md +36 -36
  81. package/references/host-adapters.md +119 -119
  82. package/references/learning-system.md +35 -35
  83. package/references/marketplace-discovery.md +46 -46
  84. package/references/model-routing.md +103 -103
  85. package/references/open-source-defaults.md +39 -39
  86. package/references/operating-model.md +52 -52
  87. package/references/packaging.md +277 -277
  88. package/references/project-agent-workspace.md +89 -89
  89. package/references/project-bootstrap.md +122 -122
  90. package/references/project-profile.md +57 -57
  91. package/references/public-release.md +174 -174
  92. package/references/quality-gates.md +100 -100
  93. package/references/recovery.md +176 -176
  94. package/references/release-trust.md +43 -43
  95. package/references/release.md +126 -126
  96. package/references/review.md +141 -141
  97. package/references/router.md +90 -90
  98. package/references/spec-workflow.md +66 -66
  99. package/references/task-levels.md +81 -81
  100. package/references/tool-adapters.md +73 -73
  101. package/scripts/audit-acceptance-execution-packet.mjs +133 -133
  102. package/scripts/audit-adoption-recipes.mjs +99 -99
  103. package/scripts/audit-change-lifecycle.mjs +77 -77
  104. package/scripts/audit-change-system.mjs +134 -134
  105. package/scripts/audit-ci-readiness.mjs +107 -107
  106. package/scripts/audit-close-gate.mjs +323 -323
  107. package/scripts/audit-command-adapters.mjs +91 -91
  108. package/scripts/audit-command-execution.mjs +210 -210
  109. package/scripts/audit-compatibility.mjs +149 -149
  110. package/scripts/audit-completion-readiness.mjs +292 -292
  111. package/scripts/audit-distribution.mjs +251 -251
  112. package/scripts/audit-domain-quality-gates.mjs +108 -108
  113. package/scripts/audit-evidence-placeholders.mjs +126 -126
  114. package/scripts/audit-final-readiness-promotion.mjs +255 -255
  115. package/scripts/audit-final-readiness.mjs +226 -226
  116. package/scripts/audit-fixtures.mjs +154 -154
  117. package/scripts/audit-fresh-session-readiness.mjs +177 -177
  118. package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -159
  119. package/scripts/audit-host-runtime-invocation-drill.mjs +240 -240
  120. package/scripts/audit-host-runtime-invocations.mjs +254 -254
  121. package/scripts/audit-host-ui-invocation.mjs +132 -132
  122. package/scripts/audit-marketplace-discovery.mjs +122 -122
  123. package/scripts/audit-npm-package-metadata.mjs +155 -155
  124. package/scripts/audit-npm-publish-dry-run.mjs +191 -169
  125. package/scripts/audit-npm-tarball-install.mjs +191 -191
  126. package/scripts/audit-open-source-defaults.mjs +92 -92
  127. package/scripts/audit-open-source-readiness.mjs +97 -97
  128. package/scripts/audit-project.mjs +138 -138
  129. package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -203
  130. package/scripts/audit-public-acceptance-readiness.mjs +224 -224
  131. package/scripts/audit-public-channel-publication.mjs +248 -248
  132. package/scripts/audit-public-ci-run.mjs +184 -184
  133. package/scripts/audit-public-collaboration-templates.mjs +98 -98
  134. package/scripts/audit-public-external-gate-probe.mjs +206 -206
  135. package/scripts/audit-public-release-decision.mjs +201 -201
  136. package/scripts/audit-public-release-metadata.mjs +176 -176
  137. package/scripts/audit-public-repository-settings.mjs +237 -237
  138. package/scripts/audit-public-security-contact.mjs +171 -171
  139. package/scripts/audit-readme-docs.mjs +6 -4
  140. package/scripts/audit-recovery-readiness.mjs +98 -98
  141. package/scripts/audit-release-readiness.mjs +106 -106
  142. package/scripts/audit-release-trust.mjs +62 -62
  143. package/scripts/audit-remote-distribution.mjs +266 -266
  144. package/scripts/audit-roadmap-consistency.mjs +235 -235
  145. package/scripts/audit-signing.mjs +147 -147
  146. package/scripts/audit-state-freshness.mjs +14 -9
  147. package/scripts/audit-target-adoption-evidence.mjs +117 -117
  148. package/scripts/audit-target-project.mjs +507 -507
  149. package/scripts/audit-update-release-acceptance.mjs +136 -136
  150. package/scripts/audit-v1-target-validation.mjs +269 -269
  151. package/scripts/audit-validation-profiles.mjs +125 -125
  152. package/scripts/close-change.mjs +116 -116
  153. package/scripts/discover-project-profile.mjs +307 -307
  154. package/scripts/generate-command-adapter.mjs +231 -231
  155. package/scripts/generate-final-acceptance-packet.mjs +181 -181
  156. package/scripts/generate-final-form-progress-report.mjs +205 -205
  157. package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -206
  158. package/scripts/generate-owner-external-gate-kit.mjs +295 -295
  159. package/scripts/generate-public-acceptance-handoff.mjs +168 -168
  160. package/scripts/generate-public-release-checklist.mjs +207 -207
  161. package/scripts/generate-release-bundle.mjs +505 -505
  162. package/scripts/generate-release-owner-action-plan.mjs +172 -172
  163. package/scripts/generate-release-status-manifest.mjs +200 -200
  164. package/scripts/generate-session-prompt.mjs +188 -188
  165. package/scripts/gse.mjs +67 -67
  166. package/scripts/init-change.mjs +265 -265
  167. package/scripts/init-project.mjs +785 -785
  168. package/scripts/install-gse.mjs +234 -234
  169. package/scripts/lib/evidence-placeholders.mjs +28 -28
  170. package/scripts/package-gse.mjs +174 -174
  171. package/scripts/probe-public-external-gates.mjs +167 -167
  172. package/scripts/record-host-invocation.mjs +151 -151
  173. package/scripts/record-public-channel-publication.mjs +178 -178
  174. package/scripts/record-public-ci-run.mjs +180 -180
  175. package/scripts/record-public-release.mjs +175 -175
  176. package/scripts/record-public-repository-settings.mjs +209 -209
  177. package/scripts/record-public-security-contact.mjs +157 -157
  178. package/scripts/sign-gse-package.mjs +83 -83
  179. package/scripts/update-project-state.mjs +223 -223
  180. package/scripts/verify-gse-package.mjs +85 -85
@@ -1,505 +1,505 @@
1
- #!/usr/bin/env node
2
- import fs from 'node:fs'
3
- import path from 'node:path'
4
- import os from 'node:os'
5
- import crypto from 'node:crypto'
6
- import { spawnSync } from 'node:child_process'
7
-
8
- const args = process.argv.slice(2)
9
-
10
- function readArg(name, fallback = null) {
11
- const index = args.indexOf(name)
12
- if (index === -1) return fallback
13
- return args[index + 1] ?? fallback
14
- }
15
-
16
- function hasArg(name) {
17
- return args.includes(name)
18
- }
19
-
20
- const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
21
- const label = readArg('--label', 'gse-release-bundle-' + new Date().toISOString().slice(0, 10))
22
- const out = path.resolve(readArg('--out', path.join(root, '.gse', 'release-bundles', label)))
23
- const displayRoot = readArg('--display-root', '<gse-root>')
24
- const dryRun = hasArg('--dry-run')
25
- const force = hasArg('--force')
26
- const jsonOnly = hasArg('--json')
27
-
28
- function exists(relativePath) {
29
- return fs.existsSync(path.join(root, relativePath))
30
- }
31
-
32
- function read(relativePath) {
33
- const fullPath = path.join(root, relativePath)
34
- return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
35
- }
36
-
37
- function run(command, commandArgs) {
38
- const result = spawnSync(command, commandArgs, {
39
- cwd: root,
40
- encoding: 'utf8',
41
- windowsHide: true,
42
- })
43
- return {
44
- command: [command, ...commandArgs].join(' '),
45
- status: result.status ?? 1,
46
- stdout: (result.stdout ?? '').trim(),
47
- stderr: (result.stderr ?? '').trim(),
48
- }
49
- }
50
-
51
- function parseJson(stdout) {
52
- try {
53
- return JSON.parse(stdout)
54
- } catch {
55
- return null
56
- }
57
- }
58
-
59
- function sha256File(filePath) {
60
- return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex')
61
- }
62
-
63
- function collectFileHashes(baseDir) {
64
- const rows = []
65
- function visit(itemPath) {
66
- if (!fs.existsSync(itemPath)) return
67
- const stat = fs.statSync(itemPath)
68
- if (stat.isDirectory()) {
69
- for (const child of fs.readdirSync(itemPath)) visit(path.join(itemPath, child))
70
- return
71
- }
72
- if (!stat.isFile()) return
73
- const relativePath = path.relative(baseDir, itemPath).replace(/\\/g, '/')
74
- rows.push({
75
- relativePath,
76
- sha256: sha256File(itemPath),
77
- bytes: stat.size,
78
- })
79
- }
80
- visit(baseDir)
81
- rows.sort((a, b) => a.relativePath.localeCompare(b.relativePath))
82
- return rows
83
- }
84
-
85
- function portableCommand(commandLine) {
86
- if (!commandLine) return commandLine
87
- const rootForward = root.replace(/\\/g, '/')
88
- return commandLine
89
- .replaceAll(process.execPath, 'node')
90
- .replaceAll(root, '<gse-root>')
91
- .replaceAll(rootForward, '<gse-root>')
92
- .replace(/<gse-root>[\\/]/g, '<gse-root>/')
93
- .replace(/\\/g, '/')
94
- }
95
-
96
- const required = [
97
- 'SKILL.md',
98
- 'README.md',
99
- 'README.zh-CN.md',
100
- 'CHANGELOG.md',
101
- 'references/packaging.md',
102
- 'references/public-release.md',
103
- 'references/release-trust.md',
104
- 'references/marketplace-discovery.md',
105
- 'scripts/validate-gse.mjs',
106
- 'scripts/package-gse.mjs',
107
- 'scripts/install-gse.mjs',
108
- 'scripts/record-public-release.mjs',
109
- '.gse/releases/public-release-owner-required.md',
110
- '.gse/acceptance/public-acceptance-handoff.md',
111
- '.gse/acceptance/host-runtime-evidence-handoff.md',
112
- ]
113
-
114
- const errors = []
115
- for (const item of required) {
116
- if (!exists(item)) errors.push('missing required release-bundle input: ' + item)
117
- }
118
-
119
- const validation = errors.length === 0
120
- ? run(process.execPath, [path.join(root, 'scripts', 'validate-gse.mjs'), '--root', root, '--skip-distribution', '--skip-skill-validator', '--skip-completion-readiness', '--skip-release-bundle', '--skip-final-form-stale-copy', '--skip-local-final-form-completion', '--json'])
121
- : null
122
- const validationData = validation ? parseJson(validation.stdout) : null
123
- if (validation && validation.status !== 0) errors.push('validation command failed for release bundle readiness')
124
- const validationChecks = Array.isArray(validationData?.checks)
125
- ? validationData.checks.map((item) => ({
126
- id: item.id,
127
- label: item.label,
128
- status: item.status,
129
- command: portableCommand(item.command),
130
- summary: item.summary ?? null,
131
- }))
132
- : []
133
-
134
- const generatedAcceptanceRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-release-bundle-acceptance-'))
135
- const freshPublicAcceptanceHandoffPath = path.join(generatedAcceptanceRoot, 'public-acceptance-handoff.md')
136
- const freshReleaseStatusManifestPath = path.join(generatedAcceptanceRoot, 'release-status-manifest.json')
137
- const freshReleaseOwnerActionPlanPath = path.join(generatedAcceptanceRoot, 'release-owner-action-plan.md')
138
- const freshPublicReleaseChecklistPath = path.join(generatedAcceptanceRoot, 'public-release-checklist.md')
139
- const freshOwnerExternalGateKitPath = path.join(generatedAcceptanceRoot, 'owner-external-gate-kit')
140
- const freshInstallablePackagePath = path.join(generatedAcceptanceRoot, 'installable-package')
141
-
142
- if (errors.length === 0) {
143
- const publicAcceptanceHandoffGeneration = run(process.execPath, [
144
- path.join(root, 'scripts', 'generate-public-acceptance-handoff.mjs'),
145
- '--root',
146
- root,
147
- '--display-root',
148
- displayRoot,
149
- '--out',
150
- freshPublicAcceptanceHandoffPath,
151
- '--force',
152
- '--json',
153
- ])
154
- if (publicAcceptanceHandoffGeneration.status !== 0) {
155
- errors.push('public acceptance handoff generation failed for release bundle')
156
- }
157
- const manifestGeneration = run(process.execPath, [
158
- path.join(root, 'scripts', 'generate-release-status-manifest.mjs'),
159
- '--root',
160
- root,
161
- '--display-root',
162
- displayRoot,
163
- '--out',
164
- freshReleaseStatusManifestPath,
165
- '--force',
166
- '--json',
167
- ])
168
- if (manifestGeneration.status !== 0) {
169
- errors.push('release status manifest generation failed for release bundle')
170
- }
171
- const actionPlanGeneration = run(process.execPath, [
172
- path.join(root, 'scripts', 'generate-release-owner-action-plan.mjs'),
173
- '--root',
174
- root,
175
- '--manifest',
176
- freshReleaseStatusManifestPath,
177
- '--out',
178
- freshReleaseOwnerActionPlanPath,
179
- '--force',
180
- '--json',
181
- ])
182
- if (actionPlanGeneration.status !== 0) {
183
- errors.push('release owner action plan generation failed for release bundle')
184
- }
185
- const publicReleaseChecklistGeneration = run(process.execPath, [
186
- path.join(root, 'scripts', 'generate-public-release-checklist.mjs'),
187
- '--root',
188
- root,
189
- '--display-root',
190
- displayRoot,
191
- '--manifest',
192
- freshReleaseStatusManifestPath,
193
- '--out',
194
- freshPublicReleaseChecklistPath,
195
- '--force',
196
- '--json',
197
- ])
198
- if (publicReleaseChecklistGeneration.status !== 0) {
199
- errors.push('public release checklist generation failed for release bundle')
200
- }
201
- const ownerExternalGateKitGeneration = run(process.execPath, [
202
- path.join(root, 'scripts', 'generate-owner-external-gate-kit.mjs'),
203
- '--root',
204
- root,
205
- '--display-root',
206
- displayRoot,
207
- '--out',
208
- freshOwnerExternalGateKitPath,
209
- '--force',
210
- '--json',
211
- ])
212
- if (ownerExternalGateKitGeneration.status !== 0) {
213
- errors.push('owner/external gate kit generation failed for release bundle')
214
- }
215
- const packageGeneration = run(process.execPath, [
216
- path.join(root, 'scripts', 'package-gse.mjs'),
217
- '--root',
218
- root,
219
- '--out',
220
- freshInstallablePackagePath,
221
- '--label',
222
- label + '-installable',
223
- '--json',
224
- ])
225
- if (packageGeneration.status !== 0) {
226
- errors.push('installable package generation failed for release bundle')
227
- }
228
- }
229
-
230
- const publicReleaseRecord = read('.gse/releases/public-release-owner-required.md')
231
- const publicAcceptanceHandoff = fs.existsSync(freshPublicAcceptanceHandoffPath) ? fs.readFileSync(freshPublicAcceptanceHandoffPath, 'utf8') : ''
232
- const hostRuntimeEvidenceHandoff = read('.gse/acceptance/host-runtime-evidence-handoff.md')
233
- const releaseStatusManifest = fs.existsSync(freshReleaseStatusManifestPath) ? fs.readFileSync(freshReleaseStatusManifestPath, 'utf8') : ''
234
- const releaseOwnerActionPlan = fs.existsSync(freshReleaseOwnerActionPlanPath) ? fs.readFileSync(freshReleaseOwnerActionPlanPath, 'utf8') : ''
235
- const publicReleaseChecklist = fs.existsSync(freshPublicReleaseChecklistPath) ? fs.readFileSync(freshPublicReleaseChecklistPath, 'utf8') : ''
236
- function readFreshKit(fileName) {
237
- const fullPath = path.join(freshOwnerExternalGateKitPath, fileName)
238
- return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
239
- }
240
- const releaseStatusData = parseJson(releaseStatusManifest)
241
- const installablePackageManifestPath = path.join(freshInstallablePackagePath, 'gse-package-manifest.json')
242
- const installablePackageManifest = fs.existsSync(installablePackageManifestPath)
243
- ? parseJson(fs.readFileSync(installablePackageManifestPath, 'utf8'))
244
- : null
245
- const installablePackageHashes = fs.existsSync(freshInstallablePackagePath)
246
- ? collectFileHashes(freshInstallablePackagePath)
247
- : []
248
- const licenseDecisionAccepted =
249
- publicReleaseRecord.includes('License status: selected') &&
250
- publicReleaseRecord.includes('SPDX identifier: MIT') &&
251
- publicReleaseRecord.includes('Evidence status: accepted')
252
- const releaseSummary = [
253
- '# GSE Release Bundle',
254
- '',
255
- 'Bundle label: ' + label,
256
- '',
257
- 'Generated: ' + new Date().toISOString(),
258
- '',
259
- 'Source root: ' + displayRoot,
260
- '',
261
- '## Readiness',
262
- '',
263
- 'Status: verified for local package, URL install, signing mechanics, command semantics, public-release metadata, and release decision record.',
264
- '',
265
- 'Accepted public release: not accepted until public security contact, public repository settings, public CI, public channel publication, and host runtime evidence are recorded.',
266
- '',
267
- '## License Decision',
268
- '',
269
- publicReleaseRecord.includes('License status: owner-required')
270
- ? 'License status: owner-required'
271
- : licenseDecisionAccepted
272
- ? 'License status: selected; SPDX identifier: MIT; Evidence status: accepted'
273
- : 'License status: unknown',
274
- '',
275
- '## Install Commands',
276
- '',
277
- 'This bundle includes an installable package snapshot under `installable-package/`.',
278
- '',
279
- '```text',
280
- 'node <skill>/scripts/install-gse.mjs --source <release-bundle>/installable-package --target <install-skill-dir>',
281
- 'node <install-skill-dir>/scripts/validate-gse.mjs --root <install-skill-dir> --skip-skill-validator --skip-distribution --skip-completion-readiness --json',
282
- 'node <install-skill-dir>/scripts/gse.mjs status --target <install-skill-dir> --json',
283
- '```',
284
- '',
285
- '## Verification Command',
286
- '',
287
- '```text',
288
- 'node <skill>/scripts/validate-gse.mjs --root <skill> --json',
289
- '```',
290
- '',
291
- 'Latest local bundle precheck: ' + (validationData?.summary?.status ?? 'not-run') + ', checks ' + (validationData?.summary ? `${validationData.summary.passed}/${validationData.summary.total}` : 'unknown'),
292
- '',
293
- 'Validation manifest detail: `bundle-manifest.json` includes compact `validationChecks[]` entries for the checks that produced the precheck total.',
294
- '',
295
- '## Public Acceptance Handoff',
296
- '',
297
- 'Use `public-acceptance-handoff.md` before public release handoff. It lists the owner/external gates that must be backed by real accepted evidence before public acceptance can be claimed.',
298
- '',
299
- '## Host Runtime Evidence Handoff',
300
- '',
301
- 'Use `host-runtime-evidence-handoff.md` before claiming cross-host support. It lists host families, record commands, and anti-overclaim rules for native slash-command and portable command evidence.',
302
- '',
303
- 'Run `audit-host-runtime-invocation-drill.mjs` before cross-host release handoff to verify record/audit mechanics without treating fixture records as real host evidence.',
304
- '',
305
- '## Release Status Manifest',
306
- '',
307
- 'Use `release-status-manifest.json` when another host, CI job, marketplace checklist, or maintainer needs a machine-readable summary of verified capabilities and pending owner/external gates.',
308
- '',
309
- '## Release Owner Action Plan',
310
- '',
311
- 'Use `release-owner-action-plan.md` when a human owner or maintainer needs the remaining public-release actions grouped by responsible party with exact record commands.',
312
- '',
313
- '## Public Release Checklist',
314
- '',
315
- 'Use `public-release-checklist.md` when the owner needs a linear release runway from bundle preparation through repository, security, CI, registry, marketplace, host evidence, and final verification.',
316
- '',
317
- '## Owner / External Gate Kit',
318
- '',
319
- 'Use `owner-external-gate-kit/` as the one-directory execution packet for the remaining owner-required and external-required gates. It includes final acceptance, public handoff, host runtime evidence, record commands, verification commands, and a machine-readable kit manifest.',
320
- '',
321
- '## External Evidence Not Included',
322
- '',
323
- '- Public marketplace approval or publication.',
324
- '- Public registry publication.',
325
- '- Legal suitability of a selected license.',
326
- '- Host-native slash-command runtime execution unless a host-specific invocation record exists.',
327
- '',
328
- ]
329
-
330
- const files = {
331
- 'release-summary.md': releaseSummary.join('\n'),
332
- 'install-commands.md': [
333
- '# Install Commands',
334
- '',
335
- 'This release bundle includes an installable GSE package snapshot.',
336
- '',
337
- '```text',
338
- 'node <skill>/scripts/install-gse.mjs --source <release-bundle>/installable-package --target <install-skill-dir>',
339
- 'node <install-skill-dir>/scripts/validate-gse.mjs --root <install-skill-dir> --skip-skill-validator --skip-distribution --skip-completion-readiness --json',
340
- 'node <install-skill-dir>/scripts/gse.mjs status --target <install-skill-dir> --json',
341
- '```',
342
- '',
343
- ].join('\n'),
344
- 'validation-checklist.md': [
345
- '# Validation Checklist',
346
- '',
347
- '- [ ] `validate-gse.mjs` passes in source environment.',
348
- '- [ ] `audit-distribution.mjs` passes for local package/install.',
349
- '- [ ] `audit-remote-distribution.mjs` passes for URL install and integrity.',
350
- '- [ ] `audit-signing.mjs` passes for signing mechanics.',
351
- '- [ ] `audit-public-release-metadata.mjs` passes.',
352
- '- [ ] MIT license decision is recorded; accepted public release still requires real owner/external evidence.',
353
- '- [ ] `public-acceptance-handoff.md` has been reviewed before public release handoff.',
354
- '- [ ] `host-runtime-evidence-handoff.md` has been reviewed before claiming cross-host or native slash-command support.',
355
- '- [ ] `audit-host-runtime-invocation-drill.mjs` passes before cross-host release handoff.',
356
- '- [ ] `release-status-manifest.json` has been regenerated from current audits before handoff.',
357
- '- [ ] `release-owner-action-plan.md` has been regenerated from current manifest before owner handoff.',
358
- '- [ ] `public-release-checklist.md` has been regenerated from current manifest before public release execution.',
359
- '- [ ] `owner-external-gate-kit/` has been generated and reviewed before owner/external handoff.',
360
- '- [ ] Host-native invocation is recorded per host before claiming host-native support.',
361
- '',
362
- ].join('\n'),
363
- 'public-release-record.md': publicReleaseRecord,
364
- 'public-acceptance-handoff.md': publicAcceptanceHandoff,
365
- 'host-runtime-evidence-handoff.md': hostRuntimeEvidenceHandoff,
366
- 'release-status-manifest.json': releaseStatusManifest,
367
- 'release-owner-action-plan.md': releaseOwnerActionPlan,
368
- 'public-release-checklist.md': publicReleaseChecklist,
369
- 'owner-external-gate-kit/README.md': readFreshKit('README.md'),
370
- 'owner-external-gate-kit/action-packet.md': readFreshKit('action-packet.md'),
371
- 'owner-external-gate-kit/final-acceptance-packet.md': readFreshKit('final-acceptance-packet.md'),
372
- 'owner-external-gate-kit/public-acceptance-handoff.md': readFreshKit('public-acceptance-handoff.md'),
373
- 'owner-external-gate-kit/host-runtime-evidence-handoff.md': readFreshKit('host-runtime-evidence-handoff.md'),
374
- 'owner-external-gate-kit/release-status-manifest.json': readFreshKit('release-status-manifest.json'),
375
- 'owner-external-gate-kit/release-owner-action-plan.md': readFreshKit('release-owner-action-plan.md'),
376
- 'owner-external-gate-kit/record-commands.md': readFreshKit('record-commands.md'),
377
- 'owner-external-gate-kit/verification-commands.md': readFreshKit('verification-commands.md'),
378
- 'owner-external-gate-kit/kit-manifest.json': readFreshKit('kit-manifest.json'),
379
- 'checksums.sha256': installablePackageHashes
380
- .map((item) => `${item.sha256} installable-package/${item.relativePath}`)
381
- .join('\n') + (installablePackageHashes.length ? '\n' : ''),
382
- 'provenance.json': JSON.stringify({
383
- schemaVersion: 1,
384
- label,
385
- generatedAt: new Date().toISOString(),
386
- generator: 'scripts/generate-release-bundle.mjs',
387
- source: {
388
- displayRoot,
389
- packageName: 'gse',
390
- localSourcePathIncluded: false,
391
- },
392
- installablePackage: installablePackageManifest
393
- ? {
394
- path: 'installable-package/',
395
- manifest: 'installable-package/gse-package-manifest.json',
396
- fileCount: installablePackageManifest.fileCount,
397
- totalBytes: installablePackageManifest.totalBytes,
398
- packageDigest: installablePackageManifest.integrity?.packageDigest ?? null,
399
- algorithm: installablePackageManifest.integrity?.algorithm ?? null,
400
- cli: installablePackageManifest.entrypoints?.cli ?? null,
401
- }
402
- : null,
403
- validation: validationData?.summary ?? null,
404
- publicAcceptance: {
405
- status: releaseStatusData?.claimBoundary?.publicAccepted ?? 'not-accepted',
406
- pendingGates: releaseStatusData?.publicAcceptance?.pendingGates?.length ?? null,
407
- },
408
- claimBoundaries: [
409
- 'This provenance is generated locally from the release bundle generator.',
410
- 'It is not a registry attestation, Sigstore bundle, marketplace approval, public CI attestation, or host-runtime certificate.',
411
- 'Public-final claims require accepted owner/external records and final readiness re-audit.',
412
- ],
413
- checksumsFile: 'checksums.sha256',
414
- }, null, 2) + '\n',
415
- 'bundle-manifest.json': JSON.stringify({
416
- schemaVersion: 1,
417
- label,
418
- generatedAt: new Date().toISOString(),
419
- requiredInputs: required,
420
- validation: validationData?.summary ?? null,
421
- validationChecks,
422
- generatedAcceptanceInputs: {
423
- publicAcceptanceHandoff: 'generated during bundle creation',
424
- releaseStatusManifest: 'generated during bundle creation',
425
- releaseOwnerActionPlan: 'generated during bundle creation',
426
- ownerExternalGateKit: 'generated during bundle creation',
427
- },
428
- publicReleaseAcceptance: releaseStatusData?.claimBoundary?.publicAccepted ?? 'not-accepted',
429
- licenseDecision: licenseDecisionAccepted ? 'accepted' : 'owner-required',
430
- installablePackage: installablePackageManifest
431
- ? {
432
- path: 'installable-package/',
433
- manifest: 'installable-package/gse-package-manifest.json',
434
- fileCount: installablePackageManifest.fileCount,
435
- packageDigest: installablePackageManifest.integrity?.packageDigest ?? null,
436
- algorithm: installablePackageManifest.integrity?.algorithm ?? null,
437
- cli: installablePackageManifest.entrypoints?.cli ?? null,
438
- }
439
- : null,
440
- publicAcceptanceHandoff: 'included',
441
- hostRuntimeEvidenceHandoff: 'included',
442
- releaseStatusManifest: 'included',
443
- releaseOwnerActionPlan: 'included',
444
- ownerExternalGateKit: 'included',
445
- provenance: 'included',
446
- checksums: 'included',
447
- limits: [
448
- 'Bundle does not publish GSE.',
449
- 'Bundle does not choose a license.',
450
- 'Bundle does not prove marketplace approval or host-native slash-command support.',
451
- ],
452
- }, null, 2) + '\n',
453
- }
454
-
455
- function copyDirectory(sourceDir, targetDir) {
456
- if (!fs.existsSync(sourceDir)) return
457
- fs.mkdirSync(targetDir, { recursive: true })
458
- for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
459
- const sourcePath = path.join(sourceDir, entry.name)
460
- const targetPath = path.join(targetDir, entry.name)
461
- if (entry.isDirectory()) copyDirectory(sourcePath, targetPath)
462
- else if (entry.isFile()) fs.copyFileSync(sourcePath, targetPath)
463
- }
464
- }
465
-
466
- const report = {
467
- root,
468
- out,
469
- label,
470
- dryRun,
471
- status: errors.length > 0 ? 'failed' : dryRun ? 'ready' : 'written',
472
- errors,
473
- files: Object.keys(files),
474
- validation: validationData?.summary ?? null,
475
- }
476
-
477
- if (errors.length === 0 && !dryRun) {
478
- if (fs.existsSync(out) && !force) {
479
- report.status = 'exists'
480
- report.errors.push('output exists; use --force or choose another --out path')
481
- } else {
482
- if (fs.existsSync(out)) fs.rmSync(out, { recursive: true, force: true })
483
- fs.mkdirSync(out, { recursive: true })
484
- for (const [fileName, content] of Object.entries(files)) {
485
- const fullPath = path.join(out, fileName)
486
- fs.mkdirSync(path.dirname(fullPath), { recursive: true })
487
- fs.writeFileSync(fullPath, content, 'utf8')
488
- }
489
- copyDirectory(freshInstallablePackagePath, path.join(out, 'installable-package'))
490
- }
491
- }
492
-
493
- if (jsonOnly) console.log(JSON.stringify(report, null, 2))
494
- else {
495
- console.log('Release bundle status: ' + report.status)
496
- console.log('Output: ' + report.out)
497
- if (report.errors.length) {
498
- console.log('Errors:')
499
- for (const error of report.errors) console.log('- ' + error)
500
- }
501
- }
502
-
503
- fs.rmSync(generatedAcceptanceRoot, { recursive: true, force: true })
504
-
505
- if (report.status === 'failed' || report.status === 'exists') process.exit(1)
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import os from 'node:os'
5
+ import crypto from 'node:crypto'
6
+ import { spawnSync } from 'node:child_process'
7
+
8
+ const args = process.argv.slice(2)
9
+
10
+ function readArg(name, fallback = null) {
11
+ const index = args.indexOf(name)
12
+ if (index === -1) return fallback
13
+ return args[index + 1] ?? fallback
14
+ }
15
+
16
+ function hasArg(name) {
17
+ return args.includes(name)
18
+ }
19
+
20
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
21
+ const label = readArg('--label', 'gse-release-bundle-' + new Date().toISOString().slice(0, 10))
22
+ const out = path.resolve(readArg('--out', path.join(root, '.gse', 'release-bundles', label)))
23
+ const displayRoot = readArg('--display-root', '<gse-root>')
24
+ const dryRun = hasArg('--dry-run')
25
+ const force = hasArg('--force')
26
+ const jsonOnly = hasArg('--json')
27
+
28
+ function exists(relativePath) {
29
+ return fs.existsSync(path.join(root, relativePath))
30
+ }
31
+
32
+ function read(relativePath) {
33
+ const fullPath = path.join(root, relativePath)
34
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
35
+ }
36
+
37
+ function run(command, commandArgs) {
38
+ const result = spawnSync(command, commandArgs, {
39
+ cwd: root,
40
+ encoding: 'utf8',
41
+ windowsHide: true,
42
+ })
43
+ return {
44
+ command: [command, ...commandArgs].join(' '),
45
+ status: result.status ?? 1,
46
+ stdout: (result.stdout ?? '').trim(),
47
+ stderr: (result.stderr ?? '').trim(),
48
+ }
49
+ }
50
+
51
+ function parseJson(stdout) {
52
+ try {
53
+ return JSON.parse(stdout)
54
+ } catch {
55
+ return null
56
+ }
57
+ }
58
+
59
+ function sha256File(filePath) {
60
+ return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex')
61
+ }
62
+
63
+ function collectFileHashes(baseDir) {
64
+ const rows = []
65
+ function visit(itemPath) {
66
+ if (!fs.existsSync(itemPath)) return
67
+ const stat = fs.statSync(itemPath)
68
+ if (stat.isDirectory()) {
69
+ for (const child of fs.readdirSync(itemPath)) visit(path.join(itemPath, child))
70
+ return
71
+ }
72
+ if (!stat.isFile()) return
73
+ const relativePath = path.relative(baseDir, itemPath).replace(/\\/g, '/')
74
+ rows.push({
75
+ relativePath,
76
+ sha256: sha256File(itemPath),
77
+ bytes: stat.size,
78
+ })
79
+ }
80
+ visit(baseDir)
81
+ rows.sort((a, b) => a.relativePath.localeCompare(b.relativePath))
82
+ return rows
83
+ }
84
+
85
+ function portableCommand(commandLine) {
86
+ if (!commandLine) return commandLine
87
+ const rootForward = root.replace(/\\/g, '/')
88
+ return commandLine
89
+ .replaceAll(process.execPath, 'node')
90
+ .replaceAll(root, '<gse-root>')
91
+ .replaceAll(rootForward, '<gse-root>')
92
+ .replace(/<gse-root>[\\/]/g, '<gse-root>/')
93
+ .replace(/\\/g, '/')
94
+ }
95
+
96
+ const required = [
97
+ 'SKILL.md',
98
+ 'README.md',
99
+ 'README.zh-CN.md',
100
+ 'CHANGELOG.md',
101
+ 'references/packaging.md',
102
+ 'references/public-release.md',
103
+ 'references/release-trust.md',
104
+ 'references/marketplace-discovery.md',
105
+ 'scripts/validate-gse.mjs',
106
+ 'scripts/package-gse.mjs',
107
+ 'scripts/install-gse.mjs',
108
+ 'scripts/record-public-release.mjs',
109
+ '.gse/releases/public-release-owner-required.md',
110
+ '.gse/acceptance/public-acceptance-handoff.md',
111
+ '.gse/acceptance/host-runtime-evidence-handoff.md',
112
+ ]
113
+
114
+ const errors = []
115
+ for (const item of required) {
116
+ if (!exists(item)) errors.push('missing required release-bundle input: ' + item)
117
+ }
118
+
119
+ const validation = errors.length === 0
120
+ ? run(process.execPath, [path.join(root, 'scripts', 'validate-gse.mjs'), '--root', root, '--skip-distribution', '--skip-skill-validator', '--skip-completion-readiness', '--skip-release-bundle', '--skip-final-form-stale-copy', '--skip-local-final-form-completion', '--json'])
121
+ : null
122
+ const validationData = validation ? parseJson(validation.stdout) : null
123
+ if (validation && validation.status !== 0) errors.push('validation command failed for release bundle readiness')
124
+ const validationChecks = Array.isArray(validationData?.checks)
125
+ ? validationData.checks.map((item) => ({
126
+ id: item.id,
127
+ label: item.label,
128
+ status: item.status,
129
+ command: portableCommand(item.command),
130
+ summary: item.summary ?? null,
131
+ }))
132
+ : []
133
+
134
+ const generatedAcceptanceRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-release-bundle-acceptance-'))
135
+ const freshPublicAcceptanceHandoffPath = path.join(generatedAcceptanceRoot, 'public-acceptance-handoff.md')
136
+ const freshReleaseStatusManifestPath = path.join(generatedAcceptanceRoot, 'release-status-manifest.json')
137
+ const freshReleaseOwnerActionPlanPath = path.join(generatedAcceptanceRoot, 'release-owner-action-plan.md')
138
+ const freshPublicReleaseChecklistPath = path.join(generatedAcceptanceRoot, 'public-release-checklist.md')
139
+ const freshOwnerExternalGateKitPath = path.join(generatedAcceptanceRoot, 'owner-external-gate-kit')
140
+ const freshInstallablePackagePath = path.join(generatedAcceptanceRoot, 'installable-package')
141
+
142
+ if (errors.length === 0) {
143
+ const publicAcceptanceHandoffGeneration = run(process.execPath, [
144
+ path.join(root, 'scripts', 'generate-public-acceptance-handoff.mjs'),
145
+ '--root',
146
+ root,
147
+ '--display-root',
148
+ displayRoot,
149
+ '--out',
150
+ freshPublicAcceptanceHandoffPath,
151
+ '--force',
152
+ '--json',
153
+ ])
154
+ if (publicAcceptanceHandoffGeneration.status !== 0) {
155
+ errors.push('public acceptance handoff generation failed for release bundle')
156
+ }
157
+ const manifestGeneration = run(process.execPath, [
158
+ path.join(root, 'scripts', 'generate-release-status-manifest.mjs'),
159
+ '--root',
160
+ root,
161
+ '--display-root',
162
+ displayRoot,
163
+ '--out',
164
+ freshReleaseStatusManifestPath,
165
+ '--force',
166
+ '--json',
167
+ ])
168
+ if (manifestGeneration.status !== 0) {
169
+ errors.push('release status manifest generation failed for release bundle')
170
+ }
171
+ const actionPlanGeneration = run(process.execPath, [
172
+ path.join(root, 'scripts', 'generate-release-owner-action-plan.mjs'),
173
+ '--root',
174
+ root,
175
+ '--manifest',
176
+ freshReleaseStatusManifestPath,
177
+ '--out',
178
+ freshReleaseOwnerActionPlanPath,
179
+ '--force',
180
+ '--json',
181
+ ])
182
+ if (actionPlanGeneration.status !== 0) {
183
+ errors.push('release owner action plan generation failed for release bundle')
184
+ }
185
+ const publicReleaseChecklistGeneration = run(process.execPath, [
186
+ path.join(root, 'scripts', 'generate-public-release-checklist.mjs'),
187
+ '--root',
188
+ root,
189
+ '--display-root',
190
+ displayRoot,
191
+ '--manifest',
192
+ freshReleaseStatusManifestPath,
193
+ '--out',
194
+ freshPublicReleaseChecklistPath,
195
+ '--force',
196
+ '--json',
197
+ ])
198
+ if (publicReleaseChecklistGeneration.status !== 0) {
199
+ errors.push('public release checklist generation failed for release bundle')
200
+ }
201
+ const ownerExternalGateKitGeneration = run(process.execPath, [
202
+ path.join(root, 'scripts', 'generate-owner-external-gate-kit.mjs'),
203
+ '--root',
204
+ root,
205
+ '--display-root',
206
+ displayRoot,
207
+ '--out',
208
+ freshOwnerExternalGateKitPath,
209
+ '--force',
210
+ '--json',
211
+ ])
212
+ if (ownerExternalGateKitGeneration.status !== 0) {
213
+ errors.push('owner/external gate kit generation failed for release bundle')
214
+ }
215
+ const packageGeneration = run(process.execPath, [
216
+ path.join(root, 'scripts', 'package-gse.mjs'),
217
+ '--root',
218
+ root,
219
+ '--out',
220
+ freshInstallablePackagePath,
221
+ '--label',
222
+ label + '-installable',
223
+ '--json',
224
+ ])
225
+ if (packageGeneration.status !== 0) {
226
+ errors.push('installable package generation failed for release bundle')
227
+ }
228
+ }
229
+
230
+ const publicReleaseRecord = read('.gse/releases/public-release-owner-required.md')
231
+ const publicAcceptanceHandoff = fs.existsSync(freshPublicAcceptanceHandoffPath) ? fs.readFileSync(freshPublicAcceptanceHandoffPath, 'utf8') : ''
232
+ const hostRuntimeEvidenceHandoff = read('.gse/acceptance/host-runtime-evidence-handoff.md')
233
+ const releaseStatusManifest = fs.existsSync(freshReleaseStatusManifestPath) ? fs.readFileSync(freshReleaseStatusManifestPath, 'utf8') : ''
234
+ const releaseOwnerActionPlan = fs.existsSync(freshReleaseOwnerActionPlanPath) ? fs.readFileSync(freshReleaseOwnerActionPlanPath, 'utf8') : ''
235
+ const publicReleaseChecklist = fs.existsSync(freshPublicReleaseChecklistPath) ? fs.readFileSync(freshPublicReleaseChecklistPath, 'utf8') : ''
236
+ function readFreshKit(fileName) {
237
+ const fullPath = path.join(freshOwnerExternalGateKitPath, fileName)
238
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
239
+ }
240
+ const releaseStatusData = parseJson(releaseStatusManifest)
241
+ const installablePackageManifestPath = path.join(freshInstallablePackagePath, 'gse-package-manifest.json')
242
+ const installablePackageManifest = fs.existsSync(installablePackageManifestPath)
243
+ ? parseJson(fs.readFileSync(installablePackageManifestPath, 'utf8'))
244
+ : null
245
+ const installablePackageHashes = fs.existsSync(freshInstallablePackagePath)
246
+ ? collectFileHashes(freshInstallablePackagePath)
247
+ : []
248
+ const licenseDecisionAccepted =
249
+ publicReleaseRecord.includes('License status: selected') &&
250
+ publicReleaseRecord.includes('SPDX identifier: MIT') &&
251
+ publicReleaseRecord.includes('Evidence status: accepted')
252
+ const releaseSummary = [
253
+ '# GSE Release Bundle',
254
+ '',
255
+ 'Bundle label: ' + label,
256
+ '',
257
+ 'Generated: ' + new Date().toISOString(),
258
+ '',
259
+ 'Source root: ' + displayRoot,
260
+ '',
261
+ '## Readiness',
262
+ '',
263
+ 'Status: verified for local package, URL install, signing mechanics, command semantics, public-release metadata, and release decision record.',
264
+ '',
265
+ 'Accepted public release: not accepted until public security contact, public repository settings, public CI, public channel publication, and host runtime evidence are recorded.',
266
+ '',
267
+ '## License Decision',
268
+ '',
269
+ publicReleaseRecord.includes('License status: owner-required')
270
+ ? 'License status: owner-required'
271
+ : licenseDecisionAccepted
272
+ ? 'License status: selected; SPDX identifier: MIT; Evidence status: accepted'
273
+ : 'License status: unknown',
274
+ '',
275
+ '## Install Commands',
276
+ '',
277
+ 'This bundle includes an installable package snapshot under `installable-package/`.',
278
+ '',
279
+ '```text',
280
+ 'node <skill>/scripts/install-gse.mjs --source <release-bundle>/installable-package --target <install-skill-dir>',
281
+ 'node <install-skill-dir>/scripts/validate-gse.mjs --root <install-skill-dir> --skip-skill-validator --skip-distribution --skip-completion-readiness --json',
282
+ 'node <install-skill-dir>/scripts/gse.mjs status --target <install-skill-dir> --json',
283
+ '```',
284
+ '',
285
+ '## Verification Command',
286
+ '',
287
+ '```text',
288
+ 'node <skill>/scripts/validate-gse.mjs --root <skill> --json',
289
+ '```',
290
+ '',
291
+ 'Latest local bundle precheck: ' + (validationData?.summary?.status ?? 'not-run') + ', checks ' + (validationData?.summary ? `${validationData.summary.passed}/${validationData.summary.total}` : 'unknown'),
292
+ '',
293
+ 'Validation manifest detail: `bundle-manifest.json` includes compact `validationChecks[]` entries for the checks that produced the precheck total.',
294
+ '',
295
+ '## Public Acceptance Handoff',
296
+ '',
297
+ 'Use `public-acceptance-handoff.md` before public release handoff. It lists the owner/external gates that must be backed by real accepted evidence before public acceptance can be claimed.',
298
+ '',
299
+ '## Host Runtime Evidence Handoff',
300
+ '',
301
+ 'Use `host-runtime-evidence-handoff.md` before claiming cross-host support. It lists host families, record commands, and anti-overclaim rules for native slash-command and portable command evidence.',
302
+ '',
303
+ 'Run `audit-host-runtime-invocation-drill.mjs` before cross-host release handoff to verify record/audit mechanics without treating fixture records as real host evidence.',
304
+ '',
305
+ '## Release Status Manifest',
306
+ '',
307
+ 'Use `release-status-manifest.json` when another host, CI job, marketplace checklist, or maintainer needs a machine-readable summary of verified capabilities and pending owner/external gates.',
308
+ '',
309
+ '## Release Owner Action Plan',
310
+ '',
311
+ 'Use `release-owner-action-plan.md` when a human owner or maintainer needs the remaining public-release actions grouped by responsible party with exact record commands.',
312
+ '',
313
+ '## Public Release Checklist',
314
+ '',
315
+ 'Use `public-release-checklist.md` when the owner needs a linear release runway from bundle preparation through repository, security, CI, registry, marketplace, host evidence, and final verification.',
316
+ '',
317
+ '## Owner / External Gate Kit',
318
+ '',
319
+ 'Use `owner-external-gate-kit/` as the one-directory execution packet for the remaining owner-required and external-required gates. It includes final acceptance, public handoff, host runtime evidence, record commands, verification commands, and a machine-readable kit manifest.',
320
+ '',
321
+ '## External Evidence Not Included',
322
+ '',
323
+ '- Public marketplace approval or publication.',
324
+ '- Public registry publication.',
325
+ '- Legal suitability of a selected license.',
326
+ '- Host-native slash-command runtime execution unless a host-specific invocation record exists.',
327
+ '',
328
+ ]
329
+
330
+ const files = {
331
+ 'release-summary.md': releaseSummary.join('\n'),
332
+ 'install-commands.md': [
333
+ '# Install Commands',
334
+ '',
335
+ 'This release bundle includes an installable GSE package snapshot.',
336
+ '',
337
+ '```text',
338
+ 'node <skill>/scripts/install-gse.mjs --source <release-bundle>/installable-package --target <install-skill-dir>',
339
+ 'node <install-skill-dir>/scripts/validate-gse.mjs --root <install-skill-dir> --skip-skill-validator --skip-distribution --skip-completion-readiness --json',
340
+ 'node <install-skill-dir>/scripts/gse.mjs status --target <install-skill-dir> --json',
341
+ '```',
342
+ '',
343
+ ].join('\n'),
344
+ 'validation-checklist.md': [
345
+ '# Validation Checklist',
346
+ '',
347
+ '- [ ] `validate-gse.mjs` passes in source environment.',
348
+ '- [ ] `audit-distribution.mjs` passes for local package/install.',
349
+ '- [ ] `audit-remote-distribution.mjs` passes for URL install and integrity.',
350
+ '- [ ] `audit-signing.mjs` passes for signing mechanics.',
351
+ '- [ ] `audit-public-release-metadata.mjs` passes.',
352
+ '- [ ] MIT license decision is recorded; accepted public release still requires real owner/external evidence.',
353
+ '- [ ] `public-acceptance-handoff.md` has been reviewed before public release handoff.',
354
+ '- [ ] `host-runtime-evidence-handoff.md` has been reviewed before claiming cross-host or native slash-command support.',
355
+ '- [ ] `audit-host-runtime-invocation-drill.mjs` passes before cross-host release handoff.',
356
+ '- [ ] `release-status-manifest.json` has been regenerated from current audits before handoff.',
357
+ '- [ ] `release-owner-action-plan.md` has been regenerated from current manifest before owner handoff.',
358
+ '- [ ] `public-release-checklist.md` has been regenerated from current manifest before public release execution.',
359
+ '- [ ] `owner-external-gate-kit/` has been generated and reviewed before owner/external handoff.',
360
+ '- [ ] Host-native invocation is recorded per host before claiming host-native support.',
361
+ '',
362
+ ].join('\n'),
363
+ 'public-release-record.md': publicReleaseRecord,
364
+ 'public-acceptance-handoff.md': publicAcceptanceHandoff,
365
+ 'host-runtime-evidence-handoff.md': hostRuntimeEvidenceHandoff,
366
+ 'release-status-manifest.json': releaseStatusManifest,
367
+ 'release-owner-action-plan.md': releaseOwnerActionPlan,
368
+ 'public-release-checklist.md': publicReleaseChecklist,
369
+ 'owner-external-gate-kit/README.md': readFreshKit('README.md'),
370
+ 'owner-external-gate-kit/action-packet.md': readFreshKit('action-packet.md'),
371
+ 'owner-external-gate-kit/final-acceptance-packet.md': readFreshKit('final-acceptance-packet.md'),
372
+ 'owner-external-gate-kit/public-acceptance-handoff.md': readFreshKit('public-acceptance-handoff.md'),
373
+ 'owner-external-gate-kit/host-runtime-evidence-handoff.md': readFreshKit('host-runtime-evidence-handoff.md'),
374
+ 'owner-external-gate-kit/release-status-manifest.json': readFreshKit('release-status-manifest.json'),
375
+ 'owner-external-gate-kit/release-owner-action-plan.md': readFreshKit('release-owner-action-plan.md'),
376
+ 'owner-external-gate-kit/record-commands.md': readFreshKit('record-commands.md'),
377
+ 'owner-external-gate-kit/verification-commands.md': readFreshKit('verification-commands.md'),
378
+ 'owner-external-gate-kit/kit-manifest.json': readFreshKit('kit-manifest.json'),
379
+ 'checksums.sha256': installablePackageHashes
380
+ .map((item) => `${item.sha256} installable-package/${item.relativePath}`)
381
+ .join('\n') + (installablePackageHashes.length ? '\n' : ''),
382
+ 'provenance.json': JSON.stringify({
383
+ schemaVersion: 1,
384
+ label,
385
+ generatedAt: new Date().toISOString(),
386
+ generator: 'scripts/generate-release-bundle.mjs',
387
+ source: {
388
+ displayRoot,
389
+ packageName: 'gse',
390
+ localSourcePathIncluded: false,
391
+ },
392
+ installablePackage: installablePackageManifest
393
+ ? {
394
+ path: 'installable-package/',
395
+ manifest: 'installable-package/gse-package-manifest.json',
396
+ fileCount: installablePackageManifest.fileCount,
397
+ totalBytes: installablePackageManifest.totalBytes,
398
+ packageDigest: installablePackageManifest.integrity?.packageDigest ?? null,
399
+ algorithm: installablePackageManifest.integrity?.algorithm ?? null,
400
+ cli: installablePackageManifest.entrypoints?.cli ?? null,
401
+ }
402
+ : null,
403
+ validation: validationData?.summary ?? null,
404
+ publicAcceptance: {
405
+ status: releaseStatusData?.claimBoundary?.publicAccepted ?? 'not-accepted',
406
+ pendingGates: releaseStatusData?.publicAcceptance?.pendingGates?.length ?? null,
407
+ },
408
+ claimBoundaries: [
409
+ 'This provenance is generated locally from the release bundle generator.',
410
+ 'It is not a registry attestation, Sigstore bundle, marketplace approval, public CI attestation, or host-runtime certificate.',
411
+ 'Public-final claims require accepted owner/external records and final readiness re-audit.',
412
+ ],
413
+ checksumsFile: 'checksums.sha256',
414
+ }, null, 2) + '\n',
415
+ 'bundle-manifest.json': JSON.stringify({
416
+ schemaVersion: 1,
417
+ label,
418
+ generatedAt: new Date().toISOString(),
419
+ requiredInputs: required,
420
+ validation: validationData?.summary ?? null,
421
+ validationChecks,
422
+ generatedAcceptanceInputs: {
423
+ publicAcceptanceHandoff: 'generated during bundle creation',
424
+ releaseStatusManifest: 'generated during bundle creation',
425
+ releaseOwnerActionPlan: 'generated during bundle creation',
426
+ ownerExternalGateKit: 'generated during bundle creation',
427
+ },
428
+ publicReleaseAcceptance: releaseStatusData?.claimBoundary?.publicAccepted ?? 'not-accepted',
429
+ licenseDecision: licenseDecisionAccepted ? 'accepted' : 'owner-required',
430
+ installablePackage: installablePackageManifest
431
+ ? {
432
+ path: 'installable-package/',
433
+ manifest: 'installable-package/gse-package-manifest.json',
434
+ fileCount: installablePackageManifest.fileCount,
435
+ packageDigest: installablePackageManifest.integrity?.packageDigest ?? null,
436
+ algorithm: installablePackageManifest.integrity?.algorithm ?? null,
437
+ cli: installablePackageManifest.entrypoints?.cli ?? null,
438
+ }
439
+ : null,
440
+ publicAcceptanceHandoff: 'included',
441
+ hostRuntimeEvidenceHandoff: 'included',
442
+ releaseStatusManifest: 'included',
443
+ releaseOwnerActionPlan: 'included',
444
+ ownerExternalGateKit: 'included',
445
+ provenance: 'included',
446
+ checksums: 'included',
447
+ limits: [
448
+ 'Bundle does not publish GSE.',
449
+ 'Bundle does not choose a license.',
450
+ 'Bundle does not prove marketplace approval or host-native slash-command support.',
451
+ ],
452
+ }, null, 2) + '\n',
453
+ }
454
+
455
+ function copyDirectory(sourceDir, targetDir) {
456
+ if (!fs.existsSync(sourceDir)) return
457
+ fs.mkdirSync(targetDir, { recursive: true })
458
+ for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
459
+ const sourcePath = path.join(sourceDir, entry.name)
460
+ const targetPath = path.join(targetDir, entry.name)
461
+ if (entry.isDirectory()) copyDirectory(sourcePath, targetPath)
462
+ else if (entry.isFile()) fs.copyFileSync(sourcePath, targetPath)
463
+ }
464
+ }
465
+
466
+ const report = {
467
+ root,
468
+ out,
469
+ label,
470
+ dryRun,
471
+ status: errors.length > 0 ? 'failed' : dryRun ? 'ready' : 'written',
472
+ errors,
473
+ files: Object.keys(files),
474
+ validation: validationData?.summary ?? null,
475
+ }
476
+
477
+ if (errors.length === 0 && !dryRun) {
478
+ if (fs.existsSync(out) && !force) {
479
+ report.status = 'exists'
480
+ report.errors.push('output exists; use --force or choose another --out path')
481
+ } else {
482
+ if (fs.existsSync(out)) fs.rmSync(out, { recursive: true, force: true })
483
+ fs.mkdirSync(out, { recursive: true })
484
+ for (const [fileName, content] of Object.entries(files)) {
485
+ const fullPath = path.join(out, fileName)
486
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true })
487
+ fs.writeFileSync(fullPath, content, 'utf8')
488
+ }
489
+ copyDirectory(freshInstallablePackagePath, path.join(out, 'installable-package'))
490
+ }
491
+ }
492
+
493
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
494
+ else {
495
+ console.log('Release bundle status: ' + report.status)
496
+ console.log('Output: ' + report.out)
497
+ if (report.errors.length) {
498
+ console.log('Errors:')
499
+ for (const error of report.errors) console.log('- ' + error)
500
+ }
501
+ }
502
+
503
+ fs.rmSync(generatedAcceptanceRoot, { recursive: true, force: true })
504
+
505
+ if (report.status === 'failed' || report.status === 'exists') process.exit(1)