@t275005746/gse 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -42
- package/.github/ISSUE_TEMPLATE/change_request.yml +50 -50
- package/.github/ISSUE_TEMPLATE/config.yml +5 -5
- package/.github/PULL_REQUEST_TEMPLATE.md +38 -38
- package/.github/workflows/validate-gse.yml +33 -33
- package/.gse/README.md +18 -18
- package/.gse/gse-development-protocol.md +50 -50
- package/.gse/project-profile.md +29 -29
- package/.gse/quality-gates.md +25 -25
- package/.gse/releases/public-registry-publication-npm.md +49 -0
- package/.gse/releases/public-release-owner-required.md +65 -65
- package/.gse/releases/public-security-contact-owner-required.md +45 -45
- package/.gse/state.json +3 -4
- package/CHANGELOG.md +24 -24
- package/CONTRIBUTING.md +64 -64
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/SECURITY.md +41 -41
- package/SUPPORT.md +38 -38
- package/assets/marketplace/README.md +7 -7
- package/assets/marketplace/gse-listing.json +75 -75
- package/assets/templates/acceptance-execution-packet.md +73 -73
- package/assets/templates/adr.md +14 -14
- package/assets/templates/change-brief.md +16 -16
- package/assets/templates/design.md +18 -18
- package/assets/templates/dispatch-packet.md +104 -104
- package/assets/templates/evidence.md +14 -14
- package/assets/templates/execution-quality-pack.md +65 -65
- package/assets/templates/goal-map.md +21 -21
- package/assets/templates/host-adapter.md +48 -48
- package/assets/templates/host-ui-invocation-record.md +42 -42
- package/assets/templates/incident-review.md +60 -60
- package/assets/templates/public-channel-publication-record.md +49 -49
- package/assets/templates/public-ci-run-record.md +53 -53
- package/assets/templates/public-release-record.md +65 -65
- package/assets/templates/public-repository-settings-record.md +59 -59
- package/assets/templates/public-security-contact-record.md +45 -45
- package/assets/templates/release-trust-record.md +32 -32
- package/assets/templates/review.md +18 -18
- package/assets/templates/spec.md +16 -16
- package/assets/templates/target-adoption-evidence.md +29 -29
- package/assets/templates/tasks.md +17 -17
- package/assets/templates/update-release-acceptance-record.md +58 -58
- package/examples/README.md +22 -22
- package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -6
- package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -7
- package/examples/agent-runtime-host/.gse/goal-map.md +7 -7
- package/examples/agent-runtime-host/.gse/project-profile.md +27 -27
- package/examples/agent-runtime-host/.gse/tooling.md +5 -5
- package/examples/agent-runtime-host/.mcp.json +9 -9
- package/examples/agent-runtime-host/AGENTS.md +5 -5
- package/examples/agent-runtime-host/README.md +10 -10
- package/examples/agent-runtime-host/docs/model-routing.md +5 -5
- package/examples/cli-tool/.gse/project-profile.md +21 -21
- package/examples/cli-tool/AGENTS.md +5 -5
- package/examples/cli-tool/README.md +12 -12
- package/examples/cli-tool/package.json +21 -21
- package/examples/small-app/.env.example +2 -2
- package/examples/small-app/.github/workflows/ci.yml +8 -8
- package/examples/small-app/AGENTS.md +5 -5
- package/examples/small-app/README.md +12 -12
- package/examples/small-app/package.json +26 -26
- package/examples/small-app/playwright.config.ts +4 -4
- package/package.json +53 -53
- package/references/adoption-recipes.md +171 -171
- package/references/agent-roles.md +49 -49
- package/references/architecture-health.md +101 -101
- package/references/benchmark-audit.md +73 -73
- package/references/community-channels.md +46 -46
- package/references/compatibility.md +70 -70
- package/references/design-basis.md +38 -38
- package/references/domain-model.md +129 -129
- package/references/domain-quality-gates.md +75 -75
- package/references/drift-audit.md +81 -81
- package/references/evidence-taxonomy.md +123 -123
- package/references/file-ownership.md +107 -107
- package/references/final-readiness.md +84 -84
- package/references/forward-test.md +133 -133
- package/references/goal-map.md +36 -36
- package/references/host-adapters.md +119 -119
- package/references/learning-system.md +35 -35
- package/references/marketplace-discovery.md +46 -46
- package/references/model-routing.md +103 -103
- package/references/open-source-defaults.md +39 -39
- package/references/operating-model.md +52 -52
- package/references/packaging.md +277 -277
- package/references/project-agent-workspace.md +89 -89
- package/references/project-bootstrap.md +122 -122
- package/references/project-profile.md +57 -57
- package/references/public-release.md +174 -174
- package/references/quality-gates.md +100 -100
- package/references/recovery.md +176 -176
- package/references/release-trust.md +43 -43
- package/references/release.md +126 -126
- package/references/review.md +141 -141
- package/references/router.md +90 -90
- package/references/spec-workflow.md +66 -66
- package/references/task-levels.md +81 -81
- package/references/tool-adapters.md +73 -73
- package/scripts/audit-acceptance-execution-packet.mjs +133 -133
- package/scripts/audit-adoption-recipes.mjs +99 -99
- package/scripts/audit-change-lifecycle.mjs +77 -77
- package/scripts/audit-change-system.mjs +134 -134
- package/scripts/audit-ci-readiness.mjs +107 -107
- package/scripts/audit-close-gate.mjs +323 -323
- package/scripts/audit-command-adapters.mjs +91 -91
- package/scripts/audit-command-execution.mjs +210 -210
- package/scripts/audit-compatibility.mjs +149 -149
- package/scripts/audit-completion-readiness.mjs +292 -292
- package/scripts/audit-distribution.mjs +251 -251
- package/scripts/audit-domain-quality-gates.mjs +108 -108
- package/scripts/audit-evidence-placeholders.mjs +126 -126
- package/scripts/audit-final-readiness-promotion.mjs +255 -255
- package/scripts/audit-final-readiness.mjs +226 -226
- package/scripts/audit-fixtures.mjs +154 -154
- package/scripts/audit-fresh-session-readiness.mjs +177 -177
- package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -159
- package/scripts/audit-host-runtime-invocation-drill.mjs +240 -240
- package/scripts/audit-host-runtime-invocations.mjs +254 -254
- package/scripts/audit-host-ui-invocation.mjs +132 -132
- package/scripts/audit-marketplace-discovery.mjs +122 -122
- package/scripts/audit-npm-package-metadata.mjs +155 -155
- package/scripts/audit-npm-publish-dry-run.mjs +191 -169
- package/scripts/audit-npm-tarball-install.mjs +191 -191
- package/scripts/audit-open-source-defaults.mjs +92 -92
- package/scripts/audit-open-source-readiness.mjs +97 -97
- package/scripts/audit-project.mjs +138 -138
- package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -203
- package/scripts/audit-public-acceptance-readiness.mjs +224 -224
- package/scripts/audit-public-channel-publication.mjs +248 -248
- package/scripts/audit-public-ci-run.mjs +184 -184
- package/scripts/audit-public-collaboration-templates.mjs +98 -98
- package/scripts/audit-public-external-gate-probe.mjs +206 -206
- package/scripts/audit-public-release-decision.mjs +201 -201
- package/scripts/audit-public-release-metadata.mjs +176 -176
- package/scripts/audit-public-repository-settings.mjs +237 -237
- package/scripts/audit-public-security-contact.mjs +171 -171
- package/scripts/audit-readme-docs.mjs +6 -4
- package/scripts/audit-recovery-readiness.mjs +98 -98
- package/scripts/audit-release-readiness.mjs +106 -106
- package/scripts/audit-release-trust.mjs +62 -62
- package/scripts/audit-remote-distribution.mjs +266 -266
- package/scripts/audit-roadmap-consistency.mjs +235 -235
- package/scripts/audit-signing.mjs +147 -147
- package/scripts/audit-state-freshness.mjs +14 -9
- package/scripts/audit-target-adoption-evidence.mjs +117 -117
- package/scripts/audit-target-project.mjs +507 -507
- package/scripts/audit-update-release-acceptance.mjs +136 -136
- package/scripts/audit-v1-target-validation.mjs +269 -269
- package/scripts/audit-validation-profiles.mjs +125 -125
- package/scripts/close-change.mjs +116 -116
- package/scripts/discover-project-profile.mjs +307 -307
- package/scripts/generate-command-adapter.mjs +231 -231
- package/scripts/generate-final-acceptance-packet.mjs +181 -181
- package/scripts/generate-final-form-progress-report.mjs +205 -205
- package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -206
- package/scripts/generate-owner-external-gate-kit.mjs +295 -295
- package/scripts/generate-public-acceptance-handoff.mjs +168 -168
- package/scripts/generate-public-release-checklist.mjs +207 -207
- package/scripts/generate-release-bundle.mjs +505 -505
- package/scripts/generate-release-owner-action-plan.mjs +172 -172
- package/scripts/generate-release-status-manifest.mjs +200 -200
- package/scripts/generate-session-prompt.mjs +188 -188
- package/scripts/gse.mjs +67 -67
- package/scripts/init-change.mjs +265 -265
- package/scripts/init-project.mjs +785 -785
- package/scripts/install-gse.mjs +234 -234
- package/scripts/lib/evidence-placeholders.mjs +28 -28
- package/scripts/package-gse.mjs +174 -174
- package/scripts/probe-public-external-gates.mjs +167 -167
- package/scripts/record-host-invocation.mjs +151 -151
- package/scripts/record-public-channel-publication.mjs +178 -178
- package/scripts/record-public-ci-run.mjs +180 -180
- package/scripts/record-public-release.mjs +175 -175
- package/scripts/record-public-repository-settings.mjs +209 -209
- package/scripts/record-public-security-contact.mjs +157 -157
- package/scripts/sign-gse-package.mjs +83 -83
- package/scripts/update-project-state.mjs +223 -223
- package/scripts/verify-gse-package.mjs +85 -85
|
@@ -1,133 +1,133 @@
|
|
|
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 template = read('assets/templates/acceptance-execution-packet.md')
|
|
30
|
-
const forwardTest = read('references/forward-test.md')
|
|
31
|
-
const recipes = read('references/adoption-recipes.md')
|
|
32
|
-
const validate = read('scripts/validate-gse.mjs')
|
|
33
|
-
|
|
34
|
-
const fields = [
|
|
35
|
-
'Acceptance path:',
|
|
36
|
-
'Target project or session:',
|
|
37
|
-
'Purpose:',
|
|
38
|
-
'Required inputs:',
|
|
39
|
-
'Allowed files:',
|
|
40
|
-
'Forbidden files:',
|
|
41
|
-
'Allowed commands:',
|
|
42
|
-
'Forbidden commands:',
|
|
43
|
-
'Expected output:',
|
|
44
|
-
'Evidence record path:',
|
|
45
|
-
'Acceptance gate:',
|
|
46
|
-
'Accepted by:',
|
|
47
|
-
'Stop conditions:',
|
|
48
|
-
'Residual risk if incomplete:',
|
|
49
|
-
'Next action after completion:',
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
const freshInputs = [
|
|
53
|
-
'SKILL.md',
|
|
54
|
-
'.gse/gse-design-master-plan.md',
|
|
55
|
-
'.gse/goal-map.md',
|
|
56
|
-
'.gse/current-slice.md',
|
|
57
|
-
'references/forward-test.md',
|
|
58
|
-
'references/evidence-taxonomy.md',
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
const projectInputs = [
|
|
62
|
-
'Project owner approval text or issue/task link.',
|
|
63
|
-
'references/adoption-recipes.md',
|
|
64
|
-
'assets/templates/target-adoption-evidence.md',
|
|
65
|
-
'assets/templates/update-release-acceptance-record.md',
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
const antiOverclaim = [
|
|
69
|
-
'Do not write `Accepted by: fresh-session` unless a separate session actually ran the packet.',
|
|
70
|
-
'Do not write `Accepted by: owner` unless owner approval is explicit and recorded.',
|
|
71
|
-
'Do not treat a generated packet, local validation, fixture audit, or read-only discovery as acceptance.',
|
|
72
|
-
'Evidence status: not ready',
|
|
73
|
-
'Accepted by: not accepted',
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
const checks = [
|
|
77
|
-
check('AEP01', 'acceptance execution packet template exists', exists('assets/templates/acceptance-execution-packet.md'), 'assets/templates/acceptance-execution-packet.md'),
|
|
78
|
-
check('AEP02', 'packet captures execution boundaries', fields.every((item) => template.includes(item)), fields.join(', ')),
|
|
79
|
-
check('AEP03', 'fresh-session path uses documented GSE inputs', freshInputs.every((item) => template.includes(item)), freshInputs.join(', ')),
|
|
80
|
-
check('AEP04', 'owner-approved path requires explicit owner evidence and project templates', projectInputs.every((item) => template.includes(item)), projectInputs.join(', ')),
|
|
81
|
-
check('AEP05', 'packet limits default project writes to .gse artifacts', template.includes('.gse/project-profile.md') && template.includes('.gse/evidence/YYYY-MM-DD.md') && template.includes('Source code, lockfiles, secrets'), 'allowed and forbidden file sections'),
|
|
82
|
-
check('AEP06', 'packet prevents fake acceptance', antiOverclaim.every((item) => template.includes(item)), 'anti-overclaim rules'),
|
|
83
|
-
check('AEP07', 'forward-test reference supports fresh-session acceptance boundary', forwardTest.includes('Use `accepted by: fresh-session` only when a separate agent/session actually ran the path.'), 'references/forward-test.md'),
|
|
84
|
-
check('AEP08', 'adoption recipes support target adoption evidence template', recipes.includes('assets/templates/target-adoption-evidence.md'), 'references/adoption-recipes.md'),
|
|
85
|
-
check('AEP09', 'consolidated validator includes this audit', validate.includes('audit-acceptance-execution-packet.mjs'), 'scripts/validate-gse.mjs'),
|
|
86
|
-
]
|
|
87
|
-
|
|
88
|
-
const passed = checks.filter((item) => item.status === 'passed').length
|
|
89
|
-
const failed = checks.length - passed
|
|
90
|
-
const report = {
|
|
91
|
-
root,
|
|
92
|
-
generatedAt: new Date().toISOString(),
|
|
93
|
-
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
94
|
-
workflows: { acceptanceExecutionPacket: failed === 0 ? 'verified' : 'failed' },
|
|
95
|
-
acceptedBy: 'not accepted; this audit verifies packet readiness only',
|
|
96
|
-
limits: [
|
|
97
|
-
'This audit verifies acceptance packet readiness only.',
|
|
98
|
-
'It does not create a separate session, write to a target project, or record owner acceptance.',
|
|
99
|
-
],
|
|
100
|
-
checks,
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function renderMarkdown(data) {
|
|
104
|
-
const lines = []
|
|
105
|
-
lines.push('# GSE Acceptance Execution Packet Audit')
|
|
106
|
-
lines.push('')
|
|
107
|
-
lines.push('Generated: ' + data.generatedAt)
|
|
108
|
-
lines.push('Root: ' + data.root)
|
|
109
|
-
lines.push('')
|
|
110
|
-
lines.push('## Summary')
|
|
111
|
-
lines.push('')
|
|
112
|
-
lines.push('- Status: ' + data.summary.status)
|
|
113
|
-
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
114
|
-
lines.push('- Acceptance execution packet: ' + data.workflows.acceptanceExecutionPacket)
|
|
115
|
-
lines.push('- Accepted by: ' + data.acceptedBy)
|
|
116
|
-
lines.push('')
|
|
117
|
-
lines.push('## Checks')
|
|
118
|
-
lines.push('')
|
|
119
|
-
for (const item of data.checks) {
|
|
120
|
-
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
121
|
-
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
122
|
-
}
|
|
123
|
-
lines.push('')
|
|
124
|
-
lines.push('## Limits')
|
|
125
|
-
lines.push('')
|
|
126
|
-
for (const item of data.limits) lines.push('- ' + item)
|
|
127
|
-
return lines.join('\n') + '\n'
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
131
|
-
else console.log(renderMarkdown(report))
|
|
132
|
-
|
|
133
|
-
if (failed > 0) process.exit(1)
|
|
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 template = read('assets/templates/acceptance-execution-packet.md')
|
|
30
|
+
const forwardTest = read('references/forward-test.md')
|
|
31
|
+
const recipes = read('references/adoption-recipes.md')
|
|
32
|
+
const validate = read('scripts/validate-gse.mjs')
|
|
33
|
+
|
|
34
|
+
const fields = [
|
|
35
|
+
'Acceptance path:',
|
|
36
|
+
'Target project or session:',
|
|
37
|
+
'Purpose:',
|
|
38
|
+
'Required inputs:',
|
|
39
|
+
'Allowed files:',
|
|
40
|
+
'Forbidden files:',
|
|
41
|
+
'Allowed commands:',
|
|
42
|
+
'Forbidden commands:',
|
|
43
|
+
'Expected output:',
|
|
44
|
+
'Evidence record path:',
|
|
45
|
+
'Acceptance gate:',
|
|
46
|
+
'Accepted by:',
|
|
47
|
+
'Stop conditions:',
|
|
48
|
+
'Residual risk if incomplete:',
|
|
49
|
+
'Next action after completion:',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
const freshInputs = [
|
|
53
|
+
'SKILL.md',
|
|
54
|
+
'.gse/gse-design-master-plan.md',
|
|
55
|
+
'.gse/goal-map.md',
|
|
56
|
+
'.gse/current-slice.md',
|
|
57
|
+
'references/forward-test.md',
|
|
58
|
+
'references/evidence-taxonomy.md',
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const projectInputs = [
|
|
62
|
+
'Project owner approval text or issue/task link.',
|
|
63
|
+
'references/adoption-recipes.md',
|
|
64
|
+
'assets/templates/target-adoption-evidence.md',
|
|
65
|
+
'assets/templates/update-release-acceptance-record.md',
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
const antiOverclaim = [
|
|
69
|
+
'Do not write `Accepted by: fresh-session` unless a separate session actually ran the packet.',
|
|
70
|
+
'Do not write `Accepted by: owner` unless owner approval is explicit and recorded.',
|
|
71
|
+
'Do not treat a generated packet, local validation, fixture audit, or read-only discovery as acceptance.',
|
|
72
|
+
'Evidence status: not ready',
|
|
73
|
+
'Accepted by: not accepted',
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
const checks = [
|
|
77
|
+
check('AEP01', 'acceptance execution packet template exists', exists('assets/templates/acceptance-execution-packet.md'), 'assets/templates/acceptance-execution-packet.md'),
|
|
78
|
+
check('AEP02', 'packet captures execution boundaries', fields.every((item) => template.includes(item)), fields.join(', ')),
|
|
79
|
+
check('AEP03', 'fresh-session path uses documented GSE inputs', freshInputs.every((item) => template.includes(item)), freshInputs.join(', ')),
|
|
80
|
+
check('AEP04', 'owner-approved path requires explicit owner evidence and project templates', projectInputs.every((item) => template.includes(item)), projectInputs.join(', ')),
|
|
81
|
+
check('AEP05', 'packet limits default project writes to .gse artifacts', template.includes('.gse/project-profile.md') && template.includes('.gse/evidence/YYYY-MM-DD.md') && template.includes('Source code, lockfiles, secrets'), 'allowed and forbidden file sections'),
|
|
82
|
+
check('AEP06', 'packet prevents fake acceptance', antiOverclaim.every((item) => template.includes(item)), 'anti-overclaim rules'),
|
|
83
|
+
check('AEP07', 'forward-test reference supports fresh-session acceptance boundary', forwardTest.includes('Use `accepted by: fresh-session` only when a separate agent/session actually ran the path.'), 'references/forward-test.md'),
|
|
84
|
+
check('AEP08', 'adoption recipes support target adoption evidence template', recipes.includes('assets/templates/target-adoption-evidence.md'), 'references/adoption-recipes.md'),
|
|
85
|
+
check('AEP09', 'consolidated validator includes this audit', validate.includes('audit-acceptance-execution-packet.mjs'), 'scripts/validate-gse.mjs'),
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
89
|
+
const failed = checks.length - passed
|
|
90
|
+
const report = {
|
|
91
|
+
root,
|
|
92
|
+
generatedAt: new Date().toISOString(),
|
|
93
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
94
|
+
workflows: { acceptanceExecutionPacket: failed === 0 ? 'verified' : 'failed' },
|
|
95
|
+
acceptedBy: 'not accepted; this audit verifies packet readiness only',
|
|
96
|
+
limits: [
|
|
97
|
+
'This audit verifies acceptance packet readiness only.',
|
|
98
|
+
'It does not create a separate session, write to a target project, or record owner acceptance.',
|
|
99
|
+
],
|
|
100
|
+
checks,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function renderMarkdown(data) {
|
|
104
|
+
const lines = []
|
|
105
|
+
lines.push('# GSE Acceptance Execution Packet Audit')
|
|
106
|
+
lines.push('')
|
|
107
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
108
|
+
lines.push('Root: ' + data.root)
|
|
109
|
+
lines.push('')
|
|
110
|
+
lines.push('## Summary')
|
|
111
|
+
lines.push('')
|
|
112
|
+
lines.push('- Status: ' + data.summary.status)
|
|
113
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
114
|
+
lines.push('- Acceptance execution packet: ' + data.workflows.acceptanceExecutionPacket)
|
|
115
|
+
lines.push('- Accepted by: ' + data.acceptedBy)
|
|
116
|
+
lines.push('')
|
|
117
|
+
lines.push('## Checks')
|
|
118
|
+
lines.push('')
|
|
119
|
+
for (const item of data.checks) {
|
|
120
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
121
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
122
|
+
}
|
|
123
|
+
lines.push('')
|
|
124
|
+
lines.push('## Limits')
|
|
125
|
+
lines.push('')
|
|
126
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
127
|
+
return lines.join('\n') + '\n'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
131
|
+
else console.log(renderMarkdown(report))
|
|
132
|
+
|
|
133
|
+
if (failed > 0) process.exit(1)
|
|
@@ -1,99 +1,99 @@
|
|
|
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 recipes = read('references/adoption-recipes.md')
|
|
30
|
-
const skill = read('SKILL.md')
|
|
31
|
-
const bootstrap = read('references/project-bootstrap.md')
|
|
32
|
-
const packaging = read('references/packaging.md')
|
|
33
|
-
const examples = read('examples/README.md')
|
|
34
|
-
|
|
35
|
-
const recipeNames = ['Fresh Project Install', 'Existing Repo Adoption', 'Update Existing GSE', 'Host Adapter Adoption', 'CLI Or Package Project Adoption']
|
|
36
|
-
const recordFields = ['Adoption recipe:', 'Project path:', 'Mode or host:', 'Project rules read:', 'Commands run:', 'Files created or changed:', 'Preserved project-specific rules:', 'Host/tool statuses:', 'Validation evidence:', 'Evidence status:', 'Residual risk:', 'Next action:']
|
|
37
|
-
const commands = ['init-project.mjs', 'discover-project-profile.mjs', 'generate-command-adapter.mjs', 'audit-command-adapters.mjs', 'generate-host-adapter.mjs', 'audit-project.mjs', 'audit-adoption.mjs', 'audit-host-adapters.mjs', 'audit-fixtures.mjs', 'validate-gse.mjs']
|
|
38
|
-
const statusTerms = ['result', 'verified', 'accepted', 'not ready', 'unknown', 'documented', 'unavailable']
|
|
39
|
-
|
|
40
|
-
const checks = [
|
|
41
|
-
check('AR01', 'adoption recipes reference exists', exists('references/adoption-recipes.md'), 'references/adoption-recipes.md'),
|
|
42
|
-
check('AR02', 'SKILL routes adoption recipes', skill.includes('references/adoption-recipes.md'), 'SKILL.md Reference Routing'),
|
|
43
|
-
check('AR03', 'bootstrap, packaging, and examples route to recipes', bootstrap.includes('references/adoption-recipes.md') && packaging.includes('references/adoption-recipes.md') && examples.includes('references/adoption-recipes.md'), 'project-bootstrap.md, packaging.md, examples/README.md'),
|
|
44
|
-
check('AR04', 'core adoption recipes are present', recipeNames.every((item) => recipes.includes(item)), recipeNames.join(', ')),
|
|
45
|
-
check('AR05', 'fresh install includes mode selection and init command', recipes.includes('--mode <mode>') && recipes.includes('node <gse-skill>/scripts/init-project.mjs --target <project-root> --mode <mode>'), 'Fresh Project Install'),
|
|
46
|
-
check('AR06', 'existing repo adoption protects pre-existing project files', recipes.includes('Do not overwrite') && recipes.includes('--force') && recipes.includes('documented`, not `verified`'), 'Existing Repo Adoption'),
|
|
47
|
-
check('AR07', 'update recipe preserves local decisions and validates skill package', recipes.includes('Preserve local project decisions') && recipes.includes('node <gse-skill>/scripts/validate-gse.mjs --root <gse-skill>'), 'Update Existing GSE'),
|
|
48
|
-
check('AR08', 'host adapter recipe uses current command adapter path and keeps .gse source of truth', recipes.includes('Keep `.gse/` as the source of truth') && recipes.includes('generate-command-adapter.mjs') && recipes.includes('claude|codex|hermes|workbuddy|copilot|gemini|generic|all') && recipes.includes('legacy fixture helper') && recipes.includes('verified`, `documented`, `unknown`, or `unavailable`'), 'Host Adapter Adoption'),
|
|
49
|
-
check('AR09', 'adoption record has required fields', recordFields.every((item) => recipes.includes(item)), recordFields.join(', ')),
|
|
50
|
-
check('AR10', 'verification command list covers adoption scripts', commands.every((item) => recipes.includes(item)), commands.join(', ')),
|
|
51
|
-
check('AR11', 'status vocabulary avoids overclaiming', statusTerms.every((item) => recipes.includes(item)) && recipes.includes('do not certify arbitrary production repositories'), 'status and certification boundary'),
|
|
52
|
-
check('AR12', 'recipes are host-neutral and require project evidence', recipes.includes('host-neutral') && recipes.includes('project-specific evidence') && recipes.includes('unknown` until checked'), 'host-neutral project evidence rules'),
|
|
53
|
-
check('AR13', 'CLI/package adoption keeps release and install claims evidence-bound', recipes.includes('CLI Or Package Project Adoption') && recipes.includes('npm pack --dry-run') && recipes.includes('registry access') && recipes.includes('global install') && recipes.includes('shell completion require project-specific evidence'), 'CLI/package adoption recipe'),
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
const passed = checks.filter((item) => item.status === 'passed').length
|
|
57
|
-
const failed = checks.length - passed
|
|
58
|
-
const report = {
|
|
59
|
-
root,
|
|
60
|
-
generatedAt: new Date().toISOString(),
|
|
61
|
-
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
62
|
-
workflows: { adoptionRecipes: failed === 0 ? 'verified' : 'failed' },
|
|
63
|
-
limits: [
|
|
64
|
-
'Adoption recipe audit verifies reusable recipe coverage and routing; it does not install GSE into arbitrary production repositories.',
|
|
65
|
-
'Real adoption still needs project-specific inspection, focused smokes, and host/tool evidence.',
|
|
66
|
-
],
|
|
67
|
-
checks,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function renderMarkdown(data) {
|
|
71
|
-
const lines = []
|
|
72
|
-
lines.push('# GSE Adoption Recipe Audit')
|
|
73
|
-
lines.push('')
|
|
74
|
-
lines.push('Generated: ' + data.generatedAt)
|
|
75
|
-
lines.push('Root: ' + data.root)
|
|
76
|
-
lines.push('')
|
|
77
|
-
lines.push('## Summary')
|
|
78
|
-
lines.push('')
|
|
79
|
-
lines.push('- Status: ' + data.summary.status)
|
|
80
|
-
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
81
|
-
lines.push('- Adoption recipes: ' + data.workflows.adoptionRecipes)
|
|
82
|
-
lines.push('')
|
|
83
|
-
lines.push('## Checks')
|
|
84
|
-
lines.push('')
|
|
85
|
-
for (const item of data.checks) {
|
|
86
|
-
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
87
|
-
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
88
|
-
}
|
|
89
|
-
lines.push('')
|
|
90
|
-
lines.push('## Limits')
|
|
91
|
-
lines.push('')
|
|
92
|
-
for (const item of data.limits) lines.push('- ' + item)
|
|
93
|
-
return lines.join('\n') + '\n'
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
97
|
-
else console.log(renderMarkdown(report))
|
|
98
|
-
|
|
99
|
-
if (failed > 0) process.exit(1)
|
|
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 recipes = read('references/adoption-recipes.md')
|
|
30
|
+
const skill = read('SKILL.md')
|
|
31
|
+
const bootstrap = read('references/project-bootstrap.md')
|
|
32
|
+
const packaging = read('references/packaging.md')
|
|
33
|
+
const examples = read('examples/README.md')
|
|
34
|
+
|
|
35
|
+
const recipeNames = ['Fresh Project Install', 'Existing Repo Adoption', 'Update Existing GSE', 'Host Adapter Adoption', 'CLI Or Package Project Adoption']
|
|
36
|
+
const recordFields = ['Adoption recipe:', 'Project path:', 'Mode or host:', 'Project rules read:', 'Commands run:', 'Files created or changed:', 'Preserved project-specific rules:', 'Host/tool statuses:', 'Validation evidence:', 'Evidence status:', 'Residual risk:', 'Next action:']
|
|
37
|
+
const commands = ['init-project.mjs', 'discover-project-profile.mjs', 'generate-command-adapter.mjs', 'audit-command-adapters.mjs', 'generate-host-adapter.mjs', 'audit-project.mjs', 'audit-adoption.mjs', 'audit-host-adapters.mjs', 'audit-fixtures.mjs', 'validate-gse.mjs']
|
|
38
|
+
const statusTerms = ['result', 'verified', 'accepted', 'not ready', 'unknown', 'documented', 'unavailable']
|
|
39
|
+
|
|
40
|
+
const checks = [
|
|
41
|
+
check('AR01', 'adoption recipes reference exists', exists('references/adoption-recipes.md'), 'references/adoption-recipes.md'),
|
|
42
|
+
check('AR02', 'SKILL routes adoption recipes', skill.includes('references/adoption-recipes.md'), 'SKILL.md Reference Routing'),
|
|
43
|
+
check('AR03', 'bootstrap, packaging, and examples route to recipes', bootstrap.includes('references/adoption-recipes.md') && packaging.includes('references/adoption-recipes.md') && examples.includes('references/adoption-recipes.md'), 'project-bootstrap.md, packaging.md, examples/README.md'),
|
|
44
|
+
check('AR04', 'core adoption recipes are present', recipeNames.every((item) => recipes.includes(item)), recipeNames.join(', ')),
|
|
45
|
+
check('AR05', 'fresh install includes mode selection and init command', recipes.includes('--mode <mode>') && recipes.includes('node <gse-skill>/scripts/init-project.mjs --target <project-root> --mode <mode>'), 'Fresh Project Install'),
|
|
46
|
+
check('AR06', 'existing repo adoption protects pre-existing project files', recipes.includes('Do not overwrite') && recipes.includes('--force') && recipes.includes('documented`, not `verified`'), 'Existing Repo Adoption'),
|
|
47
|
+
check('AR07', 'update recipe preserves local decisions and validates skill package', recipes.includes('Preserve local project decisions') && recipes.includes('node <gse-skill>/scripts/validate-gse.mjs --root <gse-skill>'), 'Update Existing GSE'),
|
|
48
|
+
check('AR08', 'host adapter recipe uses current command adapter path and keeps .gse source of truth', recipes.includes('Keep `.gse/` as the source of truth') && recipes.includes('generate-command-adapter.mjs') && recipes.includes('claude|codex|hermes|workbuddy|copilot|gemini|generic|all') && recipes.includes('legacy fixture helper') && recipes.includes('verified`, `documented`, `unknown`, or `unavailable`'), 'Host Adapter Adoption'),
|
|
49
|
+
check('AR09', 'adoption record has required fields', recordFields.every((item) => recipes.includes(item)), recordFields.join(', ')),
|
|
50
|
+
check('AR10', 'verification command list covers adoption scripts', commands.every((item) => recipes.includes(item)), commands.join(', ')),
|
|
51
|
+
check('AR11', 'status vocabulary avoids overclaiming', statusTerms.every((item) => recipes.includes(item)) && recipes.includes('do not certify arbitrary production repositories'), 'status and certification boundary'),
|
|
52
|
+
check('AR12', 'recipes are host-neutral and require project evidence', recipes.includes('host-neutral') && recipes.includes('project-specific evidence') && recipes.includes('unknown` until checked'), 'host-neutral project evidence rules'),
|
|
53
|
+
check('AR13', 'CLI/package adoption keeps release and install claims evidence-bound', recipes.includes('CLI Or Package Project Adoption') && recipes.includes('npm pack --dry-run') && recipes.includes('registry access') && recipes.includes('global install') && recipes.includes('shell completion require project-specific evidence'), 'CLI/package adoption recipe'),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
57
|
+
const failed = checks.length - passed
|
|
58
|
+
const report = {
|
|
59
|
+
root,
|
|
60
|
+
generatedAt: new Date().toISOString(),
|
|
61
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
62
|
+
workflows: { adoptionRecipes: failed === 0 ? 'verified' : 'failed' },
|
|
63
|
+
limits: [
|
|
64
|
+
'Adoption recipe audit verifies reusable recipe coverage and routing; it does not install GSE into arbitrary production repositories.',
|
|
65
|
+
'Real adoption still needs project-specific inspection, focused smokes, and host/tool evidence.',
|
|
66
|
+
],
|
|
67
|
+
checks,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function renderMarkdown(data) {
|
|
71
|
+
const lines = []
|
|
72
|
+
lines.push('# GSE Adoption Recipe Audit')
|
|
73
|
+
lines.push('')
|
|
74
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
75
|
+
lines.push('Root: ' + data.root)
|
|
76
|
+
lines.push('')
|
|
77
|
+
lines.push('## Summary')
|
|
78
|
+
lines.push('')
|
|
79
|
+
lines.push('- Status: ' + data.summary.status)
|
|
80
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
81
|
+
lines.push('- Adoption recipes: ' + data.workflows.adoptionRecipes)
|
|
82
|
+
lines.push('')
|
|
83
|
+
lines.push('## Checks')
|
|
84
|
+
lines.push('')
|
|
85
|
+
for (const item of data.checks) {
|
|
86
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
87
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
88
|
+
}
|
|
89
|
+
lines.push('')
|
|
90
|
+
lines.push('## Limits')
|
|
91
|
+
lines.push('')
|
|
92
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
93
|
+
return lines.join('\n') + '\n'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
97
|
+
else console.log(renderMarkdown(report))
|
|
98
|
+
|
|
99
|
+
if (failed > 0) process.exit(1)
|
|
@@ -1,77 +1,77 @@
|
|
|
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-change-lifecycle-'))
|
|
18
|
-
const initScript = path.join(root, 'scripts', 'init-change.mjs')
|
|
19
|
-
const closeScript = path.join(root, 'scripts', 'close-change.mjs')
|
|
20
|
-
|
|
21
|
-
function run(script, commandArgs) {
|
|
22
|
-
return spawnSync(process.execPath, [script, ...commandArgs], { cwd: root, encoding: 'utf8', windowsHide: true })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function parseJson(text) {
|
|
26
|
-
try { return JSON.parse(text) } catch { return null }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function check(id, label, ok, evidence, risk = '') {
|
|
30
|
-
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fs.mkdirSync(path.join(target, '.gse', 'evidence'), { recursive: true })
|
|
34
|
-
fs.writeFileSync(path.join(target, '.gse', 'goal-map.md'), '# Goal Map\n', 'utf8')
|
|
35
|
-
fs.writeFileSync(path.join(target, '.gse', 'quality-gates.md'), '# Quality Gates\n', 'utf8')
|
|
36
|
-
fs.writeFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), '', 'utf8')
|
|
37
|
-
|
|
38
|
-
const init = run(initScript, ['--target', target, '--change-id', 'Archive Me', '--level', 'standard', '--json'])
|
|
39
|
-
const dryRun = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--dry-run', '--json'])
|
|
40
|
-
const dryRunPreservedSource = fs.existsSync(path.join(target, '.gse', 'changes', 'archive-me'))
|
|
41
|
-
const close = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--json'])
|
|
42
|
-
const closeJson = parseJson(close.stdout)
|
|
43
|
-
const archiveDir = path.join(target, '.gse', 'archive', '2026-07-06-archive-me')
|
|
44
|
-
const sourceDir = path.join(target, '.gse', 'changes', 'archive-me')
|
|
45
|
-
const indexText = fs.readFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), 'utf8')
|
|
46
|
-
const archiveRecord = fs.existsSync(path.join(archiveDir, 'archive-record.md')) ? fs.readFileSync(path.join(archiveDir, 'archive-record.md'), 'utf8') : ''
|
|
47
|
-
|
|
48
|
-
const checks = [
|
|
49
|
-
check('CHGLC01', 'close-change script exists', fs.existsSync(closeScript), 'scripts/close-change.mjs'),
|
|
50
|
-
check('CHGLC02', 'init-change creates closeable change pack', init.status === 0, 'scripts/init-change.mjs fixture run'),
|
|
51
|
-
check('CHGLC03', 'dry-run reports pass without moving source folder', dryRun.status === 0 && dryRunPreservedSource, 'close-change --dry-run'),
|
|
52
|
-
check('CHGLC04', 'close moves change folder into archive', close.status === 0 && fs.existsSync(archiveDir) && !fs.existsSync(sourceDir), '.gse/archive/YYYY-MM-DD-change-id'),
|
|
53
|
-
check('CHGLC05', 'archive record captures closure metadata', archiveRecord.includes('Status: verified') && archiveRecord.includes('Source: .gse/changes/archive-me'), 'archive-record.md'),
|
|
54
|
-
check('CHGLC06', 'evidence index receives schema-complete change-archive record', indexText.includes('"recordType":"change-archive"') && indexText.includes('"changeId":"archive-me"') && indexText.includes('"commands":') && indexText.includes('"nextAction":'), '.gse/evidence/index.jsonl'),
|
|
55
|
-
check('CHGLC07', 'close output preserves evidence status and archive path', closeJson?.evidenceStatus === 'verified' && closeJson?.indexRecord?.archivePath === '.gse/archive/2026-07-06-archive-me', 'close-change JSON'),
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
const passed = checks.filter((item) => item.status === 'passed').length
|
|
59
|
-
const failed = checks.length - passed
|
|
60
|
-
const report = {
|
|
61
|
-
root,
|
|
62
|
-
generatedAt: new Date().toISOString(),
|
|
63
|
-
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
64
|
-
workflows: { changeArchiveLifecycle: failed === 0 ? 'verified' : 'failed' },
|
|
65
|
-
limits: [
|
|
66
|
-
'This audit verifies local change archive mechanics in a fixture.',
|
|
67
|
-
'It does not certify the product correctness of a real target-project change.',
|
|
68
|
-
],
|
|
69
|
-
checks,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
fs.rmSync(target, { recursive: true, force: true })
|
|
73
|
-
|
|
74
|
-
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
75
|
-
else console.log(JSON.stringify(report, null, 2))
|
|
76
|
-
|
|
77
|
-
if (failed > 0) process.exit(1)
|
|
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-change-lifecycle-'))
|
|
18
|
+
const initScript = path.join(root, 'scripts', 'init-change.mjs')
|
|
19
|
+
const closeScript = path.join(root, 'scripts', 'close-change.mjs')
|
|
20
|
+
|
|
21
|
+
function run(script, commandArgs) {
|
|
22
|
+
return spawnSync(process.execPath, [script, ...commandArgs], { cwd: root, encoding: 'utf8', windowsHide: true })
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function parseJson(text) {
|
|
26
|
+
try { return JSON.parse(text) } catch { return null }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
30
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fs.mkdirSync(path.join(target, '.gse', 'evidence'), { recursive: true })
|
|
34
|
+
fs.writeFileSync(path.join(target, '.gse', 'goal-map.md'), '# Goal Map\n', 'utf8')
|
|
35
|
+
fs.writeFileSync(path.join(target, '.gse', 'quality-gates.md'), '# Quality Gates\n', 'utf8')
|
|
36
|
+
fs.writeFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), '', 'utf8')
|
|
37
|
+
|
|
38
|
+
const init = run(initScript, ['--target', target, '--change-id', 'Archive Me', '--level', 'standard', '--json'])
|
|
39
|
+
const dryRun = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--dry-run', '--json'])
|
|
40
|
+
const dryRunPreservedSource = fs.existsSync(path.join(target, '.gse', 'changes', 'archive-me'))
|
|
41
|
+
const close = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--json'])
|
|
42
|
+
const closeJson = parseJson(close.stdout)
|
|
43
|
+
const archiveDir = path.join(target, '.gse', 'archive', '2026-07-06-archive-me')
|
|
44
|
+
const sourceDir = path.join(target, '.gse', 'changes', 'archive-me')
|
|
45
|
+
const indexText = fs.readFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), 'utf8')
|
|
46
|
+
const archiveRecord = fs.existsSync(path.join(archiveDir, 'archive-record.md')) ? fs.readFileSync(path.join(archiveDir, 'archive-record.md'), 'utf8') : ''
|
|
47
|
+
|
|
48
|
+
const checks = [
|
|
49
|
+
check('CHGLC01', 'close-change script exists', fs.existsSync(closeScript), 'scripts/close-change.mjs'),
|
|
50
|
+
check('CHGLC02', 'init-change creates closeable change pack', init.status === 0, 'scripts/init-change.mjs fixture run'),
|
|
51
|
+
check('CHGLC03', 'dry-run reports pass without moving source folder', dryRun.status === 0 && dryRunPreservedSource, 'close-change --dry-run'),
|
|
52
|
+
check('CHGLC04', 'close moves change folder into archive', close.status === 0 && fs.existsSync(archiveDir) && !fs.existsSync(sourceDir), '.gse/archive/YYYY-MM-DD-change-id'),
|
|
53
|
+
check('CHGLC05', 'archive record captures closure metadata', archiveRecord.includes('Status: verified') && archiveRecord.includes('Source: .gse/changes/archive-me'), 'archive-record.md'),
|
|
54
|
+
check('CHGLC06', 'evidence index receives schema-complete change-archive record', indexText.includes('"recordType":"change-archive"') && indexText.includes('"changeId":"archive-me"') && indexText.includes('"commands":') && indexText.includes('"nextAction":'), '.gse/evidence/index.jsonl'),
|
|
55
|
+
check('CHGLC07', 'close output preserves evidence status and archive path', closeJson?.evidenceStatus === 'verified' && closeJson?.indexRecord?.archivePath === '.gse/archive/2026-07-06-archive-me', 'close-change JSON'),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
59
|
+
const failed = checks.length - passed
|
|
60
|
+
const report = {
|
|
61
|
+
root,
|
|
62
|
+
generatedAt: new Date().toISOString(),
|
|
63
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
64
|
+
workflows: { changeArchiveLifecycle: failed === 0 ? 'verified' : 'failed' },
|
|
65
|
+
limits: [
|
|
66
|
+
'This audit verifies local change archive mechanics in a fixture.',
|
|
67
|
+
'It does not certify the product correctness of a real target-project change.',
|
|
68
|
+
],
|
|
69
|
+
checks,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fs.rmSync(target, { recursive: true, force: true })
|
|
73
|
+
|
|
74
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
75
|
+
else console.log(JSON.stringify(report, null, 2))
|
|
76
|
+
|
|
77
|
+
if (failed > 0) process.exit(1)
|