@t275005746/gse 0.1.0

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 (207) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
  2. package/.github/ISSUE_TEMPLATE/change_request.yml +50 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  5. package/.github/workflows/validate-gse.yml +33 -0
  6. package/.gse/README.md +18 -0
  7. package/.gse/gse-development-protocol.md +50 -0
  8. package/.gse/project-profile.md +29 -0
  9. package/.gse/quality-gates.md +25 -0
  10. package/.gse/releases/public-channel-publication-pending.md +49 -0
  11. package/.gse/releases/public-ci-run-pending.md +53 -0
  12. package/.gse/releases/public-release-owner-required.md +65 -0
  13. package/.gse/releases/public-repository-settings-owner-required.md +59 -0
  14. package/.gse/releases/public-security-contact-owner-required.md +45 -0
  15. package/.gse/state.json +27 -0
  16. package/CHANGELOG.md +24 -0
  17. package/CONTRIBUTING.md +64 -0
  18. package/LICENSE +21 -0
  19. package/README.md +236 -0
  20. package/README.zh-CN.md +236 -0
  21. package/SECURITY.md +41 -0
  22. package/SKILL.md +148 -0
  23. package/SUPPORT.md +38 -0
  24. package/agents/openai.yaml +4 -0
  25. package/assets/marketplace/README.md +7 -0
  26. package/assets/marketplace/gse-listing.json +75 -0
  27. package/assets/templates/acceptance-execution-packet.md +73 -0
  28. package/assets/templates/adr.md +14 -0
  29. package/assets/templates/change-brief.md +16 -0
  30. package/assets/templates/design.md +18 -0
  31. package/assets/templates/dispatch-packet.md +104 -0
  32. package/assets/templates/evidence.md +14 -0
  33. package/assets/templates/execution-quality-pack.md +65 -0
  34. package/assets/templates/goal-map.md +21 -0
  35. package/assets/templates/host-adapter.md +48 -0
  36. package/assets/templates/host-ui-invocation-record.md +42 -0
  37. package/assets/templates/incident-review.md +60 -0
  38. package/assets/templates/public-channel-publication-record.md +49 -0
  39. package/assets/templates/public-ci-run-record.md +53 -0
  40. package/assets/templates/public-release-record.md +65 -0
  41. package/assets/templates/public-repository-settings-record.md +59 -0
  42. package/assets/templates/public-security-contact-record.md +45 -0
  43. package/assets/templates/release-trust-record.md +32 -0
  44. package/assets/templates/review.md +18 -0
  45. package/assets/templates/spec.md +16 -0
  46. package/assets/templates/target-adoption-evidence.md +29 -0
  47. package/assets/templates/tasks.md +17 -0
  48. package/assets/templates/update-release-acceptance-record.md +58 -0
  49. package/examples/README.md +22 -0
  50. package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -0
  51. package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -0
  52. package/examples/agent-runtime-host/.gse/goal-map.md +7 -0
  53. package/examples/agent-runtime-host/.gse/project-profile.md +27 -0
  54. package/examples/agent-runtime-host/.gse/tooling.md +5 -0
  55. package/examples/agent-runtime-host/.mcp.json +9 -0
  56. package/examples/agent-runtime-host/AGENTS.md +5 -0
  57. package/examples/agent-runtime-host/README.md +10 -0
  58. package/examples/agent-runtime-host/docs/model-routing.md +5 -0
  59. package/examples/cli-tool/.gse/project-profile.md +21 -0
  60. package/examples/cli-tool/AGENTS.md +5 -0
  61. package/examples/cli-tool/README.md +12 -0
  62. package/examples/cli-tool/package.json +21 -0
  63. package/examples/small-app/.env.example +2 -0
  64. package/examples/small-app/.github/workflows/ci.yml +8 -0
  65. package/examples/small-app/AGENTS.md +5 -0
  66. package/examples/small-app/README.md +12 -0
  67. package/examples/small-app/package.json +26 -0
  68. package/examples/small-app/playwright.config.ts +4 -0
  69. package/package.json +53 -0
  70. package/references/adoption-recipes.md +171 -0
  71. package/references/agent-roles.md +49 -0
  72. package/references/architecture-health.md +101 -0
  73. package/references/benchmark-audit.md +73 -0
  74. package/references/commands.md +295 -0
  75. package/references/community-channels.md +46 -0
  76. package/references/compatibility.md +70 -0
  77. package/references/design-basis.md +38 -0
  78. package/references/domain-model.md +129 -0
  79. package/references/domain-quality-gates.md +75 -0
  80. package/references/drift-audit.md +81 -0
  81. package/references/evidence-taxonomy.md +123 -0
  82. package/references/file-ownership.md +107 -0
  83. package/references/final-readiness.md +84 -0
  84. package/references/forward-test.md +133 -0
  85. package/references/goal-map.md +36 -0
  86. package/references/host-adapters.md +119 -0
  87. package/references/learning-system.md +35 -0
  88. package/references/marketplace-discovery.md +46 -0
  89. package/references/model-routing.md +103 -0
  90. package/references/open-source-defaults.md +39 -0
  91. package/references/operating-model.md +52 -0
  92. package/references/packaging.md +277 -0
  93. package/references/project-agent-workspace.md +89 -0
  94. package/references/project-bootstrap.md +122 -0
  95. package/references/project-profile.md +57 -0
  96. package/references/public-release.md +174 -0
  97. package/references/quality-gates.md +100 -0
  98. package/references/recovery.md +176 -0
  99. package/references/release-trust.md +43 -0
  100. package/references/release.md +126 -0
  101. package/references/review.md +141 -0
  102. package/references/router.md +90 -0
  103. package/references/spec-workflow.md +66 -0
  104. package/references/task-levels.md +81 -0
  105. package/references/tool-adapters.md +73 -0
  106. package/scripts/audit-acceptance-execution-packet.mjs +133 -0
  107. package/scripts/audit-adoption-recipes.mjs +99 -0
  108. package/scripts/audit-adoption.mjs +154 -0
  109. package/scripts/audit-change-lifecycle.mjs +77 -0
  110. package/scripts/audit-change-system.mjs +134 -0
  111. package/scripts/audit-ci-readiness.mjs +107 -0
  112. package/scripts/audit-close-gate.mjs +323 -0
  113. package/scripts/audit-command-adapters.mjs +91 -0
  114. package/scripts/audit-command-execution.mjs +210 -0
  115. package/scripts/audit-commands.mjs +117 -0
  116. package/scripts/audit-compatibility.mjs +149 -0
  117. package/scripts/audit-completion-readiness.mjs +292 -0
  118. package/scripts/audit-distribution.mjs +251 -0
  119. package/scripts/audit-domain-quality-gates.mjs +108 -0
  120. package/scripts/audit-evidence-placeholders.mjs +126 -0
  121. package/scripts/audit-final-acceptance-packet.mjs +148 -0
  122. package/scripts/audit-final-form-progress-report.mjs +161 -0
  123. package/scripts/audit-final-form-stale-copy.mjs +221 -0
  124. package/scripts/audit-final-readiness-promotion.mjs +255 -0
  125. package/scripts/audit-final-readiness.mjs +226 -0
  126. package/scripts/audit-fixtures.mjs +154 -0
  127. package/scripts/audit-fresh-session-readiness.mjs +177 -0
  128. package/scripts/audit-gse.mjs +275 -0
  129. package/scripts/audit-host-adapters.mjs +119 -0
  130. package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -0
  131. package/scripts/audit-host-runtime-invocation-drill.mjs +240 -0
  132. package/scripts/audit-host-runtime-invocations.mjs +254 -0
  133. package/scripts/audit-host-ui-invocation.mjs +132 -0
  134. package/scripts/audit-learning-system.mjs +103 -0
  135. package/scripts/audit-local-final-form-completion.mjs +131 -0
  136. package/scripts/audit-marketplace-discovery.mjs +122 -0
  137. package/scripts/audit-npm-package-metadata.mjs +155 -0
  138. package/scripts/audit-npm-publish-dry-run.mjs +169 -0
  139. package/scripts/audit-npm-tarball-install.mjs +191 -0
  140. package/scripts/audit-open-source-defaults.mjs +92 -0
  141. package/scripts/audit-open-source-readiness.mjs +97 -0
  142. package/scripts/audit-owner-external-gate-kit.mjs +218 -0
  143. package/scripts/audit-project.mjs +323 -0
  144. package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -0
  145. package/scripts/audit-public-acceptance-handoff.mjs +142 -0
  146. package/scripts/audit-public-acceptance-readiness.mjs +224 -0
  147. package/scripts/audit-public-channel-publication.mjs +248 -0
  148. package/scripts/audit-public-ci-run.mjs +184 -0
  149. package/scripts/audit-public-collaboration-templates.mjs +98 -0
  150. package/scripts/audit-public-external-gate-probe.mjs +206 -0
  151. package/scripts/audit-public-release-checklist.mjs +133 -0
  152. package/scripts/audit-public-release-decision.mjs +201 -0
  153. package/scripts/audit-public-release-metadata.mjs +176 -0
  154. package/scripts/audit-public-repository-settings.mjs +237 -0
  155. package/scripts/audit-public-security-contact.mjs +171 -0
  156. package/scripts/audit-readme-docs.mjs +185 -0
  157. package/scripts/audit-recovery-readiness.mjs +98 -0
  158. package/scripts/audit-release-bundle.mjs +251 -0
  159. package/scripts/audit-release-owner-action-plan-drill.mjs +277 -0
  160. package/scripts/audit-release-owner-action-plan.mjs +164 -0
  161. package/scripts/audit-release-readiness.mjs +106 -0
  162. package/scripts/audit-release-status-manifest.mjs +165 -0
  163. package/scripts/audit-release-trust.mjs +62 -0
  164. package/scripts/audit-remote-distribution.mjs +266 -0
  165. package/scripts/audit-roadmap-consistency.mjs +235 -0
  166. package/scripts/audit-signing.mjs +147 -0
  167. package/scripts/audit-state-freshness.mjs +113 -0
  168. package/scripts/audit-target-adoption-evidence.mjs +117 -0
  169. package/scripts/audit-target-project.mjs +507 -0
  170. package/scripts/audit-update-release-acceptance.mjs +136 -0
  171. package/scripts/audit-v1-target-validation.mjs +269 -0
  172. package/scripts/audit-validation-profiles.mjs +125 -0
  173. package/scripts/close-change.mjs +116 -0
  174. package/scripts/discover-project-profile.mjs +307 -0
  175. package/scripts/forward-test-gse.mjs +146 -0
  176. package/scripts/generate-command-adapter.mjs +231 -0
  177. package/scripts/generate-final-acceptance-packet.mjs +181 -0
  178. package/scripts/generate-final-form-progress-report.mjs +205 -0
  179. package/scripts/generate-host-adapter.mjs +73 -0
  180. package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -0
  181. package/scripts/generate-owner-external-gate-kit.mjs +295 -0
  182. package/scripts/generate-public-acceptance-handoff.mjs +168 -0
  183. package/scripts/generate-public-release-checklist.mjs +207 -0
  184. package/scripts/generate-release-bundle.mjs +505 -0
  185. package/scripts/generate-release-owner-action-plan.mjs +172 -0
  186. package/scripts/generate-release-status-manifest.mjs +200 -0
  187. package/scripts/generate-session-prompt.mjs +188 -0
  188. package/scripts/gse.mjs +67 -0
  189. package/scripts/init-change.mjs +265 -0
  190. package/scripts/init-project.mjs +785 -0
  191. package/scripts/install-gse.mjs +234 -0
  192. package/scripts/lib/evidence-placeholders.mjs +28 -0
  193. package/scripts/package-gse.mjs +174 -0
  194. package/scripts/probe-public-external-gates.mjs +167 -0
  195. package/scripts/record-host-invocation.mjs +151 -0
  196. package/scripts/record-learning.mjs +137 -0
  197. package/scripts/record-public-channel-publication.mjs +178 -0
  198. package/scripts/record-public-ci-run.mjs +180 -0
  199. package/scripts/record-public-release.mjs +175 -0
  200. package/scripts/record-public-repository-settings.mjs +209 -0
  201. package/scripts/record-public-security-contact.mjs +157 -0
  202. package/scripts/run-gse-command.mjs +538 -0
  203. package/scripts/run-validation-profile.mjs +146 -0
  204. package/scripts/sign-gse-package.mjs +83 -0
  205. package/scripts/update-project-state.mjs +223 -0
  206. package/scripts/validate-gse.mjs +1168 -0
  207. package/scripts/verify-gse-package.mjs +85 -0
