@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,176 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { spawnSync } from 'node:child_process'
5
+
6
+ const args = process.argv.slice(2)
7
+
8
+ function readArg(name, fallback = null) {
9
+ const index = args.indexOf(name)
10
+ if (index === -1) return fallback
11
+ return args[index + 1] ?? fallback
12
+ }
13
+
14
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
15
+ const jsonOnly = args.includes('--json')
16
+
17
+ function read(relativePath) {
18
+ const fullPath = path.join(root, relativePath)
19
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
20
+ }
21
+
22
+ function exists(relativePath) {
23
+ return fs.existsSync(path.join(root, relativePath))
24
+ }
25
+
26
+ function check(id, label, ok, evidence, risk = '') {
27
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
28
+ }
29
+
30
+ const skill = read('SKILL.md')
31
+ const release = read('references/release.md')
32
+ const publicRelease = read('references/public-release.md')
33
+ const releaseTrust = read('references/release-trust.md')
34
+ const marketplace = read('references/marketplace-discovery.md')
35
+ const changelog = read('CHANGELOG.md')
36
+ const template = read('assets/templates/public-release-record.md')
37
+ const validate = read('scripts/validate-gse.mjs')
38
+ const recordScript = read('scripts/record-public-release.mjs')
39
+
40
+ function run(command, commandArgs) {
41
+ const result = spawnSync(command, commandArgs, {
42
+ cwd: root,
43
+ encoding: 'utf8',
44
+ windowsHide: true,
45
+ })
46
+ return {
47
+ status: result.status ?? 1,
48
+ stdout: (result.stdout ?? '').trim(),
49
+ stderr: (result.stderr ?? '').trim(),
50
+ }
51
+ }
52
+
53
+ function parseJson(stdout) {
54
+ try {
55
+ return JSON.parse(stdout)
56
+ } catch {
57
+ return null
58
+ }
59
+ }
60
+
61
+ const ownerRequiredDryRun = exists('scripts/record-public-release.mjs')
62
+ ? run(process.execPath, [path.join(root, 'scripts', 'record-public-release.mjs'), '--root', root, '--license-status', 'owner-required', '--dry-run', '--json'])
63
+ : null
64
+ const ownerRequiredData = ownerRequiredDryRun ? parseJson(ownerRequiredDryRun.stdout) : null
65
+ const selectedFailureRun = exists('scripts/record-public-release.mjs')
66
+ ? run(process.execPath, [path.join(root, 'scripts', 'record-public-release.mjs'), '--root', root, '--license-status', 'selected', '--dry-run', '--json'])
67
+ : null
68
+ const selectedFailureData = selectedFailureRun ? parseJson(selectedFailureRun.stdout) : null
69
+
70
+ const ownerLicensePending =
71
+ publicRelease.includes('GSE must not choose a license by guessing') &&
72
+ publicRelease.includes('owner-required') &&
73
+ changelog.includes('Open-source license selection remains an owner decision')
74
+
75
+ const releaseRecord = read('.gse/releases/public-release-owner-required.md')
76
+ const ownerRequiredRecord =
77
+ releaseRecord.includes('License status: owner-required') &&
78
+ releaseRecord.includes('Evidence status: result')
79
+ const selectedAcceptedRecord =
80
+ releaseRecord.includes('License status: selected') &&
81
+ releaseRecord.includes('SPDX identifier: MIT') &&
82
+ releaseRecord.includes('License file: LICENSE') &&
83
+ releaseRecord.includes('Evidence status: accepted')
84
+ const releaseRecordStatus = selectedAcceptedRecord
85
+ ? 'accepted-license-decision'
86
+ : ownerRequiredRecord
87
+ ? 'owner-required'
88
+ : 'unknown'
89
+
90
+ const releaseRecordFields = [
91
+ 'Release name:',
92
+ 'Release version or label:',
93
+ 'Distribution channel:',
94
+ 'License status:',
95
+ 'SPDX identifier:',
96
+ 'License file:',
97
+ 'Approved by:',
98
+ 'Changelog path:',
99
+ 'Validation command:',
100
+ 'Known unsupported claims:',
101
+ 'Evidence status:',
102
+ ]
103
+
104
+ const changelogTerms = [
105
+ '# Changelog',
106
+ '## Unreleased',
107
+ '### Added',
108
+ '### Verified',
109
+ '### Not Yet Accepted',
110
+ 'Public registry publication and marketplace approval are not verified',
111
+ ]
112
+
113
+ const checks = [
114
+ check('PR01', 'public release reference exists', exists('references/public-release.md'), 'references/public-release.md'),
115
+ check('PR02', 'public release record template exists', exists('assets/templates/public-release-record.md'), 'assets/templates/public-release-record.md'),
116
+ check('PR03', 'changelog exists with public-release boundaries', exists('CHANGELOG.md') && changelogTerms.every((term) => changelog.includes(term)), 'CHANGELOG.md'),
117
+ check('PR04', 'license decision is owner-gated and not guessed', ownerLicensePending, 'references/public-release.md, CHANGELOG.md'),
118
+ check('PR05', 'public release record captures owner/license/release evidence fields', releaseRecordFields.every((field) => template.includes(field)), releaseRecordFields.join(', ')),
119
+ check('PR06', 'release docs route to public metadata, trust, and marketplace gates', release.includes('references/public-release.md') && publicRelease.includes('references/release-trust.md') && publicRelease.includes('references/marketplace-discovery.md') && releaseTrust.includes('release-trust') && marketplace.includes('marketplace'), 'release, public-release, release-trust, marketplace references'),
120
+ check('PR07', 'SKILL routes public release metadata reference', skill.includes('references/public-release.md'), 'SKILL.md Reference Routing'),
121
+ check('PR08', 'validator includes public release metadata audit', validate.includes('audit-public-release-metadata.mjs'), 'scripts/validate-gse.mjs'),
122
+ check('PR09', 'public release record command exists and is documented', exists('scripts/record-public-release.mjs') && publicRelease.includes('scripts/record-public-release.mjs') && skill.includes('record-public-release.mjs'), 'scripts/record-public-release.mjs, references/public-release.md, SKILL.md'),
123
+ check('PR10', 'public release record command can dry-run owner-required state', ownerRequiredDryRun?.status === 0 && ownerRequiredData?.status === 'ready' && ownerRequiredData?.licenseStatus === 'owner-required', 'record-public-release owner-required dry-run'),
124
+ check('PR11', 'selected license mode requires owner decision fields', selectedFailureRun?.status !== 0 && selectedFailureData?.status === 'failed' && selectedFailureData?.errors?.some((item) => item.includes('--spdx')) && recordScript.includes('selected license requires --approved-by'), 'record-public-release selected dry-run failure'),
125
+ check('PR12', 'public release decision record is preserved', exists('.gse/releases/public-release-owner-required.md') && (ownerRequiredRecord || selectedAcceptedRecord), '.gse/releases/public-release-owner-required.md'),
126
+ ]
127
+
128
+ const passed = checks.filter((item) => item.status === 'passed').length
129
+ const failed = checks.length - passed
130
+ const report = {
131
+ root,
132
+ generatedAt: new Date().toISOString(),
133
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
134
+ workflows: {
135
+ publicReleaseMetadata: failed === 0 ? 'verified' : 'failed',
136
+ publicReleaseAcceptance: releaseRecordStatus,
137
+ },
138
+ limits: [
139
+ 'This audit verifies public-release metadata structure, changelog policy, owner-gated license decision, and routing.',
140
+ 'It does not choose a license, publish to GitHub, approve a marketplace listing, or certify legal suitability.',
141
+ 'Accepted public release still requires public repository, CI, security contact, channel publication, and host-runtime evidence when those claims are made.',
142
+ ],
143
+ checks,
144
+ }
145
+
146
+ function renderMarkdown(data) {
147
+ const lines = []
148
+ lines.push('# GSE Public Release Metadata Audit')
149
+ lines.push('')
150
+ lines.push('Generated: ' + data.generatedAt)
151
+ lines.push('Root: ' + data.root)
152
+ lines.push('')
153
+ lines.push('## Summary')
154
+ lines.push('')
155
+ lines.push('- Status: ' + data.summary.status)
156
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
157
+ lines.push('- Public release metadata: ' + data.workflows.publicReleaseMetadata)
158
+ lines.push('- Public release acceptance: ' + data.workflows.publicReleaseAcceptance)
159
+ lines.push('')
160
+ lines.push('## Checks')
161
+ lines.push('')
162
+ for (const item of data.checks) {
163
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
164
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
165
+ }
166
+ lines.push('')
167
+ lines.push('## Limits')
168
+ lines.push('')
169
+ for (const item of data.limits) lines.push('- ' + item)
170
+ return lines.join('\n') + '\n'
171
+ }
172
+
173
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
174
+ else console.log(renderMarkdown(report))
175
+
176
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,237 @@
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 run(command, commandArgs, cwd = root) {
28
+ const result = spawnSync(command, commandArgs, {
29
+ cwd,
30
+ encoding: 'utf8',
31
+ windowsHide: true,
32
+ })
33
+ return {
34
+ status: result.status ?? 1,
35
+ stdout: (result.stdout ?? '').trim(),
36
+ stderr: (result.stderr ?? '').trim(),
37
+ command: [command, ...commandArgs].join(' '),
38
+ }
39
+ }
40
+
41
+ function parseJson(stdout) {
42
+ try {
43
+ return JSON.parse(stdout)
44
+ } catch {
45
+ return null
46
+ }
47
+ }
48
+
49
+ function check(id, label, ok, evidence, risk = '') {
50
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
51
+ }
52
+
53
+ function createFixture() {
54
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-public-repo-settings-'))
55
+ fs.mkdirSync(path.join(fixture, '.gse', 'releases'), { recursive: true })
56
+ fs.mkdirSync(path.join(fixture, '.github', 'workflows'), { recursive: true })
57
+ fs.mkdirSync(path.join(fixture, '.github', 'ISSUE_TEMPLATE'), { recursive: true })
58
+ fs.writeFileSync(path.join(fixture, '.github', 'workflows', 'validate-gse.yml'), 'name: Validate GSE\n', 'utf8')
59
+ fs.writeFileSync(path.join(fixture, '.github', 'PULL_REQUEST_TEMPLATE.md'), '## Evidence\n', 'utf8')
60
+ fs.writeFileSync(path.join(fixture, '.github', 'ISSUE_TEMPLATE', 'bug_report.yml'), 'name: Bug report\n', 'utf8')
61
+ return fixture
62
+ }
63
+
64
+ const recordScript = path.join(root, 'scripts', 'record-public-repository-settings.mjs')
65
+ const template = read('assets/templates/public-repository-settings-record.md')
66
+ const publicRelease = read('references/public-release.md')
67
+ const finalReadiness = read('references/final-readiness.md')
68
+ const validate = read('scripts/validate-gse.mjs')
69
+
70
+ const fixture = exists('scripts/record-public-repository-settings.mjs') ? createFixture() : null
71
+ const pending = fixture ? run(process.execPath, [recordScript, '--root', fixture, '--settings-status', 'pending', '--dry-run', '--json']) : null
72
+ const verifiedOk = fixture ? run(process.execPath, [
73
+ recordScript,
74
+ '--root', fixture,
75
+ '--repository-url', 'https://github.com/example/gse',
76
+ '--visibility', 'public',
77
+ '--settings-status', 'verified',
78
+ '--evidence-owner', 'fixture-owner',
79
+ '--evidence-date', '2026-07-06',
80
+ '--evidence-url', 'https://github.com/example/gse/settings/branches',
81
+ '--issues-enabled', 'true',
82
+ '--pull-requests-enabled', 'true',
83
+ '--security-policy-visible', 'true',
84
+ '--branch-protection-enabled', 'true',
85
+ '--required-status-checks-enabled', 'true',
86
+ '--required-checks', 'Validate GSE',
87
+ '--require-review-before-merge', 'true',
88
+ '--require-conversation-resolution', 'true',
89
+ '--restrict-force-pushes', 'true',
90
+ '--restrict-deletions', 'true',
91
+ '--evidence-status', 'verified',
92
+ '--dry-run',
93
+ '--json',
94
+ ]) : null
95
+ const verifiedMissing = fixture ? run(process.execPath, [recordScript, '--root', fixture, '--settings-status', 'verified', '--dry-run', '--json']) : null
96
+ const acceptedMissing = fixture ? run(process.execPath, [
97
+ recordScript,
98
+ '--root', fixture,
99
+ '--repository-url', 'https://github.com/example/gse',
100
+ '--visibility', 'public',
101
+ '--settings-status', 'accepted',
102
+ '--evidence-owner', 'fixture-owner',
103
+ '--evidence-date', '2026-07-06',
104
+ '--evidence-url', 'https://github.com/example/gse/settings/branches',
105
+ '--issues-enabled', 'true',
106
+ '--pull-requests-enabled', 'true',
107
+ '--security-policy-visible', 'true',
108
+ '--branch-protection-enabled', 'true',
109
+ '--required-status-checks-enabled', 'true',
110
+ '--required-checks', 'Validate GSE',
111
+ '--require-review-before-merge', 'true',
112
+ '--require-conversation-resolution', 'true',
113
+ '--restrict-force-pushes', 'true',
114
+ '--restrict-deletions', 'true',
115
+ '--evidence-status', 'verified',
116
+ '--dry-run',
117
+ '--json',
118
+ ]) : null
119
+ const acceptedOk = fixture ? run(process.execPath, [
120
+ recordScript,
121
+ '--root', fixture,
122
+ '--repository-url', 'https://github.com/example/gse',
123
+ '--visibility', 'public',
124
+ '--settings-status', 'accepted',
125
+ '--evidence-owner', 'fixture-owner',
126
+ '--evidence-date', '2026-07-06',
127
+ '--evidence-url', 'https://github.com/example/gse/settings/branches',
128
+ '--issues-enabled', 'true',
129
+ '--pull-requests-enabled', 'true',
130
+ '--security-policy-visible', 'true',
131
+ '--branch-protection-enabled', 'true',
132
+ '--required-status-checks-enabled', 'true',
133
+ '--required-checks', 'Validate GSE',
134
+ '--require-review-before-merge', 'true',
135
+ '--require-conversation-resolution', 'true',
136
+ '--restrict-force-pushes', 'true',
137
+ '--restrict-deletions', 'true',
138
+ '--evidence-status', 'accepted',
139
+ '--accepted-by', 'fixture-owner',
140
+ '--accepted-at', '2026-07-06',
141
+ '--dry-run',
142
+ '--json',
143
+ ]) : null
144
+ const verifiedPlaceholderWrite = fixture ? run(process.execPath, [
145
+ recordScript,
146
+ '--root', fixture,
147
+ '--repository-url', 'https://github.com/example/gse',
148
+ '--visibility', 'public',
149
+ '--settings-status', 'verified',
150
+ '--evidence-owner', 'fixture-owner',
151
+ '--evidence-date', '2026-07-06',
152
+ '--evidence-url', 'https://github.com/example/gse/settings/branches',
153
+ '--issues-enabled', 'true',
154
+ '--pull-requests-enabled', 'true',
155
+ '--security-policy-visible', 'true',
156
+ '--branch-protection-enabled', 'true',
157
+ '--required-status-checks-enabled', 'true',
158
+ '--required-checks', 'Validate GSE',
159
+ '--require-review-before-merge', 'true',
160
+ '--require-conversation-resolution', 'true',
161
+ '--restrict-force-pushes', 'true',
162
+ '--restrict-deletions', 'true',
163
+ '--evidence-status', 'verified',
164
+ '--json',
165
+ ]) : null
166
+
167
+ const pendingData = pending ? parseJson(pending.stdout) : null
168
+ const verifiedOkData = verifiedOk ? parseJson(verifiedOk.stdout) : null
169
+ const verifiedMissingData = verifiedMissing ? parseJson(verifiedMissing.stdout) : null
170
+ const acceptedMissingData = acceptedMissing ? parseJson(acceptedMissing.stdout) : null
171
+ const acceptedOkData = acceptedOk ? parseJson(acceptedOk.stdout) : null
172
+ const verifiedPlaceholderWriteData = verifiedPlaceholderWrite ? parseJson(verifiedPlaceholderWrite.stdout) : null
173
+
174
+ const checks = [
175
+ check('PRS01', 'public repository settings record command exists', exists('scripts/record-public-repository-settings.mjs'), 'scripts/record-public-repository-settings.mjs'),
176
+ check('PRS02', 'public repository settings template exists', exists('assets/templates/public-repository-settings-record.md') && template.includes('Branch protection enabled') && template.includes('Required status checks enabled'), 'assets/templates/public-repository-settings-record.md'),
177
+ check('PRS03', 'pending settings path remains writable without external proof', pending?.status === 0 && pendingData?.status === 'ready' && pendingData?.settingsStatus === 'pending' && pendingData?.evidenceStatus === 'pending', 'record-public-repository-settings pending dry-run'),
178
+ check('PRS04', 'verified settings path accepts complete external evidence', verifiedOk?.status === 0 && verifiedOkData?.status === 'ready' && verifiedOkData?.settingsStatus === 'verified' && verifiedOkData?.evidenceStatus === 'verified', 'record-public-repository-settings verified dry-run'),
179
+ check('PRS05', 'verified settings path rejects missing evidence', verifiedMissing?.status !== 0 && verifiedMissingData?.status === 'failed' && verifiedMissingData?.errors?.some((item) => item.includes('--evidence-owner')) && verifiedMissingData?.errors?.some((item) => item.includes('--evidence-date')) && verifiedMissingData?.errors?.some((item) => item.includes('--required-checks')), 'record-public-repository-settings verified missing-fields dry-run'),
180
+ check('PRS06', 'accepted settings path rejects missing owner acceptance', acceptedMissing?.status !== 0 && acceptedMissingData?.status === 'failed' && acceptedMissingData?.errors?.some((item) => item.includes('--accepted-by')) && acceptedMissingData?.errors?.some((item) => item.includes('--evidence-status accepted')), 'record-public-repository-settings accepted missing acceptance dry-run'),
181
+ check('PRS07', 'accepted settings path accepts complete owner acceptance', acceptedOk?.status === 0 && acceptedOkData?.status === 'ready' && acceptedOkData?.settingsStatus === 'accepted' && acceptedOkData?.evidenceStatus === 'accepted', 'record-public-repository-settings accepted dry-run'),
182
+ check('PRS08', 'verified settings real write rejects placeholder or example evidence', verifiedPlaceholderWrite?.status !== 0 && verifiedPlaceholderWriteData?.status === 'failed' && verifiedPlaceholderWriteData?.errors?.some((item) => item.includes('not a placeholder')), 'record-public-repository-settings verified placeholder write'),
183
+ check('PRS09', 'public release docs reference repository settings evidence', publicRelease.includes('Public repository settings') || publicRelease.includes('repository settings'), 'references/public-release.md'),
184
+ check('PRS10', 'final readiness matrix includes public repository settings', finalReadiness.includes('Public repository settings'), 'references/final-readiness.md'),
185
+ check('PRS11', 'consolidated validator includes repository settings audit', validate.includes('audit-public-repository-settings.mjs'), 'scripts/validate-gse.mjs'),
186
+ ]
187
+
188
+ const passed = checks.filter((item) => item.status === 'passed').length
189
+ const failed = checks.length - passed
190
+ const report = {
191
+ root,
192
+ generatedAt: new Date().toISOString(),
193
+ fixtureRoot: fixture,
194
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
195
+ workflows: {
196
+ publicRepositorySettings: failed === 0 ? 'verified' : 'failed',
197
+ acceptedRepositorySettings: acceptedOkData?.status === 'ready' ? 'fixture-verified' : 'not-verified',
198
+ },
199
+ limits: [
200
+ 'This audit verifies record mechanics and guardrails for public repository settings.',
201
+ 'It does not configure a real GitHub repository, branch protection, issue settings, required checks, or maintainer policies.',
202
+ 'Accepted public repository settings still require owner/external evidence from the real repository.',
203
+ ],
204
+ checks,
205
+ }
206
+
207
+ function renderMarkdown(data) {
208
+ const lines = []
209
+ lines.push('# GSE Public Repository Settings Audit')
210
+ lines.push('')
211
+ lines.push('Generated: ' + data.generatedAt)
212
+ lines.push('Root: ' + data.root)
213
+ lines.push('')
214
+ lines.push('## Summary')
215
+ lines.push('')
216
+ lines.push('- Status: ' + data.summary.status)
217
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
218
+ lines.push('- Public repository settings: ' + data.workflows.publicRepositorySettings)
219
+ lines.push('- Accepted repository settings path: ' + data.workflows.acceptedRepositorySettings)
220
+ lines.push('')
221
+ lines.push('## Checks')
222
+ lines.push('')
223
+ for (const item of data.checks) {
224
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
225
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
226
+ }
227
+ lines.push('')
228
+ lines.push('## Limits')
229
+ lines.push('')
230
+ for (const item of data.limits) lines.push('- ' + item)
231
+ return lines.join('\n') + '\n'
232
+ }
233
+
234
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
235
+ else console.log(renderMarkdown(report))
236
+
237
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,171 @@
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 run(command, commandArgs, cwd = root) {
28
+ const result = spawnSync(command, commandArgs, {
29
+ cwd,
30
+ encoding: 'utf8',
31
+ windowsHide: true,
32
+ })
33
+ return {
34
+ status: result.status ?? 1,
35
+ stdout: (result.stdout ?? '').trim(),
36
+ stderr: (result.stderr ?? '').trim(),
37
+ command: [command, ...commandArgs].join(' '),
38
+ }
39
+ }
40
+
41
+ function parseJson(stdout) {
42
+ try {
43
+ return JSON.parse(stdout)
44
+ } catch {
45
+ return null
46
+ }
47
+ }
48
+
49
+ function check(id, label, ok, evidence, risk = '') {
50
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
51
+ }
52
+
53
+ function createFixture() {
54
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-public-security-contact-'))
55
+ fs.mkdirSync(path.join(fixture, '.gse', 'releases'), { recursive: true })
56
+ fs.writeFileSync(path.join(fixture, 'SECURITY.md'), '# Security Policy\n\nNo public vulnerability disclosure address has been owner-approved yet.\n', 'utf8')
57
+ return fixture
58
+ }
59
+
60
+ const recordScript = path.join(root, 'scripts', 'record-public-security-contact.mjs')
61
+ const template = read('assets/templates/public-security-contact-record.md')
62
+ const security = read('SECURITY.md')
63
+ const publicRelease = read('references/public-release.md')
64
+ const finalReadiness = read('references/final-readiness.md')
65
+ const validate = read('scripts/validate-gse.mjs')
66
+
67
+ const fixture = exists('scripts/record-public-security-contact.mjs') ? createFixture() : null
68
+ const pending = fixture ? run(process.execPath, [recordScript, '--root', fixture, '--contact-status', 'pending', '--dry-run', '--json']) : null
69
+ const acceptedOk = fixture ? run(process.execPath, [
70
+ recordScript,
71
+ '--root', fixture,
72
+ '--contact-status', 'accepted',
73
+ '--contact-type', 'email',
74
+ '--contact-value', 'security@example.com',
75
+ '--evidence-owner', 'fixture-owner',
76
+ '--evidence-date', '2026-07-06',
77
+ '--evidence-url', 'https://github.com/example/gse/security/policy',
78
+ '--is-public', 'true',
79
+ '--security-policy-updated', 'true',
80
+ '--evidence-status', 'accepted',
81
+ '--accepted-by', 'fixture-owner',
82
+ '--accepted-at', '2026-07-06',
83
+ '--dry-run',
84
+ '--json',
85
+ ]) : null
86
+ const acceptedMissing = fixture ? run(process.execPath, [recordScript, '--root', fixture, '--contact-status', 'accepted', '--evidence-status', 'pending', '--dry-run', '--json']) : null
87
+ const acceptedPlaceholderWrite = fixture ? run(process.execPath, [
88
+ recordScript,
89
+ '--root', fixture,
90
+ '--contact-status', 'accepted',
91
+ '--contact-type', 'email',
92
+ '--contact-value', 'security@example.com',
93
+ '--evidence-owner', 'fixture-owner',
94
+ '--evidence-date', '2026-07-06',
95
+ '--evidence-url', 'https://github.com/example/gse/security/policy',
96
+ '--is-public', 'true',
97
+ '--security-policy-updated', 'true',
98
+ '--evidence-status', 'accepted',
99
+ '--accepted-by', 'fixture-owner',
100
+ '--accepted-at', '2026-07-06',
101
+ '--json',
102
+ ]) : null
103
+
104
+ const pendingData = pending ? parseJson(pending.stdout) : null
105
+ const acceptedOkData = acceptedOk ? parseJson(acceptedOk.stdout) : null
106
+ const acceptedMissingData = acceptedMissing ? parseJson(acceptedMissing.stdout) : null
107
+ const acceptedPlaceholderWriteData = acceptedPlaceholderWrite ? parseJson(acceptedPlaceholderWrite.stdout) : null
108
+
109
+ const checks = [
110
+ check('PSC01', 'public security contact record command exists', exists('scripts/record-public-security-contact.mjs'), 'scripts/record-public-security-contact.mjs'),
111
+ check('PSC02', 'public security contact template exists', exists('assets/templates/public-security-contact-record.md') && template.includes('Contact status') && template.includes('Security policy updated?'), 'assets/templates/public-security-contact-record.md'),
112
+ check('PSC03', 'pending contact path remains writable without owner proof', pending?.status === 0 && pendingData?.status === 'ready' && pendingData?.contactStatus === 'pending' && pendingData?.evidenceStatus === 'pending', 'record-public-security-contact pending dry-run'),
113
+ check('PSC04', 'accepted contact path accepts complete owner evidence', acceptedOk?.status === 0 && acceptedOkData?.status === 'ready' && acceptedOkData?.contactStatus === 'accepted' && acceptedOkData?.evidenceStatus === 'accepted', 'record-public-security-contact accepted dry-run'),
114
+ check('PSC05', 'accepted contact path rejects missing owner evidence', acceptedMissing?.status !== 0 && acceptedMissingData?.status === 'failed' && acceptedMissingData?.errors?.some((item) => item.includes('--contact-value')) && acceptedMissingData?.errors?.some((item) => item.includes('--accepted-by')) && acceptedMissingData?.errors?.some((item) => item.includes('--evidence-status accepted')), 'record-public-security-contact accepted missing-fields dry-run'),
115
+ check('PSC06', 'accepted contact real write rejects placeholder or example evidence', acceptedPlaceholderWrite?.status !== 0 && acceptedPlaceholderWriteData?.status === 'failed' && acceptedPlaceholderWriteData?.errors?.some((item) => item.includes('not a placeholder')), 'record-public-security-contact accepted placeholder write'),
116
+ check('PSC07', 'security policy keeps public contact owner-gated', security.includes('Until a public security contact is chosen') && security.includes('No public vulnerability disclosure address has been owner-approved yet'), 'SECURITY.md'),
117
+ check('PSC08', 'public release docs reference public security contact evidence', publicRelease.includes('Public security contact') && publicRelease.includes('record-public-security-contact.mjs'), 'references/public-release.md'),
118
+ check('PSC09', 'final readiness matrix includes public security contact record', finalReadiness.includes('Public security contact record') && finalReadiness.includes('Public security contact'), 'references/final-readiness.md'),
119
+ check('PSC10', 'consolidated validator includes public security contact audit', validate.includes('audit-public-security-contact.mjs'), 'scripts/validate-gse.mjs'),
120
+ ]
121
+
122
+ const passed = checks.filter((item) => item.status === 'passed').length
123
+ const failed = checks.length - passed
124
+ const report = {
125
+ root,
126
+ generatedAt: new Date().toISOString(),
127
+ fixtureRoot: fixture,
128
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
129
+ workflows: {
130
+ publicSecurityContact: failed === 0 ? 'verified' : 'failed',
131
+ acceptedSecurityContact: acceptedOkData?.status === 'ready' ? 'fixture-verified' : 'not-verified',
132
+ },
133
+ limits: [
134
+ 'This audit verifies record mechanics and guardrails for public security contact acceptance.',
135
+ 'It does not create a real public vulnerability disclosure address or approve a SECURITY.md policy.',
136
+ 'Accepted public security contact still requires owner evidence from the real public release process.',
137
+ ],
138
+ checks,
139
+ }
140
+
141
+ function renderMarkdown(data) {
142
+ const lines = []
143
+ lines.push('# GSE Public Security Contact Audit')
144
+ lines.push('')
145
+ lines.push('Generated: ' + data.generatedAt)
146
+ lines.push('Root: ' + data.root)
147
+ lines.push('')
148
+ lines.push('## Summary')
149
+ lines.push('')
150
+ lines.push('- Status: ' + data.summary.status)
151
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
152
+ lines.push('- Public security contact: ' + data.workflows.publicSecurityContact)
153
+ lines.push('- Accepted security contact path: ' + data.workflows.acceptedSecurityContact)
154
+ lines.push('')
155
+ lines.push('## Checks')
156
+ lines.push('')
157
+ for (const item of data.checks) {
158
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
159
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
160
+ }
161
+ lines.push('')
162
+ lines.push('## Limits')
163
+ lines.push('')
164
+ for (const item of data.limits) lines.push('- ' + item)
165
+ return lines.join('\n') + '\n'
166
+ }
167
+
168
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
169
+ else console.log(renderMarkdown(report))
170
+
171
+ if (failed > 0) process.exit(1)