@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
|
@@ -12,7 +12,6 @@ contract block specs alongside built-in MODULE_CONTRACT and CHANGE_SUMMARY check
|
|
|
12
12
|
</non-goals>
|
|
13
13
|
</MODULE_CONTRACT>
|
|
14
14
|
<CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-0943: added COMPASS-PLUGIN-01/02/03 diagnostics for pack-declared contract block specs from forge.plugin.yaml extensionPoints.</item>
|
|
16
15
|
<item>RFC-1094: --mode warning|error on compass.validate; mode-aware v2 diagnostics (KD/ORDER/PURPOSE) with severity field; inventory data.entries now carries full entries and XML gains v2 fields.</item>
|
|
17
16
|
<item>RFC-1095: summary-record unit tests, commit integration tests, CS rules into compass.validate</item>
|
|
18
17
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
@@ -21,7 +20,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
21
20
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
22
21
|
|
|
23
22
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
24
|
-
<
|
|
23
|
+
<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>
|
|
24
|
+
<history>RFC-0348, RFC-0350, RFC-0556, RFC-0943</history>
|
|
25
25
|
</CHANGE_SUMMARY>
|
|
26
26
|
*/
|
|
27
27
|
|
|
@@ -391,15 +391,20 @@ export async function runCompassValidation(
|
|
|
391
391
|
if (!V2_VALIDATE_RULE_PREFIXES.some((prefix) => v2.ruleId.startsWith(prefix))) {
|
|
392
392
|
continue;
|
|
393
393
|
}
|
|
394
|
+
// RFC-1323: COMPASS-CS-08 is corruption detection, not a style lint —
|
|
395
|
+
// a file it names is lexically broken, so it reports error even in the
|
|
396
|
+
// default warning mode where sibling v2 rules stay advisory.
|
|
397
|
+
const severity =
|
|
398
|
+
v2.ruleId === "COMPASS-CS-08" ? "error" : (v2Severity as "warning" | "error");
|
|
394
399
|
const log = `[compass.validate] ${v2.ruleId}: ${entry.path}: ${v2.message}`;
|
|
395
|
-
if (
|
|
400
|
+
if (severity === "error") {
|
|
396
401
|
context.logger.error(log);
|
|
397
402
|
} else {
|
|
398
403
|
context.logger.warn(log);
|
|
399
404
|
}
|
|
400
405
|
diagnostics.push({
|
|
401
406
|
ruleId: v2.ruleId,
|
|
402
|
-
severity
|
|
407
|
+
severity,
|
|
403
408
|
file: entry.path,
|
|
404
409
|
message: v2.message,
|
|
405
410
|
fix: v2.fix,
|
|
@@ -15,16 +15,12 @@ for Compass source-file inventory.</purpose>
|
|
|
15
15
|
<item>Policy literals come from resolveCompassPolicy — no stack- or consumer-specific values live in this module.</item>
|
|
16
16
|
</KEY_DECISIONS>
|
|
17
17
|
<CHANGE_SUMMARY>
|
|
18
|
-
<item>RFC-1096: all policy literals externalized to resolveCompassPolicy — scan roots, extensions, ignored dirs/paths, layer/risk rules, governance-ID and boilerplate patterns come from generic defaults + profile + bindings.compass.</item>
|
|
19
|
-
<item>RFC-1097: sweep — SKILL.md headers + classification fixes
|
|
20
|
-
|
|
21
|
-
Sweep batch 1: add Compass v2 headers to 45 SKILL.md files (purpose derived from frontmatter description). Fix non-skill-markdown exclusion to check filename not workspace-relative path (packages/AGENTS.md escaped it). Add .coverage to ignoredDirs.</item>
|
|
22
|
-
<item>RFC-1097: sweep — packages/forge + services clean
|
|
23
|
-
|
|
24
|
-
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
25
18
|
<item>RFC-1111: normalize dynamic-route bracket stems in deriveFileTokens — [token]/[...slug]/[lang] segments strip brackets and dots so PURPOSE-02 is satisfiable for Astro dynamic routes.</item>
|
|
26
19
|
<item>RFC-1220: step 2 — fail-closed guards in history paths</item>
|
|
27
|
-
<
|
|
20
|
+
<item>RFC-1318: add compass.header.scaffold codemod for mechanical header sweeps</item>
|
|
21
|
+
<item>RFC-1318</item>
|
|
22
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
23
|
+
<history>RFC-0348, RFC-0556, RFC-1094, RFC-1095, RFC-1096, RFC-1097</history>
|
|
28
24
|
</CHANGE_SUMMARY>
|
|
29
25
|
|
|
30
26
|
*/
|
|
@@ -33,6 +29,7 @@ import { join, relative, resolve } from "node:path";
|
|
|
33
29
|
import { ambientIo } from "../../../src/utils/io.ts";
|
|
34
30
|
import type { ForgeCommandInput } from "../../../src/types.ts";
|
|
35
31
|
import { hasGeneratedMarker } from "../../../src/utils/generated-marker.ts";
|
|
32
|
+
import { findCompassTerminatorInHeader } from "../comment-safety.ts";
|
|
36
33
|
|
|
37
34
|
// Ambient default for helper fns without a context param — handlers override
|
|
38
35
|
// with `const io = resolveIo(context.io)` inside their own scope.
|
|
@@ -72,7 +69,7 @@ const GENERIC_STEMS = new Set([
|
|
|
72
69
|
"readme",
|
|
73
70
|
]);
|
|
74
71
|
const SYMBOL_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts"]);
|
|
75
|
-
const EXPORTED_SYMBOL_RE =
|
|
72
|
+
export const EXPORTED_SYMBOL_RE =
|
|
76
73
|
/export\s+(?:async\s+)?(?:function|const|let|class|interface|type|enum)\s+(\w+)/g;
|
|
77
74
|
|
|
78
75
|
const KEY_DECISIONS_MAX_ITEMS = 7;
|
|
@@ -212,7 +209,7 @@ function detectWorkspaceKind(segments: string[], policy: CompassPolicy): Compass
|
|
|
212
209
|
return (first !== undefined && policy.workspaceKinds[first]) || "app";
|
|
213
210
|
}
|
|
214
211
|
|
|
215
|
-
function detectWorkspaceName(segments: string[], policy: CompassPolicy): string {
|
|
212
|
+
export function detectWorkspaceName(segments: string[], policy: CompassPolicy): string {
|
|
216
213
|
if (isWorkspaceDir(segments[0], policy)) {
|
|
217
214
|
return segments[1] ?? "unknown";
|
|
218
215
|
}
|
|
@@ -251,7 +248,7 @@ function detectComplexity(source: string): CompassComplexity {
|
|
|
251
248
|
return "non-trivial";
|
|
252
249
|
}
|
|
253
250
|
|
|
254
|
-
function detectAuthoringStatus(
|
|
251
|
+
export function detectAuthoringStatus(
|
|
255
252
|
segments: string[],
|
|
256
253
|
relativePath: string,
|
|
257
254
|
source: string,
|
|
@@ -289,7 +286,9 @@ function detectAuthoringStatus(
|
|
|
289
286
|
};
|
|
290
287
|
}
|
|
291
288
|
|
|
292
|
-
|
|
289
|
+
// RFC-1311: scaffoldTestPatterns opts covered test files out of the
|
|
290
|
+
// exclusion — they stay authored and carry the standard scaffolding.
|
|
291
|
+
if (policy.isTestPath(relativePath) && !policy.isScaffoldedTestPath(relativePath)) {
|
|
293
292
|
return {
|
|
294
293
|
authoringStatus: "excluded",
|
|
295
294
|
exclusionReason: "test-file",
|
|
@@ -480,8 +479,12 @@ export function deriveFileTokens(pathFromRoot: string, source: string): Set<stri
|
|
|
480
479
|
const segments = pathFromRoot.split("/").filter(Boolean);
|
|
481
480
|
const filename = segments[segments.length - 1] ?? "";
|
|
482
481
|
const dotIndex = filename.lastIndexOf(".");
|
|
483
|
-
const
|
|
482
|
+
const rawStem = dotIndex > 0 ? filename.slice(0, dotIndex) : filename;
|
|
484
483
|
const extension = dotIndex > 0 ? filename.slice(dotIndex) : "";
|
|
484
|
+
// RFC-1311: compound suffixes (`.test`, `.spec`) glue the real stem to an
|
|
485
|
+
// unwritable token (`create.test` → "createtest") — strip them so
|
|
486
|
+
// scaffolded test files get their natural stem tokens.
|
|
487
|
+
const stem = rawStem.replace(/\.(test|spec)$/i, "");
|
|
485
488
|
|
|
486
489
|
const tokens = new Set<string>();
|
|
487
490
|
for (const segment of stem.split("-").filter(Boolean)) {
|
|
@@ -541,6 +544,19 @@ export function evaluateV2Rules(
|
|
|
541
544
|
const parse = parseCompassBlocks(source);
|
|
542
545
|
const diagnostics: CompassV2Diagnostic[] = [];
|
|
543
546
|
|
|
547
|
+
// RFC-1323: COMPASS-CS-08 — a comment terminator landing while Compass
|
|
548
|
+
// inner tags are still unclosed truncated the header mid-block. Scan runs
|
|
549
|
+
// on the raw header region: parseCompassBlocks never sees the corrupted
|
|
550
|
+
// tail, so the parse cannot carry this diagnostic.
|
|
551
|
+
const terminatorHit = findCompassTerminatorInHeader(source, entry.path);
|
|
552
|
+
if (terminatorHit) {
|
|
553
|
+
diagnostics.push({
|
|
554
|
+
ruleId: "COMPASS-CS-08",
|
|
555
|
+
message: `comment-close sequence "${terminatorHit.substring}" truncates a Compass block at line ${terminatorHit.line} — inner tags are left unclosed`,
|
|
556
|
+
fix: "fix: reword so the terminator pair never appears in block text (space the glyphs, describe the glob, or XML-escape); run the writers that now reject/neutralize at the seam",
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
|
|
544
560
|
const orderedPositions = [
|
|
545
561
|
parse.positions.moduleContract,
|
|
546
562
|
parse.positions.keyDecisions,
|
|
@@ -9,10 +9,6 @@ the migrateWorkspace codemod and returns the per-file action manifest.</purpose>
|
|
|
9
9
|
</non-goals>
|
|
10
10
|
</MODULE_CONTRACT>
|
|
11
11
|
<CHANGE_SUMMARY>
|
|
12
|
-
<item>RFC-1097: initial handler — dirty-tree refusal with --force, --files bypass, dry-run manifest.</item>
|
|
13
|
-
<item>RFC-1097: steps 1-4 — compass.migrate codemod
|
|
14
|
-
|
|
15
|
-
Add the v1 to v2 Compass header codemod: migrateFile pure transform (collapse, strip, seed, reorder, purpose-flag actions), migrateWorkspace walker, runCompassMigrate handler with dirty-tree refusal and --force/--files/--dry-run flags, module registration, and 15 unit tests.</item>
|
|
16
12
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
17
13
|
|
|
18
14
|
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
@@ -22,11 +18,14 @@ Sweep batch 4: 73 Compass headers on headerless engine files (certification, com
|
|
|
22
18
|
<item>RFC-1097: AC-4 banned literal in os/compass handlers
|
|
23
19
|
|
|
24
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-1318: add compass.header.scaffold codemod for mechanical header sweeps</item>
|
|
22
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
23
|
+
<history>RFC-1097</history>
|
|
25
24
|
</CHANGE_SUMMARY>
|
|
26
25
|
*/
|
|
27
26
|
|
|
28
|
-
import { execFileSync } from "../../../src/utils/sync-fs.ts";
|
|
29
27
|
import { migrateWorkspace, type MigrateResult } from "./compass-migrate.ts";
|
|
28
|
+
import { DIRTY_LIST_CAP, listDirtyPaths } from "./git-revision.ts";
|
|
30
29
|
import { resolveCompassScanRoot } from "./resolve-scan-root.ts";
|
|
31
30
|
import { resolveCompassPolicy } from "../policy.ts";
|
|
32
31
|
import type {
|
|
@@ -35,26 +34,6 @@ import type {
|
|
|
35
34
|
ForgeRuntimeContext,
|
|
36
35
|
} from "../../../src/types.ts";
|
|
37
36
|
|
|
38
|
-
const DIRTY_LIST_CAP = 20;
|
|
39
|
-
|
|
40
|
-
function listDirtyPaths(repoRoot: string): string[] | null {
|
|
41
|
-
try {
|
|
42
|
-
const out = execFileSync("git", ["-C", repoRoot, "status", "--porcelain"], {
|
|
43
|
-
encoding: "utf8",
|
|
44
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
45
|
-
timeout: 15000,
|
|
46
|
-
});
|
|
47
|
-
return out
|
|
48
|
-
.split("\n")
|
|
49
|
-
.map((line) => line.trim())
|
|
50
|
-
.filter(Boolean)
|
|
51
|
-
.map((line) => line.slice(3));
|
|
52
|
-
} catch {
|
|
53
|
-
// Not a git repository — nothing to protect, skip the check.
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
37
|
export async function runCompassMigrate(
|
|
59
38
|
input: ForgeCommandInput,
|
|
60
39
|
context: ForgeRuntimeContext,
|
|
@@ -107,11 +86,18 @@ export async function runCompassMigrate(
|
|
|
107
86
|
}
|
|
108
87
|
}
|
|
109
88
|
const tally = [...counts.entries()].map(([k, v]) => `${k}=${v}`).join(", ");
|
|
89
|
+
const unsafe = result.files.filter((f) => f.actions.includes("unsafe-text"));
|
|
90
|
+
const unsafeNote =
|
|
91
|
+
unsafe.length > 0
|
|
92
|
+
? ` | COMPASS-CS-08 unsafe authored text (files left untouched): ${unsafe
|
|
93
|
+
.map((f) => `${f.path}${f.error ? ` — ${f.error}` : ""}`)
|
|
94
|
+
.join("; ")}`
|
|
95
|
+
: "";
|
|
110
96
|
|
|
111
97
|
return {
|
|
112
98
|
data: result,
|
|
113
|
-
exitCode: 0,
|
|
114
|
-
summary: `[compass.migrate] scanned=${result.scanned} ${tally}${dryRun ? " (dry-run)" : ""}`,
|
|
99
|
+
exitCode: unsafe.length > 0 ? 1 : 0,
|
|
100
|
+
summary: `[compass.migrate] scanned=${result.scanned} ${tally}${dryRun ? " (dry-run)" : ""}${unsafeNote}`,
|
|
115
101
|
nextSteps: [
|
|
116
102
|
{
|
|
117
103
|
action:
|
|
@@ -23,6 +23,9 @@ walker; the kernel handler lives in compass-migrate-handler.ts.</purpose>
|
|
|
23
23
|
<item>RFC-1097: steps 1-4 — compass.migrate codemod
|
|
24
24
|
|
|
25
25
|
Add the v1 to v2 Compass header codemod: migrateFile pure transform (collapse, strip, seed, reorder, purpose-flag actions), migrateWorkspace walker, runCompassMigrate handler with dirty-tree refusal and --force/--files/--dry-run flags, module registration, and 15 unit tests.</item>
|
|
26
|
+
<item>RFC-1318: add compass.header.scaffold codemod for mechanical header sweeps</item>
|
|
27
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
28
|
+
<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>
|
|
26
29
|
</CHANGE_SUMMARY>
|
|
27
30
|
*/
|
|
28
31
|
|
|
@@ -38,10 +41,18 @@ import {
|
|
|
38
41
|
import {
|
|
39
42
|
buildChangeSummaryBlock,
|
|
40
43
|
CHANGE_SUMMARY_WINDOW,
|
|
41
|
-
getLineCommentPrefix,
|
|
42
44
|
mergeHistoryIds,
|
|
43
45
|
parseChangeSummary,
|
|
44
46
|
} from "./summary-record.ts";
|
|
47
|
+
import {
|
|
48
|
+
CompassCommentSafetyError,
|
|
49
|
+
HEADER_SCAN_LINES,
|
|
50
|
+
commentStyleFor,
|
|
51
|
+
enclosingCommentStyle,
|
|
52
|
+
getLineCommentPrefix,
|
|
53
|
+
assertCompassCommentSafe,
|
|
54
|
+
type CommentStyle,
|
|
55
|
+
} from "../comment-safety.ts";
|
|
45
56
|
import { writeFileIfChanged } from "../../../src/utils/fs-idempotent.ts";
|
|
46
57
|
import type { CompassPolicy } from "../policy.ts";
|
|
47
58
|
import type { ForgeCommandInput } from "../../../src/types.ts";
|
|
@@ -59,6 +70,7 @@ export type MigrateAction =
|
|
|
59
70
|
| "reordered"
|
|
60
71
|
| "unparseable"
|
|
61
72
|
| "no-header"
|
|
73
|
+
| "unsafe-text"
|
|
62
74
|
| "unchanged";
|
|
63
75
|
|
|
64
76
|
export interface MigrateFileResult {
|
|
@@ -68,7 +80,7 @@ export interface MigrateFileResult {
|
|
|
68
80
|
|
|
69
81
|
export interface MigrateResult {
|
|
70
82
|
scanned: number;
|
|
71
|
-
files: Array<{ path: string; actions: MigrateAction[] }>;
|
|
83
|
+
files: Array<{ path: string; actions: MigrateAction[]; error?: string }>;
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
export interface MigrateOptions {
|
|
@@ -80,17 +92,19 @@ export interface MigrateOptions {
|
|
|
80
92
|
siteDirectory?: string;
|
|
81
93
|
}
|
|
82
94
|
|
|
83
|
-
|
|
95
|
+
// Canonical home is ../comment-safety.ts (RFC-1323) — re-exported to keep the
|
|
96
|
+
// existing public surface of this module.
|
|
97
|
+
export { HEADER_SCAN_LINES } from "../comment-safety.ts";
|
|
84
98
|
const KEY_DECISIONS_MAX_ITEMS = 7;
|
|
85
|
-
const TODO_ITEM = "TODO: record current design decisions";
|
|
99
|
+
export const TODO_ITEM = "TODO: record current design decisions";
|
|
86
100
|
|
|
87
|
-
const COMPASS_TAGS = ["MODULE_CONTRACT", "KEY_DECISIONS", "CHANGE_SUMMARY"] as const;
|
|
101
|
+
export const COMPASS_TAGS = ["MODULE_CONTRACT", "KEY_DECISIONS", "CHANGE_SUMMARY"] as const;
|
|
88
102
|
type CompassTag = (typeof COMPASS_TAGS)[number];
|
|
89
103
|
|
|
90
104
|
const FORBIDDEN_BLOCK_TAGS = ["MODULE_MAP", "keywords", "responsibilities"] as const;
|
|
91
105
|
const COMPASS_BLOCK_ANCHOR_RE = /[ \t]*<\/?COMPASS_BLOCK\b[^>]*>[ \t]*/g;
|
|
92
106
|
|
|
93
|
-
function blockSpan(source: string, tag: string): { start: number; end: number } | null {
|
|
107
|
+
export function blockSpan(source: string, tag: string): { start: number; end: number } | null {
|
|
94
108
|
const open = source.indexOf(`<${tag}>`);
|
|
95
109
|
if (open < 0) return null;
|
|
96
110
|
const closeTag = `</${tag}>`;
|
|
@@ -99,11 +113,11 @@ function blockSpan(source: string, tag: string): { start: number; end: number }
|
|
|
99
113
|
return { start: open, end: close + closeTag.length };
|
|
100
114
|
}
|
|
101
115
|
|
|
102
|
-
function hasUnclosedTag(source: string, tag: string): boolean {
|
|
116
|
+
export function hasUnclosedTag(source: string, tag: string): boolean {
|
|
103
117
|
return source.includes(`<${tag}>`) && !source.includes(`</${tag}>`);
|
|
104
118
|
}
|
|
105
119
|
|
|
106
|
-
function inHeaderRegion(source: string, index: number): boolean {
|
|
120
|
+
export function inHeaderRegion(source: string, index: number): boolean {
|
|
107
121
|
return source.slice(0, index).split("\n").length <= HEADER_SCAN_LINES;
|
|
108
122
|
}
|
|
109
123
|
|
|
@@ -131,7 +145,14 @@ export function collectAiInvariants(source: string, policy: CompassPolicy): stri
|
|
|
131
145
|
return items;
|
|
132
146
|
}
|
|
133
147
|
|
|
134
|
-
function buildKeyDecisionsBlock(items: string[], filePath: string): string {
|
|
148
|
+
function buildKeyDecisionsBlock(items: string[], filePath: string, style?: CommentStyle): string {
|
|
149
|
+
// RFC-1323: seeded items carry authored @ai-invariant text — it may hold a
|
|
150
|
+
// sequence that is harmless where it was written but terminates the target
|
|
151
|
+
// comment style here. Fail closed (COMPASS-CS-08), never write corrupt text.
|
|
152
|
+
const effectiveStyle = style ?? commentStyleFor(filePath);
|
|
153
|
+
for (const item of items) {
|
|
154
|
+
assertCompassCommentSafe(item, effectiveStyle, { file: filePath, block: "KEY_DECISIONS" });
|
|
155
|
+
}
|
|
135
156
|
const lines = ["<KEY_DECISIONS>"];
|
|
136
157
|
for (const item of items) {
|
|
137
158
|
lines.push(` <item>${item}</item>`);
|
|
@@ -157,7 +178,10 @@ function extractPurposeText(source: string): string {
|
|
|
157
178
|
/**
|
|
158
179
|
* Pure v1 to v2 transform of one file's source. Returns the rewritten source
|
|
159
180
|
* and the closed action union. `unchanged` is exclusive; every other action
|
|
160
|
-
* may combine. Never throws on malformed input — reports `unparseable
|
|
181
|
+
* may combine. Never throws on malformed input — reports `unparseable` —
|
|
182
|
+
* except CompassCommentSafetyError (COMPASS-CS-08): text that would corrupt
|
|
183
|
+
* the target comment is fail-closed, not malformed; batch callers (e.g.
|
|
184
|
+
* migrateWorkspace's runMigrateGuarded) convert it to `unsafe-text` per file.
|
|
161
185
|
*/
|
|
162
186
|
export function migrateFile(
|
|
163
187
|
source: string,
|
|
@@ -205,7 +229,13 @@ export function migrateFile(
|
|
|
205
229
|
nextHistory.length !== historyIds.length ||
|
|
206
230
|
nextHistory.some((id, i) => id !== historyIds[i]);
|
|
207
231
|
if (changed) {
|
|
208
|
-
|
|
232
|
+
// RFC-1323: emission assert uses the enclosing comment's detected style.
|
|
233
|
+
const newBlock = buildChangeSummaryBlock(
|
|
234
|
+
idItems,
|
|
235
|
+
nextHistory,
|
|
236
|
+
pathFromRoot,
|
|
237
|
+
enclosingCommentStyle(next, csSpan.start, pathFromRoot),
|
|
238
|
+
);
|
|
209
239
|
next = next.slice(0, csSpan.start) + newBlock + next.slice(csSpan.end);
|
|
210
240
|
actions.push("collapsed");
|
|
211
241
|
}
|
|
@@ -229,15 +259,16 @@ export function migrateFile(
|
|
|
229
259
|
if (kdRequired && !next.includes("<KEY_DECISIONS>")) {
|
|
230
260
|
const invariants = collectAiInvariants(next, policy);
|
|
231
261
|
const items = invariants.length > 0 ? invariants : [TODO_ITEM];
|
|
232
|
-
const kdBlock = buildKeyDecisionsBlock(items, pathFromRoot);
|
|
233
262
|
const mcSpan = blockSpan(next, "MODULE_CONTRACT");
|
|
263
|
+
const csAnchor = mcSpan ?? blockSpan(next, "CHANGE_SUMMARY");
|
|
264
|
+
const insertStyle = csAnchor
|
|
265
|
+
? enclosingCommentStyle(next, csAnchor.start, pathFromRoot)
|
|
266
|
+
: undefined;
|
|
267
|
+
const kdBlock = buildKeyDecisionsBlock(items, pathFromRoot, insertStyle);
|
|
234
268
|
if (mcSpan) {
|
|
235
269
|
next = next.slice(0, mcSpan.end) + "\n" + kdBlock + next.slice(mcSpan.end);
|
|
236
|
-
} else {
|
|
237
|
-
|
|
238
|
-
if (csSpan2) {
|
|
239
|
-
next = next.slice(0, csSpan2.start) + kdBlock + "\n" + next.slice(csSpan2.start);
|
|
240
|
-
}
|
|
270
|
+
} else if (csAnchor) {
|
|
271
|
+
next = next.slice(0, csAnchor.start) + kdBlock + "\n" + next.slice(csAnchor.start);
|
|
241
272
|
}
|
|
242
273
|
actions.push(invariants.length > 0 ? "seeded" : "todo");
|
|
243
274
|
}
|
|
@@ -334,13 +365,17 @@ export async function migrateWorkspace(
|
|
|
334
365
|
continue;
|
|
335
366
|
}
|
|
336
367
|
result.scanned += 1;
|
|
337
|
-
const migrated =
|
|
368
|
+
const migrated = runMigrateGuarded(
|
|
338
369
|
source,
|
|
339
370
|
policy,
|
|
340
371
|
target.pathFromRoot,
|
|
341
372
|
target.workspaceRelativePath,
|
|
342
373
|
);
|
|
343
|
-
result.files.push({
|
|
374
|
+
result.files.push({
|
|
375
|
+
path: target.pathFromRoot,
|
|
376
|
+
actions: migrated.actions,
|
|
377
|
+
error: migrated.error,
|
|
378
|
+
});
|
|
344
379
|
if (!options.dryRun && migrated.source !== source) {
|
|
345
380
|
await writeFileIfChanged(absPath, migrated.source);
|
|
346
381
|
}
|
|
@@ -361,8 +396,8 @@ export async function migrateWorkspace(
|
|
|
361
396
|
const source = getEntrySource(entry) ?? (await io.readFile(absPath));
|
|
362
397
|
const segments = getRelativeSegments(absPath, workspaceRoot);
|
|
363
398
|
const workspaceRelativePath = getWorkspaceRelativeSegments(segments, policy).join("/");
|
|
364
|
-
const migrated =
|
|
365
|
-
result.files.push({ path: entry.path, actions: migrated.actions });
|
|
399
|
+
const migrated = runMigrateGuarded(source, policy, entry.path, workspaceRelativePath);
|
|
400
|
+
result.files.push({ path: entry.path, actions: migrated.actions, error: migrated.error });
|
|
366
401
|
if (!options.dryRun && migrated.source !== source) {
|
|
367
402
|
await writeFileIfChanged(absPath, migrated.source);
|
|
368
403
|
}
|
|
@@ -370,3 +405,24 @@ export async function migrateWorkspace(
|
|
|
370
405
|
|
|
371
406
|
return result;
|
|
372
407
|
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* RFC-1323: migrateFile's emission asserts can throw COMPASS-CS-08 when authored
|
|
411
|
+
* @ai-invariant text carries a comment terminator. Fail closed per file — the
|
|
412
|
+
* file is left untouched, the action is recorded, the batch continues.
|
|
413
|
+
*/
|
|
414
|
+
function runMigrateGuarded(
|
|
415
|
+
source: string,
|
|
416
|
+
policy: CompassPolicy,
|
|
417
|
+
pathFromRoot: string,
|
|
418
|
+
workspaceRelativePath: string,
|
|
419
|
+
): MigrateFileResult & { error?: string } {
|
|
420
|
+
try {
|
|
421
|
+
return migrateFile(source, policy, pathFromRoot, workspaceRelativePath);
|
|
422
|
+
} catch (err) {
|
|
423
|
+
if (err instanceof CompassCommentSafetyError) {
|
|
424
|
+
return { source, actions: ["unsafe-text"], error: err.message };
|
|
425
|
+
}
|
|
426
|
+
throw err;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
<MODULE_CONTRACT>
|
|
3
|
-
<purpose>Git revision lookup by file path. Moved from
|
|
4
|
-
to @warpgogol/forge for full autonomous mode (RFC-0556).
|
|
5
|
-
with integrity-registry lookup and git-history fallback,
|
|
3
|
+
<purpose>Git revision and worktree-dirtiness lookup by file path. Moved from
|
|
4
|
+
@warpgogol/site-kernel-integrity to @warpgogol/forge for full autonomous mode (RFC-0556).
|
|
5
|
+
Provides getRevisionByPath with integrity-registry lookup and git-history fallback,
|
|
6
|
+
plus getFileRevisionFromHistory and the porcelain dirty-path helpers
|
|
7
|
+
(repoTopLevel/listDirtyPaths/isDirtyPath) shared by write-refusing commands.</purpose>
|
|
6
8
|
<non-goals>
|
|
7
9
|
<item>Do not compute a new per-file counter — reuse the existing integrity revision.</item>
|
|
8
10
|
<item>Do not modify the registry or write any files.</item>
|
|
@@ -11,10 +13,12 @@ with integrity-registry lookup and git-history fallback, plus getFileRevisionFro
|
|
|
11
13
|
<CHANGE_SUMMARY>
|
|
12
14
|
<item>RFC-0352: initial implementation of getRevisionByPath helper.</item>
|
|
13
15
|
<item>RFC-0556: moved from @warpgogol/site-kernel-integrity to @warpgogol/forge for autonomous mode.</item>
|
|
16
|
+
<item>RFC-1318: add compass.header.scaffold codemod for mechanical header sweeps</item>
|
|
17
|
+
<item>RFC-1318</item>
|
|
14
18
|
</CHANGE_SUMMARY>
|
|
15
19
|
*/
|
|
16
20
|
|
|
17
|
-
import { execFile } from "../../../src/utils/sync-fs.ts";
|
|
21
|
+
import { execFile, execFileSync } from "../../../src/utils/sync-fs.ts";
|
|
18
22
|
import { ambientIo } from "../../../src/utils/io.ts";
|
|
19
23
|
import { promisify } from "node:util";
|
|
20
24
|
import { createHash } from "node:crypto";
|
|
@@ -28,6 +32,57 @@ const io = ambientIo;
|
|
|
28
32
|
const execFileAsync = promisify(execFile);
|
|
29
33
|
const DEFAULT_GIT_TIMEOUT_MS = 15_000;
|
|
30
34
|
|
|
35
|
+
export const DIRTY_LIST_CAP = 20;
|
|
36
|
+
|
|
37
|
+
/** The repository top-level containing `repoRoot` — null when not a git repo. */
|
|
38
|
+
export function repoTopLevel(repoRoot: string): string | null {
|
|
39
|
+
try {
|
|
40
|
+
const out = execFileSync("git", ["-C", repoRoot, "rev-parse", "--show-toplevel"], {
|
|
41
|
+
encoding: "utf8",
|
|
42
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
43
|
+
timeout: 15000,
|
|
44
|
+
}).trim();
|
|
45
|
+
return out.length > 0 ? out : null;
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Paths with uncommitted changes under `repoRoot` — null when not a git repo. */
|
|
52
|
+
export function listDirtyPaths(repoRoot: string): string[] | null {
|
|
53
|
+
try {
|
|
54
|
+
const out = execFileSync("git", ["-C", repoRoot, "status", "--porcelain"], {
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
57
|
+
timeout: 15000,
|
|
58
|
+
});
|
|
59
|
+
return out
|
|
60
|
+
.split("\n")
|
|
61
|
+
.filter((line) => line.length >= 3)
|
|
62
|
+
.map((line) => {
|
|
63
|
+
// Porcelain is `XY <path>` — slice the raw line so leading-space
|
|
64
|
+
// status pairs (e.g. " M") keep their offsets.
|
|
65
|
+
let path = line.slice(3);
|
|
66
|
+
// Rename entries read `old -> new`; the live path is the target.
|
|
67
|
+
const arrow = path.indexOf(" -> ");
|
|
68
|
+
if (arrow >= 0) path = path.slice(arrow + 4);
|
|
69
|
+
return path.replace(/^"|"$/g, "");
|
|
70
|
+
})
|
|
71
|
+
.filter(Boolean);
|
|
72
|
+
} catch {
|
|
73
|
+
// Not a git repository — nothing to protect, skip the check.
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Whether `path` is covered by the dirty set. Git collapses untracked
|
|
80
|
+
* directories to `?? dir/`, so a dirty directory prefix counts as dirty too.
|
|
81
|
+
*/
|
|
82
|
+
export function isDirtyPath(path: string, dirty: readonly string[]): boolean {
|
|
83
|
+
return dirty.some((d) => path === d || (d.endsWith("/") && path.startsWith(d)));
|
|
84
|
+
}
|
|
85
|
+
|
|
31
86
|
async function runGit(
|
|
32
87
|
cwd: string,
|
|
33
88
|
args: string[],
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for resolve scan root package covering resolveCompassScanRoot --package.
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the resolve suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
16
|
import { mkdtempSync, mkdirSync, rmSync } from "node:fs";
|
|
3
17
|
import { join } from "node:path";
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for resolve scan root workpiece covering resolveCompassScanRoot --workpiece (RFC-0617).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the resolve suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
16
|
import { mkdtempSync, mkdirSync, rmSync } from "node:fs";
|
|
3
17
|
import { join } from "node:path";
|