@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
|
@@ -11,12 +11,14 @@ and a held integration lock is waited out.</purpose>
|
|
|
11
11
|
</non-goals>
|
|
12
12
|
</MODULE_CONTRACT>
|
|
13
13
|
<CHANGE_SUMMARY>
|
|
14
|
-
<item>RFC-1538: revalidate integration preconditions post-lock and reuse the session engine</item>
|
|
15
|
-
<item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
|
|
16
14
|
<item>RFC-1545: standalone generated-conflict regeneration in flow.integrate</item>
|
|
17
15
|
<item>RFC-1543: attribute shared-checkout dirt to live ops and expose peers (RFC-1543)</item>
|
|
18
16
|
<item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
|
|
19
|
-
<
|
|
17
|
+
<item>ADR-0128: FLOW-INT-02 names rebase stderr tail + porcelain status when no unmerged paths; cap path list at 20 (+N more) (ADR-0128 F-0188)</item>
|
|
18
|
+
<item>RFC-1574: regenerate derived manifests after the integrate rebase and commit them
|
|
19
|
+
|
|
20
|
+
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>
|
|
21
|
+
<history>RFC-1487, RFC-1515, RFC-1528, RFC-1537, RFC-1538, RFC-1546</history>
|
|
20
22
|
</CHANGE_SUMMARY>
|
|
21
23
|
*/
|
|
22
24
|
|
|
@@ -128,6 +130,72 @@ describe("flow.integrate", () => {
|
|
|
128
130
|
expect(wt.stdout.trim()).toBe("");
|
|
129
131
|
}, 20_000);
|
|
130
132
|
|
|
133
|
+
it("names the cause when the rebase fails without unmerged paths (ADR-0128, F-0188)", async () => {
|
|
134
|
+
const repo = await governedRepo();
|
|
135
|
+
const session = await openSession(repo, "blocked");
|
|
136
|
+
// the session branch needs a unique commit so the integrate actually
|
|
137
|
+
// reaches the rebase stage; without it the branch fast-forwards trivially.
|
|
138
|
+
await commitIn(session.worktree!, "session.txt", "session work\n");
|
|
139
|
+
// develop-only path whose worktree twin is tolerated dirt — the dirty
|
|
140
|
+
// preflight lets it through (FORGE_STATE_FILES) but the rebase checkout
|
|
141
|
+
// refuses on it before any unmerged path exists.
|
|
142
|
+
await mkdir(join(repo, ".forge"), { recursive: true });
|
|
143
|
+
await commitIn(repo, ".forge/knowledge-conflicts.txt", "develop content\n");
|
|
144
|
+
await mkdir(join(session.worktree!, ".forge"), { recursive: true });
|
|
145
|
+
await writeFile(
|
|
146
|
+
join(session.worktree!, ".forge/knowledge-conflicts.txt"),
|
|
147
|
+
"session-local state\n",
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const data = await integrateFlowBranch(repo, ambientIo, {
|
|
151
|
+
branch: session.branch!,
|
|
152
|
+
dryRun: false,
|
|
153
|
+
now: NOW,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-INT-02");
|
|
157
|
+
const message = data.diagnostics[0]?.message ?? "";
|
|
158
|
+
expect(message).toContain("failed without unmerged paths");
|
|
159
|
+
expect(message).toContain("knowledge-conflicts.txt");
|
|
160
|
+
expect(data.diagnostics[0]?.fixHint).toContain("clean the listed worktree state");
|
|
161
|
+
const details = (data.diagnostics[0] as { data?: Record<string, unknown> }).data;
|
|
162
|
+
expect(details?.conflictedPaths).toEqual([]);
|
|
163
|
+
expect((details?.rebaseStderrTail as string[]).join("\n")).toContain(
|
|
164
|
+
"knowledge-conflicts.txt",
|
|
165
|
+
);
|
|
166
|
+
expect((details?.statusPorcelain as string[]).join("\n")).toContain(".forge/");
|
|
167
|
+
}, 20_000);
|
|
168
|
+
|
|
169
|
+
it("caps the conflicted path list at 20 and reports the remainder (ADR-0128, F-0188)", async () => {
|
|
170
|
+
const repo = await governedRepo();
|
|
171
|
+
const session = await openSession(repo, "many");
|
|
172
|
+
// 22 files conflict in ONE commit each side — the rebase stops with all
|
|
173
|
+
// of them unmerged at once.
|
|
174
|
+
for (let i = 0; i < 22; i++) {
|
|
175
|
+
await writeFile(join(session.worktree!, `f${String(i).padStart(2, "0")}.txt`), "session\n");
|
|
176
|
+
}
|
|
177
|
+
await gitExec(session.worktree!, ["add", "."]);
|
|
178
|
+
await gitExec(session.worktree!, ["commit", "-m", "session adds 22 files"]);
|
|
179
|
+
for (let i = 0; i < 22; i++) {
|
|
180
|
+
await writeFile(join(repo, `f${String(i).padStart(2, "0")}.txt`), "develop\n");
|
|
181
|
+
}
|
|
182
|
+
await gitExec(repo, ["add", "."]);
|
|
183
|
+
await gitExec(repo, ["commit", "-m", "develop edits 22 files"]);
|
|
184
|
+
|
|
185
|
+
const data = await integrateFlowBranch(repo, ambientIo, {
|
|
186
|
+
branch: session.branch!,
|
|
187
|
+
dryRun: false,
|
|
188
|
+
now: NOW,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-INT-02");
|
|
192
|
+
const message = data.diagnostics[0]?.message ?? "";
|
|
193
|
+
expect(message).toContain("(+2 more)");
|
|
194
|
+
expect(message).not.toContain("f21.txt");
|
|
195
|
+
const details = (data.diagnostics[0] as { data?: Record<string, unknown> }).data;
|
|
196
|
+
expect((details?.conflictedPaths as string[]).length).toBe(22);
|
|
197
|
+
}, 20_000);
|
|
198
|
+
|
|
131
199
|
it("refuses FLOW-INT-05 when the primary gate fails though the branch's copy passes (AC-5)", async () => {
|
|
132
200
|
const repo = await governedRepo();
|
|
133
201
|
const session = await openSession(repo, "gate");
|
|
@@ -723,7 +791,7 @@ describe("flow.integrate — RFC-1538 post-lock revalidation, session engine, au
|
|
|
723
791
|
});
|
|
724
792
|
|
|
725
793
|
describe("flow.integrate — recoverable manifest drift (RFC-1546 AC-1)", () => {
|
|
726
|
-
it("sole FLOW-INT-12 drift
|
|
794
|
+
it("sole FLOW-INT-12 drift defers regeneration to the post-rebase step and writes nothing (RFC-1574 AC-4)", async () => {
|
|
727
795
|
const repo = await governedRepo();
|
|
728
796
|
const session = await openSession(repo, "regen");
|
|
729
797
|
const { runIntegratePreflight } = await import("../preflight.ts");
|
|
@@ -759,12 +827,11 @@ describe("flow.integrate — recoverable manifest drift (RFC-1546 AC-1)", () =>
|
|
|
759
827
|
},
|
|
760
828
|
});
|
|
761
829
|
expect(preflight.ok).toBe(true);
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
]);
|
|
830
|
+
// RFC-1574: the preflight never invokes the generator — step (3b) does,
|
|
831
|
+
// on the rebased tree, and commits the result.
|
|
832
|
+
expect(invoked).toEqual(["ecosystem.manifest.validate", "friction.validate"]);
|
|
833
|
+
const status = await gitExec(session.worktree!, ["status", "--porcelain"]);
|
|
834
|
+
expect(status.stdout.trim(), "the preflight must leave the worktree clean").toBe("");
|
|
768
835
|
}, 20_000);
|
|
769
836
|
|
|
770
837
|
it("a second violation alongside drift refuses without regenerating", async () => {
|
package/os/flow/tests/helpers.ts
CHANGED
|
@@ -13,11 +13,13 @@ flow.install does it (committed hooks dir + core.hooksPath).</purpose>
|
|
|
13
13
|
<item>FORGE_FLOW_OP is always set explicitly ("" for the unset cases) so a leaked outer value cannot make tests non-deterministic.</item>
|
|
14
14
|
</KEY_DECISIONS>
|
|
15
15
|
<CHANGE_SUMMARY>
|
|
16
|
-
<item>RFC-1486: review r1 — committed-state adoption gate, uncommitted-hook committedness, step-failure trail, idempotency declaration, lazy asset resolution</item>
|
|
17
16
|
<item>RFC-1490: pre-merge-commit guard mode + per-mode op vocabulary; amends the wave-1 guard RFC's backmerge escape (AC-11)</item>
|
|
18
17
|
<item>RFC-1491: step 2 — pre-push guard mode, install steps pre-push + markers, FLOW-10</item>
|
|
19
18
|
<item>RFC-1491: step 5 — flow.push atomic outbound path + extract publication</item>
|
|
20
19
|
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
20
|
+
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
21
|
+
|
|
22
|
+
Add os/correctness/gate (frozen set at --base, weakening diff incl. byte changes without verifier trailers and frozen exempt mode, git-derived oracle origin with forge/oracle-review@1 records, argv oracle runner with timeout, schema-hash substrate attestation, anchor events, tier high/formal, forge/correctness-bundle@1), the correctness.gate command, test-side helpers @warpgogol/forge/correctness, bindings.paths.oracleReviewsDir, and flow.integrate spawning the primary install's gate after hooks/integration-gate.sh (FLOW-INT-18, --accept-weakening with an X-Correctness-Weakening trailer commit). Flow and system test primaries get a stand-in forge binary; integration warnings now survive the cleanup report.</item>
|
|
21
23
|
<history>RFC-1486</history>
|
|
22
24
|
</CHANGE_SUMMARY>
|
|
23
25
|
*/
|
|
@@ -39,11 +41,7 @@ import {
|
|
|
39
41
|
const PREMERGE_MANAGED_BLOCK = managedBlock("pre-merge-commit");
|
|
40
42
|
const PREPUSH_MANAGED_BLOCK = managedBlock("pre-push");
|
|
41
43
|
|
|
42
|
-
export {
|
|
43
|
-
GUARD_BEGIN_MARKER,
|
|
44
|
-
GUARD_END_MARKER,
|
|
45
|
-
MANAGED_BLOCK,
|
|
46
|
-
};
|
|
44
|
+
export { GUARD_BEGIN_MARKER, GUARD_END_MARKER, MANAGED_BLOCK };
|
|
47
45
|
|
|
48
46
|
/** Absolute path of the shipped guard asset — resolved on first use. */
|
|
49
47
|
export const GUARD_ASSET = resolveGuardAssetPath();
|
|
@@ -61,6 +59,40 @@ export function gitExec(
|
|
|
61
59
|
* git config may leak in). `seedCommit` creates a root commit — skipped for
|
|
62
60
|
* unborn-HEAD cases.
|
|
63
61
|
*/
|
|
62
|
+
/**
|
|
63
|
+
* RFC-1580: flow.integrate spawns `<primary>/node_modules/.bin/forge
|
|
64
|
+
* correctness.gate` and refuses FLOW-INT-18 when it is missing. Test
|
|
65
|
+
* primaries get a stand-in that answers a passing gate (or the verdict in
|
|
66
|
+
* `<primary>/.correctness-gate.json` when a test drops one there). The path
|
|
67
|
+
* is excluded via .git/info/exclude so it never reads as primary dirt.
|
|
68
|
+
*/
|
|
69
|
+
export async function installFakePrimaryForge(repo: string): Promise<void> {
|
|
70
|
+
const bin = join(repo, "node_modules", ".bin");
|
|
71
|
+
await mkdir(bin, { recursive: true });
|
|
72
|
+
const script = join(bin, "forge");
|
|
73
|
+
await writeFile(
|
|
74
|
+
script,
|
|
75
|
+
[
|
|
76
|
+
"#!/bin/sh",
|
|
77
|
+
'if [ "$1" = "correctness.gate" ]; then',
|
|
78
|
+
' primary="$(dirname "$(dirname "$(dirname "$0")")")"',
|
|
79
|
+
' if [ -f "$primary/.correctness-gate.json" ]; then cat "$primary/.correctness-gate.json"; exit "$(cat "$primary/.correctness-gate.exit" 2>/dev/null || echo 0)"; fi',
|
|
80
|
+
' echo \'{"command":"correctness.gate","mode":"warn","status":"pass","bundlePath":null,"violations":[],"weakenings":[],"acceptedWeakening":null}\'',
|
|
81
|
+
" exit 0",
|
|
82
|
+
"fi",
|
|
83
|
+
'echo "fake forge: unsupported $*" >&2',
|
|
84
|
+
"exit 64",
|
|
85
|
+
"",
|
|
86
|
+
].join("\n"),
|
|
87
|
+
);
|
|
88
|
+
await chmod(script, 0o755);
|
|
89
|
+
const exclude = join(repo, ".git", "info", "exclude");
|
|
90
|
+
await mkdir(join(repo, ".git", "info"), { recursive: true });
|
|
91
|
+
await writeFile(exclude, "node_modules/\n.correctness-gate.json\n.correctness-gate.exit\n", {
|
|
92
|
+
flag: "a",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
64
96
|
export async function initRepo(opts?: {
|
|
65
97
|
branch?: string;
|
|
66
98
|
seedCommit?: boolean;
|
|
@@ -72,6 +104,7 @@ export async function initRepo(opts?: {
|
|
|
72
104
|
await gitExec(dir, ["config", "user.email", "flow-test@example.invalid"]);
|
|
73
105
|
await gitExec(dir, ["config", "user.name", "flow-test"]);
|
|
74
106
|
await gitExec(dir, ["config", "commit.gpgsign", "false"]);
|
|
107
|
+
await installFakePrimaryForge(dir);
|
|
75
108
|
if (opts?.seedCommit !== false) {
|
|
76
109
|
await writeFile(join(dir, "seed.txt"), "seed\n");
|
|
77
110
|
await gitExec(dir, ["add", "seed.txt"]);
|
|
@@ -104,18 +137,12 @@ export async function installGuard(repo: string): Promise<void> {
|
|
|
104
137
|
}
|
|
105
138
|
|
|
106
139
|
/** Attempt a commit; env overrides merge over process.env (set "" to neutralize). */
|
|
107
|
-
export function tryCommit(
|
|
108
|
-
repo: string,
|
|
109
|
-
env?: Record<string, string>,
|
|
110
|
-
): Promise<ExecResult> {
|
|
140
|
+
export function tryCommit(repo: string, env?: Record<string, string>): Promise<ExecResult> {
|
|
111
141
|
return gitExec(repo, ["commit", "--allow-empty", "-m", "probe"], env);
|
|
112
142
|
}
|
|
113
143
|
|
|
114
144
|
/** Invoke the installed guard directly with HEAD on the current branch. */
|
|
115
|
-
export function runGuardDirect(
|
|
116
|
-
repo: string,
|
|
117
|
-
env?: Record<string, string>,
|
|
118
|
-
): Promise<ExecResult> {
|
|
145
|
+
export function runGuardDirect(repo: string, env?: Record<string, string>): Promise<ExecResult> {
|
|
119
146
|
return ambientIo.exec("sh", [join(repo, "hooks", "flow-guard.sh"), "pre-commit"], {
|
|
120
147
|
cwd: repo,
|
|
121
148
|
env,
|
|
@@ -145,10 +172,7 @@ export async function initRepoWithOrigin(
|
|
|
145
172
|
await gitExec(repo, ["config", "user.name", "flow-test"]);
|
|
146
173
|
await gitExec(repo, ["config", "commit.gpgsign", "false"]);
|
|
147
174
|
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
148
|
-
await writeFile(
|
|
149
|
-
join(repo, "pnpm-workspace.yaml"),
|
|
150
|
-
"packages:\n - packages/*\n",
|
|
151
|
-
);
|
|
175
|
+
await writeFile(join(repo, "pnpm-workspace.yaml"), "packages:\n - packages/*\n");
|
|
152
176
|
await writeFile(join(repo, "seed.txt"), "seed\n");
|
|
153
177
|
await gitExec(repo, ["add", "-A"]);
|
|
154
178
|
const seed = await gitExec(repo, ["commit", "-m", "seed"]);
|
|
@@ -162,6 +186,7 @@ export async function initRepoWithOrigin(
|
|
|
162
186
|
const push = await gitExec(repo, ["push", "-u", "origin", "develop", "main"]);
|
|
163
187
|
if (push.exitCode !== 0) throw new Error(`initial push failed: ${push.stderr}`);
|
|
164
188
|
|
|
189
|
+
await installFakePrimaryForge(repo);
|
|
165
190
|
if (opts?.fakeExtract) await installFakeRepoExtract(repo, extractLog);
|
|
166
191
|
return { repo, origin, extractLog, parent };
|
|
167
192
|
}
|
|
@@ -176,10 +201,7 @@ export async function initRepoWithOrigin(
|
|
|
176
201
|
* env — or drop a `.fail-extract` marker in the caller's cwd — to make it
|
|
177
202
|
* exit 3 (FLOW-PUSH-05 / FLOW-CUT-13 tests).
|
|
178
203
|
*/
|
|
179
|
-
export async function installFakeRepoExtract(
|
|
180
|
-
repo: string,
|
|
181
|
-
log: string,
|
|
182
|
-
): Promise<string> {
|
|
204
|
+
export async function installFakeRepoExtract(repo: string, log: string): Promise<string> {
|
|
183
205
|
const bin = join(repo, "node_modules", ".bin");
|
|
184
206
|
await mkdir(bin, { recursive: true });
|
|
185
207
|
const script = join(bin, "repo-extract");
|
|
@@ -228,8 +250,7 @@ git -C "$dest" remote add origin "$dorigin"
|
|
|
228
250
|
|
|
229
251
|
/** Switch to a branch, creating it when it does not exist yet. */
|
|
230
252
|
export async function checkoutOrCreate(repo: string, name: string): Promise<void> {
|
|
231
|
-
const exists =
|
|
232
|
-
(await gitExec(repo, ["branch", "--list", name])).stdout.trim().length > 0;
|
|
253
|
+
const exists = (await gitExec(repo, ["branch", "--list", name])).stdout.trim().length > 0;
|
|
233
254
|
const result = exists
|
|
234
255
|
? await gitExec(repo, ["switch", name])
|
|
235
256
|
: await gitExec(repo, ["switch", "-c", name]);
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>ADR-0130 (F-0201): the induced-change lockfile shapes —
|
|
4
|
+
importer-materialize with `optional: true` removals and `key:` → `key: {}`
|
|
5
|
+
collapses on reachable snapshots, and importer-prune with inverse induced
|
|
6
|
+
additions — classify into their tolerated classes instead of `work`, while
|
|
7
|
+
a real content change (a version bump) stays `work`.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No integrate-level restore coverage — the foreign-open-mission restore
|
|
10
|
+
path itself is covered in the preflight/integrate suites; these tests pin
|
|
11
|
+
the classification boundary the sweep depends on.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>ADR-0130: induced-change lockfile classifiers — materialize BFS reachability + prune induced additions</item>
|
|
16
|
+
<item>ADR-0130: induced-change lockfile classifiers — BFS reachability for optional-flag removals, collapse pairs, induced packages/snapshots additions</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { describe, expect, it, afterEach } from "vitest";
|
|
21
|
+
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
|
|
25
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
26
|
+
import {
|
|
27
|
+
classifyLockfileMaterializeExtended,
|
|
28
|
+
classifyLockfilePruneIdsExtended,
|
|
29
|
+
} from "../preflight.ts";
|
|
30
|
+
|
|
31
|
+
const dirs: string[] = [];
|
|
32
|
+
afterEach(async () => {
|
|
33
|
+
for (const dir of dirs.splice(0)) {
|
|
34
|
+
await rm(dir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Fixture cut from commit 9fc5be128 (importer materialize + induced removals):
|
|
39
|
+
// HEAD lacks the mission importer; the working file gains it plus
|
|
40
|
+
// `optional: true` removals and a `buffer-from` collapse on reachable snapshots.
|
|
41
|
+
const HEAD_MATERIALIZE = `lockfileVersion: '9.0'
|
|
42
|
+
|
|
43
|
+
importers:
|
|
44
|
+
|
|
45
|
+
.:
|
|
46
|
+
dependencies:
|
|
47
|
+
yaml:
|
|
48
|
+
specifier: ^2.9.1
|
|
49
|
+
version: 2.9.1
|
|
50
|
+
|
|
51
|
+
packages:
|
|
52
|
+
|
|
53
|
+
yaml@2.9.1:
|
|
54
|
+
resolution: {integrity: sha1}
|
|
55
|
+
|
|
56
|
+
buffer-from@1.1.2:
|
|
57
|
+
resolution: {integrity: sha2}
|
|
58
|
+
|
|
59
|
+
buffer-crc32@0.2.13:
|
|
60
|
+
resolution: {integrity: sha3}
|
|
61
|
+
|
|
62
|
+
snapshots:
|
|
63
|
+
|
|
64
|
+
yaml@2.9.1: {}
|
|
65
|
+
|
|
66
|
+
buffer-crc32@0.2.13:
|
|
67
|
+
optional: true
|
|
68
|
+
|
|
69
|
+
buffer-from@1.1.2:
|
|
70
|
+
optional: true
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const DIFF_MATERIALIZE = `diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
|
74
|
+
index aaa..bbb 100644
|
|
75
|
+
--- a/pnpm-lock.yaml
|
|
76
|
+
+++ b/pnpm-lock.yaml
|
|
77
|
+
@@ -5,7 +5,15 @@ importers:
|
|
78
|
+
.:
|
|
79
|
+
dependencies:
|
|
80
|
+
yaml:
|
|
81
|
+
specifier: ^2.9.1
|
|
82
|
+
version: 2.9.1
|
|
83
|
+
|
|
84
|
+
+ missions/site-m000001/workpiece:
|
|
85
|
+
+ dependencies:
|
|
86
|
+
+ buffer-from:
|
|
87
|
+
+ specifier: ^1.1.2
|
|
88
|
+
+ version: 1.1.2
|
|
89
|
+
+ buffer-crc32:
|
|
90
|
+
+ specifier: ^0.2.13
|
|
91
|
+
+ version: 0.2.13
|
|
92
|
+
+
|
|
93
|
+
packages:
|
|
94
|
+
@@ -22,10 +30,9 @@ snapshots:
|
|
95
|
+
|
|
96
|
+
yaml@2.9.1: {}
|
|
97
|
+
|
|
98
|
+
buffer-crc32@0.2.13:
|
|
99
|
+
- optional: true
|
|
100
|
+
|
|
101
|
+
- buffer-from@1.1.2:
|
|
102
|
+
- optional: true
|
|
103
|
+
+ buffer-from@1.1.2: {}
|
|
104
|
+
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
const WORK_MATERIALIZE = `lockfileVersion: '9.0'
|
|
108
|
+
|
|
109
|
+
importers:
|
|
110
|
+
|
|
111
|
+
.:
|
|
112
|
+
dependencies:
|
|
113
|
+
yaml:
|
|
114
|
+
specifier: ^2.9.1
|
|
115
|
+
version: 2.9.1
|
|
116
|
+
|
|
117
|
+
missions/site-m000001/workpiece:
|
|
118
|
+
dependencies:
|
|
119
|
+
buffer-from:
|
|
120
|
+
specifier: ^1.1.2
|
|
121
|
+
version: 1.1.2
|
|
122
|
+
buffer-crc32:
|
|
123
|
+
specifier: ^0.2.13
|
|
124
|
+
version: 0.2.13
|
|
125
|
+
|
|
126
|
+
packages:
|
|
127
|
+
|
|
128
|
+
yaml@2.9.1:
|
|
129
|
+
resolution: {integrity: sha1}
|
|
130
|
+
|
|
131
|
+
buffer-from@1.1.2:
|
|
132
|
+
resolution: {integrity: sha2}
|
|
133
|
+
|
|
134
|
+
buffer-crc32@0.2.13:
|
|
135
|
+
resolution: {integrity: sha3}
|
|
136
|
+
|
|
137
|
+
snapshots:
|
|
138
|
+
|
|
139
|
+
yaml@2.9.1: {}
|
|
140
|
+
|
|
141
|
+
buffer-crc32@0.2.13:
|
|
142
|
+
|
|
143
|
+
buffer-from@1.1.2: {}
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
// Fixture cut from commit 391abcfaf (importer prune + induced additions):
|
|
147
|
+
// HEAD carries the mission importer; the working file drops it and gains
|
|
148
|
+
// `optional: true`/`transitivePeerDependencies`/snapshot entries.
|
|
149
|
+
const HEAD_PRUNE = `lockfileVersion: '9.0'
|
|
150
|
+
|
|
151
|
+
importers:
|
|
152
|
+
|
|
153
|
+
.:
|
|
154
|
+
dependencies:
|
|
155
|
+
yaml:
|
|
156
|
+
specifier: ^2.9.1
|
|
157
|
+
version: 2.9.1
|
|
158
|
+
|
|
159
|
+
missions/site-m000001/workpiece:
|
|
160
|
+
dependencies:
|
|
161
|
+
buffer-from:
|
|
162
|
+
specifier: ^1.1.2
|
|
163
|
+
version: 1.1.2
|
|
164
|
+
|
|
165
|
+
packages:
|
|
166
|
+
|
|
167
|
+
yaml@2.9.1:
|
|
168
|
+
resolution: {integrity: sha1}
|
|
169
|
+
|
|
170
|
+
buffer-from@1.1.2:
|
|
171
|
+
resolution: {integrity: sha2}
|
|
172
|
+
|
|
173
|
+
snapshots:
|
|
174
|
+
|
|
175
|
+
yaml@2.9.1: {}
|
|
176
|
+
|
|
177
|
+
buffer-from@1.1.2: {}
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
const DIFF_PRUNE = `diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
|
181
|
+
index ccc..ddd 100644
|
|
182
|
+
--- a/pnpm-lock.yaml
|
|
183
|
+
+++ b/pnpm-lock.yaml
|
|
184
|
+
@@ -9,7 +9,4 @@ importers:
|
|
185
|
+
specifier: ^2.9.1
|
|
186
|
+
version: 2.9.1
|
|
187
|
+
|
|
188
|
+
- missions/site-m000001/workpiece:
|
|
189
|
+
- dependencies:
|
|
190
|
+
- buffer-from:
|
|
191
|
+
- specifier: ^1.1.2
|
|
192
|
+
- version: 1.1.2
|
|
193
|
+
|
|
194
|
+
packages:
|
|
195
|
+
@@ -25,6 +22,13 @@ snapshots:
|
|
196
|
+
|
|
197
|
+
yaml@2.9.1: {}
|
|
198
|
+
|
|
199
|
+
- buffer-from@1.1.2: {}
|
|
200
|
+
+ buffer-from@1.1.2:
|
|
201
|
+
+ optional: true
|
|
202
|
+
+
|
|
203
|
+
+ buffer-crc32@0.2.13:
|
|
204
|
+
+ dependencies:
|
|
205
|
+
+ x: 1.0.0
|
|
206
|
+
+ transitivePeerDependencies:
|
|
207
|
+
+ - prettier
|
|
208
|
+
+ optional: true
|
|
209
|
+
|
|
210
|
+
`;
|
|
211
|
+
|
|
212
|
+
const DIFF_VERSION_BUMP = `diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
|
213
|
+
index eee..fff 100644
|
|
214
|
+
--- a/pnpm-lock.yaml
|
|
215
|
+
+++ b/pnpm-lock.yaml
|
|
216
|
+
@@ -5,6 +5,11 @@ importers:
|
|
217
|
+
.:
|
|
218
|
+
dependencies:
|
|
219
|
+
yaml:
|
|
220
|
+
- specifier: ^2.9.1
|
|
221
|
+
- version: 2.9.1
|
|
222
|
+
+ specifier: ^3.0.0
|
|
223
|
+
+ version: 3.0.0
|
|
224
|
+
+
|
|
225
|
+
+ missions/site-m000001/workpiece:
|
|
226
|
+
+ dependencies:
|
|
227
|
+
+ buffer-from:
|
|
228
|
+
+ specifier: ^1.1.2
|
|
229
|
+
+ version: 1.1.2
|
|
230
|
+
+
|
|
231
|
+
packages:
|
|
232
|
+
`;
|
|
233
|
+
|
|
234
|
+
describe("classifyLockfileMaterializeExtended — ADR-0130", () => {
|
|
235
|
+
it("the 9fc5be128 shape (importer add + optional removals + collapse) classifies importer-materialize", () => {
|
|
236
|
+
expect(
|
|
237
|
+
classifyLockfileMaterializeExtended(DIFF_MATERIALIZE, HEAD_MATERIALIZE, WORK_MATERIALIZE),
|
|
238
|
+
).toEqual(["site-m000001"]);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("an `optional: true` removal on an unreachable snapshot keeps the diff unattributed", () => {
|
|
242
|
+
// drop buffer-crc32 from the mission's deps — its optional removal is
|
|
243
|
+
// then outside the added importers' closure.
|
|
244
|
+
const narrowed = WORK_MATERIALIZE.replace(
|
|
245
|
+
` buffer-crc32:
|
|
246
|
+
specifier: ^0.2.13
|
|
247
|
+
version: 0.2.13
|
|
248
|
+
`,
|
|
249
|
+
"",
|
|
250
|
+
);
|
|
251
|
+
expect(
|
|
252
|
+
classifyLockfileMaterializeExtended(DIFF_MATERIALIZE, HEAD_MATERIALIZE, narrowed),
|
|
253
|
+
).toBeNull();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
describe("classifyLockfilePruneIdsExtended — ADR-0130", () => {
|
|
258
|
+
it("the 391abcfaf shape (importer prune + induced additions) returns the pruned ids", () => {
|
|
259
|
+
expect(classifyLockfilePruneIdsExtended(DIFF_PRUNE, HEAD_PRUNE)).toEqual(["site-m000001"]);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("a version-string change inside the diff keeps the diff unattributed", () => {
|
|
263
|
+
expect(classifyLockfilePruneIdsExtended(DIFF_VERSION_BUMP, HEAD_MATERIALIZE)).toBeNull();
|
|
264
|
+
expect(
|
|
265
|
+
classifyLockfileMaterializeExtended(DIFF_VERSION_BUMP, HEAD_MATERIALIZE, WORK_MATERIALIZE),
|
|
266
|
+
).toBeNull();
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe("classifyDirt — induced shapes (ADR-0130)", () => {
|
|
271
|
+
it("the 391abcfaf shape against a foreign open mission classifies foreign-open-mission (restored, not swept)", async () => {
|
|
272
|
+
const { classifyDirt } = await import("../preflight.ts");
|
|
273
|
+
const repo = await mkdtemp(join(tmpdir(), "dirt-"));
|
|
274
|
+
dirs.push(repo);
|
|
275
|
+
// classifyDirt reads the working lockfile through io — content is
|
|
276
|
+
// irrelevant for the prune direction (only HEAD text + diff are used).
|
|
277
|
+
await writeFile(join(repo, "pnpm-lock.yaml"), HEAD_PRUNE);
|
|
278
|
+
const runGit = async (_cwd: string, _io: unknown, args: string[]) => {
|
|
279
|
+
const joined = args.join(" ");
|
|
280
|
+
if (joined.includes("diff")) return { exitCode: 0, stdout: DIFF_PRUNE, stderr: "" };
|
|
281
|
+
if (joined.includes("show")) return { exitCode: 0, stdout: HEAD_PRUNE, stderr: "" };
|
|
282
|
+
return { exitCode: 0, stdout: "", stderr: "" };
|
|
283
|
+
};
|
|
284
|
+
const verdict = await classifyDirt(
|
|
285
|
+
repo,
|
|
286
|
+
ambientIo,
|
|
287
|
+
[" M pnpm-lock.yaml"],
|
|
288
|
+
{ runGit: runGit as never },
|
|
289
|
+
[],
|
|
290
|
+
async (ids) =>
|
|
291
|
+
ids.map((missionId) => ({
|
|
292
|
+
missionId,
|
|
293
|
+
existsHere: false,
|
|
294
|
+
existsInCheckout: ["/repo@auto/foreign"],
|
|
295
|
+
missionOpen: true,
|
|
296
|
+
})),
|
|
297
|
+
);
|
|
298
|
+
expect(verdict.tolerated).toEqual([
|
|
299
|
+
{
|
|
300
|
+
path: "pnpm-lock.yaml",
|
|
301
|
+
class: "foreign-open-mission",
|
|
302
|
+
missionIds: ["site-m000001"],
|
|
303
|
+
},
|
|
304
|
+
]);
|
|
305
|
+
expect(verdict.unattributed).toEqual([]);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it("the 9fc5be128 shape with an open mission classifies importer-materialize", async () => {
|
|
309
|
+
const { classifyDirt } = await import("../preflight.ts");
|
|
310
|
+
const repo = await mkdtemp(join(tmpdir(), "dirt-"));
|
|
311
|
+
dirs.push(repo);
|
|
312
|
+
await writeFile(join(repo, "pnpm-lock.yaml"), WORK_MATERIALIZE);
|
|
313
|
+
// the mission must read as open — openMissionsIn globs missions/*/mission.yaml
|
|
314
|
+
await mkdir(join(repo, "missions/site-m000001"), { recursive: true });
|
|
315
|
+
await writeFile(join(repo, "missions/site-m000001/mission.yaml"), 'state: "open"\n');
|
|
316
|
+
const runGit = async (_cwd: string, _io: unknown, args: string[]) => {
|
|
317
|
+
const joined = args.join(" ");
|
|
318
|
+
if (joined.includes("diff")) return { exitCode: 0, stdout: DIFF_MATERIALIZE, stderr: "" };
|
|
319
|
+
if (joined.includes("show")) return { exitCode: 0, stdout: HEAD_MATERIALIZE, stderr: "" };
|
|
320
|
+
return { exitCode: 0, stdout: "", stderr: "" };
|
|
321
|
+
};
|
|
322
|
+
const verdict = await classifyDirt(repo, ambientIo, [" M pnpm-lock.yaml"], {
|
|
323
|
+
runGit: runGit as never,
|
|
324
|
+
});
|
|
325
|
+
expect(verdict.tolerated).toEqual([{ path: "pnpm-lock.yaml", class: "importer-materialize" }]);
|
|
326
|
+
expect(verdict.unattributed).toEqual([]);
|
|
327
|
+
});
|
|
328
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1568 — detach mechanics: the parent re-spawns the same CLI
|
|
4
|
+
entrypoint with `--detach` stripped, stdio routed to the run's log file,
|
|
5
|
+
`WERKSTATT_GATE_RUN_ID` in env so the child adopts the parent's record,
|
|
6
|
+
then prints the pointer block and exits 0.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No output mirroring — detached output lives only in the log file.</item>
|
|
9
|
+
<item>No waiting on the gate itself — only a ≤2 s heartbeat on the child's
|
|
10
|
+
first record write, so an unspawnable child surfaces before the parent
|
|
11
|
+
returns.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1568: step 3 — detachSelf with injected SpawnLike</item>
|
|
16
|
+
<item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// kernel-io-lint IO-01 carve-out (RFC-1568 / DNA-105): a detached gate is the
|
|
21
|
+
// "genuinely long-lived child process" class the spawn carve-out exists for.
|
|
22
|
+
// The spawner stays injectable — unit tests never spawn real gates.
|
|
23
|
+
import { spawn as nodeSpawn } from "node:child_process";
|
|
24
|
+
import { closeSync, openSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
|
|
27
|
+
import type { GateRunRecord, SpawnLike } from "./types.ts";
|
|
28
|
+
import { gateRunsDir } from "./record.ts";
|
|
29
|
+
|
|
30
|
+
export const GATE_RUN_ID_ENV = "WERKSTATT_GATE_RUN_ID";
|
|
31
|
+
/** How long the parent waits for the child's first record write. */
|
|
32
|
+
export const HEARTBEAT_WAIT_MS = 2_000;
|
|
33
|
+
|
|
34
|
+
export interface DetachResult {
|
|
35
|
+
pid: number;
|
|
36
|
+
logPath: string;
|
|
37
|
+
runId: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Re-spawn the current CLI detached. `entry` is process.argv[1] of the
|
|
42
|
+
* running host (`forge` bin or `werkstatt` bin); `argv` carries the command
|
|
43
|
+
* and its flags minus `--detach` — for the kernel host it MUST keep the
|
|
44
|
+
* leading `run` token so the child re-enters the same dispatch path.
|
|
45
|
+
*/
|
|
46
|
+
export async function detachSelf(input: {
|
|
47
|
+
entry: string;
|
|
48
|
+
argv: string[];
|
|
49
|
+
record: GateRunRecord;
|
|
50
|
+
commonGitDir: string;
|
|
51
|
+
spawn?: SpawnLike;
|
|
52
|
+
/** Reads the record back for the heartbeat — injected in tests. */
|
|
53
|
+
recordExists?: (runId: string) => Promise<boolean>;
|
|
54
|
+
}): Promise<DetachResult> {
|
|
55
|
+
const doSpawn: SpawnLike = input.spawn ?? (nodeSpawn as unknown as SpawnLike);
|
|
56
|
+
const logPath = join(gateRunsDir(input.commonGitDir), `${input.record.runId}.log`);
|
|
57
|
+
const logFd = openSync(logPath, "a");
|
|
58
|
+
try {
|
|
59
|
+
// process.execArgv forwards the host's loader flags (--import tsx, …) —
|
|
60
|
+
// a bare `node entry.ts` dies with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX.
|
|
61
|
+
const child = doSpawn(process.execPath, [...process.execArgv, input.entry, ...input.argv], {
|
|
62
|
+
detached: true,
|
|
63
|
+
stdio: ["ignore", logFd, logFd],
|
|
64
|
+
env: { ...process.env, [GATE_RUN_ID_ENV]: input.record.runId },
|
|
65
|
+
});
|
|
66
|
+
child.unref();
|
|
67
|
+
const pid = child.pid;
|
|
68
|
+
if (pid === undefined) {
|
|
69
|
+
throw new Error("spawn returned no pid");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ≤2 s heartbeat — the child adopts the record by rewriting it with its
|
|
73
|
+
// own pid; if that write never lands the parent reports the spawn
|
|
74
|
+
// failure instead of leaving an untrackable process.
|
|
75
|
+
if (input.recordExists !== undefined) {
|
|
76
|
+
const deadline = Date.now() + HEARTBEAT_WAIT_MS;
|
|
77
|
+
while (Date.now() < deadline) {
|
|
78
|
+
if (await input.recordExists(input.record.runId)) break;
|
|
79
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { pid, logPath, runId: input.record.runId };
|
|
83
|
+
} finally {
|
|
84
|
+
try {
|
|
85
|
+
closeSync(logFd);
|
|
86
|
+
} catch {
|
|
87
|
+
// fd already closed — nothing to do
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Pretty pointer block printed by the parent before exiting. */
|
|
93
|
+
export function detachPointerLines(
|
|
94
|
+
result: DetachResult,
|
|
95
|
+
commonGitDir: string,
|
|
96
|
+
statusCommand: string,
|
|
97
|
+
): string[] {
|
|
98
|
+
const relLog = result.logPath.startsWith(commonGitDir)
|
|
99
|
+
? `.git/${result.logPath.slice(commonGitDir.length + 1)}`
|
|
100
|
+
: result.logPath;
|
|
101
|
+
return [
|
|
102
|
+
`[gate-run] started ${result.runId} (pid ${result.pid})`,
|
|
103
|
+
` log: ${relLog}`,
|
|
104
|
+
` status: ${statusCommand} --id ${result.runId}`,
|
|
105
|
+
];
|
|
106
|
+
}
|