@warpgogol/forge 7.0.0 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/bin/cli.js +6 -12
- package/bin/resolve-entry.js +24 -0
- package/dist/os/compass/comment-safety.d.ts +83 -0
- package/dist/os/compass/comment-safety.d.ts.map +1 -0
- package/dist/os/compass/comment-safety.js +305 -0
- package/dist/os/compass/comment-safety.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -4
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
- package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
- package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.js +28 -13
- package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
- package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.js +58 -20
- package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +10 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +58 -4
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts +20 -5
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +175 -44
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/compass/index.d.ts +1 -0
- package/dist/os/compass/index.d.ts.map +1 -1
- package/dist/os/compass/index.js +2 -0
- package/dist/os/compass/index.js.map +1 -1
- package/dist/os/compass/policy.d.ts +9 -0
- package/dist/os/compass/policy.d.ts.map +1 -1
- package/dist/os/compass/policy.js +11 -2
- package/dist/os/compass/policy.js.map +1 -1
- package/dist/os/core/core.module.js +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +1 -6
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/queue/types.d.ts +2 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +3 -1
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +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 +60 -8
- 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 +81 -12
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +15 -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/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +5 -23
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +30 -9
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/workflow/handlers.d.ts +0 -4
- package/dist/os/workflow/handlers.d.ts.map +1 -1
- package/dist/os/workflow/handlers.js +9 -36
- package/dist/os/workflow/handlers.js.map +1 -1
- package/dist/os/workflow/index.d.ts +2 -2
- package/dist/os/workflow/index.d.ts.map +1 -1
- package/dist/os/workflow/index.js +1 -1
- package/dist/os/workflow/index.js.map +1 -1
- package/dist/os/workflow/types.d.ts +0 -19
- package/dist/os/workflow/types.d.ts.map +1 -1
- package/dist/os/workflow/types.js +0 -2
- package/dist/os/workflow/types.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +6 -15
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +5 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +5 -2
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/doctor.js +3 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +2 -2
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/prettierignore.js +1 -1
- package/dist/src/onboarding/upgrade.js +2 -2
- package/dist/src/onboarding/workspace-discovery.js +1 -1
- package/dist/src/profiles/profile-schema.d.ts +2 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +1 -0
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +1 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/types.js.map +1 -1
- package/docs/reference/cli.md +0 -1
- package/docs/reference/programmatic-api.md +1 -1
- package/os/adr/handlers/validate.test.ts +14 -0
- package/os/compass/comment-safety.ts +331 -0
- package/os/compass/compass.module.ts +50 -4
- package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
- package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
- package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
- package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
- package/os/compass/handlers/compass-header-scaffold.ts +847 -0
- package/os/compass/handlers/compass-inventory-handler.ts +9 -4
- package/os/compass/handlers/compass-inventory.ts +29 -13
- package/os/compass/handlers/compass-migrate-handler.ts +13 -27
- package/os/compass/handlers/compass-migrate.ts +77 -21
- package/os/compass/handlers/git-revision.ts +59 -4
- package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
- package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
- package/os/compass/handlers/summary-record.ts +194 -41
- package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
- package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
- package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
- package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
- package/os/compass/handlers/tests/summary-record.test.ts +324 -3
- package/os/compass/index.ts +15 -0
- package/os/compass/policy.ts +27 -2
- package/os/core/core.module.ts +1 -1
- package/os/core/handlers/invariant-engine.test.ts +3 -1
- package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
- package/os/core/handlers/note-link-validate.test.ts +6 -1
- package/os/core/handlers/note-orphan-detect.test.ts +6 -1
- package/os/core/handlers/package-health.test.ts +6 -0
- package/os/core/handlers/package-health.ts +1 -6
- package/os/mission/handlers/archive.test.ts +14 -0
- package/os/naming/naming-convention.test.ts +14 -0
- package/os/queue/decision-ledger.test.ts +27 -4
- package/os/queue/queue-validate.test.ts +14 -0
- package/os/queue/types.ts +3 -1
- package/os/rfc/acceptance-reachable.test.ts +146 -0
- package/os/rfc/acceptance.test.ts +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 +80 -7
- 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 +106 -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/spec/spec-status.test.ts +130 -0
- package/os/spec/spec-status.ts +5 -18
- package/os/spec/spec-validate.test.ts +76 -1
- package/os/spec/spec-validate.ts +26 -7
- package/os/workflow/handlers.ts +8 -42
- package/os/workflow/index.ts +1 -4
- package/os/workflow/types.ts +0 -22
- package/os/workflow/workflow.module.ts +6 -16
- package/package.json +1 -1
- package/skills/_shared/agent-operating-model.md +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/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/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +14 -0
- package/src/tests/session-pbt.test.ts +14 -0
- package/src/tests/skill-agents-sync.test.ts +3 -4
- package/src/tests/skill-schema.test.ts +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
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for lifecycle covering RFC-CMD-02/03 cutoff behavior. It also guards the documented public contract and regression-sensitive edge cases.
|
|
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 lifecycle suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe } from "vitest";
|
|
2
16
|
import { collectRfcCommandLifecycleViolations } from "./lifecycle.ts";
|
|
3
17
|
import type { ParsedRfc } from "../frontmatter-io.ts";
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1306: rfc.evidence.sync — one-command evidence resync before stamp.
|
|
5
|
+
Runs the workspace's generated-manifest chain in dependency order and
|
|
6
|
+
finishes with rfc.verification.emit when --id is given, so a single
|
|
7
|
+
invocation attests "all generated artifacts + RFC evidence are current".
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Does not reimplement generator logic — every step is delegated by name through the host's invocation port.</item>
|
|
11
|
+
<item>Does not run inside pipelines — sync is an explicit on-demand command like rfc.verification.emit.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<KEY_DECISIONS>
|
|
15
|
+
<item>Step order is contract: the ecosystem manifest hashes the other artifacts, so ecosystem.manifest.generate runs last among the manifest steps.</item>
|
|
16
|
+
<item>EVIDENCE_SYNC_STEPS is the canonical regen list</item>
|
|
17
|
+
</KEY_DECISIONS>
|
|
18
|
+
<CHANGE_SUMMARY>
|
|
19
|
+
<item>RFC-1306: initial — EVIDENCE_SYNC_STEPS chain + runRfcEvidenceSync via the ctx.invoke port; EVIDENCE-SYNC-01 fail-closed without a kernel host, EVIDENCE-SYNC-02 propagates a failed step's diagnostics verbatim; review-r1: try/catch maps thrown invokes into EVIDENCE-SYNC-02, dry-run exposes `planned` in data.</item>
|
|
20
|
+
<item>RFC-1306: review-r1 — io-native writes, cacheable off on chain generators, EVIDENCE-SYNC-02 on invoke throws</item>
|
|
21
|
+
</CHANGE_SUMMARY>
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type {
|
|
25
|
+
ForgeCommandInput,
|
|
26
|
+
ForgeCommandResult,
|
|
27
|
+
ForgeRuntimeContext,
|
|
28
|
+
} from "../../../src/types.ts";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The canonical RFC-evidence regen order (RFC-1306). The emit step is
|
|
32
|
+
* appended conditionally on --id — the chain ends at rfc.verification.emit,
|
|
33
|
+
* which never re-enters this command.
|
|
34
|
+
*/
|
|
35
|
+
export const EVIDENCE_SYNC_STEPS: readonly string[] = [
|
|
36
|
+
"checks.commands.generate",
|
|
37
|
+
"command.manifest.generate",
|
|
38
|
+
"validator.inventory.generate",
|
|
39
|
+
"docs.commands.generate",
|
|
40
|
+
"ecosystem.manifest.generate",
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export const EVIDENCE_SYNC_EMIT_STEP = "rfc.verification.emit";
|
|
44
|
+
|
|
45
|
+
export interface RfcEvidenceSyncStepResult {
|
|
46
|
+
step: string;
|
|
47
|
+
flags?: Record<string, unknown>;
|
|
48
|
+
exitCode: number;
|
|
49
|
+
status: "pass" | "fail";
|
|
50
|
+
filesModified: string[];
|
|
51
|
+
summary?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface RfcEvidenceSyncViolation {
|
|
55
|
+
rule: string;
|
|
56
|
+
message: string;
|
|
57
|
+
step?: string;
|
|
58
|
+
/** The failed step's diagnostics/violations payload, verbatim. */
|
|
59
|
+
stepDiagnostics?: unknown;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface RfcEvidenceSyncResult {
|
|
63
|
+
steps: RfcEvidenceSyncStepResult[];
|
|
64
|
+
rfcId?: string;
|
|
65
|
+
failedStep?: string;
|
|
66
|
+
/** Dry-run only — the ordered step list that would execute. */
|
|
67
|
+
planned?: Array<{ step: string; flags?: Record<string, string> }>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface SyncReport {
|
|
71
|
+
command: string;
|
|
72
|
+
status: "pass" | "fail";
|
|
73
|
+
violations: RfcEvidenceSyncViolation[];
|
|
74
|
+
data?: RfcEvidenceSyncResult;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function childDiagnostics(data: unknown): unknown {
|
|
78
|
+
if (data !== null && typeof data === "object") {
|
|
79
|
+
const record = data as Record<string, unknown>;
|
|
80
|
+
return record["diagnostics"] ?? record["violations"];
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function syncResult(
|
|
86
|
+
status: "pass" | "fail",
|
|
87
|
+
violations: RfcEvidenceSyncViolation[],
|
|
88
|
+
data: RfcEvidenceSyncResult | undefined,
|
|
89
|
+
summary: string,
|
|
90
|
+
): ForgeCommandResult<SyncReport> {
|
|
91
|
+
return {
|
|
92
|
+
data: { command: "rfc.evidence.sync", status, violations, ...(data ? { data } : {}) },
|
|
93
|
+
exitCode: status === "pass" ? 0 : 1,
|
|
94
|
+
summary,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function runRfcEvidenceSync(
|
|
99
|
+
input: ForgeCommandInput,
|
|
100
|
+
context: ForgeRuntimeContext,
|
|
101
|
+
): Promise<ForgeCommandResult<SyncReport>> {
|
|
102
|
+
const { logger, outputFormat } = context;
|
|
103
|
+
const rfcId = input.flags["id"];
|
|
104
|
+
const rfcIdStr = typeof rfcId === "string" && rfcId !== "" ? rfcId : undefined;
|
|
105
|
+
const isDryRun = context.dryRun || input.flags["dry-run"] === true;
|
|
106
|
+
|
|
107
|
+
const plan: Array<{ step: string; flags?: Record<string, string> }> = [
|
|
108
|
+
...EVIDENCE_SYNC_STEPS.map((step) => ({ step })),
|
|
109
|
+
...(rfcIdStr ? [{ step: EVIDENCE_SYNC_EMIT_STEP, flags: { id: rfcIdStr } }] : []),
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
if (isDryRun) {
|
|
113
|
+
const lines = plan.map((p) =>
|
|
114
|
+
p.flags
|
|
115
|
+
? `${p.step} ${Object.entries(p.flags)
|
|
116
|
+
.map(([k, v]) => `--${k}=${v}`)
|
|
117
|
+
.join(" ")}`
|
|
118
|
+
: p.step,
|
|
119
|
+
);
|
|
120
|
+
if (outputFormat === "pretty") {
|
|
121
|
+
logger.info(`[dry-run] rfc.evidence.sync would run ${plan.length} steps:`);
|
|
122
|
+
for (const line of lines) logger.info(` ${line}`);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
data: {
|
|
126
|
+
command: "rfc.evidence.sync",
|
|
127
|
+
status: "pass",
|
|
128
|
+
violations: [],
|
|
129
|
+
data: { steps: [], planned: plan, ...(rfcIdStr ? { rfcId: rfcIdStr } : {}) },
|
|
130
|
+
},
|
|
131
|
+
exitCode: 0,
|
|
132
|
+
summary: `[dry-run] rfc.evidence.sync: ${plan.length} steps — ${lines.join(" → ")}`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// EVIDENCE-SYNC-01: the orchestration port exists only under a kernel
|
|
137
|
+
// host — the standalone forge CLI has no executeKernelCommand behind it.
|
|
138
|
+
const invoke = context.invoke;
|
|
139
|
+
if (!invoke) {
|
|
140
|
+
const violations: RfcEvidenceSyncViolation[] = [
|
|
141
|
+
{
|
|
142
|
+
rule: "EVIDENCE-SYNC-01",
|
|
143
|
+
message:
|
|
144
|
+
"rfc.evidence.sync requires the werkstatt kernel host (context.invoke is absent). Run it via `pnpm exec werkstatt run rfc.evidence.sync`.",
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
if (outputFormat === "pretty") {
|
|
148
|
+
logger.warn(`EVIDENCE-SYNC-01: ${violations[0]!.message}`);
|
|
149
|
+
}
|
|
150
|
+
return syncResult("fail", violations, undefined, "rfc.evidence.sync: no kernel host");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const steps: RfcEvidenceSyncStepResult[] = [];
|
|
154
|
+
for (const planned of plan) {
|
|
155
|
+
// A throwing invoke (unresolvable child, host/module failure) still maps
|
|
156
|
+
// into the EVIDENCE-SYNC-02 contract — fail closed, never a raw exception.
|
|
157
|
+
let report: Awaited<ReturnType<typeof invoke>>;
|
|
158
|
+
try {
|
|
159
|
+
report = await invoke(planned.step, planned.flags);
|
|
160
|
+
} catch (err) {
|
|
161
|
+
const violations: RfcEvidenceSyncViolation[] = [
|
|
162
|
+
{
|
|
163
|
+
rule: "EVIDENCE-SYNC-02",
|
|
164
|
+
message: `Step "${planned.step}" threw: ${err instanceof Error ? err.message : String(err)}. Partial sync — earlier steps were applied.`,
|
|
165
|
+
step: planned.step,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
return syncResult(
|
|
169
|
+
"fail",
|
|
170
|
+
violations,
|
|
171
|
+
{ steps, failedStep: planned.step, ...(rfcIdStr ? { rfcId: rfcIdStr } : {}) },
|
|
172
|
+
`rfc.evidence.sync: step "${planned.step}" threw`,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const filesModified = report.filesModified ?? [];
|
|
176
|
+
const stepResult: RfcEvidenceSyncStepResult = {
|
|
177
|
+
step: planned.step,
|
|
178
|
+
...(planned.flags ? { flags: planned.flags } : {}),
|
|
179
|
+
exitCode: report.exitCode,
|
|
180
|
+
status: report.exitCode === 0 ? "pass" : "fail",
|
|
181
|
+
filesModified,
|
|
182
|
+
...(report.summary ? { summary: report.summary } : {}),
|
|
183
|
+
};
|
|
184
|
+
steps.push(stepResult);
|
|
185
|
+
if (outputFormat === "pretty") {
|
|
186
|
+
const changed = filesModified.length;
|
|
187
|
+
logger.info(
|
|
188
|
+
` ${planned.step}: ${stepResult.status}${changed > 0 ? ` (${changed} file${changed === 1 ? "" : "s"} changed)` : ""}`,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// EVIDENCE-SYNC-02: stop on the first failing step — a partial sync is
|
|
193
|
+
// reported with the step's diagnostics verbatim, never silently tolerated.
|
|
194
|
+
if (report.exitCode !== 0) {
|
|
195
|
+
const violations: RfcEvidenceSyncViolation[] = [
|
|
196
|
+
{
|
|
197
|
+
rule: "EVIDENCE-SYNC-02",
|
|
198
|
+
message: `Step "${planned.step}" failed (exit ${report.exitCode})${report.summary ? `: ${report.summary}` : ""}. Partial sync — earlier steps were applied.`,
|
|
199
|
+
step: planned.step,
|
|
200
|
+
...(childDiagnostics(report.data) !== undefined
|
|
201
|
+
? { stepDiagnostics: childDiagnostics(report.data) }
|
|
202
|
+
: {}),
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
return syncResult(
|
|
206
|
+
"fail",
|
|
207
|
+
violations,
|
|
208
|
+
{ steps, failedStep: planned.step, ...(rfcIdStr ? { rfcId: rfcIdStr } : {}) },
|
|
209
|
+
`rfc.evidence.sync: failed at step "${planned.step}"`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const changedFiles = [...new Set(steps.flatMap((s) => s.filesModified))];
|
|
215
|
+
return syncResult(
|
|
216
|
+
"pass",
|
|
217
|
+
[],
|
|
218
|
+
{ steps, ...(rfcIdStr ? { rfcId: rfcIdStr } : {}) },
|
|
219
|
+
`rfc.evidence.sync: ${steps.length} steps clean, ${changedFiles.length} file${changedFiles.length === 1 ? "" : "s"} changed`,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for validate rules rfc0997 covering evaluateAcceptanceCriteria: AC-N id parsing (RFC-0997); computeProbeCoverage (RFC-0997); V-35: probe→criterion referential integrity (RFC-0997).
|
|
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 validate suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe } from "vitest";
|
|
2
16
|
import {
|
|
3
17
|
evaluateAcceptanceCriteria,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for validate rules rfc1006 covering evaluateDocumentReadiness (RFC-1006); V-38: document readiness completeness (RFC-1006); V-39: non-atomic criterion (RFC-1006).
|
|
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 validate suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe } from "vitest";
|
|
2
16
|
import {
|
|
3
17
|
evaluateAcceptanceCriteria,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Unit tests for validate rules rfc1330 covering V-44: WHEN/IF behavioral criteria bound only to presence probes are rejected for post-cutoff RFCs.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a contract source of truth — validate-rules.ts owns V-44; fixtures are minimal scaffolding only.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1330: V-44 tests.</item>
|
|
10
|
+
</CHANGE_SUMMARY>
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, expect, test } from "vitest";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { tmpdir } from "node:os";
|
|
16
|
+
import {
|
|
17
|
+
findPresenceOnlyBehavioralCriteria,
|
|
18
|
+
type AddViolationFn,
|
|
19
|
+
validateSingleRfc,
|
|
20
|
+
} from "./validate-rules.ts";
|
|
21
|
+
import type { ParsedRfc } from "../frontmatter-io.ts";
|
|
22
|
+
import type { AcceptanceProbe } from "../types.ts";
|
|
23
|
+
|
|
24
|
+
const BODY = (criteria: string): string => `
|
|
25
|
+
# RFC-9998: Test RFC
|
|
26
|
+
|
|
27
|
+
## Acceptance criteria
|
|
28
|
+
|
|
29
|
+
${criteria}
|
|
30
|
+
|
|
31
|
+
## Implementation notes for agents
|
|
32
|
+
|
|
33
|
+
Notes.
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
async function v44(createdAt: string, criteria: string, probes: AcceptanceProbe[]) {
|
|
37
|
+
const parsed: ParsedRfc = {
|
|
38
|
+
frontmatter: {
|
|
39
|
+
id: "RFC-9998",
|
|
40
|
+
title: "Test RFC",
|
|
41
|
+
status: "draft",
|
|
42
|
+
kind: "command",
|
|
43
|
+
scope: "workspace",
|
|
44
|
+
owners: ["architecture"],
|
|
45
|
+
createdAt,
|
|
46
|
+
updatedAt: createdAt,
|
|
47
|
+
acceptance: probes,
|
|
48
|
+
},
|
|
49
|
+
body: BODY(criteria),
|
|
50
|
+
};
|
|
51
|
+
const found: string[] = [];
|
|
52
|
+
const add: AddViolationFn = (_id, _file, rule, message) => {
|
|
53
|
+
if (rule === "V-44") found.push(message);
|
|
54
|
+
};
|
|
55
|
+
await validateSingleRfc(
|
|
56
|
+
"rfc-9998-test.md",
|
|
57
|
+
parsed,
|
|
58
|
+
new Map(),
|
|
59
|
+
new Map(),
|
|
60
|
+
new Set(),
|
|
61
|
+
new Set(),
|
|
62
|
+
new Set(Object.keys(parsed.frontmatter)),
|
|
63
|
+
join(tmpdir(), "test-workspace-rfc1330"),
|
|
64
|
+
add,
|
|
65
|
+
);
|
|
66
|
+
return found;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const presence: AcceptanceProbe = {
|
|
70
|
+
probe: "file-contains",
|
|
71
|
+
criterion: "AC-1",
|
|
72
|
+
path: "packages/x/src/gate.ts",
|
|
73
|
+
pattern: "EC-99",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
describe("V-44 (RFC-1330)", () => {
|
|
77
|
+
test("V-44 rejects an event criterion bound only to presence probes", async () => {
|
|
78
|
+
const found = await v44(
|
|
79
|
+
"2026-10-18",
|
|
80
|
+
"- [ ] AC-1: WHEN a commit weakens a test, THE gate SHALL block it.",
|
|
81
|
+
[presence],
|
|
82
|
+
);
|
|
83
|
+
expect(found).toHaveLength(1);
|
|
84
|
+
expect(found[0]).toContain("AC-1");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("accepts an event criterion that also has an execution probe", async () => {
|
|
88
|
+
const found = await v44(
|
|
89
|
+
"2026-10-18",
|
|
90
|
+
"- [ ] AC-1: IF the input is empty, THEN the command SHALL fail.",
|
|
91
|
+
[presence, { probe: "test", criterion: "AC-1", file: "a.test.ts", expect: { exitCode: 0 } }],
|
|
92
|
+
);
|
|
93
|
+
expect(found).toEqual([]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("leaves invariant-form and doc-targeted criteria alone", () => {
|
|
97
|
+
const body = BODY(
|
|
98
|
+
"- [ ] AC-1: THE module SHALL export X.\n- [ ] AC-2: WHEN archived, THE index SHALL list it.",
|
|
99
|
+
);
|
|
100
|
+
const offenders = findPresenceOnlyBehavioralCriteria(body, [
|
|
101
|
+
presence,
|
|
102
|
+
{ probe: "file-contains", criterion: "AC-2", path: "docs/index.md", pattern: "x" },
|
|
103
|
+
]);
|
|
104
|
+
expect(offenders).toEqual([]);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("treats uppercase checked boxes as criteria", () => {
|
|
108
|
+
const body = BODY("- [X] AC-1: WHEN a commit weakens a test, THE gate SHALL block it.");
|
|
109
|
+
expect(findPresenceOnlyBehavioralCriteria(body, [presence])).toEqual(["AC-1"]);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("exempts RFCs created before the cutoff", async () => {
|
|
113
|
+
const found = await v44(
|
|
114
|
+
"2026-10-17",
|
|
115
|
+
"- [ ] AC-1: WHEN a commit weakens a test, THE gate SHALL block it.",
|
|
116
|
+
[presence],
|
|
117
|
+
);
|
|
118
|
+
expect(found).toEqual([]);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1334: V-45 tests — post-cutoff proposed/added commands without a command-mode reachable probe warn.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a probe-execution suite.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1334: tests for AC-8.</item>
|
|
10
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
11
|
+
</CHANGE_SUMMARY>
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, expect, test } from "vitest";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { type AddViolationFn, validateSingleRfc } from "./validate-rules.ts";
|
|
18
|
+
import type { ParsedRfc } from "../frontmatter-io.ts";
|
|
19
|
+
|
|
20
|
+
async function v45(acceptance: unknown[]): Promise<Array<{ message: string; severity: string }>> {
|
|
21
|
+
const parsed: ParsedRfc = {
|
|
22
|
+
frontmatter: {
|
|
23
|
+
id: "RFC-9997",
|
|
24
|
+
title: "T",
|
|
25
|
+
status: "draft",
|
|
26
|
+
kind: "command",
|
|
27
|
+
scope: "workspace",
|
|
28
|
+
owners: ["architecture"],
|
|
29
|
+
createdAt: "2026-10-18",
|
|
30
|
+
updatedAt: "2026-10-18",
|
|
31
|
+
commands: { proposed: ["demo.run"], added: [], changed: [], removed: [] },
|
|
32
|
+
acceptance,
|
|
33
|
+
},
|
|
34
|
+
body: "\n# RFC-9997: T\n\n## Acceptance criteria\n\n- [ ] AC-1: THE x SHALL y.\n",
|
|
35
|
+
};
|
|
36
|
+
const out: Array<{ message: string; severity: string }> = [];
|
|
37
|
+
const add: AddViolationFn = (_id, _f, rule, message, severity = "error") => {
|
|
38
|
+
if (rule === "V-45") out.push({ message, severity });
|
|
39
|
+
};
|
|
40
|
+
await validateSingleRfc(
|
|
41
|
+
"rfc-9997-t.md",
|
|
42
|
+
parsed,
|
|
43
|
+
new Map(),
|
|
44
|
+
new Map(),
|
|
45
|
+
new Set(),
|
|
46
|
+
new Set(),
|
|
47
|
+
new Set(Object.keys(parsed.frontmatter)),
|
|
48
|
+
join(tmpdir(), "ws-1334"),
|
|
49
|
+
add,
|
|
50
|
+
);
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
describe("V-45 (RFC-1334)", () => {
|
|
55
|
+
test("V-45 warns when a proposed command has no reachable probe", async () => {
|
|
56
|
+
const found = await v45([]);
|
|
57
|
+
expect(found).toHaveLength(1);
|
|
58
|
+
expect(found[0]?.severity).toBe("warning");
|
|
59
|
+
expect(found[0]?.message).toContain("demo.run");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("stays quiet when a command-mode reachable probe covers the command", async () => {
|
|
63
|
+
expect(await v45([{ probe: "reachable", command: "demo.run", criterion: "AC-1" }])).toEqual([]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for validate rules covering V-26: implemented RFCs must have all acceptance criteria checked; V-27: checked criteria must carry inline evidence; V-31: filename-number uniqueness and filename/id consistency.
|
|
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 validate suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe } from "vitest";
|
|
2
16
|
import {
|
|
3
17
|
validateSingleRfc,
|
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-0997: add V-35 probe→criterion referential integrity, V-36 criterion identifier discipline, V-37 evidence mechanism validity, and computeProbeCoverage for non-blocking coverage reports.</item>
|
|
10
|
-
<item>RFC-1006: add V-38 document readiness completeness, V-39 non-atomic criterion, V-40 unbounded quantity, V-41 weasel verb, V-42 criterion versioning annotation format. Add evaluateDocumentReadiness and extend evaluateAcceptanceCriteria with supersession tracking and reject-checklist scans.</item>
|
|
11
|
-
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
12
|
-
|
|
13
|
-
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
14
9
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
15
10
|
|
|
16
11
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
17
12
|
<item>RFC-1271: V-43 verificationTier enum check; V-23 archive exemption (isArchived paths skip evidence-presence — archive-freeze precedent).</item>
|
|
18
|
-
<
|
|
13
|
+
<item>RFC-1322: fo-review fix pass — V-37 annotation extraction takes the LAST (evidence: ...) occurrence, matching the stamp resolver (prose mentions no longer shadow the real annotation).</item>
|
|
14
|
+
<item>RFC-1330: V-44 presence-only behavioral criteria; shared listBehavioralCriteria.</item>
|
|
15
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
16
|
+
<history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097</history>
|
|
19
17
|
</CHANGE_SUMMARY>
|
|
20
18
|
*/
|
|
21
19
|
|
|
@@ -41,8 +39,11 @@ import {
|
|
|
41
39
|
RFC_VERSION_BUMP_CUTOFF,
|
|
42
40
|
RFC_PROBE_BINDING_CUTOFF,
|
|
43
41
|
RFC_CRITERIA_CONTENT_CUTOFF,
|
|
42
|
+
RFC_ORIGIN_CUTOFF,
|
|
43
|
+
RFC_REACHABLE_CUTOFF,
|
|
44
44
|
} from "../types.ts";
|
|
45
45
|
import type { ProbeCoverageReport, AcceptanceProbe } from "../types.ts";
|
|
46
|
+
import { isPresenceProbe } from "../verification-origin.ts";
|
|
46
47
|
import { DNA_DOCS, AP_DOCS } from "./shared.ts";
|
|
47
48
|
|
|
48
49
|
// Ambient default for helper fns without a context param — handlers override
|
|
@@ -96,6 +97,35 @@ export interface DocumentReadinessEvaluation {
|
|
|
96
97
|
linesWithoutId: string[];
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
// ─── RFC-1330: V-44 presence-only behavioral criteria ───────────────────────
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Behavioral criteria (EARS event-driven `WHEN …` or failure-path `IF …`
|
|
104
|
+
* forms) whose bound probes are all presence probes. A criterion with no
|
|
105
|
+
* bound probe is not reported here — probe coverage is V-35's concern.
|
|
106
|
+
* Pure function — no I/O, no side effects.
|
|
107
|
+
*/
|
|
108
|
+
export function listBehavioralCriteria(body: string): string[] {
|
|
109
|
+
const section = extractAcceptanceCriteriaSection(stripFencedCodeBlocks(body));
|
|
110
|
+
if (!section) return [];
|
|
111
|
+
const ids: string[] = [];
|
|
112
|
+
for (const line of section.split("\n")) {
|
|
113
|
+
const match = /^\s*- \[[ xX]\]\s*(AC-\d+):\s*(.*)$/.exec(line);
|
|
114
|
+
if (match && /^(WHEN|IF)\b/.test((match[2] ?? "").trim())) ids.push(match[1]!);
|
|
115
|
+
}
|
|
116
|
+
return ids;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function findPresenceOnlyBehavioralCriteria(
|
|
120
|
+
body: string,
|
|
121
|
+
probes: AcceptanceProbe[],
|
|
122
|
+
): string[] {
|
|
123
|
+
return listBehavioralCriteria(body).filter((id) => {
|
|
124
|
+
const bound = probes.filter((p) => p.criterion === id);
|
|
125
|
+
return bound.length > 0 && bound.every(isPresenceProbe);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
99
129
|
// ─── RFC-1006: reject checklist constants ──────────────────────────────────
|
|
100
130
|
|
|
101
131
|
const UNBOUNDED_QUANTITY_TRIGGERS = [
|
|
@@ -812,7 +842,10 @@ export async function validateSingleRfc(
|
|
|
812
842
|
.split("\n")
|
|
813
843
|
.filter((line: string) => /^- \[x\]/.test(line));
|
|
814
844
|
for (const line of checkedLines) {
|
|
815
|
-
|
|
845
|
+
// The LAST `(evidence: ...)` occurrence is the annotation — criterion
|
|
846
|
+
// prose may mention the literal syntax mid-sentence (RFC-1322 AC-1/2).
|
|
847
|
+
const evidenceMatches = [...line.matchAll(/\(evidence:\s*(.+?)\)/g)];
|
|
848
|
+
const evidenceMatch = evidenceMatches.at(-1);
|
|
816
849
|
if (!evidenceMatch) continue;
|
|
817
850
|
const evidence = evidenceMatch[1]!.trim();
|
|
818
851
|
|
|
@@ -941,6 +974,46 @@ export async function validateSingleRfc(
|
|
|
941
974
|
);
|
|
942
975
|
}
|
|
943
976
|
|
|
977
|
+
// V-44: WHEN/IF criteria need an execution probe (RFC-1330, post-cutoff only)
|
|
978
|
+
if (createdAt >= RFC_ORIGIN_CUTOFF && !isArchived) {
|
|
979
|
+
const acceptance = fm["acceptance"];
|
|
980
|
+
const probes = Array.isArray(acceptance) ? (acceptance as AcceptanceProbe[]) : [];
|
|
981
|
+
for (const id of findPresenceOnlyBehavioralCriteria(body, probes)) {
|
|
982
|
+
addViolation(
|
|
983
|
+
rfcId,
|
|
984
|
+
relFile,
|
|
985
|
+
"V-44",
|
|
986
|
+
`${id} is a WHEN/IF behavioral criterion evidenced only by presence probes (file-exists, command-registered, or file-contains/json-schema over non-doc paths). Bind an execution probe (test, run, or page) to ${id}.`,
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// V-45: proposed/added commands need a command-mode reachable probe (RFC-1334, warning)
|
|
992
|
+
if (createdAt >= RFC_REACHABLE_CUTOFF && !isArchived) {
|
|
993
|
+
const acceptance = fm["acceptance"];
|
|
994
|
+
const probes = Array.isArray(acceptance) ? (acceptance as AcceptanceProbe[]) : [];
|
|
995
|
+
const covered = new Set(
|
|
996
|
+
probes
|
|
997
|
+
.filter((p) => p.probe === "reachable" && "command" in p)
|
|
998
|
+
.map((p) => (p as { command: string }).command),
|
|
999
|
+
);
|
|
1000
|
+
const block = (fm["commands"] ?? {}) as Record<string, unknown>;
|
|
1001
|
+
const declared = [
|
|
1002
|
+
...(Array.isArray(block["proposed"]) ? block["proposed"] : []),
|
|
1003
|
+
...(Array.isArray(block["added"]) ? block["added"] : []),
|
|
1004
|
+
].map(String);
|
|
1005
|
+
const missing = declared.filter((c) => !covered.has(c));
|
|
1006
|
+
if (missing.length > 0) {
|
|
1007
|
+
addViolation(
|
|
1008
|
+
rfcId,
|
|
1009
|
+
relFile,
|
|
1010
|
+
"V-45",
|
|
1011
|
+
`commands without a command-mode reachable probe: ${missing.join(", ")} — add \`probe: reachable\` with \`command: <name>\` per command.`,
|
|
1012
|
+
"warning",
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
944
1017
|
// V-15: title consistency
|
|
945
1018
|
const titleStr = String(fm["title"] ?? "");
|
|
946
1019
|
const headingMatch = body.match(/^#\s+(?:RFC-\d{4}:\s*)?(.+)$/m);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>
|
|
4
|
-
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for validate covering runRfcValidate --id flag guard. It also guards the documented public contract and regression-sensitive edge cases.
|
|
5
|
+
</purpose>
|
|
5
6
|
<non-goals>
|
|
6
7
|
<item>Do not duplicate validate-rules coverage — V-rule behavior lives in validate-rules*.test.ts.</item>
|
|
7
8
|
</non-goals>
|
|
8
9
|
</MODULE_CONTRACT>
|
|
9
10
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>Initial test — non-string --id (boolean/array from unvalidated flag input) throws a clear flag error instead of TypeError in rfcFileMatchesId.</item>
|
|
11
|
+
<item>RFC-1311: carried legacy entry — Initial test — non-string --id (boolean/array from unvalidated flag input) throws a clear flag error instead of TypeError in rfcFileMatchesId.</item>
|
|
11
12
|
</CHANGE_SUMMARY>
|
|
12
13
|
*/
|
|
13
14
|
|