@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
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,53 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
For the full commit history, see the [GitHub releases page](https://github.com/syrokomskyi/forge/releases).
|
|
8
8
|
|
|
9
|
+
## [8.0.2] — 2026-10-19
|
|
10
|
+
|
|
11
|
+
_Major line 8: verification evidence is now checked against git history and independent verification. `rfc.implement.stamp` gains blocking gates (RFC-IMP-10/11/12), and the `amend` command family is removed. 8.0.0 and 8.0.1 were never published; 8.0.2 is the first 8.x release on npm._
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Git-derived probe origin** (`os/rfc/verification-origin.ts`): every probe in the verification envelope carries a derived origin (`self`, `verifier`, `unchanged`, `unresolved`, `presence`), computed from the range between the `status: accepted` transition and HEAD. V-44 rejects WHEN/IF criteria that are evidenced only by presence probes.
|
|
16
|
+
- **Stamp gates**: RFC-IMP-10 blocks a declared `expectationSource` that git contradicts. RFC-IMP-11 blocks `verificationTier: high` RFCs when a behavioral criterion has no non-self probe. RFC-IMP-12 requires a committed, passing, subagent-isolated acceptance-verification report; the operator can waive it with `--waive-independent-verification`.
|
|
17
|
+
- **`rfc.verify.workspace`**: exports a committed candidate as a tree without git metadata, with self-authored tests and RFC plan, review and session documents removed, for independent acceptance verification.
|
|
18
|
+
- **`probe: reachable`** (symbol and command modes), plus a V-45 warning for exported symbols that nothing reaches.
|
|
19
|
+
- **`verifyReproduction` binding** and reason-gated test guidance in `fo-idea-implement`, `fo-add-tests` and `fo-fix`. Acceptance-verification mode in `fo-review`.
|
|
20
|
+
- **`rfc.implement.stamp --check-criteria`** flips evidenced criteria atomically with the stamp. **`rfc.evidence.sync`** resyncs evidence in one command. **`compass.header.scaffold`** codemod.
|
|
21
|
+
- **Compass comment-terminator safety** (COMPASS-CS-08): authored text that would end a comment early is rejected, injected text is neutralized, and `summary.record` reports `neutralized`.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- `rfc.verification.emit` checks that generated artifacts are fresh (EVIDENCE-FRESH-01/02/03).
|
|
26
|
+
- Governance ids are matched case-insensitively.
|
|
27
|
+
- Git subprocesses ignore repository-locating `GIT_*` variables inherited from the environment.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- The `amend` command family.
|
|
32
|
+
|
|
33
|
+
## [7.0.0] — 2026-10-13
|
|
34
|
+
|
|
35
|
+
_Major: `rfc.implement.stamp` now enforces the RFC-IMP-09 stale-evidence gate and writes the verification envelope itself — the stamp contract and its declared `writes[]` change. The agent operating model ships as a synced normative document and reaches generated `AGENTS.md`._
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **Evidence-driven agent operating model** (`skills/_shared/agent-operating-model.md`, synced to `.agents/skills/_shared/` by `forge upgrade`): EXPLORE/ROUTINE/GOVERNED work modes, authority boundaries and escalation triggers, a proportionate verification portfolio (STANDARD/HIGH/FORMAL tiers — proportionate checks, not mandatory TDD), expectation-source classes for probes, the evidence trust boundary, and the IMPLEMENTED/VERIFIED/ACCEPTED/RELEASED completion vocabulary
|
|
40
|
+
- **RFC-IMP-09 stale-evidence gate** in `rfc.implement.stamp`: recomputes `rfcFileHash` + `acceptanceHash` before mutation and blocks on mismatch, missing hash fields, post-emit probe deletion, or malformed/non-object envelopes (fail-closed)
|
|
41
|
+
- **Post-stamp evidence re-emit**: stamping a probe-bearing RFC re-emits its verification envelope in-process after the frontmatter mutation — a stamped RFC never ships a born-stale envelope (`evidenceReEmitted` in the result payload)
|
|
42
|
+
- **`rfc.verification.emit --check`**: recomputes evidence and compares the committed envelope on non-volatile fields (`rfcFileHash`, `acceptanceHash`, `probes.length`, `probes[].ok`, `overall`) — exits non-zero with named `mismatches` on divergence or a missing envelope; no writes
|
|
43
|
+
- **Probe metadata**: optional `expectationSource` (`self|requirement|independent|external`) and `limitations` on every acceptance-probe kind; optional RFC frontmatter `verificationTier` (`standard|high|formal`, V-43)
|
|
44
|
+
- **Skill schema**: optional `notApplicableWhen` and `costNotes` frontmatter fields; `fo-idea` declares `notApplicableWhen` and labels its routing outcomes with work modes
|
|
45
|
+
- **Behavioral layer**: generated `AGENTS.md` gains a "Work modes and completion vocabulary" section
|
|
46
|
+
- **V-23 archive exemption**: `docs/rfcs/archive/**` no longer blocks validation on historical failed envelopes (archive-freeze precedent)
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- `normalizeProbes` serialization is now a full recursive key sort with no key filtering — `acceptanceHash` binds the complete probe identity including nested `expect`/`schemaInline` fields; exported for the stamp-side recompute (envelopes emitted before 7.0.0 read as stale once — one `rfc.verification.emit` re-emit heals them)
|
|
51
|
+
- `rfc.implement.stamp` declares `docs/rfcs/verification/*.generated.yaml` in `writes[]` (it owns the post-stamp re-emit)
|
|
52
|
+
- EXPLORE-mode gloss aligned across the behavioral template and the normative document: isolated-scope experiments permitted, no writes to durable surfaces
|
|
53
|
+
- RFC template probe examples carry `criterion:` bindings and the `werkstatt run` command prefix required by the shape validator
|
|
54
|
+
- `rfc.implement.stamp` repair hints name the real fixes (re-emit; for probe deletion: restore probes first or remove the stale envelope)
|
|
55
|
+
|
|
9
56
|
## [6.3.6] — 2026-10-12
|
|
10
57
|
|
|
11
58
|
### Fixed
|
package/README.md
CHANGED
|
@@ -143,6 +143,7 @@ Agents can change. Models can change. IDEs can change. Engineering rules stay wi
|
|
|
143
143
|
- **Workflow linting** — validate `.agents/workflows/` frontmatter
|
|
144
144
|
- **Stack scaffolding** — pnpm + Turborepo monorepo from a profile
|
|
145
145
|
- **Bindings contract** — de-hardcode project-specific commands via `forge.yaml`
|
|
146
|
+
- **Agent operating model** — EXPLORE/ROUTINE/GOVERNED work modes with explicit authority boundaries (the operator owns intent and significant decisions; the agent owns implementation inside them, and escalates rather than guesses when a boundary is crossed), a proportionate verification portfolio with tiers (tests are one tool — rigor scales to risk, not a mandatory-TDD rule; skills declare `notApplicableWhen`/`costNotes` so a mismatching skill is not force-applied), and separated completion vocabulary (IMPLEMENTED / VERIFIED / ACCEPTED / RELEASED), shipped as a shared skill and synced by `forge upgrade`
|
|
146
147
|
- **Doctor** — project health check
|
|
147
148
|
- **Upgrade** — additive, idempotent skill and config sync
|
|
148
149
|
|
|
@@ -156,7 +157,7 @@ Forge works with any AI agent — Windsurf, Cursor, Claude Code, Codex CLI, or a
|
|
|
156
157
|
|
|
157
158
|
**Describe results, not steps.** Tell the agent what you want, not how to do it. For complex work, ask the agent to plan first and wait for your approval.
|
|
158
159
|
|
|
159
|
-
**Let the agent verify its own work.** Give criteria for "done" and let the agent check itself: "Run the tests after you're done." "Validate the RFC before committing." "Check project health with `forge doctor`."
|
|
160
|
+
**Let the agent verify its own work.** Give criteria for "done" and let the agent check itself: "Run the tests after you're done." "Validate the RFC before committing." "Check project health with `forge doctor`." Forge's operating model teaches agents to report IMPLEMENTED vs VERIFIED vs ACCEPTED separately — a claim never outruns its evidence.
|
|
160
161
|
|
|
161
162
|
**AGENTS.md is your project's persistent memory.** Forge generates `AGENTS.md` files that the agent reads at the start of every session. Put build commands, code style, architecture decisions, and "do X, not Y" rules there.
|
|
162
163
|
|
package/bin/cli.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
-
import { dirname
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { resolveForgeEntry } from "./resolve-entry.js";
|
|
6
7
|
|
|
7
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const
|
|
9
|
-
const srcEntry = resolve(__dirname, "cli.ts");
|
|
9
|
+
const entry = resolveForgeEntry(__dirname, existsSync);
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const insideNodeModules = __dirname.split(sep).includes("node_modules");
|
|
14
|
-
|
|
15
|
-
if (existsSync(distEntry)) {
|
|
16
|
-
await import(pathToFileURL(distEntry).href);
|
|
17
|
-
} else if (!insideNodeModules) {
|
|
18
|
-
await import(pathToFileURL(srcEntry).href);
|
|
11
|
+
if (entry.kind !== "tsx") {
|
|
12
|
+
await import(pathToFileURL(entry.path).href);
|
|
19
13
|
} else {
|
|
20
14
|
// Installed package without a built dist/ — run the TS entry through tsx.
|
|
21
|
-
const result = spawnSync("npx", ["--yes", "tsx",
|
|
15
|
+
const result = spawnSync("npx", ["--yes", "tsx", entry.path, ...process.argv.slice(2)], {
|
|
22
16
|
stdio: "inherit",
|
|
23
17
|
});
|
|
24
18
|
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolve, sep } from "node:path";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pick the forge CLI entry for a given bin directory (RFC-1302).
|
|
5
|
+
*
|
|
6
|
+
* A source checkout (bin not inside node_modules) always runs the TS
|
|
7
|
+
* source: a gitignored dist/ there is never rebuilt by the dogfooding
|
|
8
|
+
* workflow and silently goes stale. Installed packages prefer the built
|
|
9
|
+
* dist/; without it they fall back to tsx.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} binDir
|
|
12
|
+
* @param {(path: string) => boolean} exists
|
|
13
|
+
* @returns {{ kind: "src" | "dist" | "tsx", path: string }}
|
|
14
|
+
*/
|
|
15
|
+
export function resolveForgeEntry(binDir, exists) {
|
|
16
|
+
const distEntry = resolve(binDir, "..", "dist", "bin", "cli.js");
|
|
17
|
+
const srcEntry = resolve(binDir, "cli.ts");
|
|
18
|
+
// Node type stripping is disabled inside node_modules — a bare
|
|
19
|
+
// `import cli.ts` works only in a source checkout, not for npm consumers.
|
|
20
|
+
const insideNodeModules = binDir.split(sep).includes("node_modules");
|
|
21
|
+
if (!insideNodeModules && exists(srcEntry)) return { kind: "src", path: srcEntry };
|
|
22
|
+
if (exists(distEntry)) return { kind: "dist", path: distEntry };
|
|
23
|
+
return { kind: "tsx", path: srcEntry };
|
|
24
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** The comment grammar a file's Compass header lives in. */
|
|
2
|
+
export type CommentStyle = "block" | "html" | "line";
|
|
3
|
+
/** Line-comment prefixes for prefix-run styles (.gd `#`, .tscn/.tres `;`). */
|
|
4
|
+
export declare function getLineCommentPrefix(filePath: string): string | null;
|
|
5
|
+
/**
|
|
6
|
+
* A CHANGE_SUMMARY/Compass block counts as a header only within this many
|
|
7
|
+
* lines from the file top — deeper matches are doc examples or template
|
|
8
|
+
* strings, not headers. Shared by the writer guards and the CS-08 scan.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HEADER_SCAN_LINES = 120;
|
|
11
|
+
/**
|
|
12
|
+
* Comment styles a file type may carry, most likely first. .astro headers
|
|
13
|
+
* exist in both forms — block comments inside the `---` frontmatter and html
|
|
14
|
+
* comments in the markup below — so both are candidates at detection time.
|
|
15
|
+
*/
|
|
16
|
+
export declare function commentStyleCandidates(path: string): CommentStyle[];
|
|
17
|
+
export declare function commentStyleFor(path: string): CommentStyle;
|
|
18
|
+
export declare function enclosingCommentStyle(source: string, index: number, path: string): CommentStyle;
|
|
19
|
+
/**
|
|
20
|
+
* First terminator present in `text` for the style, or null. Scans raw text —
|
|
21
|
+
* a terminator inside a quoted example still counts (conservative; authors
|
|
22
|
+
* reword).
|
|
23
|
+
*/
|
|
24
|
+
export declare function findCompassTerminator(text: string, style: CommentStyle): string | null;
|
|
25
|
+
/** COMPASS-CS-08 payload carried by authored-surface rejections. */
|
|
26
|
+
export declare class CompassCommentSafetyError extends Error {
|
|
27
|
+
readonly ruleId: "COMPASS-CS-08";
|
|
28
|
+
readonly substring: string;
|
|
29
|
+
readonly file?: string;
|
|
30
|
+
readonly block?: string;
|
|
31
|
+
readonly fixHint: string;
|
|
32
|
+
constructor(substring: string, context?: {
|
|
33
|
+
file?: string;
|
|
34
|
+
block?: string;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fail-closed guard for authored Compass block text — throws
|
|
39
|
+
* CompassCommentSafetyError (COMPASS-CS-08) when `text` carries the style's
|
|
40
|
+
* terminator. Call at emission time, before the text lands in a comment.
|
|
41
|
+
*/
|
|
42
|
+
export declare function assertCompassCommentSafe(text: string, style: CommentStyle, context?: {
|
|
43
|
+
file?: string;
|
|
44
|
+
block?: string;
|
|
45
|
+
}): void;
|
|
46
|
+
/**
|
|
47
|
+
* Style-aware terminator neutralization for injected free text — rewrites
|
|
48
|
+
* each terminator pair into its visually-identical non-terminating form and
|
|
49
|
+
* reports whether the text changed. Second pass is a no-op.
|
|
50
|
+
*/
|
|
51
|
+
export declare function neutralizeCompassText(text: string, style: CommentStyle): {
|
|
52
|
+
text: string;
|
|
53
|
+
neutralized: boolean;
|
|
54
|
+
};
|
|
55
|
+
export interface CompassTerminatorHit {
|
|
56
|
+
substring: string;
|
|
57
|
+
/** UTF-16 code-unit offset of the terminator inside the scanned region. */
|
|
58
|
+
offset: number;
|
|
59
|
+
/** 1-based line number. */
|
|
60
|
+
line: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* COMPASS-CS-08 scan over the raw header region: the style's close marker
|
|
64
|
+
* appearing while a Compass inner tag is still unclosed means the comment was
|
|
65
|
+
* truncated mid-block — the corrupted tail is invisible to parseCompassBlocks,
|
|
66
|
+
* so detection must run on raw text.
|
|
67
|
+
*
|
|
68
|
+
* Tag state is tracked only INSIDE comment spans: once the header comment
|
|
69
|
+
* closes, tag-shaped literals in code strings and regexes are inert noise.
|
|
70
|
+
* `/*` opens a block region for block-capable files, `<!--` for html-capable
|
|
71
|
+
* ones; the style's close marker exits the region — firing instead when tags
|
|
72
|
+
* are still open. The close landing with every tag closed is the comment's
|
|
73
|
+
* legitimate own close and never fires.
|
|
74
|
+
*
|
|
75
|
+
* For .astro both candidate comment styles are recognized — either header
|
|
76
|
+
* form can be corrupted. Line-style files carry no embedded terminator and
|
|
77
|
+
* are never flagged. `---`-only lines (frontmatter fences, horizontal
|
|
78
|
+
* rules) reset a comment state that holds no open Compass tags: a `/*` or
|
|
79
|
+
* `<!--` token inside frontmatter code (string/regex/division) is phantom
|
|
80
|
+
* state, not a comment span.
|
|
81
|
+
*/
|
|
82
|
+
export declare function findCompassTerminatorInHeader(source: string, path: string): CompassTerminatorHit | null;
|
|
83
|
+
//# sourceMappingURL=comment-safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-safety.d.ts","sourceRoot":"","sources":["../../../os/compass/comment-safety.ts"],"names":[],"mappings":"AA4BA,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAKnE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAE1D;AAsCD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CA4B/F;AA4BD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAKtF;AAED,oEAAoE;AACpE,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,MAAM,EAAG,eAAe,CAAU;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;CAY3E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CAKN;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAMxC;AAyBD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,oBAAoB,GAAG,IAAI,CAyD7B"}
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
/** Line-comment prefixes for prefix-run styles (.gd `#`, .tscn/.tres `;`). */
|
|
29
|
+
export function getLineCommentPrefix(filePath) {
|
|
30
|
+
if (filePath.endsWith(".gd"))
|
|
31
|
+
return "# ";
|
|
32
|
+
if (filePath.endsWith(".tscn") || filePath.endsWith(".tres"))
|
|
33
|
+
return "; ";
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A CHANGE_SUMMARY/Compass block counts as a header only within this many
|
|
38
|
+
* lines from the file top — deeper matches are doc examples or template
|
|
39
|
+
* strings, not headers. Shared by the writer guards and the CS-08 scan.
|
|
40
|
+
*/
|
|
41
|
+
export const HEADER_SCAN_LINES = 120;
|
|
42
|
+
/**
|
|
43
|
+
* Comment styles a file type may carry, most likely first. .astro headers
|
|
44
|
+
* exist in both forms — block comments inside the `---` frontmatter and html
|
|
45
|
+
* comments in the markup below — so both are candidates at detection time.
|
|
46
|
+
*/
|
|
47
|
+
export function commentStyleCandidates(path) {
|
|
48
|
+
if (path.endsWith(".astro"))
|
|
49
|
+
return ["block", "html"];
|
|
50
|
+
if (path.endsWith(".md"))
|
|
51
|
+
return ["html"];
|
|
52
|
+
if (getLineCommentPrefix(path) !== null)
|
|
53
|
+
return ["line"];
|
|
54
|
+
return ["block"];
|
|
55
|
+
}
|
|
56
|
+
export function commentStyleFor(path) {
|
|
57
|
+
return commentStyleCandidates(path)[0];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The style of the comment that encloses `index` in `source` — the ground
|
|
61
|
+
* truth for edits inside an EXISTING header (record/trim/migrate), where
|
|
62
|
+
* commentStyleFor is only an extension guess. .astro is the case that
|
|
63
|
+
* matters: its header may sit in a `<!-- -->` markup comment while the
|
|
64
|
+
* extension table says "block".
|
|
65
|
+
*
|
|
66
|
+
* Detection replays the comment open/close tokens up to `index` — the
|
|
67
|
+
* nearest UNCLOSED opener wins. A `/*` literal inside an `<!-- -->` header's
|
|
68
|
+
* prose (or a `<!--` literal inside `/* */`) is inert text, not a state
|
|
69
|
+
* change, so it can never flip the detected style. Openers of styles the
|
|
70
|
+
* file type cannot carry are ignored entirely — a `/*` inside .md prose is
|
|
71
|
+
* literal text, never a comment.
|
|
72
|
+
*
|
|
73
|
+
* .astro zoning: a `/*` is a real comment only inside `---` frontmatter
|
|
74
|
+
* (the code region); `<!--` is real only outside it. In markup a `/*` is
|
|
75
|
+
* literal text and in frontmatter code a `<!--` can only be a string
|
|
76
|
+
* literal — counting either latches phantom state that hides the real
|
|
77
|
+
* header, the same class the CS-08 scanner resets on `---`. A comment
|
|
78
|
+
* still open at the closing fence is likewise a phantom and is reset —
|
|
79
|
+
* real frontmatter comments cannot span the fence (frontmatter is TS).
|
|
80
|
+
* Pure-block files (canHtml=false) never carry frontmatter, so `/*`
|
|
81
|
+
* counts anywhere there. No enclosing comment falls back to the
|
|
82
|
+
* extension table.
|
|
83
|
+
*/
|
|
84
|
+
const ENCLOSING_TOKEN_RE = /\*\/|\/\*|-->|<!--/g;
|
|
85
|
+
function leadingFrontmatterFenceEnd(source) {
|
|
86
|
+
const open = /^---[ \t]*\r?\n/.exec(source);
|
|
87
|
+
if (!open)
|
|
88
|
+
return -1;
|
|
89
|
+
const rest = /^---[ \t]*$/gm;
|
|
90
|
+
rest.lastIndex = open[0].length;
|
|
91
|
+
const close = rest.exec(source);
|
|
92
|
+
return close === null ? -1 : close.index + close[0].length;
|
|
93
|
+
}
|
|
94
|
+
export function enclosingCommentStyle(source, index, path) {
|
|
95
|
+
if (getLineCommentPrefix(path) !== null)
|
|
96
|
+
return "line";
|
|
97
|
+
const candidates = commentStyleCandidates(path);
|
|
98
|
+
const canBlock = candidates.includes("block");
|
|
99
|
+
const canHtml = candidates.includes("html");
|
|
100
|
+
const fenceEnd = canHtml ? leadingFrontmatterFenceEnd(source) : -1;
|
|
101
|
+
const hasFrontmatter = fenceEnd > 0;
|
|
102
|
+
let fenceCleared = false;
|
|
103
|
+
let inComment = null;
|
|
104
|
+
for (const m of source.slice(0, index).matchAll(ENCLOSING_TOKEN_RE)) {
|
|
105
|
+
const inFm = hasFrontmatter && m.index < fenceEnd;
|
|
106
|
+
if (hasFrontmatter && !fenceCleared && !inFm) {
|
|
107
|
+
inComment = null;
|
|
108
|
+
fenceCleared = true;
|
|
109
|
+
}
|
|
110
|
+
const token = m[0];
|
|
111
|
+
const blockZone = canBlock && (!canHtml || inFm);
|
|
112
|
+
const htmlZone = canHtml && !inFm;
|
|
113
|
+
if (inComment === null) {
|
|
114
|
+
if (token === "/*" && blockZone)
|
|
115
|
+
inComment = "block";
|
|
116
|
+
else if (token === "<!--" && htmlZone)
|
|
117
|
+
inComment = "html";
|
|
118
|
+
}
|
|
119
|
+
else if (inComment === "block" && token === "*/") {
|
|
120
|
+
inComment = null;
|
|
121
|
+
}
|
|
122
|
+
else if (inComment === "html" && token === "-->") {
|
|
123
|
+
inComment = null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return inComment ?? commentStyleFor(path);
|
|
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 = {
|
|
134
|
+
block: ["*/"],
|
|
135
|
+
html: ["-->", "<!--"],
|
|
136
|
+
line: [],
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The neutralization table (decided at session-20261017-1943, Q-5): each
|
|
140
|
+
* terminator loses one ASCII glyph to its non-ASCII look-alike. The result is
|
|
141
|
+
* byte-preserving except the glyph and idempotent — the substitutes can never
|
|
142
|
+
* re-form a terminator on a second pass.
|
|
143
|
+
*/
|
|
144
|
+
const NEUTRALIZATION = {
|
|
145
|
+
block: [["*/", "*∕"]], // solidus / → ∕ U+2215
|
|
146
|
+
html: [
|
|
147
|
+
["-->", "--›"], // > → › U+203A
|
|
148
|
+
["<!--", "‹!--"], // < → ‹ U+2039
|
|
149
|
+
],
|
|
150
|
+
line: [],
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* First terminator present in `text` for the style, or null. Scans raw text —
|
|
154
|
+
* a terminator inside a quoted example still counts (conservative; authors
|
|
155
|
+
* reword).
|
|
156
|
+
*/
|
|
157
|
+
export function findCompassTerminator(text, style) {
|
|
158
|
+
for (const terminator of COMPASS_TERMINATORS[style]) {
|
|
159
|
+
if (text.includes(terminator))
|
|
160
|
+
return terminator;
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
/** COMPASS-CS-08 payload carried by authored-surface rejections. */
|
|
165
|
+
export class CompassCommentSafetyError extends Error {
|
|
166
|
+
ruleId = "COMPASS-CS-08";
|
|
167
|
+
substring;
|
|
168
|
+
file;
|
|
169
|
+
block;
|
|
170
|
+
fixHint;
|
|
171
|
+
constructor(substring, context) {
|
|
172
|
+
const where = [context?.file, context?.block].filter(Boolean).join(" / ");
|
|
173
|
+
super(`COMPASS-CS-08: comment-close sequence "${substring}" in Compass block text${where ? ` (${where})` : ""}`);
|
|
174
|
+
this.name = "CompassCommentSafetyError";
|
|
175
|
+
this.substring = substring;
|
|
176
|
+
this.file = context?.file;
|
|
177
|
+
this.block = context?.block;
|
|
178
|
+
this.fixHint =
|
|
179
|
+
"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.";
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Fail-closed guard for authored Compass block text — throws
|
|
184
|
+
* CompassCommentSafetyError (COMPASS-CS-08) when `text` carries the style's
|
|
185
|
+
* terminator. Call at emission time, before the text lands in a comment.
|
|
186
|
+
*/
|
|
187
|
+
export function assertCompassCommentSafe(text, style, context) {
|
|
188
|
+
const substring = findCompassTerminator(text, style);
|
|
189
|
+
if (substring !== null) {
|
|
190
|
+
throw new CompassCommentSafetyError(substring, context);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Style-aware terminator neutralization for injected free text — rewrites
|
|
195
|
+
* each terminator pair into its visually-identical non-terminating form and
|
|
196
|
+
* reports whether the text changed. Second pass is a no-op.
|
|
197
|
+
*/
|
|
198
|
+
export function neutralizeCompassText(text, style) {
|
|
199
|
+
let out = text;
|
|
200
|
+
for (const [from, to] of NEUTRALIZATION[style]) {
|
|
201
|
+
out = out.replaceAll(from, to);
|
|
202
|
+
}
|
|
203
|
+
return { text: out, neutralized: out !== text };
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Compass tags whose open state decides whether a close marker is a legal
|
|
207
|
+
* comment end or corruption — the outer block tags plus the nested tags that
|
|
208
|
+
* can still be open when the truncation lands.
|
|
209
|
+
*/
|
|
210
|
+
const COMPASS_INNER_TAGS = [
|
|
211
|
+
"MODULE_CONTRACT",
|
|
212
|
+
"KEY_DECISIONS",
|
|
213
|
+
"CHANGE_SUMMARY",
|
|
214
|
+
"purpose",
|
|
215
|
+
"non-goals",
|
|
216
|
+
"item",
|
|
217
|
+
"history",
|
|
218
|
+
];
|
|
219
|
+
/** Top-level Compass block tags — a truncation only counts while one is open. */
|
|
220
|
+
const COMPASS_STRUCTURAL_TAGS = ["MODULE_CONTRACT", "KEY_DECISIONS", "CHANGE_SUMMARY"];
|
|
221
|
+
const CS08_TOKEN_RE = new RegExp(`<(?:${COMPASS_INNER_TAGS.join("|")})>|</(?:${COMPASS_INNER_TAGS.join("|")})>|\\*\\/|\\/\\*|-->|<!--|^---[^\\S\\n]*$`, "gm");
|
|
222
|
+
/**
|
|
223
|
+
* COMPASS-CS-08 scan over the raw header region: the style's close marker
|
|
224
|
+
* appearing while a Compass inner tag is still unclosed means the comment was
|
|
225
|
+
* truncated mid-block — the corrupted tail is invisible to parseCompassBlocks,
|
|
226
|
+
* so detection must run on raw text.
|
|
227
|
+
*
|
|
228
|
+
* Tag state is tracked only INSIDE comment spans: once the header comment
|
|
229
|
+
* closes, tag-shaped literals in code strings and regexes are inert noise.
|
|
230
|
+
* `/*` opens a block region for block-capable files, `<!--` for html-capable
|
|
231
|
+
* ones; the style's close marker exits the region — firing instead when tags
|
|
232
|
+
* are still open. The close landing with every tag closed is the comment's
|
|
233
|
+
* legitimate own close and never fires.
|
|
234
|
+
*
|
|
235
|
+
* For .astro both candidate comment styles are recognized — either header
|
|
236
|
+
* form can be corrupted. Line-style files carry no embedded terminator and
|
|
237
|
+
* are never flagged. `---`-only lines (frontmatter fences, horizontal
|
|
238
|
+
* rules) reset a comment state that holds no open Compass tags: a `/*` or
|
|
239
|
+
* `<!--` token inside frontmatter code (string/regex/division) is phantom
|
|
240
|
+
* state, not a comment span.
|
|
241
|
+
*/
|
|
242
|
+
export function findCompassTerminatorInHeader(source, path) {
|
|
243
|
+
const region = source.split("\n").slice(0, HEADER_SCAN_LINES).join("\n");
|
|
244
|
+
const styles = commentStyleCandidates(path);
|
|
245
|
+
const canBlock = styles.includes("block");
|
|
246
|
+
const canHtml = styles.includes("html");
|
|
247
|
+
if (!canBlock && !canHtml)
|
|
248
|
+
return null;
|
|
249
|
+
let inComment = null;
|
|
250
|
+
const open = new Set();
|
|
251
|
+
for (const m of region.matchAll(CS08_TOKEN_RE)) {
|
|
252
|
+
const token = m[0];
|
|
253
|
+
// Frontmatter/horizontal-rule fence: a `---`-only line while a comment
|
|
254
|
+
// holds NO open Compass tags must be phantom comment state (a `/*` or
|
|
255
|
+
// `<!--` inside a code string/regex latched it) — resetting restores
|
|
256
|
+
// visibility of the real header below. With tags open the line is
|
|
257
|
+
// comment content and state is preserved.
|
|
258
|
+
if (token.startsWith("---") && inComment !== null && open.size === 0) {
|
|
259
|
+
inComment = null;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (inComment === null) {
|
|
263
|
+
if (token === "/*" && canBlock)
|
|
264
|
+
inComment = "block";
|
|
265
|
+
else if (token === "<!--" && canHtml)
|
|
266
|
+
inComment = "html";
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const terms = COMPASS_TERMINATORS[inComment];
|
|
270
|
+
if (terms.includes(token)) {
|
|
271
|
+
// A terminator while a STRUCTURAL Compass block tag remains open —
|
|
272
|
+
// mid-block truncation. A bare <item>/<purpose> in a doc comment is not
|
|
273
|
+
// a Compass block (inner tags only nest inside a structural parent), so
|
|
274
|
+
// those alone never fire.
|
|
275
|
+
if (COMPASS_STRUCTURAL_TAGS.some((tag) => open.has(tag))) {
|
|
276
|
+
const offset = m.index;
|
|
277
|
+
return {
|
|
278
|
+
substring: token,
|
|
279
|
+
offset,
|
|
280
|
+
line: region.slice(0, offset).split("\n").length,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
// Legal own-close exits the region (open must not leak into the next
|
|
284
|
+
// comment's state); a nested html opener inside a clean html comment
|
|
285
|
+
// is stray but cannot have truncated Compass tags.
|
|
286
|
+
if (token === "*/" || token === "-->") {
|
|
287
|
+
inComment = null;
|
|
288
|
+
open.clear();
|
|
289
|
+
}
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
// Inner-tag open/close — only Compass names are tracked; angle tokens of
|
|
293
|
+
// other shapes (an html opener scanned inside a block comment, generic
|
|
294
|
+
// markup) keep out of the set.
|
|
295
|
+
const name = token.replace(/^<\/?/, "").replace(/>$/, "");
|
|
296
|
+
if (!COMPASS_INNER_TAGS.includes(name))
|
|
297
|
+
continue;
|
|
298
|
+
if (token.startsWith("</"))
|
|
299
|
+
open.delete(name);
|
|
300
|
+
else
|
|
301
|
+
open.add(name);
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=comment-safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-safety.js","sourceRoot":"","sources":["../../../os/compass/comment-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AAKF,8EAA8E;AAC9E,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1E,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC;;;;GAIG;AACH,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I,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compass.module.d.ts","sourceRoot":"","sources":["../../../os/compass/compass.module.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"compass.module.d.ts","sourceRoot":"","sources":["../../../os/compass/compass.module.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA2C7D,eAAO,MAAM,kBAAkB,EAAE,WAqWhC,CAAC"}
|
|
@@ -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
|
import { runCompassInventory, runCompassValidation } from "./handlers/compass-inventory-handler.js";
|
|
@@ -24,6 +24,7 @@ import { runCompassAuditPlan, runCompassAuditRecord, runCompassAuditBaseline, ru
|
|
|
24
24
|
import { runCompassSummaryTrim } from "./handlers/compass-change-summary-handler.js";
|
|
25
25
|
import { runCompassSummaryRecord } from "./handlers/summary-record.js";
|
|
26
26
|
import { runCompassMigrate } from "./handlers/compass-migrate-handler.js";
|
|
27
|
+
import { runCompassHeaderScaffold } from "./handlers/compass-header-scaffold-handler.js";
|
|
27
28
|
import { runCompassDocsValidate } from "./handlers/compass-docs-validate.js";
|
|
28
29
|
import { runCompassDocsScaffold } from "./handlers/compass-docs-scaffold.js";
|
|
29
30
|
const compassScanFlags = {
|
|
@@ -73,7 +74,9 @@ export const forgeCompassModule = {
|
|
|
73
74
|
name: "compass.validate",
|
|
74
75
|
mutatesState: false,
|
|
75
76
|
contract: "compass",
|
|
76
|
-
|
|
77
|
+
// RFC-1323: first declared CS-family id — sibling CS-05/06/07 stay
|
|
78
|
+
// undeclared (pre-existing inconsistency the RFC does not backfill).
|
|
79
|
+
rules: ["COMPASS-CS-08"],
|
|
77
80
|
description: "Validate authored source files against current Compass scaffolding requirements.",
|
|
78
81
|
scope: "workspace",
|
|
79
82
|
acceptsAllFlag: true,
|
|
@@ -120,6 +123,10 @@ export const forgeCompassModule = {
|
|
|
120
123
|
kind: "string",
|
|
121
124
|
description: "Item description. Default: commit subject minus conventional prefix; bare ID outside commit context.",
|
|
122
125
|
},
|
|
126
|
+
injected: {
|
|
127
|
+
kind: "boolean",
|
|
128
|
+
description: "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.",
|
|
129
|
+
},
|
|
123
130
|
},
|
|
124
131
|
execute: runCompassSummaryRecord,
|
|
125
132
|
},
|
|
@@ -186,6 +193,42 @@ export const forgeCompassModule = {
|
|
|
186
193
|
},
|
|
187
194
|
execute: runCompassMigrate,
|
|
188
195
|
},
|
|
196
|
+
{
|
|
197
|
+
name: "compass.header.scaffold",
|
|
198
|
+
coverage: "operator",
|
|
199
|
+
description: "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.",
|
|
200
|
+
scope: "workspace",
|
|
201
|
+
mutatesState: true,
|
|
202
|
+
acceptsAllFlag: true,
|
|
203
|
+
writes: [
|
|
204
|
+
"apps/**/*.{astro,ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
205
|
+
"packages/**/*.{astro,ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
206
|
+
"services/**/*.{ts,tsx,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
207
|
+
],
|
|
208
|
+
generates: [],
|
|
209
|
+
reads: [
|
|
210
|
+
"packages/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
211
|
+
"apps/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
212
|
+
"services/**/*.{ts,tsx,astro,js,mjs,css,cs,tscn,tres,gd,md}",
|
|
213
|
+
],
|
|
214
|
+
cacheable: false,
|
|
215
|
+
flags: {
|
|
216
|
+
...compassScanFlags,
|
|
217
|
+
files: {
|
|
218
|
+
kind: "string[]",
|
|
219
|
+
description: "Explicit root-relative file list — bypasses scan-root filtering entirely.",
|
|
220
|
+
},
|
|
221
|
+
census: {
|
|
222
|
+
kind: "boolean",
|
|
223
|
+
description: "Report per-package uncovered/malformed/clean counts through the same discovery and disposition pipeline — performs no writes and never refuses on a dirty tree.",
|
|
224
|
+
},
|
|
225
|
+
force: {
|
|
226
|
+
kind: "boolean",
|
|
227
|
+
description: "Override the dirty-target refusal (apply mode only).",
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
execute: runCompassHeaderScaffold,
|
|
231
|
+
},
|
|
189
232
|
{
|
|
190
233
|
name: "compass.audit.plan",
|
|
191
234
|
coverage: "operator",
|