@warpgogol/forge 6.3.6 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +2 -1
- package/bin/cli.js +6 -12
- package/bin/resolve-entry.js +24 -0
- package/dist/os/compass/comment-safety.d.ts +83 -0
- package/dist/os/compass/comment-safety.d.ts.map +1 -0
- package/dist/os/compass/comment-safety.js +305 -0
- package/dist/os/compass/comment-safety.js.map +1 -0
- package/dist/os/compass/compass.module.d.ts.map +1 -1
- package/dist/os/compass/compass.module.js +47 -4
- package/dist/os/compass/compass.module.js.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
- package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
- package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
- package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
- package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
- package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-inventory.js +28 -13
- package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
- package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate.js +58 -20
- package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +10 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +58 -4
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts +20 -5
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +175 -44
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/compass/index.d.ts +1 -0
- package/dist/os/compass/index.d.ts.map +1 -1
- package/dist/os/compass/index.js +2 -0
- package/dist/os/compass/index.js.map +1 -1
- package/dist/os/compass/policy.d.ts +9 -0
- package/dist/os/compass/policy.d.ts.map +1 -1
- package/dist/os/compass/policy.js +11 -2
- package/dist/os/compass/policy.js.map +1 -1
- package/dist/os/core/core.module.js +1 -1
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +1 -6
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/queue/types.d.ts +2 -0
- package/dist/os/queue/types.d.ts.map +1 -1
- package/dist/os/queue/types.js +3 -1
- package/dist/os/queue/types.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +66 -2
- 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 +645 -47
- 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 +71 -10
- 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 +99 -10
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +112 -14
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +27 -10
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +25 -0
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +244 -13
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +58 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -0
- package/dist/os/rfc/verification-origin.js +346 -0
- package/dist/os/rfc/verification-origin.js.map +1 -0
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +11 -1
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +23 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
- package/dist/os/rfc/verify-workspace.js +278 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -0
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +3 -0
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +5 -23
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +30 -9
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/workflow/handlers.d.ts +0 -4
- package/dist/os/workflow/handlers.d.ts.map +1 -1
- package/dist/os/workflow/handlers.js +9 -36
- package/dist/os/workflow/handlers.js.map +1 -1
- package/dist/os/workflow/index.d.ts +2 -2
- package/dist/os/workflow/index.d.ts.map +1 -1
- package/dist/os/workflow/index.js +1 -1
- package/dist/os/workflow/index.js.map +1 -1
- package/dist/os/workflow/types.d.ts +0 -19
- package/dist/os/workflow/types.d.ts.map +1 -1
- package/dist/os/workflow/types.js +0 -2
- package/dist/os/workflow/types.js.map +1 -1
- package/dist/os/workflow/workflow.module.d.ts.map +1 -1
- package/dist/os/workflow/workflow.module.js +6 -15
- package/dist/os/workflow/workflow.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +5 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +5 -2
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/doctor.js +3 -3
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/init.js +2 -2
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/prettierignore.js +1 -1
- package/dist/src/onboarding/upgrade.js +2 -2
- package/dist/src/onboarding/workspace-discovery.js +1 -1
- package/dist/src/profiles/profile-schema.d.ts +2 -0
- package/dist/src/profiles/profile-schema.d.ts.map +1 -1
- package/dist/src/profiles/profile-schema.js +1 -0
- package/dist/src/profiles/profile-schema.js.map +1 -1
- package/dist/src/profiles/stack-profile.d.ts +1 -0
- package/dist/src/profiles/stack-profile.d.ts.map +1 -1
- package/dist/src/skill-schema.d.ts +2 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -1
- package/dist/src/skill-schema.js.map +1 -1
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -1
- package/dist/src/types.js.map +1 -1
- package/docs/reference/cli.md +0 -1
- package/docs/reference/programmatic-api.md +1 -1
- package/os/adr/handlers/validate.test.ts +14 -0
- package/os/compass/comment-safety.ts +331 -0
- package/os/compass/compass.module.ts +50 -4
- package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
- package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
- package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
- package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
- package/os/compass/handlers/compass-header-scaffold.ts +847 -0
- package/os/compass/handlers/compass-inventory-handler.ts +9 -4
- package/os/compass/handlers/compass-inventory.ts +29 -13
- package/os/compass/handlers/compass-migrate-handler.ts +13 -27
- package/os/compass/handlers/compass-migrate.ts +77 -21
- package/os/compass/handlers/git-revision.ts +59 -4
- package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
- package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
- package/os/compass/handlers/summary-record.ts +194 -41
- package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
- package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
- package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
- package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
- package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
- package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
- package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
- package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
- package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
- package/os/compass/handlers/tests/summary-record.test.ts +324 -3
- package/os/compass/index.ts +15 -0
- package/os/compass/policy.ts +27 -2
- package/os/core/core.module.ts +1 -1
- package/os/core/handlers/invariant-engine.test.ts +3 -1
- package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
- package/os/core/handlers/note-link-validate.test.ts +6 -1
- package/os/core/handlers/note-orphan-detect.test.ts +6 -1
- package/os/core/handlers/package-health.test.ts +6 -0
- package/os/core/handlers/package-health.ts +1 -6
- package/os/mission/handlers/archive.test.ts +14 -0
- package/os/naming/naming-convention.test.ts +14 -0
- package/os/queue/decision-ledger.test.ts +27 -4
- package/os/queue/queue-validate.test.ts +14 -0
- package/os/queue/types.ts +3 -1
- package/os/rfc/acceptance-reachable.test.ts +146 -0
- package/os/rfc/acceptance.test.ts +136 -0
- package/os/rfc/acceptance.ts +71 -2
- 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 +285 -0
- package/os/rfc/handlers/implement-stamp.ts +783 -55
- 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 +56 -0
- package/os/rfc/handlers/validate-rules.ts +101 -10
- package/os/rfc/handlers/validate.test.ts +4 -3
- package/os/rfc/reachable-symbol.ts +441 -0
- package/os/rfc/rfc-0000-template.md +21 -1
- 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 +106 -10
- package/os/rfc/types.ts +151 -14
- package/os/rfc/verification-emit-check.test.ts +215 -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 +301 -13
- package/os/rfc/verification-normalize.test.ts +75 -0
- package/os/rfc/verification-origin.test.ts +236 -0
- package/os/rfc/verification-origin.ts +417 -0
- package/os/rfc/verification-refresh.test.ts +14 -0
- package/os/rfc/verification-refresh.ts +12 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
- package/os/rfc/verify-workspace.test.ts +122 -0
- package/os/rfc/verify-workspace.ts +342 -0
- package/os/session/handlers/metrics-rfc.ts +3 -0
- package/os/spec/spec-status.test.ts +130 -0
- package/os/spec/spec-status.ts +5 -18
- package/os/spec/spec-validate.test.ts +76 -1
- package/os/spec/spec-validate.ts +26 -7
- package/os/workflow/handlers.ts +8 -42
- package/os/workflow/index.ts +1 -4
- package/os/workflow/types.ts +0 -22
- package/os/workflow/workflow.module.ts +6 -16
- package/package.json +1 -1
- package/skills/_shared/agent-operating-model.md +83 -0
- 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/SKILL.md +6 -3
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
- package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
- package/skills/fo/fo-idea-implement/SKILL.md +68 -53
- package/skills/fo/fo-idea-plan/SKILL.md +3 -1
- package/skills/fo/fo-review/SKILL.md +12 -0
- package/skills/fo/fo-session-save/learned-principles.md +13 -0
- package/skills/fo/fo-step-commit/SKILL.md +1 -1
- package/src/bin-entry.test.ts +37 -0
- package/src/compass/contract-registry.test.ts +14 -0
- package/src/compass/types.test.ts +14 -0
- package/src/config/__tests__/resolve-terminology.test.ts +14 -0
- package/src/config/forge-config.test.ts +14 -0
- package/src/config/forge-config.ts +7 -2
- package/src/forge-module.test.ts +14 -0
- package/src/knowledge/__tests__/promote.test.ts +14 -0
- package/src/knowledge/__tests__/serialize.test.ts +14 -0
- package/src/knowledge/__tests__/sync.test.ts +4 -1
- package/src/knowledge/budgets.test.ts +14 -0
- package/src/knowledge/compact.test.ts +14 -0
- package/src/knowledge/parse.test.ts +14 -0
- package/src/knowledge/schema.test.ts +14 -0
- package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
- package/src/migration-adapters/__tests__/registry.test.ts +14 -0
- package/src/migration-adapters/__tests__/types.test.ts +14 -0
- package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
- package/src/onboarding/agents-generate.ts +1 -1
- package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
- package/src/onboarding/create.test.ts +14 -0
- package/src/onboarding/doctor-token-check.test.ts +3 -0
- package/src/onboarding/doctor.test.ts +14 -0
- package/src/onboarding/doctor.ts +3 -3
- package/src/onboarding/init.test.ts +14 -0
- package/src/onboarding/init.ts +2 -2
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/prettierignore.ts +1 -1
- package/src/onboarding/scaffold.test.ts +14 -0
- package/src/onboarding/site-workshop-profile.test.ts +3 -0
- package/src/onboarding/templates/behavioral-layer-core.md +8 -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/skill-schema.ts +9 -1
- 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/fixtures/agents-generate-business-before.txt +8 -0
- package/src/tests/forge-autonomy-validate.test.ts +3 -1
- package/src/tests/forge-config.test.ts +6 -1
- package/src/tests/forge-validate-compass-docs.test.ts +6 -0
- package/src/tests/fs-atomic.test.ts +14 -0
- package/src/tests/fs.test.ts +14 -0
- package/src/tests/generated-marker.test.ts +14 -0
- package/src/tests/hash.test.ts +14 -0
- package/src/tests/implement-stamp.test.ts +476 -10
- package/src/tests/init-bindings.test.ts +6 -1
- package/src/tests/knowledge-parse.test.ts +14 -0
- package/src/tests/knowledge-pbt.test.ts +14 -0
- package/src/tests/markdown-table.test.ts +6 -3
- package/src/tests/memory-compact.test.ts +3 -0
- package/src/tests/memory-scaffold.test.ts +6 -1
- package/src/tests/metrics-rfc-1053.test.ts +14 -0
- package/src/tests/migration-adapters.test.ts +3 -0
- package/src/tests/package-files.test.ts +4 -1
- package/src/tests/package-health-lint-surface.test.ts +3 -0
- package/src/tests/pinned-check.test.ts +14 -0
- package/src/tests/pinned-init.test.ts +14 -0
- package/src/tests/pinned-validate.test.ts +14 -0
- package/src/tests/plugin-manifest.test.ts +14 -0
- package/src/tests/prettierignore-manage.test.ts +3 -0
- package/src/tests/profile-schema.test.ts +6 -1
- package/src/tests/profile-validate.test.ts +6 -1
- package/src/tests/program-lease.test.ts +3 -0
- package/src/tests/program-paths-extended.test.ts +3 -0
- package/src/tests/program-paths.test.ts +3 -0
- package/src/tests/program-property.test.ts +3 -0
- package/src/tests/program-schemas.test.ts +3 -0
- package/src/tests/program-spec-node.test.ts +3 -0
- package/src/tests/promote.test.ts +14 -0
- package/src/tests/public-surface.test.ts +6 -1
- package/src/tests/registry.test.ts +14 -0
- package/src/tests/rfc-evidence-sync.test.ts +347 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
- package/src/tests/scaffold-project.test.ts +3 -0
- package/src/tests/session-handlers.test.ts +14 -0
- package/src/tests/session-pbt.test.ts +14 -0
- package/src/tests/skill-agents-sync.test.ts +3 -4
- package/src/tests/skill-schema.test.ts +53 -0
- package/src/tests/skill-sync-marker.test.ts +3 -0
- package/src/tests/skill-validate-knowledge.test.ts +14 -0
- package/src/tests/skill-validate.test.ts +14 -0
- package/src/tests/stack-profile.test.ts +6 -1
- package/src/tests/string-utils.test.ts +14 -0
- package/src/tests/upgrade.test.ts +6 -1
- package/src/tests/werkstatt-lock.test.ts +14 -0
- package/src/tests/workspace-discovery-domain.test.ts +6 -1
- package/src/tests/workspace-discovery.test.ts +6 -1
- package/src/types.test.ts +14 -0
- package/src/types.ts +30 -1
- package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
- package/src/utils/__tests__/fs-trash.test.ts +17 -0
- package/src/utils/fs-atomic.test.ts +17 -0
- package/src/utils/fs-trash-sync.test.ts +17 -0
- package/src/utils/fs.test.ts +17 -0
- package/src/utils/generated-marker.test.ts +17 -0
- package/src/utils/hash.test.ts +17 -0
- package/src/utils/string-utils.test.ts +17 -0
- package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for validate covering AV-16: implementation commit drift detection; ADR-DIR-01: directory structure convention (RFC-0722); AV-17: acceptance criteria completeness for implemented post-cutoff ADRs (RFC-0996).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1311: Compass header sweep — declares the validate suite's contract for test-file scaffold coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
import { test, expect, describe } from "vitest";
|
|
2
16
|
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
17
|
import { execSync, execFileSync } from "node:child_process";
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
comment-safety — the shared comment-terminator contract for Compass text
|
|
5
|
+
writers (RFC-1323). Owns CommentStyle detection plus the
|
|
6
|
+
findCompassTerminator/assertCompassCommentSafe/neutralizeCompassText triple:
|
|
7
|
+
authored text rejects with COMPASS-CS-08, injected free text neutralizes the
|
|
8
|
+
terminator pair into a non-terminating glyph, and the header-region scan
|
|
9
|
+
detects latent corruption in existing files.
|
|
10
|
+
</purpose>
|
|
11
|
+
<non-goals>
|
|
12
|
+
<item>Do not strip Compass tags from text — sanitizeItemText in summary-record.ts keeps that duty and delegates the terminator rewrite here.</item>
|
|
13
|
+
<item>Do not parse whole files — detection works on raw header-region text; parseCompassBlocks never sees the terminator that truncated its input.</item>
|
|
14
|
+
</non-goals>
|
|
15
|
+
</MODULE_CONTRACT>
|
|
16
|
+
<KEY_DECISIONS>
|
|
17
|
+
<item>Two policies: authored text throws COMPASS-CS-08 (author rewords); injected text neutralizes (operators cannot reword commit messages).</item>
|
|
18
|
+
<item>Neutralization swaps one ASCII glyph for its non-ASCII look-alike — byte-light, idempotent, can never re-form a terminator.</item>
|
|
19
|
+
<item>Scanning tracks tag state only inside comment spans; a terminator fires while a structural block tag stays unclosed.</item>
|
|
20
|
+
</KEY_DECISIONS>
|
|
21
|
+
<CHANGE_SUMMARY>
|
|
22
|
+
<item>RFC-1323: created — CommentStyle/commentStyleFor/getLineCommentPrefix/HEADER_SCAN_LINES consolidated here; terminator triple + CompassCommentSafetyError + header-region CS-08 scan.</item>
|
|
23
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
24
|
+
<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>
|
|
25
|
+
<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>
|
|
26
|
+
</CHANGE_SUMMARY>
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** The comment grammar a file's Compass header lives in. */
|
|
30
|
+
export type CommentStyle = "block" | "html" | "line";
|
|
31
|
+
|
|
32
|
+
/** Line-comment prefixes for prefix-run styles (.gd `#`, .tscn/.tres `;`). */
|
|
33
|
+
export function getLineCommentPrefix(filePath: string): string | null {
|
|
34
|
+
if (filePath.endsWith(".gd")) return "# ";
|
|
35
|
+
if (filePath.endsWith(".tscn") || filePath.endsWith(".tres")) return "; ";
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A CHANGE_SUMMARY/Compass block counts as a header only within this many
|
|
41
|
+
* lines from the file top — deeper matches are doc examples or template
|
|
42
|
+
* strings, not headers. Shared by the writer guards and the CS-08 scan.
|
|
43
|
+
*/
|
|
44
|
+
export const HEADER_SCAN_LINES = 120;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Comment styles a file type may carry, most likely first. .astro headers
|
|
48
|
+
* exist in both forms — block comments inside the `---` frontmatter and html
|
|
49
|
+
* comments in the markup below — so both are candidates at detection time.
|
|
50
|
+
*/
|
|
51
|
+
export function commentStyleCandidates(path: string): CommentStyle[] {
|
|
52
|
+
if (path.endsWith(".astro")) return ["block", "html"];
|
|
53
|
+
if (path.endsWith(".md")) return ["html"];
|
|
54
|
+
if (getLineCommentPrefix(path) !== null) return ["line"];
|
|
55
|
+
return ["block"];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function commentStyleFor(path: string): CommentStyle {
|
|
59
|
+
return commentStyleCandidates(path)[0]!;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The style of the comment that encloses `index` in `source` — the ground
|
|
64
|
+
* truth for edits inside an EXISTING header (record/trim/migrate), where
|
|
65
|
+
* commentStyleFor is only an extension guess. .astro is the case that
|
|
66
|
+
* matters: its header may sit in a `<!-- -->` markup comment while the
|
|
67
|
+
* extension table says "block".
|
|
68
|
+
*
|
|
69
|
+
* Detection replays the comment open/close tokens up to `index` — the
|
|
70
|
+
* nearest UNCLOSED opener wins. A `/*` literal inside an `<!-- -->` header's
|
|
71
|
+
* prose (or a `<!--` literal inside `/* */`) is inert text, not a state
|
|
72
|
+
* change, so it can never flip the detected style. Openers of styles the
|
|
73
|
+
* file type cannot carry are ignored entirely — a `/*` inside .md prose is
|
|
74
|
+
* literal text, never a comment.
|
|
75
|
+
*
|
|
76
|
+
* .astro zoning: a `/*` is a real comment only inside `---` frontmatter
|
|
77
|
+
* (the code region); `<!--` is real only outside it. In markup a `/*` is
|
|
78
|
+
* literal text and in frontmatter code a `<!--` can only be a string
|
|
79
|
+
* literal — counting either latches phantom state that hides the real
|
|
80
|
+
* header, the same class the CS-08 scanner resets on `---`. A comment
|
|
81
|
+
* still open at the closing fence is likewise a phantom and is reset —
|
|
82
|
+
* real frontmatter comments cannot span the fence (frontmatter is TS).
|
|
83
|
+
* Pure-block files (canHtml=false) never carry frontmatter, so `/*`
|
|
84
|
+
* counts anywhere there. No enclosing comment falls back to the
|
|
85
|
+
* extension table.
|
|
86
|
+
*/
|
|
87
|
+
const ENCLOSING_TOKEN_RE = /\*\/|\/\*|-->|<!--/g;
|
|
88
|
+
|
|
89
|
+
function leadingFrontmatterFenceEnd(source: string): number {
|
|
90
|
+
const open = /^---[ \t]*\r?\n/.exec(source);
|
|
91
|
+
if (!open) return -1;
|
|
92
|
+
const rest = /^---[ \t]*$/gm;
|
|
93
|
+
rest.lastIndex = open[0].length;
|
|
94
|
+
const close = rest.exec(source);
|
|
95
|
+
return close === null ? -1 : close.index + close[0].length;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function enclosingCommentStyle(source: string, index: number, path: string): CommentStyle {
|
|
99
|
+
if (getLineCommentPrefix(path) !== null) return "line";
|
|
100
|
+
const candidates = commentStyleCandidates(path);
|
|
101
|
+
const canBlock = candidates.includes("block");
|
|
102
|
+
const canHtml = candidates.includes("html");
|
|
103
|
+
const fenceEnd = canHtml ? leadingFrontmatterFenceEnd(source) : -1;
|
|
104
|
+
const hasFrontmatter = fenceEnd > 0;
|
|
105
|
+
let fenceCleared = false;
|
|
106
|
+
let inComment: "block" | "html" | null = null;
|
|
107
|
+
for (const m of source.slice(0, index).matchAll(ENCLOSING_TOKEN_RE)) {
|
|
108
|
+
const inFm = hasFrontmatter && m.index! < fenceEnd;
|
|
109
|
+
if (hasFrontmatter && !fenceCleared && !inFm) {
|
|
110
|
+
inComment = null;
|
|
111
|
+
fenceCleared = true;
|
|
112
|
+
}
|
|
113
|
+
const token = m[0];
|
|
114
|
+
const blockZone = canBlock && (!canHtml || inFm);
|
|
115
|
+
const htmlZone = canHtml && !inFm;
|
|
116
|
+
if (inComment === null) {
|
|
117
|
+
if (token === "/*" && blockZone) inComment = "block";
|
|
118
|
+
else if (token === "<!--" && htmlZone) inComment = "html";
|
|
119
|
+
} else if (inComment === "block" && token === "*/") {
|
|
120
|
+
inComment = null;
|
|
121
|
+
} else if (inComment === "html" && token === "-->") {
|
|
122
|
+
inComment = null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return inComment ?? commentStyleFor(path);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sequences that terminate or corrupt a comment of the given style when they
|
|
130
|
+
* appear inside its text. Line comments have no embedded terminator — a
|
|
131
|
+
* newline is structural and already handled by line-item formatting.
|
|
132
|
+
*/
|
|
133
|
+
const COMPASS_TERMINATORS: Record<CommentStyle, readonly string[]> = {
|
|
134
|
+
block: ["*/"],
|
|
135
|
+
html: ["-->", "<!--"],
|
|
136
|
+
line: [],
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The neutralization table (decided at session-20261017-1943, Q-5): each
|
|
141
|
+
* terminator loses one ASCII glyph to its non-ASCII look-alike. The result is
|
|
142
|
+
* byte-preserving except the glyph and idempotent — the substitutes can never
|
|
143
|
+
* re-form a terminator on a second pass.
|
|
144
|
+
*/
|
|
145
|
+
const NEUTRALIZATION: Record<CommentStyle, ReadonlyArray<readonly [string, string]>> = {
|
|
146
|
+
block: [["*/", "*∕"]], // solidus / → ∕ U+2215
|
|
147
|
+
html: [
|
|
148
|
+
["-->", "--›"], // > → › U+203A
|
|
149
|
+
["<!--", "‹!--"], // < → ‹ U+2039
|
|
150
|
+
],
|
|
151
|
+
line: [],
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* First terminator present in `text` for the style, or null. Scans raw text —
|
|
156
|
+
* a terminator inside a quoted example still counts (conservative; authors
|
|
157
|
+
* reword).
|
|
158
|
+
*/
|
|
159
|
+
export function findCompassTerminator(text: string, style: CommentStyle): string | null {
|
|
160
|
+
for (const terminator of COMPASS_TERMINATORS[style]) {
|
|
161
|
+
if (text.includes(terminator)) return terminator;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** COMPASS-CS-08 payload carried by authored-surface rejections. */
|
|
167
|
+
export class CompassCommentSafetyError extends Error {
|
|
168
|
+
readonly ruleId = "COMPASS-CS-08" as const;
|
|
169
|
+
readonly substring: string;
|
|
170
|
+
readonly file?: string;
|
|
171
|
+
readonly block?: string;
|
|
172
|
+
readonly fixHint: string;
|
|
173
|
+
|
|
174
|
+
constructor(substring: string, context?: { file?: string; block?: string }) {
|
|
175
|
+
const where = [context?.file, context?.block].filter(Boolean).join(" / ");
|
|
176
|
+
super(
|
|
177
|
+
`COMPASS-CS-08: comment-close sequence "${substring}" in Compass block text${where ? ` (${where})` : ""}`,
|
|
178
|
+
);
|
|
179
|
+
this.name = "CompassCommentSafetyError";
|
|
180
|
+
this.substring = substring;
|
|
181
|
+
this.file = context?.file;
|
|
182
|
+
this.block = context?.block;
|
|
183
|
+
this.fixHint =
|
|
184
|
+
"Reword so the terminator pair never appears: space the glyphs apart, describe the path without the glob (e.g. packages/<pkg>/AGENTS.md), or XML-escape the characters. Injected text (commit messages) is neutralized automatically instead of rejected.";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Fail-closed guard for authored Compass block text — throws
|
|
190
|
+
* CompassCommentSafetyError (COMPASS-CS-08) when `text` carries the style's
|
|
191
|
+
* terminator. Call at emission time, before the text lands in a comment.
|
|
192
|
+
*/
|
|
193
|
+
export function assertCompassCommentSafe(
|
|
194
|
+
text: string,
|
|
195
|
+
style: CommentStyle,
|
|
196
|
+
context?: { file?: string; block?: string },
|
|
197
|
+
): void {
|
|
198
|
+
const substring = findCompassTerminator(text, style);
|
|
199
|
+
if (substring !== null) {
|
|
200
|
+
throw new CompassCommentSafetyError(substring, context);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Style-aware terminator neutralization for injected free text — rewrites
|
|
206
|
+
* each terminator pair into its visually-identical non-terminating form and
|
|
207
|
+
* reports whether the text changed. Second pass is a no-op.
|
|
208
|
+
*/
|
|
209
|
+
export function neutralizeCompassText(
|
|
210
|
+
text: string,
|
|
211
|
+
style: CommentStyle,
|
|
212
|
+
): { text: string; neutralized: boolean } {
|
|
213
|
+
let out = text;
|
|
214
|
+
for (const [from, to] of NEUTRALIZATION[style]) {
|
|
215
|
+
out = out.replaceAll(from, to);
|
|
216
|
+
}
|
|
217
|
+
return { text: out, neutralized: out !== text };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Compass tags whose open state decides whether a close marker is a legal
|
|
222
|
+
* comment end or corruption — the outer block tags plus the nested tags that
|
|
223
|
+
* can still be open when the truncation lands.
|
|
224
|
+
*/
|
|
225
|
+
const COMPASS_INNER_TAGS = [
|
|
226
|
+
"MODULE_CONTRACT",
|
|
227
|
+
"KEY_DECISIONS",
|
|
228
|
+
"CHANGE_SUMMARY",
|
|
229
|
+
"purpose",
|
|
230
|
+
"non-goals",
|
|
231
|
+
"item",
|
|
232
|
+
"history",
|
|
233
|
+
] as const;
|
|
234
|
+
|
|
235
|
+
/** Top-level Compass block tags — a truncation only counts while one is open. */
|
|
236
|
+
const COMPASS_STRUCTURAL_TAGS = ["MODULE_CONTRACT", "KEY_DECISIONS", "CHANGE_SUMMARY"] as const;
|
|
237
|
+
|
|
238
|
+
const CS08_TOKEN_RE = new RegExp(
|
|
239
|
+
`<(?:${COMPASS_INNER_TAGS.join("|")})>|</(?:${COMPASS_INNER_TAGS.join("|")})>|\\*\\/|\\/\\*|-->|<!--|^---[^\\S\\n]*$`,
|
|
240
|
+
"gm",
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
export interface CompassTerminatorHit {
|
|
244
|
+
substring: string;
|
|
245
|
+
/** UTF-16 code-unit offset of the terminator inside the scanned region. */
|
|
246
|
+
offset: number;
|
|
247
|
+
/** 1-based line number. */
|
|
248
|
+
line: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* COMPASS-CS-08 scan over the raw header region: the style's close marker
|
|
253
|
+
* appearing while a Compass inner tag is still unclosed means the comment was
|
|
254
|
+
* truncated mid-block — the corrupted tail is invisible to parseCompassBlocks,
|
|
255
|
+
* so detection must run on raw text.
|
|
256
|
+
*
|
|
257
|
+
* Tag state is tracked only INSIDE comment spans: once the header comment
|
|
258
|
+
* closes, tag-shaped literals in code strings and regexes are inert noise.
|
|
259
|
+
* `/*` opens a block region for block-capable files, `<!--` for html-capable
|
|
260
|
+
* ones; the style's close marker exits the region — firing instead when tags
|
|
261
|
+
* are still open. The close landing with every tag closed is the comment's
|
|
262
|
+
* legitimate own close and never fires.
|
|
263
|
+
*
|
|
264
|
+
* For .astro both candidate comment styles are recognized — either header
|
|
265
|
+
* form can be corrupted. Line-style files carry no embedded terminator and
|
|
266
|
+
* are never flagged. `---`-only lines (frontmatter fences, horizontal
|
|
267
|
+
* rules) reset a comment state that holds no open Compass tags: a `/*` or
|
|
268
|
+
* `<!--` token inside frontmatter code (string/regex/division) is phantom
|
|
269
|
+
* state, not a comment span.
|
|
270
|
+
*/
|
|
271
|
+
export function findCompassTerminatorInHeader(
|
|
272
|
+
source: string,
|
|
273
|
+
path: string,
|
|
274
|
+
): CompassTerminatorHit | null {
|
|
275
|
+
const region = source.split("\n").slice(0, HEADER_SCAN_LINES).join("\n");
|
|
276
|
+
const styles = commentStyleCandidates(path);
|
|
277
|
+
const canBlock = styles.includes("block");
|
|
278
|
+
const canHtml = styles.includes("html");
|
|
279
|
+
if (!canBlock && !canHtml) return null;
|
|
280
|
+
|
|
281
|
+
let inComment: "block" | "html" | null = null;
|
|
282
|
+
const open = new Set<string>();
|
|
283
|
+
for (const m of region.matchAll(CS08_TOKEN_RE)) {
|
|
284
|
+
const token = m[0];
|
|
285
|
+
// Frontmatter/horizontal-rule fence: a `---`-only line while a comment
|
|
286
|
+
// holds NO open Compass tags must be phantom comment state (a `/*` or
|
|
287
|
+
// `<!--` inside a code string/regex latched it) — resetting restores
|
|
288
|
+
// visibility of the real header below. With tags open the line is
|
|
289
|
+
// comment content and state is preserved.
|
|
290
|
+
if (token.startsWith("---") && inComment !== null && open.size === 0) {
|
|
291
|
+
inComment = null;
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (inComment === null) {
|
|
295
|
+
if (token === "/*" && canBlock) inComment = "block";
|
|
296
|
+
else if (token === "<!--" && canHtml) inComment = "html";
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const terms = COMPASS_TERMINATORS[inComment];
|
|
300
|
+
if (terms.includes(token)) {
|
|
301
|
+
// A terminator while a STRUCTURAL Compass block tag remains open —
|
|
302
|
+
// mid-block truncation. A bare <item>/<purpose> in a doc comment is not
|
|
303
|
+
// a Compass block (inner tags only nest inside a structural parent), so
|
|
304
|
+
// those alone never fire.
|
|
305
|
+
if (COMPASS_STRUCTURAL_TAGS.some((tag) => open.has(tag))) {
|
|
306
|
+
const offset = m.index!;
|
|
307
|
+
return {
|
|
308
|
+
substring: token,
|
|
309
|
+
offset,
|
|
310
|
+
line: region.slice(0, offset).split("\n").length,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
// Legal own-close exits the region (open must not leak into the next
|
|
314
|
+
// comment's state); a nested html opener inside a clean html comment
|
|
315
|
+
// is stray but cannot have truncated Compass tags.
|
|
316
|
+
if (token === "*/" || token === "-->") {
|
|
317
|
+
inComment = null;
|
|
318
|
+
open.clear();
|
|
319
|
+
}
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
// Inner-tag open/close — only Compass names are tracked; angle tokens of
|
|
323
|
+
// other shapes (an html opener scanned inside a block comment, generic
|
|
324
|
+
// markup) keep out of the set.
|
|
325
|
+
const name = token.replace(/^<\/?/, "").replace(/>$/, "");
|
|
326
|
+
if (!(COMPASS_INNER_TAGS as readonly string[]).includes(name)) continue;
|
|
327
|
+
if (token.startsWith("</")) open.delete(name);
|
|
328
|
+
else open.add(name);
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)</item>
|
|
10
|
-
<item>KERNEL-FLAG-02: Declare compass --root as kind "string[]" — resolveScanRoots reads it as multi-value via getFlagValues, so repeated --root stays legal now that repeated kind-"string" flags are rejected at flag resolution.</item>
|
|
11
9
|
<item>RFC-1231: step 1 — rename supportsAllSites to acceptsAllFlag
|
|
12
10
|
|
|
13
11
|
Mechanical sweep: the field only ever gated --all argv acceptance; fan-out
|
|
@@ -16,7 +14,9 @@ assertAllFlagAccepted, message updated. 417 declaration sites + type
|
|
|
16
14
|
surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.</item>
|
|
17
15
|
<item>RFC-1248: VITE-CLIENT-DEP-02 lazy-import gate + SCAN-02 validator reads-root existence check (RFC-1248)</item>
|
|
18
16
|
<item>RFC-1251: step 3 — diagnostic.rule-id.validate gate + RULEID-CANONICAL-01, pipeline-wired</item>
|
|
19
|
-
<
|
|
17
|
+
<item>RFC-1318: add compass.header.scaffold codemod for mechanical header sweeps</item>
|
|
18
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
19
|
+
<history>KERNEL-FLAG-02, RFC-0374, RFC-0538, RFC-0556, RFC-1095, RFC-1097, RFC-1173, RFC-1242</history>
|
|
20
20
|
</CHANGE_SUMMARY>
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { runCompassSummaryTrim } from "./handlers/compass-change-summary-handler.ts";
|
|
33
33
|
import { runCompassSummaryRecord } from "./handlers/summary-record.ts";
|
|
34
34
|
import { runCompassMigrate } from "./handlers/compass-migrate-handler.ts";
|
|
35
|
+
import { runCompassHeaderScaffold } from "./handlers/compass-header-scaffold-handler.ts";
|
|
35
36
|
import { runCompassDocsValidate } from "./handlers/compass-docs-validate.ts";
|
|
36
37
|
import { runCompassDocsScaffold } from "./handlers/compass-docs-scaffold.ts";
|
|
37
38
|
|
|
@@ -86,7 +87,9 @@ export const forgeCompassModule: ForgeModule = {
|
|
|
86
87
|
name: "compass.validate",
|
|
87
88
|
mutatesState: false,
|
|
88
89
|
contract: "compass",
|
|
89
|
-
|
|
90
|
+
// RFC-1323: first declared CS-family id — sibling CS-05/06/07 stay
|
|
91
|
+
// undeclared (pre-existing inconsistency the RFC does not backfill).
|
|
92
|
+
rules: ["COMPASS-CS-08"],
|
|
90
93
|
description:
|
|
91
94
|
"Validate authored source files against current Compass scaffolding requirements.",
|
|
92
95
|
scope: "workspace",
|
|
@@ -137,6 +140,11 @@ export const forgeCompassModule: ForgeModule = {
|
|
|
137
140
|
description:
|
|
138
141
|
"Item description. Default: commit subject minus conventional prefix; bare ID outside commit context.",
|
|
139
142
|
},
|
|
143
|
+
injected: {
|
|
144
|
+
kind: "boolean",
|
|
145
|
+
description:
|
|
146
|
+
"RFC-1323: mark --text as machine-piped free text (commit messages) — comment terminators are neutralized instead of rejected with COMPASS-CS-08, and the write reports `neutralized` per file.",
|
|
147
|
+
},
|
|
140
148
|
},
|
|
141
149
|
execute: runCompassSummaryRecord,
|
|
142
150
|
},
|
|
@@ -205,6 +213,44 @@ export const forgeCompassModule: ForgeModule = {
|
|
|
205
213
|
},
|
|
206
214
|
execute: runCompassMigrate,
|
|
207
215
|
},
|
|
216
|
+
{
|
|
217
|
+
name: "compass.header.scaffold",
|
|
218
|
+
coverage: "operator" as const,
|
|
219
|
+
description:
|
|
220
|
+
"Author and repair Compass v2 headers (RFC-1318): append-only merge, closed-block guarantee, derived-or-sentinel purposes, fixture-string safety (SCAFFOLD-01), high-risk deference. --census reports the coverage manifest without writing; apply refuses when target files carry uncommitted changes unless --force.",
|
|
221
|
+
scope: "workspace",
|
|
222
|
+
mutatesState: true,
|
|
223
|
+
acceptsAllFlag: true,
|
|
224
|
+
writes: [
|
|
225
|
+
"apps/**/*.{astro,ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
226
|
+
"packages/**/*.{astro,ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
227
|
+
"services/**/*.{ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
228
|
+
],
|
|
229
|
+
generates: [],
|
|
230
|
+
reads: [
|
|
231
|
+
"packages/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
232
|
+
"apps/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
233
|
+
"services/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
234
|
+
],
|
|
235
|
+
cacheable: false,
|
|
236
|
+
flags: {
|
|
237
|
+
...compassScanFlags,
|
|
238
|
+
files: {
|
|
239
|
+
kind: "string[]",
|
|
240
|
+
description: "Explicit root-relative file list — bypasses scan-root filtering entirely.",
|
|
241
|
+
},
|
|
242
|
+
census: {
|
|
243
|
+
kind: "boolean",
|
|
244
|
+
description:
|
|
245
|
+
"Report per-package uncovered/malformed/clean counts through the same discovery and disposition pipeline — performs no writes and never refuses on a dirty tree.",
|
|
246
|
+
},
|
|
247
|
+
force: {
|
|
248
|
+
kind: "boolean",
|
|
249
|
+
description: "Override the dirty-target refusal (apply mode only).",
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
execute: runCompassHeaderScaffold,
|
|
253
|
+
},
|
|
208
254
|
{
|
|
209
255
|
name: "compass.audit.plan",
|
|
210
256
|
coverage: "operator" as const,
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
</non-goals>
|
|
11
11
|
</MODULE_CONTRACT>
|
|
12
12
|
<CHANGE_SUMMARY>
|
|
13
|
-
<item>RFC-0538: renamed compass.changesummary.tidy to compass.summary.trim, raised cap from 3 unprotected to 30 total items, aligned validate cap to 30 total.</item>
|
|
14
|
-
<item>RFC-0556: moved from @warpgogol/site-kernel-checks to @warpgogol/forge for autonomous mode.</item>
|
|
15
|
-
<item>RFC-1094: --mode flag; mode-aware COMPASS-CS-05/06/07 diagnostics via shared evaluateV2Rules; PROTECTED_RE now aliases GOVERNANCE_ID_RE.</item>
|
|
16
|
-
<item>RFC-1095: rewrote trim as v2 repair (collapse >5 described items into history, remove ID-less items, normalize history); removed compass.changesummary.validate and the classify machinery (classifyChangeSummaryItem, PROTECTED_RE, BOILERPLATE_RE).</item>
|
|
17
13
|
<item>RFC-1095: compass.summary.record, trim repair rewrite, commit integration</item>
|
|
18
|
-
<
|
|
14
|
+
<item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
|
|
15
|
+
<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>
|
|
16
|
+
<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>
|
|
17
|
+
<item>RFC-1323: final review nits — existing-item ordering, fail enum convention, trim skippedUnsafe coverage</item>
|
|
18
|
+
<history>RFC-0349, RFC-0538, RFC-0556, RFC-1094, RFC-1095</history>
|
|
19
19
|
</CHANGE_SUMMARY>
|
|
20
20
|
*/
|
|
21
21
|
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
mergeHistoryIds,
|
|
33
33
|
parseChangeSummary,
|
|
34
34
|
} from "./summary-record.ts";
|
|
35
|
+
import { enclosingCommentStyle, CompassCommentSafetyError } from "../comment-safety.ts";
|
|
35
36
|
import type {
|
|
36
37
|
ForgeCommandInput,
|
|
37
38
|
ForgeCommandResult,
|
|
@@ -46,8 +47,9 @@ export async function runCompassSummaryTrim(
|
|
|
46
47
|
): Promise<
|
|
47
48
|
ForgeCommandResult<{
|
|
48
49
|
command: string;
|
|
49
|
-
status: "ok";
|
|
50
|
+
status: "ok" | "fail";
|
|
50
51
|
files: Array<{ path: string; removed: string[]; kept: number }>;
|
|
52
|
+
skippedUnsafe: string[];
|
|
51
53
|
}>
|
|
52
54
|
> {
|
|
53
55
|
const io = resolveIo(context.io);
|
|
@@ -74,6 +76,7 @@ export async function runCompassSummaryTrim(
|
|
|
74
76
|
);
|
|
75
77
|
|
|
76
78
|
const results: Array<{ path: string; removed: string[]; kept: number }> = [];
|
|
79
|
+
const skippedUnsafe: string[] = [];
|
|
77
80
|
|
|
78
81
|
for (const entry of entries) {
|
|
79
82
|
if (entry.authoringStatus !== "authored" || entry.requiredScaffolding === "none") {
|
|
@@ -118,8 +121,28 @@ export async function runCompassSummaryTrim(
|
|
|
118
121
|
continue;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
// RFC-1323: the emission assert uses the style of the comment actually
|
|
125
|
+
// enclosing the block — .astro can carry an html header the extension
|
|
126
|
+
// table does not predict. A re-emitted item carrying the style's
|
|
127
|
+
// terminator means the file's own text is unsafe — skip it per file so
|
|
128
|
+
// one bad block never aborts the batch after earlier writes.
|
|
129
|
+
let transformed: string;
|
|
130
|
+
try {
|
|
131
|
+
const newBlock = buildChangeSummaryBlock(
|
|
132
|
+
idItems,
|
|
133
|
+
nextHistory,
|
|
134
|
+
entry.path,
|
|
135
|
+
enclosingCommentStyle(source, blockMatch.index!, entry.path),
|
|
136
|
+
);
|
|
137
|
+
transformed = source.replace(CHANGE_SUMMARY_BLOCK_RE, newBlock);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err instanceof CompassCommentSafetyError) {
|
|
140
|
+
skippedUnsafe.push(entry.path);
|
|
141
|
+
context.logger.warn(`[compass.summary.trim] skipped ${entry.path}: ${err.message}`);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
throw err;
|
|
145
|
+
}
|
|
123
146
|
|
|
124
147
|
if (transformed === source) {
|
|
125
148
|
continue;
|
|
@@ -143,11 +166,18 @@ export async function runCompassSummaryTrim(
|
|
|
143
166
|
return {
|
|
144
167
|
data: {
|
|
145
168
|
command: "compass.summary.trim",
|
|
146
|
-
status: "ok",
|
|
169
|
+
status: skippedUnsafe.length > 0 ? "fail" : "ok",
|
|
147
170
|
files: results,
|
|
171
|
+
skippedUnsafe,
|
|
148
172
|
},
|
|
149
|
-
|
|
150
|
-
|
|
173
|
+
// Same CS-08 contract as migrate and scaffold-apply: an unsafe file is
|
|
174
|
+
// corruption, not advisory debt — the run fails closed and names it.
|
|
175
|
+
exitCode: skippedUnsafe.length > 0 ? 1 : 0,
|
|
176
|
+
summary:
|
|
177
|
+
`[compass.summary.trim] files=${results.length}, removed=${results.reduce((sum, r) => sum + r.removed.length, 0)}` +
|
|
178
|
+
(skippedUnsafe.length > 0
|
|
179
|
+
? `, skipped-unsafe=${skippedUnsafe.length}: ${skippedUnsafe.join(", ")}`
|
|
180
|
+
: ""),
|
|
151
181
|
nextSteps: [
|
|
152
182
|
{
|
|
153
183
|
action: `Commit the repaired headers: pnpm exec forge run ecosystem.commit`,
|