@t275005746/gse 0.1.1 → 0.2.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/.gse/releases/public-github-release-v0.1.2.md +49 -0
- package/.gse/releases/public-registry-publication-npm.md +49 -49
- package/.gse/state.json +148 -26
- package/CHANGELOG.md +52 -8
- package/README.md +13 -6
- package/README.zh-CN.md +13 -6
- package/SKILL.md +32 -12
- package/assets/templates/dispatch-packet.md +22 -14
- package/assets/templates/evidence.md +11 -5
- package/assets/templates/role-fallback-packet.md +49 -0
- package/package.json +18 -10
- package/references/agent-roles.md +41 -20
- package/references/commands.md +75 -45
- package/references/drift-audit.md +2 -1
- package/references/evidence-taxonomy.md +46 -9
- package/references/file-ownership.md +17 -13
- package/references/final-form-roadmap.md +203 -0
- package/references/final-readiness.md +3 -3
- package/references/host-adapters.md +38 -10
- package/references/learning-system.md +24 -8
- package/references/maintenance-cadence.md +51 -0
- package/references/project-guards.md +52 -0
- package/references/quality-gates.md +18 -11
- package/references/role-dispatch-fallback.md +54 -0
- package/references/tool-adapters.md +13 -3
- package/scripts/audit-close-gate-hardening.mjs +188 -0
- package/scripts/audit-close-gate.mjs +219 -33
- package/scripts/audit-command-execution.mjs +30 -17
- package/scripts/audit-commands.mjs +7 -5
- package/scripts/audit-completion-plan-drill.mjs +271 -0
- package/scripts/audit-completion-readiness.mjs +9 -6
- package/scripts/audit-continue-preflight.mjs +318 -0
- package/scripts/audit-evidence-levels.mjs +217 -0
- package/scripts/audit-evidence-review-queue.mjs +206 -0
- package/scripts/audit-final-acceptance-packet.mjs +9 -9
- package/scripts/audit-final-form-progress-report.mjs +19 -18
- package/scripts/audit-final-form-roadmap.mjs +157 -0
- package/scripts/audit-final-form-stale-copy.mjs +2 -2
- package/scripts/audit-final-readiness.mjs +3 -3
- package/scripts/audit-fresh-session-readiness.mjs +1 -1
- package/scripts/audit-host-capabilities.mjs +237 -0
- package/scripts/audit-installed-sync.mjs +203 -0
- package/scripts/audit-learning-drift.mjs +292 -0
- package/scripts/audit-learning-promotion.mjs +351 -0
- package/scripts/audit-learning-system.mjs +24 -14
- package/scripts/audit-local-final-form-completion.mjs +11 -10
- package/scripts/audit-maintenance-cadence.mjs +139 -0
- package/scripts/audit-maintenance-snapshot.mjs +181 -0
- package/scripts/audit-npm-package-metadata.mjs +8 -2
- package/scripts/audit-npm-publish-dry-run.mjs +10 -4
- package/scripts/audit-npm-tarball-install.mjs +9 -3
- package/scripts/audit-owner-external-gate-kit.mjs +12 -11
- package/scripts/audit-project-guards.mjs +189 -0
- package/scripts/audit-project.mjs +14 -11
- package/scripts/audit-public-acceptance-handoff.mjs +10 -10
- package/scripts/audit-public-acceptance-readiness.mjs +6 -6
- package/scripts/audit-public-release-checklist.mjs +17 -15
- package/scripts/audit-release-bundle.mjs +13 -11
- package/scripts/audit-release-owner-action-plan-drill.mjs +5 -4
- package/scripts/audit-release-owner-action-plan.mjs +10 -10
- package/scripts/audit-release-status-manifest.mjs +4 -4
- package/scripts/audit-roadmap-consistency.mjs +11 -7
- package/scripts/audit-role-dispatch-fallback.mjs +212 -0
- package/scripts/audit-session-sync.mjs +127 -0
- package/scripts/audit-state-freshness.mjs +6 -5
- package/scripts/audit-state-repair.mjs +360 -0
- package/scripts/audit-target-hardening-drills.mjs +518 -0
- package/scripts/audit-tool-fallback-policy.mjs +180 -0
- package/scripts/audit-ui-browser-evidence-policy.mjs +191 -0
- package/scripts/audit-validation-profiles.mjs +6 -4
- package/scripts/backfill-evidence-levels.mjs +98 -0
- package/scripts/check-encoding.mjs +72 -0
- package/scripts/generate-continue-packet.mjs +1487 -0
- package/scripts/generate-final-acceptance-packet.mjs +23 -8
- package/scripts/generate-final-form-progress-report.mjs +25 -23
- package/scripts/generate-host-runtime-evidence-handoff.mjs +23 -16
- package/scripts/generate-maintenance-snapshot.mjs +216 -0
- package/scripts/generate-public-acceptance-handoff.mjs +26 -14
- package/scripts/generate-release-owner-action-plan.mjs +4 -3
- package/scripts/generate-release-status-manifest.mjs +4 -3
- package/scripts/init-project.mjs +144 -63
- package/scripts/record-learning.mjs +37 -8
- package/scripts/record-session-sync.mjs +87 -0
- package/scripts/run-gse-command.mjs +79 -47
- package/scripts/run-validation-profile.mjs +24 -5
- package/scripts/validate-gse.mjs +262 -9
|
@@ -0,0 +1,351 @@
|
|
|
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 { fileURLToPath } from 'node:url'
|
|
6
|
+
import { spawnSync } from 'node:child_process'
|
|
7
|
+
|
|
8
|
+
const args = process.argv.slice(2)
|
|
9
|
+
|
|
10
|
+
function readArg(name, fallback = null) {
|
|
11
|
+
const index = args.indexOf(name)
|
|
12
|
+
if (index === -1) return fallback
|
|
13
|
+
return args[index + 1] ?? fallback
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
17
|
+
const targetArg = readArg('--target')
|
|
18
|
+
const jsonOnly = args.includes('--json')
|
|
19
|
+
const write = args.includes('--write') || args.includes('--execute')
|
|
20
|
+
|
|
21
|
+
function readText(filePath) {
|
|
22
|
+
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '') : ''
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function clean(value) {
|
|
26
|
+
return String(value ?? '').replace(/\s+/g, ' ').trim()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function normalize(value) {
|
|
30
|
+
return clean(value)
|
|
31
|
+
.toLowerCase()
|
|
32
|
+
.replace(/[`"'“”‘’]/g, '')
|
|
33
|
+
.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, ' ')
|
|
34
|
+
.replace(/\s+/g, ' ')
|
|
35
|
+
.trim()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function slugify(value) {
|
|
39
|
+
return normalize(value)
|
|
40
|
+
.replace(/[^\w\u4e00-\u9fa5]+/g, '-')
|
|
41
|
+
.replace(/^-+|-+$/g, '')
|
|
42
|
+
.slice(0, 48) || 'learning'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
46
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const CATEGORY_RULES = [
|
|
50
|
+
{ category: 'encoding', severity: 'high', patterns: [/utf-?8/i, /encoding/i, /mojibake/i, /乱码/, /中文/] },
|
|
51
|
+
{ category: 'shell', severity: 'high', patterns: [/powershell/i, /\bcmd\b/i, /&&/, /shell/i, /windows/i] },
|
|
52
|
+
{ category: 'git', severity: 'high', patterns: [/git/i, /sparse/i, /stage/i, /commit/i, /checkout/i] },
|
|
53
|
+
{ category: 'host-tool', severity: 'high', patterns: [/subagent/i, /dispatch/i, /mcp/i, /lsp/i, /native slash/i, /host/i] },
|
|
54
|
+
{ category: 'evidence', severity: 'high', patterns: [/evidence/i, /jsonl/i, /verified/i, /accepted/i, /close gate/i] },
|
|
55
|
+
{ category: 'browser', severity: 'medium', patterns: [/browser/i, /playwright/i, /screenshot/i, /ui\b/i, /component test/i] },
|
|
56
|
+
{ category: 'project-rule', severity: 'medium', patterns: [/project/i, /canonical/i, /goal map/i, /AGENTS\.md/i, /规则/] },
|
|
57
|
+
{ category: 'release', severity: 'medium', patterns: [/release/i, /registry/i, /marketplace/i, /npm/i, /ci\b/i, /security contact/i] },
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
function classify(summary, trigger = '', impact = '') {
|
|
61
|
+
const text = [summary, trigger, impact].join(' ')
|
|
62
|
+
for (const rule of CATEGORY_RULES) {
|
|
63
|
+
if (rule.patterns.some((pattern) => pattern.test(text))) {
|
|
64
|
+
return { category: rule.category, severity: rule.severity }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { category: 'project-rule', severity: 'low' }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function promotionFor(count, severity) {
|
|
71
|
+
if (count >= 5) return { level: 'script-or-skill-update', target: severity === 'high' ? 'script/test plus project guard' : 'template or skill update' }
|
|
72
|
+
if (count >= 3) return { level: 'guard-or-quality-gate', target: severity === 'high' ? 'project guard or quality gate' : 'project guard candidate' }
|
|
73
|
+
if (count >= 2) return { level: 'checklist-or-template', target: 'checklist or template update' }
|
|
74
|
+
return { level: 'learning-note', target: 'keep as learning note' }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parseLearningEntries(text) {
|
|
78
|
+
const entries = []
|
|
79
|
+
let current = null
|
|
80
|
+
for (const line of text.split(/\r?\n/)) {
|
|
81
|
+
const heading = line.match(/^##\s+(.+)$/)
|
|
82
|
+
if (heading) {
|
|
83
|
+
if (current) entries.push(current)
|
|
84
|
+
current = { heading: heading[1], trigger: '', summary: '', source: '', impact: '', promotion: '', status: '', occurrences: 1 }
|
|
85
|
+
continue
|
|
86
|
+
}
|
|
87
|
+
if (!current) continue
|
|
88
|
+
const field = line.match(/^-\s*([^:]+):\s*(.*)$/)
|
|
89
|
+
if (!field) continue
|
|
90
|
+
const key = normalize(field[1])
|
|
91
|
+
const value = clean(field[2])
|
|
92
|
+
if (key === 'trigger') current.trigger = value
|
|
93
|
+
if (key === 'summary') current.summary = value
|
|
94
|
+
if (key === 'source') current.source = value
|
|
95
|
+
if (key === 'impact') current.impact = value
|
|
96
|
+
if (key === 'promotion') current.promotion = value
|
|
97
|
+
if (key === 'status') current.status = value
|
|
98
|
+
if (key === 'occurrences') current.occurrences = Math.max(1, Number(value) || 1)
|
|
99
|
+
}
|
|
100
|
+
if (current) entries.push(current)
|
|
101
|
+
return entries.filter((entry) => entry.summary)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function groupEntries(entries) {
|
|
105
|
+
const groups = new Map()
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
const key = normalize(entry.summary)
|
|
108
|
+
const existing = groups.get(key) ?? {
|
|
109
|
+
key,
|
|
110
|
+
summary: entry.summary,
|
|
111
|
+
triggerExamples: [],
|
|
112
|
+
sourceExamples: [],
|
|
113
|
+
impactExamples: [],
|
|
114
|
+
entries: [],
|
|
115
|
+
}
|
|
116
|
+
existing.entries.push(entry)
|
|
117
|
+
existing.count = (existing.count ?? 0) + (entry.occurrences ?? 1)
|
|
118
|
+
if (entry.trigger && !existing.triggerExamples.includes(entry.trigger)) existing.triggerExamples.push(entry.trigger)
|
|
119
|
+
if (entry.source && !existing.sourceExamples.includes(entry.source)) existing.sourceExamples.push(entry.source)
|
|
120
|
+
if (entry.impact && !existing.impactExamples.includes(entry.impact)) existing.impactExamples.push(entry.impact)
|
|
121
|
+
groups.set(key, existing)
|
|
122
|
+
}
|
|
123
|
+
return [...groups.values()]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function renderPromotionsMarkdown(report) {
|
|
127
|
+
const lines = []
|
|
128
|
+
lines.push('# Learning Promotions')
|
|
129
|
+
lines.push('')
|
|
130
|
+
lines.push('Generated: ' + report.generatedAt)
|
|
131
|
+
lines.push('Source: `.gse/learnings.md`')
|
|
132
|
+
lines.push('')
|
|
133
|
+
lines.push('This file is generated by `scripts/audit-learning-promotion.mjs --write`.')
|
|
134
|
+
lines.push('Review candidates before copying any rule into `.gse/project-guards.md`, `.gse/quality-gates.md`, templates, scripts, or the GSE skill.')
|
|
135
|
+
lines.push('')
|
|
136
|
+
lines.push('| ID | Category | Severity | Count | Promotion | Target | Summary |')
|
|
137
|
+
lines.push('|---|---|---|---:|---|---|---|')
|
|
138
|
+
for (const item of report.promotions) {
|
|
139
|
+
lines.push(`| ${item.id} | ${item.category} | ${item.severity} | ${item.count} | ${item.promotionLevel} | ${item.promotionTarget} | ${item.summary.replace(/\|/g, '/')} |`)
|
|
140
|
+
}
|
|
141
|
+
if (report.promotions.length === 0) lines.push('| none | - | - | 0 | learning-note | keep recording | No repeated lesson has reached promotion threshold yet. |')
|
|
142
|
+
lines.push('')
|
|
143
|
+
lines.push('## Guard Candidates')
|
|
144
|
+
lines.push('')
|
|
145
|
+
for (const item of report.promotions.filter((candidate) => ['guard-or-quality-gate', 'script-or-skill-update'].includes(candidate.promotionLevel))) {
|
|
146
|
+
lines.push(`### ${item.id}`)
|
|
147
|
+
lines.push('')
|
|
148
|
+
lines.push('- Guard: ' + item.summary)
|
|
149
|
+
lines.push('- Severity: ' + item.severity)
|
|
150
|
+
lines.push('- Trigger: ' + item.category)
|
|
151
|
+
lines.push('- Check: Confirm this lesson is handled before implementation or close.')
|
|
152
|
+
lines.push('- Source count: ' + item.count)
|
|
153
|
+
lines.push('')
|
|
154
|
+
}
|
|
155
|
+
return lines.join('\n') + '\n'
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function analyzeLearningPromotions(target) {
|
|
159
|
+
const resolvedTarget = path.resolve(target)
|
|
160
|
+
const learningsPath = path.join(resolvedTarget, '.gse', 'learnings.md')
|
|
161
|
+
const exists = fs.existsSync(learningsPath)
|
|
162
|
+
const text = exists ? readText(learningsPath) : ''
|
|
163
|
+
const entries = parseLearningEntries(text)
|
|
164
|
+
const groups = groupEntries(entries)
|
|
165
|
+
const promotions = groups.map((group) => {
|
|
166
|
+
const classification = classify(group.summary, group.triggerExamples.join(' '), group.impactExamples.join(' '))
|
|
167
|
+
const count = group.count || group.entries.length
|
|
168
|
+
const promotion = promotionFor(count, classification.severity)
|
|
169
|
+
return {
|
|
170
|
+
id: 'LP-' + slugify(group.summary).toUpperCase(),
|
|
171
|
+
summary: group.summary,
|
|
172
|
+
category: classification.category,
|
|
173
|
+
severity: classification.severity,
|
|
174
|
+
count,
|
|
175
|
+
promotionLevel: promotion.level,
|
|
176
|
+
promotionTarget: promotion.target,
|
|
177
|
+
triggerExamples: group.triggerExamples.slice(0, 3),
|
|
178
|
+
sourceExamples: group.sourceExamples.slice(0, 3),
|
|
179
|
+
impactExamples: group.impactExamples.slice(0, 3),
|
|
180
|
+
}
|
|
181
|
+
}).sort((a, b) => {
|
|
182
|
+
const levelOrder = { 'script-or-skill-update': 0, 'guard-or-quality-gate': 1, 'checklist-or-template': 2, 'learning-note': 3 }
|
|
183
|
+
return (levelOrder[a.promotionLevel] ?? 9) - (levelOrder[b.promotionLevel] ?? 9) || b.count - a.count || a.id.localeCompare(b.id)
|
|
184
|
+
})
|
|
185
|
+
const promoted = promotions.filter((item) => item.promotionLevel !== 'learning-note')
|
|
186
|
+
const guardCandidates = promotions.filter((item) => ['guard-or-quality-gate', 'script-or-skill-update'].includes(item.promotionLevel))
|
|
187
|
+
const scriptCandidates = promotions.filter((item) => item.promotionLevel === 'script-or-skill-update')
|
|
188
|
+
const outputPath = path.join(resolvedTarget, '.gse', 'learning-promotions.md')
|
|
189
|
+
return {
|
|
190
|
+
target: resolvedTarget,
|
|
191
|
+
generatedAt: new Date().toISOString(),
|
|
192
|
+
path: '.gse/learning-promotions.md',
|
|
193
|
+
source: '.gse/learnings.md',
|
|
194
|
+
exists,
|
|
195
|
+
summary: {
|
|
196
|
+
status: !exists ? 'warning' : 'passed',
|
|
197
|
+
entries: entries.length,
|
|
198
|
+
uniqueLessons: groups.length,
|
|
199
|
+
duplicateGroups: groups.filter((group) => group.entries.length > 1).length,
|
|
200
|
+
promoted: promoted.length,
|
|
201
|
+
guardCandidates: guardCandidates.length,
|
|
202
|
+
scriptCandidates: scriptCandidates.length,
|
|
203
|
+
},
|
|
204
|
+
promotions,
|
|
205
|
+
outputPath,
|
|
206
|
+
limits: [
|
|
207
|
+
'Promotion analysis is deterministic and project-generic; it does not hardcode AION or MuseFlow behavior.',
|
|
208
|
+
'Write mode creates .gse/learning-promotions.md candidates only; project guards and scripts still require deliberate review.',
|
|
209
|
+
'Missing learnings are a warning, not a hard failure, because new projects may not have lessons yet.',
|
|
210
|
+
],
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function run(script, commandArgs) {
|
|
215
|
+
const result = spawnSync(process.execPath, [path.join(root, 'scripts', script), ...commandArgs], {
|
|
216
|
+
cwd: root,
|
|
217
|
+
encoding: 'utf8',
|
|
218
|
+
windowsHide: true,
|
|
219
|
+
})
|
|
220
|
+
return {
|
|
221
|
+
command: [process.execPath, path.join(root, 'scripts', script), ...commandArgs].join(' '),
|
|
222
|
+
status: result.status ?? 1,
|
|
223
|
+
stdout: (result.stdout ?? '').trim(),
|
|
224
|
+
stderr: (result.stderr ?? '').trim(),
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function createFixture() {
|
|
229
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-learning-promotion-'))
|
|
230
|
+
const init = run('init-project.mjs', ['--target', dir, '--mode', 'standard', '--json'])
|
|
231
|
+
const learningsPath = path.join(dir, '.gse', 'learnings.md')
|
|
232
|
+
const entry = (date, summary, trigger, source) => [
|
|
233
|
+
`## ${date} - ${slugify(summary)}`,
|
|
234
|
+
'',
|
|
235
|
+
'- Trigger: ' + trigger,
|
|
236
|
+
'- Summary: ' + summary,
|
|
237
|
+
'- Source: ' + source,
|
|
238
|
+
'- Impact: prevents recurring workflow failure',
|
|
239
|
+
'- Promotion: learning promotion audit fixture',
|
|
240
|
+
'- Status: learning-note',
|
|
241
|
+
'',
|
|
242
|
+
].join('\n')
|
|
243
|
+
const text = [
|
|
244
|
+
'# Learnings',
|
|
245
|
+
'',
|
|
246
|
+
entry('2026-07-08', 'Use UTF-8 safe readers before judging Chinese document mojibake', 'encoding review', 'fixture'),
|
|
247
|
+
entry('2026-07-08', 'Use UTF-8 safe readers before judging Chinese document mojibake', 'encoding review repeat', 'fixture'),
|
|
248
|
+
entry('2026-07-08', 'Use UTF-8 safe readers before judging Chinese document mojibake', 'encoding review third', 'fixture'),
|
|
249
|
+
entry('2026-07-08', 'Do not claim real subagent dispatch without host evidence', 'subagent review', 'fixture'),
|
|
250
|
+
entry('2026-07-08', 'Do not claim real subagent dispatch without host evidence', 'subagent review repeat', 'fixture'),
|
|
251
|
+
entry('2026-07-08', 'Avoid PowerShell && and use host-appropriate shell syntax on Windows', 'shell failure', 'fixture'),
|
|
252
|
+
entry('2026-07-08', 'Avoid PowerShell && and use host-appropriate shell syntax on Windows', 'shell failure repeat', 'fixture'),
|
|
253
|
+
entry('2026-07-08', 'Avoid PowerShell && and use host-appropriate shell syntax on Windows', 'shell failure third', 'fixture'),
|
|
254
|
+
entry('2026-07-08', 'Avoid PowerShell && and use host-appropriate shell syntax on Windows', 'shell failure fourth', 'fixture'),
|
|
255
|
+
entry('2026-07-08', 'Avoid PowerShell && and use host-appropriate shell syntax on Windows', 'shell failure fifth', 'fixture'),
|
|
256
|
+
].join('\n')
|
|
257
|
+
fs.writeFileSync(learningsPath, text, 'utf8')
|
|
258
|
+
return { dir, init }
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function audit(target) {
|
|
262
|
+
const analysis = analyzeLearningPromotions(target)
|
|
263
|
+
const checks = [
|
|
264
|
+
check('LP01', 'learning promotion source is present or reported as warning', analysis.exists || analysis.summary.status === 'warning', analysis.exists ? analysis.source : 'missing learnings warning'),
|
|
265
|
+
check('LP02', 'learning entries parse into normalized groups', !analysis.exists || analysis.summary.uniqueLessons > 0, `${analysis.summary.uniqueLessons} unique lesson(s)`),
|
|
266
|
+
check('LP03', 'promotion thresholds follow documented upgrade rule', analysis.promotions.every((item) =>
|
|
267
|
+
(item.count >= 5 && item.promotionLevel === 'script-or-skill-update') ||
|
|
268
|
+
(item.count >= 3 && item.count < 5 && item.promotionLevel === 'guard-or-quality-gate') ||
|
|
269
|
+
(item.count >= 2 && item.count < 3 && item.promotionLevel === 'checklist-or-template') ||
|
|
270
|
+
(item.count < 2 && item.promotionLevel === 'learning-note')
|
|
271
|
+
), 'note -> checklist/template -> guard/quality gate -> script/skill'),
|
|
272
|
+
check('LP04', 'promotion candidates include category and severity', analysis.promotions.every((item) => item.category && item.severity), 'category/severity assigned'),
|
|
273
|
+
check('LP05', 'write mode is candidate-only', true, 'write mode creates .gse/learning-promotions.md, not project guard mutations'),
|
|
274
|
+
]
|
|
275
|
+
let writeStatus = null
|
|
276
|
+
if (write) {
|
|
277
|
+
fs.mkdirSync(path.dirname(analysis.outputPath), { recursive: true })
|
|
278
|
+
fs.writeFileSync(analysis.outputPath, renderPromotionsMarkdown(analysis), 'utf8')
|
|
279
|
+
writeStatus = {
|
|
280
|
+
status: 'written',
|
|
281
|
+
path: analysis.path,
|
|
282
|
+
effect: 'candidate-only learning promotion report',
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
286
|
+
const failed = checks.length - passed
|
|
287
|
+
return {
|
|
288
|
+
...analysis,
|
|
289
|
+
summary: {
|
|
290
|
+
...analysis.summary,
|
|
291
|
+
status: failed === 0 ? analysis.summary.status : 'failed',
|
|
292
|
+
passed,
|
|
293
|
+
failed,
|
|
294
|
+
total: checks.length,
|
|
295
|
+
},
|
|
296
|
+
workflows: {
|
|
297
|
+
learningPromotion: failed === 0 ? 'verified' : 'failed',
|
|
298
|
+
candidateWrite: write ? 'verified' : 'dry-run',
|
|
299
|
+
},
|
|
300
|
+
write: writeStatus,
|
|
301
|
+
checks,
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function selfTestReport() {
|
|
306
|
+
const fixture = createFixture()
|
|
307
|
+
const fixtureReport = audit(fixture.dir)
|
|
308
|
+
const missingDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-learning-promotion-missing-'))
|
|
309
|
+
fs.mkdirSync(path.join(missingDir, '.gse'), { recursive: true })
|
|
310
|
+
const missingReport = analyzeLearningPromotions(missingDir)
|
|
311
|
+
fs.rmSync(fixture.dir, { recursive: true, force: true })
|
|
312
|
+
fs.rmSync(missingDir, { recursive: true, force: true })
|
|
313
|
+
const checks = [
|
|
314
|
+
check('LPA01', 'init-project supports learning store', fixture.init.status === 0, 'scripts/init-project.mjs'),
|
|
315
|
+
check('LPA02', 'repeated encoding lesson becomes guard candidate', fixtureReport.promotions.some((item) => item.category === 'encoding' && item.count === 3 && item.promotionLevel === 'guard-or-quality-gate'), 'encoding fixture'),
|
|
316
|
+
check('LPA03', 'fifth shell occurrence becomes script or skill candidate', fixtureReport.promotions.some((item) => item.category === 'shell' && item.count === 5 && item.promotionLevel === 'script-or-skill-update'), 'shell fixture'),
|
|
317
|
+
check('LPA04', 'second host-tool lesson becomes checklist/template candidate', fixtureReport.promotions.some((item) => item.category === 'host-tool' && item.count === 2 && item.promotionLevel === 'checklist-or-template'), 'host-tool fixture'),
|
|
318
|
+
check('LPA05', 'missing learnings is warning not hard failure', missingReport.summary.status === 'warning', 'missing learning store'),
|
|
319
|
+
]
|
|
320
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
321
|
+
const failed = checks.length - passed
|
|
322
|
+
return {
|
|
323
|
+
root,
|
|
324
|
+
generatedAt: new Date().toISOString(),
|
|
325
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
326
|
+
workflows: {
|
|
327
|
+
learningPromotion: failed === 0 ? 'verified' : 'failed',
|
|
328
|
+
fixtureCoverage: failed === 0 ? 'verified' : 'failed',
|
|
329
|
+
},
|
|
330
|
+
fixture: {
|
|
331
|
+
promoted: fixtureReport.summary.promoted,
|
|
332
|
+
guardCandidates: fixtureReport.summary.guardCandidates,
|
|
333
|
+
scriptCandidates: fixtureReport.summary.scriptCandidates,
|
|
334
|
+
categories: fixtureReport.promotions.map((item) => item.category),
|
|
335
|
+
},
|
|
336
|
+
checks,
|
|
337
|
+
limits: [
|
|
338
|
+
'Self-test uses generic shell, encoding, and host-tool lessons.',
|
|
339
|
+
'No target-project behavior is hardcoded.',
|
|
340
|
+
],
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const isCli = process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])
|
|
345
|
+
|
|
346
|
+
if (isCli) {
|
|
347
|
+
const report = targetArg ? audit(targetArg) : selfTestReport()
|
|
348
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
349
|
+
else console.log(JSON.stringify(report, null, 2))
|
|
350
|
+
if (report.summary.status === 'failed') process.exit(1)
|
|
351
|
+
}
|
|
@@ -49,20 +49,28 @@ const dryRun = run('record-learning.mjs', ['--target', target, '--summary', summ
|
|
|
49
49
|
const afterDryRun = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
50
50
|
const writeRun = run('record-learning.mjs', ['--target', target, '--summary', summary, '--trigger', 'encoding review', '--source', 'audit fixture', '--impact', 'prevents false mojibake fixes', '--execute', '--json'])
|
|
51
51
|
const afterWrite = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
52
|
-
const duplicateRun = run('record-learning.mjs', ['--target', target, '--summary', summary, '--trigger', 'encoding review again', '--source', 'audit fixture', '--execute', '--json'])
|
|
53
|
-
const afterDuplicate = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
54
|
-
const commandDryRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', `/gse learn --summary ${summary} via command --trigger command audit --source run-gse-command`, '--json'])
|
|
55
|
-
const commandWriteRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', '/gse learn --summary Capture tool capability mismatches as reusable lessons --trigger tool mismatch --source command audit', '--execute', '--json'])
|
|
56
|
-
const afterCommandWrite = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
52
|
+
const duplicateRun = run('record-learning.mjs', ['--target', target, '--summary', summary, '--trigger', 'encoding review again', '--source', 'audit fixture', '--execute', '--json'])
|
|
53
|
+
const afterDuplicate = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
54
|
+
const commandDryRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', `/gse learn --summary ${summary} via command --trigger command audit --source run-gse-command`, '--json'])
|
|
55
|
+
const commandWriteRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', '/gse learn --summary Capture tool capability mismatches as reusable lessons --trigger tool mismatch --source command audit', '--execute', '--json'])
|
|
56
|
+
const afterCommandWrite = fs.existsSync(learningsPath) ? fs.readFileSync(learningsPath, 'utf8') : ''
|
|
57
|
+
const promoteDryRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', '/gse learn --promote', '--json'])
|
|
58
|
+
const promoteWriteRun = run('run-gse-command.mjs', ['--root', root, '--target', target, '--command', '/gse learn --promote', '--execute', '--json'])
|
|
59
|
+
const promotionsPath = path.join(target, '.gse', 'learning-promotions.md')
|
|
60
|
+
const promotionsText = fs.existsSync(promotionsPath) ? fs.readFileSync(promotionsPath, 'utf8') : ''
|
|
57
61
|
|
|
58
62
|
const waiting = parseJson(waitingRun.stdout)
|
|
59
63
|
const dry = parseJson(dryRun.stdout)
|
|
60
64
|
const written = parseJson(writeRun.stdout)
|
|
61
65
|
const duplicate = parseJson(duplicateRun.stdout)
|
|
62
|
-
const commandDry = parseJson(commandDryRun.stdout)
|
|
63
|
-
const commandDryChild = parseJson(commandDry?.execution?.stdout ?? '')
|
|
64
|
-
const commandWrite = parseJson(commandWriteRun.stdout)
|
|
65
|
-
const commandWriteChild = parseJson(commandWrite?.execution?.stdout ?? '')
|
|
66
|
+
const commandDry = parseJson(commandDryRun.stdout)
|
|
67
|
+
const commandDryChild = parseJson(commandDry?.execution?.stdout ?? '')
|
|
68
|
+
const commandWrite = parseJson(commandWriteRun.stdout)
|
|
69
|
+
const commandWriteChild = parseJson(commandWrite?.execution?.stdout ?? '')
|
|
70
|
+
const promoteDry = parseJson(promoteDryRun.stdout)
|
|
71
|
+
const promoteDryChild = parseJson(promoteDry?.execution?.stdout ?? '')
|
|
72
|
+
const promoteWrite = parseJson(promoteWriteRun.stdout)
|
|
73
|
+
const promoteWriteChild = parseJson(promoteWrite?.execution?.stdout ?? '')
|
|
66
74
|
|
|
67
75
|
const checks = [
|
|
68
76
|
check('LRN01', 'record-learning script exists', fs.existsSync(path.join(root, 'scripts', 'record-learning.mjs')), 'scripts/record-learning.mjs'),
|
|
@@ -71,10 +79,12 @@ const checks = [
|
|
|
71
79
|
check('LRN04', 'missing summary returns waiting-for-input without failing', waitingRun.status === 0 && waiting?.status === 'waiting-for-input', 'record-learning without --summary'),
|
|
72
80
|
check('LRN05', 'dry-run previews learning without modifying file', dryRun.status === 0 && dry?.status === 'ready' && before === afterDryRun && dry?.preview?.includes(summary), 'record-learning dry-run'),
|
|
73
81
|
check('LRN06', 'execute appends structured learning entry', writeRun.status === 0 && written?.status === 'written' && afterWrite.includes('- Summary: ' + summary) && afterWrite.includes('- Trigger: encoding review') && afterWrite.includes('- Status: learning-note'), 'record-learning --execute'),
|
|
74
|
-
check('LRN07', 'duplicate summary
|
|
75
|
-
check('LRN08', '/gse learn dry-runs through portable command runner', commandDryRun.status === 0 && commandDry?.verb === 'learn' && commandDryChild?.status === 'ready', '/gse learn'),
|
|
76
|
-
check('LRN09', '/gse learn --execute writes through portable command runner', commandWriteRun.status === 0 && commandWrite?.verb === 'learn' && commandWriteChild?.status === 'written' && afterCommandWrite.includes('Capture tool capability mismatches as reusable lessons'), '/gse learn --execute'),
|
|
77
|
-
|
|
82
|
+
check('LRN07', 'duplicate summary increments occurrence without appending another entry', duplicateRun.status === 0 && duplicate?.status === 'updated' && afterDuplicate.includes('- Occurrences: 2') && (afterDuplicate.match(new RegExp('- Summary: ' + summary.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g')) ?? []).length === 1, 'duplicate record-learning --execute'),
|
|
83
|
+
check('LRN08', '/gse learn dry-runs through portable command runner', commandDryRun.status === 0 && commandDry?.verb === 'learn' && commandDryChild?.status === 'ready', '/gse learn'),
|
|
84
|
+
check('LRN09', '/gse learn --execute writes through portable command runner', commandWriteRun.status === 0 && commandWrite?.verb === 'learn' && commandWriteChild?.status === 'written' && afterCommandWrite.includes('Capture tool capability mismatches as reusable lessons'), '/gse learn --execute'),
|
|
85
|
+
check('LRN10', '/gse learn --promote dry-runs promotion analysis', promoteDryRun.status === 0 && promoteDry?.verb === 'learn' && promoteDryChild?.workflows?.learningPromotion === 'verified', '/gse learn --promote'),
|
|
86
|
+
check('LRN11', '/gse learn --promote --execute writes candidate-only report', promoteWriteRun.status === 0 && promoteWrite?.verb === 'learn' && promoteWriteChild?.write?.status === 'written' && promotionsText.includes('# Learning Promotions'), '/gse learn --promote --execute'),
|
|
87
|
+
]
|
|
78
88
|
|
|
79
89
|
const passed = checks.filter((item) => item.status === 'passed').length
|
|
80
90
|
const failed = checks.length - passed
|
|
@@ -87,7 +97,7 @@ const report = {
|
|
|
87
97
|
learningCommand: failed === 0 ? 'verified' : 'failed',
|
|
88
98
|
learningStore: failed === 0 ? 'verified' : 'failed',
|
|
89
99
|
},
|
|
90
|
-
commands: [waitingRun.command, dryRun.command, writeRun.command, duplicateRun.command, commandDryRun.command, commandWriteRun.command],
|
|
100
|
+
commands: [waitingRun.command, dryRun.command, writeRun.command, duplicateRun.command, commandDryRun.command, commandWriteRun.command, promoteDryRun.command, promoteWriteRun.command],
|
|
91
101
|
limits: [
|
|
92
102
|
'This verifies deterministic learning capture and duplicate prevention.',
|
|
93
103
|
'It does not automatically decide which lessons are worth recording; the agent or owner still supplies the summary.',
|
|
@@ -45,10 +45,11 @@ const publicAcceptance = run('audit-public-acceptance-readiness.mjs')
|
|
|
45
45
|
const completionReadiness = run('audit-completion-readiness.mjs')
|
|
46
46
|
|
|
47
47
|
const finalRows = finalReadiness.data?.matrix ?? []
|
|
48
|
-
const nonExternalIncompleteRows = finalRows.filter((row) => {
|
|
49
|
-
if (row.status === 'verified') return false
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const nonExternalIncompleteRows = finalRows.filter((row) => {
|
|
49
|
+
if (row.status === 'verified') return false
|
|
50
|
+
if (row.status === 'not-claimed') return false
|
|
51
|
+
return !['owner-required', 'external-required'].includes(row.status)
|
|
52
|
+
})
|
|
52
53
|
const pendingGates = publicAcceptance.data?.pendingGates ?? []
|
|
53
54
|
const pendingGateAreas = pendingGates.map((gate) => gate.area)
|
|
54
55
|
const expectedPendingAreas = pendingGateAreas
|
|
@@ -57,11 +58,11 @@ const checks = [
|
|
|
57
58
|
check('LFC01', 'final readiness audit passes', finalReadiness.status === 0 && finalReadiness.data?.summary?.failed === 0, finalReadiness.command),
|
|
58
59
|
check('LFC02', 'completion readiness audit passes', completionReadiness.status === 0 && completionReadiness.data?.summary?.failed === 0, completionReadiness.command),
|
|
59
60
|
check('LFC03', 'final-form progress report shows local engineering readiness at 100', progress.status === 0 && progress.data?.workflows?.localEngineeringReadiness === 100, 'localEngineeringReadiness=' + progress.data?.workflows?.localEngineeringReadiness),
|
|
60
|
-
check('LFC04', '
|
|
61
|
+
check('LFC04', 'portable-core final-form readiness is accepted when only optional host-native claims remain not-claimed', progress.status === 0 && progress.data?.workflows?.publicAccepted === 'verified' && Number(progress.data?.workflows?.pendingGates) === 0, 'publicAccepted=' + progress.data?.workflows?.publicAccepted + '; pendingGates=' + progress.data?.workflows?.pendingGates),
|
|
61
62
|
check('LFC05', 'all incomplete final readiness rows are owner/external only', nonExternalIncompleteRows.length === 0, nonExternalIncompleteRows.length ? JSON.stringify(nonExternalIncompleteRows) : 'no local incomplete rows'),
|
|
62
|
-
check('LFC06', 'public acceptance doctor passes and
|
|
63
|
-
check('LFC07', 'public acceptance pending gates
|
|
64
|
-
check('LFC08', 'pending
|
|
63
|
+
check('LFC06', 'public acceptance doctor passes and accepts required GSE core gates', publicAcceptance.status === 0 && publicAcceptance.data?.summary?.failed === 0 && publicAcceptance.data?.summary?.publicAccepted === 'verified', publicAcceptance.command),
|
|
64
|
+
check('LFC07', 'public acceptance has no pending owner/external gates after optional host-native claims are excluded', pendingGateAreas.length === 0 && expectedPendingAreas.length === 0, pendingGateAreas.join(', ') || 'none'),
|
|
65
|
+
check('LFC08', 'pending gate command templates are not required when no owner/external gates remain', pendingGates.length === 0 || pendingGates.every((gate) => gate.recordCommand && gate.preflightCommand && gate.requiredEvidence && gate.owner), 'pending gate command templates'),
|
|
65
66
|
]
|
|
66
67
|
|
|
67
68
|
const passed = checks.filter((item) => item.status === 'passed').length
|
|
@@ -91,8 +92,8 @@ const report = {
|
|
|
91
92
|
})),
|
|
92
93
|
limits: [
|
|
93
94
|
'This audit proves local GSE engineering completion boundaries only.',
|
|
94
|
-
'It does not create
|
|
95
|
-
'A
|
|
95
|
+
'It does not create optional host-native slash-command evidence.',
|
|
96
|
+
'A host-native slash claim still requires a per-host accepted invocation record and final readiness re-audit.',
|
|
96
97
|
],
|
|
97
98
|
checks,
|
|
98
99
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
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').replace(/^\uFEFF/, '') : ''
|
|
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 maintenance = read('references/maintenance-cadence.md')
|
|
30
|
+
const skill = read('SKILL.md')
|
|
31
|
+
const validationProfile = read('scripts/run-validation-profile.mjs')
|
|
32
|
+
const validator = read('scripts/validate-gse.mjs')
|
|
33
|
+
const commandRunner = read('scripts/run-gse-command.mjs')
|
|
34
|
+
const roadmap = read('references/final-form-roadmap.md')
|
|
35
|
+
const masterPlan = read('.gse/gse-design-master-plan.md')
|
|
36
|
+
|
|
37
|
+
const requiredAreas = [
|
|
38
|
+
'Benchmark audit',
|
|
39
|
+
'Drift audit',
|
|
40
|
+
'Dependency and security review',
|
|
41
|
+
'Forward test',
|
|
42
|
+
'Target-project hardening drill',
|
|
43
|
+
'Public acceptance doctor',
|
|
44
|
+
'Installed skill sync',
|
|
45
|
+
'Active session sync',
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
const requiredCommands = [
|
|
49
|
+
'audit-final-form-roadmap.mjs',
|
|
50
|
+
'audit-learning-drift.mjs',
|
|
51
|
+
'audit-release-trust.mjs',
|
|
52
|
+
'forward-test-gse.mjs',
|
|
53
|
+
'audit-target-hardening-drills.mjs',
|
|
54
|
+
'audit-public-acceptance-readiness.mjs',
|
|
55
|
+
'audit-installed-sync.mjs',
|
|
56
|
+
'audit-session-sync.mjs',
|
|
57
|
+
'record-session-sync.mjs',
|
|
58
|
+
'generate-maintenance-snapshot.mjs',
|
|
59
|
+
'audit-maintenance-snapshot.mjs',
|
|
60
|
+
'run-gse-command.mjs',
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
const scriptTargets = [
|
|
64
|
+
'scripts/audit-final-form-roadmap.mjs',
|
|
65
|
+
'scripts/audit-learning-drift.mjs',
|
|
66
|
+
'scripts/audit-release-trust.mjs',
|
|
67
|
+
'scripts/forward-test-gse.mjs',
|
|
68
|
+
'scripts/audit-target-hardening-drills.mjs',
|
|
69
|
+
'scripts/audit-public-acceptance-readiness.mjs',
|
|
70
|
+
'scripts/audit-installed-sync.mjs',
|
|
71
|
+
'scripts/audit-session-sync.mjs',
|
|
72
|
+
'scripts/record-session-sync.mjs',
|
|
73
|
+
'scripts/generate-maintenance-snapshot.mjs',
|
|
74
|
+
'scripts/audit-maintenance-snapshot.mjs',
|
|
75
|
+
'scripts/run-gse-command.mjs',
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
const checks = [
|
|
79
|
+
check('MC01', 'maintenance cadence reference exists', exists('references/maintenance-cadence.md'), 'references/maintenance-cadence.md'),
|
|
80
|
+
check('MC02', 'cadence covers all final-form upkeep areas', requiredAreas.every((term) => maintenance.includes(term)), requiredAreas.join(', ')),
|
|
81
|
+
check('MC03', 'cadence maps each area to executable commands', requiredCommands.every((term) => maintenance.includes(term)), requiredCommands.join(', ')),
|
|
82
|
+
check('MC04', 'cadence distinguishes recurring maintenance from external acceptance', maintenance.includes('not a substitute for native host evidence') && maintenance.includes('remaining external gates stay visible'), 'claim boundary'),
|
|
83
|
+
check('MC05', 'all referenced maintenance scripts exist', scriptTargets.every((target) => exists(target)), scriptTargets.join(', ')),
|
|
84
|
+
check('MC06', 'skill routing exposes maintenance cadence', skill.includes('references/maintenance-cadence.md') && skill.includes('audit-maintenance-cadence.mjs'), 'SKILL.md'),
|
|
85
|
+
check('MC07', 'portable command runner exposes /gse maintenance snapshot route', commandRunner.includes('maintenance') && commandRunner.includes('generate-maintenance-snapshot.mjs'), 'scripts/run-gse-command.mjs'),
|
|
86
|
+
check('MC08', 'validation profile includes maintenance cadence audit', validationProfile.includes('audit-maintenance-cadence.mjs'), 'scripts/run-validation-profile.mjs'),
|
|
87
|
+
check('MC09', 'consolidated validator includes maintenance cadence audit', validator.includes('audit-maintenance-cadence.mjs'), 'scripts/validate-gse.mjs'),
|
|
88
|
+
check('MC10', 'final-form roadmap tracks maintenance cadence as Wave 5 capability', roadmap.includes('Maintenance cadence') && roadmap.includes('audit-maintenance-cadence.mjs'), 'references/final-form-roadmap.md'),
|
|
89
|
+
check('MC11', 'master plan current priority includes maintenance cadence evidence', masterPlan.includes('maintenance cadence') && masterPlan.includes('audit-maintenance-cadence.mjs'), '.gse/gse-design-master-plan.md'),
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
93
|
+
const failed = checks.length - passed
|
|
94
|
+
const report = {
|
|
95
|
+
root,
|
|
96
|
+
generatedAt: new Date().toISOString(),
|
|
97
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
98
|
+
workflows: {
|
|
99
|
+
maintenanceCadence: failed === 0 ? 'verified' : 'failed',
|
|
100
|
+
externalNativeSlashCommand: 'external-required',
|
|
101
|
+
},
|
|
102
|
+
limits: [
|
|
103
|
+
'This audit verifies recurring maintenance coverage and command wiring.',
|
|
104
|
+
'It does not prove a real host-native slash command, public CI run, marketplace approval, or owner acceptance.',
|
|
105
|
+
],
|
|
106
|
+
checks,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function renderMarkdown(data) {
|
|
110
|
+
const lines = []
|
|
111
|
+
lines.push('# GSE Maintenance Cadence Audit')
|
|
112
|
+
lines.push('')
|
|
113
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
114
|
+
lines.push('Root: ' + data.root)
|
|
115
|
+
lines.push('')
|
|
116
|
+
lines.push('## Summary')
|
|
117
|
+
lines.push('')
|
|
118
|
+
lines.push('- Status: ' + data.summary.status)
|
|
119
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
120
|
+
lines.push('- Maintenance cadence: ' + data.workflows.maintenanceCadence)
|
|
121
|
+
lines.push('- External native slash command: ' + data.workflows.externalNativeSlashCommand)
|
|
122
|
+
lines.push('')
|
|
123
|
+
lines.push('## Checks')
|
|
124
|
+
lines.push('')
|
|
125
|
+
for (const item of data.checks) {
|
|
126
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
127
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
128
|
+
}
|
|
129
|
+
lines.push('')
|
|
130
|
+
lines.push('## Limits')
|
|
131
|
+
lines.push('')
|
|
132
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
133
|
+
return lines.join('\n') + '\n'
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
137
|
+
else console.log(renderMarkdown(report))
|
|
138
|
+
|
|
139
|
+
if (failed > 0) process.exit(1)
|