@warpgogol/forge 6.3.6 → 8.0.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.
- package/CHANGELOG.md +47 -0
- package/README.md +2 -1
- package/bin/cli.js +6 -12
- package/bin/resolve-entry.js +24 -0
- package/dist/os/compass/comment-safety.d.ts +83 -0
- package/dist/os/compass/comment-safety.d.ts.map +1 -0
- package/dist/os/compass/comment-safety.js +305 -0
- package/dist/os/compass/comment-safety.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -4
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
- package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
- package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.js +28 -13
- package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
- package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.js +58 -20
- package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +10 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +58 -4
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts +20 -5
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +175 -44
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/compass/index.d.ts +1 -0
- package/dist/os/compass/index.d.ts.map +1 -1
- package/dist/os/compass/index.js +2 -0
- package/dist/os/compass/index.js.map +1 -1
- package/dist/os/compass/policy.d.ts +9 -0
- package/dist/os/compass/policy.d.ts.map +1 -1
- package/dist/os/compass/policy.js +11 -2
- package/dist/os/compass/policy.js.map +1 -1
- package/dist/os/core/core.module.js +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +1 -6
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/queue/types.d.ts +2 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +3 -1
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +66 -2
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +21 -3
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/dna-trace.d.ts +2 -0
- package/dist/os/rfc/dna-trace.d.ts.map +1 -1
- package/dist/os/rfc/dna-trace.js +13 -4
- package/dist/os/rfc/dna-trace.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +645 -47
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +71 -10
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts +17 -0
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
- package/dist/os/rfc/reachable-symbol.js +376 -0
- package/dist/os/rfc/reachable-symbol.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +99 -10
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +112 -14
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +27 -10
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +25 -0
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +244 -13
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +58 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -0
- package/dist/os/rfc/verification-origin.js +346 -0
- package/dist/os/rfc/verification-origin.js.map +1 -0
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +11 -1
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +23 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
- package/dist/os/rfc/verify-workspace.js +278 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -0
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +3 -0
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +5 -23
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +30 -9
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/workflow/handlers.d.ts +0 -4
- package/dist/os/workflow/handlers.d.ts.map +1 -1
- package/dist/os/workflow/handlers.js +9 -36
- package/dist/os/workflow/handlers.js.map +1 -1
- package/dist/os/workflow/index.d.ts +2 -2
- package/dist/os/workflow/index.d.ts.map +1 -1
- package/dist/os/workflow/index.js +1 -1
- package/dist/os/workflow/index.js.map +1 -1
- package/dist/os/workflow/types.d.ts +0 -19
- package/dist/os/workflow/types.d.ts.map +1 -1
- package/dist/os/workflow/types.js +0 -2
- package/dist/os/workflow/types.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +6 -15
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +5 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +5 -2
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/doctor.js +3 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +2 -2
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/prettierignore.js +1 -1
- package/dist/src/onboarding/upgrade.js +2 -2
- package/dist/src/onboarding/workspace-discovery.js +1 -1
- package/dist/src/profiles/profile-schema.d.ts +2 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +1 -0
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +1 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/skill-schema.d.ts +2 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -1
- package/dist/src/skill-schema.js.map +1 -1
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/types.js.map +1 -1
- package/docs/reference/cli.md +0 -1
- package/docs/reference/programmatic-api.md +1 -1
- package/os/adr/handlers/validate.test.ts +14 -0
- package/os/compass/comment-safety.ts +331 -0
- package/os/compass/compass.module.ts +50 -4
- package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
- package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
- package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
- package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
- package/os/compass/handlers/compass-header-scaffold.ts +847 -0
- package/os/compass/handlers/compass-inventory-handler.ts +9 -4
- package/os/compass/handlers/compass-inventory.ts +29 -13
- package/os/compass/handlers/compass-migrate-handler.ts +13 -27
- package/os/compass/handlers/compass-migrate.ts +77 -21
- package/os/compass/handlers/git-revision.ts +59 -4
- package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
- package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
- package/os/compass/handlers/summary-record.ts +194 -41
- package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
- package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
- package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
- package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
- package/os/compass/handlers/tests/summary-record.test.ts +324 -3
- package/os/compass/index.ts +15 -0
- package/os/compass/policy.ts +27 -2
- package/os/core/core.module.ts +1 -1
- package/os/core/handlers/invariant-engine.test.ts +3 -1
- package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
- package/os/core/handlers/note-link-validate.test.ts +6 -1
- package/os/core/handlers/note-orphan-detect.test.ts +6 -1
- package/os/core/handlers/package-health.test.ts +6 -0
- package/os/core/handlers/package-health.ts +1 -6
- package/os/mission/handlers/archive.test.ts +14 -0
- package/os/naming/naming-convention.test.ts +14 -0
- package/os/queue/decision-ledger.test.ts +27 -4
- package/os/queue/queue-validate.test.ts +14 -0
- package/os/queue/types.ts +3 -1
- package/os/rfc/acceptance-reachable.test.ts +146 -0
- package/os/rfc/acceptance.test.ts +136 -0
- package/os/rfc/acceptance.ts +71 -2
- package/os/rfc/decision-log.ts +22 -4
- package/os/rfc/dna-trace.ts +17 -5
- package/os/rfc/frontmatter-io.test.ts +14 -0
- package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
- package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
- package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
- package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
- package/os/rfc/handlers/implement-stamp-stale.test.ts +285 -0
- package/os/rfc/handlers/implement-stamp.ts +783 -55
- package/os/rfc/handlers/lifecycle.test.ts +14 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
- package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
- package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
- package/os/rfc/handlers/validate-rules.test.ts +56 -0
- package/os/rfc/handlers/validate-rules.ts +101 -10
- package/os/rfc/handlers/validate.test.ts +4 -3
- package/os/rfc/reachable-symbol.ts +441 -0
- package/os/rfc/rfc-0000-template.md +21 -1
- package/os/rfc/rfc-create-concurrent.test.ts +6 -0
- package/os/rfc/rfc-create-hint.test.ts +6 -0
- package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
- package/os/rfc/rfc.module.ts +106 -10
- package/os/rfc/types.ts +151 -14
- package/os/rfc/verification-emit-check.test.ts +215 -0
- package/os/rfc/verification-emit-freshness.test.ts +415 -0
- package/os/rfc/verification-emit.test.ts +14 -0
- package/os/rfc/verification-evidence.ts +301 -13
- package/os/rfc/verification-normalize.test.ts +75 -0
- package/os/rfc/verification-origin.test.ts +236 -0
- package/os/rfc/verification-origin.ts +417 -0
- package/os/rfc/verification-refresh.test.ts +14 -0
- package/os/rfc/verification-refresh.ts +12 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
- package/os/rfc/verify-workspace.test.ts +122 -0
- package/os/rfc/verify-workspace.ts +342 -0
- package/os/session/handlers/metrics-rfc.ts +3 -0
- package/os/spec/spec-status.test.ts +130 -0
- package/os/spec/spec-status.ts +5 -18
- package/os/spec/spec-validate.test.ts +76 -1
- package/os/spec/spec-validate.ts +26 -7
- package/os/workflow/handlers.ts +8 -42
- package/os/workflow/index.ts +1 -4
- package/os/workflow/types.ts +0 -22
- package/os/workflow/workflow.module.ts +6 -16
- package/package.json +1 -1
- package/skills/_shared/agent-operating-model.md +83 -0
- package/skills/_shared/fo-pipeline-conventions.md +1 -0
- package/skills/fo/fo-add-tests/SKILL.md +14 -0
- package/skills/fo/fo-fix/SKILL.md +2 -1
- package/skills/fo/fo-handoff/SKILL.md +1 -1
- package/skills/fo/fo-idea/SKILL.md +6 -3
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
- package/skills/fo/fo-idea-implement/SKILL.md +68 -53
- package/skills/fo/fo-idea-plan/SKILL.md +3 -1
- package/skills/fo/fo-review/SKILL.md +12 -0
- package/skills/fo/fo-session-save/learned-principles.md +13 -0
- package/skills/fo/fo-step-commit/SKILL.md +1 -1
- package/src/bin-entry.test.ts +37 -0
- package/src/compass/contract-registry.test.ts +14 -0
- package/src/compass/types.test.ts +14 -0
- package/src/config/__tests__/resolve-terminology.test.ts +14 -0
- package/src/config/forge-config.test.ts +14 -0
- package/src/config/forge-config.ts +7 -2
- package/src/forge-module.test.ts +14 -0
- package/src/knowledge/__tests__/promote.test.ts +14 -0
- package/src/knowledge/__tests__/serialize.test.ts +14 -0
- package/src/knowledge/__tests__/sync.test.ts +4 -1
- package/src/knowledge/budgets.test.ts +14 -0
- package/src/knowledge/compact.test.ts +14 -0
- package/src/knowledge/parse.test.ts +14 -0
- package/src/knowledge/schema.test.ts +14 -0
- package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
- package/src/migration-adapters/__tests__/registry.test.ts +14 -0
- package/src/migration-adapters/__tests__/types.test.ts +14 -0
- package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
- package/src/onboarding/agents-generate.ts +1 -1
- package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
- package/src/onboarding/create.test.ts +14 -0
- package/src/onboarding/doctor-token-check.test.ts +3 -0
- package/src/onboarding/doctor.test.ts +14 -0
- package/src/onboarding/doctor.ts +3 -3
- package/src/onboarding/init.test.ts +14 -0
- package/src/onboarding/init.ts +2 -2
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/prettierignore.ts +1 -1
- package/src/onboarding/scaffold.test.ts +14 -0
- package/src/onboarding/site-workshop-profile.test.ts +3 -0
- package/src/onboarding/templates/behavioral-layer-core.md +8 -0
- package/src/onboarding/upgrade.test.ts +14 -0
- package/src/onboarding/upgrade.ts +2 -2
- package/src/onboarding/workspace-discovery.ts +1 -1
- package/src/pipeline-status.test.ts +14 -0
- package/src/plugin/forge-plugin-manifest.test.ts +14 -0
- package/src/profiles/__tests__/profile-schema.test.ts +14 -0
- package/src/profiles/__tests__/stack-profile.test.ts +14 -0
- package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
- package/src/profiles/profile-schema.ts +1 -0
- package/src/skill-schema.ts +9 -1
- package/src/tests/acceptance-criteria.test.ts +14 -0
- package/src/tests/acceptance-probe-kinds.test.ts +14 -0
- package/src/tests/adr-implement-stamp.test.ts +14 -0
- package/src/tests/agents-generate-domain.test.ts +3 -0
- package/src/tests/agents-generate.test.ts +3 -0
- package/src/tests/bindings-schema.test.ts +2 -0
- package/src/tests/budgets.test.ts +14 -0
- package/src/tests/compact.test.ts +14 -0
- package/src/tests/compass-docs-flag.test.ts +6 -0
- package/src/tests/compass-docs-scaffold.test.ts +6 -0
- package/src/tests/compass-docs-validate-scope.test.ts +6 -0
- package/src/tests/contract-registry.test.ts +14 -0
- package/src/tests/create.test.ts +3 -0
- package/src/tests/discover-pack-skills.test.ts +14 -0
- package/src/tests/doctor-autonomy.test.ts +3 -0
- package/src/tests/doctor-bindings.test.ts +6 -1
- package/src/tests/doctor-dist-freshness.test.ts +26 -2
- package/src/tests/doctor-domain.test.ts +6 -1
- package/src/tests/doctor-fix.test.ts +3 -0
- package/src/tests/doctor-nested-agents.test.ts +3 -0
- package/src/tests/doctor-profile-id-known.test.ts +3 -0
- package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
- package/src/tests/doctor-version-sync.test.ts +4 -1
- package/src/tests/editable-generated-region.test.ts +6 -3
- package/src/tests/exploration-handlers.test.ts +14 -0
- package/src/tests/file-size-lint.test.ts +6 -1
- package/src/tests/fixtures/agents-generate-business-before.txt +8 -0
- package/src/tests/forge-autonomy-validate.test.ts +3 -1
- package/src/tests/forge-config.test.ts +6 -1
- package/src/tests/forge-validate-compass-docs.test.ts +6 -0
- package/src/tests/fs-atomic.test.ts +14 -0
- package/src/tests/fs.test.ts +14 -0
- package/src/tests/generated-marker.test.ts +14 -0
- package/src/tests/hash.test.ts +14 -0
- package/src/tests/implement-stamp.test.ts +476 -10
- package/src/tests/init-bindings.test.ts +6 -1
- package/src/tests/knowledge-parse.test.ts +14 -0
- package/src/tests/knowledge-pbt.test.ts +14 -0
- package/src/tests/markdown-table.test.ts +6 -3
- package/src/tests/memory-compact.test.ts +3 -0
- package/src/tests/memory-scaffold.test.ts +6 -1
- package/src/tests/metrics-rfc-1053.test.ts +14 -0
- package/src/tests/migration-adapters.test.ts +3 -0
- package/src/tests/package-files.test.ts +4 -1
- package/src/tests/package-health-lint-surface.test.ts +3 -0
- package/src/tests/pinned-check.test.ts +14 -0
- package/src/tests/pinned-init.test.ts +14 -0
- package/src/tests/pinned-validate.test.ts +14 -0
- package/src/tests/plugin-manifest.test.ts +14 -0
- package/src/tests/prettierignore-manage.test.ts +3 -0
- package/src/tests/profile-schema.test.ts +6 -1
- package/src/tests/profile-validate.test.ts +6 -1
- package/src/tests/program-lease.test.ts +3 -0
- package/src/tests/program-paths-extended.test.ts +3 -0
- package/src/tests/program-paths.test.ts +3 -0
- package/src/tests/program-property.test.ts +3 -0
- package/src/tests/program-schemas.test.ts +3 -0
- package/src/tests/program-spec-node.test.ts +3 -0
- package/src/tests/promote.test.ts +14 -0
- package/src/tests/public-surface.test.ts +6 -1
- package/src/tests/registry.test.ts +14 -0
- package/src/tests/rfc-evidence-sync.test.ts +347 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
- package/src/tests/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +14 -0
- package/src/tests/session-pbt.test.ts +14 -0
- package/src/tests/skill-agents-sync.test.ts +3 -4
- package/src/tests/skill-schema.test.ts +53 -0
- package/src/tests/skill-sync-marker.test.ts +3 -0
- package/src/tests/skill-validate-knowledge.test.ts +14 -0
- package/src/tests/skill-validate.test.ts +14 -0
- package/src/tests/stack-profile.test.ts +6 -1
- package/src/tests/string-utils.test.ts +14 -0
- package/src/tests/upgrade.test.ts +6 -1
- package/src/tests/werkstatt-lock.test.ts +14 -0
- package/src/tests/workspace-discovery-domain.test.ts +6 -1
- package/src/tests/workspace-discovery.test.ts +6 -1
- package/src/types.test.ts +14 -0
- package/src/types.ts +30 -1
- package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
- package/src/utils/__tests__/fs-trash.test.ts +17 -0
- package/src/utils/fs-atomic.test.ts +17 -0
- package/src/utils/fs-trash-sync.test.ts +17 -0
- package/src/utils/fs.test.ts +17 -0
- package/src/utils/generated-marker.test.ts +17 -0
- package/src/utils/hash.test.ts +17 -0
- package/src/utils/string-utils.test.ts +17 -0
- package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
|
@@ -19,15 +19,17 @@ io.writeFile port routing, emit-canonical generated header — refresh owns
|
|
|
19
19
|
content freshness, never envelope identity (ownerCommand stays
|
|
20
20
|
rfc.verification.emit).</item>
|
|
21
21
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
22
|
+
<item>RFC-1330: refresh attaches git-derived origin like emit.</item>
|
|
22
23
|
</CHANGE_SUMMARY>
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
import { join } from "node:path";
|
|
26
|
+
import { join, relative } from "node:path";
|
|
26
27
|
import { resolveIo } from "../../src/utils/io.ts";
|
|
27
28
|
import { performance } from "node:perf_hooks";
|
|
28
29
|
import { parse as yamlParse } from "yaml";
|
|
29
30
|
|
|
30
31
|
import { runProbe } from "./acceptance.ts";
|
|
32
|
+
import { attachProbeOrigins } from "./verification-origin.ts";
|
|
31
33
|
import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
|
|
32
34
|
import {
|
|
33
35
|
captureGitContext,
|
|
@@ -149,6 +151,15 @@ export async function runRfcVerificationRefresh(
|
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
// RFC-1330: git-derived origin per probe (post-cutoff RFCs only).
|
|
155
|
+
await attachProbeOrigins({
|
|
156
|
+
workspaceRoot,
|
|
157
|
+
rfcRelPath: relative(workspaceRoot, rfcFilePath),
|
|
158
|
+
frontmatter: fm,
|
|
159
|
+
probes,
|
|
160
|
+
records: probeRecords,
|
|
161
|
+
});
|
|
162
|
+
|
|
152
163
|
const envelope = buildEvidenceEnvelope(
|
|
153
164
|
rfcId,
|
|
154
165
|
String(fm["title"] ?? ""),
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// RFC-1333 Design "Stamp gate RFC-IMP-12" — candidate binding: descendants of
|
|
2
|
+
// candidateSha up to the implementation commit may touch only verifier-trailer
|
|
3
|
+
// commits and docs/**.
|
|
4
|
+
// @vitest-environment node
|
|
5
|
+
import { execFileSync } from "node:child_process";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import os from "node:os";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { describe, expect, test, vi } from "vitest";
|
|
10
|
+
|
|
11
|
+
import { runRfcImplementStamp } from "../../handlers/implement-stamp.ts";
|
|
12
|
+
import type { ForgeCommandInput, ForgeRuntimeContext } from "../../../../src/types.ts";
|
|
13
|
+
|
|
14
|
+
vi.mock("../../acceptance.ts", () => ({
|
|
15
|
+
runProbe: vi.fn(async (probe: unknown) => ({ probe, ok: true, detail: "ok" })),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const git = (dir: string, args: string[]) =>
|
|
19
|
+
execFileSync("git", args, { cwd: dir, encoding: "utf-8" }).trim();
|
|
20
|
+
const put = async (dir: string, rel: string, body: string) => {
|
|
21
|
+
await fs.mkdir(path.dirname(path.join(dir, rel)), { recursive: true });
|
|
22
|
+
await fs.writeFile(path.join(dir, rel), body);
|
|
23
|
+
};
|
|
24
|
+
const commit = (dir: string, msg: string) => {
|
|
25
|
+
git(dir, ["add", "-A"]);
|
|
26
|
+
git(dir, ["commit", "-qm", msg]);
|
|
27
|
+
return git(dir, ["rev-parse", "HEAD"]);
|
|
28
|
+
};
|
|
29
|
+
const RFC = `---\nid: RFC-0100\ntitle: "T"\nstatus: accepted\nkind: command\nscope: workspace\nowners:\n - architecture\ncreatedAt: 2026-10-18\nupdatedAt: 2026-10-18\nverificationTier: high\nacceptance:\n - probe: file-exists\n path: src/index.ts\n criterion: AC-1\n---\n\n# RFC-0100\n## Context\nx\n## Acceptance criteria\n\n- [x] AC-1: THE thing SHALL exist (evidence: probe:AC-1)\n`;
|
|
30
|
+
|
|
31
|
+
async function scenario(laterPath: string): Promise<string[]> {
|
|
32
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "imp12-"));
|
|
33
|
+
try {
|
|
34
|
+
git(dir, ["init", "-q"]);
|
|
35
|
+
git(dir, ["config", "user.email", "t@t.t"]);
|
|
36
|
+
git(dir, ["config", "user.name", "t"]);
|
|
37
|
+
await put(dir, "docs/rfcs/rfc-0100-t.md", RFC);
|
|
38
|
+
commit(dir, "docs: RFC-0100 accepted");
|
|
39
|
+
await put(dir, "src/index.ts", "export {};\n");
|
|
40
|
+
const cand = commit(dir, "feat: RFC-0100 implement");
|
|
41
|
+
await put(
|
|
42
|
+
dir,
|
|
43
|
+
"docs/reviews/acceptance/rfc-0100/acceptance-2026-10-18-r0.md",
|
|
44
|
+
`---\nrfcId: RFC-0100\ncandidateSha: ${cand}\nround: 0\nisolation: subagent\nverifierModel: null\nverdict: pass\ncounterexamples: []\n---\n\nok\n`,
|
|
45
|
+
);
|
|
46
|
+
commit(dir, "docs: RFC-0100 acceptance report");
|
|
47
|
+
await put(dir, laterPath, "changed after verification\n");
|
|
48
|
+
const head = commit(dir, "feat: RFC-0100 post-verification change");
|
|
49
|
+
const ctx = {
|
|
50
|
+
workspaceRoot: dir,
|
|
51
|
+
logger: { info: () => {}, warn: () => {} },
|
|
52
|
+
outputFormat: "json",
|
|
53
|
+
commandRegistry: undefined,
|
|
54
|
+
dryRun: false,
|
|
55
|
+
} as unknown as ForgeRuntimeContext;
|
|
56
|
+
const r = await runRfcImplementStamp(
|
|
57
|
+
{
|
|
58
|
+
flags: { id: "RFC-0100", "implementation-commit": head, "dry-run": true },
|
|
59
|
+
} as unknown as ForgeCommandInput,
|
|
60
|
+
ctx,
|
|
61
|
+
);
|
|
62
|
+
return (r.data?.violations ?? []).map((v) => v.rule);
|
|
63
|
+
} finally {
|
|
64
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
describe("RFC-IMP-12 candidate binding", () => {
|
|
69
|
+
test("control: post-candidate code change unbinds the report", async () => {
|
|
70
|
+
expect(await scenario("src/other.ts")).toContain("RFC-IMP-12");
|
|
71
|
+
});
|
|
72
|
+
test("post-candidate change to a non-docs/** markdown file (e.g. a skill) unbinds the report", async () => {
|
|
73
|
+
expect(await scenario("packages/forge/skills/fo/x/SKILL.md")).toContain("RFC-IMP-12");
|
|
74
|
+
});
|
|
75
|
+
test("post-candidate docs/** change keeps the report bound", async () => {
|
|
76
|
+
expect(await scenario("docs/notes.md")).not.toContain("RFC-IMP-12");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// RFC-1333 AC-5, AC-6 — RFC-IMP-12 gate (pure evaluator).
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { evaluateAcceptanceVerificationGate } from "../../handlers/implement-stamp-origin.ts";
|
|
4
|
+
|
|
5
|
+
const fm = { createdAt: "2026-10-18", verificationTier: "high" };
|
|
6
|
+
const rep = (f: Record<string, unknown>) => ({
|
|
7
|
+
path: "docs/reviews/acceptance/rfc-9/a-r0.md",
|
|
8
|
+
frontmatter: f,
|
|
9
|
+
});
|
|
10
|
+
const bound = async () => true;
|
|
11
|
+
|
|
12
|
+
describe("RFC-IMP-12", () => {
|
|
13
|
+
it("AC-5: no report blocks", async () => {
|
|
14
|
+
const r = await evaluateAcceptanceVerificationGate({
|
|
15
|
+
targetId: "RFC-9",
|
|
16
|
+
frontmatter: fm,
|
|
17
|
+
reports: [],
|
|
18
|
+
isCandidateBound: bound,
|
|
19
|
+
});
|
|
20
|
+
expect(r.errors.map((e) => e.rule)).toContain("RFC-IMP-12");
|
|
21
|
+
});
|
|
22
|
+
it("AC-5: non-pass verdict blocks", async () => {
|
|
23
|
+
const r = await evaluateAcceptanceVerificationGate({
|
|
24
|
+
targetId: "RFC-9",
|
|
25
|
+
frontmatter: fm,
|
|
26
|
+
reports: [rep({ verdict: "counterexamples", isolation: "subagent", candidateSha: "abc" })],
|
|
27
|
+
isCandidateBound: bound,
|
|
28
|
+
});
|
|
29
|
+
expect(r.errors.map((e) => e.rule)).toContain("RFC-IMP-12");
|
|
30
|
+
});
|
|
31
|
+
it("AC-5: unbound candidate blocks", async () => {
|
|
32
|
+
const r = await evaluateAcceptanceVerificationGate({
|
|
33
|
+
targetId: "RFC-9",
|
|
34
|
+
frontmatter: fm,
|
|
35
|
+
reports: [rep({ verdict: "pass", isolation: "subagent", candidateSha: "abc" })],
|
|
36
|
+
isCandidateBound: async () => false,
|
|
37
|
+
});
|
|
38
|
+
expect(r.errors.map((e) => e.rule)).toContain("RFC-IMP-12");
|
|
39
|
+
});
|
|
40
|
+
it("AC-5: bound pass subagent report passes", async () => {
|
|
41
|
+
const r = await evaluateAcceptanceVerificationGate({
|
|
42
|
+
targetId: "RFC-9",
|
|
43
|
+
frontmatter: fm,
|
|
44
|
+
reports: [rep({ verdict: "pass", isolation: "subagent", candidateSha: "abc" })],
|
|
45
|
+
isCandidateBound: bound,
|
|
46
|
+
});
|
|
47
|
+
expect(r.errors).toEqual([]);
|
|
48
|
+
});
|
|
49
|
+
it("AC-6: non-subagent isolation without waiver blocks; with waiver warns", async () => {
|
|
50
|
+
const reports = [rep({ verdict: "pass", isolation: "inline", candidateSha: "abc" })];
|
|
51
|
+
const a = await evaluateAcceptanceVerificationGate({
|
|
52
|
+
targetId: "RFC-9",
|
|
53
|
+
frontmatter: fm,
|
|
54
|
+
reports,
|
|
55
|
+
isCandidateBound: bound,
|
|
56
|
+
});
|
|
57
|
+
expect(a.errors.map((e) => e.rule)).toContain("RFC-IMP-12");
|
|
58
|
+
const b = await evaluateAcceptanceVerificationGate({
|
|
59
|
+
targetId: "RFC-9",
|
|
60
|
+
frontmatter: fm,
|
|
61
|
+
reports,
|
|
62
|
+
isCandidateBound: bound,
|
|
63
|
+
waiverReason: "no subagents",
|
|
64
|
+
});
|
|
65
|
+
expect(b.errors).toEqual([]);
|
|
66
|
+
expect(b.warnings.map((e) => e.rule)).toContain("RFC-IMP-12");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe("RFC-IMP-12 failure mode: no report", () => {
|
|
71
|
+
it("design: worktree cannot be created → no report; operator may waive", async () => {
|
|
72
|
+
const r = await evaluateAcceptanceVerificationGate({
|
|
73
|
+
targetId: "RFC-9",
|
|
74
|
+
frontmatter: fm,
|
|
75
|
+
reports: [],
|
|
76
|
+
isCandidateBound: bound,
|
|
77
|
+
waiverReason: "export failed",
|
|
78
|
+
});
|
|
79
|
+
expect(r.errors).toEqual([]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// RFC-1333 AC-3, AC-4, AC-7, AC-8, AC-9.
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { describe, expect, expectTypeOf, it } from "vitest";
|
|
4
|
+
import { RFC_IMP_11_BLOCKING } from "../../handlers/implement-stamp-origin.ts";
|
|
5
|
+
import type { AcceptanceVerificationReport } from "../../types.ts";
|
|
6
|
+
|
|
7
|
+
const review = readFileSync(
|
|
8
|
+
new URL("../../../../skills/fo/fo-review/SKILL.md", import.meta.url),
|
|
9
|
+
"utf8",
|
|
10
|
+
);
|
|
11
|
+
const impl = readFileSync(
|
|
12
|
+
new URL("../../../../skills/fo/fo-idea-implement/SKILL.md", import.meta.url),
|
|
13
|
+
"utf8",
|
|
14
|
+
);
|
|
15
|
+
const section = review.split(/^## Acceptance verification mode\s*$/m)[1]?.split(/^## /m)[0] ?? "";
|
|
16
|
+
|
|
17
|
+
describe("RFC-1333 skills/types", () => {
|
|
18
|
+
it("AC-3: fo-review acceptance section covers inputs, minimization, isolation", () => {
|
|
19
|
+
expect(section).not.toBe("");
|
|
20
|
+
expect(section).toMatch(/Inputs/);
|
|
21
|
+
expect(section).toMatch(/[Mm]inimi/);
|
|
22
|
+
expect(section).toMatch(/isolation/);
|
|
23
|
+
});
|
|
24
|
+
it("AC-9: at most two fix rounds, then park", () => {
|
|
25
|
+
expect(section).toMatch(/at most two fix rounds/);
|
|
26
|
+
expect(section).toMatch(/park/);
|
|
27
|
+
});
|
|
28
|
+
it("AC-4: step 4.4b gated on verificationTier: high", () => {
|
|
29
|
+
const step =
|
|
30
|
+
impl.split(/^#### 4\.4b\. Independent acceptance verification/m)[1]?.split(/^#{2,4} /m)[0] ??
|
|
31
|
+
"";
|
|
32
|
+
expect(step).not.toBe("");
|
|
33
|
+
expect(step).toMatch(/verificationTier: high/);
|
|
34
|
+
});
|
|
35
|
+
it("AC-7: RFC-IMP-11 blocking", () => {
|
|
36
|
+
expect(RFC_IMP_11_BLOCKING).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
it("AC-8: report type fields", () => {
|
|
39
|
+
expectTypeOf<AcceptanceVerificationReport>()
|
|
40
|
+
.toHaveProperty("candidateSha")
|
|
41
|
+
.toEqualTypeOf<string>();
|
|
42
|
+
expectTypeOf<AcceptanceVerificationReport>().toHaveProperty("round").toEqualTypeOf<0 | 1 | 2>();
|
|
43
|
+
expectTypeOf<AcceptanceVerificationReport>().toHaveProperty("isolation");
|
|
44
|
+
expectTypeOf<AcceptanceVerificationReport>()
|
|
45
|
+
.toHaveProperty("verifierModel")
|
|
46
|
+
.toEqualTypeOf<string | null>();
|
|
47
|
+
expectTypeOf<AcceptanceVerificationReport>().toHaveProperty("verdict");
|
|
48
|
+
expectTypeOf<AcceptanceVerificationReport>().toHaveProperty("counterexamples");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// RFC-1333 AC-1, AC-2, AC-10, Design step 2/3 — rfc.verify.workspace export.
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
import { buildVerifyWorkspace } from "../../verify-workspace.ts";
|
|
9
|
+
|
|
10
|
+
let repo = "";
|
|
11
|
+
let out = "";
|
|
12
|
+
let removed: string[] = [];
|
|
13
|
+
const git = (...a: string[]) =>
|
|
14
|
+
execFileSync("git", a, {
|
|
15
|
+
cwd: repo,
|
|
16
|
+
encoding: "utf8",
|
|
17
|
+
env: {
|
|
18
|
+
...process.env,
|
|
19
|
+
GIT_AUTHOR_NAME: "t",
|
|
20
|
+
GIT_AUTHOR_EMAIL: "t@t",
|
|
21
|
+
GIT_COMMITTER_NAME: "t",
|
|
22
|
+
GIT_COMMITTER_EMAIL: "t@t",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const put = (rel: string, body: string) => {
|
|
26
|
+
mkdirSync(dirname(join(repo, rel)), { recursive: true });
|
|
27
|
+
writeFileSync(join(repo, rel), body);
|
|
28
|
+
};
|
|
29
|
+
const rfc = (status: string) =>
|
|
30
|
+
`---\nid: RFC-0001\ntitle: "x"\nstatus: ${status}\ncreatedAt: 2026-10-18\n---\n\n## Context\n\nctx\n\n## Problem\n\np\n\n## Decision\n\nd\n\n## Design\n\ndes\n\n## Acceptance criteria\n\n- [ ] AC-1: x\n\n## Implementation notes\n\nSECRET-NARRATIVE\n`;
|
|
31
|
+
|
|
32
|
+
beforeAll(async () => {
|
|
33
|
+
repo = mkdtempSync(join(tmpdir(), "vw-fixture-"));
|
|
34
|
+
git("init", "-q", "-b", "main");
|
|
35
|
+
put("docs/rfcs/rfc-0001-x.md", rfc("draft"));
|
|
36
|
+
put("src/old.test.ts", "// pre-existing\n");
|
|
37
|
+
put("docs/plans/other.md", "unrelated plan\n");
|
|
38
|
+
git("add", "-A");
|
|
39
|
+
git("commit", "-qm", "chore: init");
|
|
40
|
+
put("docs/rfcs/rfc-0001-x.md", rfc("accepted"));
|
|
41
|
+
git("commit", "-qam", "docs: accept");
|
|
42
|
+
put("src/a.ts", "export const a = 1;\n");
|
|
43
|
+
put("src/a.test.ts", "// self test\n");
|
|
44
|
+
put("src/old.test.ts", "// edited by implementer\n");
|
|
45
|
+
put("docs/plans/plan-x.md", "Plan for rfc-0001\n");
|
|
46
|
+
put("docs/reviews/code/r.md", "Review of RFC-0001\n");
|
|
47
|
+
put("docs/sessions/s.md", "session about RFC-0001\n");
|
|
48
|
+
put("docs/rfcs/verification/rfc-0001.generated.yaml", "x: 1\n");
|
|
49
|
+
put("docs/metrics/rfcs/rfc-0001.metrics.yaml", "x: 1\n");
|
|
50
|
+
git("add", "-A");
|
|
51
|
+
git("commit", "-qm", "feat: RFC-0001 impl");
|
|
52
|
+
put("src/v.test.ts", "// verifier\n");
|
|
53
|
+
git("add", "-A");
|
|
54
|
+
git(
|
|
55
|
+
"commit",
|
|
56
|
+
"-qm",
|
|
57
|
+
"test: verifier\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: docs/reviews/acceptance/rfc-0001/a-r0.md",
|
|
58
|
+
);
|
|
59
|
+
const head = git("rev-parse", "HEAD").trim();
|
|
60
|
+
const res = await buildVerifyWorkspace({
|
|
61
|
+
workspaceRoot: repo,
|
|
62
|
+
rfcId: "RFC-0001",
|
|
63
|
+
candidateSha: head,
|
|
64
|
+
});
|
|
65
|
+
expect(res.status).toBe("pass");
|
|
66
|
+
out = res.path!;
|
|
67
|
+
removed = res.removed;
|
|
68
|
+
});
|
|
69
|
+
afterAll(() => {
|
|
70
|
+
rmSync(repo, { recursive: true, force: true });
|
|
71
|
+
if (out) rmSync(out, { recursive: true, force: true });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("RFC-1333 rfc.verify.workspace", () => {
|
|
75
|
+
it("AC-1: self-origin test files are absent", () => {
|
|
76
|
+
expect(existsSync(join(out, "src/a.test.ts"))).toBe(false);
|
|
77
|
+
expect(existsSync(join(out, "src/old.test.ts"))).toBe(false);
|
|
78
|
+
expect(existsSync(join(out, "src/a.ts"))).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
it("AC-1 (design): verifier-trailer test files are kept", () => {
|
|
81
|
+
expect(existsSync(join(out, "src/v.test.ts"))).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
it("AC-2: plan/review/session docs referencing the RFC are absent; unrelated kept", () => {
|
|
84
|
+
expect(existsSync(join(out, "docs/plans/plan-x.md"))).toBe(false);
|
|
85
|
+
expect(existsSync(join(out, "docs/reviews/code/r.md"))).toBe(false);
|
|
86
|
+
expect(existsSync(join(out, "docs/sessions/s.md"))).toBe(false);
|
|
87
|
+
expect(existsSync(join(out, "docs/plans/other.md"))).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
it("design: verification envelope and metrics removed", () => {
|
|
90
|
+
expect(existsSync(join(out, "docs/rfcs/verification/rfc-0001.generated.yaml"))).toBe(false);
|
|
91
|
+
expect(existsSync(join(out, "docs/metrics/rfcs/rfc-0001.metrics.yaml"))).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
it("AC-10: no .git entry", () => {
|
|
94
|
+
expect(existsSync(join(out, ".git"))).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
it("design step 3: bundle carries only normative sections and removed list", () => {
|
|
97
|
+
const b = readFileSync(join(out, "VERIFY-BUNDLE.md"), "utf8");
|
|
98
|
+
for (const h of ["Context", "Problem", "Decision", "Design", "Acceptance criteria"])
|
|
99
|
+
expect(b).toContain(`## ${h}`);
|
|
100
|
+
expect(b).not.toContain("SECRET-NARRATIVE");
|
|
101
|
+
for (const r of removed) expect(b).toContain(`- ${r}`);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1333: rfc.verify.workspace tests — stripped, git-free export of a committed candidate over a temporary git repository.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Do not run a verifier — only the export contract is under test.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1333: tests for AC-1, AC-2, AC-10.</item>
|
|
10
|
+
<item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
|
|
11
|
+
</CHANGE_SUMMARY>
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { execFileSync } from "node:child_process";
|
|
15
|
+
import { existsSync } from "node:fs";
|
|
16
|
+
import * as fs from "node:fs/promises";
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
20
|
+
import { buildVerifyWorkspace } from "./verify-workspace.ts";
|
|
21
|
+
|
|
22
|
+
let root: string;
|
|
23
|
+
let out: string;
|
|
24
|
+
|
|
25
|
+
function git(...args: string[]): string {
|
|
26
|
+
return execFileSync(
|
|
27
|
+
"git",
|
|
28
|
+
["-c", "core.hooksPath=/dev/null", "-c", "user.email=t@t", "-c", "user.name=T", ...args],
|
|
29
|
+
{ cwd: root, encoding: "utf8" },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function commit(message: string, files: Record<string, string>): Promise<string> {
|
|
34
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
35
|
+
await fs.mkdir(path.dirname(path.join(root, rel)), { recursive: true });
|
|
36
|
+
await fs.writeFile(path.join(root, rel), content);
|
|
37
|
+
}
|
|
38
|
+
git("add", "-A");
|
|
39
|
+
git("commit", "-qm", message);
|
|
40
|
+
return git("rev-parse", "HEAD").trim();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const rfc = (status: string) =>
|
|
44
|
+
`---\nid: RFC-9002\ntitle: "Fixture"\nstatus: ${status}\ncreatedAt: 2026-10-18\n---\n\n# RFC-9002: Fixture\n\n## Context\n\nCtx.\n\n## Decision\n\nDecide.\n\n## Risks\n\nInternal only.\n\n## Acceptance criteria\n\n- [ ] AC-1: WHEN x, THE y SHALL z.\n`;
|
|
45
|
+
|
|
46
|
+
let candidate: string;
|
|
47
|
+
|
|
48
|
+
beforeEach(async () => {
|
|
49
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), "verify-ws-"));
|
|
50
|
+
out = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "verify-out-")), "tree");
|
|
51
|
+
git("init", "-q");
|
|
52
|
+
await commit("draft", {
|
|
53
|
+
"docs/rfcs/rfc-9002-fixture.md": rfc("draft"),
|
|
54
|
+
"src/old.test.ts": "it('pre-existing', () => {});\n",
|
|
55
|
+
});
|
|
56
|
+
await commit("accept", { "docs/rfcs/rfc-9002-fixture.md": rfc("accepted") });
|
|
57
|
+
candidate = await commit("RFC-9002: implement", {
|
|
58
|
+
"src/feature.ts": "export const f = 1;\n",
|
|
59
|
+
"src/feature.test.ts": "it('self', () => {});\n",
|
|
60
|
+
"docs/plans/plan-rfc-9002-fixture.md": "# plan for RFC-9002\n",
|
|
61
|
+
"docs/reviews/code/x/review-1.md": "reviews RFC-9002\n",
|
|
62
|
+
"docs/sessions/s.md": "unrelated session\n",
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
afterEach(async () => {
|
|
67
|
+
await fs.rm(root, { recursive: true, force: true });
|
|
68
|
+
await fs.rm(path.dirname(out), { recursive: true, force: true });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("rfc.verify.workspace (RFC-1333)", () => {
|
|
72
|
+
it("omits test files whose derived origin is self from the verifier worktree", async () => {
|
|
73
|
+
const r = await buildVerifyWorkspace({
|
|
74
|
+
workspaceRoot: root,
|
|
75
|
+
rfcId: "RFC-9002",
|
|
76
|
+
candidateSha: candidate,
|
|
77
|
+
outDir: out,
|
|
78
|
+
});
|
|
79
|
+
expect(r.status, r.error).toBe("pass");
|
|
80
|
+
expect(existsSync(path.join(out, "src/feature.test.ts"))).toBe(false);
|
|
81
|
+
expect(existsSync(path.join(out, "src/old.test.ts")), "pre-acceptance tests stay visible").toBe(
|
|
82
|
+
true,
|
|
83
|
+
);
|
|
84
|
+
expect(existsSync(path.join(out, "src/feature.ts"))).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("omits plan, review, and session documents for the RFC from the verifier worktree", async () => {
|
|
88
|
+
const r = await buildVerifyWorkspace({
|
|
89
|
+
workspaceRoot: root,
|
|
90
|
+
rfcId: "RFC-9002",
|
|
91
|
+
candidateSha: candidate,
|
|
92
|
+
outDir: out,
|
|
93
|
+
});
|
|
94
|
+
expect(existsSync(path.join(out, "docs/plans/plan-rfc-9002-fixture.md"))).toBe(false);
|
|
95
|
+
expect(existsSync(path.join(out, "docs/reviews/code/x/review-1.md"))).toBe(false);
|
|
96
|
+
expect(existsSync(path.join(out, "docs/sessions/s.md")), "unrelated docs stay").toBe(true);
|
|
97
|
+
const bundle = await fs.readFile(path.join(out, "VERIFY-BUNDLE.md"), "utf8");
|
|
98
|
+
expect(bundle).toContain("## Decision");
|
|
99
|
+
expect(bundle).not.toContain("## Risks");
|
|
100
|
+
expect(r.removed).toContain("src/feature.test.ts");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("fails without leaving a partial tree for an unknown candidate", async () => {
|
|
104
|
+
const r = await buildVerifyWorkspace({
|
|
105
|
+
workspaceRoot: root,
|
|
106
|
+
rfcId: "RFC-9002",
|
|
107
|
+
candidateSha: "not-a-ref",
|
|
108
|
+
});
|
|
109
|
+
expect(r.status).toBe("fail");
|
|
110
|
+
expect(r.path).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("exports the candidate without git metadata", async () => {
|
|
114
|
+
await buildVerifyWorkspace({
|
|
115
|
+
workspaceRoot: root,
|
|
116
|
+
rfcId: "RFC-9002",
|
|
117
|
+
candidateSha: candidate,
|
|
118
|
+
outDir: out,
|
|
119
|
+
});
|
|
120
|
+
expect(existsSync(path.join(out, ".git"))).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
});
|