@t275005746/gse 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.yml +42 -0
- package/.github/ISSUE_TEMPLATE/change_request.yml +50 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- package/.github/workflows/validate-gse.yml +33 -0
- package/.gse/README.md +18 -0
- package/.gse/gse-development-protocol.md +50 -0
- package/.gse/project-profile.md +29 -0
- package/.gse/quality-gates.md +25 -0
- package/.gse/releases/public-channel-publication-pending.md +49 -0
- package/.gse/releases/public-ci-run-pending.md +53 -0
- package/.gse/releases/public-release-owner-required.md +65 -0
- package/.gse/releases/public-repository-settings-owner-required.md +59 -0
- package/.gse/releases/public-security-contact-owner-required.md +45 -0
- package/.gse/state.json +27 -0
- package/CHANGELOG.md +24 -0
- package/CONTRIBUTING.md +64 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/README.zh-CN.md +236 -0
- package/SECURITY.md +41 -0
- package/SKILL.md +148 -0
- package/SUPPORT.md +38 -0
- package/agents/openai.yaml +4 -0
- package/assets/marketplace/README.md +7 -0
- package/assets/marketplace/gse-listing.json +75 -0
- package/assets/templates/acceptance-execution-packet.md +73 -0
- package/assets/templates/adr.md +14 -0
- package/assets/templates/change-brief.md +16 -0
- package/assets/templates/design.md +18 -0
- package/assets/templates/dispatch-packet.md +104 -0
- package/assets/templates/evidence.md +14 -0
- package/assets/templates/execution-quality-pack.md +65 -0
- package/assets/templates/goal-map.md +21 -0
- package/assets/templates/host-adapter.md +48 -0
- package/assets/templates/host-ui-invocation-record.md +42 -0
- package/assets/templates/incident-review.md +60 -0
- package/assets/templates/public-channel-publication-record.md +49 -0
- package/assets/templates/public-ci-run-record.md +53 -0
- package/assets/templates/public-release-record.md +65 -0
- package/assets/templates/public-repository-settings-record.md +59 -0
- package/assets/templates/public-security-contact-record.md +45 -0
- package/assets/templates/release-trust-record.md +32 -0
- package/assets/templates/review.md +18 -0
- package/assets/templates/spec.md +16 -0
- package/assets/templates/target-adoption-evidence.md +29 -0
- package/assets/templates/tasks.md +17 -0
- package/assets/templates/update-release-acceptance-record.md +58 -0
- package/examples/README.md +22 -0
- package/examples/agent-runtime-host/.claude/gse-adapter.md +6 -0
- package/examples/agent-runtime-host/.codex/gse-adapter.md +7 -0
- package/examples/agent-runtime-host/.gse/goal-map.md +7 -0
- package/examples/agent-runtime-host/.gse/project-profile.md +27 -0
- package/examples/agent-runtime-host/.gse/tooling.md +5 -0
- package/examples/agent-runtime-host/.mcp.json +9 -0
- package/examples/agent-runtime-host/AGENTS.md +5 -0
- package/examples/agent-runtime-host/README.md +10 -0
- package/examples/agent-runtime-host/docs/model-routing.md +5 -0
- package/examples/cli-tool/.gse/project-profile.md +21 -0
- package/examples/cli-tool/AGENTS.md +5 -0
- package/examples/cli-tool/README.md +12 -0
- package/examples/cli-tool/package.json +21 -0
- package/examples/small-app/.env.example +2 -0
- package/examples/small-app/.github/workflows/ci.yml +8 -0
- package/examples/small-app/AGENTS.md +5 -0
- package/examples/small-app/README.md +12 -0
- package/examples/small-app/package.json +26 -0
- package/examples/small-app/playwright.config.ts +4 -0
- package/package.json +53 -0
- package/references/adoption-recipes.md +171 -0
- package/references/agent-roles.md +49 -0
- package/references/architecture-health.md +101 -0
- package/references/benchmark-audit.md +73 -0
- package/references/commands.md +295 -0
- package/references/community-channels.md +46 -0
- package/references/compatibility.md +70 -0
- package/references/design-basis.md +38 -0
- package/references/domain-model.md +129 -0
- package/references/domain-quality-gates.md +75 -0
- package/references/drift-audit.md +81 -0
- package/references/evidence-taxonomy.md +123 -0
- package/references/file-ownership.md +107 -0
- package/references/final-readiness.md +84 -0
- package/references/forward-test.md +133 -0
- package/references/goal-map.md +36 -0
- package/references/host-adapters.md +119 -0
- package/references/learning-system.md +35 -0
- package/references/marketplace-discovery.md +46 -0
- package/references/model-routing.md +103 -0
- package/references/open-source-defaults.md +39 -0
- package/references/operating-model.md +52 -0
- package/references/packaging.md +277 -0
- package/references/project-agent-workspace.md +89 -0
- package/references/project-bootstrap.md +122 -0
- package/references/project-profile.md +57 -0
- package/references/public-release.md +174 -0
- package/references/quality-gates.md +100 -0
- package/references/recovery.md +176 -0
- package/references/release-trust.md +43 -0
- package/references/release.md +126 -0
- package/references/review.md +141 -0
- package/references/router.md +90 -0
- package/references/spec-workflow.md +66 -0
- package/references/task-levels.md +81 -0
- package/references/tool-adapters.md +73 -0
- package/scripts/audit-acceptance-execution-packet.mjs +133 -0
- package/scripts/audit-adoption-recipes.mjs +99 -0
- package/scripts/audit-adoption.mjs +154 -0
- package/scripts/audit-change-lifecycle.mjs +77 -0
- package/scripts/audit-change-system.mjs +134 -0
- package/scripts/audit-ci-readiness.mjs +107 -0
- package/scripts/audit-close-gate.mjs +323 -0
- package/scripts/audit-command-adapters.mjs +91 -0
- package/scripts/audit-command-execution.mjs +210 -0
- package/scripts/audit-commands.mjs +117 -0
- package/scripts/audit-compatibility.mjs +149 -0
- package/scripts/audit-completion-readiness.mjs +292 -0
- package/scripts/audit-distribution.mjs +251 -0
- package/scripts/audit-domain-quality-gates.mjs +108 -0
- package/scripts/audit-evidence-placeholders.mjs +126 -0
- package/scripts/audit-final-acceptance-packet.mjs +148 -0
- package/scripts/audit-final-form-progress-report.mjs +161 -0
- package/scripts/audit-final-form-stale-copy.mjs +221 -0
- package/scripts/audit-final-readiness-promotion.mjs +255 -0
- package/scripts/audit-final-readiness.mjs +226 -0
- package/scripts/audit-fixtures.mjs +154 -0
- package/scripts/audit-fresh-session-readiness.mjs +177 -0
- package/scripts/audit-gse.mjs +275 -0
- package/scripts/audit-host-adapters.mjs +119 -0
- package/scripts/audit-host-runtime-evidence-handoff.mjs +159 -0
- package/scripts/audit-host-runtime-invocation-drill.mjs +240 -0
- package/scripts/audit-host-runtime-invocations.mjs +254 -0
- package/scripts/audit-host-ui-invocation.mjs +132 -0
- package/scripts/audit-learning-system.mjs +103 -0
- package/scripts/audit-local-final-form-completion.mjs +131 -0
- package/scripts/audit-marketplace-discovery.mjs +122 -0
- package/scripts/audit-npm-package-metadata.mjs +155 -0
- package/scripts/audit-npm-publish-dry-run.mjs +169 -0
- package/scripts/audit-npm-tarball-install.mjs +191 -0
- package/scripts/audit-open-source-defaults.mjs +92 -0
- package/scripts/audit-open-source-readiness.mjs +97 -0
- package/scripts/audit-owner-external-gate-kit.mjs +218 -0
- package/scripts/audit-project.mjs +323 -0
- package/scripts/audit-public-acceptance-command-dry-run-drill.mjs +203 -0
- package/scripts/audit-public-acceptance-handoff.mjs +142 -0
- package/scripts/audit-public-acceptance-readiness.mjs +224 -0
- package/scripts/audit-public-channel-publication.mjs +248 -0
- package/scripts/audit-public-ci-run.mjs +184 -0
- package/scripts/audit-public-collaboration-templates.mjs +98 -0
- package/scripts/audit-public-external-gate-probe.mjs +206 -0
- package/scripts/audit-public-release-checklist.mjs +133 -0
- package/scripts/audit-public-release-decision.mjs +201 -0
- package/scripts/audit-public-release-metadata.mjs +176 -0
- package/scripts/audit-public-repository-settings.mjs +237 -0
- package/scripts/audit-public-security-contact.mjs +171 -0
- package/scripts/audit-readme-docs.mjs +185 -0
- package/scripts/audit-recovery-readiness.mjs +98 -0
- package/scripts/audit-release-bundle.mjs +251 -0
- package/scripts/audit-release-owner-action-plan-drill.mjs +277 -0
- package/scripts/audit-release-owner-action-plan.mjs +164 -0
- package/scripts/audit-release-readiness.mjs +106 -0
- package/scripts/audit-release-status-manifest.mjs +165 -0
- package/scripts/audit-release-trust.mjs +62 -0
- package/scripts/audit-remote-distribution.mjs +266 -0
- package/scripts/audit-roadmap-consistency.mjs +235 -0
- package/scripts/audit-signing.mjs +147 -0
- package/scripts/audit-state-freshness.mjs +113 -0
- package/scripts/audit-target-adoption-evidence.mjs +117 -0
- package/scripts/audit-target-project.mjs +507 -0
- package/scripts/audit-update-release-acceptance.mjs +136 -0
- package/scripts/audit-v1-target-validation.mjs +269 -0
- package/scripts/audit-validation-profiles.mjs +125 -0
- package/scripts/close-change.mjs +116 -0
- package/scripts/discover-project-profile.mjs +307 -0
- package/scripts/forward-test-gse.mjs +146 -0
- package/scripts/generate-command-adapter.mjs +231 -0
- package/scripts/generate-final-acceptance-packet.mjs +181 -0
- package/scripts/generate-final-form-progress-report.mjs +205 -0
- package/scripts/generate-host-adapter.mjs +73 -0
- package/scripts/generate-host-runtime-evidence-handoff.mjs +206 -0
- package/scripts/generate-owner-external-gate-kit.mjs +295 -0
- package/scripts/generate-public-acceptance-handoff.mjs +168 -0
- package/scripts/generate-public-release-checklist.mjs +207 -0
- package/scripts/generate-release-bundle.mjs +505 -0
- package/scripts/generate-release-owner-action-plan.mjs +172 -0
- package/scripts/generate-release-status-manifest.mjs +200 -0
- package/scripts/generate-session-prompt.mjs +188 -0
- package/scripts/gse.mjs +67 -0
- package/scripts/init-change.mjs +265 -0
- package/scripts/init-project.mjs +785 -0
- package/scripts/install-gse.mjs +234 -0
- package/scripts/lib/evidence-placeholders.mjs +28 -0
- package/scripts/package-gse.mjs +174 -0
- package/scripts/probe-public-external-gates.mjs +167 -0
- package/scripts/record-host-invocation.mjs +151 -0
- package/scripts/record-learning.mjs +137 -0
- package/scripts/record-public-channel-publication.mjs +178 -0
- package/scripts/record-public-ci-run.mjs +180 -0
- package/scripts/record-public-release.mjs +175 -0
- package/scripts/record-public-repository-settings.mjs +209 -0
- package/scripts/record-public-security-contact.mjs +157 -0
- package/scripts/run-gse-command.mjs +538 -0
- package/scripts/run-validation-profile.mjs +146 -0
- package/scripts/sign-gse-package.mjs +83 -0
- package/scripts/update-project-state.mjs +223 -0
- package/scripts/validate-gse.mjs +1168 -0
- package/scripts/verify-gse-package.mjs +85 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Task Levels
|
|
2
|
+
|
|
3
|
+
Classify before choosing process weight.
|
|
4
|
+
|
|
5
|
+
## Level 1 - Lite
|
|
6
|
+
|
|
7
|
+
Use for small bugs, small UI/copy changes, scripts, docs, and narrow refactors.
|
|
8
|
+
|
|
9
|
+
Required artifacts:
|
|
10
|
+
|
|
11
|
+
- Inline `Outcome / Scope / Acceptance / Evidence / Next action`
|
|
12
|
+
- Focused verification command or manual evidence
|
|
13
|
+
- Learning only when reusable
|
|
14
|
+
|
|
15
|
+
No change folder required.
|
|
16
|
+
|
|
17
|
+
Gate profile:
|
|
18
|
+
|
|
19
|
+
- Run the narrowest focused test, smoke, structural check, or manual evidence that proves the changed behavior.
|
|
20
|
+
- Do not run build/typecheck/browser/full close gates by default unless the changed file or failure mode specifically requires them.
|
|
21
|
+
- Keep evidence inline or in the existing slice log; do not create long process artifacts for tiny state-only changes.
|
|
22
|
+
|
|
23
|
+
## Level 2 - Standard
|
|
24
|
+
|
|
25
|
+
Use for user-visible features, API changes, state-machine branches, cross-file behavior, or work expected to take more than one focused slice.
|
|
26
|
+
|
|
27
|
+
Required artifacts:
|
|
28
|
+
|
|
29
|
+
- Goal-map binding or project issue link
|
|
30
|
+
- `.gse/changes/<change-id>/brief.md`
|
|
31
|
+
- Acceptance and evidence log
|
|
32
|
+
- Focused tests or smoke verification
|
|
33
|
+
|
|
34
|
+
Use OpenSpec or Comet when available and suitable.
|
|
35
|
+
|
|
36
|
+
Gate profile:
|
|
37
|
+
|
|
38
|
+
- Run focused tests for changed behavior and one integration/API/UI smoke when the user-visible path needs it.
|
|
39
|
+
- Run build/typecheck before commit when the slice touches shared TypeScript contracts, Next routing/build-time code, generated package shape, or release/install paths.
|
|
40
|
+
- Prefer combining several tiny state-only changes into one user-visible product chain instead of committing each micro-state transition separately.
|
|
41
|
+
|
|
42
|
+
## Level 3 - Enterprise
|
|
43
|
+
|
|
44
|
+
Use for long-running product work, security, payments, data migrations, public contracts, release readiness, multi-agent coordination, or architecture changes.
|
|
45
|
+
|
|
46
|
+
Required artifacts:
|
|
47
|
+
|
|
48
|
+
- Goal-map node
|
|
49
|
+
- Spec or RFC
|
|
50
|
+
- Design notes, state machine, or risk matrix when relevant
|
|
51
|
+
- Quality gates and rollback plan
|
|
52
|
+
- Review and evidence
|
|
53
|
+
- Learning review after completion
|
|
54
|
+
|
|
55
|
+
Use OpenSpec, Comet, subagents, CI gates, browser automation, and ADRs when available.
|
|
56
|
+
|
|
57
|
+
Gate profile:
|
|
58
|
+
|
|
59
|
+
- Run focused verification plus the relevant hard gate for the risk: build, browser smoke, API smoke, install/distribution audit, security check, migration check, or close gate.
|
|
60
|
+
- Use full validation only for release, public contract, scaffold/skill, install, cross-host, or high-blast-radius changes.
|
|
61
|
+
- Keep evidence concise even when gates are heavy; link or summarize outputs instead of pasting logs.
|
|
62
|
+
|
|
63
|
+
## Upgrade Triggers
|
|
64
|
+
|
|
65
|
+
Upgrade one level when:
|
|
66
|
+
|
|
67
|
+
- Scope touches 3+ modules.
|
|
68
|
+
- A public API, data model, security boundary, or release process changes.
|
|
69
|
+
- Failure would block users or corrupt data.
|
|
70
|
+
- The same issue recurred.
|
|
71
|
+
- The task needs multiple agents or multiple sessions.
|
|
72
|
+
|
|
73
|
+
## Slice Sizing
|
|
74
|
+
|
|
75
|
+
Prefer a slice that proves one user-visible chain or one production capability boundary.
|
|
76
|
+
|
|
77
|
+
- Too small: only flips an internal status with no visible capability, no contract change, and no risk reduction.
|
|
78
|
+
- Healthy: covers a coherent path such as `bundle ShotSpec -> shot acceptance -> QA seed`, with focused tests proving the path.
|
|
79
|
+
- Too large: mixes unrelated product flows, broad refactors, and release/process changes that cannot be verified in one evidence pass.
|
|
80
|
+
|
|
81
|
+
For long-running productization, merge adjacent tiny state-machine steps when they are only meaningful together, but keep the acceptance proof focused.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Tool Adapters
|
|
2
|
+
|
|
3
|
+
GSE has few hard requirements. Tools enhance the workflow when available.
|
|
4
|
+
|
|
5
|
+
## Minimum Tools
|
|
6
|
+
|
|
7
|
+
- Git
|
|
8
|
+
- A shell
|
|
9
|
+
- Project build/test commands when present
|
|
10
|
+
|
|
11
|
+
Recommended:
|
|
12
|
+
|
|
13
|
+
- `rg` / `rg --files` for search
|
|
14
|
+
- LSP for symbol navigation
|
|
15
|
+
- Browser or Playwright for UI verification
|
|
16
|
+
|
|
17
|
+
## Context and Code Location
|
|
18
|
+
|
|
19
|
+
Use in order:
|
|
20
|
+
|
|
21
|
+
1. Project rules: `AGENTS.md`, `CLAUDE.md`, README, or equivalent.
|
|
22
|
+
2. `.gse/project-profile.md` for project-specific standards, commands, tools, and permissions.
|
|
23
|
+
3. `.gse/README.md` and `goal-map.md` when present.
|
|
24
|
+
4. `rg --files` and `rg` to find relevant code.
|
|
25
|
+
5. LSP or code index when available.
|
|
26
|
+
6. Existing tests and recent commits.
|
|
27
|
+
|
|
28
|
+
Avoid broad reads of generated outputs, logs, lockfiles, or historical archives unless required.
|
|
29
|
+
|
|
30
|
+
## Project-Specific Tools
|
|
31
|
+
|
|
32
|
+
Use `references/drift-audit.md` when recorded tool status, command assumptions, MCP, LSP/index, browser, CI, package manager, or deployment facts may be stale.
|
|
33
|
+
|
|
34
|
+
Use `project-profile.md` to record tool connections and status.
|
|
35
|
+
|
|
36
|
+
Status vocabulary:
|
|
37
|
+
|
|
38
|
+
- `verified`: command/config was tested or documented in a trusted project file.
|
|
39
|
+
- `documented`: project docs mention it, but this session has not tested it.
|
|
40
|
+
- `unknown`: not confirmed.
|
|
41
|
+
- `unavailable`: expected but missing or failing.
|
|
42
|
+
|
|
43
|
+
Project-specific commands and standards override generic recommendations. If the project says to use `pnpm`, `bun`, `make`, a custom smoke script, a specific LSP/index, or a private MCP server, follow that after verifying it is present or documenting its status.
|
|
44
|
+
|
|
45
|
+
## Model Routing
|
|
46
|
+
|
|
47
|
+
Use `references/model-routing.md` when choosing model, provider, hosted tool, worker, or role-specific agent capability. Record documented vs verified behavior separately.
|
|
48
|
+
|
|
49
|
+
## Host Adapters
|
|
50
|
+
|
|
51
|
+
Use `references/host-adapters.md` and `references/compatibility.md` when a project has `.codex/`, `.claude/`, `.agents/`, Hermes/AION-style runtime folders, WorkBuddy settings, MCP configs, hooks, local skills, or other host-specific workflow files.
|
|
52
|
+
|
|
53
|
+
Host adapters are pointers and capability maps. They should not duplicate `.gse/goal-map.md`, `.gse/quality-gates.md`, or `.gse/evidence/`.
|
|
54
|
+
|
|
55
|
+
## OpenSpec
|
|
56
|
+
|
|
57
|
+
Use for capability specs and acceptance deltas. Fall back to `.gse/changes/` markdown when unavailable.
|
|
58
|
+
|
|
59
|
+
## Comet
|
|
60
|
+
|
|
61
|
+
Use for full change lifecycle when installed and suitable. Fall back to GSE change folders when unavailable.
|
|
62
|
+
|
|
63
|
+
## Superpowers
|
|
64
|
+
|
|
65
|
+
Use for complex plans, subagent-driven execution, and staged review. Do not force it on Level 1 work.
|
|
66
|
+
|
|
67
|
+
## Self-Improvement
|
|
68
|
+
|
|
69
|
+
Use when a user correction, repeated failure, tool gap, non-obvious root cause, or better recurring method is discovered.
|
|
70
|
+
|
|
71
|
+
## Subagents
|
|
72
|
+
|
|
73
|
+
Use when actual tools exist, such as `spawn_agent` / `wait_agent` or thread dispatch equivalents. Do not claim delegation when the tools are absent.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2)
|
|
6
|
+
|
|
7
|
+
function readArg(name, fallback = null) {
|
|
8
|
+
const index = args.indexOf(name)
|
|
9
|
+
if (index === -1) return fallback
|
|
10
|
+
return args[index + 1] ?? fallback
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
14
|
+
const jsonOnly = args.includes('--json')
|
|
15
|
+
|
|
16
|
+
function read(relativePath) {
|
|
17
|
+
const fullPath = path.join(root, relativePath)
|
|
18
|
+
return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function exists(relativePath) {
|
|
22
|
+
return fs.existsSync(path.join(root, relativePath))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
26
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const template = read('assets/templates/acceptance-execution-packet.md')
|
|
30
|
+
const forwardTest = read('references/forward-test.md')
|
|
31
|
+
const recipes = read('references/adoption-recipes.md')
|
|
32
|
+
const validate = read('scripts/validate-gse.mjs')
|
|
33
|
+
|
|
34
|
+
const fields = [
|
|
35
|
+
'Acceptance path:',
|
|
36
|
+
'Target project or session:',
|
|
37
|
+
'Purpose:',
|
|
38
|
+
'Required inputs:',
|
|
39
|
+
'Allowed files:',
|
|
40
|
+
'Forbidden files:',
|
|
41
|
+
'Allowed commands:',
|
|
42
|
+
'Forbidden commands:',
|
|
43
|
+
'Expected output:',
|
|
44
|
+
'Evidence record path:',
|
|
45
|
+
'Acceptance gate:',
|
|
46
|
+
'Accepted by:',
|
|
47
|
+
'Stop conditions:',
|
|
48
|
+
'Residual risk if incomplete:',
|
|
49
|
+
'Next action after completion:',
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
const freshInputs = [
|
|
53
|
+
'SKILL.md',
|
|
54
|
+
'.gse/gse-design-master-plan.md',
|
|
55
|
+
'.gse/goal-map.md',
|
|
56
|
+
'.gse/current-slice.md',
|
|
57
|
+
'references/forward-test.md',
|
|
58
|
+
'references/evidence-taxonomy.md',
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const projectInputs = [
|
|
62
|
+
'Project owner approval text or issue/task link.',
|
|
63
|
+
'references/adoption-recipes.md',
|
|
64
|
+
'assets/templates/target-adoption-evidence.md',
|
|
65
|
+
'assets/templates/update-release-acceptance-record.md',
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
const antiOverclaim = [
|
|
69
|
+
'Do not write `Accepted by: fresh-session` unless a separate session actually ran the packet.',
|
|
70
|
+
'Do not write `Accepted by: owner` unless owner approval is explicit and recorded.',
|
|
71
|
+
'Do not treat a generated packet, local validation, fixture audit, or read-only discovery as acceptance.',
|
|
72
|
+
'Evidence status: not ready',
|
|
73
|
+
'Accepted by: not accepted',
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
const checks = [
|
|
77
|
+
check('AEP01', 'acceptance execution packet template exists', exists('assets/templates/acceptance-execution-packet.md'), 'assets/templates/acceptance-execution-packet.md'),
|
|
78
|
+
check('AEP02', 'packet captures execution boundaries', fields.every((item) => template.includes(item)), fields.join(', ')),
|
|
79
|
+
check('AEP03', 'fresh-session path uses documented GSE inputs', freshInputs.every((item) => template.includes(item)), freshInputs.join(', ')),
|
|
80
|
+
check('AEP04', 'owner-approved path requires explicit owner evidence and project templates', projectInputs.every((item) => template.includes(item)), projectInputs.join(', ')),
|
|
81
|
+
check('AEP05', 'packet limits default project writes to .gse artifacts', template.includes('.gse/project-profile.md') && template.includes('.gse/evidence/YYYY-MM-DD.md') && template.includes('Source code, lockfiles, secrets'), 'allowed and forbidden file sections'),
|
|
82
|
+
check('AEP06', 'packet prevents fake acceptance', antiOverclaim.every((item) => template.includes(item)), 'anti-overclaim rules'),
|
|
83
|
+
check('AEP07', 'forward-test reference supports fresh-session acceptance boundary', forwardTest.includes('Use `accepted by: fresh-session` only when a separate agent/session actually ran the path.'), 'references/forward-test.md'),
|
|
84
|
+
check('AEP08', 'adoption recipes support target adoption evidence template', recipes.includes('assets/templates/target-adoption-evidence.md'), 'references/adoption-recipes.md'),
|
|
85
|
+
check('AEP09', 'consolidated validator includes this audit', validate.includes('audit-acceptance-execution-packet.mjs'), 'scripts/validate-gse.mjs'),
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
89
|
+
const failed = checks.length - passed
|
|
90
|
+
const report = {
|
|
91
|
+
root,
|
|
92
|
+
generatedAt: new Date().toISOString(),
|
|
93
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
94
|
+
workflows: { acceptanceExecutionPacket: failed === 0 ? 'verified' : 'failed' },
|
|
95
|
+
acceptedBy: 'not accepted; this audit verifies packet readiness only',
|
|
96
|
+
limits: [
|
|
97
|
+
'This audit verifies acceptance packet readiness only.',
|
|
98
|
+
'It does not create a separate session, write to a target project, or record owner acceptance.',
|
|
99
|
+
],
|
|
100
|
+
checks,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function renderMarkdown(data) {
|
|
104
|
+
const lines = []
|
|
105
|
+
lines.push('# GSE Acceptance Execution Packet Audit')
|
|
106
|
+
lines.push('')
|
|
107
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
108
|
+
lines.push('Root: ' + data.root)
|
|
109
|
+
lines.push('')
|
|
110
|
+
lines.push('## Summary')
|
|
111
|
+
lines.push('')
|
|
112
|
+
lines.push('- Status: ' + data.summary.status)
|
|
113
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
114
|
+
lines.push('- Acceptance execution packet: ' + data.workflows.acceptanceExecutionPacket)
|
|
115
|
+
lines.push('- Accepted by: ' + data.acceptedBy)
|
|
116
|
+
lines.push('')
|
|
117
|
+
lines.push('## Checks')
|
|
118
|
+
lines.push('')
|
|
119
|
+
for (const item of data.checks) {
|
|
120
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
121
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
122
|
+
}
|
|
123
|
+
lines.push('')
|
|
124
|
+
lines.push('## Limits')
|
|
125
|
+
lines.push('')
|
|
126
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
127
|
+
return lines.join('\n') + '\n'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
131
|
+
else console.log(renderMarkdown(report))
|
|
132
|
+
|
|
133
|
+
if (failed > 0) process.exit(1)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2)
|
|
6
|
+
|
|
7
|
+
function readArg(name, fallback = null) {
|
|
8
|
+
const index = args.indexOf(name)
|
|
9
|
+
if (index === -1) return fallback
|
|
10
|
+
return args[index + 1] ?? fallback
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
14
|
+
const jsonOnly = args.includes('--json')
|
|
15
|
+
|
|
16
|
+
function read(relativePath) {
|
|
17
|
+
const fullPath = path.join(root, relativePath)
|
|
18
|
+
return fs.existsSync(fullPath) ? fs.readFileSync(fullPath, 'utf8') : ''
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function exists(relativePath) {
|
|
22
|
+
return fs.existsSync(path.join(root, relativePath))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
26
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const recipes = read('references/adoption-recipes.md')
|
|
30
|
+
const skill = read('SKILL.md')
|
|
31
|
+
const bootstrap = read('references/project-bootstrap.md')
|
|
32
|
+
const packaging = read('references/packaging.md')
|
|
33
|
+
const examples = read('examples/README.md')
|
|
34
|
+
|
|
35
|
+
const recipeNames = ['Fresh Project Install', 'Existing Repo Adoption', 'Update Existing GSE', 'Host Adapter Adoption', 'CLI Or Package Project Adoption']
|
|
36
|
+
const recordFields = ['Adoption recipe:', 'Project path:', 'Mode or host:', 'Project rules read:', 'Commands run:', 'Files created or changed:', 'Preserved project-specific rules:', 'Host/tool statuses:', 'Validation evidence:', 'Evidence status:', 'Residual risk:', 'Next action:']
|
|
37
|
+
const commands = ['init-project.mjs', 'discover-project-profile.mjs', 'generate-command-adapter.mjs', 'audit-command-adapters.mjs', 'generate-host-adapter.mjs', 'audit-project.mjs', 'audit-adoption.mjs', 'audit-host-adapters.mjs', 'audit-fixtures.mjs', 'validate-gse.mjs']
|
|
38
|
+
const statusTerms = ['result', 'verified', 'accepted', 'not ready', 'unknown', 'documented', 'unavailable']
|
|
39
|
+
|
|
40
|
+
const checks = [
|
|
41
|
+
check('AR01', 'adoption recipes reference exists', exists('references/adoption-recipes.md'), 'references/adoption-recipes.md'),
|
|
42
|
+
check('AR02', 'SKILL routes adoption recipes', skill.includes('references/adoption-recipes.md'), 'SKILL.md Reference Routing'),
|
|
43
|
+
check('AR03', 'bootstrap, packaging, and examples route to recipes', bootstrap.includes('references/adoption-recipes.md') && packaging.includes('references/adoption-recipes.md') && examples.includes('references/adoption-recipes.md'), 'project-bootstrap.md, packaging.md, examples/README.md'),
|
|
44
|
+
check('AR04', 'core adoption recipes are present', recipeNames.every((item) => recipes.includes(item)), recipeNames.join(', ')),
|
|
45
|
+
check('AR05', 'fresh install includes mode selection and init command', recipes.includes('--mode <mode>') && recipes.includes('node <gse-skill>/scripts/init-project.mjs --target <project-root> --mode <mode>'), 'Fresh Project Install'),
|
|
46
|
+
check('AR06', 'existing repo adoption protects pre-existing project files', recipes.includes('Do not overwrite') && recipes.includes('--force') && recipes.includes('documented`, not `verified`'), 'Existing Repo Adoption'),
|
|
47
|
+
check('AR07', 'update recipe preserves local decisions and validates skill package', recipes.includes('Preserve local project decisions') && recipes.includes('node <gse-skill>/scripts/validate-gse.mjs --root <gse-skill>'), 'Update Existing GSE'),
|
|
48
|
+
check('AR08', 'host adapter recipe uses current command adapter path and keeps .gse source of truth', recipes.includes('Keep `.gse/` as the source of truth') && recipes.includes('generate-command-adapter.mjs') && recipes.includes('claude|codex|hermes|workbuddy|copilot|gemini|generic|all') && recipes.includes('legacy fixture helper') && recipes.includes('verified`, `documented`, `unknown`, or `unavailable`'), 'Host Adapter Adoption'),
|
|
49
|
+
check('AR09', 'adoption record has required fields', recordFields.every((item) => recipes.includes(item)), recordFields.join(', ')),
|
|
50
|
+
check('AR10', 'verification command list covers adoption scripts', commands.every((item) => recipes.includes(item)), commands.join(', ')),
|
|
51
|
+
check('AR11', 'status vocabulary avoids overclaiming', statusTerms.every((item) => recipes.includes(item)) && recipes.includes('do not certify arbitrary production repositories'), 'status and certification boundary'),
|
|
52
|
+
check('AR12', 'recipes are host-neutral and require project evidence', recipes.includes('host-neutral') && recipes.includes('project-specific evidence') && recipes.includes('unknown` until checked'), 'host-neutral project evidence rules'),
|
|
53
|
+
check('AR13', 'CLI/package adoption keeps release and install claims evidence-bound', recipes.includes('CLI Or Package Project Adoption') && recipes.includes('npm pack --dry-run') && recipes.includes('registry access') && recipes.includes('global install') && recipes.includes('shell completion require project-specific evidence'), 'CLI/package adoption recipe'),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
57
|
+
const failed = checks.length - passed
|
|
58
|
+
const report = {
|
|
59
|
+
root,
|
|
60
|
+
generatedAt: new Date().toISOString(),
|
|
61
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
62
|
+
workflows: { adoptionRecipes: failed === 0 ? 'verified' : 'failed' },
|
|
63
|
+
limits: [
|
|
64
|
+
'Adoption recipe audit verifies reusable recipe coverage and routing; it does not install GSE into arbitrary production repositories.',
|
|
65
|
+
'Real adoption still needs project-specific inspection, focused smokes, and host/tool evidence.',
|
|
66
|
+
],
|
|
67
|
+
checks,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function renderMarkdown(data) {
|
|
71
|
+
const lines = []
|
|
72
|
+
lines.push('# GSE Adoption Recipe Audit')
|
|
73
|
+
lines.push('')
|
|
74
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
75
|
+
lines.push('Root: ' + data.root)
|
|
76
|
+
lines.push('')
|
|
77
|
+
lines.push('## Summary')
|
|
78
|
+
lines.push('')
|
|
79
|
+
lines.push('- Status: ' + data.summary.status)
|
|
80
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
81
|
+
lines.push('- Adoption recipes: ' + data.workflows.adoptionRecipes)
|
|
82
|
+
lines.push('')
|
|
83
|
+
lines.push('## Checks')
|
|
84
|
+
lines.push('')
|
|
85
|
+
for (const item of data.checks) {
|
|
86
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
87
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
88
|
+
}
|
|
89
|
+
lines.push('')
|
|
90
|
+
lines.push('## Limits')
|
|
91
|
+
lines.push('')
|
|
92
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
93
|
+
return lines.join('\n') + '\n'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
97
|
+
else console.log(renderMarkdown(report))
|
|
98
|
+
|
|
99
|
+
if (failed > 0) process.exit(1)
|
|
@@ -0,0 +1,154 @@
|
|
|
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 keepTemp = args.includes('--keep-temp')
|
|
18
|
+
const tempRootArg = readArg('--temp-root', null)
|
|
19
|
+
const tempRoot = tempRootArg ? path.resolve(tempRootArg) : fs.mkdtempSync(path.join(os.tmpdir(), 'gse-adoption-audit-'))
|
|
20
|
+
const target = path.join(tempRoot, 'existing-repo')
|
|
21
|
+
const discoveryScript = path.join(root, 'scripts', 'discover-project-profile.mjs')
|
|
22
|
+
|
|
23
|
+
function write(relativePath, content) {
|
|
24
|
+
const fullPath = path.join(target, relativePath)
|
|
25
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true })
|
|
26
|
+
fs.writeFileSync(fullPath, content.trimStart().replace(/\n/g, '\r\n'), 'utf8')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function runNode(script, commandArgs) {
|
|
30
|
+
return spawnSync(process.execPath, [script, ...commandArgs], {
|
|
31
|
+
cwd: root,
|
|
32
|
+
encoding: 'utf8',
|
|
33
|
+
windowsHide: true,
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function parseJson(text) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(text)
|
|
40
|
+
} catch {
|
|
41
|
+
return null
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
46
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setupFixture() {
|
|
50
|
+
fs.rmSync(target, { recursive: true, force: true })
|
|
51
|
+
fs.mkdirSync(target, { recursive: true })
|
|
52
|
+
write('AGENTS.md', '# Existing Repo Rules\n\n- Prefer focused tests.\n- Do not overwrite existing project workflow files without explicit force.\n')
|
|
53
|
+
write('README.md', '# Existing Repo Fixture\n\nRepresentative repository shape for GSE adoption smoke.\n')
|
|
54
|
+
write('package.json', JSON.stringify({
|
|
55
|
+
name: 'gse-existing-repo-fixture',
|
|
56
|
+
private: true,
|
|
57
|
+
scripts: { dev: 'vite', test: 'vitest run', 'test:e2e': 'playwright test', typecheck: 'tsc --noEmit', build: 'vite build' },
|
|
58
|
+
dependencies: { react: '^19.0.0', vite: '^6.0.0' },
|
|
59
|
+
devDependencies: { typescript: '^5.0.0', '@playwright/test': '^1.0.0', vitest: '^2.0.0', eslint: '^9.0.0' },
|
|
60
|
+
}, null, 2))
|
|
61
|
+
write('playwright.config.ts', 'export default {}\n')
|
|
62
|
+
write('.env.example', 'PUBLIC_API_URL=https://example.invalid\n')
|
|
63
|
+
write('.github/workflows/ci.yml', 'name: ci\non: [push]\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - run: npm test\n')
|
|
64
|
+
write('.gse/project-profile.md', '# Existing Project Profile\n\nDo not overwrite me without --force.\n')
|
|
65
|
+
write('.gse/goal-map.md', '# Existing Goal Map\n\nExisting project goal map.\n')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!fs.existsSync(discoveryScript)) {
|
|
69
|
+
console.error('Missing discover-project-profile.mjs at ' + discoveryScript)
|
|
70
|
+
process.exit(1)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setupFixture()
|
|
74
|
+
const profilePath = path.join(target, '.gse', 'project-profile.md')
|
|
75
|
+
const beforeProfile = fs.readFileSync(profilePath, 'utf8')
|
|
76
|
+
|
|
77
|
+
const discovery = runNode(discoveryScript, ['--target', target, '--json'])
|
|
78
|
+
const model = discovery.status === 0 ? parseJson(discovery.stdout) : null
|
|
79
|
+
const noForceWrite = runNode(discoveryScript, ['--target', target, '--write'])
|
|
80
|
+
const afterNoForce = fs.readFileSync(profilePath, 'utf8')
|
|
81
|
+
const forceWrite = runNode(discoveryScript, ['--target', target, '--write', '--force'])
|
|
82
|
+
const afterForce = fs.readFileSync(profilePath, 'utf8')
|
|
83
|
+
|
|
84
|
+
const frameworks = new Set(model?.identity?.frameworks ?? [])
|
|
85
|
+
const toolConnections = model?.toolConnections ?? []
|
|
86
|
+
const statuses = new Set(toolConnections.map((item) => item.status))
|
|
87
|
+
const verifiedTools = toolConnections.filter((item) => item.status === 'verified')
|
|
88
|
+
const scriptNames = new Set((model?.scripts ?? []).map((item) => item.name))
|
|
89
|
+
|
|
90
|
+
const checks = [
|
|
91
|
+
check('A01', 'controlled existing repo fixture was created', fs.existsSync(path.join(target, 'package.json')) && fs.existsSync(profilePath), 'package.json and pre-existing .gse/project-profile.md'),
|
|
92
|
+
check('A02', 'discovery reads real project files', discovery.status === 0 && Boolean(model), 'discover-project-profile --json'),
|
|
93
|
+
check('A03', 'discovery detects representative existing repo shape', frameworks.has('React') && frameworks.has('Vite') && frameworks.has('TypeScript') && frameworks.has('Playwright'), 'frameworks: ' + [...frameworks].join(', ')),
|
|
94
|
+
check('A04', 'discovery captures focused commands from package.json', scriptNames.has('test') && scriptNames.has('test:e2e') && scriptNames.has('typecheck') && scriptNames.has('build'), 'scripts: ' + [...scriptNames].join(', ')),
|
|
95
|
+
check('A05', 'tool statuses stay documented or unknown, not invented verified', statuses.has('documented') && statuses.has('unknown') && verifiedTools.length === 0, 'tool statuses: ' + [...statuses].join(', ')),
|
|
96
|
+
check('A06', 'write without force refuses to overwrite existing profile', noForceWrite.status === 2 && afterNoForce === beforeProfile, 'exit ' + noForceWrite.status + '; profile unchanged'),
|
|
97
|
+
check('A07', 'write with force explicitly overwrites profile', forceWrite.status === 0 && afterForce !== beforeProfile && afterForce.includes('Generated:') && afterForce.includes('Tool Connections'), 'force write exit ' + forceWrite.status),
|
|
98
|
+
check('A08', 'generated profile preserves documented-not-verified warning', afterForce.includes('Tool presence from config is marked documented, not verified'), '.gse/project-profile.md known gotcha'),
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
102
|
+
const failed = checks.length - passed
|
|
103
|
+
const report = {
|
|
104
|
+
root,
|
|
105
|
+
generatedAt: new Date().toISOString(),
|
|
106
|
+
tempRoot,
|
|
107
|
+
target,
|
|
108
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
109
|
+
workflows: {
|
|
110
|
+
existingRepoDiscovery: checks.filter((item) => ['A02', 'A03', 'A04', 'A05'].includes(item.id)).every((item) => item.status === 'passed') ? 'verified' : 'failed',
|
|
111
|
+
nonOverwriteSafety: checks.filter((item) => ['A06', 'A07'].includes(item.id)).every((item) => item.status === 'passed') ? 'verified' : 'failed',
|
|
112
|
+
},
|
|
113
|
+
limits: [
|
|
114
|
+
'Adoption audit uses a controlled existing-repo fixture in a temporary directory, not arbitrary production repositories.',
|
|
115
|
+
'Config and script presence is treated as documented unless commands are actually run.',
|
|
116
|
+
'No package install, CI, browser, MCP, LSP, or external service is executed.',
|
|
117
|
+
],
|
|
118
|
+
checks,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!keepTemp) fs.rmSync(tempRoot, { recursive: true, force: true })
|
|
122
|
+
|
|
123
|
+
function renderMarkdown(data) {
|
|
124
|
+
const lines = []
|
|
125
|
+
lines.push('# GSE Existing Repo Adoption Audit')
|
|
126
|
+
lines.push('')
|
|
127
|
+
lines.push('Generated: ' + data.generatedAt)
|
|
128
|
+
lines.push('Root: ' + data.root)
|
|
129
|
+
lines.push('Temp root: ' + data.tempRoot)
|
|
130
|
+
lines.push('')
|
|
131
|
+
lines.push('## Summary')
|
|
132
|
+
lines.push('')
|
|
133
|
+
lines.push('- Status: ' + data.summary.status)
|
|
134
|
+
lines.push('- Checks: ' + data.summary.passed + '/' + data.summary.total)
|
|
135
|
+
lines.push('- Existing repo discovery: ' + data.workflows.existingRepoDiscovery)
|
|
136
|
+
lines.push('- Non-overwrite safety: ' + data.workflows.nonOverwriteSafety)
|
|
137
|
+
lines.push('')
|
|
138
|
+
lines.push('## Checks')
|
|
139
|
+
lines.push('')
|
|
140
|
+
for (const item of data.checks) {
|
|
141
|
+
const marker = item.status === 'passed' ? '[x]' : '[ ]'
|
|
142
|
+
lines.push('- ' + marker + ' ' + item.id + ' ' + item.label + ': ' + item.evidence)
|
|
143
|
+
}
|
|
144
|
+
lines.push('')
|
|
145
|
+
lines.push('## Limits')
|
|
146
|
+
lines.push('')
|
|
147
|
+
for (const item of data.limits) lines.push('- ' + item)
|
|
148
|
+
return lines.join('\n') + '\n'
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
152
|
+
else console.log(renderMarkdown(report))
|
|
153
|
+
|
|
154
|
+
if (failed > 0) process.exit(1)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import os from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { spawnSync } from 'node:child_process'
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2)
|
|
8
|
+
|
|
9
|
+
function readArg(name, fallback = null) {
|
|
10
|
+
const index = args.indexOf(name)
|
|
11
|
+
if (index === -1) return fallback
|
|
12
|
+
return args[index + 1] ?? fallback
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const root = path.resolve(readArg('--root', path.join(import.meta.dirname, '..')))
|
|
16
|
+
const jsonOnly = args.includes('--json')
|
|
17
|
+
const target = fs.mkdtempSync(path.join(os.tmpdir(), 'gse-change-lifecycle-'))
|
|
18
|
+
const initScript = path.join(root, 'scripts', 'init-change.mjs')
|
|
19
|
+
const closeScript = path.join(root, 'scripts', 'close-change.mjs')
|
|
20
|
+
|
|
21
|
+
function run(script, commandArgs) {
|
|
22
|
+
return spawnSync(process.execPath, [script, ...commandArgs], { cwd: root, encoding: 'utf8', windowsHide: true })
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function parseJson(text) {
|
|
26
|
+
try { return JSON.parse(text) } catch { return null }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function check(id, label, ok, evidence, risk = '') {
|
|
30
|
+
return { id, label, status: ok ? 'passed' : 'failed', evidence, risk }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fs.mkdirSync(path.join(target, '.gse', 'evidence'), { recursive: true })
|
|
34
|
+
fs.writeFileSync(path.join(target, '.gse', 'goal-map.md'), '# Goal Map\n', 'utf8')
|
|
35
|
+
fs.writeFileSync(path.join(target, '.gse', 'quality-gates.md'), '# Quality Gates\n', 'utf8')
|
|
36
|
+
fs.writeFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), '', 'utf8')
|
|
37
|
+
|
|
38
|
+
const init = run(initScript, ['--target', target, '--change-id', 'Archive Me', '--level', 'standard', '--json'])
|
|
39
|
+
const dryRun = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--dry-run', '--json'])
|
|
40
|
+
const dryRunPreservedSource = fs.existsSync(path.join(target, '.gse', 'changes', 'archive-me'))
|
|
41
|
+
const close = run(closeScript, ['--target', target, '--change-id', 'archive-me', '--status', 'verified', '--date', '2026-07-06', '--json'])
|
|
42
|
+
const closeJson = parseJson(close.stdout)
|
|
43
|
+
const archiveDir = path.join(target, '.gse', 'archive', '2026-07-06-archive-me')
|
|
44
|
+
const sourceDir = path.join(target, '.gse', 'changes', 'archive-me')
|
|
45
|
+
const indexText = fs.readFileSync(path.join(target, '.gse', 'evidence', 'index.jsonl'), 'utf8')
|
|
46
|
+
const archiveRecord = fs.existsSync(path.join(archiveDir, 'archive-record.md')) ? fs.readFileSync(path.join(archiveDir, 'archive-record.md'), 'utf8') : ''
|
|
47
|
+
|
|
48
|
+
const checks = [
|
|
49
|
+
check('CHGLC01', 'close-change script exists', fs.existsSync(closeScript), 'scripts/close-change.mjs'),
|
|
50
|
+
check('CHGLC02', 'init-change creates closeable change pack', init.status === 0, 'scripts/init-change.mjs fixture run'),
|
|
51
|
+
check('CHGLC03', 'dry-run reports pass without moving source folder', dryRun.status === 0 && dryRunPreservedSource, 'close-change --dry-run'),
|
|
52
|
+
check('CHGLC04', 'close moves change folder into archive', close.status === 0 && fs.existsSync(archiveDir) && !fs.existsSync(sourceDir), '.gse/archive/YYYY-MM-DD-change-id'),
|
|
53
|
+
check('CHGLC05', 'archive record captures closure metadata', archiveRecord.includes('Status: verified') && archiveRecord.includes('Source: .gse/changes/archive-me'), 'archive-record.md'),
|
|
54
|
+
check('CHGLC06', 'evidence index receives schema-complete change-archive record', indexText.includes('"recordType":"change-archive"') && indexText.includes('"changeId":"archive-me"') && indexText.includes('"commands":') && indexText.includes('"nextAction":'), '.gse/evidence/index.jsonl'),
|
|
55
|
+
check('CHGLC07', 'close output preserves evidence status and archive path', closeJson?.evidenceStatus === 'verified' && closeJson?.indexRecord?.archivePath === '.gse/archive/2026-07-06-archive-me', 'close-change JSON'),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
const passed = checks.filter((item) => item.status === 'passed').length
|
|
59
|
+
const failed = checks.length - passed
|
|
60
|
+
const report = {
|
|
61
|
+
root,
|
|
62
|
+
generatedAt: new Date().toISOString(),
|
|
63
|
+
summary: { status: failed === 0 ? 'passed' : 'failed', passed, failed, total: checks.length },
|
|
64
|
+
workflows: { changeArchiveLifecycle: failed === 0 ? 'verified' : 'failed' },
|
|
65
|
+
limits: [
|
|
66
|
+
'This audit verifies local change archive mechanics in a fixture.',
|
|
67
|
+
'It does not certify the product correctness of a real target-project change.',
|
|
68
|
+
],
|
|
69
|
+
checks,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fs.rmSync(target, { recursive: true, force: true })
|
|
73
|
+
|
|
74
|
+
if (jsonOnly) console.log(JSON.stringify(report, null, 2))
|
|
75
|
+
else console.log(JSON.stringify(report, null, 2))
|
|
76
|
+
|
|
77
|
+
if (failed > 0) process.exit(1)
|