@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 decision ledger covering decisionLedgerSchema (RFC-1250); decisionLedgerPath / loadDecisionLedger (RFC-1250).
|
|
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 decision suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe, beforeEach, afterEach } from "vitest";
|
|
2
16
|
import fs from "node:fs/promises";
|
|
3
17
|
import path from "node:path";
|
|
@@ -70,6 +84,18 @@ describe("decisionLedgerSchema (RFC-1250)", () => {
|
|
|
70
84
|
expect(result.success).toBe(false);
|
|
71
85
|
});
|
|
72
86
|
|
|
87
|
+
test("stage accepts pipeline phases incl. audit", () => {
|
|
88
|
+
for (const stage of ["idea", "audit", "enhance", "plan", "implement", "review"]) {
|
|
89
|
+
const result = decisionLedgerSchema.safeParse({
|
|
90
|
+
id: "x.decisions",
|
|
91
|
+
queue: "x",
|
|
92
|
+
createdAt: "2026-10-09",
|
|
93
|
+
items: [{ id: "Q-1", doc: "RFC-1243", stage, question: "q", resolutionPath: "none" }],
|
|
94
|
+
});
|
|
95
|
+
expect(result.success, `stage "${stage}" rejected`).toBe(true);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
73
99
|
test("entry id must match Q-N", () => {
|
|
74
100
|
const result = decisionLedgerSchema.safeParse({
|
|
75
101
|
id: "x.decisions",
|
|
@@ -141,10 +167,7 @@ describe("decisionLedgerPath / loadDecisionLedger (RFC-1250)", () => {
|
|
|
141
167
|
});
|
|
142
168
|
|
|
143
169
|
test("invalid YAML → QUEUE-01 error on the manifest load path", async () => {
|
|
144
|
-
await fs.writeFile(
|
|
145
|
-
path.join(tmpDir, "docs/queues/block-b.decisions.yaml"),
|
|
146
|
-
"id: [unclosed\n",
|
|
147
|
-
);
|
|
170
|
+
await fs.writeFile(path.join(tmpDir, "docs/queues/block-b.decisions.yaml"), "id: [unclosed\n");
|
|
148
171
|
const { ledger, errors } = await loadDecisionLedger(tmpDir, "docs/queues/block-b.yaml");
|
|
149
172
|
expect(ledger).toBeNull();
|
|
150
173
|
expect(errors.some((e) => e.ruleId === "QUEUE-01")).toBe(true);
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for queue validate covering loadQueueManifest — validation rules (RFC-1140); runQueueValidate — decision ledger (RFC-1250); runQueueValidate — command contract (RFC-1140).
|
|
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 queue suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe, beforeEach, afterEach } from "vitest";
|
|
2
16
|
import fs from "node:fs/promises";
|
|
3
17
|
import path from "node:path";
|
package/os/queue/types.ts
CHANGED
|
@@ -24,6 +24,8 @@ items; top-level decision totals added. Orchestrator pre-flight treats
|
|
|
24
24
|
QUEUE-07 as the window agenda — structural errors still stop the batch;
|
|
25
25
|
maturation skips parked/deferred items; uncovered imperative ask sites
|
|
26
26
|
gain collect riders (ADR code-trace, NC markers, audit-verdict guard).</item>
|
|
27
|
+
<item>RFC-1250: decision stage enum gains audit — audit-phase questions had no valid stage</item>
|
|
28
|
+
<history>RFC-1250</history>
|
|
27
29
|
</CHANGE_SUMMARY>
|
|
28
30
|
*/
|
|
29
31
|
|
|
@@ -46,7 +48,7 @@ export const decisionOptionSchema = z.object({
|
|
|
46
48
|
export const decisionEntrySchema = z.object({
|
|
47
49
|
id: z.string().regex(/^Q-\d+$/),
|
|
48
50
|
doc: z.string().regex(QUEUE_ITEM_ID_PATTERN),
|
|
49
|
-
stage: z.enum(["idea", "enhance", "plan", "implement", "review"]),
|
|
51
|
+
stage: z.enum(["idea", "audit", "enhance", "plan", "implement", "review"]),
|
|
50
52
|
question: z.string().min(1),
|
|
51
53
|
resolutionPath: z.enum(["codebase", "convention", "profile", "policy", "none"]),
|
|
52
54
|
options: z.array(decisionOptionSchema).default([]),
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1334: reachable probe tests — symbol mode over a temporary git repository and command mode over a fixture manifest.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a TypeScript resolution suite — the scan is lexical by design.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1334: tests for AC-1..AC-5.</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 { execFileSync } from "node:child_process";
|
|
15
|
+
import * as fs from "node:fs/promises";
|
|
16
|
+
import * as os from "node:os";
|
|
17
|
+
import * as path from "node:path";
|
|
18
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
19
|
+
import {
|
|
20
|
+
probeReachableCommand,
|
|
21
|
+
probeReachableSymbol,
|
|
22
|
+
resetReachableScanCache,
|
|
23
|
+
} from "./reachable-symbol.ts";
|
|
24
|
+
|
|
25
|
+
let root: string;
|
|
26
|
+
|
|
27
|
+
async function repo(files: Record<string, string>): Promise<void> {
|
|
28
|
+
for (const [rel, body] of Object.entries(files)) {
|
|
29
|
+
await fs.mkdir(path.dirname(path.join(root, rel)), { recursive: true });
|
|
30
|
+
await fs.writeFile(path.join(root, rel), body);
|
|
31
|
+
}
|
|
32
|
+
execFileSync("git", ["add", "-A"], { cwd: root });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const lib = { "packages/p/src/lib.ts": "export function compute() { return 1; }\n" };
|
|
36
|
+
const probe = (extra: { root?: string } = {}) =>
|
|
37
|
+
probeReachableSymbol({
|
|
38
|
+
workspaceRoot: root,
|
|
39
|
+
symbol: "compute",
|
|
40
|
+
module: "packages/p/src/lib.ts",
|
|
41
|
+
...extra,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
beforeEach(async () => {
|
|
45
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), "reachable-"));
|
|
46
|
+
execFileSync("git", ["init", "-q"], { cwd: root });
|
|
47
|
+
resetReachableScanCache();
|
|
48
|
+
});
|
|
49
|
+
afterEach(async () => {
|
|
50
|
+
await fs.rm(root, { recursive: true, force: true });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe("reachable probe (RFC-1334)", () => {
|
|
54
|
+
it("passes when a non-test module imports the symbol", async () => {
|
|
55
|
+
await repo({
|
|
56
|
+
...lib,
|
|
57
|
+
"packages/p/src/use.ts": 'import { compute } from "./lib.ts";\nexport const v = compute();\n',
|
|
58
|
+
});
|
|
59
|
+
expect((await probe()).ok).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("fails when only test files import the symbol", async () => {
|
|
63
|
+
await repo({ ...lib, "packages/p/src/lib.test.ts": 'import { compute } from "./lib.ts";\n' });
|
|
64
|
+
const r = await probe();
|
|
65
|
+
expect(r.ok).toBe(false);
|
|
66
|
+
expect(r.detail).toContain("no runtime importer");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("fails when only type-only imports reference the symbol", async () => {
|
|
70
|
+
await repo({
|
|
71
|
+
...lib,
|
|
72
|
+
"packages/p/src/a.ts": 'import type { compute } from "./lib.ts";\n',
|
|
73
|
+
"packages/p/src/b.ts": 'import { type compute } from "./lib.ts";\n',
|
|
74
|
+
});
|
|
75
|
+
expect((await probe()).ok).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("fails when no importer is reachable from the declared root", async () => {
|
|
79
|
+
await repo({
|
|
80
|
+
...lib,
|
|
81
|
+
"packages/p/src/orphan.ts": 'import { compute } from "./lib.ts";\n',
|
|
82
|
+
"packages/p/src/main.ts": "export const main = 1;\n",
|
|
83
|
+
});
|
|
84
|
+
const r = await probe({ root: "packages/p/src/main.ts" });
|
|
85
|
+
expect(r.ok).toBe(false);
|
|
86
|
+
expect(r.detail).toContain("not reachable from root");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("passes through a barrel and a namespace import", async () => {
|
|
90
|
+
await repo({
|
|
91
|
+
...lib,
|
|
92
|
+
"packages/p/src/index.ts": 'export { compute } from "./lib.ts";\n',
|
|
93
|
+
"packages/p/src/use.ts": 'import * as p from "./index.ts";\np.compute();\n',
|
|
94
|
+
});
|
|
95
|
+
expect((await probe()).ok).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("keeps imports that follow a glob string containing a comment opener", async () => {
|
|
99
|
+
await repo({
|
|
100
|
+
...lib,
|
|
101
|
+
"packages/p/src/use.ts":
|
|
102
|
+
'const G = "packages/*/src/**";\nimport { compute } from "./lib.ts";\nexport const v = compute() + G.length; // */\n',
|
|
103
|
+
});
|
|
104
|
+
expect((await probe()).ok).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("reaches an importer through a dynamic module loader from the root", async () => {
|
|
108
|
+
await repo({
|
|
109
|
+
...lib,
|
|
110
|
+
"packages/p/src/feature.ts":
|
|
111
|
+
'import { compute } from "./lib.ts";\nexport const f = compute;\n',
|
|
112
|
+
"packages/p/src/main.ts": 'export const loaders = { f: () => import("./feature.ts") };\n',
|
|
113
|
+
});
|
|
114
|
+
expect((await probe({ root: "packages/p/src/main.ts" })).ok).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("treats a bound dynamic import as a namespace", async () => {
|
|
118
|
+
await repo({
|
|
119
|
+
...lib,
|
|
120
|
+
"packages/p/src/use.ts": 'const m = await import("./lib.ts");\nm.compute();\n',
|
|
121
|
+
});
|
|
122
|
+
expect((await probe()).ok).toBe(true);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("resolves bare specifiers through exports subpath patterns", async () => {
|
|
126
|
+
await repo({
|
|
127
|
+
...lib,
|
|
128
|
+
"packages/p/package.json": '{ "name": "@t/p", "exports": { "./*": "./src/*.ts" } }\n',
|
|
129
|
+
"packages/q/src/use.ts": 'import { compute } from "@t/p/lib";\nexport const v = compute();\n',
|
|
130
|
+
});
|
|
131
|
+
expect((await probe()).ok).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("fails a command probe whose reachableVia is empty", async () => {
|
|
135
|
+
await repo({
|
|
136
|
+
"docs/command-manifest.generated.yaml":
|
|
137
|
+
"commands:\n - name: lonely.run\n reachableVia: []\n - name: wired.run\n reachableVia:\n - kind: pipeline\n ref: packages.check\n",
|
|
138
|
+
});
|
|
139
|
+
expect((await probeReachableCommand({ workspaceRoot: root, command: "lonely.run" })).ok).toBe(
|
|
140
|
+
false,
|
|
141
|
+
);
|
|
142
|
+
expect((await probeReachableCommand({ workspaceRoot: root, command: "wired.run" })).ok).toBe(
|
|
143
|
+
true,
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for acceptance covering validateAcceptanceShape — RFC-1271 optional probe metadata; V-43 — verificationTier enum validation (RFC-1271).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the acceptance suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
1
16
|
import { test, expect, describe } from "vitest";
|
|
2
17
|
import { join } from "node:path";
|
|
3
18
|
import { tmpdir } from "node:os";
|
|
@@ -108,4 +123,14 @@ describe("V-43 — verificationTier enum validation (RFC-1271)", () => {
|
|
|
108
123
|
const violations = await runValidate(makeParsed("extreme"));
|
|
109
124
|
expect(violations.some((v) => v.rule === "V-43")).toBe(true);
|
|
110
125
|
});
|
|
126
|
+
test("rejects a reachable probe that declares both or neither of symbol and command", () => {
|
|
127
|
+
const both = validateAcceptanceShape([
|
|
128
|
+
{ probe: "reachable", symbol: "a", module: "m.ts", command: "x.y" },
|
|
129
|
+
]);
|
|
130
|
+
const neither = validateAcceptanceShape([{ probe: "reachable" }]);
|
|
131
|
+
const ok = validateAcceptanceShape([{ probe: "reachable", command: "x.y" }]);
|
|
132
|
+
expect(both).toHaveLength(1);
|
|
133
|
+
expect(neither).toHaveLength(1);
|
|
134
|
+
expect(ok).toEqual([]);
|
|
135
|
+
});
|
|
111
136
|
});
|
package/os/rfc/acceptance.ts
CHANGED
|
@@ -16,9 +16,11 @@ prose checklist.
|
|
|
16
16
|
<item>RFC-0268: initial implementation.</item>
|
|
17
17
|
<item>RFC-0998: added test and json-schema probe kinds — spawnVitest helper, Ajv validation, shape validation.</item>
|
|
18
18
|
<item>RFC-1271: optional probe metadata — expectationSource enum-check, limitations pass-through.</item>
|
|
19
|
+
<item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
|
|
19
20
|
</CHANGE_SUMMARY>
|
|
20
21
|
*/
|
|
21
22
|
|
|
23
|
+
import { probeReachableCommand, probeReachableSymbol } from "./reachable-symbol.ts";
|
|
22
24
|
import { spawn } from "../../src/utils/sync-fs.ts";
|
|
23
25
|
import { ambientIo, resolveIo } from "../../src/utils/io.ts";
|
|
24
26
|
|
|
@@ -171,6 +173,42 @@ export function validateAcceptanceShape(value: unknown): AcceptanceShapeIssue[]
|
|
|
171
173
|
}
|
|
172
174
|
break;
|
|
173
175
|
}
|
|
176
|
+
case "reachable": {
|
|
177
|
+
const rec = entry as Record<string, unknown>;
|
|
178
|
+
const hasSymbol = rec["symbol"] !== undefined;
|
|
179
|
+
const hasCommand = rec["command"] !== undefined;
|
|
180
|
+
if (hasSymbol === hasCommand) {
|
|
181
|
+
issues.push({
|
|
182
|
+
index,
|
|
183
|
+
message:
|
|
184
|
+
'probe "reachable" requires exactly one of "symbol" (with "module") or "command"',
|
|
185
|
+
});
|
|
186
|
+
} else if (hasSymbol) {
|
|
187
|
+
if (typeof rec["symbol"] !== "string" || typeof rec["module"] !== "string") {
|
|
188
|
+
issues.push({
|
|
189
|
+
index,
|
|
190
|
+
message: 'probe "reachable" symbol mode requires string "symbol" and "module"',
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (rec["root"] !== undefined && typeof rec["root"] !== "string") {
|
|
194
|
+
issues.push({ index, message: 'probe "reachable" "root" must be a string if present' });
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
if (typeof rec["command"] !== "string") {
|
|
198
|
+
issues.push({
|
|
199
|
+
index,
|
|
200
|
+
message: 'probe "reachable" command mode requires a string "command"',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (rec["root"] !== undefined || rec["module"] !== undefined) {
|
|
204
|
+
issues.push({
|
|
205
|
+
index,
|
|
206
|
+
message: 'probe "reachable" command mode takes no "root" or "module"',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
174
212
|
case "json-schema": {
|
|
175
213
|
const artifact = (entry as Record<string, unknown>)["artifact"];
|
|
176
214
|
if (typeof artifact !== "string") {
|
|
@@ -185,7 +223,7 @@ export function validateAcceptanceShape(value: unknown): AcceptanceShapeIssue[]
|
|
|
185
223
|
default:
|
|
186
224
|
issues.push({
|
|
187
225
|
index,
|
|
188
|
-
message: `unknown probe kind "${String(probe)}" — expected one of: run, file-exists, file-contains, command-registered, page, test, json-schema`,
|
|
226
|
+
message: `unknown probe kind "${String(probe)}" — expected one of: run, file-exists, file-contains, command-registered, page, test, json-schema, reachable`,
|
|
189
227
|
});
|
|
190
228
|
}
|
|
191
229
|
|
|
@@ -356,6 +394,18 @@ export async function runProbe(
|
|
|
356
394
|
const ok = exitCode === probe.expect.exitCode;
|
|
357
395
|
return { probe, ok, detail: `exitCode=${exitCode} (expected ${probe.expect.exitCode})` };
|
|
358
396
|
}
|
|
397
|
+
case "reachable": {
|
|
398
|
+
const r =
|
|
399
|
+
"command" in probe
|
|
400
|
+
? await probeReachableCommand({ workspaceRoot, command: probe.command })
|
|
401
|
+
: await probeReachableSymbol({
|
|
402
|
+
workspaceRoot,
|
|
403
|
+
symbol: probe.symbol,
|
|
404
|
+
module: probe.module,
|
|
405
|
+
...(probe.root ? { root: probe.root } : {}),
|
|
406
|
+
});
|
|
407
|
+
return { probe, ok: r.ok, detail: r.detail };
|
|
408
|
+
}
|
|
359
409
|
case "json-schema": {
|
|
360
410
|
const artifactPath = path.join(workspaceRoot, probe.artifact);
|
|
361
411
|
let raw: string;
|
package/os/rfc/decision-log.ts
CHANGED
|
@@ -12,13 +12,12 @@ keywords for rfc.create consultation, and generate/validate projections.
|
|
|
12
12
|
</MODULE_CONTRACT>
|
|
13
13
|
<CHANGE_SUMMARY>
|
|
14
14
|
<item>RFC-0329: initial implementation.</item>
|
|
15
|
+
<item>RFC-1320 review-r1: writes migrated writeFileAtomic → context.io; dry-run returns renderedFiles for both projections (ambient writes bypassed dry-run interception and self-healed stale artifacts inside emit's freshness precheck).</item>
|
|
15
16
|
</CHANGE_SUMMARY>
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
import { join } from "node:path";
|
|
19
20
|
import { resolveIo } from "../../src/utils/io.ts";
|
|
20
|
-
|
|
21
|
-
import { writeFileAtomic } from "../../src/utils/fs-atomic.ts";
|
|
22
21
|
import { buildGeneratedHeader } from "../../src/utils/generated-marker.ts";
|
|
23
22
|
import { stringify as yamlStringify } from "yaml";
|
|
24
23
|
import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
|
|
@@ -290,8 +289,27 @@ export async function runRfcDecisionLogGenerate(
|
|
|
290
289
|
const jsonContent = `${buildGeneratedHeader({ filePath: jsonRelPath, ownerCommand: "rfc.decision-log.generate" })}${yamlStringify({ command: "rfc.decision-log.generate", status: "ok", count: entries.length, entries })}\n`;
|
|
291
290
|
const mdContent = renderMarkdown(entries);
|
|
292
291
|
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
// RFC-1320: dry-run must surface renderedFiles — emit's freshness gate
|
|
293
|
+
// byte-verifies these artifacts via generated.drift.validate --target=workspace.
|
|
294
|
+
if (context.dryRun) {
|
|
295
|
+
return {
|
|
296
|
+
data: {
|
|
297
|
+
command: "rfc.decision-log.generate",
|
|
298
|
+
status: "ok",
|
|
299
|
+
count: entries.length,
|
|
300
|
+
entries,
|
|
301
|
+
renderedFiles: {
|
|
302
|
+
[jsonRelPath.replace(/\\/g, "/")]: jsonContent,
|
|
303
|
+
[mdRelPath.replace(/\\/g, "/")]: mdContent,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
exitCode: 0,
|
|
307
|
+
summary: `rfc.decision-log.generate: dry-run rendered ${entries.length} entries (JSON + Markdown)`,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
await io.writeFile(join(workspaceRoot, jsonRelPath), jsonContent);
|
|
312
|
+
await io.writeFile(join(workspaceRoot, mdRelPath), mdContent);
|
|
295
313
|
|
|
296
314
|
if (outputFormat === "pretty") {
|
|
297
315
|
logger.success(`Wrote ${jsonRelPath} and ${mdRelPath} (${entries.length} entries)`);
|
package/os/rfc/dna-trace.ts
CHANGED
|
@@ -11,14 +11,14 @@ entries from all RFCs, and builds a bidirectional trace matrix.
|
|
|
11
11
|
</non-goals>
|
|
12
12
|
</MODULE_CONTRACT>
|
|
13
13
|
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1328 review (unblock): rename _io → io in the two command scopes — the WS-WRITE-02 scan pattern matches io.writeFile but not _io.writeFile (false positive since the RFC-1320 migration).</item>
|
|
14
15
|
<item>RFC-0331: initial implementation.</item>
|
|
16
|
+
<item>RFC-1320 review-r1: write migrated writeFileAtomic → context.io; dry-run returns renderedFiles (ambient writes bypassed dry-run interception and self-healed stale artifacts inside emit's freshness precheck).</item>
|
|
15
17
|
</CHANGE_SUMMARY>
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { join } from "node:path";
|
|
19
21
|
import { ambientIo, resolveIo } from "../../src/utils/io.ts";
|
|
20
|
-
|
|
21
|
-
import { writeFileAtomic } from "../../src/utils/fs-atomic.ts";
|
|
22
22
|
import { buildGeneratedHeader } from "../../src/utils/generated-marker.ts";
|
|
23
23
|
import { stringify as yamlStringify } from "yaml";
|
|
24
24
|
import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
|
|
@@ -55,6 +55,8 @@ export interface DnaTraceResult {
|
|
|
55
55
|
entries: DnaTraceEntry[];
|
|
56
56
|
diagnostics: Diagnostic[];
|
|
57
57
|
written?: string;
|
|
58
|
+
/** RFC-1320: dry-run render surface for generated.drift.validate. */
|
|
59
|
+
renderedFiles?: Record<string, string>;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
async function parseDnaRegistry(workspaceRoot: string): Promise<Set<string>> {
|
|
@@ -190,7 +192,6 @@ export async function runRfcDnaTraceValidate(
|
|
|
190
192
|
input: ForgeCommandInput,
|
|
191
193
|
context: ForgeRuntimeContext,
|
|
192
194
|
): Promise<ForgeCommandResult<DnaTraceResult>> {
|
|
193
|
-
const _io = resolveIo(context.io);
|
|
194
195
|
const { workspaceRoot, logger, outputFormat } = context;
|
|
195
196
|
const dnaFilter = input.flags["dna"] as string | undefined;
|
|
196
197
|
|
|
@@ -246,7 +247,7 @@ export async function runRfcDnaTraceGenerate(
|
|
|
246
247
|
_input: ForgeCommandInput,
|
|
247
248
|
context: ForgeRuntimeContext,
|
|
248
249
|
): Promise<ForgeCommandResult<DnaTraceResult>> {
|
|
249
|
-
const
|
|
250
|
+
const io = resolveIo(context.io);
|
|
250
251
|
const { workspaceRoot, logger, outputFormat } = context;
|
|
251
252
|
|
|
252
253
|
const { entries, diagnostics, registryIds } = await buildDnaTrace(workspaceRoot);
|
|
@@ -269,7 +270,18 @@ export async function runRfcDnaTraceGenerate(
|
|
|
269
270
|
written: outRel,
|
|
270
271
|
};
|
|
271
272
|
const jsonContent = `${buildGeneratedHeader({ filePath: outRel, ownerCommand: "rfc.dna.trace.generate" })}${yamlStringify({ ...payload })}\n`;
|
|
272
|
-
|
|
273
|
+
|
|
274
|
+
// RFC-1320: dry-run must surface renderedFiles — emit's freshness gate
|
|
275
|
+
// byte-verifies this artifact via generated.drift.validate --target=workspace.
|
|
276
|
+
if (context.dryRun) {
|
|
277
|
+
return {
|
|
278
|
+
data: { ...payload, renderedFiles: { [outRel.replace(/\\/g, "/")]: jsonContent } },
|
|
279
|
+
exitCode: hasErrors ? 1 : 0,
|
|
280
|
+
summary: `rfc.dna.trace.generate: dry-run rendered ${outRel} (${registryIds.size} DNA, ${tracedDnaCount} traced)`,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
await io.writeFile(join(workspaceRoot, outRel), jsonContent);
|
|
273
285
|
|
|
274
286
|
if (outputFormat === "pretty") {
|
|
275
287
|
logger.section(
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for frontmatter io covering listRfcFiles — recursive scanning (RFC-0491); readAndParseRfc — YAML parse error handling (RFC-0755); parseRfcFile — basic parsing.
|
|
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 frontmatter 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 fs from "node:fs/promises";
|
|
3
17
|
import path from "node:path";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1333: RFC-IMP-12 tests — HIGH-tier stamps need a committed passing, subagent-isolated acceptance report bound to the current code.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Do not read git — reports and candidate binding are supplied directly.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1333: tests for AC-5 and AC-6.</item>
|
|
10
|
+
<item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
|
|
11
|
+
</CHANGE_SUMMARY>
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, expect, it } from "vitest";
|
|
15
|
+
import { evaluateAcceptanceVerificationGate } from "./implement-stamp-origin.ts";
|
|
16
|
+
|
|
17
|
+
const fm = { createdAt: "2026-10-18", verificationTier: "high" };
|
|
18
|
+
const report = (extra: Record<string, unknown>) => ({
|
|
19
|
+
path: "docs/reviews/acceptance/rfc-9001/acceptance-2026-10-18-r0.md",
|
|
20
|
+
frontmatter: {
|
|
21
|
+
rfcId: "RFC-9001",
|
|
22
|
+
candidateSha: "abc1234",
|
|
23
|
+
round: 0,
|
|
24
|
+
verdict: "pass",
|
|
25
|
+
isolation: "subagent",
|
|
26
|
+
...extra,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("RFC-IMP-12 (RFC-1333)", () => {
|
|
31
|
+
it("blocks RFC-IMP-12 when a high-tier RFC has no pass report bound to the implementation commit", async () => {
|
|
32
|
+
const none = await evaluateAcceptanceVerificationGate({
|
|
33
|
+
targetId: "RFC-9001",
|
|
34
|
+
frontmatter: fm,
|
|
35
|
+
reports: [],
|
|
36
|
+
isCandidateBound: async () => true,
|
|
37
|
+
});
|
|
38
|
+
expect(none.errors.map((e) => e.rule)).toEqual(["RFC-IMP-12"]);
|
|
39
|
+
const unbound = await evaluateAcceptanceVerificationGate({
|
|
40
|
+
targetId: "RFC-9001",
|
|
41
|
+
frontmatter: fm,
|
|
42
|
+
reports: [report({})],
|
|
43
|
+
isCandidateBound: async () => false,
|
|
44
|
+
});
|
|
45
|
+
expect(unbound.errors.map((e) => e.rule)).toEqual(["RFC-IMP-12"]);
|
|
46
|
+
const ok = await evaluateAcceptanceVerificationGate({
|
|
47
|
+
targetId: "RFC-9001",
|
|
48
|
+
frontmatter: fm,
|
|
49
|
+
reports: [report({})],
|
|
50
|
+
isCandidateBound: async () => true,
|
|
51
|
+
});
|
|
52
|
+
expect(ok.errors).toEqual([]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("blocks RFC-IMP-12 when the bound report records non-subagent isolation without a waiver", async () => {
|
|
56
|
+
const input = {
|
|
57
|
+
targetId: "RFC-9001",
|
|
58
|
+
frontmatter: fm,
|
|
59
|
+
reports: [report({ isolation: "isolated-inline" })],
|
|
60
|
+
isCandidateBound: async () => true,
|
|
61
|
+
};
|
|
62
|
+
const blocked = await evaluateAcceptanceVerificationGate(input);
|
|
63
|
+
expect(blocked.errors.map((e) => e.rule)).toEqual(["RFC-IMP-12"]);
|
|
64
|
+
const waived = await evaluateAcceptanceVerificationGate({
|
|
65
|
+
...input,
|
|
66
|
+
waiverReason: "operator: no subagent on this platform",
|
|
67
|
+
});
|
|
68
|
+
expect(waived.errors).toEqual([]);
|
|
69
|
+
expect(waived.warnings[0]?.message).toContain("Waived by operator");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("ignores standard-tier and pre-cutoff RFCs", async () => {
|
|
73
|
+
const std = await evaluateAcceptanceVerificationGate({
|
|
74
|
+
targetId: "RFC-9001",
|
|
75
|
+
frontmatter: { createdAt: "2026-10-18" },
|
|
76
|
+
reports: [],
|
|
77
|
+
isCandidateBound: async () => true,
|
|
78
|
+
});
|
|
79
|
+
expect(std.errors).toEqual([]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1333: candidate-binding and report-parsing tests for RFC-IMP-12 over a temporary git repository.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Do not run the full stamp — the gate evaluator is covered elsewhere.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1333: merge-commit binding and CRLF report regression tests (REVIEW-CODE-2026-10-18-04).</item>
|
|
10
|
+
</CHANGE_SUMMARY>
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { execFileSync } from "node:child_process";
|
|
14
|
+
import * as fs from "node:fs/promises";
|
|
15
|
+
import * as os from "node:os";
|
|
16
|
+
import * as path from "node:path";
|
|
17
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
18
|
+
import { candidateBoundToHead, readAcceptanceReports } from "./implement-stamp.ts";
|
|
19
|
+
|
|
20
|
+
let root: string;
|
|
21
|
+
const git = (...a: string[]) =>
|
|
22
|
+
execFileSync(
|
|
23
|
+
"git",
|
|
24
|
+
["-c", "core.hooksPath=/dev/null", "-c", "user.email=t@t", "-c", "user.name=T", ...a],
|
|
25
|
+
{
|
|
26
|
+
cwd: root,
|
|
27
|
+
encoding: "utf8",
|
|
28
|
+
},
|
|
29
|
+
).trim();
|
|
30
|
+
async function put(rel: string, body: string): Promise<void> {
|
|
31
|
+
await fs.mkdir(path.dirname(path.join(root, rel)), { recursive: true });
|
|
32
|
+
await fs.writeFile(path.join(root, rel), body);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
beforeEach(async () => {
|
|
36
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), "imp12-bind-"));
|
|
37
|
+
git("init", "-q", "-b", "main");
|
|
38
|
+
await put("src/a.ts", "a\n");
|
|
39
|
+
git("add", "-A");
|
|
40
|
+
git("commit", "-qm", "init");
|
|
41
|
+
});
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
await fs.rm(root, { recursive: true, force: true });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("RFC-IMP-12 binding (RFC-1333)", () => {
|
|
47
|
+
it("unbinds when a merge brings code after the candidate", async () => {
|
|
48
|
+
const candidate = git("rev-parse", "HEAD");
|
|
49
|
+
git("checkout", "-qb", "side");
|
|
50
|
+
await put("src/evil.ts", "x\n");
|
|
51
|
+
git("add", "-A");
|
|
52
|
+
git("commit", "-qm", "side change");
|
|
53
|
+
git("checkout", "-q", "main");
|
|
54
|
+
await put("docs/note.md", "n\n");
|
|
55
|
+
git("add", "-A");
|
|
56
|
+
git("commit", "-qm", "docs");
|
|
57
|
+
git("merge", "-q", "--no-ff", "side", "-m", "merge side");
|
|
58
|
+
expect(await candidateBoundToHead(root, candidate)).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("stays bound across docs-only commits", async () => {
|
|
62
|
+
const candidate = git("rev-parse", "HEAD");
|
|
63
|
+
await put("docs/note.md", "n\n");
|
|
64
|
+
git("add", "-A");
|
|
65
|
+
git("commit", "-qm", "docs");
|
|
66
|
+
expect(await candidateBoundToHead(root, candidate)).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("parses CRLF report frontmatter", async () => {
|
|
70
|
+
await put(
|
|
71
|
+
"docs/reviews/acceptance/rfc-9003/acceptance-2026-10-18-r0.md",
|
|
72
|
+
"---\r\nrfcId: RFC-9003\r\nverdict: pass\r\nisolation: subagent\r\ncandidateSha: abc\r\n---\r\n\r\nok\r\n",
|
|
73
|
+
);
|
|
74
|
+
git("add", "-A");
|
|
75
|
+
git("commit", "-qm", "report");
|
|
76
|
+
const reports = await readAcceptanceReports(root, "RFC-9003");
|
|
77
|
+
expect(reports[0]?.frontmatter["verdict"]).toBe("pass");
|
|
78
|
+
});
|
|
79
|
+
});
|