@@ -0,0 +1,206 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import http from 'node:http'
4
+ import os from 'node:os'
5
+ import path from 'node:path'
6
+ import { spawn, 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
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
17
+ const jsonOnly = args.includes('--json')
18
+
19
+ function read(relativePath) {
20
+ const fullPath = path.join(root, relativePath)
21
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
22
+ }
23
+
24
+ function exists(relativePath) {
25
+ return fs.existsSync(path.join(root, relativePath))
26
+ }
27
+
28
+ function run(command, commandArgs) {
29
+ const result = spawnSync(command, commandArgs, {
30
+ cwd: root,
31
+ encoding: 'utf8',
32
+ windowsHide: true,
33
+ })
34
+ return {
35
+ status: result.status ?? 1,
36
+ stdout: (result.stdout ?? '').trim(),
37
+ stderr: (result.stderr ?? '').trim(),
38
+ command: [command, ...commandArgs].join(' '),
39
+ }
40
+ }
41
+
42
+ function runAsync(command, commandArgs) {
43
+ return new Promise((resolve) => {
44
+ const child = spawn(command, commandArgs, {
45
+ cwd: root,
46
+ windowsHide: true,
47
+ stdio: ['ignore', 'pipe', 'pipe'],
48
+ })
49
+ let stdout = ''
50
+ let stderr = ''
51
+ child.stdout.setEncoding('utf8')
52
+ child.stderr.setEncoding('utf8')
53
+ child.stdout.on('data', (chunk) => {
54
+ stdout += chunk
55
+ })
56
+ child.stderr.on('data', (chunk) => {
57
+ stderr += chunk
58
+ })
59
+ child.on('close', (status) => {
60
+ resolve({
61
+ status: status ?? 1,
62
+ stdout: stdout.trim(),
63
+ stderr: stderr.trim(),
64
+ command: [command, ...commandArgs].join(' '),
65
+ })
66
+ })
67
+ })
68
+ }
69
+
70
+ function parseJson(stdout) {
71
+ try {
72
+ return JSON.parse(stdout)
73
+ } catch {
74
+ return null
75
+ }
76
+ }
77
+
78
+ function check(id, label, ok, evidence, risk = '') {
79
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
80
+ }
81
+
82
+ function startServer() {
83
+ const server = http.createServer((request, response) => {
84
+ response.writeHead(200, { 'content-type': 'text/plain; charset=utf-8' })
85
+ response.end('gse fixture evidence\n')
86
+ })
87
+ return new Promise((resolve, reject) => {
88
+ server.once('error', reject)
89
+ server.listen(0, '127.0.0.1', () => {
90
+ const address = server.address()
91
+ resolve({ server, url: `http://127.0.0.1:${address.port}` })
92
+ })
93
+ })
94
+ }
95
+
96
+ const probeScript = path.join(root, 'scripts', 'probe-public-external-gates.mjs')
97
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-public-external-probe-'))
98
+ const hostEvidence = path.join(fixture, 'host-evidence.txt')
99
+ fs.writeFileSync(hostEvidence, 'fixture host transcript\n', 'utf8')
100
+ const { server, url } = await startServer()
101
+
102
+ let positive
103
+ let negativePlaceholder
104
+ let negativeMissingFile
105
+ let waiting
106
+ try {
107
+ positive = await runAsync(process.execPath, [
108
+ probeScript,
109
+ '--root', root,
110
+ '--allow-local-fixture',
111
+ '--timeout-ms', '3000',
112
+ '--public-repo-url', `${url}/repo`,
113
+ '--security-contact-url', `${url}/security`,
114
+ '--public-ci-run-url', `${url}/ci`,
115
+ '--registry-package-url', `${url}/package`,
116
+ '--marketplace-url', `${url}/marketplace`,
117
+ '--native-host-evidence', hostEvidence,
118
+ '--other-host-evidence', `${url}/host`,
119
+ '--json',
120
+ ])
121
+ negativePlaceholder = run(process.execPath, [
122
+ probeScript,
123
+ '--root', root,
124
+ '--public-repo-url', 'https://github.com/example/gse',
125
+ '--registry-package-url', 'https://example.com/gse',
126
+ '--json',
127
+ ])
128
+ negativeMissingFile = run(process.execPath, [
129
+ probeScript,
130
+ '--root', root,
131
+ '--native-host-evidence', path.join(fixture, 'missing.txt'),
132
+ '--json',
133
+ ])
134
+ waiting = run(process.execPath, [probeScript, '--root', root, '--json'])
135
+ } finally {
136
+ await new Promise((resolve) => server.close(resolve))
137
+ fs.rmSync(fixture, { recursive: true, force: true })
138
+ }
139
+
140
+ const positiveData = parseJson(positive.stdout)
141
+ const negativePlaceholderData = parseJson(negativePlaceholder.stdout)
142
+ const negativeMissingFileData = parseJson(negativeMissingFile.stdout)
143
+ const waitingData = parseJson(waiting.stdout)
144
+ const skill = read('SKILL.md')
145
+ const validate = read('scripts/validate-gse.mjs')
146
+ const completion = read('scripts/audit-completion-readiness.mjs')
147
+ const ownerKitGenerator = read('scripts/generate-owner-external-gate-kit.mjs')
148
+ const verificationCommands = read('.gse/acceptance/owner-external-gate-kit/verification-commands.md')
149
+
150
+ const checks = [
151
+ check('PEG01', 'public external gate probe exists', exists('scripts/probe-public-external-gates.mjs'), 'scripts/probe-public-external-gates.mjs'),
152
+ check('PEG02', 'probe accepts reachable evidence locations in fixture mode', positive.status === 0 && positiveData?.status === 'ready' && positiveData?.summary?.checked === 7 && positiveData?.summary?.failed === 0, positive.command),
153
+ check('PEG03', 'probe rejects placeholder and example public evidence', negativePlaceholder.status !== 0 && negativePlaceholderData?.status === 'failed' && negativePlaceholderData?.probes?.some((item) => item.errors?.some((error) => error.includes('not a placeholder'))), negativePlaceholder.command),
154
+ check('PEG04', 'probe rejects missing host evidence files', negativeMissingFile.status !== 0 && negativeMissingFileData?.status === 'failed' && negativeMissingFileData?.probes?.some((item) => item.errors?.some((error) => error.includes('existing evidence file'))), negativeMissingFile.command),
155
+ check('PEG05', 'probe can run without evidence inputs as a waiting diagnostic', waiting.status === 0 && waitingData?.status === 'waiting-for-input' && waitingData?.summary?.checked === 0, waiting.command),
156
+ check('PEG06', 'probe keeps acceptance boundary explicit', positiveData?.limits?.some((item) => item.includes('does not publish GSE')) && positiveData?.limits?.some((item) => item.includes('record script')), 'probe report limits'),
157
+ check('PEG07', 'GSE routing and owner kit mention the portable probe command', skill.includes('probe-public-external-gates.mjs') && ownerKitGenerator.includes('run-gse-command.mjs') && ownerKitGenerator.includes('/gse probe') && verificationCommands.includes('run-gse-command.mjs') && verificationCommands.includes('/gse probe') && !verificationCommands.includes('node scripts/probe-public-external-gates.mjs'), 'SKILL.md, generate-owner-external-gate-kit.mjs, owner kit verification commands'),
158
+ check('PEG08', 'validator and completion readiness include the probe audit', validate.includes('audit-public-external-gate-probe.mjs') && completion.includes('audit-public-external-gate-probe.mjs'), 'scripts/validate-gse.mjs, scripts/audit-completion-readiness.mjs'),
159
+ ]
160
+
161
+ const passed = checks.filter((item) => item.status === 'passed').length
162
+ const failed = checks.length - passed
163
+ const report = {
164
+ root,
165
+ generatedAt: new Date().toISOString(),
166
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
167
+ workflows: {
168
+ publicExternalGateProbe: failed === 0 ? 'verified' : 'failed',
169
+ },
170
+ limits: [
171
+ 'This audit verifies the probe mechanics with fixture evidence.',
172
+ 'It does not create real public owner/external evidence or mark final readiness accepted.',
173
+ ],
174
+ checks,
175
+ }
176
+
177
+ function renderMarkdown(data) {
178
+ const lines = []
179
+ lines.push('# GSE Public External Gate Probe Audit')
180
+ lines.push('')
181
+ lines.push('Generated: ' + data.generatedAt)
182
+ lines.push('Root: ' + data.root)
183
+ lines.push('')
184
+ lines.push('## Summary')
185
+ lines.push('')
186
+ lines.push('- Status: ' + data.summary.status)
187
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
188
+ lines.push('- Public external gate probe: ' + data.workflows.publicExternalGateProbe)
189
+ lines.push('')
190
+ lines.push('## Checks')
191
+ lines.push('')
192
+ for (const item of data.checks) {
193
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
194
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
195
+ }
196
+ lines.push('')
197
+ lines.push('## Limits')
198
+ lines.push('')
199
+ for (const item of data.limits) lines.push('- ' + item)
200
+ return lines.join('\n') + '\n'
201
+ }
202
+
203
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
204
+ else console.log(renderMarkdown(report))
205
+
206
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { mkdtempSync, rmSync } from 'node:fs'
5
+ import { tmpdir } from 'node:os'
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
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
17
+ const jsonOnly = args.includes('--json')
18
+
19
+ function exists(relativePath) {
20
+ return fs.existsSync(path.join(root, relativePath))
21
+ }
22
+
23
+ function read(relativePath) {
24
+ const fullPath = path.join(root, relativePath)
25
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8').replace(/^\uFEFF/, '') : ''
26
+ }
27
+
28
+ function run(command, commandArgs) {
29
+ const result = spawnSync(command, commandArgs, {
30
+ cwd: root,
31
+ encoding: 'utf8',
32
+ windowsHide: true,
33
+ })
34
+ return {
35
+ status: result.status ?? 1,
36
+ stdout: (result.stdout ?? '').trim(),
37
+ stderr: (result.stderr ?? '').trim(),
38
+ command: [command, ...commandArgs].join(' '),
39
+ }
40
+ }
41
+
42
+ function parseJson(text) {
43
+ try {
44
+ return JSON.parse(text)
45
+ } catch {
46
+ return null
47
+ }
48
+ }
49
+
50
+ function check(id, label, ok, evidence, risk = '') {
51
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
52
+ }
53
+
54
+ const tmp = mkdtempSync(path.join(tmpdir(), 'gse-public-release-checklist-'))
55
+ const tmpManifest = path.join(tmp, 'release-status-manifest.json')
56
+ const tmpChecklist = path.join(tmp, 'public-release-checklist.md')
57
+ const manifestRun = exists('scripts/generate-release-status-manifest.mjs')
58
+ ? run(process.execPath, [path.join(root, 'scripts', 'generate-release-status-manifest.mjs'), '--root', root, '--out', tmpManifest, '--force', '--json'])
59
+ : null
60
+ const checklistRun = manifestRun?.status === 0 && exists('scripts/generate-public-release-checklist.mjs')
61
+ ? run(process.execPath, [path.join(root, 'scripts', 'generate-public-release-checklist.mjs'), '--root', root, '--manifest', tmpManifest, '--out', tmpChecklist, '--force', '--json'])
62
+ : null
63
+ const manifest = fs.existsSync(tmpManifest) ? parseJson(fs.readFileSync(tmpManifest, 'utf8')) : null
64
+ const checklist = fs.existsSync(tmpChecklist) ? fs.readFileSync(tmpChecklist, 'utf8') : ''
65
+ const checklistData = checklistRun ? parseJson(checklistRun.stdout) : null
66
+ const canonicalChecklist = read('.gse/acceptance/public-release-checklist.md')
67
+ rmSync(tmp, { recursive: true, force: true })
68
+
69
+ const pendingGates = manifest?.publicAcceptance?.pendingGates ?? []
70
+ const expectedAreas = pendingGates.map((gate) => gate.area)
71
+ const requiredPhases = [
72
+ '01. Prepare the release bundle',
73
+ '02. Publish and configure the public repository',
74
+ '03. Approve the public security contact',
75
+ '04. Run public CI on the release commit',
76
+ '05. Publish the registry package',
77
+ '06. Publish or submit marketplace listing',
78
+ '07. Record native slash-command evidence',
79
+ '08. Record other host runtime invocation evidence',
80
+ ]
81
+ const expectedScripts = [...new Set(pendingGates
82
+ .map((gate) => String(gate.recordCommand ?? '').match(/scripts\/([\w-]+\.mjs)/)?.[1])
83
+ .filter(Boolean))]
84
+ const noLocalPaths = !/[A-Z]:\\|C:\\Users\\|D:\\codex\\/i.test(checklist) && !/[A-Z]:\\|C:\\Users\\|D:\\codex\\/i.test(canonicalChecklist)
85
+ const noFalseAcceptance = checklist.includes('Public accepted: not-accepted') &&
86
+ checklist.includes('does not publish, approve, or accept') &&
87
+ checklist.includes('A gate is complete only after real accepted evidence')
88
+ const commandCoverage = expectedScripts.every((script) => checklist.includes(script)) &&
89
+ checklist.includes('/gse release') &&
90
+ checklist.includes('/gse release --execute --out <bundle>') &&
91
+ checklist.includes('/gse probe')
92
+ const canonicalFresh = canonicalChecklist.includes('GSE Public Release Checklist') &&
93
+ requiredPhases.every((phase) => canonicalChecklist.includes(phase)) &&
94
+ expectedAreas.every((area) => canonicalChecklist.includes(`Gate: ${area}`)) &&
95
+ canonicalChecklist.includes(`Pending owner/external gates: ${pendingGates.length}`)
96
+
97
+ const checks = [
98
+ check('PRC01', 'public release checklist generator exists', exists('scripts/generate-public-release-checklist.mjs'), 'scripts/generate-public-release-checklist.mjs'),
99
+ check('PRC02', 'generator writes checklist from release status manifest', checklistRun?.status === 0 && checklistData?.status === 'written' && checklist.includes('GSE Public Release Checklist'), 'generate-public-release-checklist.mjs'),
100
+ check('PRC03', 'checklist uses ordered public release runway phases', requiredPhases.every((phase) => checklist.includes(phase)), 'public-release-checklist.md'),
101
+ check('PRC04', 'checklist covers every pending owner/external gate', expectedAreas.length > 0 && expectedAreas.every((area) => checklist.includes(`Gate: ${area}`)), 'release-status-manifest pending gates'),
102
+ check('PRC05', 'checklist includes executable preflight and record command families', commandCoverage && checklist.includes('Preflight:') && checklist.includes('Record accepted evidence:'), 'public-release-checklist.md'),
103
+ check('PRC06', 'checklist preserves public acceptance boundary', noFalseAcceptance, 'public-release-checklist.md'),
104
+ check('PRC07', 'checklist avoids local machine paths', noLocalPaths, 'public-release-checklist.md'),
105
+ check('PRC08', 'canonical checklist is fresh against current manifest', canonicalFresh, '.gse/acceptance/public-release-checklist.md'),
106
+ ]
107
+
108
+ const passed = checks.filter((item) => item.status === 'passed').length
109
+ const failed = checks.length - passed
110
+ const report = {
111
+ root,
112
+ generatedAt: new Date().toISOString(),
113
+ summary: {
114
+ status: failed === 0 ? 'passed' : 'failed',
115
+ passed,
116
+ failed,
117
+ total: checks.length,
118
+ },
119
+ workflows: {
120
+ publicReleaseChecklist: failed === 0 ? 'verified' : 'failed',
121
+ publicAccepted: manifest?.publicAcceptance?.publicAccepted ?? 'unknown',
122
+ pendingGates: pendingGates.length,
123
+ },
124
+ checks,
125
+ }
126
+
127
+ if (jsonOnly) {
128
+ console.log(JSON.stringify(report, null, 2))
129
+ } else {
130
+ console.log(`${report.summary.status}: ${passed}/${checks.length}`)
131
+ }
132
+
133
+ process.exit(failed === 0 ? 0 : 1)
@@ -0,0 +1,201 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import { spawnSync } from 'node:child_process'
6
+
7
+ const args = process.argv.slice(2)
8
+
9
+ function readArg(name, fallback = null) {
10
+ const index = args.indexOf(name)
11
+ if (index === -1) return fallback
12
+ return args[index + 1] ?? fallback
13
+ }
14
+
15
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
16
+ const jsonOnly = args.includes('--json')
17
+
18
+ function read(relativePath) {
19
+ const fullPath = path.join(root, relativePath)
20
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
21
+ }
22
+
23
+ function exists(relativePath) {
24
+ return fs.existsSync(path.join(root, relativePath))
25
+ }
26
+
27
+ function check(id, label, ok, evidence, risk = '') {
28
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
29
+ }
30
+
31
+ function run(command, commandArgs, cwd = root) {
32
+ const result = spawnSync(command, commandArgs, {
33
+ cwd,
34
+ encoding: 'utf8',
35
+ windowsHide: true,
36
+ })
37
+ return {
38
+ status: result.status ?? 1,
39
+ stdout: (result.stdout ?? '').trim(),
40
+ stderr: (result.stderr ?? '').trim(),
41
+ command: [command, ...commandArgs].join(' '),
42
+ }
43
+ }
44
+
45
+ function parseJson(stdout) {
46
+ try {
47
+ return JSON.parse(stdout)
48
+ } catch {
49
+ return null
50
+ }
51
+ }
52
+
53
+ function createReleaseFixture() {
54
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-public-release-decision-'))
55
+ fs.mkdirSync(path.join(fixture, '.gse', 'releases'), { recursive: true })
56
+ fs.writeFileSync(path.join(fixture, 'CHANGELOG.md'), '# Changelog\n\n## Unreleased\n\n- Fixture release decision.\n', 'utf8')
57
+ fs.writeFileSync(path.join(fixture, 'LICENSE'), 'Fixture license text for audit only.\n', 'utf8')
58
+ return fixture
59
+ }
60
+
61
+ const recordScript = path.join(root, 'scripts', 'record-public-release.mjs')
62
+ const publicRelease = read('references/public-release.md')
63
+ const validate = read('scripts/validate-gse.mjs')
64
+ const completion = read('scripts/audit-completion-readiness.mjs')
65
+ const roadmap = read('scripts/audit-roadmap-consistency.mjs')
66
+
67
+ let fixture = null
68
+ let ownerRequired = null
69
+ let selectedOk = null
70
+ let selectedMissing = null
71
+ let notPublicOk = null
72
+ let notPublicMissing = null
73
+
74
+ if (fs.existsSync(recordScript)) {
75
+ fixture = createReleaseFixture()
76
+ ownerRequired = run(process.execPath, [
77
+ recordScript,
78
+ '--root',
79
+ fixture,
80
+ '--license-status',
81
+ 'owner-required',
82
+ '--dry-run',
83
+ '--json',
84
+ ])
85
+ selectedOk = run(process.execPath, [
86
+ recordScript,
87
+ '--root',
88
+ fixture,
89
+ '--license-status',
90
+ 'selected',
91
+ '--spdx',
92
+ 'MIT',
93
+ '--license-file',
94
+ 'LICENSE',
95
+ '--approved-by',
96
+ 'fixture-owner',
97
+ '--decision-date',
98
+ '2026-07-06',
99
+ '--evidence-status',
100
+ 'accepted',
101
+ '--dry-run',
102
+ '--json',
103
+ ])
104
+ selectedMissing = run(process.execPath, [
105
+ recordScript,
106
+ '--root',
107
+ fixture,
108
+ '--license-status',
109
+ 'selected',
110
+ '--dry-run',
111
+ '--json',
112
+ ])
113
+ notPublicOk = run(process.execPath, [
114
+ recordScript,
115
+ '--root',
116
+ fixture,
117
+ '--license-status',
118
+ 'not-public',
119
+ '--approved-by',
120
+ 'fixture-owner',
121
+ '--decision-date',
122
+ '2026-07-06',
123
+ '--dry-run',
124
+ '--json',
125
+ ])
126
+ notPublicMissing = run(process.execPath, [
127
+ recordScript,
128
+ '--root',
129
+ fixture,
130
+ '--license-status',
131
+ 'not-public',
132
+ '--dry-run',
133
+ '--json',
134
+ ])
135
+ }
136
+
137
+ const ownerRequiredData = ownerRequired ? parseJson(ownerRequired.stdout) : null
138
+ const selectedOkData = selectedOk ? parseJson(selectedOk.stdout) : null
139
+ const selectedMissingData = selectedMissing ? parseJson(selectedMissing.stdout) : null
140
+ const notPublicOkData = notPublicOk ? parseJson(notPublicOk.stdout) : null
141
+ const notPublicMissingData = notPublicMissing ? parseJson(notPublicMissing.stdout) : null
142
+
143
+ const checks = [
144
+ check('PD01', 'public release decision command exists', exists('scripts/record-public-release.mjs'), 'scripts/record-public-release.mjs'),
145
+ check('PD02', 'owner-required decision path remains writable without approval fields', ownerRequired?.status === 0 && ownerRequiredData?.status === 'ready' && ownerRequiredData?.licenseStatus === 'owner-required' && ownerRequiredData?.evidenceStatus === 'result', 'record-public-release --license-status owner-required --dry-run'),
146
+ check('PD03', 'selected-license decision path accepts complete owner evidence', selectedOk?.status === 0 && selectedOkData?.status === 'ready' && selectedOkData?.licenseStatus === 'selected' && selectedOkData?.evidenceStatus === 'accepted', 'record-public-release --license-status selected fixture dry-run'),
147
+ check('PD04', 'selected-license decision path rejects missing owner evidence', selectedMissing?.status !== 0 && selectedMissingData?.status === 'failed' && selectedMissingData?.errors?.some((item) => item.includes('--spdx')) && selectedMissingData?.errors?.some((item) => item.includes('--approved-by')), 'record-public-release selected missing-fields dry-run'),
148
+ check('PD05', 'not-public decision path accepts explicit owner decision', notPublicOk?.status === 0 && notPublicOkData?.status === 'ready' && notPublicOkData?.licenseStatus === 'not-public', 'record-public-release --license-status not-public fixture dry-run'),
149
+ check('PD06', 'not-public decision path rejects missing owner decision', notPublicMissing?.status !== 0 && notPublicMissingData?.status === 'failed' && notPublicMissingData?.errors?.some((item) => item.includes('--approved-by')) && notPublicMissingData?.errors?.some((item) => item.includes('--decision-date')), 'record-public-release not-public missing-fields dry-run'),
150
+ check('PD07', 'public release docs describe all decision states', publicRelease.includes('owner-required | selected | not-public') && publicRelease.includes('For `--license-status selected`') && publicRelease.includes('not-public'), 'references/public-release.md'),
151
+ check('PD08', 'validator and completion audits include public decision lifecycle', validate.includes('audit-public-release-decision.mjs') && completion.includes('audit-public-release-decision.mjs') && roadmap.includes('audit-public-release-decision.mjs'), 'validate, completion, roadmap audits'),
152
+ ]
153
+
154
+ const passed = checks.filter((item) => item.status === 'passed').length
155
+ const failed = checks.length - passed
156
+ const report = {
157
+ root,
158
+ generatedAt: new Date().toISOString(),
159
+ fixtureRoot: fixture,
160
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
161
+ workflows: {
162
+ publicReleaseDecisionLifecycle: failed === 0 ? 'verified' : 'failed',
163
+ },
164
+ limits: [
165
+ 'This audit verifies decision-path mechanics for owner-required, selected-license, and not-public records.',
166
+ 'The selected-license path is tested with a temporary fixture license; it does not select a license for GSE.',
167
+ 'Accepted public release for GSE still requires an owner-approved real license file or explicit not-public decision record.',
168
+ ],
169
+ checks,
170
+ }
171
+
172
+ function renderMarkdown(data) {
173
+ const lines = []
174
+ lines.push('# GSE Public Release Decision Audit')
175
+ lines.push('')
176
+ lines.push('Generated: ' + data.generatedAt)
177
+ lines.push('Root: ' + data.root)
178
+ lines.push('')
179
+ lines.push('## Summary')
180
+ lines.push('')
181
+ lines.push('- Status: ' + data.summary.status)
182
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
183
+ lines.push('- Public release decision lifecycle: ' + data.workflows.publicReleaseDecisionLifecycle)
184
+ lines.push('')
185
+ lines.push('## Checks')
186
+ lines.push('')
187
+ for (const item of data.checks) {
188
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
189
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
190
+ }
191
+ lines.push('')
192
+ lines.push('## Limits')
193
+ lines.push('')
194
+ for (const item of data.limits) lines.push('- ' + item)
195
+ return lines.join('\n') + '\n'
196
+ }
197
+
198
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
199
+ else console.log(renderMarkdown(report))
200
+
201
+ if (failed > 0) process.exit(1)