@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
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1330: derive each acceptance probe's origin from git history of the RFC's
|
|
5
|
+
implementation range — base is the commit that transitioned the RFC file to
|
|
6
|
+
`status: accepted`, head is HEAD — so evidence envelopes record who authored
|
|
7
|
+
the expectation instead of trusting the declared expectationSource.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not decide stamp outcomes — implement-stamp owns RFC-IMP-10/11.</item>
|
|
11
|
+
<item>Do not prove authorship — git history and trailers are agent-writable; this raises the cost of mislabeling only.</item>
|
|
12
|
+
<item>Do not write the verifier trailer — only the RFC-1333 workflow commits it.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<KEY_DECISIONS>
|
|
16
|
+
<item>Range head is HEAD, never the auto-detected implementation commit — later fix commits stay in range.</item>
|
|
17
|
+
<item>Range base is the oldest commit adding `status: accepted` — maturation edits never count as self.</item>
|
|
18
|
+
<item>All in-range commits count regardless of subject, so unrelated subjects cannot hide test edits.</item>
|
|
19
|
+
<item>Unresolvable history yields `unresolved`, which tier rules treat as self.</item>
|
|
20
|
+
<item>Git access goes through an injectable port so derivation stays testable.</item>
|
|
21
|
+
<item>Declarations compare acceptance-time vs current bytes; a loosen-then-restore within range stays unchanged.</item>
|
|
22
|
+
</KEY_DECISIONS>
|
|
23
|
+
<CHANGE_SUMMARY>
|
|
24
|
+
<item>RFC-1330: git-derived probe origin — range anchoring, declaration/test/run rules, verifier trailers, presence classes, attachProbeOrigins.</item>
|
|
25
|
+
</CHANGE_SUMMARY>
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { execFile } from "../../src/utils/sync-fs.ts";
|
|
29
|
+
import { parseRfcFile } from "./frontmatter-io.ts";
|
|
30
|
+
import { RFC_ORIGIN_CUTOFF } from "./types.ts";
|
|
31
|
+
import type {
|
|
32
|
+
AcceptanceProbe,
|
|
33
|
+
DerivedProbeOrigin,
|
|
34
|
+
ImplementationRange,
|
|
35
|
+
ProbeOriginRecord,
|
|
36
|
+
RfcExpectationSource,
|
|
37
|
+
} from "./types.ts";
|
|
38
|
+
|
|
39
|
+
/** Git port — returns stdout, or null when the command failed. */
|
|
40
|
+
export interface OriginGit {
|
|
41
|
+
run(args: string[]): Promise<string | null>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Env for git subprocesses that pass an explicit cwd: repository-locating
|
|
46
|
+
* variables inherited from a hook or outer git command (GIT_DIR, GIT_INDEX_FILE,
|
|
47
|
+
* …) would otherwise redirect every call to the outer repository.
|
|
48
|
+
*/
|
|
49
|
+
export function gitEnvForCwd(): NodeJS.ProcessEnv {
|
|
50
|
+
const env = { ...process.env };
|
|
51
|
+
for (const key of [
|
|
52
|
+
"GIT_DIR",
|
|
53
|
+
"GIT_WORK_TREE",
|
|
54
|
+
"GIT_INDEX_FILE",
|
|
55
|
+
"GIT_PREFIX",
|
|
56
|
+
"GIT_COMMON_DIR",
|
|
57
|
+
"GIT_OBJECT_DIRECTORY",
|
|
58
|
+
]) {
|
|
59
|
+
delete env[key];
|
|
60
|
+
}
|
|
61
|
+
return env;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function createOriginGit(workspaceRoot: string): OriginGit {
|
|
65
|
+
return {
|
|
66
|
+
run: (args) =>
|
|
67
|
+
new Promise((resolve) => {
|
|
68
|
+
execFile(
|
|
69
|
+
"git",
|
|
70
|
+
args,
|
|
71
|
+
{ cwd: workspaceRoot, timeout: 15000, maxBuffer: 32 * 1024 * 1024, env: gitEnvForCwd() },
|
|
72
|
+
(err, stdout) => resolve(err ? null : String(stdout)),
|
|
73
|
+
);
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const VERIFIER_ORIGIN_TRAILER = "X-Expectation-Origin: independent-verifier";
|
|
79
|
+
const VERIFIER_ORIGIN_RE = /^X-Expectation-Origin:\s*independent-verifier\s*$/m;
|
|
80
|
+
const VERIFIER_REPORT_RE = /^X-Verifier-Report:\s*(\S+)\s*$/m;
|
|
81
|
+
|
|
82
|
+
/** True when a commit body carries the sanctioned verifier trailer pair. */
|
|
83
|
+
export function hasVerifierTrailers(body: string): boolean {
|
|
84
|
+
return VERIFIER_ORIGIN_RE.test(body) && VERIFIER_REPORT_RE.test(body);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function verifierReportOf(body: string): string | null {
|
|
88
|
+
return VERIFIER_REPORT_RE.exec(body)?.[1] ?? null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const DOC_EXTENSIONS = [".md", ".mdx", ".txt", ".xml"];
|
|
92
|
+
|
|
93
|
+
export function isDocPath(path: string): boolean {
|
|
94
|
+
const lower = path.toLowerCase();
|
|
95
|
+
return DOC_EXTENSIONS.some((ext) => lower.endsWith(ext));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Presence probes prove structure, not behavior: `file-exists`,
|
|
100
|
+
* `command-registered`, and `file-contains` / `json-schema` over non-doc
|
|
101
|
+
* targets. Their origin is not counted toward tier rules (V-44, RFC-IMP-11).
|
|
102
|
+
*/
|
|
103
|
+
export function isPresenceProbe(probe: AcceptanceProbe): boolean {
|
|
104
|
+
switch (probe.probe) {
|
|
105
|
+
case "file-exists":
|
|
106
|
+
case "command-registered":
|
|
107
|
+
return true;
|
|
108
|
+
case "file-contains":
|
|
109
|
+
return !isDocPath(probe.path);
|
|
110
|
+
case "json-schema":
|
|
111
|
+
return !isDocPath(probe.artifact);
|
|
112
|
+
default:
|
|
113
|
+
// Future structural kinds (e.g. RFC-1334 `reachable`) opt in here.
|
|
114
|
+
return (probe as { probe: string }).probe === "reachable";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const SHORT = 7;
|
|
119
|
+
const short = (sha: string): string => sha.slice(0, SHORT);
|
|
120
|
+
|
|
121
|
+
function sortKeysDeep(value: unknown): unknown {
|
|
122
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep);
|
|
123
|
+
if (value && typeof value === "object") {
|
|
124
|
+
const out: Record<string, unknown> = {};
|
|
125
|
+
for (const key of Object.keys(value as Record<string, unknown>).sort()) {
|
|
126
|
+
out[key] = sortKeysDeep((value as Record<string, unknown>)[key]);
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Stable identity of a probe declaration (sorted-key JSON). */
|
|
134
|
+
export function probeDeclarationKey(probe: AcceptanceProbe): string {
|
|
135
|
+
return JSON.stringify(sortKeysDeep(probe));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** `git log --follow` names the file per commit: commit sha → path at that commit. */
|
|
139
|
+
async function pathHistory(git: OriginGit, relPath: string): Promise<Map<string, string>> {
|
|
140
|
+
const out = await git.run([
|
|
141
|
+
"log",
|
|
142
|
+
"--follow",
|
|
143
|
+
"--name-only",
|
|
144
|
+
"--format=COMMIT %H",
|
|
145
|
+
"--",
|
|
146
|
+
relPath,
|
|
147
|
+
]);
|
|
148
|
+
const map = new Map<string, string>();
|
|
149
|
+
if (!out) return map;
|
|
150
|
+
let current: string | null = null;
|
|
151
|
+
for (const raw of out.split("\n")) {
|
|
152
|
+
const line = raw.trim();
|
|
153
|
+
if (!line) continue;
|
|
154
|
+
if (line.startsWith("COMMIT ")) {
|
|
155
|
+
current = line.slice("COMMIT ".length);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (current && !map.has(current)) map.set(current, line);
|
|
159
|
+
}
|
|
160
|
+
return map;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Range for RFC origin derivation. Base = oldest commit whose diff adds or
|
|
165
|
+
* removes a `status: accepted` line in the RFC file (the acceptance
|
|
166
|
+
* transition), head = HEAD.
|
|
167
|
+
*/
|
|
168
|
+
export async function resolveImplementationRange(
|
|
169
|
+
git: OriginGit,
|
|
170
|
+
rfcRelPath: string,
|
|
171
|
+
): Promise<ImplementationRange> {
|
|
172
|
+
const head = (await git.run(["rev-parse", "HEAD"]))?.trim() ?? "HEAD";
|
|
173
|
+
const out = await git.run([
|
|
174
|
+
"log",
|
|
175
|
+
"--follow",
|
|
176
|
+
"--format=%H",
|
|
177
|
+
"-G",
|
|
178
|
+
"^status:[[:space:]]*[\"']?accepted[\"']?[[:space:]]*$",
|
|
179
|
+
"--",
|
|
180
|
+
rfcRelPath,
|
|
181
|
+
]);
|
|
182
|
+
const shas = (out ?? "")
|
|
183
|
+
.split("\n")
|
|
184
|
+
.map((l) => l.trim())
|
|
185
|
+
.filter(Boolean);
|
|
186
|
+
return { base: shas.length > 0 ? shas[shas.length - 1]! : null, head };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface RangeCommit {
|
|
190
|
+
sha: string;
|
|
191
|
+
body: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Commits in base..head touching `relPath` (renames followed), oldest first. */
|
|
195
|
+
async function commitsTouching(
|
|
196
|
+
git: OriginGit,
|
|
197
|
+
range: ImplementationRange,
|
|
198
|
+
relPath: string,
|
|
199
|
+
): Promise<RangeCommit[]> {
|
|
200
|
+
if (!range.base) return [];
|
|
201
|
+
const out = await git.run([
|
|
202
|
+
"log",
|
|
203
|
+
"--follow",
|
|
204
|
+
"--format=%H%x1f%B%x1e",
|
|
205
|
+
`${range.base}..${range.head}`,
|
|
206
|
+
"--",
|
|
207
|
+
relPath,
|
|
208
|
+
]);
|
|
209
|
+
if (!out) return [];
|
|
210
|
+
return out
|
|
211
|
+
.split("\x1e")
|
|
212
|
+
.map((chunk) => chunk.replace(/^\s+/, ""))
|
|
213
|
+
.filter((chunk) => chunk.includes("\x1f"))
|
|
214
|
+
.map((chunk) => {
|
|
215
|
+
const [sha, body] = chunk.split("\x1f");
|
|
216
|
+
return { sha: (sha ?? "").trim(), body: body ?? "" };
|
|
217
|
+
})
|
|
218
|
+
.filter((c) => c.sha.length > 0)
|
|
219
|
+
.reverse();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
async function acceptanceAt(
|
|
223
|
+
git: OriginGit,
|
|
224
|
+
sha: string,
|
|
225
|
+
pathAt: Map<string, string>,
|
|
226
|
+
fallbackPath: string,
|
|
227
|
+
): Promise<AcceptanceProbe[] | null> {
|
|
228
|
+
const path = pathAt.get(sha) ?? fallbackPath;
|
|
229
|
+
const source = await git.run(["show", `${sha}:${path}`]);
|
|
230
|
+
if (source === null) return null;
|
|
231
|
+
try {
|
|
232
|
+
const acceptance = parseRfcFile(source).frontmatter["acceptance"];
|
|
233
|
+
return Array.isArray(acceptance) ? (acceptance as AcceptanceProbe[]) : [];
|
|
234
|
+
} catch {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* For each in-range commit touching the RFC file, the probe declaration keys
|
|
241
|
+
* it introduced (present after, absent before) — newest introduction wins.
|
|
242
|
+
*/
|
|
243
|
+
async function declarationIntroductions(
|
|
244
|
+
git: OriginGit,
|
|
245
|
+
range: ImplementationRange,
|
|
246
|
+
rfcRelPath: string,
|
|
247
|
+
): Promise<{ baseKeys: Set<string> | null; introducedBy: Map<string, RangeCommit> }> {
|
|
248
|
+
const introducedBy = new Map<string, RangeCommit>();
|
|
249
|
+
if (!range.base) return { baseKeys: null, introducedBy };
|
|
250
|
+
const pathAt = await pathHistory(git, rfcRelPath);
|
|
251
|
+
const baseProbes = await acceptanceAt(git, range.base, pathAt, rfcRelPath);
|
|
252
|
+
if (baseProbes === null) return { baseKeys: null, introducedBy };
|
|
253
|
+
const baseKeys = new Set(baseProbes.map(probeDeclarationKey));
|
|
254
|
+
let previous = baseKeys;
|
|
255
|
+
for (const commit of await commitsTouching(git, range, rfcRelPath)) {
|
|
256
|
+
const probes = await acceptanceAt(git, commit.sha, pathAt, rfcRelPath);
|
|
257
|
+
if (probes === null) continue;
|
|
258
|
+
const keys = new Set(probes.map(probeDeclarationKey));
|
|
259
|
+
for (const key of keys) {
|
|
260
|
+
if (!previous.has(key)) introducedBy.set(key, commit);
|
|
261
|
+
}
|
|
262
|
+
previous = keys;
|
|
263
|
+
}
|
|
264
|
+
return { baseKeys, introducedBy };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function runCommandName(command: string): string | null {
|
|
268
|
+
const match = /^(?:pnpm\s+exec\s+)?werkstatt\s+(?:run|pipeline)\s+(\S+)/.exec(command.trim());
|
|
269
|
+
return match?.[1] ?? null;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function rfcCommandSet(frontmatter: Record<string, unknown>): Set<string> {
|
|
273
|
+
const block = (frontmatter["commands"] ?? {}) as Record<string, unknown>;
|
|
274
|
+
const names = new Set<string>();
|
|
275
|
+
for (const bucket of ["proposed", "added", "changed"]) {
|
|
276
|
+
const list = block[bucket];
|
|
277
|
+
if (Array.isArray(list)) for (const n of list) names.add(String(n));
|
|
278
|
+
}
|
|
279
|
+
return names;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function effectiveOf(
|
|
283
|
+
derived: DerivedProbeOrigin | "presence",
|
|
284
|
+
declared: RfcExpectationSource | "undeclared",
|
|
285
|
+
): ProbeOriginRecord["effective"] {
|
|
286
|
+
if (derived === "presence") return "presence";
|
|
287
|
+
if (derived === "self" || derived === "unresolved") return "self";
|
|
288
|
+
if (derived === "verifier") return "independent";
|
|
289
|
+
return declared;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface DeriveProbeOriginsInput {
|
|
293
|
+
git: OriginGit;
|
|
294
|
+
rfcRelPath: string;
|
|
295
|
+
frontmatter: Record<string, unknown>;
|
|
296
|
+
probes: AcceptanceProbe[];
|
|
297
|
+
/** Precomputed range (tests / callers that already resolved it). */
|
|
298
|
+
range?: ImplementationRange;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Derive one origin record per probe, in probe order. */
|
|
302
|
+
export async function deriveProbeOrigins(
|
|
303
|
+
input: DeriveProbeOriginsInput,
|
|
304
|
+
): Promise<ProbeOriginRecord[]> {
|
|
305
|
+
const { git, rfcRelPath, frontmatter, probes } = input;
|
|
306
|
+
const range = input.range ?? (await resolveImplementationRange(git, rfcRelPath));
|
|
307
|
+
const { baseKeys, introducedBy } = await declarationIntroductions(git, range, rfcRelPath);
|
|
308
|
+
const rfcCommands = rfcCommandSet(frontmatter);
|
|
309
|
+
const fileCache = new Map<string, RangeCommit[]>();
|
|
310
|
+
|
|
311
|
+
const records: ProbeOriginRecord[] = [];
|
|
312
|
+
for (const probe of probes) {
|
|
313
|
+
const declared: RfcExpectationSource | "undeclared" = probe.expectationSource ?? "undeclared";
|
|
314
|
+
const finish = (derived: DerivedProbeOrigin | "presence", reason: string[]): void => {
|
|
315
|
+
records.push({
|
|
316
|
+
declared,
|
|
317
|
+
derivedOrigin: derived,
|
|
318
|
+
effective: effectiveOf(derived, declared),
|
|
319
|
+
reason,
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
if (isPresenceProbe(probe)) {
|
|
324
|
+
finish("presence", []);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (!range.base || baseKeys === null) {
|
|
328
|
+
finish("unresolved", ["no `status: accepted` transition found in history"]);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Declaration rule — added/changed after acceptance ⇒ self, unless the
|
|
333
|
+
// introducing commit carries the verifier trailer pair (RFC-1333).
|
|
334
|
+
const key = probeDeclarationKey(probe);
|
|
335
|
+
let declarationByVerifier: RangeCommit | null = null;
|
|
336
|
+
if (!baseKeys.has(key)) {
|
|
337
|
+
const intro = introducedBy.get(key);
|
|
338
|
+
if (intro && hasVerifierTrailers(intro.body)) {
|
|
339
|
+
declarationByVerifier = intro;
|
|
340
|
+
} else {
|
|
341
|
+
finish("self", [
|
|
342
|
+
intro
|
|
343
|
+
? `${short(intro.sha)} changed the probe declaration`
|
|
344
|
+
: "probe declaration changed after acceptance",
|
|
345
|
+
]);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (probe.probe === "test") {
|
|
351
|
+
let commits = fileCache.get(probe.file);
|
|
352
|
+
if (!commits) {
|
|
353
|
+
commits = await commitsTouching(git, range, probe.file);
|
|
354
|
+
fileCache.set(probe.file, commits);
|
|
355
|
+
}
|
|
356
|
+
const nonVerifier = commits.filter((c) => !hasVerifierTrailers(c.body));
|
|
357
|
+
if (nonVerifier.length > 0) {
|
|
358
|
+
finish(
|
|
359
|
+
"self",
|
|
360
|
+
nonVerifier.map((c) => `${short(c.sha)} touched ${probe.file}`),
|
|
361
|
+
);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (commits.length > 0) {
|
|
365
|
+
finish(
|
|
366
|
+
"verifier",
|
|
367
|
+
commits.map((c) => verifierReportOf(c.body) ?? short(c.sha)),
|
|
368
|
+
);
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
} else if (probe.probe === "run") {
|
|
372
|
+
const name = runCommandName(probe.command);
|
|
373
|
+
if (name && rfcCommands.has(name)) {
|
|
374
|
+
finish("self", [`runs ${name}, listed in the RFC's commands block`]);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (declarationByVerifier) {
|
|
380
|
+
finish("verifier", [
|
|
381
|
+
verifierReportOf(declarationByVerifier.body) ?? short(declarationByVerifier.sha),
|
|
382
|
+
]);
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
finish("unchanged", []);
|
|
386
|
+
}
|
|
387
|
+
return records;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* RFC-1330: attach `origin` to envelope probe records for RFCs created on or
|
|
392
|
+
* after RFC_ORIGIN_CUTOFF. Shared by `rfc.verification.emit` and
|
|
393
|
+
* `rfc.verification.refresh` so both envelope writers stay identical.
|
|
394
|
+
* `origin` is volatile evidence context — `checkEvidenceEnvelope` never
|
|
395
|
+
* compares it because it depends on git history, not on the RFC bytes.
|
|
396
|
+
*/
|
|
397
|
+
export async function attachProbeOrigins(opts: {
|
|
398
|
+
workspaceRoot: string;
|
|
399
|
+
rfcRelPath: string;
|
|
400
|
+
frontmatter: Record<string, unknown>;
|
|
401
|
+
probes: AcceptanceProbe[];
|
|
402
|
+
records: Array<{ origin?: ProbeOriginRecord }>;
|
|
403
|
+
git?: OriginGit;
|
|
404
|
+
}): Promise<void> {
|
|
405
|
+
const createdAt = String(opts.frontmatter["createdAt"] ?? "");
|
|
406
|
+
if (createdAt < RFC_ORIGIN_CUTOFF) return;
|
|
407
|
+
const origins = await deriveProbeOrigins({
|
|
408
|
+
git: opts.git ?? createOriginGit(opts.workspaceRoot),
|
|
409
|
+
rfcRelPath: opts.rfcRelPath,
|
|
410
|
+
frontmatter: opts.frontmatter,
|
|
411
|
+
probes: opts.probes,
|
|
412
|
+
});
|
|
413
|
+
origins.forEach((origin, i) => {
|
|
414
|
+
const record = opts.records[i];
|
|
415
|
+
if (record) record.origin = origin;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for verification refresh covering rfc.verification.refresh — sweep delta report; rfc.verification.refresh — AC-1: single-RFC refresh; rfc.verification.refresh — AC-2: --all mode.
|
|
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";
|
|
@@ -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
|
+
});
|