@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.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
- package/.github/ISSUE_TEMPLATE/change_request.yml +50 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- package/.github/workflows/validate-gse.yml +33 -0
- package/.gse/README.md +18 -0
- package/.gse/gse-development-protocol.md +50 -0
- package/.gse/project-profile.md +29 -0
- package/.gse/quality-gates.md +25 -0
- package/.gse/releases/public-channel-publication-pending.md +49 -0
- package/.gse/releases/public-ci-run-pending.md +53 -0
- package/.gse/releases/public-release-owner-required.md +65 -0
- package/.gse/releases/public-repository-settings-owner-required.md +59 -0
- package/.gse/releases/public-security-contact-owner-required.md +45 -0
- package/.gse/state.json +27 -0
- package/CHANGELOG.md +24 -0
- package/CONTRIBUTING.md +64 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/README.zh-CN.md +236 -0
- package/SECURITY.md +41 -0
- package/SKILL.md +148 -0
- package/SUPPORT.md +38 -0
- package/agents/openai.yaml +4 -0
- package/assets/marketplace/README.md +7 -0
- package/assets/marketplace/gse-listing.json +75 -0
- package/assets/templates/acceptance-execution-packet.md +73 -0
- package/assets/templates/adr.md +14 -0
- package/assets/templates/change-brief.md +16 -0
- package/assets/templates/design.md +18 -0
- package/assets/templates/dispatch-packet.md +104 -0
- package/assets/templates/evidence.md +14 -0
- package/assets/templates/execution-quality-pack.md +65 -0
- package/assets/templates/goal-map.md +21 -0
- package/assets/templates/host-adapter.md +48 -0
- package/assets/templates/host-ui-invocation-record.md +42 -0
- package/assets/templates/incident-review.md +60 -0
- package/assets/templates/public-channel-publication-record.md +49 -0
- package/assets/templates/public-ci-run-record.md +53 -0
- package/assets/templates/public-release-record.md +65 -0
- package/assets/templates/public-repository-settings-record.md +59 -0
- package/assets/templates/public-security-contact-record.md +45 -0
- package/assets/templates/release-trust-record.md +32 -0
- package/assets/templates/review.md +18 -0
- package/assets/templates/spec.md +16 -0
- package/assets/templates/target-adoption-evidence.md +29 -0
- package/assets/templates/tasks.md +17 -0
- package/assets/templates/update-release-acceptance-record.md +58 -0
- package/examples/README.md +22 -0
- package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -0
- package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -0
- package/examples/agent-runtime-host/.gse/goal-map.md +7 -0
- package/examples/agent-runtime-host/.gse/project-profile.md +27 -0
- package/examples/agent-runtime-host/.gse/tooling.md +5 -0
- package/examples/agent-runtime-host/.mcp.json +9 -0
- package/examples/agent-runtime-host/AGENTS.md +5 -0
- package/examples/agent-runtime-host/README.md +10 -0
- package/examples/agent-runtime-host/docs/model-routing.md +5 -0
- package/examples/cli-tool/.gse/project-profile.md +21 -0
- package/examples/cli-tool/AGENTS.md +5 -0
- package/examples/cli-tool/README.md +12 -0
- package/examples/cli-tool/package.json +21 -0
- package/examples/small-app/.env.example +2 -0
- package/examples/small-app/.github/workflows/ci.yml +8 -0
- package/examples/small-app/AGENTS.md +5 -0
- package/examples/small-app/README.md +12 -0
- package/examples/small-app/package.json +26 -0
- package/examples/small-app/playwright.config.ts +4 -0
- package/package.json +53 -0
- package/references/adoption-recipes.md +171 -0
- package/references/agent-roles.md +49 -0
- package/references/architecture-health.md +101 -0
- package/references/benchmark-audit.md +73 -0
- package/references/commands.md +295 -0
- package/references/community-channels.md +46 -0
- package/references/compatibility.md +70 -0
- package/references/design-basis.md +38 -0
- package/references/domain-model.md +129 -0
- package/references/domain-quality-gates.md +75 -0
- package/references/drift-audit.md +81 -0
- package/references/evidence-taxonomy.md +123 -0
- package/references/file-ownership.md +107 -0
- package/references/final-readiness.md +84 -0
- package/references/forward-test.md +133 -0
- package/references/goal-map.md +36 -0
- package/references/host-adapters.md +119 -0
- package/references/learning-system.md +35 -0
- package/references/marketplace-discovery.md +46 -0
- package/references/model-routing.md +103 -0
- package/references/open-source-defaults.md +39 -0
- package/references/operating-model.md +52 -0
- package/references/packaging.md +277 -0
- package/references/project-agent-workspace.md +89 -0
- package/references/project-bootstrap.md +122 -0
- package/references/project-profile.md +57 -0
- package/references/public-release.md +174 -0
- package/references/quality-gates.md +100 -0
- package/references/recovery.md +176 -0
- package/references/release-trust.md +43 -0
- package/references/release.md +126 -0
- package/references/review.md +141 -0
- package/references/router.md +90 -0
- package/references/spec-workflow.md +66 -0
- package/references/task-levels.md +81 -0
- package/references/tool-adapters.md +73 -0
- package/scripts/audit-acceptance-execution-packet.mjs +133 -0
- package/scripts/audit-adoption-recipes.mjs +99 -0
- package/scripts/audit-adoption.mjs +154 -0
- package/scripts/audit-change-lifecycle.mjs +77 -0
- package/scripts/audit-change-system.mjs +134 -0
- package/scripts/audit-ci-readiness.mjs +107 -0
- package/scripts/audit-close-gate.mjs +323 -0
- package/scripts/audit-command-adapters.mjs +91 -0
- package/scripts/audit-command-execution.mjs +210 -0
- package/scripts/audit-commands.mjs +117 -0
- package/scripts/audit-compatibility.mjs +149 -0
- package/scripts/audit-completion-readiness.mjs +292 -0
- package/scripts/audit-distribution.mjs +251 -0
- package/scripts/audit-domain-quality-gates.mjs +108 -0
- package/scripts/audit-evidence-placeholders.mjs +126 -0
- package/scripts/audit-final-acceptance-packet.mjs +148 -0
- package/scripts/audit-final-form-progress-report.mjs +161 -0
- package/scripts/audit-final-form-stale-copy.mjs +221 -0
- package/scripts/audit-final-readiness-promotion.mjs +255 -0
- package/scripts/audit-final-readiness.mjs +226 -0
- package/scripts/audit-fixtures.mjs +154 -0
- package/scripts/audit-fresh-session-readiness.mjs +177 -0
- package/scripts/audit-gse.mjs +275 -0
- package/scripts/audit-host-adapters.mjs +119 -0
- package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -0
- package/scripts/audit-host-runtime-invocation-drill.mjs +240 -0
- package/scripts/audit-host-runtime-invocations.mjs +254 -0
- package/scripts/audit-host-ui-invocation.mjs +132 -0
- package/scripts/audit-learning-system.mjs +103 -0
- package/scripts/audit-local-final-form-completion.mjs +131 -0
- package/scripts/audit-marketplace-discovery.mjs +122 -0
- package/scripts/audit-npm-package-metadata.mjs +155 -0
- package/scripts/audit-npm-publish-dry-run.mjs +169 -0
- package/scripts/audit-npm-tarball-install.mjs +191 -0
- package/scripts/audit-open-source-defaults.mjs +92 -0
- package/scripts/audit-open-source-readiness.mjs +97 -0
- package/scripts/audit-owner-external-gate-kit.mjs +218 -0
- package/scripts/audit-project.mjs +323 -0
- package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -0
- package/scripts/audit-public-acceptance-handoff.mjs +142 -0
- package/scripts/audit-public-acceptance-readiness.mjs +224 -0
- package/scripts/audit-public-channel-publication.mjs +248 -0
- package/scripts/audit-public-ci-run.mjs +184 -0
- package/scripts/audit-public-collaboration-templates.mjs +98 -0
- package/scripts/audit-public-external-gate-probe.mjs +206 -0
- package/scripts/audit-public-release-checklist.mjs +133 -0
- package/scripts/audit-public-release-decision.mjs +201 -0
- package/scripts/audit-public-release-metadata.mjs +176 -0
- package/scripts/audit-public-repository-settings.mjs +237 -0
- package/scripts/audit-public-security-contact.mjs +171 -0
- package/scripts/audit-readme-docs.mjs +185 -0
- package/scripts/audit-recovery-readiness.mjs +98 -0
- package/scripts/audit-release-bundle.mjs +251 -0
- package/scripts/audit-release-owner-action-plan-drill.mjs +277 -0
- package/scripts/audit-release-owner-action-plan.mjs +164 -0
- package/scripts/audit-release-readiness.mjs +106 -0
- package/scripts/audit-release-status-manifest.mjs +165 -0
- package/scripts/audit-release-trust.mjs +62 -0
- package/scripts/audit-remote-distribution.mjs +266 -0
- package/scripts/audit-roadmap-consistency.mjs +235 -0
- package/scripts/audit-signing.mjs +147 -0
- package/scripts/audit-state-freshness.mjs +113 -0
- package/scripts/audit-target-adoption-evidence.mjs +117 -0
- package/scripts/audit-target-project.mjs +507 -0
- package/scripts/audit-update-release-acceptance.mjs +136 -0
- package/scripts/audit-v1-target-validation.mjs +269 -0
- package/scripts/audit-validation-profiles.mjs +125 -0
- package/scripts/close-change.mjs +116 -0
- package/scripts/discover-project-profile.mjs +307 -0
- package/scripts/forward-test-gse.mjs +146 -0
- package/scripts/generate-command-adapter.mjs +231 -0
- package/scripts/generate-final-acceptance-packet.mjs +181 -0
- package/scripts/generate-final-form-progress-report.mjs +205 -0
- package/scripts/generate-host-adapter.mjs +73 -0
- package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -0
- package/scripts/generate-owner-external-gate-kit.mjs +295 -0
- package/scripts/generate-public-acceptance-handoff.mjs +168 -0
- package/scripts/generate-public-release-checklist.mjs +207 -0
- package/scripts/generate-release-bundle.mjs +505 -0
- package/scripts/generate-release-owner-action-plan.mjs +172 -0
- package/scripts/generate-release-status-manifest.mjs +200 -0
- package/scripts/generate-session-prompt.mjs +188 -0
- package/scripts/gse.mjs +67 -0
- package/scripts/init-change.mjs +265 -0
- package/scripts/init-project.mjs +785 -0
- package/scripts/install-gse.mjs +234 -0
- package/scripts/lib/evidence-placeholders.mjs +28 -0
- package/scripts/package-gse.mjs +174 -0
- package/scripts/probe-public-external-gates.mjs +167 -0
- package/scripts/record-host-invocation.mjs +151 -0
- package/scripts/record-learning.mjs +137 -0
- package/scripts/record-public-channel-publication.mjs +178 -0
- package/scripts/record-public-ci-run.mjs +180 -0
- package/scripts/record-public-release.mjs +175 -0
- package/scripts/record-public-repository-settings.mjs +209 -0
- package/scripts/record-public-security-contact.mjs +157 -0
- package/scripts/run-gse-command.mjs +538 -0
- package/scripts/run-validation-profile.mjs +146 -0
- package/scripts/sign-gse-package.mjs +83 -0
- package/scripts/update-project-state.mjs +223 -0
- package/scripts/validate-gse.mjs +1168 -0
- package/scripts/verify-gse-package.mjs +85 -0
|
@@ -0,0 +1,507 @@
|
|
|
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
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
19
|
+
|
|
20
|
+
function slash(value) {
|
|
21
|
+
return value.replace(/\\/g, '/')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function readText(filePath) {
|
|
25
|
+
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '') : ''
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function readJson(filePath) {
|
|
29
|
+
if (!fs.existsSync(filePath)) return { exists: false, ok: false, data: null, error: 'missing' }
|
|
30
|
+
try {
|
|
31
|
+
return { exists: true, ok: true, data: JSON.parse(readText(filePath)), error: '' }
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return { exists: true, ok: false, data: null, error: error.message }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readJsonl(filePath) {
|
|
38
|
+
if (!fs.existsSync(filePath)) return { exists: false, ok: false, records: [], error: 'missing' }
|
|
39
|
+
const lines = readText(filePath)
|
|
40
|
+
.split(/\r?\n/)
|
|
41
|
+
.map((line) => line.trim())
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
const records = []
|
|
44
|
+
for (const [index, line] of lines.entries()) {
|
|
45
|
+
try {
|
|
46
|
+
records.push(JSON.parse(line))
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return { exists: true, ok: false, records, error: `line ${index + 1}: ${error.message}` }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { exists: true, ok: true, records, error: '' }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function exists(target, relativePath) {
|
|
55
|
+
return fs.existsSync(path.join(target, relativePath))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function listFiles(dir) {
|
|
59
|
+
const files = []
|
|
60
|
+
function visit(itemPath) {
|
|
61
|
+
if (!fs.existsSync(itemPath)) return
|
|
62
|
+
const stat = fs.statSync(itemPath)
|
|
63
|
+
if (stat.isDirectory()) {
|
|
64
|
+
for (const child of fs.readdirSync(itemPath)) visit(path.join(itemPath, child))
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
if (stat.isFile()) files.push(itemPath)
|
|
68
|
+
}
|
|
69
|
+
visit(dir)
|
|
70
|
+
return files
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function runGit(target, commandArgs) {
|
|
74
|
+
const result = spawnSync('git', commandArgs, {
|
|
75
|
+
cwd: target,
|
|
76
|
+
encoding: 'utf8',
|
|
77
|
+
windowsHide: true,
|
|
78
|
+
})
|
|
79
|
+
return {
|
|
80
|
+
status: result.status ?? 1,
|
|
81
|
+
stdout: (result.stdout ?? '').trim(),
|
|
82
|
+
stderr: (result.stderr ?? '').trim(),
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function statusFrom(ok, warn = false) {
|
|
87
|
+
if (ok) return 'passed'
|
|
88
|
+
if (warn) return 'warning'
|
|
89
|
+
return 'failed'
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function check(id, label, status, evidence, recommendation = '') {
|
|
93
|
+
return { id, label, status, evidence, recommendation }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const requiredFiles = [
|
|
97
|
+
'.gse/README.md',
|
|
98
|
+
'.gse/project-profile.md',
|
|
99
|
+
'.gse/goal-map.md',
|
|
100
|
+
'.gse/goals/README.md',
|
|
101
|
+
'.gse/quality-gates.md',
|
|
102
|
+
'.gse/tooling.md',
|
|
103
|
+
'.gse/templates/change-brief.md',
|
|
104
|
+
'.gse/templates/evidence.md',
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
const enterpriseFiles = [
|
|
108
|
+
'.gse/agent-workspace.md',
|
|
109
|
+
'.gse/agents/roles.md',
|
|
110
|
+
'.gse/agents/dispatch.md',
|
|
111
|
+
'.gse/skills/README.md',
|
|
112
|
+
'.gse/lsp/README.md',
|
|
113
|
+
'.gse/hooks/README.md',
|
|
114
|
+
'.gse/mcp/README.md',
|
|
115
|
+
'.gse/plugins/README.md',
|
|
116
|
+
'.gse/release.md',
|
|
117
|
+
'.gse/incident-review.md',
|
|
118
|
+
'.gse/audit.md',
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
function findCanonicalPlan(target) {
|
|
122
|
+
const candidates = []
|
|
123
|
+
const texts = [
|
|
124
|
+
readText(path.join(target, '.gse', 'README.md')),
|
|
125
|
+
readText(path.join(target, '.gse', 'project-profile.md')),
|
|
126
|
+
readText(path.join(target, '.gse', 'goal-map.md')),
|
|
127
|
+
].join('\n')
|
|
128
|
+
|
|
129
|
+
const regex = /docs\/[A-Za-z0-9._/-]*?(?:architecture|productization)[A-Za-z0-9._/-]*?\.md/g
|
|
130
|
+
for (const match of texts.matchAll(regex)) {
|
|
131
|
+
if (!candidates.includes(match[0])) candidates.push(match[0])
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
for (const fallback of [
|
|
135
|
+
'docs/aion-productization-architecture.md',
|
|
136
|
+
'docs/museflow-ai-film-productization-architecture.md',
|
|
137
|
+
]) {
|
|
138
|
+
if (exists(target, fallback) && !candidates.includes(fallback)) candidates.push(fallback)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return candidates.map((relativePath) => ({ relativePath, exists: exists(target, relativePath) }))
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function auditTarget(target) {
|
|
145
|
+
const resolvedTarget = path.resolve(target)
|
|
146
|
+
const gseDir = path.join(resolvedTarget, '.gse')
|
|
147
|
+
const checks = []
|
|
148
|
+
|
|
149
|
+
const hasGse = fs.existsSync(gseDir)
|
|
150
|
+
checks.push(
|
|
151
|
+
check(
|
|
152
|
+
'TPD01',
|
|
153
|
+
'.gse directory exists',
|
|
154
|
+
statusFrom(hasGse),
|
|
155
|
+
hasGse ? '.gse exists' : '.gse missing',
|
|
156
|
+
hasGse ? '' : 'Run GSE init/adopt before relying on project-local workflow files.',
|
|
157
|
+
),
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
const missingRequired = requiredFiles.filter((relativePath) => !exists(resolvedTarget, relativePath))
|
|
161
|
+
checks.push(
|
|
162
|
+
check(
|
|
163
|
+
'TPD02',
|
|
164
|
+
'required GSE files exist',
|
|
165
|
+
statusFrom(missingRequired.length === 0),
|
|
166
|
+
missingRequired.length === 0 ? `${requiredFiles.length}/${requiredFiles.length} required files present` : 'missing: ' + missingRequired.join(', '),
|
|
167
|
+
missingRequired.length === 0 ? '' : 'Regenerate missing scaffold files or document why this project intentionally uses a smaller mode.',
|
|
168
|
+
),
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
const presentEnterprise = enterpriseFiles.filter((relativePath) => exists(resolvedTarget, relativePath))
|
|
172
|
+
checks.push(
|
|
173
|
+
check(
|
|
174
|
+
'TPD03',
|
|
175
|
+
'enterprise workspace files are visible when present',
|
|
176
|
+
presentEnterprise.length === 0 ? 'warning' : 'passed',
|
|
177
|
+
presentEnterprise.length === 0 ? 'no enterprise workspace files found' : `${presentEnterprise.length}/${enterpriseFiles.length} enterprise files present`,
|
|
178
|
+
presentEnterprise.length === 0 ? 'Large or long-running projects should use standard/enterprise scaffold files.' : '',
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
const canonicalPlans = findCanonicalPlan(resolvedTarget)
|
|
183
|
+
const existingCanonicalPlans = canonicalPlans.filter((item) => item.exists)
|
|
184
|
+
checks.push(
|
|
185
|
+
check(
|
|
186
|
+
'TPD04',
|
|
187
|
+
'canonical project plan is discoverable',
|
|
188
|
+
statusFrom(existingCanonicalPlans.length > 0),
|
|
189
|
+
canonicalPlans.length === 0 ? 'no canonical plan reference found' : canonicalPlans.map((item) => `${item.relativePath}:${item.exists ? 'exists' : 'missing'}`).join(', '),
|
|
190
|
+
existingCanonicalPlans.length > 0 ? '' : 'Record the project canonical plan in .gse/README.md or .gse/goal-map.md.',
|
|
191
|
+
),
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
const qualityText = readText(path.join(resolvedTarget, '.gse', 'quality-gates.md'))
|
|
195
|
+
const hasUniversalGate = qualityText.includes('Universal') || qualityText.includes('Universal Slice Gate')
|
|
196
|
+
const hasDomainGate = /Identity|Chat|Canvas|UI|Browser|Media|Package|Encoding|Release|Recovery/i.test(qualityText)
|
|
197
|
+
checks.push(
|
|
198
|
+
check(
|
|
199
|
+
'TPD05',
|
|
200
|
+
'quality gates include universal and project/domain gates',
|
|
201
|
+
statusFrom(hasUniversalGate && hasDomainGate, hasUniversalGate || hasDomainGate),
|
|
202
|
+
`universal:${hasUniversalGate}, domain:${hasDomainGate}`,
|
|
203
|
+
hasUniversalGate && hasDomainGate ? '' : 'Add project-specific quality gates instead of relying only on generic GSE wording.',
|
|
204
|
+
),
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
const evidenceDir = path.join(gseDir, 'evidence')
|
|
208
|
+
const evidenceFiles = fs.existsSync(evidenceDir)
|
|
209
|
+
? listFiles(evidenceDir).filter((filePath) => /\.(md|json|jsonl)$/i.test(filePath))
|
|
210
|
+
: []
|
|
211
|
+
checks.push(
|
|
212
|
+
check(
|
|
213
|
+
'TPD06',
|
|
214
|
+
'project-local GSE evidence exists',
|
|
215
|
+
statusFrom(evidenceFiles.length > 0),
|
|
216
|
+
evidenceFiles.length > 0 ? `${evidenceFiles.length} evidence file(s)` : 'no evidence files',
|
|
217
|
+
evidenceFiles.length > 0 ? '' : 'Record adoption or slice evidence under .gse/evidence/.',
|
|
218
|
+
),
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
const gitRoot = runGit(resolvedTarget, ['rev-parse', '--show-toplevel'])
|
|
222
|
+
const isGitRepo = gitRoot.status === 0
|
|
223
|
+
checks.push(
|
|
224
|
+
check(
|
|
225
|
+
'TPD07',
|
|
226
|
+
'target is inside a git repository',
|
|
227
|
+
isGitRepo ? 'passed' : 'warning',
|
|
228
|
+
isGitRepo ? slash(gitRoot.stdout) : gitRoot.stderr || 'not a git repository',
|
|
229
|
+
isGitRepo ? '' : 'Git tracking checks are unavailable outside a git repository.',
|
|
230
|
+
),
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
let trackedGse = []
|
|
234
|
+
if (isGitRepo) {
|
|
235
|
+
const tracked = runGit(resolvedTarget, ['ls-files', '.gse'])
|
|
236
|
+
trackedGse = tracked.status === 0 && tracked.stdout ? tracked.stdout.split(/\r?\n/).filter(Boolean) : []
|
|
237
|
+
checks.push(
|
|
238
|
+
check(
|
|
239
|
+
'TPD08',
|
|
240
|
+
'.gse files are tracked by git',
|
|
241
|
+
statusFrom(trackedGse.length > 0),
|
|
242
|
+
trackedGse.length > 0 ? `${trackedGse.length} tracked .gse file(s)` : 'no tracked .gse files',
|
|
243
|
+
trackedGse.length > 0 ? '' : 'Project-level .gse files should normally be committed; caches and host-local folders should not.',
|
|
244
|
+
),
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
const status = runGit(resolvedTarget, ['status', '--short', '.gse'])
|
|
248
|
+
checks.push(
|
|
249
|
+
check(
|
|
250
|
+
'TPD09',
|
|
251
|
+
'.gse worktree is clean',
|
|
252
|
+
status.status === 0 && status.stdout.length === 0 ? 'passed' : 'warning',
|
|
253
|
+
status.stdout || 'clean',
|
|
254
|
+
status.stdout ? 'Review and intentionally stage/commit or discard project-local GSE changes.' : '',
|
|
255
|
+
),
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
const sparse = runGit(resolvedTarget, ['sparse-checkout', 'list'])
|
|
259
|
+
const sparseLines = sparse.status === 0 && sparse.stdout ? sparse.stdout.split(/\r?\n/).map((line) => slash(line.trim())).filter(Boolean) : []
|
|
260
|
+
const sparseEnabled = sparse.status === 0 && sparseLines.length > 0
|
|
261
|
+
const sparseIncludesGse = sparseLines.some((line) => line === '.gse' || line === '.gse/' || line.startsWith('.gse/') || line === '/*' || line === '*')
|
|
262
|
+
checks.push(
|
|
263
|
+
check(
|
|
264
|
+
'TPD10',
|
|
265
|
+
'sparse-checkout visibility for .gse is known',
|
|
266
|
+
sparseEnabled && !sparseIncludesGse ? 'warning' : 'passed',
|
|
267
|
+
sparseEnabled ? `sparse entries: ${sparseLines.join(', ') || '<empty>'}; includes .gse: ${sparseIncludesGse}` : 'sparse-checkout not enabled or no sparse list',
|
|
268
|
+
sparseEnabled && !sparseIncludesGse ? 'Use git add --sparse for .gse updates or add .gse to sparse-checkout rules.' : '',
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const hostAdapterFindings = []
|
|
274
|
+
for (const [hostDir, adapterPaths] of [
|
|
275
|
+
['.codex', ['.codex/gse-command.md', '.codex/gse-adapter.md']],
|
|
276
|
+
['.claude', ['.claude/commands/gse.md', '.claude/gse-adapter.md']],
|
|
277
|
+
]) {
|
|
278
|
+
if (exists(resolvedTarget, hostDir)) {
|
|
279
|
+
const candidates = adapterPaths.map((adapterPath) => {
|
|
280
|
+
const text = readText(path.join(resolvedTarget, adapterPath))
|
|
281
|
+
return {
|
|
282
|
+
adapterPath,
|
|
283
|
+
exists: exists(resolvedTarget, adapterPath),
|
|
284
|
+
pointsToGse: text.includes('.gse/'),
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
const matching = candidates.find((item) => item.exists && item.pointsToGse)
|
|
288
|
+
hostAdapterFindings.push({
|
|
289
|
+
hostDir,
|
|
290
|
+
adapterPath: matching?.adapterPath ?? candidates[0].adapterPath,
|
|
291
|
+
exists: Boolean(matching),
|
|
292
|
+
pointsToGse: Boolean(matching),
|
|
293
|
+
candidates,
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const badAdapters = hostAdapterFindings.filter((item) => !item.exists || !item.pointsToGse)
|
|
298
|
+
checks.push(
|
|
299
|
+
check(
|
|
300
|
+
'TPD11',
|
|
301
|
+
'host adapters point back to .gse when host folders exist',
|
|
302
|
+
hostAdapterFindings.length === 0 ? 'passed' : statusFrom(badAdapters.length === 0),
|
|
303
|
+
hostAdapterFindings.length === 0 ? 'no Codex/Claude host folders detected' : hostAdapterFindings.map((item) => `${item.adapterPath}:exists=${item.exists},pointsToGse=${item.pointsToGse}`).join('; '),
|
|
304
|
+
badAdapters.length === 0 ? '' : 'Generate or repair thin host adapters; do not duplicate policy outside .gse/.',
|
|
305
|
+
),
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
const state = readJson(path.join(gseDir, 'state.json'))
|
|
309
|
+
const evidenceIndex = readJsonl(path.join(gseDir, 'evidence', 'index.jsonl'))
|
|
310
|
+
const stateHasCoreFields =
|
|
311
|
+
state.ok &&
|
|
312
|
+
state.data?.schemaVersion === 1 &&
|
|
313
|
+
typeof state.data?.mode === 'string' &&
|
|
314
|
+
typeof state.data?.phase === 'string' &&
|
|
315
|
+
typeof state.data?.currentSlice?.status === 'string' &&
|
|
316
|
+
state.data?.toolStatuses &&
|
|
317
|
+
typeof state.data.toolStatuses === 'object'
|
|
318
|
+
const evidenceIndexHasCoreFields =
|
|
319
|
+
evidenceIndex.ok &&
|
|
320
|
+
evidenceIndex.records.length > 0 &&
|
|
321
|
+
evidenceIndex.records.every(
|
|
322
|
+
(record) =>
|
|
323
|
+
typeof record.date === 'string' &&
|
|
324
|
+
typeof record.recordType === 'string' &&
|
|
325
|
+
typeof record.status === 'string' &&
|
|
326
|
+
typeof record.summary === 'string' &&
|
|
327
|
+
typeof record.evidenceFile === 'string' &&
|
|
328
|
+
Array.isArray(record.commands) &&
|
|
329
|
+
typeof record.nextAction === 'string',
|
|
330
|
+
)
|
|
331
|
+
const stateIndexOk = stateHasCoreFields && evidenceIndexHasCoreFields
|
|
332
|
+
const stateIndexWarn = !state.exists || !evidenceIndex.exists
|
|
333
|
+
checks.push(
|
|
334
|
+
check(
|
|
335
|
+
'TPD12',
|
|
336
|
+
'machine-readable state and evidence index are present',
|
|
337
|
+
statusFrom(stateIndexOk, stateIndexWarn),
|
|
338
|
+
`state.json:${state.exists ? state.ok ? 'valid' : 'invalid ' + state.error : 'missing'}; evidence/index.jsonl:${evidenceIndex.exists ? evidenceIndex.ok ? `${evidenceIndex.records.length} record(s)` : 'invalid ' + evidenceIndex.error : 'missing'}`,
|
|
339
|
+
stateIndexOk ? '' : 'Add or repair .gse/state.json and .gse/evidence/index.jsonl so future sessions can continue without parsing long Markdown.',
|
|
340
|
+
),
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
const failed = checks.filter((item) => item.status === 'failed').length
|
|
344
|
+
const warnings = checks.filter((item) => item.status === 'warning').length
|
|
345
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
346
|
+
return {
|
|
347
|
+
target: resolvedTarget,
|
|
348
|
+
generatedAt: new Date().toISOString(),
|
|
349
|
+
summary: {
|
|
350
|
+
status: failed > 0 ? 'failed' : warnings > 0 ? 'warning' : 'passed',
|
|
351
|
+
passed,
|
|
352
|
+
warnings,
|
|
353
|
+
failed,
|
|
354
|
+
total: checks.length,
|
|
355
|
+
},
|
|
356
|
+
workflows: {
|
|
357
|
+
targetProjectDoctor: failed > 0 ? 'not-ready' : warnings > 0 ? 'verified-with-warnings' : 'verified',
|
|
358
|
+
},
|
|
359
|
+
state: {
|
|
360
|
+
exists: state.exists,
|
|
361
|
+
valid: stateHasCoreFields,
|
|
362
|
+
phase: state.data?.phase ?? null,
|
|
363
|
+
currentSliceStatus: state.data?.currentSlice?.status ?? null,
|
|
364
|
+
lastEvidence: state.data?.lastEvidence ?? null,
|
|
365
|
+
},
|
|
366
|
+
evidenceIndex: {
|
|
367
|
+
exists: evidenceIndex.exists,
|
|
368
|
+
valid: evidenceIndexHasCoreFields,
|
|
369
|
+
records: evidenceIndex.records.length,
|
|
370
|
+
},
|
|
371
|
+
canonicalPlans,
|
|
372
|
+
git: {
|
|
373
|
+
isGitRepo,
|
|
374
|
+
root: isGitRepo ? gitRoot.stdout : null,
|
|
375
|
+
trackedGseCount: trackedGse.length,
|
|
376
|
+
},
|
|
377
|
+
checks,
|
|
378
|
+
limits: [
|
|
379
|
+
'Target project doctor is read-only.',
|
|
380
|
+
'It checks project-local GSE adoption, git/sparse visibility, canonical plan discoverability, quality gates, evidence, and thin host adapter drift.',
|
|
381
|
+
'It does not run project tests, browser smokes, CI, MCP, LSP, subagents, or release gates.',
|
|
382
|
+
],
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function createFixture() {
|
|
387
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-target-doctor-'))
|
|
388
|
+
fs.mkdirSync(path.join(dir, '.gse', 'goals'), { recursive: true })
|
|
389
|
+
fs.mkdirSync(path.join(dir, '.gse', 'templates'), { recursive: true })
|
|
390
|
+
fs.mkdirSync(path.join(dir, '.gse', 'evidence'), { recursive: true })
|
|
391
|
+
fs.mkdirSync(path.join(dir, '.gse', 'agents'), { recursive: true })
|
|
392
|
+
fs.mkdirSync(path.join(dir, '.gse', 'skills'), { recursive: true })
|
|
393
|
+
fs.mkdirSync(path.join(dir, '.gse', 'lsp'), { recursive: true })
|
|
394
|
+
fs.mkdirSync(path.join(dir, '.gse', 'hooks'), { recursive: true })
|
|
395
|
+
fs.mkdirSync(path.join(dir, '.gse', 'mcp'), { recursive: true })
|
|
396
|
+
fs.mkdirSync(path.join(dir, '.gse', 'plugins'), { recursive: true })
|
|
397
|
+
fs.mkdirSync(path.join(dir, 'docs'), { recursive: true })
|
|
398
|
+
|
|
399
|
+
const files = {
|
|
400
|
+
'.gse/README.md': '# GSE\n\nCanonical plan: `docs/productization-architecture.md`.\n',
|
|
401
|
+
'.gse/state.json': JSON.stringify({
|
|
402
|
+
schemaVersion: 1,
|
|
403
|
+
projectName: 'fixture',
|
|
404
|
+
mode: 'enterprise',
|
|
405
|
+
canonicalPlan: 'docs/productization-architecture.md',
|
|
406
|
+
phase: 'execute',
|
|
407
|
+
currentSlice: {
|
|
408
|
+
id: 'fixture-slice',
|
|
409
|
+
outcome: 'fixture outcome',
|
|
410
|
+
status: 'verified',
|
|
411
|
+
nextAction: 'continue',
|
|
412
|
+
},
|
|
413
|
+
toolStatuses: {
|
|
414
|
+
browser: 'unknown',
|
|
415
|
+
lsp: 'unknown',
|
|
416
|
+
mcp: 'unknown',
|
|
417
|
+
subagents: 'unknown',
|
|
418
|
+
ci: 'unknown',
|
|
419
|
+
},
|
|
420
|
+
lastEvidence: '.gse/evidence/index.jsonl',
|
|
421
|
+
residualRisks: [],
|
|
422
|
+
}, null, 2) + '\n',
|
|
423
|
+
'.gse/project-profile.md': '# Project Profile\n\nProduct/system name: fixture.\n',
|
|
424
|
+
'.gse/goal-map.md': '# Goal Map\n\nNext action: continue.\n',
|
|
425
|
+
'.gse/goals/README.md': '# Goal Details\n',
|
|
426
|
+
'.gse/quality-gates.md': '# Quality Gates\n\n## Universal\n\n## UI Gate\n',
|
|
427
|
+
'.gse/tooling.md': '# Tooling\n',
|
|
428
|
+
'.gse/templates/change-brief.md': '# Change Brief\n',
|
|
429
|
+
'.gse/templates/evidence.md': '# Evidence\n',
|
|
430
|
+
'.gse/evidence/2026-07-06.md': '# Evidence\n',
|
|
431
|
+
'.gse/evidence/index.jsonl': JSON.stringify({
|
|
432
|
+
date: '2026-07-06',
|
|
433
|
+
recordType: 'audit',
|
|
434
|
+
status: 'verified',
|
|
435
|
+
summary: 'Fixture target doctor evidence.',
|
|
436
|
+
evidenceFile: '.gse/evidence/2026-07-06.md',
|
|
437
|
+
commands: ['node scripts/audit-target-project.mjs --self-test'],
|
|
438
|
+
nextAction: 'continue',
|
|
439
|
+
}) + '\n',
|
|
440
|
+
'.gse/agent-workspace.md': '# Agent Workspace\n',
|
|
441
|
+
'.gse/agents/roles.md': '# Roles\n',
|
|
442
|
+
'.gse/agents/dispatch.md': '# Dispatch\n',
|
|
443
|
+
'.gse/skills/README.md': '# Skills\n',
|
|
444
|
+
'.gse/lsp/README.md': '# LSP\n',
|
|
445
|
+
'.gse/hooks/README.md': '# Hooks\n',
|
|
446
|
+
'.gse/mcp/README.md': '# MCP\n',
|
|
447
|
+
'.gse/plugins/README.md': '# Plugins\n',
|
|
448
|
+
'.gse/release.md': '# Release\n',
|
|
449
|
+
'.gse/incident-review.md': '# Incident\n',
|
|
450
|
+
'.gse/audit.md': '# Audit\n',
|
|
451
|
+
'docs/productization-architecture.md': '# Productization Architecture\n',
|
|
452
|
+
}
|
|
453
|
+
for (const [relativePath, content] of Object.entries(files)) {
|
|
454
|
+
const fullPath = path.join(dir, relativePath)
|
|
455
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true })
|
|
456
|
+
fs.writeFileSync(fullPath, content, 'utf8')
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
runGit(dir, ['init'])
|
|
460
|
+
runGit(dir, ['config', 'user.email', 'gse-fixture@example.local'])
|
|
461
|
+
runGit(dir, ['config', 'user.name', 'GSE Fixture'])
|
|
462
|
+
runGit(dir, ['add', '.'])
|
|
463
|
+
runGit(dir, ['commit', '-m', 'fixture'])
|
|
464
|
+
return dir
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function renderMarkdown(report) {
|
|
468
|
+
const lines = []
|
|
469
|
+
lines.push('# GSE Target Project Doctor')
|
|
470
|
+
lines.push('')
|
|
471
|
+
lines.push('Generated: ' + report.generatedAt)
|
|
472
|
+
lines.push('Target: ' + report.target)
|
|
473
|
+
lines.push('')
|
|
474
|
+
lines.push('## Summary')
|
|
475
|
+
lines.push('')
|
|
476
|
+
lines.push('- Status: ' + report.summary.status)
|
|
477
|
+
lines.push('- Checks: ' + report.summary.passed + ' passed, ' + report.summary.warnings + ' warnings, ' + report.summary.failed + ' failed, ' + report.summary.total + ' total')
|
|
478
|
+
lines.push('- Workflow: ' + report.workflows.targetProjectDoctor)
|
|
479
|
+
lines.push('')
|
|
480
|
+
lines.push('## Checks')
|
|
481
|
+
lines.push('')
|
|
482
|
+
for (const item of report.checks) {
|
|
483
|
+
const marker = item.status === 'passed' ? '[x]' : item.status === 'warning' ? '[!]' : '[ ]'
|
|
484
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
485
|
+
if (item.recommendation) lines.push(' - Recommendation: ' + item.recommendation)
|
|
486
|
+
}
|
|
487
|
+
lines.push('')
|
|
488
|
+
lines.push('## Limits')
|
|
489
|
+
lines.push('')
|
|
490
|
+
for (const item of report.limits) lines.push('- ' + item)
|
|
491
|
+
return lines.join('\n') + '\n'
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
let report
|
|
495
|
+
let fixtureDir = null
|
|
496
|
+
if (selfTest) {
|
|
497
|
+
fixtureDir = createFixture()
|
|
498
|
+
report = auditTarget(fixtureDir)
|
|
499
|
+
report.selfTest = { fixtureDir }
|
|
500
|
+
} else {
|
|
501
|
+
report = auditTarget(targetArg)
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
505
|
+
else console.log(renderMarkdown(report))
|
|
506
|
+
|
|
507
|
+
if (report.summary.failed > 0) process.exit(1)
|
|
@@ -0,0 +1,136 @@
|
|
|
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/update-release-acceptance-record.md')
|
|
30
|
+
const release = read('references/release.md')
|
|
31
|
+
const packaging = read('references/packaging.md')
|
|
32
|
+
const evidenceTaxonomy = read('references/evidence-taxonomy.md')
|
|
33
|
+
const validate = read('scripts/validate-gse.mjs')
|
|
34
|
+
|
|
35
|
+
const requiredFields = [
|
|
36
|
+
'Record type:',
|
|
37
|
+
'Project path:',
|
|
38
|
+
'Goal or slice:',
|
|
39
|
+
'Release label or change id:',
|
|
40
|
+
'Evidence status:',
|
|
41
|
+
'Local decisions preserved:',
|
|
42
|
+
'Files changed:',
|
|
43
|
+
'Files intentionally not changed:',
|
|
44
|
+
'Commands run:',
|
|
45
|
+
'Focused verification:',
|
|
46
|
+
'Compatibility evidence:',
|
|
47
|
+
'Migration notes:',
|
|
48
|
+
'Rollback notes:',
|
|
49
|
+
'Owner or acceptance gate:',
|
|
50
|
+
'Accepted by:',
|
|
51
|
+
'Residual risks:',
|
|
52
|
+
'Next action:',
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
const statusTerms = ['result', 'verified', 'accepted', 'not ready']
|
|
56
|
+
const antiOverclaimTerms = [
|
|
57
|
+
'Do not mark `accepted` only because `validate-gse.mjs`, tests, lint, or a local smoke passed.',
|
|
58
|
+
'release publication',
|
|
59
|
+
'package install',
|
|
60
|
+
'production rollout',
|
|
61
|
+
'host runtime support',
|
|
62
|
+
'registry access',
|
|
63
|
+
'subagent support',
|
|
64
|
+
'MCP support',
|
|
65
|
+
'browser support',
|
|
66
|
+
'owner approval',
|
|
67
|
+
'Accepted by: not accepted',
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
const referenceTerms = [
|
|
71
|
+
'assets/templates/update-release-acceptance-record.md',
|
|
72
|
+
'local decisions',
|
|
73
|
+
'changed files',
|
|
74
|
+
'rollback notes',
|
|
75
|
+
'owner gate',
|
|
76
|
+
'accepted-by status',
|
|
77
|
+
'residual risk',
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
const checks = [
|
|
81
|
+
check('URA01', 'update/release acceptance record template exists', exists('assets/templates/update-release-acceptance-record.md'), 'assets/templates/update-release-acceptance-record.md'),
|
|
82
|
+
check('URA02', 'template captures required project-local fields', requiredFields.every((item) => template.includes(item)), requiredFields.join(', ')),
|
|
83
|
+
check('URA03', 'template separates result, verified, accepted, and not ready', statusTerms.every((item) => template.includes(item)), statusTerms.join(', ')),
|
|
84
|
+
check('URA04', 'template prevents local smoke from becoming fake acceptance', antiOverclaimTerms.every((item) => template.includes(item)), 'anti-overclaim rules'),
|
|
85
|
+
check('URA05', 'template records rollback and residual risk explicitly', template.includes('Rollback notes:') && template.includes('Residual risks:') && template.includes('If rollback is unknown, say `unknown`'), 'rollback and residual risk fields'),
|
|
86
|
+
check('URA06', 'release reference routes to acceptance record template', referenceTerms.every((item) => release.includes(item)), 'references/release.md'),
|
|
87
|
+
check('URA07', 'packaging reference routes project-local updates to acceptance record', packaging.includes('assets/templates/update-release-acceptance-record.md') && packaging.includes('accepted-by status') && packaging.includes('residual risks'), 'references/packaging.md'),
|
|
88
|
+
check('URA08', 'evidence taxonomy routes update/release work to acceptance record', evidenceTaxonomy.includes('assets/templates/update-release-acceptance-record.md') && evidenceTaxonomy.includes('rollback notes') && evidenceTaxonomy.includes('accepted-by status'), 'references/evidence-taxonomy.md'),
|
|
89
|
+
check('URA09', 'consolidated validator includes this audit', validate.includes('audit-update-release-acceptance.mjs'), 'scripts/validate-gse.mjs'),
|
|
90
|
+
check('URA10', 'template examples show verified without fake acceptance', template.includes('Evidence status: verified') && template.includes('Accepted by: policy: Lite focused smoke policy') && template.includes('Accepted by: not accepted'), 'minimal examples'),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
94
|
+
const failed = checks.length - passed
|
|
95
|
+
const report = {
|
|
96
|
+
root,
|
|
97
|
+
generatedAt: new Date().toISOString(),
|
|
98
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
99
|
+
workflows: { updateReleaseAcceptance: failed === 0 ? 'verified' : 'failed' },
|
|
100
|
+
limits: [
|
|
101
|
+
'This audit verifies the reusable update/release acceptance record and routing only.',
|
|
102
|
+
'It does not publish a release, run project-specific commands, approve owner acceptance, or certify arbitrary repositories.',
|
|
103
|
+
],
|
|
104
|
+
checks,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function renderMarkdown(data) {
|
|
108
|
+
const lines = []
|
|
109
|
+
lines.push('# GSE Update/Release Acceptance Audit')
|
|
110
|
+
lines.push('')
|
|
111
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
112
|
+
lines.push('Root: ' + data.root)
|
|
113
|
+
lines.push('')
|
|
114
|
+
lines.push('## Summary')
|
|
115
|
+
lines.push('')
|
|
116
|
+
lines.push('- Status: ' + data.summary.status)
|
|
117
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
118
|
+
lines.push('- Update/release acceptance: ' + data.workflows.updateReleaseAcceptance)
|
|
119
|
+
lines.push('')
|
|
120
|
+
lines.push('## Checks')
|
|
121
|
+
lines.push('')
|
|
122
|
+
for (const item of data.checks) {
|
|
123
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
124
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
125
|
+
}
|
|
126
|
+
lines.push('')
|
|
127
|
+
lines.push('## Limits')
|
|
128
|
+
lines.push('')
|
|
129
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
130
|
+
return lines.join('\n') + '\n'
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
134
|
+
else console.log(renderMarkdown(report))
|
|
135
|
+
|
|
136
|
+
if (failed > 0) process.exit(1)
|