@t275005746/gse 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.gse/state.json +147 -26
  2. package/CHANGELOG.md +19 -3
  3. package/README.md +13 -6
  4. package/README.zh-CN.md +13 -6
  5. package/SKILL.md +32 -12
  6. package/assets/templates/dispatch-packet.md +22 -14
  7. package/assets/templates/evidence.md +11 -5
  8. package/assets/templates/role-fallback-packet.md +49 -0
  9. package/package.json +18 -10
  10. package/references/agent-roles.md +41 -20
  11. package/references/commands.md +74 -45
  12. package/references/drift-audit.md +2 -1
  13. package/references/evidence-taxonomy.md +46 -9
  14. package/references/file-ownership.md +17 -13
  15. package/references/final-form-roadmap.md +201 -0
  16. package/references/final-readiness.md +3 -3
  17. package/references/host-adapters.md +38 -10
  18. package/references/learning-system.md +24 -8
  19. package/references/maintenance-cadence.md +51 -0
  20. package/references/project-guards.md +52 -0
  21. package/references/quality-gates.md +18 -11
  22. package/references/role-dispatch-fallback.md +54 -0
  23. package/references/tool-adapters.md +13 -3
  24. package/scripts/audit-close-gate-hardening.mjs +188 -0
  25. package/scripts/audit-close-gate.mjs +219 -33
  26. package/scripts/audit-command-execution.mjs +30 -17
  27. package/scripts/audit-commands.mjs +7 -5
  28. package/scripts/audit-completion-plan-drill.mjs +230 -0
  29. package/scripts/audit-completion-readiness.mjs +9 -6
  30. package/scripts/audit-continue-preflight.mjs +234 -0
  31. package/scripts/audit-evidence-levels.mjs +217 -0
  32. package/scripts/audit-evidence-review-queue.mjs +206 -0
  33. package/scripts/audit-final-acceptance-packet.mjs +9 -9
  34. package/scripts/audit-final-form-progress-report.mjs +19 -18
  35. package/scripts/audit-final-form-roadmap.mjs +157 -0
  36. package/scripts/audit-final-form-stale-copy.mjs +2 -2
  37. package/scripts/audit-final-readiness.mjs +3 -3
  38. package/scripts/audit-fresh-session-readiness.mjs +1 -1
  39. package/scripts/audit-host-capabilities.mjs +237 -0
  40. package/scripts/audit-installed-sync.mjs +203 -0
  41. package/scripts/audit-learning-drift.mjs +292 -0
  42. package/scripts/audit-learning-promotion.mjs +351 -0
  43. package/scripts/audit-learning-system.mjs +24 -14
  44. package/scripts/audit-local-final-form-completion.mjs +11 -10
  45. package/scripts/audit-maintenance-cadence.mjs +139 -0
  46. package/scripts/audit-maintenance-snapshot.mjs +181 -0
  47. package/scripts/audit-npm-package-metadata.mjs +8 -2
  48. package/scripts/audit-npm-publish-dry-run.mjs +10 -4
  49. package/scripts/audit-npm-tarball-install.mjs +9 -3
  50. package/scripts/audit-owner-external-gate-kit.mjs +12 -11
  51. package/scripts/audit-project-guards.mjs +189 -0
  52. package/scripts/audit-project.mjs +14 -11
  53. package/scripts/audit-public-acceptance-handoff.mjs +10 -10
  54. package/scripts/audit-public-acceptance-readiness.mjs +6 -6
  55. package/scripts/audit-public-release-checklist.mjs +17 -15
  56. package/scripts/audit-release-bundle.mjs +13 -11
  57. package/scripts/audit-release-owner-action-plan-drill.mjs +5 -4
  58. package/scripts/audit-release-owner-action-plan.mjs +10 -10
  59. package/scripts/audit-release-status-manifest.mjs +4 -4
  60. package/scripts/audit-roadmap-consistency.mjs +11 -7
  61. package/scripts/audit-role-dispatch-fallback.mjs +212 -0
  62. package/scripts/audit-session-sync.mjs +127 -0
  63. package/scripts/audit-state-freshness.mjs +6 -5
  64. package/scripts/audit-state-repair.mjs +360 -0
  65. package/scripts/audit-target-hardening-drills.mjs +267 -0
  66. package/scripts/audit-tool-fallback-policy.mjs +180 -0
  67. package/scripts/audit-ui-browser-evidence-policy.mjs +191 -0
  68. package/scripts/audit-validation-profiles.mjs +6 -4
  69. package/scripts/backfill-evidence-levels.mjs +98 -0
  70. package/scripts/check-encoding.mjs +72 -0
  71. package/scripts/generate-continue-packet.mjs +1214 -0
  72. package/scripts/generate-final-acceptance-packet.mjs +23 -8
  73. package/scripts/generate-final-form-progress-report.mjs +25 -23
  74. package/scripts/generate-host-runtime-evidence-handoff.mjs +23 -16
  75. package/scripts/generate-maintenance-snapshot.mjs +216 -0
  76. package/scripts/generate-public-acceptance-handoff.mjs +26 -14
  77. package/scripts/generate-release-owner-action-plan.mjs +4 -3
  78. package/scripts/generate-release-status-manifest.mjs +4 -3
  79. package/scripts/init-project.mjs +144 -63
  80. package/scripts/record-learning.mjs +37 -8
  81. package/scripts/record-session-sync.mjs +87 -0
  82. package/scripts/run-gse-command.mjs +79 -47
  83. package/scripts/run-validation-profile.mjs +24 -5
  84. package/scripts/validate-gse.mjs +216 -0
