@warpgogol/forge 7.0.0 → 8.0.4
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 +33 -0
- package/bin/cli.js +6 -12
- package/bin/cli.ts +3 -2
- package/bin/resolve-entry.js +24 -0
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/authority/authority.module.d.ts +3 -0
- package/dist/os/authority/authority.module.d.ts.map +1 -0
- package/dist/os/authority/authority.module.js +169 -0
- package/dist/os/authority/authority.module.js.map +1 -0
- package/dist/os/authority/handlers/delegate-revoke.d.ts +15 -0
- package/dist/os/authority/handlers/delegate-revoke.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegate-revoke.js +91 -0
- package/dist/os/authority/handlers/delegate-revoke.js.map +1 -0
- package/dist/os/authority/handlers/delegate.d.ts +14 -0
- package/dist/os/authority/handlers/delegate.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegate.js +134 -0
- package/dist/os/authority/handlers/delegate.js.map +1 -0
- package/dist/os/authority/handlers/delegation-list.d.ts +12 -0
- package/dist/os/authority/handlers/delegation-list.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegation-list.js +54 -0
- package/dist/os/authority/handlers/delegation-list.js.map +1 -0
- package/dist/os/authority/handlers/delegation-validate.d.ts +11 -0
- package/dist/os/authority/handlers/delegation-validate.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegation-validate.js +132 -0
- package/dist/os/authority/handlers/delegation-validate.js.map +1 -0
- package/dist/os/authority/helpers.d.ts +36 -0
- package/dist/os/authority/helpers.d.ts.map +1 -0
- package/dist/os/authority/helpers.js +83 -0
- package/dist/os/authority/helpers.js.map +1 -0
- package/dist/os/authority/index.d.ts +2 -0
- package/dist/os/authority/index.d.ts.map +1 -0
- package/dist/os/authority/index.js +14 -0
- package/dist/os/authority/index.js.map +1 -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 +51 -1
- 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 +594 -81
- 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 +90 -9
- 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 +89 -5
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +89 -12
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +17 -10
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +10 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +175 -10
- 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/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +41 -10
- package/dist/os/session/handlers/save.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/authority/delegations.d.ts +108 -0
- package/dist/src/authority/delegations.d.ts.map +1 -0
- package/dist/src/authority/delegations.js +217 -0
- package/dist/src/authority/delegations.js.map +1 -0
- package/dist/src/authority/index.d.ts +3 -0
- package/dist/src/authority/index.d.ts.map +1 -0
- package/dist/src/authority/index.js +17 -0
- package/dist/src/authority/index.js.map +1 -0
- package/dist/src/authority/signing.d.ts +8 -0
- package/dist/src/authority/signing.d.ts.map +1 -0
- package/dist/src/authority/signing.js +72 -0
- package/dist/src/authority/signing.js.map +1 -0
- 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/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/authority/authority.module.ts +183 -0
- package/os/authority/authority.test.ts +328 -0
- package/os/authority/handlers/delegate-revoke.ts +123 -0
- package/os/authority/handlers/delegate.ts +190 -0
- package/os/authority/handlers/delegation-list.ts +80 -0
- package/os/authority/handlers/delegation-validate.ts +231 -0
- package/os/authority/helpers.ts +111 -0
- package/os/authority/index.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 +25 -0
- package/os/rfc/acceptance.ts +51 -1
- 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 +20 -2
- package/os/rfc/handlers/implement-stamp.ts +714 -87
- 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 +14 -0
- package/os/rfc/handlers/validate-rules.ts +122 -13
- package/os/rfc/handlers/validate.test.ts +4 -3
- package/os/rfc/reachable-symbol.ts +441 -0
- package/os/rfc/rfc-0000-template.md +3 -0
- 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 +95 -5
- package/os/rfc/types.ts +116 -12
- package/os/rfc/verification-emit-check.test.ts +14 -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 +230 -10
- package/os/rfc/verification-normalize.test.ts +14 -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/session/handlers/save.ts +43 -9
- 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 +13 -1
- package/skills/_shared/agent-operating-model.md +1 -1
- 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-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/authority/delegations.ts +267 -0
- package/src/authority/index.ts +38 -0
- package/src/authority/signing.ts +73 -0
- 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/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/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/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/rfc-validate-delegation.test.ts +178 -0
- package/src/tests/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +79 -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 +14 -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
package/os/rfc/types.ts
CHANGED
|
@@ -12,16 +12,13 @@
|
|
|
12
12
|
* </non-goals>
|
|
13
13
|
* </MODULE_CONTRACT>
|
|
14
14
|
* * <CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-
|
|
16
|
-
<item>RFC-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<item>RFC-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
23
|
-
<item>RFC-1271: review wave — deep probe normalization, malformed-envelope fail-closed, post-stamp re-emit, honest repair hints</item>
|
|
24
|
-
<history>RFC-0465, RFC-0478, RFC-0480, RFC-0795, RFC-0998</history>
|
|
15
|
+
<item>RFC-1322: steps 1-3 — --check-criteria flag, auto-check pass, atomic flip+stamp</item>
|
|
16
|
+
<item>RFC-1322: fo-review fix pass — criteriaPendingRefresh/evidenceWouldRefresh dry-run fields</item>
|
|
17
|
+
<item>RFC-1330: origin contracts, RFC_ORIGIN_CUTOFF, RFC-IMP-10/11 rule ids, stamp warnings.</item>
|
|
18
|
+
<item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
|
|
19
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
20
|
+
<item>RFC-1336: RfcFrontmatter.decidedBy — the granting human when an agent:<id> reviewer decided under an rfc.decision delegation; added to RFC_KNOWN_KEYS.</item>
|
|
21
|
+
<history>RFC-0465, RFC-0478, RFC-0480, RFC-0795, RFC-0998, RFC-0999, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1320</history>
|
|
25
22
|
</CHANGE_SUMMARY>
|
|
26
23
|
***************************************************************/
|
|
27
24
|
|
|
@@ -162,6 +159,14 @@ export interface RfcFrontmatter {
|
|
|
162
159
|
/** Optional additional reviewers. */
|
|
163
160
|
reviewers?: string[];
|
|
164
161
|
|
|
162
|
+
/**
|
|
163
|
+
* RFC-1336: the granting human when a reviewer is `agent:<id>` —
|
|
164
|
+
* V-25 admits an agent reviewer only when decidedBy names the operator
|
|
165
|
+
* AND an active `rfc.decision` delegation covers the agent under that
|
|
166
|
+
* grantor. Absent on human-decided RFCs.
|
|
167
|
+
*/
|
|
168
|
+
decidedBy?: string;
|
|
169
|
+
|
|
165
170
|
/** ISO 8601 date of creation. */
|
|
166
171
|
createdAt: string;
|
|
167
172
|
|
|
@@ -329,6 +334,10 @@ export type AcceptanceProbe = (
|
|
|
329
334
|
expect: { exitCode: number };
|
|
330
335
|
criterion?: string;
|
|
331
336
|
}
|
|
337
|
+
// RFC-1334: structural wiring — symbol mode (value-imported by a non-test
|
|
338
|
+
// module, optionally inside a root's import graph) or command mode (manifest reachableVia).
|
|
339
|
+
| { probe: "reachable"; symbol: string; module: string; root?: string; criterion?: string }
|
|
340
|
+
| { probe: "reachable"; command: string; criterion?: string }
|
|
332
341
|
// RFC-0998: validate a JSON/YAML artifact against an inline JSON Schema using Ajv.
|
|
333
342
|
| {
|
|
334
343
|
probe: "json-schema";
|
|
@@ -357,6 +366,52 @@ export interface VerificationEvidenceProbeRecord {
|
|
|
357
366
|
ok: boolean;
|
|
358
367
|
detail: string;
|
|
359
368
|
durationMs: number;
|
|
369
|
+
/** RFC-1330: git-derived origin — present for RFCs created on or after RFC_ORIGIN_CUTOFF. */
|
|
370
|
+
origin?: ProbeOriginRecord;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* RFC-1330: origin of a probe derived from git history of the RFC's
|
|
375
|
+
* implementation range (base = `status: accepted` transition, head = HEAD).
|
|
376
|
+
* `presence` marks structural probe kinds whose origin is not counted.
|
|
377
|
+
*/
|
|
378
|
+
export type DerivedProbeOrigin = "self" | "verifier" | "unchanged" | "unresolved";
|
|
379
|
+
|
|
380
|
+
export interface ProbeOriginRecord {
|
|
381
|
+
declared: RfcExpectationSource | "undeclared";
|
|
382
|
+
derivedOrigin: DerivedProbeOrigin | "presence";
|
|
383
|
+
effective: RfcExpectationSource | "undeclared" | "presence";
|
|
384
|
+
/** Commit SHAs (short) that made the probe self, or the verifier report path. */
|
|
385
|
+
reason: string[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** RFC-1333: one minimized counterexample returned by the acceptance verifier. */
|
|
389
|
+
export interface AcceptanceCounterexample {
|
|
390
|
+
id: string; // CX-1, CX-2 …
|
|
391
|
+
criterion: string; // AC-N or "design:<heading>"
|
|
392
|
+
input: string;
|
|
393
|
+
expected: string; // quoted RFC text the expectation follows from
|
|
394
|
+
observed: string;
|
|
395
|
+
reproCommand: string;
|
|
396
|
+
triage?: "confirmed" | "disputed";
|
|
397
|
+
triageReason?: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** RFC-1333: frontmatter of docs/reviews/acceptance/<rfc>/acceptance-<date>-r<round>.md. */
|
|
401
|
+
export interface AcceptanceVerificationReport {
|
|
402
|
+
rfcId: string;
|
|
403
|
+
candidateSha: string;
|
|
404
|
+
round: 0 | 1 | 2;
|
|
405
|
+
isolation: "subagent" | "isolated-inline" | "inline";
|
|
406
|
+
verifierModel: string | null;
|
|
407
|
+
verdict: "pass" | "counterexamples" | "inconclusive";
|
|
408
|
+
counterexamples: AcceptanceCounterexample[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface ImplementationRange {
|
|
412
|
+
/** null ⇒ unresolved (no `status: accepted` transition in history). */
|
|
413
|
+
base: string | null;
|
|
414
|
+
head: string;
|
|
360
415
|
}
|
|
361
416
|
|
|
362
417
|
export interface VerificationEvidence {
|
|
@@ -391,7 +446,13 @@ export interface RfcVerificationEmitResult {
|
|
|
391
446
|
overall: "pass" | "fail";
|
|
392
447
|
previousOverall?: "pass" | "fail";
|
|
393
448
|
}>;
|
|
394
|
-
|
|
449
|
+
// RFC-1320: "stale-generated-artifact" — EVIDENCE-FRESH-01 blocked the
|
|
450
|
+
// pre-probe freshness gate; "unknown-probe-kind" — EVIDENCE-FRESH-03, a
|
|
451
|
+
// probe kind outside the artifact map (fail-closed); no envelope either way.
|
|
452
|
+
skipped: Array<{
|
|
453
|
+
rfcId: string;
|
|
454
|
+
reason: "no-probes" | "stale-generated-artifact" | "unknown-probe-kind";
|
|
455
|
+
}>;
|
|
395
456
|
diagnostics: Diagnostic[];
|
|
396
457
|
delta?: VerificationDelta;
|
|
397
458
|
/** RFC-1271 `--check`: committed-vs-fresh comparison per RFC — populated
|
|
@@ -522,6 +583,8 @@ export interface DecisionLogResult {
|
|
|
522
583
|
count: number;
|
|
523
584
|
entries: DecisionLogEntry[];
|
|
524
585
|
written?: string[];
|
|
586
|
+
/** RFC-1320: dry-run render surface for generated.drift.validate. */
|
|
587
|
+
renderedFiles?: Record<string, string>;
|
|
525
588
|
}
|
|
526
589
|
|
|
527
590
|
export interface ConsultedDecision {
|
|
@@ -598,6 +661,15 @@ export interface RfcImplementStampData {
|
|
|
598
661
|
implementationCommit: string;
|
|
599
662
|
stampedAt: string;
|
|
600
663
|
criteriaChecked: number;
|
|
664
|
+
/** RFC-1322: criterion ids flipped `[ ]` → `[x]` by --check-criteria. */
|
|
665
|
+
criteriaAutoChecked?: string[];
|
|
666
|
+
/**
|
|
667
|
+
* RFC-1322 dry-run only: criterion ids whose `probe:` annotations await the
|
|
668
|
+
* envelope refresh a real run would perform — pending, not failures.
|
|
669
|
+
*/
|
|
670
|
+
criteriaPendingRefresh?: string[];
|
|
671
|
+
/** RFC-1322 dry-run only: the missing/stale envelope would be refreshed first. */
|
|
672
|
+
evidenceWouldRefresh?: boolean;
|
|
601
673
|
evidencePath?: string;
|
|
602
674
|
evidenceReEmitted?: boolean;
|
|
603
675
|
metricsPath?: string;
|
|
@@ -612,7 +684,25 @@ export type RfcImplementStampRule =
|
|
|
612
684
|
| "RFC-IMP-06"
|
|
613
685
|
| "RFC-IMP-07"
|
|
614
686
|
| "RFC-IMP-08"
|
|
615
|
-
| "RFC-IMP-09"
|
|
687
|
+
| "RFC-IMP-09"
|
|
688
|
+
// RFC-1330: declared expectationSource contradicted by git-derived origin.
|
|
689
|
+
| "RFC-IMP-10"
|
|
690
|
+
// RFC-1330: verificationTier high WHEN/IF criterion without non-self evidence.
|
|
691
|
+
| "RFC-IMP-11"
|
|
692
|
+
// RFC-1333: verificationTier high needs a passing, subagent-isolated
|
|
693
|
+
// acceptance-verification report bound to the implementation commit.
|
|
694
|
+
| "RFC-IMP-12"
|
|
695
|
+
// RFC-1310: commit-time governance provenance — the implementation commit
|
|
696
|
+
// must carry the X-RFC trailer or an injected CHANGE_SUMMARY item.
|
|
697
|
+
| "STAMP-GOV-01"
|
|
698
|
+
// RFC-1306: --sync delegates to rfc.evidence.sync through ctx.invoke; the
|
|
699
|
+
// chain's own rule ids surface as stamp violations on host-less or
|
|
700
|
+
// mid-chain-failure paths.
|
|
701
|
+
| "EVIDENCE-SYNC-01"
|
|
702
|
+
| "EVIDENCE-SYNC-02"
|
|
703
|
+
// RFC-1322: --check-criteria — an unchecked criterion carries no resolvable
|
|
704
|
+
// (evidence: ...) annotation; the stamp refuses rather than blank-checking.
|
|
705
|
+
| "STAMP-CHECK-01";
|
|
616
706
|
|
|
617
707
|
export interface RfcImplementStampViolation {
|
|
618
708
|
rule: RfcImplementStampRule;
|
|
@@ -624,6 +714,8 @@ export interface RfcImplementStampResult {
|
|
|
624
714
|
status: "pass" | "fail";
|
|
625
715
|
data?: RfcImplementStampData;
|
|
626
716
|
violations: RfcImplementStampViolation[];
|
|
717
|
+
/** RFC-1330: non-blocking gate findings (RFC-IMP-11 until RFC-1333). */
|
|
718
|
+
warnings?: RfcImplementStampViolation[];
|
|
627
719
|
} // ─── Constants ───────────────────────────────────────────────────────────────
|
|
628
720
|
export const RFC_DIR = "docs/rfcs";
|
|
629
721
|
export const RFC_TEMPLATE_FILE = "docs/rfcs/rfc-0000-template.md";
|
|
@@ -653,6 +745,7 @@ export const RFC_KNOWN_KEYS: readonly string[] = [
|
|
|
653
745
|
"scope",
|
|
654
746
|
"owners",
|
|
655
747
|
"reviewers",
|
|
748
|
+
"decidedBy",
|
|
656
749
|
"createdAt",
|
|
657
750
|
"updatedAt",
|
|
658
751
|
"enhancedAt",
|
|
@@ -711,6 +804,17 @@ export const RFC_PROBE_BINDING_CUTOFF = "2026-09-01";
|
|
|
711
804
|
*/
|
|
712
805
|
export const RFC_CRITERIA_CONTENT_CUTOFF = "2026-09-03";
|
|
713
806
|
|
|
807
|
+
/**
|
|
808
|
+
* RFC-1330: cutoff date for git-derived probe origin. RFCs created on or after
|
|
809
|
+
* this date get `origin` records in their evidence envelope and are subject to
|
|
810
|
+
* V-44 (presence-only behavioral criterion), RFC-IMP-10 (declared origin
|
|
811
|
+
* contradicted by git), and RFC-IMP-11 (HIGH tier needs non-self evidence).
|
|
812
|
+
*/
|
|
813
|
+
export const RFC_ORIGIN_CUTOFF = "2026-10-18";
|
|
814
|
+
|
|
815
|
+
/** RFC-1334: cutoff for V-45 (proposed/added commands need a command-mode reachable probe). */
|
|
816
|
+
export const RFC_REACHABLE_CUTOFF = "2026-10-18";
|
|
817
|
+
|
|
714
818
|
/**
|
|
715
819
|
* RFC-0997: non-blocking probe coverage report per RFC.
|
|
716
820
|
* Emitted in `rfc.validate --json` and `rfc.acceptance.run` outputs.
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for verification emit check covering rfc.verification.emit --check (RFC-1271).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the verification suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
// @vitest-environment node
|
|
2
16
|
import { test, expect, describe, vi, beforeEach, afterEach } from "vitest";
|
|
3
17
|
import fs from "node:fs/promises";
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1320 unit tests for the pre-probe generated-artifact freshness gate inside rfc.verification.emit — EVIDENCE-FRESH-01 blocking on stale/missing probe-referenced artifacts; EVIDENCE-FRESH-02 warnings on unverifiable freshness; EVIDENCE-FRESH-03 loud failure on unknown probe kinds; emit-owned artifact exclusion.
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1320: initial suite — sync-remedy, non-sync owner remedy, absent invoke, render-unavailable, fresh pass-through, no-artifact probes, emit-owned exclusion, unowned paths, unknown kind.</item>
|
|
12
|
+
<item>RFC-1320</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// @vitest-environment node
|
|
17
|
+
import { test, expect, describe, vi, beforeEach, afterEach } from "vitest";
|
|
18
|
+
import fs from "node:fs/promises";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
import os from "node:os";
|
|
21
|
+
|
|
22
|
+
import { runRfcVerificationEmit, probeArtifactCandidates } from "./verification-evidence.ts";
|
|
23
|
+
import type { ForgeCommandInput, ForgeRuntimeContext } from "../../src/types.ts";
|
|
24
|
+
|
|
25
|
+
const { mockRunProbe } = vi.hoisted(() => ({
|
|
26
|
+
mockRunProbe: vi.fn(),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
vi.mock("./acceptance.ts", () => ({
|
|
30
|
+
runProbe: mockRunProbe,
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
const MANIFEST = "docs/command-manifest.generated.yaml";
|
|
34
|
+
|
|
35
|
+
function frontmatter(id: string, probeYaml: string): string {
|
|
36
|
+
return `---\nid: ${id}\ntitle: "Test ${id}"\nstatus: implemented\nkind: command\nscope: workspace\nowners:\n - architecture\ncreatedAt: 2026-01-01\nupdatedAt: 2026-01-01\nacceptance:\n${probeYaml}\n---\n\n# ${id}\n## Context\nTest.\n`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const PROBE_BLOCK = {
|
|
40
|
+
fileExistsManifest: ` - probe: file-exists\n path: ${MANIFEST}\n criterion: AC-1`,
|
|
41
|
+
fileContainsManifest: ` - probe: file-contains\n path: ${MANIFEST}\n pattern: "command-manifest"\n criterion: AC-1`,
|
|
42
|
+
commandRegistered: ` - probe: command-registered\n name: checks.commands.generate\n criterion: AC-1`,
|
|
43
|
+
runOnly: ` - probe: run\n command: "werkstatt run rfc.validate --id RFC-0100"\n expect:\n exitCode: 0\n criterion: AC-1`,
|
|
44
|
+
emitOwned: ` - probe: file-exists\n path: docs/rfcs/verification/rfc-0099.generated.yaml\n criterion: AC-1`,
|
|
45
|
+
unknownKind: ` - probe: teleport\n path: anywhere\n criterion: AC-1`,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
async function setupWorkspace(probeYaml: string, id = "RFC-0100") {
|
|
49
|
+
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "rfc-fresh-test-"));
|
|
50
|
+
await fs.mkdir(path.join(tmpDir, "docs", "rfcs"), { recursive: true });
|
|
51
|
+
await fs.writeFile(
|
|
52
|
+
path.join(tmpDir, "docs", "rfcs", `${id.toLowerCase()}-test.md`),
|
|
53
|
+
frontmatter(id, probeYaml),
|
|
54
|
+
);
|
|
55
|
+
return {
|
|
56
|
+
workspaceRoot: tmpDir,
|
|
57
|
+
envelope: path.join(
|
|
58
|
+
tmpDir,
|
|
59
|
+
"docs",
|
|
60
|
+
"rfcs",
|
|
61
|
+
"verification",
|
|
62
|
+
`${id.toLowerCase()}.generated.yaml`,
|
|
63
|
+
),
|
|
64
|
+
cleanup: () => fs.rm(tmpDir, { recursive: true, force: true }),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function driftResult(artifacts: unknown[]) {
|
|
69
|
+
return {
|
|
70
|
+
exitCode: 0,
|
|
71
|
+
ok: true,
|
|
72
|
+
data: { command: "generated.drift.validate", diagnostics: [], artifacts },
|
|
73
|
+
summary: "freshness",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function makeContext(
|
|
78
|
+
workspaceRoot: string,
|
|
79
|
+
overrides: Record<string, unknown> = {},
|
|
80
|
+
): ForgeRuntimeContext {
|
|
81
|
+
return {
|
|
82
|
+
workspaceRoot,
|
|
83
|
+
logger: { info: () => {}, warn: () => {} },
|
|
84
|
+
outputFormat: "json",
|
|
85
|
+
dryRun: false,
|
|
86
|
+
...overrides,
|
|
87
|
+
} as unknown as ForgeRuntimeContext;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
mockRunProbe.mockReset();
|
|
92
|
+
mockRunProbe.mockResolvedValue({ probe: {}, ok: true, detail: "ok" });
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
afterEach(() => {
|
|
96
|
+
vi.restoreAllMocks();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe("EVIDENCE-FRESH-01 — blocking", () => {
|
|
100
|
+
test("stale command manifest blocks emit and names rfc.evidence.sync as remedy", async () => {
|
|
101
|
+
const { workspaceRoot, envelope, cleanup } = await setupWorkspace(
|
|
102
|
+
PROBE_BLOCK.fileContainsManifest,
|
|
103
|
+
);
|
|
104
|
+
const invoke = vi
|
|
105
|
+
.fn()
|
|
106
|
+
.mockResolvedValue(
|
|
107
|
+
driftResult([{ path: MANIFEST, owner: "command.manifest.generate", verdict: "stale" }]),
|
|
108
|
+
);
|
|
109
|
+
try {
|
|
110
|
+
const result = await runRfcVerificationEmit(
|
|
111
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
112
|
+
makeContext(workspaceRoot, { invoke }),
|
|
113
|
+
);
|
|
114
|
+
expect(invoke).toHaveBeenCalledWith("generated.drift.validate", {
|
|
115
|
+
target: "workspace",
|
|
116
|
+
paths: [MANIFEST],
|
|
117
|
+
});
|
|
118
|
+
const diag = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-01");
|
|
119
|
+
expect(diag?.severity).toBe("error");
|
|
120
|
+
expect(diag?.message).toContain("command.manifest.generate");
|
|
121
|
+
expect(diag?.message).toContain("rfc.evidence.sync --id RFC-0100");
|
|
122
|
+
expect(result.data!.emitted).toHaveLength(0);
|
|
123
|
+
expect(result.data!.skipped[0]?.reason).toBe("stale-generated-artifact");
|
|
124
|
+
expect(result.exitCode).toBe(1);
|
|
125
|
+
// No probes ran, no envelope written — emit stays read-only.
|
|
126
|
+
expect(mockRunProbe).not.toHaveBeenCalled();
|
|
127
|
+
await expect(fs.stat(envelope)).rejects.toThrow();
|
|
128
|
+
} finally {
|
|
129
|
+
await cleanup();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("missing artifact owned by a non-sync generator names the generator command", async () => {
|
|
134
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(
|
|
135
|
+
` - probe: file-exists\n path: packages/x/out.generated.json\n criterion: AC-1`,
|
|
136
|
+
);
|
|
137
|
+
const invoke = vi.fn().mockResolvedValue(
|
|
138
|
+
driftResult([
|
|
139
|
+
{
|
|
140
|
+
path: "packages/x/out.generated.json",
|
|
141
|
+
owner: "custom.artifact.generate",
|
|
142
|
+
verdict: "missing",
|
|
143
|
+
},
|
|
144
|
+
]),
|
|
145
|
+
);
|
|
146
|
+
try {
|
|
147
|
+
const result = await runRfcVerificationEmit(
|
|
148
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
149
|
+
makeContext(workspaceRoot, { invoke }),
|
|
150
|
+
);
|
|
151
|
+
const diag = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-01");
|
|
152
|
+
expect(diag?.message).toContain("custom.artifact.generate");
|
|
153
|
+
expect(diag?.message).not.toContain("rfc.evidence.sync");
|
|
154
|
+
expect(result.exitCode).toBe(1);
|
|
155
|
+
} finally {
|
|
156
|
+
await cleanup();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("command-registered probe maps to the command manifest artifact", async () => {
|
|
161
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.commandRegistered);
|
|
162
|
+
const invoke = vi
|
|
163
|
+
.fn()
|
|
164
|
+
.mockResolvedValue(
|
|
165
|
+
driftResult([{ path: MANIFEST, owner: "command.manifest.generate", verdict: "fresh" }]),
|
|
166
|
+
);
|
|
167
|
+
try {
|
|
168
|
+
const result = await runRfcVerificationEmit(
|
|
169
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
170
|
+
makeContext(workspaceRoot, { invoke }),
|
|
171
|
+
);
|
|
172
|
+
expect(invoke).toHaveBeenCalledWith("generated.drift.validate", {
|
|
173
|
+
target: "workspace",
|
|
174
|
+
paths: [MANIFEST],
|
|
175
|
+
});
|
|
176
|
+
expect(result.exitCode).toBe(0);
|
|
177
|
+
} finally {
|
|
178
|
+
await cleanup();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe("EVIDENCE-FRESH-02 — unverifiable, probes still run", () => {
|
|
184
|
+
test("absent context.invoke warns and still emits", async () => {
|
|
185
|
+
const { workspaceRoot, envelope, cleanup } = await setupWorkspace(
|
|
186
|
+
PROBE_BLOCK.fileExistsManifest,
|
|
187
|
+
);
|
|
188
|
+
try {
|
|
189
|
+
const result = await runRfcVerificationEmit(
|
|
190
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
191
|
+
makeContext(workspaceRoot),
|
|
192
|
+
);
|
|
193
|
+
const warn = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-02");
|
|
194
|
+
expect(warn?.severity).toBe("warning");
|
|
195
|
+
expect(warn?.message).toContain("context.invoke absent");
|
|
196
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
197
|
+
expect(result.exitCode).toBe(0);
|
|
198
|
+
await expect(fs.stat(envelope)).resolves.toBeDefined();
|
|
199
|
+
} finally {
|
|
200
|
+
await cleanup();
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("invoke throwing warns and still emits", async () => {
|
|
205
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.fileExistsManifest);
|
|
206
|
+
const invoke = vi.fn().mockRejectedValue(new Error("kernel down"));
|
|
207
|
+
try {
|
|
208
|
+
const result = await runRfcVerificationEmit(
|
|
209
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
210
|
+
makeContext(workspaceRoot, { invoke }),
|
|
211
|
+
);
|
|
212
|
+
const warn = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-02");
|
|
213
|
+
expect(warn?.message).toContain("kernel down");
|
|
214
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
215
|
+
expect(result.exitCode).toBe(0);
|
|
216
|
+
} finally {
|
|
217
|
+
await cleanup();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test("render-unavailable verdict warns and still emits", async () => {
|
|
222
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.fileExistsManifest);
|
|
223
|
+
const invoke = vi
|
|
224
|
+
.fn()
|
|
225
|
+
.mockResolvedValue(
|
|
226
|
+
driftResult([
|
|
227
|
+
{ path: MANIFEST, owner: "command.manifest.generate", verdict: "render-unavailable" },
|
|
228
|
+
]),
|
|
229
|
+
);
|
|
230
|
+
try {
|
|
231
|
+
const result = await runRfcVerificationEmit(
|
|
232
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
233
|
+
makeContext(workspaceRoot, { invoke }),
|
|
234
|
+
);
|
|
235
|
+
const warn = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-02");
|
|
236
|
+
expect(warn?.message).toContain("render-unavailable");
|
|
237
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
238
|
+
expect(result.exitCode).toBe(0);
|
|
239
|
+
} finally {
|
|
240
|
+
await cleanup();
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("payload without artifact verdicts warns and still emits", async () => {
|
|
245
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.fileExistsManifest);
|
|
246
|
+
const invoke = vi.fn().mockResolvedValue({ exitCode: 0, ok: true, data: {}, summary: "ok" });
|
|
247
|
+
try {
|
|
248
|
+
const result = await runRfcVerificationEmit(
|
|
249
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
250
|
+
makeContext(workspaceRoot, { invoke }),
|
|
251
|
+
);
|
|
252
|
+
const warn = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-02");
|
|
253
|
+
expect(warn?.message).toContain("no artifact verdicts");
|
|
254
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
255
|
+
} finally {
|
|
256
|
+
await cleanup();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe("freshness gate — no-op and exclusion cases", () => {
|
|
262
|
+
test("fresh artifacts: emit proceeds, no FRESH diagnostics", async () => {
|
|
263
|
+
const { workspaceRoot, envelope, cleanup } = await setupWorkspace(
|
|
264
|
+
PROBE_BLOCK.fileContainsManifest,
|
|
265
|
+
);
|
|
266
|
+
const invoke = vi
|
|
267
|
+
.fn()
|
|
268
|
+
.mockResolvedValue(
|
|
269
|
+
driftResult([{ path: MANIFEST, owner: "command.manifest.generate", verdict: "fresh" }]),
|
|
270
|
+
);
|
|
271
|
+
try {
|
|
272
|
+
const result = await runRfcVerificationEmit(
|
|
273
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
274
|
+
makeContext(workspaceRoot, { invoke }),
|
|
275
|
+
);
|
|
276
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
277
|
+
expect(result.exitCode).toBe(0);
|
|
278
|
+
expect(result.data!.diagnostics.some((d) => d.ruleId?.startsWith("EVIDENCE-FRESH"))).toBe(
|
|
279
|
+
false,
|
|
280
|
+
);
|
|
281
|
+
await expect(fs.stat(envelope)).resolves.toBeDefined();
|
|
282
|
+
} finally {
|
|
283
|
+
await cleanup();
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
test("run-only probes: no generated dependency — invoke never called", async () => {
|
|
288
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.runOnly);
|
|
289
|
+
const invoke = vi.fn();
|
|
290
|
+
try {
|
|
291
|
+
const result = await runRfcVerificationEmit(
|
|
292
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
293
|
+
makeContext(workspaceRoot, { invoke }),
|
|
294
|
+
);
|
|
295
|
+
expect(invoke).not.toHaveBeenCalled();
|
|
296
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
297
|
+
} finally {
|
|
298
|
+
await cleanup();
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
test("emit-owned verification envelopes are excluded from candidates", async () => {
|
|
303
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(PROBE_BLOCK.emitOwned);
|
|
304
|
+
const invoke = vi.fn();
|
|
305
|
+
try {
|
|
306
|
+
const result = await runRfcVerificationEmit(
|
|
307
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
308
|
+
makeContext(workspaceRoot, { invoke }),
|
|
309
|
+
);
|
|
310
|
+
expect(invoke).not.toHaveBeenCalled();
|
|
311
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
312
|
+
} finally {
|
|
313
|
+
await cleanup();
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test("generated-looking but unowned paths do not block", async () => {
|
|
318
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(
|
|
319
|
+
` - probe: file-exists\n path: docs/stray.generated.yaml\n criterion: AC-1`,
|
|
320
|
+
);
|
|
321
|
+
const invoke = vi
|
|
322
|
+
.fn()
|
|
323
|
+
.mockResolvedValue(
|
|
324
|
+
driftResult([{ path: "docs/stray.generated.yaml", owner: null, verdict: "unowned" }]),
|
|
325
|
+
);
|
|
326
|
+
try {
|
|
327
|
+
const result = await runRfcVerificationEmit(
|
|
328
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
329
|
+
makeContext(workspaceRoot, { invoke }),
|
|
330
|
+
);
|
|
331
|
+
expect(result.data!.emitted).toHaveLength(1);
|
|
332
|
+
expect(result.exitCode).toBe(0);
|
|
333
|
+
} finally {
|
|
334
|
+
await cleanup();
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
describe("EVIDENCE-FRESH-03 — unknown probe kind fails loudly", () => {
|
|
340
|
+
test("unrecognized probe kind blocks emission with an explicit error", async () => {
|
|
341
|
+
const { workspaceRoot, envelope, cleanup } = await setupWorkspace(PROBE_BLOCK.unknownKind);
|
|
342
|
+
const invoke = vi.fn();
|
|
343
|
+
try {
|
|
344
|
+
const result = await runRfcVerificationEmit(
|
|
345
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
346
|
+
makeContext(workspaceRoot, { invoke }),
|
|
347
|
+
);
|
|
348
|
+
const diag = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-03");
|
|
349
|
+
expect(diag?.severity).toBe("error");
|
|
350
|
+
expect(diag?.message).toContain("teleport");
|
|
351
|
+
expect(result.data!.skipped[0]?.reason).toBe("unknown-probe-kind");
|
|
352
|
+
expect(result.data!.emitted).toHaveLength(0);
|
|
353
|
+
expect(result.exitCode).toBe(1);
|
|
354
|
+
await expect(fs.stat(envelope)).rejects.toThrow();
|
|
355
|
+
} finally {
|
|
356
|
+
await cleanup();
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test("malformed path-bearing probe fails this RFC, never crashes the sweep", async () => {
|
|
361
|
+
// `file-exists` with no `path:` — validate would flag it, but emit casts
|
|
362
|
+
// frontmatter unchecked; pre-change this threw an uncaught TypeError.
|
|
363
|
+
const { workspaceRoot, cleanup } = await setupWorkspace(
|
|
364
|
+
` - probe: file-exists\n criterion: AC-1`,
|
|
365
|
+
);
|
|
366
|
+
const invoke = vi.fn();
|
|
367
|
+
try {
|
|
368
|
+
const result = await runRfcVerificationEmit(
|
|
369
|
+
{ flags: { id: "RFC-0100" } } as unknown as ForgeCommandInput,
|
|
370
|
+
makeContext(workspaceRoot, { invoke }),
|
|
371
|
+
);
|
|
372
|
+
const diag = result.data!.diagnostics.find((d) => d.ruleId === "EVIDENCE-FRESH-03");
|
|
373
|
+
expect(diag?.severity).toBe("error");
|
|
374
|
+
expect(diag?.message).toContain("no string path");
|
|
375
|
+
expect(result.data!.skipped[0]?.reason).toBe("unknown-probe-kind");
|
|
376
|
+
expect(result.exitCode).toBe(1);
|
|
377
|
+
} finally {
|
|
378
|
+
await cleanup();
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
describe("probeArtifactCandidates — exhaustive mapping", () => {
|
|
384
|
+
test("each probe kind maps to its artifact dependency", () => {
|
|
385
|
+
expect(
|
|
386
|
+
probeArtifactCandidates({
|
|
387
|
+
probe: "command-registered",
|
|
388
|
+
name: "x",
|
|
389
|
+
criterion: "AC-1",
|
|
390
|
+
} as never),
|
|
391
|
+
).toEqual([MANIFEST]);
|
|
392
|
+
expect(
|
|
393
|
+
probeArtifactCandidates({ probe: "file-exists", path: "a/b.ts", criterion: "AC-1" } as never),
|
|
394
|
+
).toEqual(["a/b.ts"]);
|
|
395
|
+
expect(
|
|
396
|
+
probeArtifactCandidates({
|
|
397
|
+
probe: "file-contains",
|
|
398
|
+
path: "a/b.ts",
|
|
399
|
+
pattern: "x",
|
|
400
|
+
criterion: "AC-1",
|
|
401
|
+
} as never),
|
|
402
|
+
).toEqual(["a/b.ts"]);
|
|
403
|
+
expect(
|
|
404
|
+
probeArtifactCandidates({
|
|
405
|
+
probe: "json-schema",
|
|
406
|
+
artifact: "a/b.json",
|
|
407
|
+
schemaInline: {},
|
|
408
|
+
criterion: "AC-1",
|
|
409
|
+
} as never),
|
|
410
|
+
).toEqual(["a/b.json"]);
|
|
411
|
+
for (const live of ["run", "test", "page"] as const) {
|
|
412
|
+
expect(probeArtifactCandidates({ probe: live, criterion: "AC-1" } as never)).toEqual([]);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
});
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for verification emit covering rfc.verification.emit — baseline emission; rfc.verification.emit — sweep delta report; rfc.verification.emit — RFC-1237 AC-6: dry-run.
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the verification suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
// @vitest-environment node
|
|
2
16
|
import { test, expect, describe, vi, beforeEach, afterEach } from "vitest";
|
|
3
17
|
import fs from "node:fs/promises";
|