@warpgogol/forge 9.0.0 → 9.1.0
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 +28 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -1
- package/dist/os/agent/handlers/agent-tiers-validate.js +5 -1
- package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -1
- package/dist/os/agent/index.d.ts.map +1 -1
- package/dist/os/agent/index.js +4 -0
- package/dist/os/agent/index.js.map +1 -1
- package/dist/os/authority/handlers/delegate.d.ts.map +1 -1
- package/dist/os/authority/handlers/delegate.js +2 -1
- package/dist/os/authority/handlers/delegate.js.map +1 -1
- package/dist/os/authority/index.d.ts.map +1 -1
- package/dist/os/authority/index.js +2 -1
- package/dist/os/authority/index.js.map +1 -1
- package/dist/os/checks/checks.module.d.ts.map +1 -1
- package/dist/os/checks/checks.module.js +5 -1
- package/dist/os/checks/checks.module.js.map +1 -1
- package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -1
- package/dist/os/checks/handlers/contribution-report.js +5 -4
- package/dist/os/checks/handlers/contribution-report.js.map +1 -1
- package/dist/os/checks/handlers/counters-export.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-export.js +4 -0
- package/dist/os/checks/handlers/counters-export.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +2 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-validate.js +5 -1
- package/dist/os/checks/handlers/counters-validate.js.map +1 -1
- package/dist/os/checks/index.d.ts.map +1 -1
- package/dist/os/checks/index.js +11 -0
- package/dist/os/checks/index.js.map +1 -1
- package/dist/os/compass/handlers/compass-docs-scaffold.js +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold.js +6 -1
- package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -1
- package/dist/os/compass/handlers/compass-invariants-generate.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-invariants-generate.js +3 -2
- package/dist/os/compass/handlers/compass-invariants-generate.js.map +1 -1
- package/dist/os/context/context.module.d.ts.map +1 -1
- package/dist/os/context/context.module.js +6 -1
- package/dist/os/context/context.module.js.map +1 -1
- package/dist/os/context/handlers/context-assemble.d.ts.map +1 -1
- package/dist/os/context/handlers/context-assemble.js +5 -1
- package/dist/os/context/handlers/context-assemble.js.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.js +4 -0
- package/dist/os/context/handlers/context-slate-eval.js.map +1 -1
- package/dist/os/context/handlers/index-build.d.ts.map +1 -1
- package/dist/os/context/handlers/index-build.js +8 -5
- package/dist/os/context/handlers/index-build.js.map +1 -1
- package/dist/os/context/index.d.ts.map +1 -1
- package/dist/os/context/index.js +11 -0
- package/dist/os/context/index.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +4 -0
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe.js +4 -0
- package/dist/os/gate/handlers/gate-probe.js.map +1 -1
- package/dist/os/gate/index.d.ts.map +1 -1
- package/dist/os/gate/index.js +11 -0
- package/dist/os/gate/index.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +2 -1
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js +7 -3
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.d.ts +11 -0
- package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.d.ts.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.js +428 -0
- package/dist/os/knowledge/handlers/knowledge-conflicts-resolve.js.map +1 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.js +4 -0
- package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -1
- package/dist/os/knowledge/index.d.ts +1 -0
- package/dist/os/knowledge/index.d.ts.map +1 -1
- package/dist/os/knowledge/index.js +13 -0
- package/dist/os/knowledge/index.js.map +1 -1
- package/dist/os/knowledge/knowledge.module.d.ts.map +1 -1
- package/dist/os/knowledge/knowledge.module.js +35 -1
- package/dist/os/knowledge/knowledge.module.js.map +1 -1
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +8 -7
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/resolver/resolver.module.d.ts.map +1 -1
- package/dist/os/resolver/resolver.module.js +2 -1
- package/dist/os/resolver/resolver.module.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts +1 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.js +3 -0
- package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.js +10 -2
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts +2 -0
- package/dist/os/rfc/handlers/implement-stamp-outcome.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-outcome.js +2 -0
- package/dist/os/rfc/handlers/implement-stamp-outcome.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +176 -59
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/lifecycle.d.ts.map +1 -1
- package/dist/os/rfc/handlers/lifecycle.js +13 -6
- package/dist/os/rfc/handlers/lifecycle.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +28 -2
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
- package/dist/os/rfc/reachable-symbol.js +4 -2
- package/dist/os/rfc/reachable-symbol.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +23 -7
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +22 -2
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +18 -2
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verifier/rfc-1391/support.d.ts.map +1 -1
- package/dist/os/rfc/verifier/rfc-1391/support.js +4 -0
- package/dist/os/rfc/verifier/rfc-1391/support.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +5 -2
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit-report.js +4 -0
- package/dist/os/session/handlers/session-audit-report.js.map +1 -1
- package/dist/os/session/handlers/session-audit.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit.js +4 -0
- package/dist/os/session/handlers/session-audit.js.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.d.ts +9 -0
- package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.js +20 -2
- package/dist/os/trajectory/handlers/journal-io.js.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.js +4 -1
- package/dist/os/trajectory/handlers/outcome-record.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.js +30 -8
- package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.js +7 -4
- package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -1
- package/dist/os/trajectory/index.d.ts.map +1 -1
- package/dist/os/trajectory/index.js +11 -0
- package/dist/os/trajectory/index.js.map +1 -1
- package/dist/os/trajectory/trajectory.module.d.ts.map +1 -1
- package/dist/os/trajectory/trajectory.module.js +16 -9
- package/dist/os/trajectory/trajectory.module.js.map +1 -1
- package/dist/os/werkstatt/handlers/session-close.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/session-close.js +3 -0
- package/dist/os/werkstatt/handlers/session-close.js.map +1 -1
- package/dist/os/werkstatt/handlers/session-engine.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/session-engine.js +3 -0
- package/dist/os/werkstatt/handlers/session-engine.js.map +1 -1
- package/dist/os/werkstatt/handlers/session-open.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/session-open.js +3 -0
- package/dist/os/werkstatt/handlers/session-open.js.map +1 -1
- package/dist/os/werkstatt/handlers/session-status.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/session-status.js +3 -0
- package/dist/os/werkstatt/handlers/session-status.js.map +1 -1
- package/dist/os/yaml/handlers/scalars-validate.d.ts +28 -0
- package/dist/os/yaml/handlers/scalars-validate.d.ts.map +1 -0
- package/dist/os/yaml/handlers/scalars-validate.js +311 -0
- package/dist/os/yaml/handlers/scalars-validate.js.map +1 -0
- package/dist/os/yaml/index.d.ts +4 -0
- package/dist/os/yaml/index.d.ts.map +1 -0
- package/dist/os/yaml/index.js +15 -0
- package/dist/os/yaml/index.js.map +1 -0
- package/dist/os/yaml/yaml.module.d.ts +3 -0
- package/dist/os/yaml/yaml.module.d.ts.map +1 -0
- package/dist/os/yaml/yaml.module.js +58 -0
- package/dist/os/yaml/yaml.module.js.map +1 -0
- package/dist/src/authority/delegations.d.ts.map +1 -1
- package/dist/src/authority/delegations.js +5 -4
- package/dist/src/authority/delegations.js.map +1 -1
- package/dist/src/cli-flags.d.ts.map +1 -1
- package/dist/src/cli-flags.js +1 -5
- package/dist/src/cli-flags.js.map +1 -1
- package/dist/src/compass/invariant-parser.d.ts.map +1 -1
- package/dist/src/compass/invariant-parser.js +2 -1
- package/dist/src/compass/invariant-parser.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +17 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +33 -10
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/formal/exhaustive.d.ts.map +1 -1
- package/dist/src/formal/exhaustive.js +3 -2
- package/dist/src/formal/exhaustive.js.map +1 -1
- package/dist/src/formal/index.d.ts.map +1 -1
- package/dist/src/formal/index.js +4 -0
- package/dist/src/formal/index.js.map +1 -1
- package/dist/src/formal/proof-runner.d.ts.map +1 -1
- package/dist/src/formal/proof-runner.js +4 -3
- package/dist/src/formal/proof-runner.js.map +1 -1
- package/dist/src/formal/proof-spec.d.ts.map +1 -1
- package/dist/src/formal/proof-spec.js +3 -2
- package/dist/src/formal/proof-spec.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/knowledge/index.d.ts +2 -2
- package/dist/src/knowledge/index.d.ts.map +1 -1
- package/dist/src/knowledge/index.js +4 -3
- package/dist/src/knowledge/index.js.map +1 -1
- package/dist/src/knowledge/parse.d.ts +1 -0
- package/dist/src/knowledge/parse.d.ts.map +1 -1
- package/dist/src/knowledge/parse.js +20 -18
- package/dist/src/knowledge/parse.js.map +1 -1
- package/dist/src/knowledge/schema.d.ts.map +1 -1
- package/dist/src/knowledge/schema.js +5 -4
- package/dist/src/knowledge/schema.js.map +1 -1
- package/dist/src/knowledge/sync.d.ts +61 -0
- package/dist/src/knowledge/sync.d.ts.map +1 -1
- package/dist/src/knowledge/sync.js +202 -7
- package/dist/src/knowledge/sync.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +1 -1
- package/dist/src/onboarding/compass-docs/semantic-layer-block.js +1 -1
- package/dist/src/onboarding/doctor.d.ts +2 -0
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +166 -26
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.js +1 -1
- package/dist/src/onboarding/nested-agents-templates.js +1 -1
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +18 -10
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/reachability/command-mentions.d.ts.map +1 -1
- package/dist/src/reachability/command-mentions.js +4 -2
- package/dist/src/reachability/command-mentions.js.map +1 -1
- package/dist/src/registry.d.ts +20 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +129 -67
- package/dist/src/registry.js.map +1 -1
- package/dist/src/validators/skill-validate.d.ts +5 -0
- package/dist/src/validators/skill-validate.d.ts.map +1 -1
- package/dist/src/validators/skill-validate.js +34 -8
- package/dist/src/validators/skill-validate.js.map +1 -1
- package/os/agent/handlers/agent-tiers-validate.ts +5 -1
- package/os/agent/index.ts +4 -0
- package/os/authority/handlers/delegate.ts +2 -1
- package/os/authority/index.ts +2 -1
- package/os/checks/checks.module.ts +5 -1
- package/os/checks/handlers/contribution-report.test.ts +6 -0
- package/os/checks/handlers/contribution-report.ts +5 -4
- package/os/checks/handlers/counters-export.test.ts +6 -0
- package/os/checks/handlers/counters-export.ts +4 -0
- package/os/checks/handlers/counters-journal.test.ts +6 -0
- package/os/checks/handlers/counters-journal.ts +2 -1
- package/os/checks/handlers/counters-validate.test.ts +6 -0
- package/os/checks/handlers/counters-validate.ts +5 -1
- package/os/checks/handlers/variant-candidates.test.ts +6 -0
- package/os/checks/index.ts +12 -0
- package/os/compass/handlers/compass-docs-scaffold.ts +1 -1
- package/os/compass/handlers/compass-header-scaffold.ts +6 -1
- package/os/compass/handlers/compass-invariants-generate.ts +3 -2
- package/os/context/context.module.ts +6 -1
- package/os/context/handlers/context-assemble.test.ts +6 -0
- package/os/context/handlers/context-assemble.ts +5 -1
- package/os/context/handlers/context-slate-eval.test.ts +6 -0
- package/os/context/handlers/context-slate-eval.ts +4 -0
- package/os/context/handlers/index-build.test.ts +33 -0
- package/os/context/handlers/index-build.ts +8 -5
- package/os/context/handlers/no-model-deps.test.ts +6 -0
- package/os/context/handlers/slate-fill.test.ts +6 -0
- package/os/context/index.ts +12 -0
- package/os/gate/handlers/gate-probe-catalog.test.ts +6 -0
- package/os/gate/handlers/gate-probe-catalog.ts +4 -0
- package/os/gate/handlers/gate-probe.test.ts +6 -0
- package/os/gate/handlers/gate-probe.ts +4 -0
- package/os/gate/index.ts +12 -0
- package/os/instructions/budget.test.ts +6 -0
- package/os/instructions/instructions.module.ts +2 -1
- package/os/knowledge/handlers/knowledge-authz-probe.test.ts +21 -0
- package/os/knowledge/handlers/knowledge-authz-probe.ts +7 -3
- package/os/knowledge/handlers/knowledge-conflicts-resolve.ts +571 -0
- package/os/knowledge/handlers/knowledge-rebuild.test.ts +6 -0
- package/os/knowledge/handlers/knowledge-rebuild.ts +4 -0
- package/os/knowledge/index.ts +14 -0
- package/os/knowledge/knowledge.module.ts +36 -1
- package/os/queue/decision-ledger.test.ts +32 -1
- package/os/queue/manifest.ts +8 -7
- package/os/resolver/handlers/resolver-doors-audit.test.ts +3 -0
- package/os/resolver/resolver.module.ts +2 -1
- package/os/rfc/handlers/implement-stamp-deviations.ts +4 -1
- package/os/rfc/handlers/implement-stamp-origin.ts +10 -2
- package/os/rfc/handlers/implement-stamp-outcome.ts +4 -2
- package/os/rfc/handlers/implement-stamp-stale.test.ts +2 -1
- package/os/rfc/handlers/implement-stamp.ts +188 -58
- package/os/rfc/handlers/lifecycle.test.ts +59 -1
- package/os/rfc/handlers/lifecycle.ts +25 -15
- package/os/rfc/handlers/list-create.test.ts +81 -0
- package/os/rfc/handlers/list-create.ts +34 -2
- package/os/rfc/handlers/validate-rules-rfc1334.test.ts +2 -1
- package/os/rfc/handlers/validate-rules-rfc1453.test.ts +2 -1
- package/os/rfc/handlers/validate-rules-rfc1454.test.ts +2 -1
- package/os/rfc/handlers/validate-rules-rfc1455.test.ts +2 -1
- package/os/rfc/reachable-symbol.ts +4 -2
- package/os/rfc/rfc-0000-template.md +16 -0
- package/os/rfc/rfc.module.ts +26 -7
- package/os/rfc/types.ts +32 -2
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +12 -0
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +12 -0
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +12 -0
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +12 -0
- package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +4 -0
- package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +4 -0
- package/os/rfc/verifier/rfc-1391/support.ts +4 -0
- package/os/session/handlers/save.ts +5 -2
- package/os/session/handlers/session-audit-detectors.test.ts +6 -0
- package/os/session/handlers/session-audit-report.test.ts +6 -0
- package/os/session/handlers/session-audit-report.ts +4 -0
- package/os/session/handlers/session-audit.test.ts +6 -0
- package/os/session/handlers/session-audit.ts +4 -0
- package/os/trajectory/handlers/extract-units.test.ts +7 -1
- package/os/trajectory/handlers/journal-io.ts +20 -2
- package/os/trajectory/handlers/outcome-record.test.ts +6 -0
- package/os/trajectory/handlers/outcome-record.ts +4 -1
- package/os/trajectory/handlers/producer-trust.test.ts +6 -0
- package/os/trajectory/handlers/trajectory-index.test.ts +29 -0
- package/os/trajectory/handlers/trajectory-index.ts +31 -8
- package/os/trajectory/handlers/trajectory-recall.test.ts +27 -0
- package/os/trajectory/handlers/trajectory-recall.ts +7 -4
- package/os/trajectory/handlers/trajectory.test.ts +6 -0
- package/os/trajectory/handlers/verdict-binding.test.ts +40 -0
- package/os/trajectory/index.ts +12 -0
- package/os/trajectory/trajectory.module.ts +16 -9
- package/os/werkstatt/handlers/session-close.ts +3 -0
- package/os/werkstatt/handlers/session-engine.ts +3 -0
- package/os/werkstatt/handlers/session-open.ts +3 -0
- package/os/werkstatt/handlers/session-status.ts +3 -0
- package/os/yaml/handlers/scalars-validate.ts +343 -0
- package/os/yaml/index.ts +23 -0
- package/os/yaml/scalars.test.ts +152 -0
- package/os/yaml/yaml.module.ts +61 -0
- package/package.json +17 -1
- package/skills/fo/fo-knowledge-distill/SKILL.md +6 -5
- package/skills/fo/fo-memory-sync/SKILL.md +3 -0
- package/skills/fo/fo-memory-sync/fix-patterns.md +65 -0
- package/skills/fo/fo-memory-sync/learned-principles.md +10 -0
- package/skills/fo/fo-memory-sync/qa-log.md +30 -0
- package/skills/fo/fo-session-save/SKILL.md +2 -0
- package/skills/shared/grilling/SKILL.md +3 -0
- package/skills/shared/writing-great-skills/SKILL.md +12 -9
- package/src/authority/delegations.ts +5 -4
- package/src/cli-flags.ts +1 -5
- package/src/compass/invariant-parser.ts +2 -1
- package/src/config/forge-config.ts +40 -14
- package/src/formal/exhaustive.ts +3 -2
- package/src/formal/index.ts +4 -0
- package/src/formal/proof-runner.ts +4 -3
- package/src/formal/proof-spec.ts +3 -2
- package/src/index.ts +1 -0
- package/src/knowledge/index.ts +11 -2
- package/src/knowledge/parse.ts +20 -17
- package/src/knowledge/schema.ts +5 -4
- package/src/knowledge/sync.ts +281 -7
- package/src/onboarding/agents-generate.ts +1 -1
- package/src/onboarding/compass-docs/semantic-layer-block.ts +1 -1
- package/src/onboarding/doctor.ts +184 -26
- package/src/onboarding/nested-agents-generate.ts +1 -1
- package/src/onboarding/nested-agents-templates.ts +1 -1
- package/src/onboarding/upgrade.ts +18 -10
- package/src/reachability/command-mentions.ts +4 -2
- package/src/registry.ts +153 -74
- package/src/tests/cli-flags.test.ts +1 -1
- package/src/tests/discover-pack-skills.test.ts +26 -0
- package/src/tests/doctor-autonomy.test.ts +144 -0
- package/src/tests/doctor-dist-freshness.test.ts +24 -0
- package/src/tests/doctor-knowledge-conflicts.test.ts +135 -0
- package/src/tests/doctor-nested-agents.test.ts +30 -1
- package/src/tests/implement-stamp.test.ts +191 -8
- package/src/tests/knowledge-conflicts-resolve.pbt.test.ts +38 -0
- package/src/tests/knowledge-conflicts-resolve.test.ts +648 -0
- package/src/tests/knowledge-parse.test.ts +26 -1
- package/src/tests/session-handlers.test.ts +47 -0
- package/src/tests/skill-validate-knowledge.test.ts +93 -2
- package/src/tests/upgrade.test.ts +38 -0
- package/src/validators/skill-validate.ts +37 -9
|
@@ -12,12 +12,12 @@ verification evidence, and atomically mutates RFC frontmatter.
|
|
|
12
12
|
</non-goals>
|
|
13
13
|
</MODULE_CONTRACT>
|
|
14
14
|
<CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-1333: steps 1-3 — report contract, rfc.verify.workspace export, RFC-IMP-12 gate, RFC-IMP-11 blocking</item>
|
|
16
15
|
<item>RFC-1333: CX-1/CX-2 fixes — docs/** binding, waiver covers a missing report, IMP-12 for probe-less RFCs; merge-aware fail-closed binding.</item>
|
|
17
16
|
<item>RFC-1391: make the formal verification tier checker-bound (RFC-1391)</item>
|
|
18
17
|
<item>RFC-1453: executed outcome probes, IMP-14 surface gate, outcome.serve + V-47/V-48</item>
|
|
19
18
|
<item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
|
|
20
|
-
<
|
|
19
|
+
<item>RFC-1483: self-sufficient implement stamp — default repair pass, ordered remediation checklist, --no-repair</item>
|
|
20
|
+
<history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1321, RFC-1322, RFC-1330, RFC-1333, RFC-1383, RFC-IMP-07</history>
|
|
21
21
|
</CHANGE_SUMMARY>
|
|
22
22
|
*/
|
|
23
23
|
import { execFile, writeFileSync } from "../../../src/utils/sync-fs.js";
|
|
@@ -31,7 +31,7 @@ import { evaluateAcceptanceCriteria, stripFencedCodeBlocks } from "./validate-ru
|
|
|
31
31
|
import { evaluateDeviationGate } from "./implement-stamp-deviations.js";
|
|
32
32
|
import { toIsoDate } from "./shared.js";
|
|
33
33
|
import { byteHashHex, normalizeProbes, runRfcVerificationEmit } from "../verification-evidence.js";
|
|
34
|
-
import { RFC_DIR, RFC_METADATA_CUTOFF, RFC_ORIGIN_CUTOFF, RFC_PROBE_BINDING_CUTOFF, } from "../types.js";
|
|
34
|
+
import { PREREQUISITE_ORDER, RFC_DIR, RFC_METADATA_CUTOFF, RFC_ORIGIN_CUTOFF, RFC_PROBE_BINDING_CUTOFF, } from "../types.js";
|
|
35
35
|
import { createOriginGit, createProofEntryResolver, deriveProbeOrigins, gitEnvForCwd, hasVerifierTrailers, } from "../verification-origin.js";
|
|
36
36
|
import { ACCEPTANCE_REPORTS_DIR, evaluateAcceptanceVerificationGate, evaluateFormalProofGate, evaluateOriginGates, } from "./implement-stamp-origin.js";
|
|
37
37
|
import { evaluateOutcomeGate } from "./implement-stamp-outcome.js";
|
|
@@ -370,10 +370,12 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
370
370
|
const violations = [];
|
|
371
371
|
const warnings = [];
|
|
372
372
|
let evidenceRelPath;
|
|
373
|
+
const runIndependent = opts.gatePhase !== "dependent";
|
|
374
|
+
const runDependent = opts.gatePhase !== "independent";
|
|
373
375
|
// ── RFC-IMP-10 / RFC-IMP-11: git-derived origin gates (RFC-1330) ─────────
|
|
374
376
|
// Derived fresh at stamp time (head = HEAD) — the committed envelope's
|
|
375
377
|
// origin records are volatile context and may predate later commits.
|
|
376
|
-
if (hasProbes && String(opts.frontmatter["createdAt"] ?? "") >= RFC_ORIGIN_CUTOFF) {
|
|
378
|
+
if (runIndependent && hasProbes && String(opts.frontmatter["createdAt"] ?? "") >= RFC_ORIGIN_CUTOFF) {
|
|
377
379
|
const probes = acceptance;
|
|
378
380
|
const origins = await deriveProbeOrigins({
|
|
379
381
|
git: createOriginGit(opts.workspaceRoot),
|
|
@@ -394,29 +396,33 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
394
396
|
}
|
|
395
397
|
// RFC-IMP-12 applies to every post-cutoff HIGH-tier RFC, probe-bearing or not.
|
|
396
398
|
// ── RFC-IMP-12: acceptance-verification report (RFC-1333) ─────────────
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
399
|
+
if (runIndependent) {
|
|
400
|
+
const acc = await evaluateAcceptanceVerificationGate({
|
|
401
|
+
targetId,
|
|
402
|
+
frontmatter: opts.frontmatter,
|
|
403
|
+
reports: await readAcceptanceReports(opts.workspaceRoot, targetId),
|
|
404
|
+
isCandidateBound: (sha) => candidateBoundToHead(opts.workspaceRoot, sha),
|
|
405
|
+
waiverReason: opts.waiverReason,
|
|
406
|
+
});
|
|
407
|
+
violations.push(...acc.errors);
|
|
408
|
+
warnings.push(...acc.warnings);
|
|
409
|
+
}
|
|
406
410
|
// ── RFC-IMP-13: formal tier requires proved proof probes (RFC-1391) ────────
|
|
407
411
|
// No waiver path — formal evidence is a mechanical checker verdict by
|
|
408
412
|
// definition. Reads the committed envelope's proof verdicts.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
413
|
+
if (runDependent) {
|
|
414
|
+
const formal = evaluateFormalProofGate({
|
|
415
|
+
targetId,
|
|
416
|
+
frontmatter: opts.frontmatter,
|
|
417
|
+
probes: (Array.isArray(acceptance) ? acceptance : []),
|
|
418
|
+
evidenceRecords: evidenceCheck.envelope?.probes,
|
|
419
|
+
});
|
|
420
|
+
violations.push(...formal.errors);
|
|
421
|
+
warnings.push(...formal.warnings);
|
|
422
|
+
}
|
|
417
423
|
// ── RFC-IMP-14: outcome-surface diffs need a passing outcome probe (RFC-1453) ──
|
|
418
424
|
// Evaluates the committed envelope's recorded verdicts — never re-executes.
|
|
419
|
-
{
|
|
425
|
+
if (runDependent) {
|
|
420
426
|
let outcomeSurfaces = [];
|
|
421
427
|
let outcomeBuild = null;
|
|
422
428
|
try {
|
|
@@ -444,7 +450,7 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
444
450
|
}
|
|
445
451
|
}
|
|
446
452
|
// ── RFC-IMP-15: amend review deviations recorded in ## Deviations (RFC-1454) ──
|
|
447
|
-
{
|
|
453
|
+
if (runIndependent) {
|
|
448
454
|
let reviewsDir = null;
|
|
449
455
|
try {
|
|
450
456
|
reviewsDir = loadForgeConfig(opts.workspaceRoot).bindings?.paths?.reviewsDir ?? null;
|
|
@@ -461,11 +467,12 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
461
467
|
violations.push(...deviations.errors);
|
|
462
468
|
}
|
|
463
469
|
// ── RFC-IMP-06: probe-bearing post-cutoff RFCs need a passing envelope ────
|
|
464
|
-
if (requiresEvidence) {
|
|
470
|
+
if (requiresEvidence && runDependent && !opts.suppressRepairable) {
|
|
465
471
|
if (!evidenceCheck.exists || evidenceCheck.overall !== "pass") {
|
|
466
472
|
violations.push({
|
|
467
473
|
rule: "RFC-IMP-06",
|
|
468
474
|
message: `RFC ${targetId} declares acceptance probes but evidence file is missing or overall is not "pass" (got "${evidenceCheck.overall}"). Run: site-kernel run rfc.verification.emit --id ${targetId}`,
|
|
475
|
+
fixHint: `run rfc.verification.emit --id ${targetId} and fix the failing probe(s) — the default repair pass emits a missing/stale envelope in-process but cannot make a failing probe pass`,
|
|
469
476
|
});
|
|
470
477
|
}
|
|
471
478
|
else {
|
|
@@ -477,17 +484,19 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
477
484
|
// (the RFC file must be committed-clean to stamp) the compared bytes are
|
|
478
485
|
// effectively the committed bytes — deliberate, keeps the gate honest
|
|
479
486
|
// without a second git read.
|
|
480
|
-
if (evidenceCheck.exists) {
|
|
487
|
+
if (evidenceCheck.exists && runDependent && !opts.suppressRepairable) {
|
|
481
488
|
if (evidenceCheck.malformed || !evidenceCheck.envelope) {
|
|
482
489
|
violations.push({
|
|
483
490
|
rule: "RFC-IMP-09",
|
|
484
491
|
message: `RFC ${targetId} evidence envelope is malformed (unreadable YAML or non-object content). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file.`,
|
|
492
|
+
fixHint: `re-run rfc.verification.emit --id ${targetId} and commit the envelope, or delete the stale envelope file`,
|
|
485
493
|
});
|
|
486
494
|
}
|
|
487
495
|
else if (!hasProbes) {
|
|
488
496
|
violations.push({
|
|
489
497
|
rule: "RFC-IMP-09",
|
|
490
498
|
message: `RFC ${targetId} has a committed evidence envelope but no acceptance: list — probes were deleted after emission, which is a criteria change. Either restore the probes and re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file (rfc.verification.emit skips probe-less RFCs, so re-emit alone cannot clear this).`,
|
|
499
|
+
fixHint: `restore the deleted probes and re-run rfc.verification.emit --id ${targetId}, or delete the stale envelope file`,
|
|
491
500
|
});
|
|
492
501
|
}
|
|
493
502
|
else {
|
|
@@ -499,6 +508,7 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
499
508
|
violations.push({
|
|
500
509
|
rule: "RFC-IMP-09",
|
|
501
510
|
message: `RFC ${targetId} evidence envelope lacks hash fields (pre-RFC-0330 format). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
|
|
511
|
+
fixHint: `re-run rfc.verification.emit --id ${targetId} and commit the refreshed envelope`,
|
|
502
512
|
});
|
|
503
513
|
}
|
|
504
514
|
else if (env.rfcFileHash !== currentFileHash ||
|
|
@@ -512,6 +522,7 @@ async function evaluateStampEvidenceGates(opts) {
|
|
|
512
522
|
violations.push({
|
|
513
523
|
rule: "RFC-IMP-09",
|
|
514
524
|
message: `RFC ${targetId} evidence is stale: ${staleFields} mismatch — the RFC file or its acceptance list changed after emission. Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
|
|
525
|
+
fixHint: `re-run rfc.verification.emit --id ${targetId} after committing the RFC bytes, then commit the refreshed envelope`,
|
|
515
526
|
});
|
|
516
527
|
}
|
|
517
528
|
}
|
|
@@ -603,7 +614,12 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
603
614
|
// RFC-1322: the stamp performs the checkbox flips itself — but only for
|
|
604
615
|
// criteria whose (evidence: ...) annotation resolves — and refreshes a
|
|
605
616
|
// missing/stale envelope in-process before the gates evaluate it.
|
|
606
|
-
|
|
617
|
+
// RFC-1483: the --check-criteria repair machinery is the default path —
|
|
618
|
+
// the flag stays an accepted alias for script stability; --no-repair
|
|
619
|
+
// restores fail-fast gating and wins when both are passed.
|
|
620
|
+
const noRepair = input.flags["no-repair"] === true;
|
|
621
|
+
const repairEnabled = !noRepair;
|
|
622
|
+
const repaired = [];
|
|
607
623
|
// ── Find the target RFC ───────────────────────────────────────────────────
|
|
608
624
|
const files = await listRfcFiles(rfcDirPath);
|
|
609
625
|
const targetFile = files.find((f) => rfcFileMatchesId(f, targetId));
|
|
@@ -674,24 +690,28 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
674
690
|
logger.info(`[rfc.implement.stamp] --sync: ${syncReport.summary ?? "resync chain completed"}`);
|
|
675
691
|
}
|
|
676
692
|
// ── RFC-IMP-02: criterion checks (V-26/V-27 semantics) ────────────────────
|
|
677
|
-
// Under
|
|
678
|
-
// candidates for the auto-check pass, and checkedWithoutEvidence
|
|
679
|
-
// the post-flip body — a flipped line always keeps its
|
|
693
|
+
// Under the default repair pass both branches defer: unchecked lines become
|
|
694
|
+
// flip candidates for the auto-check pass, and checkedWithoutEvidence
|
|
695
|
+
// re-runs on the post-flip body — a flipped line always keeps its
|
|
696
|
+
// annotation. --no-repair restores these blocking branches.
|
|
680
697
|
const criteriaEval = evaluateAcceptanceCriteria(body);
|
|
681
|
-
// RFC-1383: the unchecked violation names the remedy — --
|
|
682
|
-
// auto-
|
|
683
|
-
//
|
|
698
|
+
// RFC-1383: the unchecked violation names the remedy — dropping --no-repair
|
|
699
|
+
// lets the default repair pass auto-verify resolvable criteria in-place.
|
|
700
|
+
// This branch only runs under --no-repair, so the hint can never offer a
|
|
701
|
+
// no-op.
|
|
684
702
|
const criteriaTotal = criteriaEval.totalChecked + criteriaEval.totalUnchecked;
|
|
685
|
-
if (!
|
|
703
|
+
if (!repairEnabled && criteriaEval.totalUnchecked > 0) {
|
|
686
704
|
violations.push({
|
|
687
705
|
rule: "RFC-IMP-02",
|
|
688
|
-
message: `${criteriaEval.totalUnchecked} acceptance criteria are unchecked. All criteria must be checked before stamping: ${criteriaEval.uncheckedLines.join("; ")}. Re-run
|
|
706
|
+
message: `${criteriaEval.totalUnchecked} acceptance criteria are unchecked. All criteria must be checked before stamping: ${criteriaEval.uncheckedLines.join("; ")}. Re-run without --no-repair to let the default repair pass auto-verify resolvable criteria, or annotate evidence on each criterion and re-run.`,
|
|
707
|
+
fixHint: `re-run without --no-repair (the default repair pass flips criteria whose (evidence: test:<path>|file:<path>|<path>:<line>|probe:AC-N) annotation resolves), or annotate evidence on each listed criterion`,
|
|
689
708
|
});
|
|
690
709
|
}
|
|
691
|
-
if (!
|
|
710
|
+
if (!repairEnabled && criteriaEval.checkedWithoutEvidence.length > 0) {
|
|
692
711
|
violations.push({
|
|
693
712
|
rule: "RFC-IMP-02",
|
|
694
713
|
message: `${criteriaEval.checkedWithoutEvidence.length} checked criteria lack inline (evidence: ...) annotation: ${criteriaEval.checkedWithoutEvidence.join("; ")}`,
|
|
714
|
+
fixHint: `add an inline (evidence: ...) annotation to each listed checked criterion`,
|
|
695
715
|
});
|
|
696
716
|
}
|
|
697
717
|
// ── RFC-IMP-07: dependsOn dependency gate (RFC-0795) ──────────────────────
|
|
@@ -731,6 +751,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
731
751
|
violations.push({
|
|
732
752
|
rule: "RFC-IMP-03",
|
|
733
753
|
message: `No commit referencing ${targetId} found in git history. Pass --implementation-commit <SHA> explicitly.`,
|
|
754
|
+
fixHint: `land an implementation commit via ecosystem.commit referencing ${targetId}, then pass --implementation-commit <sha>`,
|
|
734
755
|
});
|
|
735
756
|
}
|
|
736
757
|
else {
|
|
@@ -756,6 +777,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
756
777
|
violations.push({
|
|
757
778
|
rule: "RFC-IMP-03",
|
|
758
779
|
message: `Multiple commits reference ${targetId}:\n${candidateList}\nPass --implementation-commit <SHA> to specify which one.${suggestion}`,
|
|
780
|
+
fixHint: `pass --implementation-commit <sha> naming the commit that carries the implementation payload`,
|
|
759
781
|
});
|
|
760
782
|
}
|
|
761
783
|
}
|
|
@@ -770,6 +792,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
770
792
|
violations.push({
|
|
771
793
|
rule: "RFC-IMP-04",
|
|
772
794
|
message: `RFC file ${rfcRelPath} has uncommitted changes. Commit the RFC file before stamping.`,
|
|
795
|
+
fixHint: `commit or stash the uncommitted changes to ${rfcRelPath}, then re-run`,
|
|
773
796
|
});
|
|
774
797
|
}
|
|
775
798
|
// ── RFC-IMP-03: implementation commit validation ──────────────────────────
|
|
@@ -779,6 +802,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
779
802
|
violations.push({
|
|
780
803
|
rule: "RFC-IMP-03",
|
|
781
804
|
message: `Implementation commit ${implementationCommit} is not reachable from HEAD. The commit must be an ancestor of the current HEAD.`,
|
|
805
|
+
fixHint: `pass --implementation-commit <sha> naming an ancestor of HEAD`,
|
|
782
806
|
});
|
|
783
807
|
}
|
|
784
808
|
else {
|
|
@@ -787,6 +811,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
787
811
|
violations.push({
|
|
788
812
|
rule: "RFC-IMP-03",
|
|
789
813
|
message: `Implementation commit ${implementationCommit} does not reference ${targetId} in its message or changed files.`,
|
|
814
|
+
fixHint: `pass --implementation-commit <sha> naming a commit that references ${targetId} in its message or changed files`,
|
|
790
815
|
});
|
|
791
816
|
}
|
|
792
817
|
else {
|
|
@@ -808,6 +833,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
808
833
|
violations.push({
|
|
809
834
|
rule: "STAMP-GOV-01",
|
|
810
835
|
message: `Implementation commit(s) for ${targetId} carry no governance provenance (no X-RFC: ${targetId} trailer, no injected CHANGE_SUMMARY item) — scanned: ${scanShas.join(", ")}. Retro-fix: hand-edit CHANGE_SUMMARY <item>${targetId}: …</item> entries into the touched files' headers in the worktree, then land a follow-up ecosystem.commit --rfc ${targetId} --message "docs(${targetId.toLowerCase()}): retrofit governance provenance" and re-stamp.`,
|
|
836
|
+
fixHint: `re-commit the implementation via ecosystem.commit so it carries governance provenance (or apply the retro-fix in the message), then pass --implementation-commit <sha>`,
|
|
811
837
|
});
|
|
812
838
|
}
|
|
813
839
|
}
|
|
@@ -834,12 +860,15 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
834
860
|
// must also be evaluated when hasProbes is now false, because probe
|
|
835
861
|
// deletion IS a criteria change and would otherwise slip past
|
|
836
862
|
// requiresEvidence entirely (RFC-IMP-08 exempts policy/deprecation kinds).
|
|
837
|
-
// let —
|
|
863
|
+
// let — the repair pass re-reads the envelope after the emit-if-needed pass.
|
|
838
864
|
let evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
|
|
839
|
-
// Default path:
|
|
840
|
-
//
|
|
841
|
-
//
|
|
842
|
-
|
|
865
|
+
// Default path: the shared evaluator fires pre-lock. --no-repair runs the
|
|
866
|
+
// full gateset here; the default repair pass runs only the
|
|
867
|
+
// envelope-independent subset (RFC-IMP-10/11/12/15) so composite reporting
|
|
868
|
+
// is preserved — the envelope-dependent gates (RFC-IMP-06/09/13/14)
|
|
869
|
+
// evaluate in-lock after the emit-if-needed pass may have refreshed the
|
|
870
|
+
// envelope.
|
|
871
|
+
{
|
|
843
872
|
const gates = await evaluateStampEvidenceGates({
|
|
844
873
|
evidenceCheck,
|
|
845
874
|
requiresEvidence,
|
|
@@ -853,6 +882,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
853
882
|
waiverReason,
|
|
854
883
|
implementationCommit,
|
|
855
884
|
waiveOutcome,
|
|
885
|
+
gatePhase: repairEnabled ? "independent" : undefined,
|
|
856
886
|
});
|
|
857
887
|
violations.push(...gates.violations);
|
|
858
888
|
stampWarnings.push(...gates.warnings);
|
|
@@ -872,14 +902,43 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
872
902
|
message: `RFC ${targetId} (kind: ${rfcKind}) has no acceptance probes. Post-cutoff architecture/contract/command RFCs require at least one probe (RFC-0997). See RFC-0996 for the authoring standard.`,
|
|
873
903
|
});
|
|
874
904
|
}
|
|
905
|
+
// RFC-1463 composite reporting under the default repair pass: when the
|
|
906
|
+
// run is already doomed pre-lock, the envelope-dependent gates still
|
|
907
|
+
// evaluate on the current state (minus the repairable staleness findings
|
|
908
|
+
// the refresh would fix anyway) so one report names every real blocker
|
|
909
|
+
// instead of surfacing them serially across re-runs.
|
|
910
|
+
if (repairEnabled && violations.length > 0) {
|
|
911
|
+
const gates = await evaluateStampEvidenceGates({
|
|
912
|
+
evidenceCheck,
|
|
913
|
+
requiresEvidence,
|
|
914
|
+
hasProbes,
|
|
915
|
+
targetId,
|
|
916
|
+
rfcFilePath,
|
|
917
|
+
acceptance,
|
|
918
|
+
io,
|
|
919
|
+
frontmatter: fm,
|
|
920
|
+
workspaceRoot,
|
|
921
|
+
waiverReason,
|
|
922
|
+
implementationCommit,
|
|
923
|
+
waiveOutcome,
|
|
924
|
+
gatePhase: "dependent",
|
|
925
|
+
suppressRepairable: true,
|
|
926
|
+
});
|
|
927
|
+
violations.push(...gates.violations);
|
|
928
|
+
stampWarnings.push(...gates.warnings);
|
|
929
|
+
for (const w of gates.warnings)
|
|
930
|
+
logger.warn(`${w.rule}: ${w.message}`);
|
|
931
|
+
if (gates.evidenceRelPath)
|
|
932
|
+
evidenceRelPath = gates.evidenceRelPath;
|
|
933
|
+
}
|
|
875
934
|
// If any violations found, return without mutation
|
|
876
935
|
if (violations.length > 0) {
|
|
877
936
|
return stampFailResult(violations, isDryRun, outputFormat, logger);
|
|
878
937
|
}
|
|
879
938
|
// ── RFC-IMP-05: acquire RFC-specific exclusive lock ───────────────────────
|
|
880
|
-
// Under
|
|
881
|
-
// the emit-if-needed envelope refresh, not the stamp mutation —
|
|
882
|
-
// envelope-independent gates above abort before this point.
|
|
939
|
+
// Under the default repair pass the lock must precede the FIRST write —
|
|
940
|
+
// which is the emit-if-needed envelope refresh, not the stamp mutation —
|
|
941
|
+
// so all envelope-independent gates above abort before this point.
|
|
883
942
|
const { acquired, lockPath } = await acquireRfcLock(workspaceRoot, targetId);
|
|
884
943
|
if (!acquired) {
|
|
885
944
|
violations.push({
|
|
@@ -891,14 +950,15 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
891
950
|
try {
|
|
892
951
|
// ── Atomic mutation ──────────────────────────────────────────────────────
|
|
893
952
|
const rfcSource = await io.readFile(rfcFilePath);
|
|
894
|
-
// RFC-1322: the mutation-bound source — under
|
|
895
|
-
// the auto-check flips;
|
|
953
|
+
// RFC-1322: the mutation-bound source — under the default repair pass it
|
|
954
|
+
// carries the auto-check flips; under --no-repair it is the committed
|
|
955
|
+
// file text.
|
|
896
956
|
let stampSource = rfcSource;
|
|
897
957
|
let criteriaAutoChecked;
|
|
898
958
|
let criteriaPendingRefresh = [];
|
|
899
959
|
let evidenceWouldRefresh = false;
|
|
900
960
|
let effectiveCriteriaChecked = criteriaEval.totalChecked;
|
|
901
|
-
if (
|
|
961
|
+
if (repairEnabled) {
|
|
902
962
|
// Emit-if-needed (RFC-1322 order step 4): a missing, malformed, or
|
|
903
963
|
// hash-stale envelope is refreshed in-process through the same direct
|
|
904
964
|
// runRfcVerificationEmit call the post-stamp re-emit uses — on the
|
|
@@ -906,6 +966,14 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
906
966
|
// freshness precheck (RFC-1320) gates this emit exactly as a manual one.
|
|
907
967
|
const needsEmit = hasProbes && envelopeNeedsRefresh(evidenceCheck, rfcSource, acceptance);
|
|
908
968
|
evidenceWouldRefresh = needsEmit;
|
|
969
|
+
// RFC-1483: the envelope emit is the first link of the repair chain —
|
|
970
|
+
// computed for dry-run too, executed only on a real run.
|
|
971
|
+
if (needsEmit) {
|
|
972
|
+
repaired.push({
|
|
973
|
+
kind: "envelope-emitted",
|
|
974
|
+
detail: join(VERIFICATION_DIR, `${targetId.toLowerCase()}.generated.yaml`),
|
|
975
|
+
});
|
|
976
|
+
}
|
|
909
977
|
if (needsEmit && !isDryRun) {
|
|
910
978
|
let emitOk = false;
|
|
911
979
|
let emitSummary = "";
|
|
@@ -924,6 +992,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
924
992
|
violations.push({
|
|
925
993
|
rule: "EVIDENCE-SYNC-02",
|
|
926
994
|
message: `pre-stamp evidence emit for ${targetId} threw: ${emitErr instanceof Error ? emitErr.message : String(emitErr)}. Resolve the failing step and re-run the stamp.`,
|
|
995
|
+
fixHint: `resolve the failing emit step, then re-run the stamp`,
|
|
927
996
|
});
|
|
928
997
|
return stampFailResult(violations, isDryRun, outputFormat, logger);
|
|
929
998
|
}
|
|
@@ -931,10 +1000,35 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
931
1000
|
violations.push({
|
|
932
1001
|
rule: "EVIDENCE-SYNC-02",
|
|
933
1002
|
message: `pre-stamp evidence emit for ${targetId} failed${emitSummary ? `: ${emitSummary}` : ""}. Resolve the failing step and re-run the stamp.`,
|
|
1003
|
+
fixHint: `resolve the failing emit step, then re-run the stamp`,
|
|
934
1004
|
});
|
|
1005
|
+
// Composite-gate semantics (RFC-1463): the failed emit is not the
|
|
1006
|
+
// whole story — evaluate the envelope-dependent gates against the
|
|
1007
|
+
// unrefreshed state so the report still names the violations the
|
|
1008
|
+
// refresh would have had to satisfy (e.g. RFC-IMP-13 on a missing
|
|
1009
|
+
// envelope). The independent subset already ran pre-lock.
|
|
1010
|
+
const stale = await evaluateStampEvidenceGates({
|
|
1011
|
+
evidenceCheck,
|
|
1012
|
+
requiresEvidence,
|
|
1013
|
+
hasProbes,
|
|
1014
|
+
targetId,
|
|
1015
|
+
rfcFilePath,
|
|
1016
|
+
acceptance,
|
|
1017
|
+
io,
|
|
1018
|
+
frontmatter: fm,
|
|
1019
|
+
workspaceRoot,
|
|
1020
|
+
waiverReason,
|
|
1021
|
+
implementationCommit,
|
|
1022
|
+
waiveOutcome,
|
|
1023
|
+
gatePhase: "dependent",
|
|
1024
|
+
});
|
|
1025
|
+
violations.push(...stale.violations);
|
|
1026
|
+
stampWarnings.push(...stale.warnings);
|
|
1027
|
+
for (const w of stale.warnings)
|
|
1028
|
+
logger.warn(`${w.rule}: ${w.message}`);
|
|
935
1029
|
return stampFailResult(violations, isDryRun, outputFormat, logger);
|
|
936
1030
|
}
|
|
937
|
-
logger.info(`[rfc.implement.stamp]
|
|
1031
|
+
logger.info(`[rfc.implement.stamp] repair: refreshed stale/missing envelope`);
|
|
938
1032
|
evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
|
|
939
1033
|
}
|
|
940
1034
|
// Auto-check pass (RFC-1322 order step 5, in-memory): each unchecked
|
|
@@ -956,10 +1050,12 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
956
1050
|
message: `${auto.failures.length} unchecked acceptance criteria lack resolvable (evidence: ...) annotations — ` +
|
|
957
1051
|
`supply a resolvable reference (test:<path>, file:<path>, <path>:<line>, or probe:AC-N bound to a passing envelope probe): ` +
|
|
958
1052
|
auto.failures.map((f) => `${f.criterion} [${f.annotation}]`).join("; "),
|
|
1053
|
+
fixHint: `annotate each listed criterion with a resolvable evidence reference — test:<path>, file:<path>, <path>:<line>, or probe:AC-N bound to a passing envelope probe`,
|
|
959
1054
|
});
|
|
960
1055
|
}
|
|
961
1056
|
if (auto.flippable.length > 0) {
|
|
962
1057
|
stampSource = flipCriteriaInSource(rfcSource, new Set(auto.flippable));
|
|
1058
|
+
repaired.push({ kind: "criteria-checked", detail: auto.flippedIds.join(",") });
|
|
963
1059
|
}
|
|
964
1060
|
// Post-flip criteria gates on the mutation-bound bytes (step 6): a
|
|
965
1061
|
// still-unchecked line means the flip failed to land — fail closed
|
|
@@ -973,20 +1069,23 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
973
1069
|
if (residualUnchecked.length > 0) {
|
|
974
1070
|
violations.push({
|
|
975
1071
|
rule: "RFC-IMP-02",
|
|
976
|
-
message: `${residualUnchecked.length} acceptance criteria remain unchecked after the
|
|
1072
|
+
message: `${residualUnchecked.length} acceptance criteria remain unchecked after the repair pass: ${residualUnchecked.join("; ")}`,
|
|
1073
|
+
fixHint: `the repair pass could not flip these criteria — annotate a resolvable evidence reference on each and re-run`,
|
|
977
1074
|
});
|
|
978
1075
|
}
|
|
979
1076
|
if (postFlipEval.checkedWithoutEvidence.length > 0) {
|
|
980
1077
|
violations.push({
|
|
981
1078
|
rule: "RFC-IMP-02",
|
|
982
1079
|
message: `${postFlipEval.checkedWithoutEvidence.length} checked criteria lack inline (evidence: ...) annotation: ${postFlipEval.checkedWithoutEvidence.join("; ")}`,
|
|
1080
|
+
fixHint: `add an inline (evidence: ...) annotation to each listed checked criterion`,
|
|
983
1081
|
});
|
|
984
1082
|
}
|
|
985
1083
|
effectiveCriteriaChecked = postFlipEval.totalChecked;
|
|
986
|
-
//
|
|
987
|
-
//
|
|
988
|
-
// since committed-bytes verdicts are not predictive of the
|
|
989
|
-
// state the real stamp evaluates.
|
|
1084
|
+
// Envelope-dependent gates (RFC-IMP-06/09/13/14) against the (possibly
|
|
1085
|
+
// just-refreshed) envelope — skipped in dry-run when a refresh would
|
|
1086
|
+
// run, since committed-bytes verdicts are not predictive of the
|
|
1087
|
+
// post-emit state the real stamp evaluates. The independent subset
|
|
1088
|
+
// already reported pre-lock.
|
|
990
1089
|
if (!(isDryRun && needsEmit)) {
|
|
991
1090
|
const gates = await evaluateStampEvidenceGates({
|
|
992
1091
|
evidenceCheck,
|
|
@@ -1001,6 +1100,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
1001
1100
|
waiverReason,
|
|
1002
1101
|
implementationCommit,
|
|
1003
1102
|
waiveOutcome,
|
|
1103
|
+
gatePhase: "dependent",
|
|
1004
1104
|
});
|
|
1005
1105
|
violations.push(...gates.violations);
|
|
1006
1106
|
stampWarnings.push(...gates.warnings);
|
|
@@ -1045,13 +1145,15 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
1045
1145
|
stampedAt,
|
|
1046
1146
|
criteriaChecked: effectiveCriteriaChecked,
|
|
1047
1147
|
criteriaTotal,
|
|
1048
|
-
|
|
1148
|
+
dryRun: true,
|
|
1149
|
+
...(repairEnabled
|
|
1049
1150
|
? {
|
|
1050
1151
|
criteriaAutoChecked: criteriaAutoChecked ?? [],
|
|
1051
1152
|
criteriaPendingRefresh,
|
|
1052
1153
|
evidenceWouldRefresh,
|
|
1053
1154
|
}
|
|
1054
1155
|
: {}),
|
|
1156
|
+
...(repaired.length > 0 ? { repaired } : {}),
|
|
1055
1157
|
...(evidenceRelPath ? { evidencePath: evidenceRelPath } : {}),
|
|
1056
1158
|
},
|
|
1057
1159
|
violations: [],
|
|
@@ -1060,7 +1162,7 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
1060
1162
|
summary: `rfc.implement.stamp: dry-run — ${targetId} would be stamped`,
|
|
1061
1163
|
};
|
|
1062
1164
|
}
|
|
1063
|
-
// Write the mutated RFC file atomically — under
|
|
1165
|
+
// Write the mutated RFC file atomically — under the repair pass this
|
|
1064
1166
|
// single write carries the checkbox flips AND the frontmatter mutation.
|
|
1065
1167
|
await writeFileAtomic(rfcFilePath, mutatedSource);
|
|
1066
1168
|
// ── RFC-1053: Generate per-RFC metrics (non-fatal, guarded by !isDryRun) ─
|
|
@@ -1125,7 +1227,8 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
1125
1227
|
stampedAt,
|
|
1126
1228
|
criteriaChecked: effectiveCriteriaChecked,
|
|
1127
1229
|
criteriaTotal,
|
|
1128
|
-
...(
|
|
1230
|
+
...(repairEnabled ? { criteriaAutoChecked: criteriaAutoChecked ?? [] } : {}),
|
|
1231
|
+
...(repaired.length > 0 ? { repaired } : {}),
|
|
1129
1232
|
...(evidenceRelPath ? { evidencePath: evidenceRelPath } : {}),
|
|
1130
1233
|
...(hasProbes ? { evidenceReEmitted } : {}),
|
|
1131
1234
|
...(metricsPath ? { metricsPath } : {}),
|
|
@@ -1148,19 +1251,33 @@ export async function runRfcImplementStamp(input, context) {
|
|
|
1148
1251
|
}
|
|
1149
1252
|
function stampFailResult(violations, isDryRun, outputFormat, logger) {
|
|
1150
1253
|
const prefix = isDryRun ? "[dry-run] " : "";
|
|
1254
|
+
// RFC-1483: the printed list IS the ordered remediation checklist —
|
|
1255
|
+
// prerequisite-rule violations sort by PREREQUISITE_ORDER; unlisted rules
|
|
1256
|
+
// keep their original relative order after the listed ones.
|
|
1257
|
+
const ordered = [...violations].sort((a, b) => {
|
|
1258
|
+
const ai = PREREQUISITE_ORDER.indexOf(a.rule);
|
|
1259
|
+
const bi = PREREQUISITE_ORDER.indexOf(b.rule);
|
|
1260
|
+
if (ai === -1 && bi === -1)
|
|
1261
|
+
return 0;
|
|
1262
|
+
if (ai === -1)
|
|
1263
|
+
return 1;
|
|
1264
|
+
if (bi === -1)
|
|
1265
|
+
return -1;
|
|
1266
|
+
return ai - bi;
|
|
1267
|
+
});
|
|
1151
1268
|
if (outputFormat === "pretty") {
|
|
1152
|
-
for (const v of
|
|
1153
|
-
logger.warn(`${prefix}${v.rule}: ${v.message}`);
|
|
1269
|
+
for (const v of ordered) {
|
|
1270
|
+
logger.warn(`${prefix}${v.rule}: ${v.message}${v.fixHint ? `\n fix: ${v.fixHint}` : ""}`);
|
|
1154
1271
|
}
|
|
1155
1272
|
}
|
|
1156
1273
|
return {
|
|
1157
1274
|
data: {
|
|
1158
1275
|
command: "rfc.implement.stamp",
|
|
1159
1276
|
status: "fail",
|
|
1160
|
-
violations,
|
|
1277
|
+
violations: ordered,
|
|
1161
1278
|
},
|
|
1162
1279
|
exitCode: 1,
|
|
1163
|
-
summary: `${prefix}rfc.implement.stamp: ${
|
|
1280
|
+
summary: `${prefix}rfc.implement.stamp: ${ordered.length} violation${ordered.length === 1 ? "" : "s"}`,
|
|
1164
1281
|
};
|
|
1165
1282
|
}
|
|
1166
1283
|
//# sourceMappingURL=implement-stamp.js.map
|