@@ -0,0 +1,98 @@
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 execute = args.includes('--execute')
15
+ const jsonOnly = args.includes('--json')
16
+ const defaultLevel = readArg('--default-level', 'result')
17
+ const evidenceIndexPath = path.join(root, '.gse', 'evidence', 'index.jsonl')
18
+ const allowedLevels = new Set([
19
+ 'result',
20
+ 'verified-unit',
21
+ 'verified-component',
22
+ 'verified-api',
23
+ 'verified-browser',
24
+ 'verified-ci',
25
+ 'accepted-owner',
26
+ 'accepted-release',
27
+ 'external-required',
28
+ ])
29
+
30
+ function parseJsonl(filePath) {
31
+ if (!fs.existsSync(filePath)) return { records: [], errors: [{ line: 0, error: 'missing evidence index' }] }
32
+ const lines = fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '').split(/\r?\n/)
33
+ const records = []
34
+ const errors = []
35
+ lines.forEach((line, index) => {
36
+ if (!line.trim()) return
37
+ try {
38
+ records.push(JSON.parse(line))
39
+ } catch (error) {
40
+ errors.push({ line: index + 1, error: error.message })
41
+ }
42
+ })
43
+ return { records, errors }
44
+ }
45
+
46
+ function summarize(record) {
47
+ return record.summary || record.recordType || '(unknown)'
48
+ }
49
+
50
+ if (!allowedLevels.has(defaultLevel)) {
51
+ console.error(`--default-level must be one of: ${[...allowedLevels].join(', ')}`)
52
+ process.exit(1)
53
+ }
54
+
55
+ const { records, errors } = parseJsonl(evidenceIndexPath)
56
+ const missingBefore = records.filter((record) => !record.evidenceLevel)
57
+ const updatedRecords = records.map((record) => {
58
+ if (record.evidenceLevel) return record
59
+ return {
60
+ ...record,
61
+ evidenceLevel: defaultLevel,
62
+ requiredEvidenceLevel: record.requiredEvidenceLevel || defaultLevel,
63
+ evidenceLevelBackfill: 'conservative-historical-default',
64
+ }
65
+ })
66
+ const missingAfter = updatedRecords.filter((record) => !record.evidenceLevel)
67
+ const invalidAfter = updatedRecords.filter((record) => !allowedLevels.has(record.evidenceLevel))
68
+
69
+ const report = {
70
+ root,
71
+ evidenceIndexPath,
72
+ execute,
73
+ defaultLevel,
74
+ summary: {
75
+ status: errors.length || invalidAfter.length ? 'failed' : execute ? 'written' : 'dry-run',
76
+ records: records.length,
77
+ missingBefore: missingBefore.length,
78
+ missingAfter: missingAfter.length,
79
+ invalidAfter: invalidAfter.length,
80
+ },
81
+ changed: missingBefore.slice(0, 20).map((record) => summarize(record)),
82
+ omittedChangedCount: Math.max(0, missingBefore.length - 20),
83
+ errors,
84
+ limits: [
85
+ 'This script only fills missing historical evidenceLevel fields with a conservative default.',
86
+ 'The default level should stay result unless a human or focused audit can prove a stronger level.',
87
+ 'It does not rewrite evidence status or claim that old records were verified by a stronger proof type.',
88
+ ],
89
+ }
90
+
91
+ if (errors.length === 0 && invalidAfter.length === 0 && execute && missingBefore.length > 0) {
92
+ fs.writeFileSync(evidenceIndexPath, updatedRecords.map((record) => JSON.stringify(record)).join('\n') + '\n', 'utf8')
93
+ }
94
+
95
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
96
+ else console.log(JSON.stringify(report, null, 2))
97
+
98
+ if (report.summary.status === 'failed') process.exit(1)
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { TextDecoder } from 'node:util'
5
+ import { spawnSync } from 'node:child_process'
6
+
7
+ const root = path.resolve(process.cwd())
8
+ const decoder = new TextDecoder('utf-8', { fatal: true })
9
+ const textExtensions = new Set([
10
+ '.md',
11
+ '.json',
12
+ '.jsonl',
13
+ '.mjs',
14
+ '.js',
15
+ '.ts',
16
+ '.tsx',
17
+ '.yml',
18
+ '.yaml',
19
+ '.txt',
20
+ '.svg',
21
+ '.html',
22
+ '.css',
23
+ '.xml',
24
+ ])
25
+
26
+ function gitFiles() {
27
+ const result = spawnSync('git', ['ls-files'], { cwd: root, encoding: 'utf8', windowsHide: true })
28
+ if ((result.status ?? 1) !== 0) {
29
+ throw new Error((result.stderr || result.stdout || 'git ls-files failed').trim())
30
+ }
31
+ return (result.stdout || '')
32
+ .split(/\r?\n/)
33
+ .map((line) => line.trim())
34
+ .filter(Boolean)
35
+ }
36
+
37
+ function isTextFile(filePath) {
38
+ const ext = path.extname(filePath).toLowerCase()
39
+ return textExtensions.has(ext) || filePath === 'package.json' || filePath === 'README' || filePath.endsWith('.md')
40
+ }
41
+
42
+ const files = gitFiles().filter(isTextFile)
43
+ const issues = []
44
+
45
+ for (const file of files) {
46
+ const fullPath = path.join(root, file)
47
+ const buffer = fs.readFileSync(fullPath)
48
+ try {
49
+ decoder.decode(buffer)
50
+ } catch (error) {
51
+ issues.push({ file, issue: 'invalid-utf8', detail: error.message })
52
+ continue
53
+ }
54
+ if (buffer.length >= 3 && buffer[0] === 0xef && buffer[1] === 0xbb && buffer[2] === 0xbf) {
55
+ issues.push({ file, issue: 'bom', detail: 'UTF-8 BOM present' })
56
+ }
57
+ }
58
+
59
+ const report = {
60
+ root,
61
+ generatedAt: new Date().toISOString(),
62
+ summary: {
63
+ status: issues.length === 0 ? 'passed' : 'failed',
64
+ passed: files.length - issues.length,
65
+ failed: issues.length,
66
+ total: files.length,
67
+ },
68
+ issues,
69
+ }
70
+
71
+ console.log(JSON.stringify(report, null, 2))
72
+ if (issues.length > 0) process.exit(1)