@warpgogol/forge 9.4.1 → 9.6.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 +33 -0
- package/README.md +30 -0
- package/README.uk.md +30 -0
- package/bin/cli.ts +163 -53
- package/dist/bin/cli.js +137 -42
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/codebase/codebase.module.d.ts +3 -0
- package/dist/os/codebase/codebase.module.d.ts.map +1 -0
- package/dist/os/codebase/codebase.module.js +53 -0
- package/dist/os/codebase/codebase.module.js.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts +15 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.js +97 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure.d.ts +22 -0
- package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure.js +435 -0
- package/dist/os/codebase/handlers/codebase-measure.js.map +1 -0
- package/dist/os/codebase/index.d.ts +4 -0
- package/dist/os/codebase/index.d.ts.map +1 -0
- package/dist/os/codebase/index.js +13 -0
- package/dist/os/codebase/index.js.map +1 -0
- package/dist/os/codebase/types.d.ts +35 -0
- package/dist/os/codebase/types.d.ts.map +1 -0
- package/dist/os/codebase/types.js +17 -0
- package/dist/os/codebase/types.js.map +1 -0
- package/dist/os/core/handlers/package-health.d.ts +6 -4
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +15 -20
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/correctness/anchors.d.ts +24 -0
- package/dist/os/correctness/anchors.d.ts.map +1 -0
- package/dist/os/correctness/anchors.js +156 -0
- package/dist/os/correctness/anchors.js.map +1 -0
- package/dist/os/correctness/audit/bindings-verify-substance.d.ts +7 -0
- package/dist/os/correctness/audit/bindings-verify-substance.d.ts.map +1 -0
- package/dist/os/correctness/audit/bindings-verify-substance.js +145 -0
- package/dist/os/correctness/audit/bindings-verify-substance.js.map +1 -0
- package/dist/os/correctness/audit/differential.d.ts +7 -0
- package/dist/os/correctness/audit/differential.d.ts.map +1 -0
- package/dist/os/correctness/audit/differential.js +105 -0
- package/dist/os/correctness/audit/differential.js.map +1 -0
- package/dist/os/correctness/audit/ledger-orphans.d.ts +6 -0
- package/dist/os/correctness/audit/ledger-orphans.d.ts.map +1 -0
- package/dist/os/correctness/audit/ledger-orphans.js +71 -0
- package/dist/os/correctness/audit/ledger-orphans.js.map +1 -0
- package/dist/os/correctness/audit/ledger.d.ts +29 -0
- package/dist/os/correctness/audit/ledger.d.ts.map +1 -0
- package/dist/os/correctness/audit/ledger.js +72 -0
- package/dist/os/correctness/audit/ledger.js.map +1 -0
- package/dist/os/correctness/audit/run.d.ts +27 -0
- package/dist/os/correctness/audit/run.d.ts.map +1 -0
- package/dist/os/correctness/audit/run.js +184 -0
- package/dist/os/correctness/audit/run.js.map +1 -0
- package/dist/os/correctness/audit/schema-db.d.ts +32 -0
- package/dist/os/correctness/audit/schema-db.d.ts.map +1 -0
- package/dist/os/correctness/audit/schema-db.js +166 -0
- package/dist/os/correctness/audit/schema-db.js.map +1 -0
- package/dist/os/correctness/audit/snapshot.d.ts +34 -0
- package/dist/os/correctness/audit/snapshot.d.ts.map +1 -0
- package/dist/os/correctness/audit/snapshot.js +190 -0
- package/dist/os/correctness/audit/snapshot.js.map +1 -0
- package/dist/os/correctness/audit/sql-scanner.d.ts +28 -0
- package/dist/os/correctness/audit/sql-scanner.d.ts.map +1 -0
- package/dist/os/correctness/audit/sql-scanner.js +279 -0
- package/dist/os/correctness/audit/sql-scanner.js.map +1 -0
- package/dist/os/correctness/audit/sql-schema-conform.d.ts +17 -0
- package/dist/os/correctness/audit/sql-schema-conform.d.ts.map +1 -0
- package/dist/os/correctness/audit/sql-schema-conform.js +163 -0
- package/dist/os/correctness/audit/sql-schema-conform.js.map +1 -0
- package/dist/os/correctness/audit/state-transitions-coverage.d.ts +19 -0
- package/dist/os/correctness/audit/state-transitions-coverage.d.ts.map +1 -0
- package/dist/os/correctness/audit/state-transitions-coverage.js +263 -0
- package/dist/os/correctness/audit/state-transitions-coverage.js.map +1 -0
- package/dist/os/correctness/audit/tests/git-fixture.d.ts +15 -0
- package/dist/os/correctness/audit/tests/git-fixture.d.ts.map +1 -0
- package/dist/os/correctness/audit/tests/git-fixture.js +85 -0
- package/dist/os/correctness/audit/tests/git-fixture.js.map +1 -0
- package/dist/os/correctness/audit/types.d.ts +58 -0
- package/dist/os/correctness/audit/types.d.ts.map +1 -0
- package/dist/os/correctness/audit/types.js +34 -0
- package/dist/os/correctness/audit/types.js.map +1 -0
- package/dist/os/correctness/correctness.module.d.ts +3 -0
- package/dist/os/correctness/correctness.module.d.ts.map +1 -0
- package/dist/os/correctness/correctness.module.js +173 -0
- package/dist/os/correctness/correctness.module.js.map +1 -0
- package/dist/os/correctness/gate/frozen.d.ts +52 -0
- package/dist/os/correctness/gate/frozen.d.ts.map +1 -0
- package/dist/os/correctness/gate/frozen.js +322 -0
- package/dist/os/correctness/gate/frozen.js.map +1 -0
- package/dist/os/correctness/gate/origin.d.ts +28 -0
- package/dist/os/correctness/gate/origin.d.ts.map +1 -0
- package/dist/os/correctness/gate/origin.js +139 -0
- package/dist/os/correctness/gate/origin.js.map +1 -0
- package/dist/os/correctness/gate/repo.d.ts +25 -0
- package/dist/os/correctness/gate/repo.d.ts.map +1 -0
- package/dist/os/correctness/gate/repo.js +88 -0
- package/dist/os/correctness/gate/repo.js.map +1 -0
- package/dist/os/correctness/gate/run.d.ts +22 -0
- package/dist/os/correctness/gate/run.d.ts.map +1 -0
- package/dist/os/correctness/gate/run.js +430 -0
- package/dist/os/correctness/gate/run.js.map +1 -0
- package/dist/os/correctness/gate/runner.d.ts +18 -0
- package/dist/os/correctness/gate/runner.d.ts.map +1 -0
- package/dist/os/correctness/gate/runner.js +123 -0
- package/dist/os/correctness/gate/runner.js.map +1 -0
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts +36 -0
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -0
- package/dist/os/correctness/gate/tests/gate-fixture.js +153 -0
- package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -0
- package/dist/os/correctness/gate/types.d.ts +102 -0
- package/dist/os/correctness/gate/types.d.ts.map +1 -0
- package/dist/os/correctness/gate/types.js +64 -0
- package/dist/os/correctness/gate/types.js.map +1 -0
- package/dist/os/correctness/handlers/audit.d.ts +4 -0
- package/dist/os/correctness/handlers/audit.d.ts.map +1 -0
- package/dist/os/correctness/handlers/audit.js +95 -0
- package/dist/os/correctness/handlers/audit.js.map +1 -0
- package/dist/os/correctness/handlers/gate.d.ts +4 -0
- package/dist/os/correctness/handlers/gate.d.ts.map +1 -0
- package/dist/os/correctness/handlers/gate.js +62 -0
- package/dist/os/correctness/handlers/gate.js.map +1 -0
- package/dist/os/correctness/handlers/validate.d.ts +19 -0
- package/dist/os/correctness/handlers/validate.d.ts.map +1 -0
- package/dist/os/correctness/handlers/validate.js +367 -0
- package/dist/os/correctness/handlers/validate.js.map +1 -0
- package/dist/os/correctness/index.d.ts +8 -0
- package/dist/os/correctness/index.d.ts.map +1 -0
- package/dist/os/correctness/index.js +23 -0
- package/dist/os/correctness/index.js.map +1 -0
- package/dist/os/correctness/manifest-schema.d.ts +155 -0
- package/dist/os/correctness/manifest-schema.d.ts.map +1 -0
- package/dist/os/correctness/manifest-schema.js +110 -0
- package/dist/os/correctness/manifest-schema.js.map +1 -0
- package/dist/os/correctness/references.d.ts +22 -0
- package/dist/os/correctness/references.d.ts.map +1 -0
- package/dist/os/correctness/references.js +129 -0
- package/dist/os/correctness/references.js.map +1 -0
- package/dist/os/correctness/tests/fixture-workspace.d.ts +23 -0
- package/dist/os/correctness/tests/fixture-workspace.d.ts.map +1 -0
- package/dist/os/correctness/tests/fixture-workspace.js +104 -0
- package/dist/os/correctness/tests/fixture-workspace.js.map +1 -0
- package/dist/os/correctness/workspace.d.ts +32 -0
- package/dist/os/correctness/workspace.d.ts.map +1 -0
- package/dist/os/correctness/workspace.js +147 -0
- package/dist/os/correctness/workspace.js.map +1 -0
- package/dist/os/flow/correctness-step.d.ts +19 -0
- package/dist/os/flow/correctness-step.d.ts.map +1 -0
- package/dist/os/flow/correctness-step.js +133 -0
- package/dist/os/flow/correctness-step.js.map +1 -0
- package/dist/os/flow/digest.d.ts +18 -0
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +28 -1
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dirty-classify.d.ts +7 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -1
- package/dist/os/flow/dirty-classify.js +11 -0
- package/dist/os/flow/dirty-classify.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +19 -4
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +9 -9
- package/dist/os/flow/handlers/flow-check.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +11 -1
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +11 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +148 -30
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +14 -19
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/index.d.ts +1 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +5 -3
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/post-rebase-regen.d.ts +33 -0
- package/dist/os/flow/post-rebase-regen.d.ts.map +1 -0
- package/dist/os/flow/post-rebase-regen.js +120 -0
- package/dist/os/flow/post-rebase-regen.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +24 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +364 -24
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +23 -4
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +6 -6
- package/dist/os/flow/tests/helpers.d.ts +9 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +36 -2
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/friction/types.d.ts +2 -2
- package/dist/os/gate-run/detach.d.ts +27 -0
- package/dist/os/gate-run/detach.d.ts.map +1 -0
- package/dist/os/gate-run/detach.js +85 -0
- package/dist/os/gate-run/detach.js.map +1 -0
- package/dist/os/gate-run/gate-run.module.d.ts +3 -0
- package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
- package/dist/os/gate-run/gate-run.module.js +23 -0
- package/dist/os/gate-run/gate-run.module.js.map +1 -0
- package/dist/os/gate-run/index.d.ts +7 -0
- package/dist/os/gate-run/index.d.ts.map +1 -0
- package/dist/os/gate-run/index.js +5 -0
- package/dist/os/gate-run/index.js.map +1 -0
- package/dist/os/gate-run/record.d.ts +47 -0
- package/dist/os/gate-run/record.d.ts.map +1 -0
- package/dist/os/gate-run/record.js +157 -0
- package/dist/os/gate-run/record.js.map +1 -0
- package/dist/os/gate-run/status.d.ts +53 -0
- package/dist/os/gate-run/status.d.ts.map +1 -0
- package/dist/os/gate-run/status.js +163 -0
- package/dist/os/gate-run/status.js.map +1 -0
- package/dist/os/gate-run/types.d.ts +47 -0
- package/dist/os/gate-run/types.d.ts.map +1 -0
- package/dist/os/gate-run/types.js +24 -0
- package/dist/os/gate-run/types.js.map +1 -0
- package/dist/os/program/schemas.d.ts +3 -3
- package/dist/os/queue/types.d.ts +2 -2
- package/dist/os/rfc/evidence-annotation.d.ts +26 -0
- package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
- package/dist/os/rfc/evidence-annotation.js +52 -0
- package/dist/os/rfc/evidence-annotation.js.map +1 -0
- package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
- package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
- package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts +8 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.js +65 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +35 -29
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +152 -11
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +20 -7
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +12 -3
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +5 -2
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +12 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
- package/dist/os/rfc/verify-workspace.js +155 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -1
- package/dist/os/system/task-schemas.d.ts +1 -1
- package/dist/os/system/tests/helpers.d.ts.map +1 -1
- package/dist/os/system/tests/helpers.js +6 -1
- package/dist/os/system/tests/helpers.js.map +1 -1
- package/dist/os/werkstatt/handlers/schema.d.ts +1 -1
- package/dist/src/cli-flags.d.ts.map +1 -1
- package/dist/src/cli-flags.js +6 -0
- package/dist/src/cli-flags.js.map +1 -1
- package/dist/src/command-modules.d.ts +4 -0
- package/dist/src/command-modules.d.ts.map +1 -0
- package/dist/src/command-modules.js +42 -0
- package/dist/src/command-modules.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +16 -1
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +27 -11
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/correctness/index.d.ts +32 -0
- package/dist/src/correctness/index.d.ts.map +1 -0
- package/dist/src/correctness/index.js +157 -0
- package/dist/src/correctness/index.js.map +1 -0
- package/dist/src/correctness/schema-hash.d.ts +15 -0
- package/dist/src/correctness/schema-hash.d.ts.map +1 -0
- package/dist/src/correctness/schema-hash.js +44 -0
- package/dist/src/correctness/schema-hash.js.map +1 -0
- package/dist/src/knowledge/schema.d.ts +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +20 -3
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/create.d.ts +7 -0
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +62 -9
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/types.d.ts +7 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -8
- package/dist/src/types.js.map +1 -1
- package/docs/reference/correctness-audit.md +91 -0
- package/docs/reference/correctness-gate.md +102 -0
- package/docs/reference/correctness-manifest.md +142 -0
- package/docs/reference/forge-yaml.md +15 -0
- package/os/codebase/codebase.module.ts +57 -0
- package/os/codebase/handlers/codebase-measure-symbols.ts +131 -0
- package/os/codebase/handlers/codebase-measure.ts +503 -0
- package/os/codebase/index.ts +21 -0
- package/os/codebase/types.ts +55 -0
- package/os/core/handlers/package-health.test.ts +24 -2
- package/os/core/handlers/package-health.ts +16 -19
- package/os/correctness/anchors.ts +182 -0
- package/os/correctness/audit/bindings-verify-substance.test.ts +79 -0
- package/os/correctness/audit/bindings-verify-substance.ts +155 -0
- package/os/correctness/audit/differential.test.ts +113 -0
- package/os/correctness/audit/differential.ts +131 -0
- package/os/correctness/audit/ledger-orphans.test.ts +96 -0
- package/os/correctness/audit/ledger-orphans.ts +84 -0
- package/os/correctness/audit/ledger.test.ts +65 -0
- package/os/correctness/audit/ledger.ts +103 -0
- package/os/correctness/audit/run.ts +220 -0
- package/os/correctness/audit/schema-db.ts +208 -0
- package/os/correctness/audit/snapshot.ts +211 -0
- package/os/correctness/audit/sql-scanner.test.ts +84 -0
- package/os/correctness/audit/sql-scanner.ts +289 -0
- package/os/correctness/audit/sql-schema-conform.test.ts +170 -0
- package/os/correctness/audit/sql-schema-conform.ts +178 -0
- package/os/correctness/audit/state-transitions-coverage.test.ts +141 -0
- package/os/correctness/audit/state-transitions-coverage.ts +271 -0
- package/os/correctness/audit/tests/git-fixture.ts +98 -0
- package/os/correctness/audit/types.ts +91 -0
- package/os/correctness/correctness-capture.test.ts +107 -0
- package/os/correctness/correctness-chain.test.ts +232 -0
- package/os/correctness/correctness-coverage.test.ts +86 -0
- package/os/correctness/correctness-mode.test.ts +108 -0
- package/os/correctness/correctness-substrate.test.ts +64 -0
- package/os/correctness/correctness.module.ts +182 -0
- package/os/correctness/gate/anchor-events.test.ts +77 -0
- package/os/correctness/gate/freeze-coverage.test.ts +218 -0
- package/os/correctness/gate/freeze-diff.test.ts +110 -0
- package/os/correctness/gate/frozen.ts +399 -0
- package/os/correctness/gate/gate-mode.test.ts +76 -0
- package/os/correctness/gate/hardening.test.ts +175 -0
- package/os/correctness/gate/oracle-edit.test.ts +83 -0
- package/os/correctness/gate/oracle-origin.test.ts +142 -0
- package/os/correctness/gate/origin.ts +175 -0
- package/os/correctness/gate/repo.ts +102 -0
- package/os/correctness/gate/run.ts +547 -0
- package/os/correctness/gate/runner.ts +136 -0
- package/os/correctness/gate/substrate-attestation.test.ts +71 -0
- package/os/correctness/gate/tests/gate-fixture.ts +205 -0
- package/os/correctness/gate/tier-high.test.ts +92 -0
- package/os/correctness/gate/types.ts +144 -0
- package/os/correctness/handlers/audit.ts +107 -0
- package/os/correctness/handlers/gate.ts +75 -0
- package/os/correctness/handlers/validate.ts +514 -0
- package/os/correctness/index.ts +24 -0
- package/os/correctness/manifest-schema.ts +174 -0
- package/os/correctness/references.ts +143 -0
- package/os/correctness/tests/fixture-workspace.ts +119 -0
- package/os/correctness/workspace.ts +167 -0
- package/os/flow/correctness-step.ts +166 -0
- package/os/flow/digest.ts +40 -1
- package/os/flow/dirty-classify.ts +13 -0
- package/os/flow/flow.module.ts +20 -4
- package/os/flow/handlers/flow-check.ts +17 -18
- package/os/flow/handlers/flow-digest.ts +11 -1
- package/os/flow/handlers/flow-integrate.ts +191 -39
- package/os/flow/handlers/flow-open.ts +24 -31
- package/os/flow/index.ts +5 -7
- package/os/flow/post-rebase-regen.ts +170 -0
- package/os/flow/preflight.ts +361 -27
- package/os/flow/publish.ts +23 -4
- package/os/flow/tests/flow-detachable.test.ts +31 -0
- package/os/flow/tests/flow-digest-correctness-trail.test.ts +55 -0
- package/os/flow/tests/flow-integrate-correctness-gate.test.ts +275 -0
- package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +234 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +26 -5
- package/os/flow/tests/flow-integrate.test.ts +77 -10
- package/os/flow/tests/helpers.ts +45 -24
- package/os/flow/tests/lockfile-induced.test.ts +328 -0
- package/os/gate-run/detach.ts +106 -0
- package/os/gate-run/gate-run.module.ts +25 -0
- package/os/gate-run/index.ts +16 -0
- package/os/gate-run/record.ts +194 -0
- package/os/gate-run/status.ts +201 -0
- package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
- package/os/gate-run/tests/gate-run-record.test.ts +200 -0
- package/os/gate-run/tests/gate-run-status.test.ts +114 -0
- package/os/gate-run/types.ts +73 -0
- package/os/rfc/evidence-annotation.ts +61 -0
- package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
- package/os/rfc/handlers/fixed-inputs.ts +11 -1
- package/os/rfc/handlers/implement-stamp-promotes.test.ts +214 -0
- package/os/rfc/handlers/implement-stamp-promotes.ts +79 -0
- package/os/rfc/handlers/implement-stamp.ts +40 -29
- package/os/rfc/handlers/list-create.test.ts +14 -5
- package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
- package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
- package/os/rfc/handlers/validate-rules.ts +211 -21
- package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
- package/os/rfc/rfc-0000-template.md +10 -10
- package/os/rfc/rfc.module.ts +21 -7
- package/os/rfc/types.ts +16 -2
- package/os/rfc/verify-workspace-manifest.test.ts +55 -0
- package/os/rfc/verify-workspace.ts +167 -0
- package/os/system/tests/helpers.ts +6 -1
- package/package.json +57 -1
- package/profiles/typescript.yaml +16 -0
- package/skills/_shared/agent-operating-model.md +4 -0
- package/skills/fo/fo-idea-audit/SKILL.md +4 -0
- package/skills/fo/fo-idea-create-rfc/SKILL.md +6 -2
- package/skills/fo/fo-idea-implement/SKILL.md +8 -2
- package/skills/fo/fo-review/SKILL.md +16 -2
- package/skills/fo/fo-session-retro/SKILL.md +4 -2
- package/src/cli-flags.ts +7 -0
- package/src/command-modules.ts +62 -0
- package/src/config/forge-config.ts +37 -11
- package/src/correctness/index.ts +192 -0
- package/src/correctness/schema-hash.ts +59 -0
- package/src/onboarding/agents-generate.ts +20 -3
- package/src/onboarding/create.ts +59 -9
- package/src/tests/agents-generate-detach.test.ts +126 -0
- package/src/tests/codebase-measure-rfc-1581.test.ts +260 -0
- package/src/tests/command-modules.test.ts +34 -0
- package/src/types.ts +9 -8
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1574 — flow.integrate step (3b): after a successful rebase onto
|
|
4
|
+
develop, run every GENERATED_BASENAME_OWNERS owner command in the session
|
|
5
|
+
worktree and commit exactly the owned generated files that changed, with a
|
|
6
|
+
fixed subject, before the integration gate runs. Replaces RFC-1546's
|
|
7
|
+
pre-rebase in-place regeneration, which wrote the file but never committed
|
|
8
|
+
it (the rebase then refused FLOW-INT-02 on the dirty worktree, F-0168).</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No conflict resolution — RFC-1538/1545 own generated rebase conflicts.</item>
|
|
11
|
+
<item>No port entries — flow.backmerge never rebases.</item>
|
|
12
|
+
<item>Never stages a non-owned path; any other dirt refuses.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
*/
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
|
|
18
|
+
import type { ForgeInvokeCommand, WorkspaceIO } from "../../src/types.ts";
|
|
19
|
+
import { REGEN_FLAGS } from "../core/archive-regen.ts";
|
|
20
|
+
import { git, gitCommit } from "./git.ts";
|
|
21
|
+
import { GENERATED_BASENAME_OWNERS } from "./preflight.ts";
|
|
22
|
+
|
|
23
|
+
export const POST_REBASE_REGEN_SUBJECT = "chore(flow): regenerate derived manifests after rebase";
|
|
24
|
+
|
|
25
|
+
/** Generated manifests live under docs/ by convention (RFC-1538 owner map). */
|
|
26
|
+
const GENERATED_DIR = "docs";
|
|
27
|
+
|
|
28
|
+
export interface PostRebaseRegenResult {
|
|
29
|
+
/** owner commands invoked — GENERATED_BASENAME_OWNERS order with ecosystem.manifest.generate last (archive-regen ordering) */
|
|
30
|
+
ran: string[];
|
|
31
|
+
/** repo-relative generated paths that changed and were committed */
|
|
32
|
+
committed: string[];
|
|
33
|
+
/** sha of the regeneration commit; undefined when nothing changed */
|
|
34
|
+
sha?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PostRebaseRegenRefusal {
|
|
38
|
+
refused: true;
|
|
39
|
+
message: string;
|
|
40
|
+
fixHint: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Owner commands for the generated files present in the worktree. */
|
|
44
|
+
export async function postRebaseOwners(
|
|
45
|
+
branchWorktree: string,
|
|
46
|
+
io: WorkspaceIO,
|
|
47
|
+
): Promise<Array<{ path: string; command: string }>> {
|
|
48
|
+
const owners: Array<{ path: string; command: string }> = [];
|
|
49
|
+
for (const [basename, command] of Object.entries(GENERATED_BASENAME_OWNERS)) {
|
|
50
|
+
const path = `${GENERATED_DIR}/${basename}`;
|
|
51
|
+
if (await io.exists(join(branchWorktree, path))) owners.push({ path, command });
|
|
52
|
+
}
|
|
53
|
+
// archive-regen ordering contract: the ecosystem manifest hashes the other
|
|
54
|
+
// generated artifacts, so its generator always runs last.
|
|
55
|
+
return owners.sort(
|
|
56
|
+
(a, b) =>
|
|
57
|
+
Number(a.command === "ecosystem.manifest.generate") -
|
|
58
|
+
Number(b.command === "ecosystem.manifest.generate"),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Porcelain line → path→status map (rename targets resolved to the new path). */
|
|
63
|
+
async function porcelainSnapshot(
|
|
64
|
+
branchWorktree: string,
|
|
65
|
+
io: WorkspaceIO,
|
|
66
|
+
): Promise<Map<string, string>> {
|
|
67
|
+
const status = await git(branchWorktree, io, ["status", "--porcelain", "--untracked-files=all"]);
|
|
68
|
+
const map = new Map<string, string>();
|
|
69
|
+
for (const l of status.stdout.split("\n")) {
|
|
70
|
+
if (l.length <= 3) continue;
|
|
71
|
+
const p = l.slice(3);
|
|
72
|
+
const arrow = p.indexOf(" -> ");
|
|
73
|
+
map.set(arrow >= 0 ? p.slice(arrow + 4) : p, l.slice(0, 2));
|
|
74
|
+
}
|
|
75
|
+
return map;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function failed(r: { ok?: boolean; exitCode?: number }): boolean {
|
|
79
|
+
return r.ok === false || (r.exitCode !== undefined && r.exitCode !== 0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function regenerateAfterRebase(input: {
|
|
83
|
+
branchWorktree: string;
|
|
84
|
+
io: WorkspaceIO;
|
|
85
|
+
invoke: ForgeInvokeCommand;
|
|
86
|
+
owners: ReadonlyArray<{ path: string; command: string }>;
|
|
87
|
+
onProgress?: (line: string) => void;
|
|
88
|
+
/** Owner commands the invoker cannot run here — skipped with a progress line. */
|
|
89
|
+
notRunnable?: ReadonlySet<string>;
|
|
90
|
+
}): Promise<PostRebaseRegenResult | PostRebaseRegenRefusal> {
|
|
91
|
+
const { branchWorktree, io, invoke } = input;
|
|
92
|
+
const ran: string[] = [];
|
|
93
|
+
const owners = input.owners.filter((o) => {
|
|
94
|
+
if (!input.notRunnable?.has(o.command)) return true;
|
|
95
|
+
input.onProgress?.(`post-rebase regeneration: ${o.command} not runnable here — skipped`);
|
|
96
|
+
return false;
|
|
97
|
+
});
|
|
98
|
+
if (owners.length === 0) return { ran, committed: [] };
|
|
99
|
+
|
|
100
|
+
// Only paths the owner run changes are judged — pre-existing tolerated
|
|
101
|
+
// state (untracked forge files) is not the generators' doing.
|
|
102
|
+
const before = await porcelainSnapshot(branchWorktree, io);
|
|
103
|
+
for (const o of owners) {
|
|
104
|
+
const result = await invoke(o.command, REGEN_FLAGS[o.command] ?? {});
|
|
105
|
+
if (failed(result)) {
|
|
106
|
+
return {
|
|
107
|
+
refused: true,
|
|
108
|
+
message: `post-rebase regeneration: ${o.command} failed — ${result.summary ?? `exit ${result.exitCode}`}`,
|
|
109
|
+
fixHint: `run ${o.command} inside the session worktree, inspect and commit the diff, then re-run flow.integrate`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
ran.push(o.command);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const after = await porcelainSnapshot(branchWorktree, io);
|
|
116
|
+
const changed = [...after.entries()].filter(([p, st]) => before.get(p) !== st).map(([p]) => p);
|
|
117
|
+
const owned = new Set(owners.map((o) => o.path));
|
|
118
|
+
const foreign = changed.filter((p) => !owned.has(p));
|
|
119
|
+
if (foreign.length > 0) {
|
|
120
|
+
return {
|
|
121
|
+
refused: true,
|
|
122
|
+
message: `post-rebase regeneration dirtied non-owned path(s): ${foreign.join(", ")}`,
|
|
123
|
+
fixHint:
|
|
124
|
+
"an owner command wrote outside its generated file — inspect the worktree, commit or revert by hand, then re-run flow.integrate",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const committed = changed.filter((p) => owned.has(p));
|
|
128
|
+
if (committed.length === 0) {
|
|
129
|
+
input.onProgress?.("post-rebase regeneration: no drift");
|
|
130
|
+
return { ran, committed };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// A generator bug must never be masked: validate the regenerated tree
|
|
134
|
+
// before anything is staged, so a red result leaves no commit behind.
|
|
135
|
+
if (ran.includes("ecosystem.manifest.generate")) {
|
|
136
|
+
const validate = await invoke("ecosystem.manifest.validate", {});
|
|
137
|
+
if (failed(validate)) {
|
|
138
|
+
return {
|
|
139
|
+
refused: true,
|
|
140
|
+
message: `post-rebase regeneration: ecosystem.manifest.validate still red — ${validate.summary ?? `exit ${validate.exitCode}`}`,
|
|
141
|
+
fixHint:
|
|
142
|
+
"the regenerated manifest is itself invalid — fix the generator input, regenerate, commit, re-run flow.integrate",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const add = await git(branchWorktree, io, ["add", "--", ...committed]);
|
|
148
|
+
const commit =
|
|
149
|
+
add.exitCode === 0
|
|
150
|
+
? await gitCommit(
|
|
151
|
+
branchWorktree,
|
|
152
|
+
io,
|
|
153
|
+
["commit", "-m", POST_REBASE_REGEN_SUBJECT],
|
|
154
|
+
"integrate",
|
|
155
|
+
)
|
|
156
|
+
: add;
|
|
157
|
+
if (commit.exitCode !== 0) {
|
|
158
|
+
return {
|
|
159
|
+
refused: true,
|
|
160
|
+
message: `post-rebase regeneration commit failed: ${commit.stderr.trim().split("\n").slice(-3).join(" | ")}`,
|
|
161
|
+
fixHint:
|
|
162
|
+
"commit the regenerated manifest(s) inside the session worktree, then re-run flow.integrate",
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const sha = (await git(branchWorktree, io, ["rev-parse", "HEAD"])).stdout.trim();
|
|
166
|
+
input.onProgress?.(
|
|
167
|
+
`post-rebase regeneration: committed ${committed.join(", ")} (${sha.slice(0, 9)})`,
|
|
168
|
+
);
|
|
169
|
+
return { ran, committed, sha };
|
|
170
|
+
}
|
package/os/flow/preflight.ts
CHANGED
|
@@ -14,16 +14,19 @@ closed by the RFC: adding a check requires an amendment.</purpose>
|
|
|
14
14
|
</non-goals>
|
|
15
15
|
</MODULE_CONTRACT>
|
|
16
16
|
<CHANGE_SUMMARY>
|
|
17
|
-
<item>RFC-1531: shared DirtyClass enum via dirty-classify.ts (Q-4), classified FLOW-INT-01/03 data.entries, classifyDirtyEntries for the remediation flags</item>
|
|
18
|
-
<item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
|
|
19
|
-
<item>RFC-1545: standalone generated-conflict regeneration in flow.integrate</item>
|
|
20
|
-
<item>RFC-1543: attribute shared-checkout dirt to live ops and expose peers (RFC-1543)</item>
|
|
21
17
|
<item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
|
|
22
|
-
<
|
|
18
|
+
<item>ADR-0130: induced-change lockfile classifiers — BFS reachability for optional-flag removals, collapse pairs, induced packages/snapshots additions</item>
|
|
19
|
+
<item>ADR-0129: F-0186/F-0187 — FLOW-INT-03 names paths + three-way remedy, FLOW-OPEN-01 same hint, forge CLI kernel-command hint</item>
|
|
20
|
+
<item>RFC-0000: skip rfc-0000 template in integrate preflight id extraction; regen ecosystem manifest; file F-0207</item>
|
|
21
|
+
<item>RFC-1574: regenerate derived manifests after the integrate rebase and commit them
|
|
22
|
+
|
|
23
|
+
flow.integrate step (3b) runs GENERATED_BASENAME_OWNERS owners on the rebased tree (opts.invoke ?? standaloneInvoke), commits only owned paths with the fixed subject before the gate, refuses FLOW-INT-12 on owner failure, non-owned dirt or a still-red validate; the preflight no longer writes and refuses only without a resolvable owner.</item>
|
|
24
|
+
<history>RFC-1528, RFC-1531, RFC-1537, RFC-1538, RFC-1543, RFC-1545, RFC-1546</history>
|
|
23
25
|
</CHANGE_SUMMARY>
|
|
24
26
|
*/
|
|
25
27
|
|
|
26
28
|
import { basename, dirname, join } from "node:path";
|
|
29
|
+
import { parse as parseYaml } from "yaml";
|
|
27
30
|
|
|
28
31
|
import type {
|
|
29
32
|
CommandRegistry,
|
|
@@ -37,6 +40,7 @@ import { isGeneratedContent, isGeneratedPathName, REGEN_FLAGS } from "../core/ar
|
|
|
37
40
|
import { openMissionsIn } from "../mission/open-missions.ts";
|
|
38
41
|
import {
|
|
39
42
|
classifyDirtyPath,
|
|
43
|
+
FOREIGN_PRIMARY_DIRT_HINT,
|
|
40
44
|
summarizeClasses,
|
|
41
45
|
type ClassifiedDirtyEntry,
|
|
42
46
|
type DirtyClass,
|
|
@@ -154,6 +158,302 @@ export function classifyLockfileMaterialize(diffText: string): string[] | null {
|
|
|
154
158
|
return sawImporterKey ? [...ids].sort() : null;
|
|
155
159
|
}
|
|
156
160
|
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// ADR-0130 (F-0201): induced-change lockfile shapes
|
|
163
|
+
//
|
|
164
|
+
// A `pnpm install` against a lockfile whose `importers:` list includes open
|
|
165
|
+
// mission workpieces produces diffs that are never pure block additions or
|
|
166
|
+
// removals — the dependency-graph write also adds/drops `optional: true`
|
|
167
|
+
// flags, collapses `key:\n optional: true` pairs to `key: {}`, and adds or
|
|
168
|
+
// removes `packages:`/`snapshots:` members. The strict one-shape classifiers
|
|
169
|
+
// above see the extra hunks and degrade to `work`, which is the ping-pong the
|
|
170
|
+
// ADR stops. These extended classifiers accept the strict shape first and
|
|
171
|
+
// then the induced shape, bounded by where each hunk anchors in the HEAD
|
|
172
|
+
// lockfile.
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
const DIFF_HEADER = /^(diff |index |--- |\+\+\+ |@@ )/;
|
|
176
|
+
const TOP_LEVEL_KEY = /^(\S[^:]*):\s*$/;
|
|
177
|
+
const IMPORTER_KEY = /^\s*missions\/([^\s/]+)\/workpiece:\s*$/;
|
|
178
|
+
const OPTIONAL_TRUE = /^\s*optional: true\s*$/;
|
|
179
|
+
|
|
180
|
+
interface DiffLine {
|
|
181
|
+
kind: "add" | "del" | "ctx" | "hunk";
|
|
182
|
+
text: string;
|
|
183
|
+
oldLine: number; // anchor position in the HEAD file (for `add`: line after which it inserts)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Parse `git diff` output into positioned lines (single-file diffs only). */
|
|
187
|
+
function parseDiffLines(diffText: string): DiffLine[] {
|
|
188
|
+
const lines: DiffLine[] = [];
|
|
189
|
+
let oldCursor = 0;
|
|
190
|
+
for (const raw of diffText.split("\n")) {
|
|
191
|
+
const hunk = /^@@ -(\d+)(?:,\d+)? \+\d+(?:,\d+)? @@/.exec(raw);
|
|
192
|
+
if (hunk) {
|
|
193
|
+
oldCursor = Number(hunk[1]);
|
|
194
|
+
lines.push({ kind: "hunk", text: raw, oldLine: oldCursor });
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (DIFF_HEADER.test(raw) || raw === "") continue;
|
|
198
|
+
if (raw.startsWith("+")) {
|
|
199
|
+
lines.push({ kind: "add", text: raw.slice(1), oldLine: oldCursor });
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (raw.startsWith("-")) {
|
|
203
|
+
lines.push({ kind: "del", text: raw.slice(1), oldLine: oldCursor });
|
|
204
|
+
oldCursor += 1;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
lines.push({ kind: "ctx", text: raw.slice(1), oldLine: oldCursor });
|
|
208
|
+
oldCursor += 1;
|
|
209
|
+
}
|
|
210
|
+
return lines;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Top-level (`key:`) section containing old-file line `n` (1-based). */
|
|
214
|
+
function topLevelSectionAt(headLines: string[], n: number): string | null {
|
|
215
|
+
let section: string | null = null;
|
|
216
|
+
for (let i = 0; i < Math.min(n, headLines.length); i++) {
|
|
217
|
+
const m = TOP_LEVEL_KEY.exec(headLines[i]);
|
|
218
|
+
if (m) section = m[1];
|
|
219
|
+
}
|
|
220
|
+
return section;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Second-level `key:` (one-indent) enclosing old-file line `n` inside `section`. */
|
|
224
|
+
function secondLevelKeyAt(headLines: string[], n: number, section: string): string | null {
|
|
225
|
+
let inSection = false;
|
|
226
|
+
let key: string | null = null;
|
|
227
|
+
for (let i = 0; i < Math.min(n, headLines.length); i++) {
|
|
228
|
+
const line = headLines[i];
|
|
229
|
+
const top = TOP_LEVEL_KEY.exec(line);
|
|
230
|
+
if (top) {
|
|
231
|
+
inSection = top[1] === section;
|
|
232
|
+
key = null;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (!inSection || line.trim() === "") continue;
|
|
236
|
+
const m = /^ {2}('?[^:]*'?):\s*(?:\{\})?\s*$/.exec(line);
|
|
237
|
+
if (m) key = m[1].replace(/^'|'$/g, "");
|
|
238
|
+
}
|
|
239
|
+
return key;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Snapshot keys reachable from `missionIds` in the working lockfile — BFS
|
|
244
|
+
* from each `missions/<id>/workpiece` importer through `dependencies`,
|
|
245
|
+
* `devDependencies` and `optionalDependencies` version specifiers, then
|
|
246
|
+
* through each reached snapshot's own dependency maps. Specifiers that are
|
|
247
|
+
* not registry resolutions (`link:`, `workspace:`, `file:`) have no snapshot
|
|
248
|
+
* entry and are ignored.
|
|
249
|
+
*/
|
|
250
|
+
export function reachableSnapshotKeys(lockText: string, missionIds: string[]): Set<string> {
|
|
251
|
+
const reachable = new Set<string>();
|
|
252
|
+
let parsed: unknown;
|
|
253
|
+
try {
|
|
254
|
+
parsed = parseYaml(lockText);
|
|
255
|
+
} catch {
|
|
256
|
+
return reachable;
|
|
257
|
+
}
|
|
258
|
+
const root = parsed as Record<string, unknown> | null;
|
|
259
|
+
const importers = (root?.importers ?? {}) as Record<string, unknown>;
|
|
260
|
+
const snapshots = (root?.snapshots ?? {}) as Record<string, Record<string, unknown>>;
|
|
261
|
+
const depMaps = (entry: Record<string, unknown>): string[] => {
|
|
262
|
+
const out: string[] = [];
|
|
263
|
+
for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
|
|
264
|
+
const deps = entry[field] as Record<string, unknown> | undefined;
|
|
265
|
+
if (!deps) continue;
|
|
266
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
267
|
+
const version =
|
|
268
|
+
typeof spec === "string" ? spec : ((spec as Record<string, unknown>)?.version as string);
|
|
269
|
+
if (typeof version !== "string") continue;
|
|
270
|
+
if (/^(link|workspace|file):/.test(version)) continue;
|
|
271
|
+
// pnpm strips the name for plain resolutions inside importers
|
|
272
|
+
// (version only) but snapshot keys carry `name@version`.
|
|
273
|
+
out.push(version.startsWith(`${name}@`) ? version : `${name}@${version}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return out;
|
|
277
|
+
};
|
|
278
|
+
const queue: string[] = [];
|
|
279
|
+
for (const id of missionIds) {
|
|
280
|
+
const entry = importers[`missions/${id}/workpiece`] as Record<string, unknown> | undefined;
|
|
281
|
+
if (entry) queue.push(...depMaps(entry));
|
|
282
|
+
}
|
|
283
|
+
while (queue.length > 0) {
|
|
284
|
+
const key = queue.shift()!;
|
|
285
|
+
if (reachable.has(key)) continue;
|
|
286
|
+
reachable.add(key);
|
|
287
|
+
const snap = snapshots[key];
|
|
288
|
+
if (snap) queue.push(...depMaps(snap));
|
|
289
|
+
}
|
|
290
|
+
return reachable;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* ADR-0130 criterion (b)+(c): materialize shape extended with induced
|
|
295
|
+
* changes. Removed lines must be `optional: true` on snapshots reachable
|
|
296
|
+
* from the added mission importers, or `key:` lines paired with an added
|
|
297
|
+
* `key: {}` collapse. Added lines outside mission importer blocks must
|
|
298
|
+
* anchor under `packages:` or `snapshots:` in the HEAD file.
|
|
299
|
+
*/
|
|
300
|
+
export function classifyLockfileMaterializeExtended(
|
|
301
|
+
diffText: string,
|
|
302
|
+
headText: string,
|
|
303
|
+
workText: string,
|
|
304
|
+
): string[] | null {
|
|
305
|
+
const strict = classifyLockfileMaterialize(diffText);
|
|
306
|
+
if (strict !== null) return strict;
|
|
307
|
+
const headLines = headText.split("\n");
|
|
308
|
+
const lines = parseDiffLines(diffText);
|
|
309
|
+
const missionIds = new Set<string>();
|
|
310
|
+
const collapsedKeys = new Set<string>();
|
|
311
|
+
const optionalRemovedOn = new Set<string>();
|
|
312
|
+
let importerBlockIndent: number | null = null;
|
|
313
|
+
let sawDiff = false;
|
|
314
|
+
for (const line of lines) {
|
|
315
|
+
if (line.kind === "hunk") {
|
|
316
|
+
importerBlockIndent = null;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (line.kind === "ctx") {
|
|
320
|
+
const indent = line.text.length - line.text.trimStart().length;
|
|
321
|
+
if (
|
|
322
|
+
line.text.trim().length > 0 &&
|
|
323
|
+
importerBlockIndent !== null &&
|
|
324
|
+
indent <= importerBlockIndent
|
|
325
|
+
) {
|
|
326
|
+
importerBlockIndent = null;
|
|
327
|
+
}
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
sawDiff = true;
|
|
331
|
+
if (line.kind === "add") {
|
|
332
|
+
const text = line.text;
|
|
333
|
+
const indent = text.length - text.trimStart().length;
|
|
334
|
+
const key = IMPORTER_KEY.exec(text);
|
|
335
|
+
if (key) {
|
|
336
|
+
missionIds.add(key[1]);
|
|
337
|
+
importerBlockIndent = indent;
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (importerBlockIndent !== null && (indent > importerBlockIndent || text.trim() === "")) {
|
|
341
|
+
continue; // member of an open importer block
|
|
342
|
+
}
|
|
343
|
+
if (indent <= (importerBlockIndent ?? indent)) importerBlockIndent = null;
|
|
344
|
+
// Non-importer additions must anchor inside the dependency-graph
|
|
345
|
+
// sections — the induced write never touches anything else.
|
|
346
|
+
const section = topLevelSectionAt(headLines, line.oldLine);
|
|
347
|
+
if (section === "packages" || section === "snapshots") continue;
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
// removed line
|
|
351
|
+
const text = line.text;
|
|
352
|
+
if (OPTIONAL_TRUE.test(text)) {
|
|
353
|
+
const owner = secondLevelKeyAt(headLines, line.oldLine, "snapshots");
|
|
354
|
+
if (owner === null) return null;
|
|
355
|
+
optionalRemovedOn.add(owner);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
const removedKey = /^(\s*'?[^:]*'?):\s*$/.exec(text);
|
|
359
|
+
if (removedKey) {
|
|
360
|
+
// allowed only as the `key:` → `key: {}` collapse — an added
|
|
361
|
+
// `key: {}` must appear somewhere in the diff.
|
|
362
|
+
collapsedKeys.add(removedKey[1].trim());
|
|
363
|
+
const owner = removedKey[1].trim().replace(/^'|'$/g, "");
|
|
364
|
+
const section = topLevelSectionAt(headLines, line.oldLine);
|
|
365
|
+
if (section !== "snapshots") return null;
|
|
366
|
+
optionalRemovedOn.add(owner);
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
if (!sawDiff || missionIds.size === 0) return null;
|
|
372
|
+
// every removed `key:` must be matched by an added `key: {}` — an
|
|
373
|
+
// unmatched one is a real snapshot removal, not a collapse.
|
|
374
|
+
for (const key of collapsedKeys) {
|
|
375
|
+
const hasPair = lines.some((l) => l.kind === "add" && l.text.trim() === `${key}: {}`);
|
|
376
|
+
if (!hasPair) return null;
|
|
377
|
+
}
|
|
378
|
+
const reachable = reachableSnapshotKeys(workText, [...missionIds]);
|
|
379
|
+
for (const owner of optionalRemovedOn) {
|
|
380
|
+
if (!reachable.has(owner)) return null;
|
|
381
|
+
}
|
|
382
|
+
return [...missionIds].sort();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* ADR-0130 prune direction: removed lines must still be importer-block
|
|
387
|
+
* members (strict rule); added lines are tolerated only when they anchor
|
|
388
|
+
* inside `packages:`/`snapshots:` — the inverse induced write (`optional:
|
|
389
|
+
* true` re-additions, `transitivePeerDependencies`, snapshot entries).
|
|
390
|
+
*/
|
|
391
|
+
export function classifyLockfilePruneIdsExtended(
|
|
392
|
+
diffText: string,
|
|
393
|
+
headText: string,
|
|
394
|
+
): string[] | null {
|
|
395
|
+
const strict = classifyLockfilePruneIds(diffText);
|
|
396
|
+
if (strict !== null) return strict;
|
|
397
|
+
const headLines = headText.split("\n");
|
|
398
|
+
const lines = parseDiffLines(diffText);
|
|
399
|
+
const ids = new Set<string>();
|
|
400
|
+
const expandedKeys = new Set<string>();
|
|
401
|
+
let sawImporterKey = false;
|
|
402
|
+
let openBlockIndent: number | null = null;
|
|
403
|
+
for (const line of lines) {
|
|
404
|
+
if (line.kind === "hunk") {
|
|
405
|
+
openBlockIndent = null;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
if (line.kind === "ctx") {
|
|
409
|
+
const indent = line.text.length - line.text.trimStart().length;
|
|
410
|
+
if (line.text.trim().length > 0 && openBlockIndent !== null && indent <= openBlockIndent) {
|
|
411
|
+
openBlockIndent = null;
|
|
412
|
+
}
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
if (line.kind === "add") {
|
|
416
|
+
const section = topLevelSectionAt(headLines, line.oldLine);
|
|
417
|
+
if (section === "packages" || section === "snapshots") continue;
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
const text = line.text;
|
|
421
|
+
if (text.trim().length === 0) {
|
|
422
|
+
if (openBlockIndent === null) return null;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
// inverse of the materialize collapse — the prune re-expands
|
|
426
|
+
// `key: {}` into `key:` + `optional: true` children.
|
|
427
|
+
const emptyEntry = /^(\s*'?[^:]*'?):\s*\{\}\s*$/.exec(text);
|
|
428
|
+
if (emptyEntry) {
|
|
429
|
+
const section = topLevelSectionAt(headLines, line.oldLine);
|
|
430
|
+
if (section === "snapshots" || section === "packages") {
|
|
431
|
+
expandedKeys.add(emptyEntry[1].trim());
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
const indent = text.length - text.trimStart().length;
|
|
437
|
+
const key = IMPORTER_KEY.exec(text);
|
|
438
|
+
if (key) {
|
|
439
|
+
sawImporterKey = true;
|
|
440
|
+
ids.add(key[1]);
|
|
441
|
+
openBlockIndent = indent;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (openBlockIndent !== null && indent > openBlockIndent) continue;
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
if (!sawImporterKey) return null;
|
|
448
|
+
// every removed `key: {}` must pair with an added `key:` — an unmatched
|
|
449
|
+
// one is a real snapshot removal, not a re-expansion.
|
|
450
|
+
for (const key of expandedKeys) {
|
|
451
|
+
const hasPair = lines.some((l) => l.kind === "add" && l.text.trim() === `${key}:`);
|
|
452
|
+
if (!hasPair) return null;
|
|
453
|
+
}
|
|
454
|
+
return [...ids].sort();
|
|
455
|
+
}
|
|
456
|
+
|
|
157
457
|
/** Classify the pnpm-lock.yaml diff of `repo` when the lockfile is dirty. */
|
|
158
458
|
async function classifyDirtyLockfile(
|
|
159
459
|
repo: string,
|
|
@@ -330,7 +630,32 @@ export async function classifyDirt(
|
|
|
330
630
|
outer: for (const [path, lines] of byPath) {
|
|
331
631
|
if (path === "pnpm-lock.yaml") {
|
|
332
632
|
const diff = await deps.runGit(repo, io, ["diff", "HEAD", "--", "pnpm-lock.yaml"]);
|
|
333
|
-
|
|
633
|
+
// ADR-0130: the induced-change shapes need the HEAD and working
|
|
634
|
+
// contents — fetched lazily, only when the strict shapes miss.
|
|
635
|
+
let headLock: string | null = null;
|
|
636
|
+
let workLock: string | null = null;
|
|
637
|
+
const lockContents = async (): Promise<{ head: string; work: string } | null> => {
|
|
638
|
+
if (headLock === null || workLock === null) {
|
|
639
|
+
const head = await deps.runGit(repo, io, ["show", "HEAD:pnpm-lock.yaml"]);
|
|
640
|
+
if (head.exitCode !== 0) return null;
|
|
641
|
+
let work: string;
|
|
642
|
+
try {
|
|
643
|
+
work = await io.readFile(join(repo, "pnpm-lock.yaml"));
|
|
644
|
+
} catch {
|
|
645
|
+
return null; // reduced io — degrade to the strict-shape verdict
|
|
646
|
+
}
|
|
647
|
+
headLock = head.stdout;
|
|
648
|
+
workLock = work;
|
|
649
|
+
}
|
|
650
|
+
return { head: headLock, work: workLock };
|
|
651
|
+
};
|
|
652
|
+
let pruneIds = classifyLockfilePruneIds(diff.stdout);
|
|
653
|
+
if (pruneIds === null) {
|
|
654
|
+
const contents = await lockContents();
|
|
655
|
+
if (contents !== null) {
|
|
656
|
+
pruneIds = classifyLockfilePruneIdsExtended(diff.stdout, contents.head);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
334
659
|
if (pruneIds !== null) {
|
|
335
660
|
// RFC-1544: the pruned importer's referent decides the class — a
|
|
336
661
|
// foreign checkout's open mission (foreign-open-mission, auto-
|
|
@@ -362,7 +687,13 @@ export async function classifyDirt(
|
|
|
362
687
|
}
|
|
363
688
|
continue;
|
|
364
689
|
}
|
|
365
|
-
|
|
690
|
+
let ids = classifyLockfileMaterialize(diff.stdout);
|
|
691
|
+
if (ids === null) {
|
|
692
|
+
const contents = await lockContents();
|
|
693
|
+
if (contents !== null) {
|
|
694
|
+
ids = classifyLockfileMaterializeExtended(diff.stdout, contents.head, contents.work);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
366
697
|
if (ids !== null) {
|
|
367
698
|
const open = await openMissionIds();
|
|
368
699
|
if (ids.every((id) => open.has(id))) {
|
|
@@ -715,7 +1046,15 @@ export async function runIntegratePreflight(
|
|
|
715
1046
|
(primaryBranch !== "develop"
|
|
716
1047
|
? `primary worktree is on ${primaryBranch ?? "detached HEAD"}, not develop`
|
|
717
1048
|
: verdict.unattributed.length > 0
|
|
718
|
-
?
|
|
1049
|
+
? // ADR-0129 (F-0186): name the paths — the remedy differs by
|
|
1050
|
+
// whose work each one is.
|
|
1051
|
+
`primary worktree has ${verdict.unattributed.length} uncommitted change(s): ${verdict.unattributed
|
|
1052
|
+
.slice(0, 20)
|
|
1053
|
+
.map((line) => line.slice(3).trim())
|
|
1054
|
+
.join(", ")}` +
|
|
1055
|
+
(verdict.unattributed.length > 20
|
|
1056
|
+
? ` (+${verdict.unattributed.length - 20} more)`
|
|
1057
|
+
: "")
|
|
719
1058
|
: `primary worktree held by ${verdict.foreignInFlight.length} in-flight foreign op(s)`) +
|
|
720
1059
|
holderNote +
|
|
721
1060
|
(verdict.tolerated.length > 0
|
|
@@ -723,8 +1062,11 @@ export async function runIntegratePreflight(
|
|
|
723
1062
|
: "") +
|
|
724
1063
|
(lockfile === "importer-prune-only" ? ` — pnpm-lock.yaml${LOCKFILE_PRUNE_HINT}` : ""),
|
|
725
1064
|
fixHint:
|
|
726
|
-
|
|
1065
|
+
primaryBranch !== "develop"
|
|
1066
|
+
? "switch the primary to develop and commit or revert its tracked changes, then re-run — the branch stays rebased"
|
|
1067
|
+
: `${FOREIGN_PRIMARY_DIRT_HINT}, then re-run`,
|
|
727
1068
|
data: {
|
|
1069
|
+
unattributed: verdict.unattributed.map((line) => line.slice(3).trim()),
|
|
728
1070
|
entries: verdict.unattributed.map((line) => {
|
|
729
1071
|
const path = line.slice(3).trim();
|
|
730
1072
|
return { path, class: classifyDirtyPath(path) };
|
|
@@ -798,7 +1140,9 @@ export async function runIntegratePreflight(
|
|
|
798
1140
|
l.trim(),
|
|
799
1141
|
)?.[1],
|
|
800
1142
|
)
|
|
801
|
-
.
|
|
1143
|
+
// rfc-0000-template.md is corpus-excluded (listRfcFiles) — it is a
|
|
1144
|
+
// template, not a validateable RFC.
|
|
1145
|
+
.filter((m): m is string => m !== undefined && m !== "0000")
|
|
802
1146
|
.map((n) => `RFC-${n.padStart(4, "0")}`),
|
|
803
1147
|
),
|
|
804
1148
|
];
|
|
@@ -856,25 +1200,15 @@ export async function runIntegratePreflight(
|
|
|
856
1200
|
});
|
|
857
1201
|
}
|
|
858
1202
|
|
|
859
|
-
// RFC-1546: every other check passed — the manifest
|
|
860
|
-
//
|
|
861
|
-
//
|
|
862
|
-
//
|
|
1203
|
+
// RFC-1574 (amends RFC-1546): every other check passed — the manifest
|
|
1204
|
+
// drift is the sole violation. The preflight writes nothing: a resolvable
|
|
1205
|
+
// owner defers the regeneration to flow.integrate step (3b), which runs on
|
|
1206
|
+
// the rebased tree and commits the result. Without an owner the drift
|
|
1207
|
+
// still refuses here.
|
|
863
1208
|
if (manifestDrift !== undefined) {
|
|
864
1209
|
if (resolvable("ecosystem.manifest.generate")) {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
REGEN_FLAGS["ecosystem.manifest.generate"] ?? {},
|
|
868
|
-
);
|
|
869
|
-
if (regen.ok !== false && (regen.exitCode === undefined || regen.exitCode === 0)) {
|
|
870
|
-
checked.push("ecosystem.manifest.generate", "ecosystem.manifest.validate");
|
|
871
|
-
const result = await opts.invoke!("ecosystem.manifest.validate", {});
|
|
872
|
-
if (result.ok !== false && (result.exitCode === undefined || result.exitCode === 0)) {
|
|
873
|
-
manifestDrift = undefined;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
if (manifestDrift !== undefined) {
|
|
1210
|
+
opts.onProgress?.("preflight: ecosystem manifest drift — regenerating after the rebase");
|
|
1211
|
+
} else {
|
|
878
1212
|
return {
|
|
879
1213
|
ok: false,
|
|
880
1214
|
checked,
|
package/os/flow/publish.ts
CHANGED
|
@@ -19,12 +19,16 @@ and return the RFC publications[] row for the journal.</purpose>
|
|
|
19
19
|
<item>RFC-1517 r1: the fixture scan enumerates `../` candidates AT `ref` via one `git grep -nI --full-name` — the extract materializes the ref's tree, so an untracked dist/ or a post-tag fix can't false-refuse or evade the way a working-tree walk did. Each candidate path is then judged by the same isShippedEntry/literalEscapesInLine core PKG-HEALTH-10 uses.</item>
|
|
20
20
|
</KEY_DECISIONS>
|
|
21
21
|
<CHANGE_SUMMARY>
|
|
22
|
-
<item>RFC-1499: step 2 — retire publish-forge/bump-forge scripts, add extract-verify hook</item>
|
|
23
|
-
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
24
22
|
<item>RFC-1502: step 7 — remediation entries, docs, deviations, generated indexes</item>
|
|
25
23
|
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
26
24
|
<item>RFC-1517: add preflight-extract-gates — FLOW-PUB-01 changelog check at ref plus shared PKG-HEALTH-10 fixture-path scan for RFC-1517</item>
|
|
27
|
-
<
|
|
25
|
+
<item>ADR-0131: pkg-health-10 suppression on the line above the literal
|
|
26
|
+
|
|
27
|
+
literalEscapesInLine accepts a // pkg-health-10: comment directly above the literal (one-line reach); the publish at-ref scan fetches that line via git show only for candidate lines; bin/cli.ts drops its prettier-ignore lines.</item>
|
|
28
|
+
<item>RFC-1574: close review REVIEW-CODE-2026-11-12-05 findings
|
|
29
|
+
|
|
30
|
+
Step (3b) judges only paths the owner run changed, validates before staging, skips owners not runnable without an engine build, runs ecosystem.manifest.generate last; e2e log write guarded and run-stamped; Unhandled Errors rule out timeout-only; lost-run wait test; publish pre-filter comment. RFC-1574/1575/1576 record DEV-1..8.</item>
|
|
31
|
+
<history>RFC-1491, RFC-1499, RFC-1502</history>
|
|
28
32
|
</CHANGE_SUMMARY>
|
|
29
33
|
*/
|
|
30
34
|
|
|
@@ -200,6 +204,7 @@ async function preflightExtractGates(
|
|
|
200
204
|
projectDirRel,
|
|
201
205
|
]);
|
|
202
206
|
const escapes: FixtureEscape[] = [];
|
|
207
|
+
const atRefLines = new Map<string, string[]>();
|
|
203
208
|
if (grep.exitCode === 0) {
|
|
204
209
|
for (const row of grep.stdout.split("\n")) {
|
|
205
210
|
if (!row.startsWith(`${ref}:`)) continue;
|
|
@@ -216,13 +221,27 @@ async function preflightExtractGates(
|
|
|
216
221
|
) {
|
|
217
222
|
continue;
|
|
218
223
|
}
|
|
224
|
+
const fileDir = dirname(join(projectRoot, rel));
|
|
225
|
+
// Cheap pre-filter: most grep hits are suppressed or in-root on their own
|
|
226
|
+
// line — only real candidates pay for the at-ref previous-line fetch.
|
|
227
|
+
const sameLine = literalEscapesInLine(rel, text!, Number(lineNo), fileDir, projectRoot);
|
|
228
|
+
if (sameLine.length === 0) continue;
|
|
229
|
+
// ADR-0131: the suppression may sit on the line above — fetched from
|
|
230
|
+
// the ref only for candidate lines (rare), cached per file.
|
|
231
|
+
let lines = atRefLines.get(relPath!);
|
|
232
|
+
if (lines === undefined) {
|
|
233
|
+
const shown = await git(primary, io, ["show", `${ref}:${relPath}`]);
|
|
234
|
+
lines = shown.exitCode === 0 ? shown.stdout.split("\n") : [];
|
|
235
|
+
atRefLines.set(relPath!, lines);
|
|
236
|
+
}
|
|
219
237
|
escapes.push(
|
|
220
238
|
...literalEscapesInLine(
|
|
221
239
|
rel,
|
|
222
240
|
text!,
|
|
223
241
|
Number(lineNo),
|
|
224
|
-
|
|
242
|
+
fileDir,
|
|
225
243
|
projectRoot,
|
|
244
|
+
lines[Number(lineNo) - 2],
|
|
226
245
|
),
|
|
227
246
|
);
|
|
228
247
|
}
|