@t275005746/gse 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
  2. package/.github/ISSUE_TEMPLATE/change_request.yml +50 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +38 -0
  5. package/.github/workflows/validate-gse.yml +33 -0
  6. package/.gse/README.md +18 -0
  7. package/.gse/gse-development-protocol.md +50 -0
  8. package/.gse/project-profile.md +29 -0
  9. package/.gse/quality-gates.md +25 -0
  10. package/.gse/releases/public-channel-publication-pending.md +49 -0
  11. package/.gse/releases/public-ci-run-pending.md +53 -0
  12. package/.gse/releases/public-release-owner-required.md +65 -0
  13. package/.gse/releases/public-repository-settings-owner-required.md +59 -0
  14. package/.gse/releases/public-security-contact-owner-required.md +45 -0
  15. package/.gse/state.json +27 -0
  16. package/CHANGELOG.md +24 -0
  17. package/CONTRIBUTING.md +64 -0
  18. package/LICENSE +21 -0
  19. package/README.md +236 -0
  20. package/README.zh-CN.md +236 -0
  21. package/SECURITY.md +41 -0
  22. package/SKILL.md +148 -0
  23. package/SUPPORT.md +38 -0
  24. package/agents/openai.yaml +4 -0
  25. package/assets/marketplace/README.md +7 -0
  26. package/assets/marketplace/gse-listing.json +75 -0
  27. package/assets/templates/acceptance-execution-packet.md +73 -0
  28. package/assets/templates/adr.md +14 -0
  29. package/assets/templates/change-brief.md +16 -0
  30. package/assets/templates/design.md +18 -0
  31. package/assets/templates/dispatch-packet.md +104 -0
  32. package/assets/templates/evidence.md +14 -0
  33. package/assets/templates/execution-quality-pack.md +65 -0
  34. package/assets/templates/goal-map.md +21 -0
  35. package/assets/templates/host-adapter.md +48 -0
  36. package/assets/templates/host-ui-invocation-record.md +42 -0
  37. package/assets/templates/incident-review.md +60 -0
  38. package/assets/templates/public-channel-publication-record.md +49 -0
  39. package/assets/templates/public-ci-run-record.md +53 -0
  40. package/assets/templates/public-release-record.md +65 -0
  41. package/assets/templates/public-repository-settings-record.md +59 -0
  42. package/assets/templates/public-security-contact-record.md +45 -0
  43. package/assets/templates/release-trust-record.md +32 -0
  44. package/assets/templates/review.md +18 -0
  45. package/assets/templates/spec.md +16 -0
  46. package/assets/templates/target-adoption-evidence.md +29 -0
  47. package/assets/templates/tasks.md +17 -0
  48. package/assets/templates/update-release-acceptance-record.md +58 -0
  49. package/examples/README.md +22 -0
  50. package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -0
  51. package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -0
  52. package/examples/agent-runtime-host/.gse/goal-map.md +7 -0
  53. package/examples/agent-runtime-host/.gse/project-profile.md +27 -0
  54. package/examples/agent-runtime-host/.gse/tooling.md +5 -0
  55. package/examples/agent-runtime-host/.mcp.json +9 -0
  56. package/examples/agent-runtime-host/AGENTS.md +5 -0
  57. package/examples/agent-runtime-host/README.md +10 -0
  58. package/examples/agent-runtime-host/docs/model-routing.md +5 -0
  59. package/examples/cli-tool/.gse/project-profile.md +21 -0
  60. package/examples/cli-tool/AGENTS.md +5 -0
  61. package/examples/cli-tool/README.md +12 -0
  62. package/examples/cli-tool/package.json +21 -0
  63. package/examples/small-app/.env.example +2 -0
  64. package/examples/small-app/.github/workflows/ci.yml +8 -0
  65. package/examples/small-app/AGENTS.md +5 -0
  66. package/examples/small-app/README.md +12 -0
  67. package/examples/small-app/package.json +26 -0
  68. package/examples/small-app/playwright.config.ts +4 -0
  69. package/package.json +53 -0
  70. package/references/adoption-recipes.md +171 -0
  71. package/references/agent-roles.md +49 -0
  72. package/references/architecture-health.md +101 -0
  73. package/references/benchmark-audit.md +73 -0
  74. package/references/commands.md +295 -0
  75. package/references/community-channels.md +46 -0
  76. package/references/compatibility.md +70 -0
  77. package/references/design-basis.md +38 -0
  78. package/references/domain-model.md +129 -0
  79. package/references/domain-quality-gates.md +75 -0
  80. package/references/drift-audit.md +81 -0
  81. package/references/evidence-taxonomy.md +123 -0
  82. package/references/file-ownership.md +107 -0
  83. package/references/final-readiness.md +84 -0
  84. package/references/forward-test.md +133 -0
  85. package/references/goal-map.md +36 -0
  86. package/references/host-adapters.md +119 -0
  87. package/references/learning-system.md +35 -0
  88. package/references/marketplace-discovery.md +46 -0
  89. package/references/model-routing.md +103 -0
  90. package/references/open-source-defaults.md +39 -0
  91. package/references/operating-model.md +52 -0
  92. package/references/packaging.md +277 -0
  93. package/references/project-agent-workspace.md +89 -0
  94. package/references/project-bootstrap.md +122 -0
  95. package/references/project-profile.md +57 -0
  96. package/references/public-release.md +174 -0
  97. package/references/quality-gates.md +100 -0
  98. package/references/recovery.md +176 -0
  99. package/references/release-trust.md +43 -0
  100. package/references/release.md +126 -0
  101. package/references/review.md +141 -0
  102. package/references/router.md +90 -0
  103. package/references/spec-workflow.md +66 -0
  104. package/references/task-levels.md +81 -0
  105. package/references/tool-adapters.md +73 -0
  106. package/scripts/audit-acceptance-execution-packet.mjs +133 -0
  107. package/scripts/audit-adoption-recipes.mjs +99 -0
  108. package/scripts/audit-adoption.mjs +154 -0
  109. package/scripts/audit-change-lifecycle.mjs +77 -0
  110. package/scripts/audit-change-system.mjs +134 -0
  111. package/scripts/audit-ci-readiness.mjs +107 -0
  112. package/scripts/audit-close-gate.mjs +323 -0
  113. package/scripts/audit-command-adapters.mjs +91 -0
  114. package/scripts/audit-command-execution.mjs +210 -0
  115. package/scripts/audit-commands.mjs +117 -0
  116. package/scripts/audit-compatibility.mjs +149 -0
  117. package/scripts/audit-completion-readiness.mjs +292 -0
  118. package/scripts/audit-distribution.mjs +251 -0
  119. package/scripts/audit-domain-quality-gates.mjs +108 -0
  120. package/scripts/audit-evidence-placeholders.mjs +126 -0
  121. package/scripts/audit-final-acceptance-packet.mjs +148 -0
  122. package/scripts/audit-final-form-progress-report.mjs +161 -0
  123. package/scripts/audit-final-form-stale-copy.mjs +221 -0
  124. package/scripts/audit-final-readiness-promotion.mjs +255 -0
  125. package/scripts/audit-final-readiness.mjs +226 -0
  126. package/scripts/audit-fixtures.mjs +154 -0
  127. package/scripts/audit-fresh-session-readiness.mjs +177 -0
  128. package/scripts/audit-gse.mjs +275 -0
  129. package/scripts/audit-host-adapters.mjs +119 -0
  130. package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -0
  131. package/scripts/audit-host-runtime-invocation-drill.mjs +240 -0
  132. package/scripts/audit-host-runtime-invocations.mjs +254 -0
  133. package/scripts/audit-host-ui-invocation.mjs +132 -0
  134. package/scripts/audit-learning-system.mjs +103 -0
  135. package/scripts/audit-local-final-form-completion.mjs +131 -0
  136. package/scripts/audit-marketplace-discovery.mjs +122 -0
  137. package/scripts/audit-npm-package-metadata.mjs +155 -0
  138. package/scripts/audit-npm-publish-dry-run.mjs +169 -0
  139. package/scripts/audit-npm-tarball-install.mjs +191 -0
  140. package/scripts/audit-open-source-defaults.mjs +92 -0
  141. package/scripts/audit-open-source-readiness.mjs +97 -0
  142. package/scripts/audit-owner-external-gate-kit.mjs +218 -0
  143. package/scripts/audit-project.mjs +323 -0
  144. package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -0
  145. package/scripts/audit-public-acceptance-handoff.mjs +142 -0
  146. package/scripts/audit-public-acceptance-readiness.mjs +224 -0
  147. package/scripts/audit-public-channel-publication.mjs +248 -0
  148. package/scripts/audit-public-ci-run.mjs +184 -0
  149. package/scripts/audit-public-collaboration-templates.mjs +98 -0
  150. package/scripts/audit-public-external-gate-probe.mjs +206 -0
  151. package/scripts/audit-public-release-checklist.mjs +133 -0
  152. package/scripts/audit-public-release-decision.mjs +201 -0
  153. package/scripts/audit-public-release-metadata.mjs +176 -0
  154. package/scripts/audit-public-repository-settings.mjs +237 -0
  155. package/scripts/audit-public-security-contact.mjs +171 -0
  156. package/scripts/audit-readme-docs.mjs +185 -0
  157. package/scripts/audit-recovery-readiness.mjs +98 -0
  158. package/scripts/audit-release-bundle.mjs +251 -0
  159. package/scripts/audit-release-owner-action-plan-drill.mjs +277 -0
  160. package/scripts/audit-release-owner-action-plan.mjs +164 -0
  161. package/scripts/audit-release-readiness.mjs +106 -0
  162. package/scripts/audit-release-status-manifest.mjs +165 -0
  163. package/scripts/audit-release-trust.mjs +62 -0
  164. package/scripts/audit-remote-distribution.mjs +266 -0
  165. package/scripts/audit-roadmap-consistency.mjs +235 -0
  166. package/scripts/audit-signing.mjs +147 -0
  167. package/scripts/audit-state-freshness.mjs +113 -0
  168. package/scripts/audit-target-adoption-evidence.mjs +117 -0
  169. package/scripts/audit-target-project.mjs +507 -0
  170. package/scripts/audit-update-release-acceptance.mjs +136 -0
  171. package/scripts/audit-v1-target-validation.mjs +269 -0
  172. package/scripts/audit-validation-profiles.mjs +125 -0
  173. package/scripts/close-change.mjs +116 -0
  174. package/scripts/discover-project-profile.mjs +307 -0
  175. package/scripts/forward-test-gse.mjs +146 -0
  176. package/scripts/generate-command-adapter.mjs +231 -0
  177. package/scripts/generate-final-acceptance-packet.mjs +181 -0
  178. package/scripts/generate-final-form-progress-report.mjs +205 -0
  179. package/scripts/generate-host-adapter.mjs +73 -0
  180. package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -0
  181. package/scripts/generate-owner-external-gate-kit.mjs +295 -0
  182. package/scripts/generate-public-acceptance-handoff.mjs +168 -0
  183. package/scripts/generate-public-release-checklist.mjs +207 -0
  184. package/scripts/generate-release-bundle.mjs +505 -0
  185. package/scripts/generate-release-owner-action-plan.mjs +172 -0
  186. package/scripts/generate-release-status-manifest.mjs +200 -0
  187. package/scripts/generate-session-prompt.mjs +188 -0
  188. package/scripts/gse.mjs +67 -0
  189. package/scripts/init-change.mjs +265 -0
  190. package/scripts/init-project.mjs +785 -0
  191. package/scripts/install-gse.mjs +234 -0
  192. package/scripts/lib/evidence-placeholders.mjs +28 -0
  193. package/scripts/package-gse.mjs +174 -0
  194. package/scripts/probe-public-external-gates.mjs +167 -0
  195. package/scripts/record-host-invocation.mjs +151 -0
  196. package/scripts/record-learning.mjs +137 -0
  197. package/scripts/record-public-channel-publication.mjs +178 -0
  198. package/scripts/record-public-ci-run.mjs +180 -0
  199. package/scripts/record-public-release.mjs +175 -0
  200. package/scripts/record-public-repository-settings.mjs +209 -0
  201. package/scripts/record-public-security-contact.mjs +157 -0
  202. package/scripts/run-gse-command.mjs +538 -0
  203. package/scripts/run-validation-profile.mjs +146 -0
  204. package/scripts/sign-gse-package.mjs +83 -0
  205. package/scripts/update-project-state.mjs +223 -0
  206. package/scripts/validate-gse.mjs +1168 -0
  207. package/scripts/verify-gse-package.mjs +85 -0
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { mkdtempSync, rmSync } from 'node:fs'
5
+ import { tmpdir } from 'node:os'
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 jsonOnly = args.includes('--json')
18
+
19
+ function exists(relativePath) {
20
+ return fs.existsSync(path.join(root, relativePath))
21
+ }
22
+
23
+ function read(relativePath) {
24
+ const fullPath = path.join(root, relativePath)
25
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8').replace(/^\uFEFF/, '') : ''
26
+ }
27
+
28
+ function run(command, commandArgs) {
29
+ const result = spawnSync(command, commandArgs, {
30
+ cwd: root,
31
+ encoding: 'utf8',
32
+ windowsHide: true,
33
+ })
34
+ return {
35
+ status: result.status ?? 1,
36
+ stdout: (result.stdout ?? '').trim(),
37
+ stderr: (result.stderr ?? '').trim(),
38
+ command: [command, ...commandArgs].join(' '),
39
+ }
40
+ }
41
+
42
+ function parseJson(stdout) {
43
+ try {
44
+ return JSON.parse(stdout)
45
+ } catch {
46
+ return null
47
+ }
48
+ }
49
+
50
+ function check(id, label, ok, evidence, risk = '') {
51
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
52
+ }
53
+
54
+ const generator = read('scripts/generate-host-runtime-evidence-handoff.mjs')
55
+ const validate = read('scripts/validate-gse.mjs')
56
+ const skill = read('SKILL.md')
57
+ const releaseGenerator = read('scripts/generate-release-bundle.mjs')
58
+ const releaseAudit = read('scripts/audit-release-bundle.mjs')
59
+ const compatibility = read('references/compatibility.md')
60
+ const tmp = mkdtempSync(path.join(tmpdir(), 'gse-host-runtime-handoff-'))
61
+ const out = path.join(tmp, 'host-runtime-evidence-handoff.md')
62
+ const generated = exists('scripts/generate-host-runtime-evidence-handoff.mjs')
63
+ ? run(process.execPath, [path.join(root, 'scripts', 'generate-host-runtime-evidence-handoff.mjs'), '--root', root, '--out', out, '--force', '--json'])
64
+ : null
65
+ const generatedData = generated ? parseJson(generated.stdout) : null
66
+ const handoff = fs.existsSync(out) ? fs.readFileSync(out, 'utf8') : ''
67
+ rmSync(tmp, { recursive: true, force: true })
68
+
69
+ const hostFamilies = [
70
+ 'Codex-style',
71
+ 'Claude Code-style',
72
+ 'Hermes/AION-style runtime',
73
+ 'WorkBuddy/other IDE agents',
74
+ 'Copilot/Gemini-style assistants',
75
+ 'Unknown or custom host',
76
+ ]
77
+ const boundaries = [
78
+ 'Do not claim native slash-command support',
79
+ 'Do not claim a host is supported without a host runtime invocation record',
80
+ 'subagents, MCP, LSP, browser tools, hooks, and plugins as host/session-specific',
81
+ ]
82
+ const commands = [
83
+ 'record-host-invocation.mjs',
84
+ 'audit-host-runtime-invocations.mjs',
85
+ 'audit-final-readiness.mjs',
86
+ 'validate-gse.mjs',
87
+ ]
88
+ const handoffUsesShellSafeCommandPlaceholders = !/record-host-invocation\.mjs[^\n`]*[<>]/.test(handoff) &&
89
+ !/audit-[a-z-]+\.mjs[^\n`]*[<>]/.test(handoff) &&
90
+ !/validate-gse\.mjs[^\n`]*[<>]/.test(handoff) &&
91
+ handoff.includes('__GSE_OR_PROJECT__') &&
92
+ handoff.includes('__PROJECT_OR_GSE__')
93
+
94
+ const checks = [
95
+ check('HRH01', 'host runtime evidence handoff generator exists', exists('scripts/generate-host-runtime-evidence-handoff.mjs'), 'scripts/generate-host-runtime-evidence-handoff.mjs'),
96
+ check('HRH02', 'generator uses runtime audit and compatibility matrix', generator.includes('audit-host-runtime-invocations.mjs') && generator.includes('references/compatibility.md'), 'generator inputs'),
97
+ check('HRH03', 'generator produces a handoff file', generated?.status === 0 && generatedData?.status === 'written' && handoff.length > 0, generated?.stderr || out),
98
+ check('HRH04', 'handoff covers core host families', hostFamilies.every((term) => handoff.includes(term)), hostFamilies.join(', ')),
99
+ check('HRH04b', 'handoff limits host evidence plan to host matrix rows', generatedData?.summary?.hostFamilies === hostFamilies.length, `${generatedData?.summary?.hostFamilies ?? 'unknown'} generated host family row(s)`),
100
+ check('HRH05', 'handoff includes executable record and verification commands', commands.every((term) => handoff.includes(term)), commands.join(', ')),
101
+ check('HRH06', 'handoff preserves anti-overclaim boundaries', boundaries.every((term) => handoff.includes(term)), boundaries.join(', ')),
102
+ check('HRH07', 'handoff reports current native and portable runtime evidence counts', handoff.includes('Native slash-command records:') && handoff.includes('Portable text-command records:'), 'current runtime evidence summary'),
103
+ check('HRH08', 'skill routes users to host runtime evidence handoff', skill.includes('generate-host-runtime-evidence-handoff.mjs'), 'SKILL.md'),
104
+ check('HRH09', 'consolidated validator includes host runtime handoff audit', validate.includes('audit-host-runtime-evidence-handoff.mjs'), 'scripts/validate-gse.mjs'),
105
+ check('HRH10', 'release bundle includes host runtime evidence handoff', releaseGenerator.includes('host-runtime-evidence-handoff.md') && releaseAudit.includes('host-runtime-evidence-handoff.md'), 'release bundle generator and audit'),
106
+ check('HRH11', 'compatibility matrix still distinguishes documented and verified host claims', compatibility.includes('Never upgrade a host capability from `documented` to `verified`') && compatibility.includes('Host Matrix'), 'references/compatibility.md'),
107
+ check('HRH12', 'handoff command placeholders are shell-safe', handoffUsesShellSafeCommandPlaceholders, 'record and verification commands use __PLACEHOLDER__ style, not <placeholder> shell redirection syntax'),
108
+ ]
109
+
110
+ const passed = checks.filter((item) => item.status === 'passed').length
111
+ const failed = checks.length - passed
112
+ const report = {
113
+ root,
114
+ generatedAt: new Date().toISOString(),
115
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
116
+ workflows: {
117
+ hostRuntimeEvidenceHandoff: failed === 0 ? 'verified' : 'failed',
118
+ nativeSlashCommandRecords: generatedData?.summary?.nativeSlashCommandRecords ?? 'unknown',
119
+ portableTextCommandRecords: generatedData?.summary?.portableTextCommandRecords ?? 'unknown',
120
+ },
121
+ limits: [
122
+ 'This audit verifies handoff generation and claim boundaries only.',
123
+ 'It does not create real runtime evidence for Claude Code, Hermes/AION-style runtimes, WorkBuddy, or native slash-command execution.',
124
+ ],
125
+ checks,
126
+ }
127
+
128
+ function renderMarkdown(data) {
129
+ const lines = []
130
+ lines.push('# GSE Host Runtime Evidence Handoff Audit')
131
+ lines.push('')
132
+ lines.push('Generated: ' + data.generatedAt)
133
+ lines.push('Root: ' + data.root)
134
+ lines.push('')
135
+ lines.push('## Summary')
136
+ lines.push('')
137
+ lines.push('- Status: ' + data.summary.status)
138
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
139
+ lines.push('- Host runtime evidence handoff: ' + data.workflows.hostRuntimeEvidenceHandoff)
140
+ lines.push('- Native slash-command records: ' + data.workflows.nativeSlashCommandRecords)
141
+ lines.push('- Portable text-command records: ' + data.workflows.portableTextCommandRecords)
142
+ lines.push('')
143
+ lines.push('## Checks')
144
+ lines.push('')
145
+ for (const item of data.checks) {
146
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
147
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
148
+ }
149
+ lines.push('')
150
+ lines.push('## Limits')
151
+ lines.push('')
152
+ for (const item of data.limits) lines.push('- ' + item)
153
+ return lines.join('\n') + '\n'
154
+ }
155
+
156
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
157
+ else console.log(renderMarkdown(report))
158
+
159
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import { spawnSync } from 'node:child_process'
6
+
7
+ const args = process.argv.slice(2)
8
+
9
+ function readArg(name, fallback = null) {
10
+ const index = args.indexOf(name)
11
+ if (index === -1) return fallback
12
+ return args[index + 1] ?? fallback
13
+ }
14
+
15
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
16
+ const jsonOnly = args.includes('--json')
17
+ const keepFixture = args.includes('--keep-fixture')
18
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-host-runtime-drill-'))
19
+ const recordsDir = path.join(tempRoot, 'host-invocations')
20
+
21
+ function run(commandArgs) {
22
+ const result = spawnSync(process.execPath, commandArgs, {
23
+ cwd: root,
24
+ encoding: 'utf8',
25
+ windowsHide: true,
26
+ })
27
+ return {
28
+ status: result.status ?? 1,
29
+ stdout: (result.stdout ?? '').trim(),
30
+ stderr: (result.stderr ?? '').trim(),
31
+ command: [process.execPath, ...commandArgs].join(' '),
32
+ }
33
+ }
34
+
35
+ function parseJson(text) {
36
+ try {
37
+ return JSON.parse(text)
38
+ } catch {
39
+ return null
40
+ }
41
+ }
42
+
43
+ function check(id, label, ok, evidence, risk = '') {
44
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
45
+ }
46
+
47
+ function record({
48
+ fileName,
49
+ host,
50
+ hostVersion,
51
+ adapterPath,
52
+ invocationMethod,
53
+ command,
54
+ nativeSlashCommand,
55
+ portableTextCommand,
56
+ generatedPointer,
57
+ }) {
58
+ return run([
59
+ path.join(root, 'scripts', 'record-host-invocation.mjs'),
60
+ '--root',
61
+ root,
62
+ '--host',
63
+ host,
64
+ '--host-version',
65
+ hostVersion,
66
+ '--project',
67
+ 'GSE host runtime fixture',
68
+ '--adapter-path',
69
+ adapterPath,
70
+ '--invocation-method',
71
+ invocationMethod,
72
+ '--command',
73
+ command,
74
+ '--status',
75
+ 'verified',
76
+ '--evidence-owner',
77
+ 'host runtime invocation drill',
78
+ '--evidence',
79
+ 'temporary fixture record; not real host runtime evidence',
80
+ '--files-read',
81
+ '.gse/README.md,.gse/project-profile.md,.gse/state.json,.gse/goal-map.md,.gse/quality-gates.md',
82
+ '--verification-command',
83
+ 'node scripts/audit-host-runtime-invocations.mjs --records-dir <fixture>',
84
+ '--native-slash-command',
85
+ nativeSlashCommand,
86
+ '--portable-text-command',
87
+ portableTextCommand,
88
+ '--generated-pointer',
89
+ generatedPointer,
90
+ '--owner-acceptance-required',
91
+ 'false',
92
+ '--residual-risk',
93
+ 'Fixture proof only; real host runtime invocation still requires persistent project evidence.',
94
+ '--out',
95
+ path.join(recordsDir, fileName),
96
+ '--json',
97
+ ])
98
+ }
99
+
100
+ const records = [
101
+ record({
102
+ fileName: 'claude-native-fixture.md',
103
+ host: 'Claude Code-style',
104
+ hostVersion: 'fixture',
105
+ adapterPath: '.claude/commands/gse.md',
106
+ invocationMethod: 'native slash-command fixture',
107
+ command: '/gse continue',
108
+ nativeSlashCommand: 'true',
109
+ portableTextCommand: 'false',
110
+ generatedPointer: 'false',
111
+ }),
112
+ record({
113
+ fileName: 'codex-portable-fixture.md',
114
+ host: 'Codex-style',
115
+ hostVersion: 'fixture',
116
+ adapterPath: '.codex/gse-command.md',
117
+ invocationMethod: 'portable text command fixture',
118
+ command: '/gse help',
119
+ nativeSlashCommand: 'false',
120
+ portableTextCommand: 'true',
121
+ generatedPointer: 'true',
122
+ }),
123
+ record({
124
+ fileName: 'hermes-runtime-fixture.md',
125
+ host: 'Hermes/AION-style runtime',
126
+ hostVersion: 'fixture',
127
+ adapterPath: '.gse/host-adapters/hermes-runtime.md',
128
+ invocationMethod: 'runtime bridge text-command fixture',
129
+ command: '/gse continue AION',
130
+ nativeSlashCommand: 'false',
131
+ portableTextCommand: 'true',
132
+ generatedPointer: 'true',
133
+ }),
134
+ record({
135
+ fileName: 'workbuddy-fixture.md',
136
+ host: 'WorkBuddy/other IDE agents',
137
+ hostVersion: 'fixture',
138
+ adapterPath: '.gse/host-adapters/workbuddy.md',
139
+ invocationMethod: 'IDE command-palette text-command fixture',
140
+ command: '/gse continue',
141
+ nativeSlashCommand: 'false',
142
+ portableTextCommand: 'true',
143
+ generatedPointer: 'true',
144
+ }),
145
+ record({
146
+ fileName: 'generic-agent-fixture.md',
147
+ host: 'Unknown or custom host',
148
+ hostVersion: 'fixture',
149
+ adapterPath: '.gse/host-adapters/generic-agent.md',
150
+ invocationMethod: 'generic natural-language command fixture',
151
+ command: 'gse continue',
152
+ nativeSlashCommand: 'false',
153
+ portableTextCommand: 'true',
154
+ generatedPointer: 'true',
155
+ }),
156
+ ]
157
+
158
+ const audit = run([
159
+ path.join(root, 'scripts', 'audit-host-runtime-invocations.mjs'),
160
+ '--root',
161
+ root,
162
+ '--records-dir',
163
+ recordsDir,
164
+ '--json',
165
+ ])
166
+ const auditData = parseJson(audit.stdout)
167
+ const recordData = records.map((item) => parseJson(item.stdout))
168
+ const recordWrites = recordData.filter((item) => item?.status === 'written').length
169
+ const hostSet = new Set(auditData?.inventory?.hosts ?? [])
170
+ const expectedHosts = [
171
+ 'Claude Code-style',
172
+ 'Codex-style',
173
+ 'Hermes/AION-style runtime',
174
+ 'WorkBuddy/other IDE agents',
175
+ 'Unknown or custom host',
176
+ ]
177
+
178
+ const checks = [
179
+ check('HRD01', 'all fixture host records are written', records.every((item) => item.status === 0) && recordWrites === records.length, `${recordWrites}/${records.length} fixture records`),
180
+ check('HRD02', 'host runtime invocation audit passes over fixture records', audit.status === 0 && auditData?.summary?.status === 'passed', audit.command),
181
+ check('HRD03', 'fixture inventory covers expected host families', expectedHosts.every((host) => hostSet.has(host)), expectedHosts.join(', ')),
182
+ check('HRD04', 'native slash-command evidence stays isolated to the Claude fixture', auditData?.inventory?.nativeSlashCommandRecords === 1, `${auditData?.inventory?.nativeSlashCommandRecords ?? 'unknown'} native record(s)`),
183
+ check('HRD05', 'portable text-command evidence covers non-native fixtures', auditData?.inventory?.portableTextCommandRecords === 4, `${auditData?.inventory?.portableTextCommandRecords ?? 'unknown'} portable record(s)`),
184
+ check('HRD06', 'drill evidence is not persisted as real host evidence', !fs.existsSync(path.join(root, '.gse', 'evidence', 'host-invocations', 'claude-native-fixture.md')), 'fixture stays outside persistent evidence directory'),
185
+ ]
186
+
187
+ if (!keepFixture) fs.rmSync(tempRoot, { recursive: true, force: true })
188
+
189
+ const passed = checks.filter((item) => item.status === 'passed').length
190
+ const failed = checks.length - passed
191
+ const report = {
192
+ root,
193
+ generatedAt: new Date().toISOString(),
194
+ tempRoot: keepFixture ? tempRoot : null,
195
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
196
+ workflows: {
197
+ hostRuntimeInvocationDrill: failed === 0 ? 'verified' : 'failed',
198
+ fixtureNativeSlashCommandRecords: auditData?.inventory?.nativeSlashCommandRecords ?? 0,
199
+ fixturePortableTextCommandRecords: auditData?.inventory?.portableTextCommandRecords ?? 0,
200
+ },
201
+ limits: [
202
+ 'This drill uses temporary fixture records only.',
203
+ 'It proves record and audit mechanics across host families, not real host runtime support.',
204
+ 'Real native slash-command or runtime support still requires persistent host invocation records from actual host sessions.',
205
+ ],
206
+ checks,
207
+ }
208
+
209
+ function renderMarkdown(data) {
210
+ const lines = []
211
+ lines.push('# GSE Host Runtime Invocation Drill')
212
+ lines.push('')
213
+ lines.push('Generated: ' + data.generatedAt)
214
+ lines.push('Root: ' + data.root)
215
+ lines.push('')
216
+ lines.push('## Summary')
217
+ lines.push('')
218
+ lines.push('- Status: ' + data.summary.status)
219
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
220
+ lines.push('- Host runtime invocation drill: ' + data.workflows.hostRuntimeInvocationDrill)
221
+ lines.push('- Fixture native slash-command records: ' + data.workflows.fixtureNativeSlashCommandRecords)
222
+ lines.push('- Fixture portable text-command records: ' + data.workflows.fixturePortableTextCommandRecords)
223
+ lines.push('')
224
+ lines.push('## Checks')
225
+ lines.push('')
226
+ for (const item of data.checks) {
227
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
228
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
229
+ }
230
+ lines.push('')
231
+ lines.push('## Limits')
232
+ lines.push('')
233
+ for (const item of data.limits) lines.push('- ' + item)
234
+ return lines.join('\n') + '\n'
235
+ }
236
+
237
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
238
+ else console.log(renderMarkdown(report))
239
+
240
+ if (failed > 0) process.exit(1)
@@ -0,0 +1,254 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import { spawnSync } from 'node:child_process'
6
+
7
+ const args = process.argv.slice(2)
8
+
9
+ function readArg(name, fallback = null) {
10
+ const index = args.indexOf(name)
11
+ if (index === -1) return fallback
12
+ return args[index + 1] ?? fallback
13
+ }
14
+
15
+ const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
16
+ const recordsDir = path.resolve(readArg('--records-dir', path.join(root, '.gse', 'evidence', 'host-invocations')))
17
+ const jsonOnly = args.includes('--json')
18
+
19
+ function read(relativePathOrFullPath) {
20
+ const fullPath = path.isAbsolute(relativePathOrFullPath) ? relativePathOrFullPath : path.join(root, relativePathOrFullPath)
21
+ return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8').replace(/^\uFEFF/, '') : ''
22
+ }
23
+
24
+ function exists(relativePath) {
25
+ return fs.existsSync(path.join(root, relativePath))
26
+ }
27
+
28
+ function check(id, label, ok, evidence, risk = '') {
29
+ return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
30
+ }
31
+
32
+ function run(commandArgs) {
33
+ const result = spawnSync(process.execPath, [path.join(root, 'scripts', 'record-host-invocation.mjs'), ...commandArgs], {
34
+ cwd: root,
35
+ encoding: 'utf8',
36
+ windowsHide: true,
37
+ })
38
+ return {
39
+ status: result.status ?? 1,
40
+ stdout: (result.stdout ?? '').trim(),
41
+ stderr: (result.stderr ?? '').trim(),
42
+ }
43
+ }
44
+
45
+ function parseJson(text) {
46
+ try {
47
+ return JSON.parse(text)
48
+ } catch {
49
+ return null
50
+ }
51
+ }
52
+
53
+ function listRecords(dir) {
54
+ if (!fs.existsSync(dir)) return []
55
+ return fs.readdirSync(dir)
56
+ .filter((item) => item.endsWith('.md'))
57
+ .map((item) => path.join(dir, item))
58
+ }
59
+
60
+ function parseRecord(filePath) {
61
+ const text = read(filePath)
62
+ const field = (label) => {
63
+ const prefix = label.endsWith('?') ? '- ' + label + ' ' : '- ' + label + ':'
64
+ const line = text.split(/\r?\n/).find((item) => item.trimStart().startsWith(prefix))
65
+ return line ? line.slice(line.indexOf(prefix) + prefix.length).trim() : ''
66
+ }
67
+ return {
68
+ filePath,
69
+ text,
70
+ host: field('Host name'),
71
+ status: field('Status'),
72
+ nativeSlashCommand: field('Does this prove native slash-command support?'),
73
+ portableTextCommand: field('Does this prove portable text-command routing only?'),
74
+ generatedPointer: field('Does this rely on a generated pointer file?'),
75
+ ownerAcceptanceRequired: field('Does this require owner acceptance before being called trusted?'),
76
+ verificationCommand: field('Verification command'),
77
+ }
78
+ }
79
+
80
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-host-invocation-audit-'))
81
+ const fixtureOut = path.join(fixture, 'codex-record.md')
82
+ const readyRun = run([
83
+ '--root',
84
+ root,
85
+ '--host',
86
+ 'Codex',
87
+ '--host-version',
88
+ 'fixture',
89
+ '--project',
90
+ 'GSE fixture',
91
+ '--adapter-path',
92
+ '.codex/gse-command.md',
93
+ '--invocation-method',
94
+ 'background-thread text command',
95
+ '--command',
96
+ '/gse help',
97
+ '--status',
98
+ 'verified',
99
+ '--evidence-owner',
100
+ 'fixture audit',
101
+ '--evidence',
102
+ 'fixture transcript',
103
+ '--portable-text-command',
104
+ 'true',
105
+ '--native-slash-command',
106
+ 'false',
107
+ '--generated-pointer',
108
+ 'true',
109
+ '--owner-acceptance-required',
110
+ 'false',
111
+ '--out',
112
+ fixtureOut,
113
+ '--json',
114
+ ])
115
+ const readyData = parseJson(readyRun.stdout)
116
+ const missingRun = run(['--root', root, '--host', 'Codex', '--dry-run', '--json'])
117
+ const missingData = parseJson(missingRun.stdout)
118
+ const contradictoryRun = run([
119
+ '--root',
120
+ root,
121
+ '--host',
122
+ 'Codex',
123
+ '--invocation-method',
124
+ 'native slash command',
125
+ '--status',
126
+ 'accepted',
127
+ '--evidence-owner',
128
+ 'fixture audit',
129
+ '--evidence',
130
+ 'fixture transcript',
131
+ '--native-slash-command',
132
+ 'true',
133
+ '--portable-text-command',
134
+ 'true',
135
+ '--generated-pointer',
136
+ 'true',
137
+ '--owner-acceptance-required',
138
+ 'false',
139
+ '--dry-run',
140
+ '--json',
141
+ ])
142
+ const contradictoryData = parseJson(contradictoryRun.stdout)
143
+ const acceptedPointerRun = run([
144
+ '--root',
145
+ root,
146
+ '--host',
147
+ 'Generic pointer host',
148
+ '--invocation-method',
149
+ 'generated pointer',
150
+ '--status',
151
+ 'accepted',
152
+ '--evidence-owner',
153
+ 'fixture audit',
154
+ '--evidence',
155
+ 'fixture transcript',
156
+ '--verification-command',
157
+ 'node scripts/audit-final-readiness.mjs --root __GSE__ --json',
158
+ '--native-slash-command',
159
+ 'false',
160
+ '--portable-text-command',
161
+ 'false',
162
+ '--generated-pointer',
163
+ 'true',
164
+ '--owner-acceptance-required',
165
+ 'false',
166
+ '--dry-run',
167
+ '--json',
168
+ ])
169
+ const acceptedPointerData = parseJson(acceptedPointerRun.stdout)
170
+
171
+ const records = listRecords(recordsDir).map(parseRecord)
172
+ const closeableRecords = records.filter((record) => ['verified', 'accepted'].includes(record.status))
173
+ const nativeRecords = closeableRecords.filter((record) => record.nativeSlashCommand === 'true')
174
+ const portableRecords = closeableRecords.filter((record) => record.portableTextCommand === 'true')
175
+ const hostNames = [...new Set(closeableRecords.map((record) => record.host).filter(Boolean))]
176
+ const recordsHaveNoContradictoryClaims = records.every((record) => !(record.nativeSlashCommand === 'true' && (record.portableTextCommand === 'true' || record.generatedPointer === 'true')))
177
+ const acceptedRecordsAreSelfVerifying = records.every((record) => record.status !== 'accepted' || (record.ownerAcceptanceRequired === 'false' && Boolean(record.verificationCommand)))
178
+ const acceptedRecordsDoNotRelyOnGeneratedPointers = records.every((record) => record.status !== 'accepted' || record.generatedPointer !== 'true')
179
+
180
+ const checks = [
181
+ check('HRI01', 'host invocation record command exists', exists('scripts/record-host-invocation.mjs'), 'scripts/record-host-invocation.mjs'),
182
+ check('HRI02', 'host invocation record command writes a valid fixture record', readyRun.status === 0 && readyData?.status === 'written' && fs.existsSync(fixtureOut) && read(fixtureOut).includes('Host name: Codex'), 'record-host-invocation fixture write'),
183
+ check('HRI03', 'host invocation record command rejects missing required fields', missingRun.status !== 0 && missingData?.status === 'failed' && missingData?.errors?.some((item) => item.includes('--invocation-method')) && missingData?.errors?.some((item) => item.includes('--evidence-owner')), 'record-host-invocation missing-fields dry-run'),
184
+ check('HRI04', 'host invocation template preserves boundaries', read('assets/templates/host-ui-invocation-record.md').includes('Does this prove native slash-command support?') && read('assets/templates/host-ui-invocation-record.md').includes('Does this prove portable text-command routing only?'), 'assets/templates/host-ui-invocation-record.md'),
185
+ check('HRI05', 'host invocation readiness audit is wired into validator', read('scripts/validate-gse.mjs').includes('audit-host-runtime-invocations.mjs'), 'scripts/validate-gse.mjs'),
186
+ check('HRI06', 'existing host invocation records, if present, parse with required status fields', records.every((record) => record.host && record.status && record.nativeSlashCommand && record.portableTextCommand), records.length ? `${records.length} record(s)` : 'no persistent records yet'),
187
+ check('HRI07', 'record command rejects contradictory native and portable claims', contradictoryRun.status !== 0 && contradictoryData?.status === 'failed' && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot also claim portable text-command routing')) && contradictoryData?.errors?.some((item) => item.includes('native slash-command records cannot rely on a generated pointer file')), 'record-host-invocation contradictory native/portable dry-run'),
188
+ check('HRI08', 'persistent host invocation records do not mix native proof with portable or generated-pointer proof', recordsHaveNoContradictoryClaims, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
189
+ check('HRI09', 'accepted persistent host invocation records carry verification commands and no pending owner acceptance', acceptedRecordsAreSelfVerifying, records.length ? `${records.length} record(s)` : 'no persistent records yet'),
190
+ check('HRI10', 'accepted host invocation records do not rely on generated pointer proof', acceptedPointerRun.status !== 0 && acceptedPointerData?.status === 'failed' && acceptedPointerData?.errors?.some((item) => item.includes('accepted host invocation records must not rely on a generated pointer file')) && acceptedRecordsDoNotRelyOnGeneratedPointers, records.length ? `${records.length} record(s)` : 'record-host-invocation accepted pointer dry-run'),
191
+ ]
192
+
193
+ fs.rmSync(fixture, { recursive: true, force: true })
194
+
195
+ const passed = checks.filter((item) => item.status === 'passed').length
196
+ const failed = checks.length - passed
197
+ const report = {
198
+ root,
199
+ recordsDir,
200
+ generatedAt: new Date().toISOString(),
201
+ summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
202
+ workflows: {
203
+ hostRuntimeInvocationRecords: failed === 0 ? 'verified' : 'failed',
204
+ realHostNativeSlashCommandRecords: nativeRecords.length,
205
+ realHostPortableTextCommandRecords: portableRecords.length,
206
+ },
207
+ inventory: {
208
+ records: records.length,
209
+ closeableRecords: closeableRecords.length,
210
+ hosts: hostNames,
211
+ nativeSlashCommandRecords: nativeRecords.length,
212
+ portableTextCommandRecords: portableRecords.length,
213
+ },
214
+ limits: [
215
+ 'This audit verifies host invocation record mechanics and parses any persistent records under .gse/evidence/host-invocations.',
216
+ 'It does not create runtime evidence for a host by itself.',
217
+ 'Native slash-command support remains unverified for a host until a persistent verified or accepted record states native slash-command support true.',
218
+ ],
219
+ checks,
220
+ }
221
+
222
+ function renderMarkdown(data) {
223
+ const lines = []
224
+ lines.push('# GSE Host Runtime Invocation Records Audit')
225
+ lines.push('')
226
+ lines.push('Generated: ' + data.generatedAt)
227
+ lines.push('Root: ' + data.root)
228
+ lines.push('')
229
+ lines.push('## Summary')
230
+ lines.push('')
231
+ lines.push('- Status: ' + data.summary.status)
232
+ lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
233
+ lines.push('- Records: ' + data.inventory.records)
234
+ lines.push('- Hosts: ' + (data.inventory.hosts.length ? data.inventory.hosts.join(', ') : 'none'))
235
+ lines.push('- Native slash-command records: ' + data.inventory.nativeSlashCommandRecords)
236
+ lines.push('- Portable text-command records: ' + data.inventory.portableTextCommandRecords)
237
+ lines.push('')
238
+ lines.push('## Checks')
239
+ lines.push('')
240
+ for (const item of data.checks) {
241
+ const marker = item.status === 'passed' ? '[x]' : '[ ]'
242
+ lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
243
+ }
244
+ lines.push('')
245
+ lines.push('## Limits')
246
+ lines.push('')
247
+ for (const item of data.limits) lines.push('- ' + item)
248
+ return lines.join('\n') + '\n'
249
+ }
250
+
251
+ if (jsonOnly) console.log(JSON.stringify(report, null, 2))
252
+ else console.log(renderMarkdown(report))
253
+
254
+ if (failed > 0) process.exit(1)