@warpgogol/forge 7.0.0 → 8.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/bin/cli.js +6 -12
- package/bin/cli.ts +3 -2
- package/bin/resolve-entry.js +24 -0
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/authority/authority.module.d.ts +3 -0
- package/dist/os/authority/authority.module.d.ts.map +1 -0
- package/dist/os/authority/authority.module.js +169 -0
- package/dist/os/authority/authority.module.js.map +1 -0
- package/dist/os/authority/handlers/delegate-revoke.d.ts +15 -0
- package/dist/os/authority/handlers/delegate-revoke.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegate-revoke.js +91 -0
- package/dist/os/authority/handlers/delegate-revoke.js.map +1 -0
- package/dist/os/authority/handlers/delegate.d.ts +14 -0
- package/dist/os/authority/handlers/delegate.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegate.js +134 -0
- package/dist/os/authority/handlers/delegate.js.map +1 -0
- package/dist/os/authority/handlers/delegation-list.d.ts +12 -0
- package/dist/os/authority/handlers/delegation-list.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegation-list.js +54 -0
- package/dist/os/authority/handlers/delegation-list.js.map +1 -0
- package/dist/os/authority/handlers/delegation-validate.d.ts +11 -0
- package/dist/os/authority/handlers/delegation-validate.d.ts.map +1 -0
- package/dist/os/authority/handlers/delegation-validate.js +132 -0
- package/dist/os/authority/handlers/delegation-validate.js.map +1 -0
- package/dist/os/authority/helpers.d.ts +36 -0
- package/dist/os/authority/helpers.d.ts.map +1 -0
- package/dist/os/authority/helpers.js +83 -0
- package/dist/os/authority/helpers.js.map +1 -0
- package/dist/os/authority/index.d.ts +2 -0
- package/dist/os/authority/index.d.ts.map +1 -0
- package/dist/os/authority/index.js +14 -0
- package/dist/os/authority/index.js.map +1 -0
- package/dist/os/compass/comment-safety.d.ts +83 -0
- package/dist/os/compass/comment-safety.d.ts.map +1 -0
- package/dist/os/compass/comment-safety.js +305 -0
- package/dist/os/compass/comment-safety.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -4
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
- package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
- package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.js +28 -13
- package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
- package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.js +58 -20
- package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +10 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +58 -4
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts +20 -5
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +175 -44
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/compass/index.d.ts +1 -0
- package/dist/os/compass/index.d.ts.map +1 -1
- package/dist/os/compass/index.js +2 -0
- package/dist/os/compass/index.js.map +1 -1
- package/dist/os/compass/policy.d.ts +9 -0
- package/dist/os/compass/policy.d.ts.map +1 -1
- package/dist/os/compass/policy.js +11 -2
- package/dist/os/compass/policy.js.map +1 -1
- package/dist/os/core/core.module.js +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +1 -6
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/queue/types.d.ts +2 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +3 -1
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +51 -1
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +21 -3
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/dna-trace.d.ts +2 -0
- package/dist/os/rfc/dna-trace.d.ts.map +1 -1
- package/dist/os/rfc/dna-trace.js +13 -4
- package/dist/os/rfc/dna-trace.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +594 -81
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +90 -9
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts +17 -0
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
- package/dist/os/rfc/reachable-symbol.js +376 -0
- package/dist/os/rfc/reachable-symbol.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +89 -5
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +89 -12
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +17 -10
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +10 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +175 -10
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +58 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -0
- package/dist/os/rfc/verification-origin.js +346 -0
- package/dist/os/rfc/verification-origin.js.map +1 -0
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +11 -1
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +23 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
- package/dist/os/rfc/verify-workspace.js +278 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -0
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +3 -0
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +41 -10
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +5 -23
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +30 -9
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/workflow/handlers.d.ts +0 -4
- package/dist/os/workflow/handlers.d.ts.map +1 -1
- package/dist/os/workflow/handlers.js +9 -36
- package/dist/os/workflow/handlers.js.map +1 -1
- package/dist/os/workflow/index.d.ts +2 -2
- package/dist/os/workflow/index.d.ts.map +1 -1
- package/dist/os/workflow/index.js +1 -1
- package/dist/os/workflow/index.js.map +1 -1
- package/dist/os/workflow/types.d.ts +0 -19
- package/dist/os/workflow/types.d.ts.map +1 -1
- package/dist/os/workflow/types.js +0 -2
- package/dist/os/workflow/types.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +6 -15
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/authority/delegations.d.ts +108 -0
- package/dist/src/authority/delegations.d.ts.map +1 -0
- package/dist/src/authority/delegations.js +217 -0
- package/dist/src/authority/delegations.js.map +1 -0
- package/dist/src/authority/index.d.ts +3 -0
- package/dist/src/authority/index.d.ts.map +1 -0
- package/dist/src/authority/index.js +17 -0
- package/dist/src/authority/index.js.map +1 -0
- package/dist/src/authority/signing.d.ts +8 -0
- package/dist/src/authority/signing.d.ts.map +1 -0
- package/dist/src/authority/signing.js +72 -0
- package/dist/src/authority/signing.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +5 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +5 -2
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/doctor.js +3 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +2 -2
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/prettierignore.js +1 -1
- package/dist/src/onboarding/upgrade.js +2 -2
- package/dist/src/onboarding/workspace-discovery.js +1 -1
- package/dist/src/profiles/profile-schema.d.ts +2 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +1 -0
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +1 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/types.js.map +1 -1
- package/docs/reference/cli.md +0 -1
- package/docs/reference/programmatic-api.md +1 -1
- package/os/adr/handlers/validate.test.ts +14 -0
- package/os/authority/authority.module.ts +183 -0
- package/os/authority/authority.test.ts +328 -0
- package/os/authority/handlers/delegate-revoke.ts +123 -0
- package/os/authority/handlers/delegate.ts +190 -0
- package/os/authority/handlers/delegation-list.ts +80 -0
- package/os/authority/handlers/delegation-validate.ts +231 -0
- package/os/authority/helpers.ts +111 -0
- package/os/authority/index.ts +14 -0
- package/os/compass/comment-safety.ts +331 -0
- package/os/compass/compass.module.ts +50 -4
- package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
- package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
- package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
- package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
- package/os/compass/handlers/compass-header-scaffold.ts +847 -0
- package/os/compass/handlers/compass-inventory-handler.ts +9 -4
- package/os/compass/handlers/compass-inventory.ts +29 -13
- package/os/compass/handlers/compass-migrate-handler.ts +13 -27
- package/os/compass/handlers/compass-migrate.ts +77 -21
- package/os/compass/handlers/git-revision.ts +59 -4
- package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
- package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
- package/os/compass/handlers/summary-record.ts +194 -41
- package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
- package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
- package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
- package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
- package/os/compass/handlers/tests/summary-record.test.ts +324 -3
- package/os/compass/index.ts +15 -0
- package/os/compass/policy.ts +27 -2
- package/os/core/core.module.ts +1 -1
- package/os/core/handlers/invariant-engine.test.ts +3 -1
- package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
- package/os/core/handlers/note-link-validate.test.ts +6 -1
- package/os/core/handlers/note-orphan-detect.test.ts +6 -1
- package/os/core/handlers/package-health.test.ts +6 -0
- package/os/core/handlers/package-health.ts +1 -6
- package/os/mission/handlers/archive.test.ts +14 -0
- package/os/naming/naming-convention.test.ts +14 -0
- package/os/queue/decision-ledger.test.ts +27 -4
- package/os/queue/queue-validate.test.ts +14 -0
- package/os/queue/types.ts +3 -1
- package/os/rfc/acceptance-reachable.test.ts +146 -0
- package/os/rfc/acceptance.test.ts +25 -0
- package/os/rfc/acceptance.ts +51 -1
- package/os/rfc/decision-log.ts +22 -4
- package/os/rfc/dna-trace.ts +17 -5
- package/os/rfc/frontmatter-io.test.ts +14 -0
- package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
- package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
- package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
- package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
- package/os/rfc/handlers/implement-stamp-stale.test.ts +20 -2
- package/os/rfc/handlers/implement-stamp.ts +714 -87
- package/os/rfc/handlers/lifecycle.test.ts +14 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
- package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
- package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
- package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
- package/os/rfc/handlers/validate-rules.test.ts +14 -0
- package/os/rfc/handlers/validate-rules.ts +122 -13
- package/os/rfc/handlers/validate.test.ts +4 -3
- package/os/rfc/reachable-symbol.ts +441 -0
- package/os/rfc/rfc-0000-template.md +3 -0
- package/os/rfc/rfc-create-concurrent.test.ts +6 -0
- package/os/rfc/rfc-create-hint.test.ts +6 -0
- package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
- package/os/rfc/rfc.module.ts +95 -5
- package/os/rfc/types.ts +116 -12
- package/os/rfc/verification-emit-check.test.ts +14 -0
- package/os/rfc/verification-emit-freshness.test.ts +415 -0
- package/os/rfc/verification-emit.test.ts +14 -0
- package/os/rfc/verification-evidence.ts +230 -10
- package/os/rfc/verification-normalize.test.ts +14 -0
- package/os/rfc/verification-origin.test.ts +236 -0
- package/os/rfc/verification-origin.ts +417 -0
- package/os/rfc/verification-refresh.test.ts +14 -0
- package/os/rfc/verification-refresh.ts +12 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
- package/os/rfc/verify-workspace.test.ts +122 -0
- package/os/rfc/verify-workspace.ts +342 -0
- package/os/session/handlers/metrics-rfc.ts +3 -0
- package/os/session/handlers/save.ts +43 -9
- package/os/spec/spec-status.test.ts +130 -0
- package/os/spec/spec-status.ts +5 -18
- package/os/spec/spec-validate.test.ts +76 -1
- package/os/spec/spec-validate.ts +26 -7
- package/os/workflow/handlers.ts +8 -42
- package/os/workflow/index.ts +1 -4
- package/os/workflow/types.ts +0 -22
- package/os/workflow/workflow.module.ts +6 -16
- package/package.json +13 -1
- package/skills/_shared/agent-operating-model.md +1 -1
- package/skills/_shared/fo-pipeline-conventions.md +1 -0
- package/skills/fo/fo-add-tests/SKILL.md +14 -0
- package/skills/fo/fo-fix/SKILL.md +2 -1
- package/skills/fo/fo-handoff/SKILL.md +1 -1
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
- package/skills/fo/fo-idea-implement/SKILL.md +68 -53
- package/skills/fo/fo-idea-plan/SKILL.md +3 -1
- package/skills/fo/fo-review/SKILL.md +12 -0
- package/skills/fo/fo-session-save/learned-principles.md +13 -0
- package/skills/fo/fo-step-commit/SKILL.md +1 -1
- package/src/authority/delegations.ts +267 -0
- package/src/authority/index.ts +38 -0
- package/src/authority/signing.ts +73 -0
- package/src/bin-entry.test.ts +37 -0
- package/src/compass/contract-registry.test.ts +14 -0
- package/src/compass/types.test.ts +14 -0
- package/src/config/__tests__/resolve-terminology.test.ts +14 -0
- package/src/config/forge-config.test.ts +14 -0
- package/src/config/forge-config.ts +7 -2
- package/src/forge-module.test.ts +14 -0
- package/src/knowledge/__tests__/promote.test.ts +14 -0
- package/src/knowledge/__tests__/serialize.test.ts +14 -0
- package/src/knowledge/__tests__/sync.test.ts +4 -1
- package/src/knowledge/budgets.test.ts +14 -0
- package/src/knowledge/compact.test.ts +14 -0
- package/src/knowledge/parse.test.ts +14 -0
- package/src/knowledge/schema.test.ts +14 -0
- package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
- package/src/migration-adapters/__tests__/registry.test.ts +14 -0
- package/src/migration-adapters/__tests__/types.test.ts +14 -0
- package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
- package/src/onboarding/agents-generate.ts +1 -1
- package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
- package/src/onboarding/create.test.ts +14 -0
- package/src/onboarding/doctor-token-check.test.ts +3 -0
- package/src/onboarding/doctor.test.ts +14 -0
- package/src/onboarding/doctor.ts +3 -3
- package/src/onboarding/init.test.ts +14 -0
- package/src/onboarding/init.ts +2 -2
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/prettierignore.ts +1 -1
- package/src/onboarding/scaffold.test.ts +14 -0
- package/src/onboarding/site-workshop-profile.test.ts +3 -0
- package/src/onboarding/upgrade.test.ts +14 -0
- package/src/onboarding/upgrade.ts +2 -2
- package/src/onboarding/workspace-discovery.ts +1 -1
- package/src/pipeline-status.test.ts +14 -0
- package/src/plugin/forge-plugin-manifest.test.ts +14 -0
- package/src/profiles/__tests__/profile-schema.test.ts +14 -0
- package/src/profiles/__tests__/stack-profile.test.ts +14 -0
- package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
- package/src/profiles/profile-schema.ts +1 -0
- package/src/tests/acceptance-criteria.test.ts +14 -0
- package/src/tests/acceptance-probe-kinds.test.ts +14 -0
- package/src/tests/adr-implement-stamp.test.ts +14 -0
- package/src/tests/agents-generate-domain.test.ts +3 -0
- package/src/tests/agents-generate.test.ts +3 -0
- package/src/tests/bindings-schema.test.ts +2 -0
- package/src/tests/budgets.test.ts +14 -0
- package/src/tests/compact.test.ts +14 -0
- package/src/tests/compass-docs-flag.test.ts +6 -0
- package/src/tests/compass-docs-scaffold.test.ts +6 -0
- package/src/tests/compass-docs-validate-scope.test.ts +6 -0
- package/src/tests/contract-registry.test.ts +14 -0
- package/src/tests/create.test.ts +3 -0
- package/src/tests/discover-pack-skills.test.ts +14 -0
- package/src/tests/doctor-autonomy.test.ts +3 -0
- package/src/tests/doctor-bindings.test.ts +6 -1
- package/src/tests/doctor-dist-freshness.test.ts +26 -2
- package/src/tests/doctor-domain.test.ts +6 -1
- package/src/tests/doctor-fix.test.ts +3 -0
- package/src/tests/doctor-nested-agents.test.ts +3 -0
- package/src/tests/doctor-profile-id-known.test.ts +3 -0
- package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
- package/src/tests/doctor-version-sync.test.ts +4 -1
- package/src/tests/editable-generated-region.test.ts +6 -3
- package/src/tests/exploration-handlers.test.ts +14 -0
- package/src/tests/file-size-lint.test.ts +6 -1
- package/src/tests/forge-autonomy-validate.test.ts +3 -1
- package/src/tests/forge-config.test.ts +6 -1
- package/src/tests/forge-validate-compass-docs.test.ts +6 -0
- package/src/tests/fs-atomic.test.ts +14 -0
- package/src/tests/fs.test.ts +14 -0
- package/src/tests/generated-marker.test.ts +14 -0
- package/src/tests/hash.test.ts +14 -0
- package/src/tests/implement-stamp.test.ts +476 -10
- package/src/tests/init-bindings.test.ts +6 -1
- package/src/tests/knowledge-parse.test.ts +14 -0
- package/src/tests/knowledge-pbt.test.ts +14 -0
- package/src/tests/markdown-table.test.ts +6 -3
- package/src/tests/memory-compact.test.ts +3 -0
- package/src/tests/memory-scaffold.test.ts +6 -1
- package/src/tests/metrics-rfc-1053.test.ts +14 -0
- package/src/tests/migration-adapters.test.ts +3 -0
- package/src/tests/package-files.test.ts +4 -1
- package/src/tests/package-health-lint-surface.test.ts +3 -0
- package/src/tests/pinned-check.test.ts +14 -0
- package/src/tests/pinned-init.test.ts +14 -0
- package/src/tests/pinned-validate.test.ts +14 -0
- package/src/tests/plugin-manifest.test.ts +14 -0
- package/src/tests/prettierignore-manage.test.ts +3 -0
- package/src/tests/profile-schema.test.ts +6 -1
- package/src/tests/profile-validate.test.ts +6 -1
- package/src/tests/program-lease.test.ts +3 -0
- package/src/tests/program-paths-extended.test.ts +3 -0
- package/src/tests/program-paths.test.ts +3 -0
- package/src/tests/program-property.test.ts +3 -0
- package/src/tests/program-schemas.test.ts +3 -0
- package/src/tests/program-spec-node.test.ts +3 -0
- package/src/tests/promote.test.ts +14 -0
- package/src/tests/public-surface.test.ts +6 -1
- package/src/tests/registry.test.ts +14 -0
- package/src/tests/rfc-evidence-sync.test.ts +347 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
- package/src/tests/rfc-validate-delegation.test.ts +178 -0
- package/src/tests/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +79 -0
- package/src/tests/session-pbt.test.ts +14 -0
- package/src/tests/skill-agents-sync.test.ts +3 -4
- package/src/tests/skill-schema.test.ts +14 -0
- package/src/tests/skill-sync-marker.test.ts +3 -0
- package/src/tests/skill-validate-knowledge.test.ts +14 -0
- package/src/tests/skill-validate.test.ts +14 -0
- package/src/tests/stack-profile.test.ts +6 -1
- package/src/tests/string-utils.test.ts +14 -0
- package/src/tests/upgrade.test.ts +6 -1
- package/src/tests/werkstatt-lock.test.ts +14 -0
- package/src/tests/workspace-discovery-domain.test.ts +6 -1
- package/src/tests/workspace-discovery.test.ts +6 -1
- package/src/types.test.ts +14 -0
- package/src/types.ts +30 -1
- package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
- package/src/utils/__tests__/fs-trash.test.ts +17 -0
- package/src/utils/fs-atomic.test.ts +17 -0
- package/src/utils/fs-trash-sync.test.ts +17 -0
- package/src/utils/fs.test.ts +17 -0
- package/src/utils/generated-marker.test.ts +17 -0
- package/src/utils/hash.test.ts +17 -0
- package/src/utils/string-utils.test.ts +17 -0
- package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// RFC-1333 AC-1, AC-2, AC-10, Design step 2/3 — rfc.verify.workspace export.
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
import { buildVerifyWorkspace } from "../../verify-workspace.ts";
|
|
9
|
+
|
|
10
|
+
let repo = "";
|
|
11
|
+
let out = "";
|
|
12
|
+
let removed: string[] = [];
|
|
13
|
+
const git = (...a: string[]) =>
|
|
14
|
+
execFileSync("git", a, {
|
|
15
|
+
cwd: repo,
|
|
16
|
+
encoding: "utf8",
|
|
17
|
+
env: {
|
|
18
|
+
...process.env,
|
|
19
|
+
GIT_AUTHOR_NAME: "t",
|
|
20
|
+
GIT_AUTHOR_EMAIL: "t@t",
|
|
21
|
+
GIT_COMMITTER_NAME: "t",
|
|
22
|
+
GIT_COMMITTER_EMAIL: "t@t",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const put = (rel: string, body: string) => {
|
|
26
|
+
mkdirSync(dirname(join(repo, rel)), { recursive: true });
|
|
27
|
+
writeFileSync(join(repo, rel), body);
|
|
28
|
+
};
|
|
29
|
+
const rfc = (status: string) =>
|
|
30
|
+
`---\nid: RFC-0001\ntitle: "x"\nstatus: ${status}\ncreatedAt: 2026-10-18\n---\n\n## Context\n\nctx\n\n## Problem\n\np\n\n## Decision\n\nd\n\n## Design\n\ndes\n\n## Acceptance criteria\n\n- [ ] AC-1: x\n\n## Implementation notes\n\nSECRET-NARRATIVE\n`;
|
|
31
|
+
|
|
32
|
+
beforeAll(async () => {
|
|
33
|
+
repo = mkdtempSync(join(tmpdir(), "vw-fixture-"));
|
|
34
|
+
git("init", "-q", "-b", "main");
|
|
35
|
+
put("docs/rfcs/rfc-0001-x.md", rfc("draft"));
|
|
36
|
+
put("src/old.test.ts", "// pre-existing\n");
|
|
37
|
+
put("docs/plans/other.md", "unrelated plan\n");
|
|
38
|
+
git("add", "-A");
|
|
39
|
+
git("commit", "-qm", "chore: init");
|
|
40
|
+
put("docs/rfcs/rfc-0001-x.md", rfc("accepted"));
|
|
41
|
+
git("commit", "-qam", "docs: accept");
|
|
42
|
+
put("src/a.ts", "export const a = 1;\n");
|
|
43
|
+
put("src/a.test.ts", "// self test\n");
|
|
44
|
+
put("src/old.test.ts", "// edited by implementer\n");
|
|
45
|
+
put("docs/plans/plan-x.md", "Plan for rfc-0001\n");
|
|
46
|
+
put("docs/reviews/code/r.md", "Review of RFC-0001\n");
|
|
47
|
+
put("docs/sessions/s.md", "session about RFC-0001\n");
|
|
48
|
+
put("docs/rfcs/verification/rfc-0001.generated.yaml", "x: 1\n");
|
|
49
|
+
put("docs/metrics/rfcs/rfc-0001.metrics.yaml", "x: 1\n");
|
|
50
|
+
git("add", "-A");
|
|
51
|
+
git("commit", "-qm", "feat: RFC-0001 impl");
|
|
52
|
+
put("src/v.test.ts", "// verifier\n");
|
|
53
|
+
git("add", "-A");
|
|
54
|
+
git(
|
|
55
|
+
"commit",
|
|
56
|
+
"-qm",
|
|
57
|
+
"test: verifier\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: docs/reviews/acceptance/rfc-0001/a-r0.md",
|
|
58
|
+
);
|
|
59
|
+
const head = git("rev-parse", "HEAD").trim();
|
|
60
|
+
const res = await buildVerifyWorkspace({
|
|
61
|
+
workspaceRoot: repo,
|
|
62
|
+
rfcId: "RFC-0001",
|
|
63
|
+
candidateSha: head,
|
|
64
|
+
});
|
|
65
|
+
expect(res.status).toBe("pass");
|
|
66
|
+
out = res.path!;
|
|
67
|
+
removed = res.removed;
|
|
68
|
+
});
|
|
69
|
+
afterAll(() => {
|
|
70
|
+
rmSync(repo, { recursive: true, force: true });
|
|
71
|
+
if (out) rmSync(out, { recursive: true, force: true });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("RFC-1333 rfc.verify.workspace", () => {
|
|
75
|
+
it("AC-1: self-origin test files are absent", () => {
|
|
76
|
+
expect(existsSync(join(out, "src/a.test.ts"))).toBe(false);
|
|
77
|
+
expect(existsSync(join(out, "src/old.test.ts"))).toBe(false);
|
|
78
|
+
expect(existsSync(join(out, "src/a.ts"))).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
it("AC-1 (design): verifier-trailer test files are kept", () => {
|
|
81
|
+
expect(existsSync(join(out, "src/v.test.ts"))).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
it("AC-2: plan/review/session docs referencing the RFC are absent; unrelated kept", () => {
|
|
84
|
+
expect(existsSync(join(out, "docs/plans/plan-x.md"))).toBe(false);
|
|
85
|
+
expect(existsSync(join(out, "docs/reviews/code/r.md"))).toBe(false);
|
|
86
|
+
expect(existsSync(join(out, "docs/sessions/s.md"))).toBe(false);
|
|
87
|
+
expect(existsSync(join(out, "docs/plans/other.md"))).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
it("design: verification envelope and metrics removed", () => {
|
|
90
|
+
expect(existsSync(join(out, "docs/rfcs/verification/rfc-0001.generated.yaml"))).toBe(false);
|
|
91
|
+
expect(existsSync(join(out, "docs/metrics/rfcs/rfc-0001.metrics.yaml"))).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
it("AC-10: no .git entry", () => {
|
|
94
|
+
expect(existsSync(join(out, ".git"))).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
it("design step 3: bundle carries only normative sections and removed list", () => {
|
|
97
|
+
const b = readFileSync(join(out, "VERIFY-BUNDLE.md"), "utf8");
|
|
98
|
+
for (const h of ["Context", "Problem", "Decision", "Design", "Acceptance criteria"])
|
|
99
|
+
expect(b).toContain(`## ${h}`);
|
|
100
|
+
expect(b).not.toContain("SECRET-NARRATIVE");
|
|
101
|
+
for (const r of removed) expect(b).toContain(`- ${r}`);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1333: rfc.verify.workspace tests — stripped, git-free export of a committed candidate over a temporary git repository.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Do not run a verifier — only the export contract is under test.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1333: tests for AC-1, AC-2, AC-10.</item>
|
|
10
|
+
<item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
|
|
11
|
+
</CHANGE_SUMMARY>
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { execFileSync } from "node:child_process";
|
|
15
|
+
import { existsSync } from "node:fs";
|
|
16
|
+
import * as fs from "node:fs/promises";
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
20
|
+
import { buildVerifyWorkspace } from "./verify-workspace.ts";
|
|
21
|
+
|
|
22
|
+
let root: string;
|
|
23
|
+
let out: string;
|
|
24
|
+
|
|
25
|
+
function git(...args: string[]): string {
|
|
26
|
+
return execFileSync(
|
|
27
|
+
"git",
|
|
28
|
+
["-c", "core.hooksPath=/dev/null", "-c", "user.email=t@t", "-c", "user.name=T", ...args],
|
|
29
|
+
{ cwd: root, encoding: "utf8" },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function commit(message: string, files: Record<string, string>): Promise<string> {
|
|
34
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
35
|
+
await fs.mkdir(path.dirname(path.join(root, rel)), { recursive: true });
|
|
36
|
+
await fs.writeFile(path.join(root, rel), content);
|
|
37
|
+
}
|
|
38
|
+
git("add", "-A");
|
|
39
|
+
git("commit", "-qm", message);
|
|
40
|
+
return git("rev-parse", "HEAD").trim();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const rfc = (status: string) =>
|
|
44
|
+
`---\nid: RFC-9002\ntitle: "Fixture"\nstatus: ${status}\ncreatedAt: 2026-10-18\n---\n\n# RFC-9002: Fixture\n\n## Context\n\nCtx.\n\n## Decision\n\nDecide.\n\n## Risks\n\nInternal only.\n\n## Acceptance criteria\n\n- [ ] AC-1: WHEN x, THE y SHALL z.\n`;
|
|
45
|
+
|
|
46
|
+
let candidate: string;
|
|
47
|
+
|
|
48
|
+
beforeEach(async () => {
|
|
49
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), "verify-ws-"));
|
|
50
|
+
out = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "verify-out-")), "tree");
|
|
51
|
+
git("init", "-q");
|
|
52
|
+
await commit("draft", {
|
|
53
|
+
"docs/rfcs/rfc-9002-fixture.md": rfc("draft"),
|
|
54
|
+
"src/old.test.ts": "it('pre-existing', () => {});\n",
|
|
55
|
+
});
|
|
56
|
+
await commit("accept", { "docs/rfcs/rfc-9002-fixture.md": rfc("accepted") });
|
|
57
|
+
candidate = await commit("RFC-9002: implement", {
|
|
58
|
+
"src/feature.ts": "export const f = 1;\n",
|
|
59
|
+
"src/feature.test.ts": "it('self', () => {});\n",
|
|
60
|
+
"docs/plans/plan-rfc-9002-fixture.md": "# plan for RFC-9002\n",
|
|
61
|
+
"docs/reviews/code/x/review-1.md": "reviews RFC-9002\n",
|
|
62
|
+
"docs/sessions/s.md": "unrelated session\n",
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
afterEach(async () => {
|
|
67
|
+
await fs.rm(root, { recursive: true, force: true });
|
|
68
|
+
await fs.rm(path.dirname(out), { recursive: true, force: true });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("rfc.verify.workspace (RFC-1333)", () => {
|
|
72
|
+
it("omits test files whose derived origin is self from the verifier worktree", async () => {
|
|
73
|
+
const r = await buildVerifyWorkspace({
|
|
74
|
+
workspaceRoot: root,
|
|
75
|
+
rfcId: "RFC-9002",
|
|
76
|
+
candidateSha: candidate,
|
|
77
|
+
outDir: out,
|
|
78
|
+
});
|
|
79
|
+
expect(r.status, r.error).toBe("pass");
|
|
80
|
+
expect(existsSync(path.join(out, "src/feature.test.ts"))).toBe(false);
|
|
81
|
+
expect(existsSync(path.join(out, "src/old.test.ts")), "pre-acceptance tests stay visible").toBe(
|
|
82
|
+
true,
|
|
83
|
+
);
|
|
84
|
+
expect(existsSync(path.join(out, "src/feature.ts"))).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("omits plan, review, and session documents for the RFC from the verifier worktree", async () => {
|
|
88
|
+
const r = await buildVerifyWorkspace({
|
|
89
|
+
workspaceRoot: root,
|
|
90
|
+
rfcId: "RFC-9002",
|
|
91
|
+
candidateSha: candidate,
|
|
92
|
+
outDir: out,
|
|
93
|
+
});
|
|
94
|
+
expect(existsSync(path.join(out, "docs/plans/plan-rfc-9002-fixture.md"))).toBe(false);
|
|
95
|
+
expect(existsSync(path.join(out, "docs/reviews/code/x/review-1.md"))).toBe(false);
|
|
96
|
+
expect(existsSync(path.join(out, "docs/sessions/s.md")), "unrelated docs stay").toBe(true);
|
|
97
|
+
const bundle = await fs.readFile(path.join(out, "VERIFY-BUNDLE.md"), "utf8");
|
|
98
|
+
expect(bundle).toContain("## Decision");
|
|
99
|
+
expect(bundle).not.toContain("## Risks");
|
|
100
|
+
expect(r.removed).toContain("src/feature.test.ts");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("fails without leaving a partial tree for an unknown candidate", async () => {
|
|
104
|
+
const r = await buildVerifyWorkspace({
|
|
105
|
+
workspaceRoot: root,
|
|
106
|
+
rfcId: "RFC-9002",
|
|
107
|
+
candidateSha: "not-a-ref",
|
|
108
|
+
});
|
|
109
|
+
expect(r.status).toBe("fail");
|
|
110
|
+
expect(r.path).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("exports the candidate without git metadata", async () => {
|
|
114
|
+
await buildVerifyWorkspace({
|
|
115
|
+
workspaceRoot: root,
|
|
116
|
+
rfcId: "RFC-9002",
|
|
117
|
+
candidateSha: candidate,
|
|
118
|
+
outDir: out,
|
|
119
|
+
});
|
|
120
|
+
expect(existsSync(path.join(out, ".git"))).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1333: rfc.verify.workspace — export a committed candidate as a plain tree
|
|
5
|
+
(no git metadata) for a clean-context acceptance verifier, stripped of the
|
|
6
|
+
implementer's in-range tests and of the RFC's plan, review, session, and queue
|
|
7
|
+
documents, with a VERIFY-BUNDLE.md carrying only the RFC's normative prose.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not run the verifier — the fo-review acceptance mode does.</item>
|
|
11
|
+
<item>Do not write inside the repository — the export lives under the OS temp dir.</item>
|
|
12
|
+
<item>Do not hide anything cryptographically — the verifier is pointed at the export; isolation is recorded, not enforced.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<KEY_DECISIONS>
|
|
16
|
+
<item>git archive piped into tar, never a worktree: a worktree shares the object database.</item>
|
|
17
|
+
<item>A test file touched in range by any commit without the verifier trailer pair is stripped.</item>
|
|
18
|
+
<item>node_modules (root included) are mirrored entry by entry with workspace links rewritten into the export.</item>
|
|
19
|
+
<item>The candidate resolves to a full commit sha once; a failed export removes its partial tree.</item>
|
|
20
|
+
<item>Directory links are junctions on Windows; path checks use forward slashes.</item>
|
|
21
|
+
</KEY_DECISIONS>
|
|
22
|
+
<CHANGE_SUMMARY>
|
|
23
|
+
<item>RFC-1333: initial implementation — git-free export, self-test and RFC-document stripping, VERIFY-BUNDLE.md.</item>
|
|
24
|
+
<item>RFC-1333: review hardening — piped export, root node_modules mirroring, failure cleanup, sha resolution, Windows links.</item>
|
|
25
|
+
</CHANGE_SUMMARY>
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { spawn } from "node:child_process";
|
|
29
|
+
import { existsSync } from "node:fs";
|
|
30
|
+
import {
|
|
31
|
+
lstat,
|
|
32
|
+
mkdir,
|
|
33
|
+
mkdtemp,
|
|
34
|
+
readdir,
|
|
35
|
+
readFile,
|
|
36
|
+
readlink,
|
|
37
|
+
rm,
|
|
38
|
+
symlink,
|
|
39
|
+
writeFile,
|
|
40
|
+
} from "node:fs/promises";
|
|
41
|
+
import { tmpdir } from "node:os";
|
|
42
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
43
|
+
|
|
44
|
+
import { execFile } from "../../src/utils/sync-fs.ts";
|
|
45
|
+
import { listRfcFiles, readAndParseRfc, rfcFileMatchesId } from "./frontmatter-io.ts";
|
|
46
|
+
import { RFC_DIR } from "./types.ts";
|
|
47
|
+
import {
|
|
48
|
+
createOriginGit,
|
|
49
|
+
gitEnvForCwd,
|
|
50
|
+
hasVerifierTrailers,
|
|
51
|
+
resolveImplementationRange,
|
|
52
|
+
type OriginGit,
|
|
53
|
+
} from "./verification-origin.ts";
|
|
54
|
+
import type {
|
|
55
|
+
ForgeCommandInput,
|
|
56
|
+
ForgeCommandResult,
|
|
57
|
+
ForgeRuntimeContext,
|
|
58
|
+
} from "../../src/types.ts";
|
|
59
|
+
|
|
60
|
+
export interface RfcVerifyWorkspaceResult {
|
|
61
|
+
command: "rfc.verify.workspace";
|
|
62
|
+
status: "pass" | "fail";
|
|
63
|
+
rfcId: string;
|
|
64
|
+
candidateSha: string;
|
|
65
|
+
path: string | null;
|
|
66
|
+
removed: string[];
|
|
67
|
+
error?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const TEST_FILE_RE = /\.(test|spec)\.(ts|tsx|mts|js|mjs)$/;
|
|
71
|
+
const DOC_DIRS = ["docs/plans/", "docs/reviews/", "docs/sessions/", "docs/queues/"];
|
|
72
|
+
const BUNDLE_SECTIONS = ["Context", "Problem", "Decision", "Design", "Acceptance criteria"];
|
|
73
|
+
|
|
74
|
+
const EXPORT_TIMEOUT_MS = 300_000;
|
|
75
|
+
|
|
76
|
+
const toPosix = (p: string): string => p.split(sep).join("/");
|
|
77
|
+
|
|
78
|
+
function run(
|
|
79
|
+
cwd: string,
|
|
80
|
+
cmd: string,
|
|
81
|
+
args: string[],
|
|
82
|
+
): Promise<{ ok: boolean; stdout: string; stderr: string }> {
|
|
83
|
+
return new Promise((done) => {
|
|
84
|
+
execFile(
|
|
85
|
+
cmd,
|
|
86
|
+
args,
|
|
87
|
+
{ cwd, timeout: 120000, maxBuffer: 64 * 1024 * 1024, env: gitEnvForCwd() },
|
|
88
|
+
(err, stdout, stderr) => done({ ok: !err, stdout: String(stdout), stderr: String(stderr) }),
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Test files touched in base..head by at least one commit without the verifier trailer pair. */
|
|
94
|
+
export async function listSelfTestFiles(
|
|
95
|
+
git: OriginGit,
|
|
96
|
+
base: string,
|
|
97
|
+
head: string,
|
|
98
|
+
): Promise<string[]> {
|
|
99
|
+
const out = await git.run([
|
|
100
|
+
"log",
|
|
101
|
+
"--first-parent",
|
|
102
|
+
"-m",
|
|
103
|
+
"--format=%x1e%H%x1f%B%x1f",
|
|
104
|
+
"--name-only",
|
|
105
|
+
`${base}..${head}`,
|
|
106
|
+
]);
|
|
107
|
+
if (!out) return [];
|
|
108
|
+
const self = new Set<string>();
|
|
109
|
+
for (const chunk of out.split("\x1e")) {
|
|
110
|
+
const [, body = "", files = ""] = chunk.split("\x1f");
|
|
111
|
+
if (hasVerifierTrailers(body)) continue;
|
|
112
|
+
for (const f of files.split("\n").map((l) => l.trim())) if (TEST_FILE_RE.test(f)) self.add(f);
|
|
113
|
+
}
|
|
114
|
+
return [...self].sort();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Keep only the normative sections of the RFC body. */
|
|
118
|
+
export function extractBundleSections(body: string): string {
|
|
119
|
+
return body
|
|
120
|
+
.split(/^(?=## )/m)
|
|
121
|
+
.filter((p) => BUNDLE_SECTIONS.some((h) => new RegExp(`^## ${h}\\r?\\n`).test(p)))
|
|
122
|
+
.join("\n")
|
|
123
|
+
.trim();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Directory links use junctions on Windows (no Developer Mode needed). */
|
|
127
|
+
async function linkPath(target: string, dst: string): Promise<void> {
|
|
128
|
+
const isDir = (await lstat(target).catch(() => null))?.isDirectory() ?? true;
|
|
129
|
+
const type = isDir ? (process.platform === "win32" ? "junction" : "dir") : "file";
|
|
130
|
+
await symlink(target, dst, type);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Mirror `<pkg>/node_modules` (root included) entry by entry. A link that
|
|
135
|
+
* resolves inside the repository but outside any node_modules is a workspace
|
|
136
|
+
* link and is rewritten into the export, so siblings run at the candidate.
|
|
137
|
+
*/
|
|
138
|
+
async function mirrorNodeModules(mainRoot: string, outRoot: string, pkgRel: string): Promise<void> {
|
|
139
|
+
const srcDir = join(mainRoot, pkgRel, "node_modules");
|
|
140
|
+
const dstDir = join(outRoot, pkgRel, "node_modules");
|
|
141
|
+
if (!existsSync(srcDir) || existsSync(dstDir)) return;
|
|
142
|
+
await mkdir(dstDir, { recursive: true });
|
|
143
|
+
const link = async (rel: string): Promise<void> => {
|
|
144
|
+
const src = join(srcDir, rel);
|
|
145
|
+
let target = src;
|
|
146
|
+
if ((await lstat(src)).isSymbolicLink()) {
|
|
147
|
+
const resolved = resolve(dirname(src), await readlink(src));
|
|
148
|
+
const inRepo = toPosix(relative(mainRoot, resolved));
|
|
149
|
+
const workspaceLink =
|
|
150
|
+
!inRepo.startsWith("..") &&
|
|
151
|
+
inRepo !== "node_modules" &&
|
|
152
|
+
!inRepo.startsWith("node_modules/") &&
|
|
153
|
+
!inRepo.includes("/node_modules/");
|
|
154
|
+
target = workspaceLink ? join(outRoot, inRepo) : resolved;
|
|
155
|
+
}
|
|
156
|
+
await mkdir(dirname(join(dstDir, rel)), { recursive: true });
|
|
157
|
+
await linkPath(target, join(dstDir, rel));
|
|
158
|
+
};
|
|
159
|
+
for (const name of await readdir(srcDir)) {
|
|
160
|
+
if (name.startsWith("@")) {
|
|
161
|
+
for (const sub of await readdir(join(srcDir, name))) await link(join(name, sub));
|
|
162
|
+
} else {
|
|
163
|
+
await link(name);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** `git archive <sha> | tar -x` through pipes — no temp tarball, no drive-letter paths. */
|
|
169
|
+
function exportTree(workspaceRoot: string, sha: string, out: string): Promise<string | null> {
|
|
170
|
+
const exitOf = (child: ReturnType<typeof spawn>): Promise<number | null> =>
|
|
171
|
+
new Promise((r) => {
|
|
172
|
+
child.on("error", () => r(-1));
|
|
173
|
+
child.on("close", (code) => r(code));
|
|
174
|
+
});
|
|
175
|
+
const archive = spawn("git", ["archive", "--format=tar", sha], {
|
|
176
|
+
cwd: workspaceRoot,
|
|
177
|
+
env: gitEnvForCwd(),
|
|
178
|
+
});
|
|
179
|
+
const tar = spawn("tar", ["-x", "-f", "-"], { cwd: out });
|
|
180
|
+
let err = "";
|
|
181
|
+
archive.stderr?.on("data", (d) => (err += String(d)));
|
|
182
|
+
tar.stderr?.on("data", (d) => (err += String(d)));
|
|
183
|
+
// An early tar exit must surface as a failed export, not an uncaught EPIPE.
|
|
184
|
+
tar.stdin?.on("error", () => {});
|
|
185
|
+
archive.stdout?.on("error", () => {});
|
|
186
|
+
archive.stdout?.pipe(tar.stdin!);
|
|
187
|
+
tar.on("close", (code) => {
|
|
188
|
+
if (code !== 0) archive.kill();
|
|
189
|
+
});
|
|
190
|
+
const timer = setTimeout(() => {
|
|
191
|
+
err += `export timed out after ${EXPORT_TIMEOUT_MS} ms`;
|
|
192
|
+
archive.kill();
|
|
193
|
+
tar.kill();
|
|
194
|
+
}, EXPORT_TIMEOUT_MS);
|
|
195
|
+
// Both processes must exit before the verdict — tar can close first.
|
|
196
|
+
return Promise.all([exitOf(archive), exitOf(tar)]).then(([g, t]) => {
|
|
197
|
+
clearTimeout(timer);
|
|
198
|
+
return g === 0 && t === 0 ? null : err.trim() || `export failed (git ${g}, tar ${t})`;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export async function buildVerifyWorkspace(opts: {
|
|
203
|
+
workspaceRoot: string;
|
|
204
|
+
rfcId: string;
|
|
205
|
+
candidateSha: string;
|
|
206
|
+
outDir?: string;
|
|
207
|
+
}): Promise<RfcVerifyWorkspaceResult> {
|
|
208
|
+
const { workspaceRoot, rfcId } = opts;
|
|
209
|
+
// Resolve once to a full commit sha: a moving branch name must not shift the binding.
|
|
210
|
+
const resolved = (
|
|
211
|
+
await run(workspaceRoot, "git", ["rev-parse", "--verify", `${opts.candidateSha}^{commit}`])
|
|
212
|
+
).stdout.trim();
|
|
213
|
+
const candidateSha = resolved || opts.candidateSha;
|
|
214
|
+
const fail = (error: string): RfcVerifyWorkspaceResult => ({
|
|
215
|
+
command: "rfc.verify.workspace",
|
|
216
|
+
status: "fail",
|
|
217
|
+
rfcId,
|
|
218
|
+
candidateSha,
|
|
219
|
+
path: null,
|
|
220
|
+
removed: [],
|
|
221
|
+
error,
|
|
222
|
+
});
|
|
223
|
+
if (!resolved) return fail(`candidate ${opts.candidateSha} is not a commit`);
|
|
224
|
+
|
|
225
|
+
const rfcDir = join(workspaceRoot, RFC_DIR);
|
|
226
|
+
const fileName = (await listRfcFiles(rfcDir)).find((f) => rfcFileMatchesId(f, rfcId));
|
|
227
|
+
if (!fileName) return fail(`${rfcId} not found`);
|
|
228
|
+
const parsed = await readAndParseRfc(rfcDir, fileName);
|
|
229
|
+
if (!parsed || "error" in parsed) return fail(`${rfcId} unparseable`);
|
|
230
|
+
|
|
231
|
+
const git = createOriginGit(workspaceRoot);
|
|
232
|
+
const rfcRel = toPosix(relative(workspaceRoot, join(rfcDir, fileName)));
|
|
233
|
+
const range = await resolveImplementationRange(git, rfcRel);
|
|
234
|
+
if (!range.base) return fail(`${rfcId} has no status: accepted transition in history`);
|
|
235
|
+
const selfTests = await listSelfTestFiles(git, range.base, candidateSha);
|
|
236
|
+
|
|
237
|
+
const selfCreated = opts.outDir === undefined;
|
|
238
|
+
const out = opts.outDir ?? (await mkdtemp(join(tmpdir(), `rfc-verify-${rfcId.toLowerCase()}-`)));
|
|
239
|
+
let result: RfcVerifyWorkspaceResult;
|
|
240
|
+
try {
|
|
241
|
+
await mkdir(out, { recursive: true });
|
|
242
|
+
const exportError = await exportTree(workspaceRoot, candidateSha, out);
|
|
243
|
+
if (exportError) {
|
|
244
|
+
result = fail(`export failed: ${exportError}`);
|
|
245
|
+
} else {
|
|
246
|
+
const removed: string[] = [];
|
|
247
|
+
const drop = async (rel: string): Promise<void> => {
|
|
248
|
+
if (existsSync(join(out, rel))) {
|
|
249
|
+
await rm(join(out, rel), { recursive: true, force: true });
|
|
250
|
+
removed.push(rel);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
for (const f of selfTests) await drop(f);
|
|
254
|
+
const idRe = new RegExp(`\\b${rfcId}\\b`, "i");
|
|
255
|
+
const tracked = (
|
|
256
|
+
await run(workspaceRoot, "git", ["ls-tree", "-r", "--name-only", candidateSha])
|
|
257
|
+
).stdout.split("\n");
|
|
258
|
+
for (const f of tracked) {
|
|
259
|
+
if (!DOC_DIRS.some((d) => f.startsWith(d))) continue;
|
|
260
|
+
const abs = join(out, f);
|
|
261
|
+
if (existsSync(abs) && (idRe.test(f) || idRe.test(await readFile(abs, "utf8")))) {
|
|
262
|
+
await drop(f);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const slug = rfcId.toLowerCase();
|
|
266
|
+
await drop(`${RFC_DIR}/verification/${slug}.generated.yaml`);
|
|
267
|
+
await drop(`docs/metrics/rfcs/${slug}.metrics.yaml`);
|
|
268
|
+
|
|
269
|
+
await mirrorNodeModules(workspaceRoot, out, ".");
|
|
270
|
+
for (const pj of tracked.filter(
|
|
271
|
+
(f) => f.endsWith("/package.json") && !f.includes("node_modules/"),
|
|
272
|
+
)) {
|
|
273
|
+
await mirrorNodeModules(workspaceRoot, out, dirname(pj));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
await writeFile(
|
|
277
|
+
join(out, "VERIFY-BUNDLE.md"),
|
|
278
|
+
[
|
|
279
|
+
`# Acceptance verification bundle — ${rfcId}`,
|
|
280
|
+
"",
|
|
281
|
+
`Candidate: ${candidateSha}`,
|
|
282
|
+
"",
|
|
283
|
+
"Removed from this tree (exists in the candidate, intentionally hidden):",
|
|
284
|
+
...removed.map((r) => `- ${r}`),
|
|
285
|
+
"",
|
|
286
|
+
extractBundleSections(parsed.parsed.body),
|
|
287
|
+
"",
|
|
288
|
+
].join("\n"),
|
|
289
|
+
);
|
|
290
|
+
result = {
|
|
291
|
+
command: "rfc.verify.workspace",
|
|
292
|
+
status: "pass",
|
|
293
|
+
rfcId,
|
|
294
|
+
candidateSha,
|
|
295
|
+
path: out,
|
|
296
|
+
removed,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
} catch (e) {
|
|
300
|
+
result = fail(e instanceof Error ? e.message : String(e));
|
|
301
|
+
}
|
|
302
|
+
// A failed export must not leave a partial tree behind.
|
|
303
|
+
if (result.status === "fail" && selfCreated) await rm(out, { recursive: true, force: true });
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export async function runRfcVerifyWorkspace(
|
|
308
|
+
input: ForgeCommandInput,
|
|
309
|
+
context: ForgeRuntimeContext,
|
|
310
|
+
): Promise<ForgeCommandResult<RfcVerifyWorkspaceResult>> {
|
|
311
|
+
const rfcId = String(input.flags["id"] ?? "").toUpperCase();
|
|
312
|
+
const candidateSha = String(input.flags["candidate"] ?? "");
|
|
313
|
+
if (!rfcId || !candidateSha) {
|
|
314
|
+
const data: RfcVerifyWorkspaceResult = {
|
|
315
|
+
command: "rfc.verify.workspace",
|
|
316
|
+
status: "fail",
|
|
317
|
+
rfcId,
|
|
318
|
+
candidateSha,
|
|
319
|
+
path: null,
|
|
320
|
+
removed: [],
|
|
321
|
+
error: "--id and --candidate are required",
|
|
322
|
+
};
|
|
323
|
+
return {
|
|
324
|
+
data,
|
|
325
|
+
exitCode: 1,
|
|
326
|
+
summary: "rfc.verify.workspace: --id and --candidate are required",
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const data = await buildVerifyWorkspace({
|
|
330
|
+
workspaceRoot: context.workspaceRoot,
|
|
331
|
+
rfcId,
|
|
332
|
+
candidateSha,
|
|
333
|
+
});
|
|
334
|
+
return {
|
|
335
|
+
data,
|
|
336
|
+
exitCode: data.status === "pass" ? 0 : 1,
|
|
337
|
+
summary:
|
|
338
|
+
data.status === "pass"
|
|
339
|
+
? `rfc.verify.workspace: ${rfcId} at ${candidateSha.slice(0, 9)} → ${data.path} (${data.removed.length} path(s) hidden)`
|
|
340
|
+
: `rfc.verify.workspace: ${data.error}`,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
@@ -13,6 +13,7 @@ Writes to docs/metrics/rfcs/<rfc-id>.metrics.yaml via writeFileAtomic.
|
|
|
13
13
|
</non-goals>
|
|
14
14
|
</MODULE_CONTRACT>
|
|
15
15
|
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1321: getRfcCommits grep hardened — --fixed-strings + --regexp-ignore-case so a lowercase rfcId still finds canonical subjects.</item>
|
|
16
17
|
<item>RFC-1053: initial generateRfcMetrics pure function.</item>
|
|
17
18
|
</CHANGE_SUMMARY>
|
|
18
19
|
*/
|
|
@@ -80,6 +81,8 @@ async function getRfcCommits(workspaceRoot: string, rfcId: string): Promise<GitL
|
|
|
80
81
|
const raw = await execGit(workspaceRoot, [
|
|
81
82
|
"log",
|
|
82
83
|
"--no-merges",
|
|
84
|
+
"--fixed-strings",
|
|
85
|
+
"--regexp-ignore-case",
|
|
83
86
|
`--grep=${rfcId}`,
|
|
84
87
|
`--format=${format}`,
|
|
85
88
|
]);
|
|
@@ -24,6 +24,7 @@ Sweep batch 4: 73 Compass headers on headerless engine files (certification, com
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { ambientIo as fs } from "../../../src/utils/io.ts";
|
|
27
|
+
import { execFile } from "../../../src/utils/sync-fs.ts";
|
|
27
28
|
import path from "node:path";
|
|
28
29
|
import { createHash } from "node:crypto";
|
|
29
30
|
import YAML from "yaml";
|
|
@@ -45,7 +46,9 @@ import {
|
|
|
45
46
|
|
|
46
47
|
const RFC_PATTERN = /\bRFC-\d{4}\b/g;
|
|
47
48
|
const FILE_PATH_PATTERN = /\b(?:packages|docs|services|systems|tools|scripts)\/[^\s"'`<>|]+/g;
|
|
49
|
+
const PATH_EDGE_PUNCTUATION = /[.,;:!?()[\]{}]+$/;
|
|
48
50
|
const COMMIT_HASH_PATTERN = /\b[0-9a-f]{7,40}\b/g;
|
|
51
|
+
const GIT_VERIFY_TIMEOUT_MS = 15_000;
|
|
49
52
|
const COMMAND_PATTERN =
|
|
50
53
|
/\b(?:session|rfc|adr|plan|audit|docs|mission|forge|compass|werkstatt|spec|naming|workflow|bordbuch|sternsystem|release)\.\w+/g;
|
|
51
54
|
|
|
@@ -70,19 +73,50 @@ function extractRfcIds(content: string): string[] {
|
|
|
70
73
|
|
|
71
74
|
function extractFilePaths(content: string): string[] {
|
|
72
75
|
const matches = content.match(FILE_PATH_PATTERN);
|
|
73
|
-
|
|
76
|
+
if (!matches) return [];
|
|
77
|
+
// Strip sentence punctuation clinging to path tokens in enumerated prose
|
|
78
|
+
// ("docs/foo.md:", "docs/foo/,") before accepting the token.
|
|
79
|
+
const cleaned = matches
|
|
80
|
+
.map((m) => m.replace(PATH_EDGE_PUNCTUATION, ""))
|
|
81
|
+
.filter((m) => m.includes("/"));
|
|
82
|
+
return [...new Set(cleaned)];
|
|
74
83
|
}
|
|
75
84
|
|
|
76
|
-
function extractCommitHashes(content: string): string[] {
|
|
85
|
+
async function extractCommitHashes(content: string, cwd: string): Promise<string[]> {
|
|
77
86
|
const matches = content.match(COMMIT_HASH_PATTERN);
|
|
78
87
|
if (!matches) return [];
|
|
79
88
|
// Filter to plausible git hashes (7-40 hex chars, but exclude pure version numbers)
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
const candidates = [...new Set(matches.filter((h) => !/^\d+$/.test(h) || h.length > 8))];
|
|
90
|
+
if (candidates.length === 0) return [];
|
|
91
|
+
|
|
92
|
+
// A hex token is recorded as a commit only when it resolves to a commit
|
|
93
|
+
// object in the workspace repository — random hex ids (approval ids,
|
|
94
|
+
// checksums, foreign-repo shas) are dropped rather than claimed.
|
|
95
|
+
const verified = new Set<string>();
|
|
96
|
+
try {
|
|
97
|
+
const stdout = await new Promise<string>((resolvePromise, rejectPromise) => {
|
|
98
|
+
const child = execFile(
|
|
99
|
+
"git",
|
|
100
|
+
["cat-file", "--batch-check"],
|
|
101
|
+
{ cwd, timeout: GIT_VERIFY_TIMEOUT_MS, encoding: "utf8" },
|
|
102
|
+
(err, out) => (err ? rejectPromise(err) : resolvePromise(out)),
|
|
103
|
+
);
|
|
104
|
+
// The child may exit before draining stdin (e.g. not a git repo —
|
|
105
|
+
// cat-file fails fast and the pipe closes mid-write → EPIPE). The
|
|
106
|
+
// execFile callback carries the real outcome; stdin errors are noise.
|
|
107
|
+
child.stdin?.on("error", () => {});
|
|
108
|
+
child.stdin?.end(candidates.map((c) => `${c}^{commit}`).join("\n") + "\n");
|
|
109
|
+
});
|
|
110
|
+
// One answer line per input, in order: `<sha> commit <size>` when the
|
|
111
|
+
// candidate resolves to a commit, `<input>^{commit} missing` otherwise.
|
|
112
|
+
const lines = stdout.split("\n");
|
|
113
|
+
candidates.forEach((candidate, i) => {
|
|
114
|
+
if (lines[i]?.split(/\s+/)[1] === "commit") verified.add(candidate);
|
|
115
|
+
});
|
|
116
|
+
} catch {
|
|
117
|
+
// Not a git repository or git unavailable — no candidate is verifiable.
|
|
118
|
+
}
|
|
119
|
+
return [...verified];
|
|
86
120
|
}
|
|
87
121
|
|
|
88
122
|
function extractCommands(content: string): string[] {
|
|
@@ -272,7 +306,7 @@ export async function runSessionSave(
|
|
|
272
306
|
const fullContent = rawContent;
|
|
273
307
|
const relatedRfcs = extractRfcIds(fullContent);
|
|
274
308
|
const relatedArtifacts = extractFilePaths(fullContent);
|
|
275
|
-
const commits = extractCommitHashes(fullContent);
|
|
309
|
+
const commits = await extractCommitHashes(fullContent, workspaceRoot);
|
|
276
310
|
const files = extractFilePaths(fullContent);
|
|
277
311
|
const commands = extractCommands(fullContent);
|
|
278
312
|
const types = detectSessionTypes(fullContent);
|