@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
|
@@ -15,14 +15,12 @@ items to CHANGE_SUMMARY blocks per RFC-1095. Collapses the 5-item window into
|
|
|
15
15
|
<item>Item text is sanitized on record — literal Compass tags would corrupt history parsing.</item>
|
|
16
16
|
</KEY_DECISIONS>
|
|
17
17
|
<CHANGE_SUMMARY>
|
|
18
|
-
<item>RFC-1097: AC-4 banned literal in os/compass handlers
|
|
19
|
-
|
|
20
|
-
compass-migrate-handler hint used a consumer-specific run command — switched to generic 'pnpm exec forge run' convention. Reworded recorded CHANGE_SUMMARY items in 3 handlers to drop the consumer-specific literal. compass-policy AC-4 test green (65/65).</item>
|
|
21
|
-
<item>RFC-1220: step 2 — fail-closed guards in history paths</item>
|
|
22
|
-
<item>RFC-1233: stripGitTrailers at the record point + sanitizeItemText star-slash guard — commit-message trailers (Token: value / Token #value, plus markdown-link attribution lines like "Generated with [X](url)") no longer pollute injected items.</item>
|
|
23
|
-
<item>Session-retro 2026-10-08: id-in-diff dedup — auto-inject skips when the worktree diff already carries a same-ID item (HEAD-vs-worktree via git show HEAD:path), closing the descriptive+generic duplicate class seen on RFC-1237.</item>
|
|
24
18
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
25
|
-
<
|
|
19
|
+
<item>RFC-1323: authored text asserts COMPASS-CS-08 via comment-safety; --injected text neutralizes style-aware and reports neutralized; getLineCommentPrefix/HEADER_SCAN_LINES moved to os/compass/comment-safety.ts.</item>
|
|
20
|
+
<item>RFC-1323: review pass — still-open enclosing-style detection, per-file pre-pass parity, scaffold never-throws, docs.scaffold raw-leaf assert, trim per-file skip, CS-08 always-error severity</item>
|
|
21
|
+
<item>RFC-1323: re-review pass — frontmatter-zone enclosing-style detection, existing-item pre-pass gating, trim exit-1 on unsafe, nextSteps rule labels, severity/census test coverage</item>
|
|
22
|
+
<item>RFC-1323: final review nits — existing-item ordering, fail enum convention, trim skippedUnsafe coverage</item>
|
|
23
|
+
<history>CONTRACT-02, PURPOSE-02, RFC-1095, RFC-1097, RFC-1220, RFC-1233</history>
|
|
26
24
|
</CHANGE_SUMMARY>
|
|
27
25
|
*/
|
|
28
26
|
|
|
@@ -30,6 +28,16 @@ import { execFile, existsSync } from "../../../src/utils/sync-fs.ts";
|
|
|
30
28
|
import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
|
|
31
29
|
|
|
32
30
|
import { resolve, relative } from "node:path";
|
|
31
|
+
import {
|
|
32
|
+
HEADER_SCAN_LINES,
|
|
33
|
+
commentStyleFor,
|
|
34
|
+
enclosingCommentStyle,
|
|
35
|
+
getLineCommentPrefix,
|
|
36
|
+
assertCompassCommentSafe,
|
|
37
|
+
neutralizeCompassText,
|
|
38
|
+
CompassCommentSafetyError,
|
|
39
|
+
type CommentStyle,
|
|
40
|
+
} from "../comment-safety.ts";
|
|
33
41
|
import { detectRiskClass, getWorkspaceRelativeSegments } from "./compass-inventory.ts";
|
|
34
42
|
import { parseGovernanceIdParts, resolveCompassPolicy, type CompassPolicy } from "../policy.ts";
|
|
35
43
|
import { resolveCompassScanRoot } from "./resolve-scan-root.ts";
|
|
@@ -51,10 +59,8 @@ const CONVENTIONAL_PREFIX_RE = /^[a-z]+(\([^)]*\))?!?:\s*/i;
|
|
|
51
59
|
|
|
52
60
|
export const CHANGE_SUMMARY_WINDOW = 5;
|
|
53
61
|
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// fenced doc sections, not headers.
|
|
57
|
-
const HEADER_SCAN_LINES = 120;
|
|
62
|
+
// HEADER_SCAN_LINES now lives in ../comment-safety.ts (RFC-1323) — imported
|
|
63
|
+
// above; it bounds both this writer's header guard and the CS-08 scan.
|
|
58
64
|
|
|
59
65
|
export interface SummaryRecordInput {
|
|
60
66
|
id: string;
|
|
@@ -72,6 +78,8 @@ export interface SummaryRecordResult {
|
|
|
72
78
|
collapsed: string[];
|
|
73
79
|
skipped: Array<{ file: string; reason: SummaryRecordSkipReason }>;
|
|
74
80
|
keyDecisionsReminders: string[];
|
|
81
|
+
/** RFC-1323: files whose injected item text was terminator-neutralized. */
|
|
82
|
+
neutralized: string[];
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
interface ParsedChangeSummary {
|
|
@@ -131,17 +139,28 @@ export function mergeHistoryIds(
|
|
|
131
139
|
return [...parseable, ...unparseable];
|
|
132
140
|
}
|
|
133
141
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
142
|
+
// getLineCommentPrefix moved to ../comment-safety.ts (RFC-1323) — re-exported
|
|
143
|
+
// here so existing deep-import consumers keep working.
|
|
144
|
+
export { getLineCommentPrefix } from "../comment-safety.ts";
|
|
139
145
|
|
|
140
146
|
export function buildChangeSummaryBlock(
|
|
141
147
|
items: string[],
|
|
142
148
|
historyIds: string[],
|
|
143
149
|
filePath: string,
|
|
150
|
+
style?: CommentStyle,
|
|
144
151
|
): string {
|
|
152
|
+
// RFC-1323: emission-time guard — item text must not carry the host style's
|
|
153
|
+
// comment terminator. Callers either asserted (authored) or neutralized
|
|
154
|
+
// (injected) upstream; this assert is the uniform seam for every emitter.
|
|
155
|
+
// `style` defaults to the extension guess — callers editing an existing
|
|
156
|
+
// header should pass enclosingCommentStyle's detection instead.
|
|
157
|
+
const effectiveStyle = style ?? commentStyleFor(filePath);
|
|
158
|
+
for (const item of items) {
|
|
159
|
+
assertCompassCommentSafe(item, effectiveStyle, {
|
|
160
|
+
file: filePath,
|
|
161
|
+
block: "CHANGE_SUMMARY",
|
|
162
|
+
});
|
|
163
|
+
}
|
|
145
164
|
const prefix = getLineCommentPrefix(filePath);
|
|
146
165
|
const lines = ["<CHANGE_SUMMARY>"];
|
|
147
166
|
for (const item of items) {
|
|
@@ -169,6 +188,9 @@ export function stripConventionalPrefix(subject: string): string {
|
|
|
169
188
|
// tail is prose.
|
|
170
189
|
const TRAILER_LINE_RE = /^[A-Za-z0-9-]+(:| #)\s*.*$/;
|
|
171
190
|
const MARKDOWN_LINK_TAIL_RE = /^.*\[[^\]]*\]\([^)]+\)\s*$/;
|
|
191
|
+
// A governed subject ("RFC-1331: …", "ADR-0110: …") matches the trailer shape;
|
|
192
|
+
// trailer tokens never end in a numeric id segment.
|
|
193
|
+
const GOVERNED_SUBJECT_RE = /^[A-Z][A-Z0-9]*-\d+:\s/i;
|
|
172
194
|
|
|
173
195
|
/**
|
|
174
196
|
* Remove a trailing git-trailer block: the contiguous tail of strict
|
|
@@ -193,6 +215,9 @@ export function stripGitTrailers(message: string): string {
|
|
|
193
215
|
}
|
|
194
216
|
}
|
|
195
217
|
if (!sawStrict || start === lines.length) return message;
|
|
218
|
+
// A trailer block is a paragraph after the subject: the subject line itself
|
|
219
|
+
// (e.g. "RFC-1331: steps 1-2") matches the trailer shape and must survive.
|
|
220
|
+
if (start === 0 && GOVERNED_SUBJECT_RE.test(lines[0]!.trim())) return message;
|
|
196
221
|
return lines.slice(0, start).join("\n").trimEnd();
|
|
197
222
|
}
|
|
198
223
|
|
|
@@ -202,15 +227,18 @@ export function stripGitTrailers(message: string): string {
|
|
|
202
227
|
const COMPASS_TAG_LITERAL_RE =
|
|
203
228
|
/<\/?(?:CHANGE_SUMMARY|MODULE_CONTRACT|KEY_DECISIONS|history|item|purpose|non-goals)>/g;
|
|
204
229
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
230
|
+
/**
|
|
231
|
+
* RFC-1233 tag-strip stays here; the terminator rewrite delegates to
|
|
232
|
+
* neutralizeCompassText (RFC-1323) — style-aware, so a star-slash inside an
|
|
233
|
+
* html- or line-style header stays literal (it is not a terminator there).
|
|
234
|
+
* Returns the neutralization flag so injected paths can report it.
|
|
235
|
+
*/
|
|
236
|
+
export function sanitizeItemText(
|
|
237
|
+
text: string,
|
|
238
|
+
style: CommentStyle,
|
|
239
|
+
): { text: string; neutralized: boolean } {
|
|
240
|
+
const tagStripped = text.replace(COMPASS_TAG_LITERAL_RE, (tag) => tag.replace(/[<>]/g, ""));
|
|
241
|
+
return neutralizeCompassText(tagStripped, style);
|
|
214
242
|
}
|
|
215
243
|
|
|
216
244
|
export function isValidGovernanceId(id: string, policy: CompassPolicy): boolean {
|
|
@@ -221,6 +249,8 @@ interface RecordOutcome {
|
|
|
221
249
|
recorded: boolean;
|
|
222
250
|
collapsed: boolean;
|
|
223
251
|
skipReason?: SummaryRecordSkipReason;
|
|
252
|
+
/** RFC-1323: the item text carried a comment terminator and was neutralized. */
|
|
253
|
+
neutralized?: boolean;
|
|
224
254
|
}
|
|
225
255
|
|
|
226
256
|
/**
|
|
@@ -228,6 +258,8 @@ interface RecordOutcome {
|
|
|
228
258
|
* Returns the outcome; writes the file only when mutated and not dry-run.
|
|
229
259
|
* `headSource` is the file's content at HEAD (when resolvable) — it enables
|
|
230
260
|
* the id-in-diff dedup; pass undefined outside git workspaces.
|
|
261
|
+
* `injected` marks machine-piped free text (commit messages): it is
|
|
262
|
+
* neutralized instead of rejected; authored text throws COMPASS-CS-08.
|
|
231
263
|
*/
|
|
232
264
|
export async function recordSummaryItem(
|
|
233
265
|
absPath: string,
|
|
@@ -237,6 +269,8 @@ export async function recordSummaryItem(
|
|
|
237
269
|
dryRun: boolean,
|
|
238
270
|
policy: CompassPolicy,
|
|
239
271
|
headSource?: string,
|
|
272
|
+
addedItemIds?: ReadonlySet<string>,
|
|
273
|
+
injected = false,
|
|
240
274
|
): Promise<RecordOutcome> {
|
|
241
275
|
const source = await io.readFile(absPath);
|
|
242
276
|
const blockMatch = source.match(CHANGE_SUMMARY_BLOCK_RE);
|
|
@@ -261,25 +295,42 @@ export async function recordSummaryItem(
|
|
|
261
295
|
const strippedText = text.startsWith(id)
|
|
262
296
|
? text.slice(id.length).replace(/^\s*[:—-]?\s*/, "")
|
|
263
297
|
: text;
|
|
264
|
-
|
|
298
|
+
// RFC-1323: authored text asserts (rewordable — a silent rewrite would
|
|
299
|
+
// obscure intent); injected text neutralizes and reports the flag. The
|
|
300
|
+
// style is detected from the comment actually enclosing the block — for
|
|
301
|
+
// .astro that can differ from the extension guess.
|
|
302
|
+
const style = enclosingCommentStyle(source, blockMatch.index!, relPath);
|
|
303
|
+
if (!injected) {
|
|
304
|
+
assertCompassCommentSafe(strippedText, style, { file: relPath, block: "CHANGE_SUMMARY" });
|
|
305
|
+
}
|
|
306
|
+
const { text: safeText, neutralized } = sanitizeItemText(strippedText, style);
|
|
307
|
+
const newItem = strippedText.length > 0 ? `${id}: ${safeText}` : id;
|
|
265
308
|
const normalizedNew = normalizeItemText(newItem);
|
|
266
309
|
if (items.some((item) => normalizeItemText(item) === normalizedNew)) {
|
|
267
310
|
return { recorded: false, collapsed: false, skipReason: "duplicate" };
|
|
268
311
|
}
|
|
269
312
|
|
|
270
|
-
// A same-ID item
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
// RFC-
|
|
275
|
-
//
|
|
313
|
+
// A same-ID item the pending diff ADDS means the change already carries a
|
|
314
|
+
// hand-authored record for this governance ID — the auto-injected
|
|
315
|
+
// subject-derived item would duplicate it at lower specificity (observed
|
|
316
|
+
// 2026-10-08: 27 files carried descriptive + generic RFC-1237 items).
|
|
317
|
+
// RFC-1315: the suppression consults the diff's added lines, so it fires
|
|
318
|
+
// even when HEAD already carries a same-ID item — consecutive commits
|
|
319
|
+
// under one RFC still stack when the diff adds none.
|
|
276
320
|
if (headSource !== undefined) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
321
|
+
if (addedItemIds !== undefined) {
|
|
322
|
+
if (addedItemIds.has(id)) {
|
|
323
|
+
return { recorded: false, collapsed: false, skipReason: "id-in-diff" };
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
// git diff unavailable — presence-check fallback (pre-RFC-1315 shape).
|
|
327
|
+
const headBlock = headSource.match(CHANGE_SUMMARY_BLOCK_RE);
|
|
328
|
+
const headItems = headBlock ? parseChangeSummary(headBlock[0]).items : [];
|
|
329
|
+
const idInWorktree = items.some((item) => leadingGovernanceId(item, policy) === id);
|
|
330
|
+
const idInHead = headItems.some((item) => leadingGovernanceId(item, policy) === id);
|
|
331
|
+
if (idInWorktree && !idInHead) {
|
|
332
|
+
return { recorded: false, collapsed: false, skipReason: "id-in-diff" };
|
|
333
|
+
}
|
|
283
334
|
}
|
|
284
335
|
}
|
|
285
336
|
|
|
@@ -293,12 +344,12 @@ export async function recordSummaryItem(
|
|
|
293
344
|
const collapsed = collapsedIds.length > 0;
|
|
294
345
|
const nextHistory = mergeHistoryIds(historyIds, collapsedIds, policy);
|
|
295
346
|
|
|
296
|
-
const newBlock = buildChangeSummaryBlock(nextItems, nextHistory, relPath);
|
|
347
|
+
const newBlock = buildChangeSummaryBlock(nextItems, nextHistory, relPath, style);
|
|
297
348
|
const transformed = source.replace(CHANGE_SUMMARY_BLOCK_RE, newBlock);
|
|
298
349
|
if (!dryRun && transformed !== source) {
|
|
299
350
|
await writeFileIfChanged(absPath, transformed);
|
|
300
351
|
}
|
|
301
|
-
return { recorded: true, collapsed };
|
|
352
|
+
return { recorded: true, collapsed, ...(neutralized ? { neutralized } : {}) };
|
|
302
353
|
}
|
|
303
354
|
|
|
304
355
|
function execGit(cwd: string, args: string[]): Promise<string | null> {
|
|
@@ -322,6 +373,38 @@ async function readHeadSource(gitTop: string | null, absPath: string): Promise<s
|
|
|
322
373
|
return source ?? undefined;
|
|
323
374
|
}
|
|
324
375
|
|
|
376
|
+
/**
|
|
377
|
+
* Governance IDs carried by `<item>` elements on lines the pending diff
|
|
378
|
+
* ADDS to `path` (`git diff -U0 HEAD -- <path>` — `+` lines only; removals
|
|
379
|
+
* and zero-context output never feed the set, so removals don't suppress).
|
|
380
|
+
* RFC-1315: the id-in-diff dedup consults this set — a hand-authored
|
|
381
|
+
* same-ID item suppresses injection even when HEAD already carries the ID.
|
|
382
|
+
* Added lines are joined before matching so multi-line `<item>` elements
|
|
383
|
+
* still yield their leading ID. Returns undefined when git is unavailable.
|
|
384
|
+
*/
|
|
385
|
+
async function readDiffAddedItemIds(
|
|
386
|
+
gitTop: string | null,
|
|
387
|
+
absPath: string,
|
|
388
|
+
policy: CompassPolicy,
|
|
389
|
+
): Promise<ReadonlySet<string> | undefined> {
|
|
390
|
+
if (!gitTop) return undefined;
|
|
391
|
+
const rel = relative(gitTop, absPath).replace(/\\/g, "/");
|
|
392
|
+
if (rel === "" || rel.startsWith("..")) return undefined;
|
|
393
|
+
const diff = await execGit(gitTop, ["diff", "-U0", "HEAD", "--", rel]);
|
|
394
|
+
if (diff === null) return undefined;
|
|
395
|
+
const added = diff
|
|
396
|
+
.split("\n")
|
|
397
|
+
.filter((line) => line.startsWith("+") && !line.startsWith("+++"))
|
|
398
|
+
.map((line) => line.slice(1))
|
|
399
|
+
.join("\n");
|
|
400
|
+
const ids = new Set<string>();
|
|
401
|
+
for (const m of added.matchAll(new RegExp(ITEM_RE.source, "g"))) {
|
|
402
|
+
const itemId = leadingGovernanceId(m[1]!.trim(), policy);
|
|
403
|
+
if (itemId) ids.add(itemId);
|
|
404
|
+
}
|
|
405
|
+
return ids;
|
|
406
|
+
}
|
|
407
|
+
|
|
325
408
|
function riskReminderNeeded(relPath: string, source: string, policy: CompassPolicy): boolean {
|
|
326
409
|
const segments = relPath.split("/").filter(Boolean);
|
|
327
410
|
const workspaceRel = getWorkspaceRelativeSegments(segments, policy).join("/");
|
|
@@ -358,6 +441,61 @@ export async function runCompassSummaryRecord(
|
|
|
358
441
|
// ecosystem.commit and mission.git.commit both pipe the raw message here.
|
|
359
442
|
const stripped = typeof rawText === "string" ? stripGitTrailers(rawText).trim() : "";
|
|
360
443
|
const text = stripped.length > 0 ? stripped : id;
|
|
444
|
+
// RFC-1323: commit integrations pass --injected to mark piped free text —
|
|
445
|
+
// neutralized, not rejected. Authored --text asserts per target style.
|
|
446
|
+
const injected = input.flags["injected"] === true;
|
|
447
|
+
|
|
448
|
+
// Fail BEFORE any file write: gate every target together. The style is
|
|
449
|
+
// resolved exactly the way the write loop resolves it (the comment
|
|
450
|
+
// actually enclosing the block) — `.astro` files can carry an html header
|
|
451
|
+
// the extension table does not predict, and guessing would diverge the
|
|
452
|
+
// up-front gate from the per-file assert mid-loop. Two surfaces gate here:
|
|
453
|
+
// the new text (authored only — injected text is neutralized, not gated)
|
|
454
|
+
// and every EXISTING item, which `buildChangeSummaryBlock` re-emits and
|
|
455
|
+
// asserts — a pre-corrupted item must abort before the first write, not
|
|
456
|
+
// mid-batch after earlier files already landed.
|
|
457
|
+
for (const file of files) {
|
|
458
|
+
const absPath = resolve(baseRoot, file);
|
|
459
|
+
const rel = relative(baseRoot, absPath).replace(/\\/g, "/");
|
|
460
|
+
let style: CommentStyle | null = null;
|
|
461
|
+
let existing: string[] = [];
|
|
462
|
+
try {
|
|
463
|
+
const source = await io.readFile(absPath);
|
|
464
|
+
const blockMatch = source.match(CHANGE_SUMMARY_BLOCK_RE);
|
|
465
|
+
const inHeaderRegion =
|
|
466
|
+
blockMatch !== null &&
|
|
467
|
+
blockMatch.index !== undefined &&
|
|
468
|
+
source.slice(0, blockMatch.index).split("\n").length <= HEADER_SCAN_LINES;
|
|
469
|
+
if (inHeaderRegion) {
|
|
470
|
+
existing = parseChangeSummary(blockMatch![0]).items;
|
|
471
|
+
style = enclosingCommentStyle(source, blockMatch.index!, rel);
|
|
472
|
+
}
|
|
473
|
+
} catch {
|
|
474
|
+
// Unreadable or block-less targets are skipped by the write loop —
|
|
475
|
+
// nothing lands in a comment, so nothing needs gating here.
|
|
476
|
+
}
|
|
477
|
+
if (style === null) continue;
|
|
478
|
+
try {
|
|
479
|
+
for (const item of existing) {
|
|
480
|
+
assertCompassCommentSafe(item, style, {
|
|
481
|
+
file: rel,
|
|
482
|
+
block: "CHANGE_SUMMARY",
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
if (!injected) {
|
|
486
|
+
assertCompassCommentSafe(text, style, {
|
|
487
|
+
file: rel,
|
|
488
|
+
block: "CHANGE_SUMMARY",
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
} catch (err) {
|
|
492
|
+
if (err instanceof CompassCommentSafetyError) {
|
|
493
|
+
context.logger.error(`[compass.summary.record] ${err.message}\n ${err.fixHint}`);
|
|
494
|
+
return { exitCode: 1, summary: `COMPASS-CS-08: ${err.message}` };
|
|
495
|
+
}
|
|
496
|
+
throw err;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
361
499
|
|
|
362
500
|
const result: SummaryRecordResult = {
|
|
363
501
|
command: "compass.summary.record",
|
|
@@ -366,6 +504,7 @@ export async function runCompassSummaryRecord(
|
|
|
366
504
|
collapsed: [],
|
|
367
505
|
skipped: [],
|
|
368
506
|
keyDecisionsReminders: [],
|
|
507
|
+
neutralized: [],
|
|
369
508
|
};
|
|
370
509
|
|
|
371
510
|
const gitTopRaw = await execGit(baseRoot, ["rev-parse", "--show-toplevel"]);
|
|
@@ -381,6 +520,8 @@ export async function runCompassSummaryRecord(
|
|
|
381
520
|
}
|
|
382
521
|
try {
|
|
383
522
|
const headSource = await readHeadSource(gitTop, absPath);
|
|
523
|
+
const addedItemIds =
|
|
524
|
+
headSource !== undefined ? await readDiffAddedItemIds(gitTop, absPath, policy) : undefined;
|
|
384
525
|
const outcome = await recordSummaryItem(
|
|
385
526
|
absPath,
|
|
386
527
|
relPath,
|
|
@@ -389,6 +530,8 @@ export async function runCompassSummaryRecord(
|
|
|
389
530
|
context.dryRun,
|
|
390
531
|
policy,
|
|
391
532
|
headSource,
|
|
533
|
+
addedItemIds,
|
|
534
|
+
injected,
|
|
392
535
|
);
|
|
393
536
|
if (outcome.skipReason) {
|
|
394
537
|
result.skipped.push({ file, reason: outcome.skipReason });
|
|
@@ -397,6 +540,7 @@ export async function runCompassSummaryRecord(
|
|
|
397
540
|
if (outcome.recorded) {
|
|
398
541
|
result.recorded.push(relPath);
|
|
399
542
|
if (outcome.collapsed) result.collapsed.push(relPath);
|
|
543
|
+
if (outcome.neutralized) result.neutralized.push(relPath);
|
|
400
544
|
const source = await io.readFile(absPath);
|
|
401
545
|
if (riskReminderNeeded(relPath, source, policy)) {
|
|
402
546
|
result.keyDecisionsReminders.push(relPath);
|
|
@@ -404,6 +548,11 @@ export async function runCompassSummaryRecord(
|
|
|
404
548
|
}
|
|
405
549
|
}
|
|
406
550
|
} catch (err) {
|
|
551
|
+
// CS-08 is fail-closed, not a per-file skip — abort the whole record.
|
|
552
|
+
if (err instanceof CompassCommentSafetyError) {
|
|
553
|
+
context.logger.error(`[compass.summary.record] ${err.message}\n ${err.fixHint}`);
|
|
554
|
+
return { exitCode: 1, summary: `COMPASS-CS-08: ${err.message}` };
|
|
555
|
+
}
|
|
407
556
|
result.skipped.push({ file, reason: "unparseable" });
|
|
408
557
|
context.logger.warn(
|
|
409
558
|
`[compass.summary.record] skipped ${file}: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -414,6 +563,10 @@ export async function runCompassSummaryRecord(
|
|
|
414
563
|
return {
|
|
415
564
|
data: result,
|
|
416
565
|
exitCode: 0,
|
|
417
|
-
summary:
|
|
566
|
+
summary:
|
|
567
|
+
`[compass.summary.record] recorded=${result.recorded.length}, collapsed=${result.collapsed.length}, skipped=${result.skipped.length}` +
|
|
568
|
+
(result.neutralized.length > 0
|
|
569
|
+
? `, neutralized=${result.neutralized.length} (${result.neutralized.join(", ")})`
|
|
570
|
+
: ""),
|
|
418
571
|
};
|
|
419
572
|
}
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
(missions/, gitignored) in its due work-order items and must report the
|
|
6
6
|
skippedIneligible count.
|
|
7
7
|
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
10
|
+
</non-goals>
|
|
8
11
|
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1311: Compass header sweep — declares the compass suite's contract for test-file scaffold coverage.</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
9
15
|
*/
|
|
10
16
|
|
|
11
17
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
gitignored) still writes the entry (operator intent wins) but emits a
|
|
6
6
|
warning that the next baseline run will sweep it.
|
|
7
7
|
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
10
|
+
</non-goals>
|
|
8
11
|
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1311: Compass header sweep — declares the compass suite's contract for test-file scaffold coverage.</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
9
15
|
*/
|
|
10
16
|
|
|
11
17
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
report skippedIneligible/skippedPaths diagnostics, and still flag eligible
|
|
7
7
|
authored files that have no ledger entry.
|
|
8
8
|
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
11
|
+
</non-goals>
|
|
9
12
|
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1311: Compass header sweep — declares the compass suite's contract for test-file scaffold coverage.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
10
16
|
*/
|
|
11
17
|
|
|
12
18
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for the compass.summary.trim handler — CS-08 unsafe-text skip
|
|
5
|
+
semantics (exit 1, bytes untouched, skippedUnsafe channel) and the clean
|
|
6
|
+
over-cap collapse control case against .astro html-enclosed fixtures.
|
|
7
|
+
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Fixture Compass markup is built via string concatenation so source-level validators never see literal forbidden tags — do not inline real tag literals.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1323: trim skippedUnsafe coverage — unsafe fixture exits 1 with bytes untouched, clean over-cap fixture collapses.</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
18
|
+
import { mkdtemp, mkdir, writeFile, readFile, rm } from "node:fs/promises";
|
|
19
|
+
import { tmpdir } from "node:os";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { runCompassSummaryTrim } from "../compass-change-summary-handler.ts";
|
|
22
|
+
import type { ForgeRuntimeContext } from "../../../../src/types.ts";
|
|
23
|
+
|
|
24
|
+
const logger = {
|
|
25
|
+
section() {},
|
|
26
|
+
info() {},
|
|
27
|
+
warn() {},
|
|
28
|
+
error() {},
|
|
29
|
+
success() {},
|
|
30
|
+
getEvents() {
|
|
31
|
+
return [];
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function makeContext(workspaceRoot: string): ForgeRuntimeContext {
|
|
36
|
+
return {
|
|
37
|
+
workspaceRoot,
|
|
38
|
+
logger: logger as never,
|
|
39
|
+
dryRun: false,
|
|
40
|
+
outputFormat: "pretty",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function makeInput(flags: Record<string, unknown> = {}) {
|
|
45
|
+
return { argv: [], flags: flags as never };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const MC_OPEN = "<" + "MODULE_CONTRACT>";
|
|
49
|
+
const MC_CLOSE = "</" + "MODULE_CONTRACT>";
|
|
50
|
+
const CS_OPEN = "<" + "CHANGE_SUMMARY>";
|
|
51
|
+
const CS_CLOSE = "</" + "CHANGE_SUMMARY>";
|
|
52
|
+
const HTML_OPEN = "<!" + "--";
|
|
53
|
+
const HTML_CLOSE = "--" + ">";
|
|
54
|
+
|
|
55
|
+
// .astro html-enclosed header; the CS window is 5 so six items force a
|
|
56
|
+
// collapse re-emit — the seam under test.
|
|
57
|
+
const ASTRO = (items: string[]) => `---
|
|
58
|
+
const x = 1;
|
|
59
|
+
---
|
|
60
|
+
${HTML_OPEN}
|
|
61
|
+
${MC_OPEN}
|
|
62
|
+
<purpose>Astro page fixture for summary trim unsafe-text coverage.</purpose>
|
|
63
|
+
<non-goals><item>No production logic.</item></non-goals>
|
|
64
|
+
${MC_CLOSE}
|
|
65
|
+
${CS_OPEN}
|
|
66
|
+
${items.map((i) => ` <item>${i}</item>`).join("\n")}
|
|
67
|
+
${CS_CLOSE}
|
|
68
|
+
${HTML_CLOSE}
|
|
69
|
+
<main/>
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
describe("compass.summary.trim", () => {
|
|
73
|
+
let root: string;
|
|
74
|
+
|
|
75
|
+
beforeEach(async () => {
|
|
76
|
+
root = await mkdtemp(join(tmpdir(), "summary-trim-"));
|
|
77
|
+
await mkdir(join(root, "packages", "fixture-pkg", "src"), { recursive: true });
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
afterEach(async () => {
|
|
81
|
+
await rm(root, { recursive: true, force: true });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("RFC-1323: an existing item carrying the terminator → skippedUnsafe, exit 1, bytes untouched", async () => {
|
|
85
|
+
const target = "packages/fixture-pkg/src/page.astro";
|
|
86
|
+
const items = [
|
|
87
|
+
"RFC-0001: first.",
|
|
88
|
+
"RFC-0002: second.",
|
|
89
|
+
"RFC-0003: third.",
|
|
90
|
+
"RFC-0004: fourth.",
|
|
91
|
+
"RFC-0005: fifth.",
|
|
92
|
+
`RFC-0006: notes ${HTML_OPEN} mid-item`,
|
|
93
|
+
];
|
|
94
|
+
const body = ASTRO(items);
|
|
95
|
+
await writeFile(join(root, target), body);
|
|
96
|
+
|
|
97
|
+
const result = await runCompassSummaryTrim(makeInput(), makeContext(root));
|
|
98
|
+
expect(result.exitCode).toBe(1);
|
|
99
|
+
const data = result.data as { skippedUnsafe: string[]; files: Array<{ path: string }> };
|
|
100
|
+
expect(data.skippedUnsafe).toEqual([target]);
|
|
101
|
+
expect(data.files.find((f) => f.path === target)).toBeUndefined();
|
|
102
|
+
expect(result.summary).toContain(target);
|
|
103
|
+
expect(await readFile(join(root, target), "utf8")).toBe(body);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("clean over-cap file trims normally alongside nothing unsafe", async () => {
|
|
107
|
+
const target = "packages/fixture-pkg/src/page.astro";
|
|
108
|
+
const items = [
|
|
109
|
+
"RFC-0001: first.",
|
|
110
|
+
"RFC-0002: second.",
|
|
111
|
+
"RFC-0003: third.",
|
|
112
|
+
"RFC-0004: fourth.",
|
|
113
|
+
"RFC-0005: fifth.",
|
|
114
|
+
"RFC-0006: sixth.",
|
|
115
|
+
];
|
|
116
|
+
await writeFile(join(root, target), ASTRO(items));
|
|
117
|
+
|
|
118
|
+
const result = await runCompassSummaryTrim(makeInput(), makeContext(root));
|
|
119
|
+
expect(result.exitCode).toBe(0);
|
|
120
|
+
const data = result.data as {
|
|
121
|
+
skippedUnsafe: string[];
|
|
122
|
+
files: Array<{ path: string; kept: number }>;
|
|
123
|
+
};
|
|
124
|
+
expect(data.skippedUnsafe).toEqual([]);
|
|
125
|
+
const entry = data.files.find((f) => f.path === target);
|
|
126
|
+
expect(entry?.kept).toBe(5);
|
|
127
|
+
const after = await readFile(join(root, target), "utf8");
|
|
128
|
+
expect(after).toContain("RFC-0006");
|
|
129
|
+
expect(after).not.toContain("RFC-0001: first.");
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
and flag malformed XML (COMPASS-DOC-00). A green corpus exits 0 with
|
|
8
8
|
status-shaped data.
|
|
9
9
|
</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
12
|
+
</non-goals>
|
|
10
13
|
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1311: Compass header sweep — declares the compass suite's contract for test-file scaffold coverage.</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
19
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|