@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,134 @@
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
+ const initScript = path.join(root, 'scripts', 'init-change.mjs')
18
+
19
+ function runNode(script, runArgs, cwd = root) {
20
+ return spawnSync(process.execPath, [script, ...runArgs], {
21
+ cwd,
22
+ encoding: 'utf8',
23
+ windowsHide: true,
24
+ })
25
+ }
26
+
27
+ function parseJson(stdout) {
28
+ try {
29
+ return JSON.parse(stdout)
30
+ } catch {
31
+ return null
32
+ }
33
+ }
34
+
35
+ function read(filePath) {
36
+ return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : ''
37
+ }
38
+
39
+ function exists(filePath) {
40
+ return fs.existsSync(filePath)
41
+ }
42
+
43
+ function check(id, label, ok, evidence, recommendation = '') {
44
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, recommendation }
45
+ }
46
+
47
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-change-system-'))
48
+ fs.mkdirSync(path.join(tempRoot, '.gse'), { recursive: true })
49
+ fs.writeFileSync(path.join(tempRoot, '.gse', 'goal-map.md'), '# Goal Map\n', 'utf8')
50
+ fs.writeFileSync(path.join(tempRoot, '.gse', 'quality-gates.md'), '# Quality Gates\n', 'utf8')
51
+
52
+ const firstRun = runNode(initScript, ['--target', tempRoot, '--change-id', 'Add User Login!', '--level', 'enterprise', '--json'])
53
+ const first = parseJson(firstRun.stdout)
54
+ const secondRun = runNode(initScript, ['--target', tempRoot, '--change-id', 'Add User Login!', '--level', 'enterprise', '--json'])
55
+ const second = parseJson(secondRun.stdout)
56
+ const changeDir = path.join(tempRoot, '.gse', 'changes', 'add-user-login')
57
+ const requiredFiles = [
58
+ 'brief.md',
59
+ 'spec.md',
60
+ 'design.md',
61
+ 'tasks.md',
62
+ 'evidence.md',
63
+ 'review.md',
64
+ 'execution-quality-pack.md',
65
+ ]
66
+ const missing = requiredFiles.filter((file) => !exists(path.join(changeDir, file)))
67
+ const spec = read(path.join(changeDir, 'spec.md'))
68
+ const design = read(path.join(changeDir, 'design.md'))
69
+ const tasks = read(path.join(changeDir, 'tasks.md'))
70
+ const evidence = read(path.join(changeDir, 'evidence.md'))
71
+ const review = read(path.join(changeDir, 'review.md'))
72
+ const executionPack = read(path.join(changeDir, 'execution-quality-pack.md'))
73
+
74
+ const checks = [
75
+ check('CHG01', 'init-change script exists', exists(initScript), 'scripts/init-change.mjs'),
76
+ check('CHG02', 'first run writes full change pack', firstRun.status === 0 && first?.summary?.written === requiredFiles.length && missing.length === 0, `written:${first?.summary?.written ?? 'unknown'}, missing:${missing.join(', ') || 'none'}`),
77
+ check('CHG03', 'rerun is non-overwriting by default', secondRun.status === 0 && second?.summary?.skipped === requiredFiles.length, `skipped:${second?.summary?.skipped ?? 'unknown'}`),
78
+ check('CHG04', 'spec includes behavior, state, recovery, privacy, acceptance, and non-goals', ['## Behavior', '## State / Data Flow', '## Error and Recovery', '## Permissions and Privacy', '## Acceptance Criteria', '## Non-goals'].every((term) => spec.includes(term)), 'spec.md'),
79
+ check('CHG05', 'design includes contracts, rollback, alternatives, and open questions', ['## Interfaces And Contracts', '## Rollback', '## Alternatives Considered', '## Open Questions'].every((term) => design.includes(term)), 'design.md'),
80
+ check('CHG06', 'tasks enforce verifiable slice execution', ['Locate existing patterns', 'Run focused verification', 'Record evidence'].every((term) => tasks.includes(term)), 'tasks.md'),
81
+ check('CHG07', 'evidence preserves result/verified/accepted distinction', evidence.includes('result | verified | accepted | not ready'), 'evidence.md'),
82
+ check('CHG08', 'review covers spec, quality, architecture, security, regression, and evidence', ['## Spec Compliance', '## Code Quality', '## Architecture / Ownership', '## Security / Privacy', '## Regression Risk', '## Evidence Review'].every((term) => review.includes(term)), 'review.md'),
83
+ check('CHG09', 'execution pack maps skills, tools, quality gates, evidence, and closure', ['## Required Skills Or Roles', '## Tool Routing', 'OpenSpec', 'Superpowers', '## Quality Gates Selected', '## Evidence Plan', '## Review And Closure'].every((term) => executionPack.includes(term)), 'execution-quality-pack.md'),
84
+ ]
85
+
86
+ const passed = checks.filter((item) => item.status === 'passed').length
87
+ const failed = checks.length - passed
88
+ const report = {
89
+ root,
90
+ generatedAt: new Date().toISOString(),
91
+ tempRoot,
92
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
93
+ workflows: {
94
+ changeSpecPack: failed === 0 ? 'verified' : 'failed',
95
+ executionQualityPack: failed === 0 ? 'verified' : 'failed',
96
+ },
97
+ limits: [
98
+ 'This audit verifies GSE native change/spec and execution-quality pack structure in a fixture.',
99
+ 'It does not run OpenSpec, Superpowers, project tests, browser smokes, or real target-project changes.',
100
+ ],
101
+ checks,
102
+ }
103
+
104
+ function renderMarkdown(data) {
105
+ const lines = []
106
+ lines.push('# GSE Change System Audit')
107
+ lines.push('')
108
+ lines.push('Generated: ' + data.generatedAt)
109
+ lines.push('Root: ' + data.root)
110
+ lines.push('')
111
+ lines.push('## Summary')
112
+ lines.push('')
113
+ lines.push('- Status: ' + data.summary.status)
114
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
115
+ lines.push('- Change spec pack: ' + data.workflows.changeSpecPack)
116
+ lines.push('- Execution quality pack: ' + data.workflows.executionQualityPack)
117
+ lines.push('')
118
+ lines.push('## Checks')
119
+ lines.push('')
120
+ for (const item of data.checks) {
121
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
122
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
123
+ }
124
+ lines.push('')
125
+ lines.push('## Limits')
126
+ lines.push('')
127
+ for (const item of data.limits) lines.push('- ' + item)
128
+ return lines.join('\n') + '\n'
129
+ }
130
+
131
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
132
+ else console.log(renderMarkdown(report))
133
+
134
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+
5
+ const args = process.argv.slice(2)
6
+
7
+ function readArg(name, fallback = null) {
8
+ const index = args.indexOf(name)
9
+ if (index === -1) return fallback
10
+ return args[index + 1] ?? fallback
11
+ }
12
+
13
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
14
+ const jsonOnly = args.includes('--json')
15
+
16
+ function read(relativePath) {
17
+ const fullPath = path.join(root, relativePath)
18
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
19
+ }
20
+
21
+ function exists(relativePath) {
22
+ return fs.existsSync(path.join(root, relativePath))
23
+ }
24
+
25
+ function check(id, label, ok, evidence, risk = '') {
26
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
27
+ }
28
+
29
+ const workflowPath = '.github/workflows/validate-gse.yml'
30
+ const workflow = read(workflowPath)
31
+ const packaging = read('references/packaging.md')
32
+ const openSourceAudit = read('scripts/audit-open-source-readiness.mjs')
33
+ const validate = read('scripts/validate-gse.mjs')
34
+
35
+ const requiredWorkflowTerms = [
36
+ 'name: Validate GSE',
37
+ 'pull_request:',
38
+ 'push:',
39
+ 'workflow_dispatch:',
40
+ 'actions/checkout@v4',
41
+ 'actions/setup-node@v4',
42
+ 'node-version: "20"',
43
+ 'node scripts/validate-gse.mjs --root . --skip-skill-validator --json',
44
+ 'node scripts/audit-final-readiness.mjs --root . --json',
45
+ 'node scripts/audit-final-acceptance-packet.mjs --root . --json',
46
+ ]
47
+
48
+ const checks = [
49
+ check('CI01', 'GitHub Actions validation workflow exists', exists(workflowPath), workflowPath),
50
+ check('CI02', 'workflow covers pull request, push, and manual dispatch', ['pull_request:', 'push:', 'workflow_dispatch:'].every((term) => workflow.includes(term)), 'workflow triggers'),
51
+ check('CI03', 'workflow uses pinned major official actions and Node 20', workflow.includes('actions/checkout@v4') && workflow.includes('actions/setup-node@v4') && workflow.includes('node-version: "20"'), 'checkout/setup-node/node version'),
52
+ check('CI04', 'workflow runs full GSE validation with CI-safe skill validator boundary', workflow.includes('node scripts/validate-gse.mjs --root . --skip-skill-validator --json'), 'validate-gse CI command'),
53
+ check('CI05', 'workflow audits final readiness and final acceptance boundaries', workflow.includes('audit-final-readiness.mjs') && workflow.includes('audit-final-acceptance-packet.mjs'), 'final readiness and packet audits'),
54
+ check('CI06', 'workflow contains all required terms', requiredWorkflowTerms.every((term) => workflow.includes(term)), requiredWorkflowTerms.join(', ')),
55
+ check('CI07', 'packaging docs include CI workflow in package boundary', packaging.includes('.github/workflows/validate-gse.yml'), 'references/packaging.md'),
56
+ check('CI08', 'open-source readiness audit includes CI readiness', openSourceAudit.includes('audit-ci-readiness.mjs') || openSourceAudit.includes('.github/workflows/validate-gse.yml'), 'scripts/audit-open-source-readiness.mjs'),
57
+ check('CI09', 'consolidated validator includes CI readiness audit', validate.includes('audit-ci-readiness.mjs'), 'scripts/validate-gse.mjs'),
58
+ ]
59
+
60
+ const passed = checks.filter((item) => item.status === 'passed').length
61
+ const failed = checks.length - passed
62
+ const report = {
63
+ root,
64
+ generatedAt: new Date().toISOString(),
65
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
66
+ workflows: {
67
+ ciWorkflowTemplate: failed === 0 ? 'verified' : 'failed',
68
+ publicCiRun: 'external-required',
69
+ },
70
+ limits: [
71
+ 'This audit verifies the repository CI workflow template and local wiring.',
72
+ 'It does not prove a public GitHub Actions run, branch protection, required checks, or marketplace CI policy.',
73
+ ],
74
+ checks,
75
+ }
76
+
77
+ function renderMarkdown(data) {
78
+ const lines = []
79
+ lines.push('# GSE CI Readiness Audit')
80
+ lines.push('')
81
+ lines.push('Generated: ' + data.generatedAt)
82
+ lines.push('Root: ' + data.root)
83
+ lines.push('')
84
+ lines.push('## Summary')
85
+ lines.push('')
86
+ lines.push('- Status: ' + data.summary.status)
87
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
88
+ lines.push('- CI workflow template: ' + data.workflows.ciWorkflowTemplate)
89
+ lines.push('- Public CI run: ' + data.workflows.publicCiRun)
90
+ lines.push('')
91
+ lines.push('## Checks')
92
+ lines.push('')
93
+ for (const item of data.checks) {
94
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
95
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
96
+ }
97
+ lines.push('')
98
+ lines.push('## Limits')
99
+ lines.push('')
100
+ for (const item of data.limits) lines.push('- ' + item)
101
+ return lines.join('\n') + '\n'
102
+ }
103
+
104
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
105
+ else console.log(renderMarkdown(report))
106
+
107
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,323 @@
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 jsonOnly = args.includes('--json')
16
+ const selfTest = args.includes('--self-test') || !args.includes('--target')
17
+ const targetArg = readArg('--target')
18
+
19
+ function readText(filePath) {
20
+ return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '') : ''
21
+ }
22
+
23
+ function readJson(filePath) {
24
+ if (!fs.existsSync(filePath)) return { exists: false, ok: false, data: null, error: 'missing' }
25
+ try {
26
+ return { exists: true, ok: true, data: JSON.parse(readText(filePath)), error: '' }
27
+ } catch (error) {
28
+ return { exists: true, ok: false, data: null, error: error.message }
29
+ }
30
+ }
31
+
32
+ function readJsonl(filePath) {
33
+ if (!fs.existsSync(filePath)) return { exists: false, ok: false, records: [], error: 'missing' }
34
+ const lines = readText(filePath)
35
+ .split(/\r?\n/)
36
+ .map((line) => line.trim())
37
+ .filter(Boolean)
38
+ const records = []
39
+ for (const [index, line] of lines.entries()) {
40
+ try {
41
+ records.push(JSON.parse(line))
42
+ } catch (error) {
43
+ return { exists: true, ok: false, records, error: `line ${index + 1}: ${error.message}` }
44
+ }
45
+ }
46
+ return { exists: true, ok: true, records, error: '' }
47
+ }
48
+
49
+ function exists(target, relativePath) {
50
+ return fs.existsSync(path.join(target, relativePath))
51
+ }
52
+
53
+ function runGit(target, commandArgs) {
54
+ const result = spawnSync('git', commandArgs, {
55
+ cwd: target,
56
+ encoding: 'utf8',
57
+ windowsHide: true,
58
+ })
59
+ return {
60
+ status: result.status ?? 1,
61
+ stdout: (result.stdout ?? '').trim(),
62
+ stderr: (result.stderr ?? '').trim(),
63
+ }
64
+ }
65
+
66
+ function statusFrom(ok, warn = false) {
67
+ if (ok) return 'passed'
68
+ if (warn) return 'warning'
69
+ return 'failed'
70
+ }
71
+
72
+ function check(id, label, status, evidence, recommendation = '') {
73
+ return { id, label, status, evidence, recommendation }
74
+ }
75
+
76
+ function createFixture() {
77
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-close-gate-'))
78
+ fs.mkdirSync(path.join(dir, '.gse', 'evidence'), { recursive: true })
79
+ fs.writeFileSync(path.join(dir, '.gse', 'README.md'), '# GSE\n', 'utf8')
80
+ fs.writeFileSync(path.join(dir, '.gse', 'project-profile.md'), '# Project Profile\n', 'utf8')
81
+ fs.writeFileSync(path.join(dir, '.gse', 'goal-map.md'), '# Goal Map\n\nNext action: archive slice.\n', 'utf8')
82
+ fs.writeFileSync(path.join(dir, '.gse', 'quality-gates.md'), '# Quality Gates\n\n## Universal\n\n- Evidence required.\n', 'utf8')
83
+ fs.writeFileSync(path.join(dir, '.gse', 'evidence', '2026-07-06.md'), '# Evidence\n\nEvidence status: verified.\n', 'utf8')
84
+ fs.writeFileSync(
85
+ path.join(dir, '.gse', 'state.json'),
86
+ JSON.stringify(
87
+ {
88
+ schemaVersion: 1,
89
+ projectName: 'fixture-product',
90
+ mode: 'standard',
91
+ canonicalPlan: '',
92
+ phase: 'verify',
93
+ currentSlice: {
94
+ id: 'fixture-close',
95
+ outcome: 'Fixture close gate.',
96
+ status: 'verified',
97
+ nextAction: 'Archive slice.',
98
+ },
99
+ toolStatuses: {
100
+ browser: 'unknown',
101
+ lsp: 'unknown',
102
+ mcp: 'unknown',
103
+ subagents: 'unknown',
104
+ ci: 'unknown',
105
+ },
106
+ lastEvidence: '.gse/evidence/2026-07-06.md',
107
+ residualRisks: ['Fixture residual risk.'],
108
+ },
109
+ null,
110
+ 2,
111
+ ) + '\n',
112
+ 'utf8',
113
+ )
114
+ fs.writeFileSync(
115
+ path.join(dir, '.gse', 'evidence', 'index.jsonl'),
116
+ JSON.stringify({
117
+ date: '2026-07-06',
118
+ recordType: 'slice',
119
+ status: 'verified',
120
+ summary: 'Fixture close gate evidence.',
121
+ evidenceFile: '.gse/evidence/2026-07-06.md',
122
+ commands: ['node scripts/audit-close-gate.mjs --self-test'],
123
+ nextAction: 'Archive slice.',
124
+ }) + '\n',
125
+ 'utf8',
126
+ )
127
+ runGit(dir, ['init'])
128
+ runGit(dir, ['config', 'user.email', 'gse-fixture@example.local'])
129
+ runGit(dir, ['config', 'user.name', 'GSE Fixture'])
130
+ runGit(dir, ['add', '.'])
131
+ runGit(dir, ['commit', '-m', 'fixture'])
132
+ return dir
133
+ }
134
+
135
+ function auditCloseGate(target) {
136
+ const resolvedTarget = path.resolve(target)
137
+ const gseDir = path.join(resolvedTarget, '.gse')
138
+ const state = readJson(path.join(gseDir, 'state.json'))
139
+ const evidenceIndex = readJsonl(path.join(gseDir, 'evidence', 'index.jsonl'))
140
+ const checks = []
141
+
142
+ checks.push(
143
+ check(
144
+ 'CG01',
145
+ '.gse directory exists',
146
+ statusFrom(exists(resolvedTarget, '.gse')),
147
+ exists(resolvedTarget, '.gse') ? '.gse exists' : '.gse missing',
148
+ exists(resolvedTarget, '.gse') ? '' : 'Initialize or adopt GSE before closing a slice.',
149
+ ),
150
+ )
151
+
152
+ const stateValid =
153
+ state.ok &&
154
+ state.data?.schemaVersion === 1 &&
155
+ typeof state.data?.phase === 'string' &&
156
+ typeof state.data?.currentSlice?.status === 'string' &&
157
+ typeof state.data?.currentSlice?.nextAction === 'string'
158
+ checks.push(
159
+ check(
160
+ 'CG02',
161
+ 'state.json is valid',
162
+ statusFrom(stateValid),
163
+ state.exists ? state.ok ? `phase:${state.data.phase}, status:${state.data.currentSlice?.status}` : 'invalid ' + state.error : 'missing',
164
+ stateValid ? '' : 'Repair .gse/state.json before closing the slice.',
165
+ ),
166
+ )
167
+
168
+ const indexValid =
169
+ evidenceIndex.ok &&
170
+ evidenceIndex.records.length > 0 &&
171
+ evidenceIndex.records.every(
172
+ (record) =>
173
+ typeof record.date === 'string' &&
174
+ typeof record.recordType === 'string' &&
175
+ typeof record.status === 'string' &&
176
+ typeof record.summary === 'string' &&
177
+ typeof record.evidenceFile === 'string' &&
178
+ Array.isArray(record.commands) &&
179
+ typeof record.nextAction === 'string',
180
+ )
181
+ checks.push(
182
+ check(
183
+ 'CG03',
184
+ 'evidence index is valid',
185
+ statusFrom(indexValid),
186
+ evidenceIndex.exists ? evidenceIndex.ok ? `${evidenceIndex.records.length} record(s)` : 'invalid ' + evidenceIndex.error : 'missing',
187
+ indexValid ? '' : 'Record at least one evidence index entry before closing.',
188
+ ),
189
+ )
190
+
191
+ const closeableState = ['verified', 'accepted'].includes(state.data?.currentSlice?.status)
192
+ checks.push(
193
+ check(
194
+ 'CG04',
195
+ 'current slice status is closeable',
196
+ statusFrom(closeableState),
197
+ `currentSlice.status:${state.data?.currentSlice?.status ?? 'unknown'}`,
198
+ closeableState ? '' : 'Set currentSlice.status to verified or accepted only after focused evidence exists.',
199
+ ),
200
+ )
201
+
202
+ const closeableEvidenceRecords = evidenceIndex.records.filter((record) => ['verified', 'accepted'].includes(record.status))
203
+ const evidenceFilesExist =
204
+ closeableEvidenceRecords.length > 0 &&
205
+ closeableEvidenceRecords.every((record) => exists(resolvedTarget, record.evidenceFile))
206
+ checks.push(
207
+ check(
208
+ 'CG05',
209
+ 'verified or accepted evidence record exists',
210
+ statusFrom(evidenceFilesExist),
211
+ closeableEvidenceRecords.length
212
+ ? closeableEvidenceRecords.map((record) => `${record.status}:${record.evidenceFile}:${exists(resolvedTarget, record.evidenceFile) ? 'exists' : 'missing'}`).join('; ')
213
+ : 'no verified/accepted evidence index record',
214
+ evidenceFilesExist ? '' : 'Add verified evidence and ensure the referenced evidence file exists.',
215
+ ),
216
+ )
217
+
218
+ const requiredDocs = ['.gse/README.md', '.gse/project-profile.md', '.gse/goal-map.md', '.gse/quality-gates.md']
219
+ const missingDocs = requiredDocs.filter((relativePath) => !exists(resolvedTarget, relativePath))
220
+ checks.push(
221
+ check(
222
+ 'CG06',
223
+ 'required workflow docs exist',
224
+ statusFrom(missingDocs.length === 0),
225
+ missingDocs.length ? 'missing: ' + missingDocs.join(', ') : `${requiredDocs.length}/${requiredDocs.length} present`,
226
+ missingDocs.length ? 'Restore required workflow docs before closing.' : '',
227
+ ),
228
+ )
229
+
230
+ const residualRisksOk = Array.isArray(state.data?.residualRisks)
231
+ checks.push(
232
+ check(
233
+ 'CG07',
234
+ 'residual risks are explicit',
235
+ statusFrom(residualRisksOk),
236
+ residualRisksOk ? `${state.data.residualRisks.length} residual risk(s)` : 'missing residualRisks array',
237
+ residualRisksOk ? '' : 'Use an empty array if there is no known residual risk.',
238
+ ),
239
+ )
240
+
241
+ const gitRoot = runGit(resolvedTarget, ['rev-parse', '--show-toplevel'])
242
+ const isGitRepo = gitRoot.status === 0
243
+ const gseStatus = isGitRepo ? runGit(resolvedTarget, ['status', '--short', '.gse']) : { status: 1, stdout: '', stderr: 'not a git repository' }
244
+ checks.push(
245
+ check(
246
+ 'CG08',
247
+ '.gse git state is known',
248
+ isGitRepo ? (gseStatus.stdout ? 'warning' : 'passed') : 'warning',
249
+ isGitRepo ? gseStatus.stdout || 'clean' : 'not a git repository',
250
+ isGitRepo && gseStatus.stdout ? 'Review and intentionally stage/commit or document project-local GSE changes.' : '',
251
+ ),
252
+ )
253
+
254
+ const failed = checks.filter((item) => item.status === 'failed').length
255
+ const warnings = checks.filter((item) => item.status === 'warning').length
256
+ const passed = checks.filter((item) => item.status === 'passed').length
257
+
258
+ return {
259
+ target: resolvedTarget,
260
+ generatedAt: new Date().toISOString(),
261
+ summary: {
262
+ status: failed > 0 ? 'not-ready' : warnings > 0 ? 'ready-with-warnings' : 'ready',
263
+ passed,
264
+ warnings,
265
+ failed,
266
+ total: checks.length,
267
+ },
268
+ workflows: {
269
+ closeGate: failed > 0 ? 'not-ready' : warnings > 0 ? 'ready-with-warnings' : 'ready',
270
+ },
271
+ state: {
272
+ exists: state.exists,
273
+ valid: stateValid,
274
+ phase: state.data?.phase ?? null,
275
+ currentSliceStatus: state.data?.currentSlice?.status ?? null,
276
+ nextAction: state.data?.currentSlice?.nextAction ?? null,
277
+ },
278
+ evidenceIndex: {
279
+ exists: evidenceIndex.exists,
280
+ valid: indexValid,
281
+ records: evidenceIndex.records.length,
282
+ closeableRecords: closeableEvidenceRecords.length,
283
+ },
284
+ checks,
285
+ limits: [
286
+ 'Close gate is diagnostic. It reports ready/not-ready and does not modify files.',
287
+ 'A ready close gate does not replace user, reviewer, release, or owner acceptance when the project requires it.',
288
+ 'Project tests, browser smokes, CI, MCP, LSP, subagents, and release checks must still be run according to project quality gates.',
289
+ ],
290
+ }
291
+ }
292
+
293
+ function renderMarkdown(report) {
294
+ const lines = []
295
+ lines.push('# GSE Close Gate')
296
+ lines.push('')
297
+ lines.push('Generated: ' + report.generatedAt)
298
+ lines.push('Target: ' + report.target)
299
+ lines.push('')
300
+ lines.push('## Summary')
301
+ lines.push('')
302
+ lines.push('- Status: ' + report.summary.status)
303
+ lines.push('- Checks: ' + report.summary.passed + ' passed, ' + report.summary.warnings + ' warnings, ' + report.summary.failed + ' failed, ' + report.summary.total + ' total')
304
+ lines.push('')
305
+ lines.push('## Checks')
306
+ lines.push('')
307
+ for (const item of report.checks) {
308
+ const marker = item.status === 'passed' ? '[x]' : item.status === 'warning' ? '[!]' : '[ ]'
309
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
310
+ if (item.recommendation) lines.push(' - Recommendation: ' + item.recommendation)
311
+ }
312
+ lines.push('')
313
+ lines.push('## Limits')
314
+ lines.push('')
315
+ for (const item of report.limits) lines.push('- ' + item)
316
+ return lines.join('\n') + '\n'
317
+ }
318
+
319
+ const target = selfTest ? createFixture() : targetArg
320
+ const report = auditCloseGate(target)
321
+
322
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
323
+ else console.log(renderMarkdown(report))
@@ -0,0 +1,91 @@
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
+ const target = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-command-adapter-'))
18
+ const script = path.join(root, 'scripts', 'generate-command-adapter.mjs')
19
+
20
+ function run(commandArgs) {
21
+ return spawnSync(process.execPath, [script, ...commandArgs], { cwd: root, encoding: 'utf8', windowsHide: true })
22
+ }
23
+
24
+ function parseJson(text) {
25
+ try { return JSON.parse(text) } catch { return null }
26
+ }
27
+
28
+ function read(relativePath) {
29
+ const fullPath = path.join(target, relativePath)
30
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
31
+ }
32
+
33
+ function check(id, label, ok, evidence, risk = '') {
34
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
35
+ }
36
+
37
+ const firstRun = run(['--target', target, '--host', 'all', '--json'])
38
+ const first = parseJson(firstRun.stdout)
39
+ const secondRun = run(['--target', target, '--host', 'all', '--json'])
40
+ const second = parseJson(secondRun.stdout)
41
+ const invalidRun = run(['--target', target, '--host', 'unknown'])
42
+ const claudeCommand = read(path.join('.claude', 'commands', 'gse.md'))
43
+ const codexPointer = read(path.join('.codex', 'gse-command.md'))
44
+ const hermesPointer = read(path.join('.gse', 'host-adapters', 'hermes-runtime.md'))
45
+ const workbuddyPointer = read(path.join('.gse', 'host-adapters', 'workbuddy.md'))
46
+ const genericPointer = read(path.join('.gse', 'host-adapters', 'generic-agent.md'))
47
+ const copilotPointer = read(path.join('.github', 'copilot-instructions.md'))
48
+ const geminiPointer = read('GEMINI.md')
49
+ const expectedHosts = ['claude', 'codex', 'hermes', 'workbuddy', 'copilot', 'gemini', 'generic']
50
+ const pointerHosts = ['codex', 'hermes', 'workbuddy', 'copilot', 'gemini', 'generic']
51
+ const firstResultByHost = new Map((first?.results ?? []).map((item) => [item.host, item]))
52
+
53
+ const checks = [
54
+ check('CMDAD01', 'command adapter generator exists', fs.existsSync(script), 'scripts/generate-command-adapter.mjs'),
55
+ check('CMDAD02', 'first run writes all supported command adapters', firstRun.status === 0 && first?.results?.length === expectedHosts.length && expectedHosts.every((host) => firstResultByHost.get(host)?.status === 'written'), 'first run written count: ' + expectedHosts.length),
56
+ check('CMDAD03', 'Claude adapter creates native slash-command path', claudeCommand.includes('# /gse') && first?.results?.some((item) => item.host === 'claude' && item.nativeSlashCommand === true && item.relativePath === '.claude/commands/gse.md'), '.claude/commands/gse.md'),
57
+ check('CMDAD04', 'Codex adapter is honest pointer, not false native claim', codexPointer.includes('not proof of a native project-level /gse slash-command mechanism') && first?.results?.some((item) => item.host === 'codex' && item.nativeSlashCommand === false), '.codex/gse-command.md'),
58
+ check('CMDAD05', 'adapters route back to portable GSE files', [claudeCommand, codexPointer, hermesPointer, workbuddyPointer, copilotPointer, geminiPointer, genericPointer].every((content) => content.includes('.gse/project-profile.md') && content.includes('.gse/state.json') && content.includes('.gse/goal-map.md') && content.includes('.gse/quality-gates.md')), 'adapter contents'),
59
+ check('CMDAD06', 'rerun skips existing adapters by default', secondRun.status === 0 && second?.results?.every((item) => item.status === 'skipped'), 'second run skipped'),
60
+ check('CMDAD07', 'unsupported host fails clearly', invalidRun.status === 1, 'invalid host exit 1'),
61
+ check('CMDAD08', 'portable pointer adapters are generated for Hermes, WorkBuddy, Copilot, Gemini, and generic hosts', hermesPointer.includes('Hermes/AION Runtime GSE Adapter') && workbuddyPointer.includes('WorkBuddy GSE Adapter') && copilotPointer.includes('GitHub Copilot GSE Adapter') && geminiPointer.includes('Gemini GSE Adapter') && genericPointer.includes('Generic Agent GSE Adapter'), 'portable adapter files'),
62
+ check('CMDAD09', 'non-Claude adapters do not claim native slash-command support', pointerHosts.every((host) => firstResultByHost.get(host)?.nativeSlashCommand === false) && [codexPointer, hermesPointer, workbuddyPointer, copilotPointer, geminiPointer, genericPointer].every((content) => content.includes('does not prove native /gse slash-command support') || content.includes('not proof of a native project-level /gse slash-command mechanism')), 'nativeSlashCommand false for portable pointers'),
63
+ check('CMDAD10', 'portable pointers require current-session evidence before verified host tool claims', [hermesPointer, workbuddyPointer, copilotPointer, geminiPointer, genericPointer].every((content) => content.includes('unknown until') || content.includes('unless this host/session produced current evidence')), 'host capability honesty'),
64
+ ]
65
+
66
+ const passed = checks.filter((item) => item.status === 'passed').length
67
+ const failed = checks.length - passed
68
+ const report = {
69
+ root,
70
+ generatedAt: new Date().toISOString(),
71
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
72
+ workflows: {
73
+ claudeNativeSlashCommandAdapter: failed === 0 ? 'verified' : 'failed',
74
+ codexCommandPointerAdapter: failed === 0 ? 'verified' : 'failed',
75
+ portableHostPointerAdapters: failed === 0 ? 'verified' : 'failed',
76
+ },
77
+ limits: [
78
+ 'This audit verifies generated adapter files and command routing.',
79
+ 'It does not execute Claude Code or Codex host runtimes.',
80
+ 'Codex project-level native slash-command support remains unverified.',
81
+ 'Hermes, WorkBuddy, Copilot, Gemini, and generic adapters are pointer files only until runtime invocation records exist.',
82
+ ],
83
+ checks,
84
+ }
85
+
86
+ fs.rmSync(target, { recursive: true, force: true })
87
+
88
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
89
+ else console.log(JSON.stringify(report, null, 2))
90
+
91
+ if (failed > 0) process.exit(1)