@warpgogol/forge 9.3.0 → 9.4.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/AGENTS.md +32 -0
- package/CHANGELOG.md +33 -0
- package/README.md +2 -2
- package/bin/cli.ts +4 -4
- package/dist/bin/cli.js +4 -4
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +23 -2
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/adr/types.d.ts +2 -0
- package/dist/os/adr/types.d.ts.map +1 -1
- package/dist/os/adr/types.js +2 -2
- package/dist/os/adr/types.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +3 -1
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +6 -12
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +2 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +7 -2
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +24 -14
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/conformance/conformance.module.d.ts.map +1 -1
- package/dist/os/conformance/conformance.module.js +21 -4
- package/dist/os/conformance/conformance.module.js.map +1 -1
- package/dist/os/conformance/handlers/conformance-validate.d.ts.map +1 -1
- package/dist/os/conformance/handlers/conformance-validate.js +64 -8
- package/dist/os/conformance/handlers/conformance-validate.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +99 -0
- package/dist/os/core/archive-regen.d.ts.map +1 -0
- package/dist/os/core/archive-regen.js +220 -0
- package/dist/os/core/archive-regen.js.map +1 -0
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +159 -18
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
- package/dist/os/core/handlers/assets-helpers.js +8 -3
- package/dist/os/core/handlers/assets-helpers.js.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +3 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
- package/dist/os/core/handlers/package-health.d.ts +130 -0
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +548 -7
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
- package/dist/os/core/handlers/release-prepare.js +5 -2
- package/dist/os/core/handlers/release-prepare.js.map +1 -1
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +3 -1
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dirty-classify.d.ts +48 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -0
- package/dist/os/flow/dirty-classify.js +81 -0
- package/dist/os/flow/dirty-classify.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +85 -19
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/gate-engine.d.ts +13 -0
- package/dist/os/flow/gate-engine.d.ts.map +1 -0
- package/dist/os/flow/gate-engine.js +32 -0
- package/dist/os/flow/gate-engine.js.map +1 -0
- package/dist/os/flow/git.d.ts +45 -4
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +95 -27
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.js +12 -5
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +25 -3
- package/dist/os/flow/handlers/flow-check.js.map +1 -1
- package/dist/os/flow/handlers/flow-cut.d.ts +4 -1
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +54 -31
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +33 -5
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +13 -10
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-hold.js +13 -7
- package/dist/os/flow/handlers/flow-hold.js.map +1 -1
- package/dist/os/flow/handlers/flow-install.d.ts +2 -1
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-install.js +56 -13
- package/dist/os/flow/handlers/flow-install.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +48 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +536 -65
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts +14 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +117 -12
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/handlers/flow-status.d.ts +13 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-status.js +35 -14
- package/dist/os/flow/handlers/flow-status.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 +3 -1
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/line-version.d.ts.map +1 -1
- package/dist/os/flow/line-version.js +2 -1
- package/dist/os/flow/line-version.js.map +1 -1
- package/dist/os/flow/locks.d.ts +37 -1
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +34 -14
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/preflight.d.ts +114 -0
- package/dist/os/flow/preflight.d.ts.map +1 -0
- package/dist/os/flow/preflight.js +620 -0
- package/dist/os/flow/preflight.js.map +1 -0
- package/dist/os/flow/publish.d.ts +7 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +165 -3
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +26 -1
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +27 -6
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/scripts.d.ts +4 -0
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +13 -3
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/session-checkout.d.ts +33 -0
- package/dist/os/flow/session-checkout.d.ts.map +1 -0
- package/dist/os/flow/session-checkout.js +151 -0
- package/dist/os/flow/session-checkout.js.map +1 -0
- package/dist/os/flow/worktree-path.d.ts.map +1 -1
- package/dist/os/flow/worktree-path.js +9 -3
- package/dist/os/flow/worktree-path.js.map +1 -1
- package/dist/os/instructions/handlers/budget-validate.d.ts +1 -0
- package/dist/os/instructions/handlers/budget-validate.d.ts.map +1 -1
- package/dist/os/instructions/handlers/budget-validate.js +12 -4
- package/dist/os/instructions/handlers/budget-validate.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +4 -1
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/mission/open-missions.d.ts +8 -0
- package/dist/os/mission/open-missions.d.ts.map +1 -0
- package/dist/os/mission/open-missions.js +42 -0
- package/dist/os/mission/open-missions.js.map +1 -0
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +11 -1
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts +14 -0
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +18 -10
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +11 -2
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts +23 -0
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +82 -1
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.js +24 -2
- package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +16 -3
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +5 -4
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +83 -8
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +48 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +131 -2
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +21 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +77 -5
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +64 -6
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/next-id.d.ts +38 -0
- package/dist/os/rfc/next-id.d.ts.map +1 -0
- package/dist/os/rfc/next-id.js +165 -0
- package/dist/os/rfc/next-id.js.map +1 -0
- package/dist/os/rfc/probe-batch.d.ts.map +1 -1
- package/dist/os/rfc/probe-batch.js +6 -1
- package/dist/os/rfc/probe-batch.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +36 -8
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +35 -6
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +6 -6
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +81 -28
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +8 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +47 -0
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +31 -7
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/spec/spec-schema.d.ts +8 -0
- package/dist/os/spec/spec-schema.d.ts.map +1 -1
- package/dist/os/spec/spec-schema.js +1 -0
- package/dist/os/spec/spec-schema.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts +8 -0
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +18 -6
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +62 -15
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/spec/spec.module.d.ts.map +1 -1
- package/dist/os/spec/spec.module.js +13 -5
- package/dist/os/spec/spec.module.js.map +1 -1
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -1
- package/dist/os/system/handlers/system-map-validate.js +2 -1
- package/dist/os/system/handlers/system-map-validate.js.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.d.ts +11 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.js +54 -6
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-create.js +6 -1
- package/dist/os/system/handlers/system-task-create.js.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.d.ts +14 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.js +246 -6
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -1
- package/dist/os/system/repo.d.ts +1 -1
- package/dist/os/system/repo.d.ts.map +1 -1
- package/dist/os/system/repo.js +53 -3
- package/dist/os/system/repo.js.map +1 -1
- package/dist/os/system/scenario-schemas.d.ts +109 -3
- package/dist/os/system/scenario-schemas.d.ts.map +1 -1
- package/dist/os/system/scenario-schemas.js +66 -10
- package/dist/os/system/scenario-schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +69 -17
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/os/system/tests/contract-fixtures.d.ts +17 -0
- package/dist/os/system/tests/contract-fixtures.d.ts.map +1 -0
- package/dist/os/system/tests/contract-fixtures.js +109 -0
- package/dist/os/system/tests/contract-fixtures.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +54 -18
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +41 -9
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/conformance/index.d.ts +6 -0
- package/dist/src/conformance/index.d.ts.map +1 -1
- package/dist/src/conformance/index.js +36 -1
- package/dist/src/conformance/index.js.map +1 -1
- package/dist/src/formal/proof-runner.d.ts.map +1 -1
- package/dist/src/formal/proof-runner.js +10 -2
- package/dist/src/formal/proof-runner.js.map +1 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js +3 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.js +3 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +4 -4
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.js +3 -1
- package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
- package/dist/src/onboarding/scaffold-project.js +2 -2
- package/dist/src/onboarding/scaffold-project.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +14 -2
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
- package/dist/src/onboarding/workspace-discovery.js +3 -1
- package/dist/src/onboarding/workspace-discovery.js.map +1 -1
- package/dist/src/skill-schema.d.ts +3 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -2
- package/dist/src/skill-schema.js.map +1 -1
- package/dist/src/spec/resolve-spec-source.d.ts +45 -0
- package/dist/src/spec/resolve-spec-source.d.ts.map +1 -0
- package/dist/src/spec/resolve-spec-source.js +153 -0
- package/dist/src/spec/resolve-spec-source.js.map +1 -0
- package/dist/src/utils/command-inventory.d.ts +28 -0
- package/dist/src/utils/command-inventory.d.ts.map +1 -0
- package/dist/src/utils/command-inventory.js +84 -0
- package/dist/src/utils/command-inventory.js.map +1 -0
- package/dist/src/utils/io.d.ts.map +1 -1
- package/dist/src/utils/io.js +6 -1
- package/dist/src/utils/io.js.map +1 -1
- package/dist/src/utils/repo-path.d.ts +10 -0
- package/dist/src/utils/repo-path.d.ts.map +1 -0
- package/dist/src/utils/repo-path.js +52 -0
- package/dist/src/utils/repo-path.js.map +1 -0
- package/dist/src/utils/spawn.d.ts +23 -0
- package/dist/src/utils/spawn.d.ts.map +1 -0
- package/dist/src/utils/spawn.js +83 -0
- package/dist/src/utils/spawn.js.map +1 -0
- package/docs/branch-model.md +1 -1
- package/docs/guides/existing-project.md +1 -1
- package/docs/maintainers/publishing.md +1 -1
- package/docs/reference/cli.md +8 -2
- package/docs/reference/profiles.md +1 -1
- package/os/adr/handlers/list-create.ts +26 -2
- package/os/adr/types.ts +4 -2
- package/os/compass/handlers/compass-audit-handler.ts +6 -1
- package/os/compass/handlers/compass-header-scaffold-handler.ts +12 -11
- package/os/compass/handlers/git-revision.ts +8 -2
- package/os/compass/handlers/summary-record.ts +25 -14
- package/os/compass/handlers/tests/compass-invariant-binding.test.ts +3 -2
- package/os/conformance/conformance.module.ts +21 -4
- package/os/conformance/handlers/conformance-validate.ts +108 -16
- package/os/conformance/handlers/tests/conformance-package-consumer.test.ts +200 -0
- package/os/core/archive-regen.ts +279 -0
- package/os/core/core.module.ts +176 -29
- package/os/core/docs-archive.test.ts +413 -3
- package/os/core/handlers/assets-helpers.ts +8 -3
- package/os/core/handlers/forge-autonomy-validate.ts +3 -1
- package/os/core/handlers/package-health.test.ts +418 -4
- package/os/core/handlers/package-health.ts +629 -7
- package/os/core/handlers/release-prepare.ts +5 -2
- package/os/flow/digest.ts +3 -1
- package/os/flow/dirty-classify.ts +112 -0
- package/os/flow/flow.module.ts +92 -24
- package/os/flow/gate-engine.ts +45 -0
- package/os/flow/git.ts +117 -29
- package/os/flow/handlers/flow-backmerge.ts +14 -4
- package/os/flow/handlers/flow-check.ts +27 -2
- package/os/flow/handlers/flow-cut.ts +97 -46
- package/os/flow/handlers/flow-discard.ts +33 -5
- package/os/flow/handlers/flow-fix.ts +22 -10
- package/os/flow/handlers/flow-hold.ts +20 -7
- package/os/flow/handlers/flow-install.ts +59 -12
- package/os/flow/handlers/flow-integrate.ts +808 -182
- package/os/flow/handlers/flow-open.ts +135 -11
- package/os/flow/handlers/flow-status.ts +45 -13
- package/os/flow/index.ts +3 -1
- package/os/flow/line-version.ts +2 -1
- package/os/flow/locks.ts +56 -14
- package/os/flow/preflight.ts +763 -0
- package/os/flow/publish.ts +200 -5
- package/os/flow/registry.ts +43 -7
- package/os/flow/scripts.ts +23 -7
- package/os/flow/session-checkout.ts +186 -0
- package/os/flow/tests/dirty-classify.test.ts +116 -0
- package/os/flow/tests/fixtures/branch-names.yaml +40 -40
- package/os/flow/tests/flow-discard.test.ts +32 -0
- package/os/flow/tests/flow-guard-parity.test.ts +10 -2
- package/os/flow/tests/flow-install.test.ts +7 -3
- package/os/flow/tests/flow-integrate.gate-report.test.ts +144 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +561 -0
- package/os/flow/tests/flow-integrate.reattach.test.ts +197 -0
- package/os/flow/tests/flow-integrate.remediation.test.ts +254 -0
- package/os/flow/tests/flow-integrate.test.ts +348 -17
- package/os/flow/tests/flow-open.pending.test.ts +277 -0
- package/os/flow/tests/flow-open.test.ts +52 -9
- package/os/flow/tests/flow-push-publish.test.ts +124 -0
- package/os/flow/tests/flow-status.test.ts +31 -1
- package/os/flow/tests/locks.test.ts +39 -3
- package/os/flow/tests/scripts.test.ts +18 -2
- package/os/flow/tests/state-roots.test.ts +8 -5
- package/os/flow/worktree-path.ts +9 -3
- package/os/formal/handlers/proof-check.test.ts +6 -3
- package/os/instructions/budget.test.ts +31 -0
- package/os/instructions/handlers/budget-validate.ts +13 -4
- package/os/instructions/instructions.module.ts +4 -1
- package/os/mission/open-missions.ts +50 -0
- package/os/queue/decision-ledger.test.ts +18 -0
- package/os/queue/manifest.ts +17 -1
- package/os/rfc/acceptance.ts +30 -10
- package/os/rfc/decision-log.ts +13 -2
- package/os/rfc/frontmatter-io.ts +89 -1
- package/os/rfc/handlers/implement-stamp-deviations.test.ts +83 -0
- package/os/rfc/handlers/implement-stamp-deviations.ts +22 -2
- package/os/rfc/handlers/implement-stamp-stale.test.ts +5 -1
- package/os/rfc/handlers/implement-stamp.ts +16 -3
- package/os/rfc/handlers/index-graph.ts +5 -4
- package/os/rfc/handlers/lifecycle.test.ts +136 -0
- package/os/rfc/handlers/list-create.test.ts +82 -0
- package/os/rfc/handlers/list-create.ts +101 -8
- package/os/rfc/handlers/rfc-evidence-sync.test.ts +504 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +192 -2
- package/os/rfc/handlers/tests/index-graph.test.ts +2 -1
- package/os/rfc/handlers/validate-rules-rfc1454.test.ts +73 -0
- package/os/rfc/handlers/validate-rules.ts +103 -7
- package/os/rfc/handlers/validate.ts +68 -4
- package/os/rfc/next-id.ts +232 -0
- package/os/rfc/probe-batch.ts +6 -1
- package/os/rfc/rfc.module.ts +41 -8
- package/os/rfc/types.ts +28 -6
- package/os/rfc/verification-emit-freshness.test.ts +5 -1
- package/os/rfc/verification-emit.test.ts +5 -1
- package/os/rfc/verification-evidence.ts +99 -33
- package/os/rfc/verification-origin.ts +59 -0
- package/os/rfc/verification-refresh.test.ts +5 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +5 -1
- package/os/session/handlers/save.ts +35 -7
- package/os/session/tests/session-save.test.ts +154 -0
- package/os/spec/spec-schema.ts +3 -0
- package/os/spec/spec-status.ts +22 -6
- package/os/spec/spec-validate.package-source.test.ts +187 -0
- package/os/spec/spec-validate.ts +65 -14
- package/os/spec/spec.module.ts +13 -5
- package/os/system/handlers/system-map-validate.ts +4 -2
- package/os/system/handlers/system-outbox-scan.ts +65 -21
- package/os/system/handlers/system-task-create.ts +6 -1
- package/os/system/handlers/system-versionset-record.ts +301 -16
- package/os/system/repo.ts +59 -18
- package/os/system/scenario-schemas.ts +91 -12
- package/os/system/system.module.ts +70 -17
- package/os/system/tests/contract-fixtures.ts +139 -0
- package/os/system/tests/scenario-pin-drift-check.test.ts +114 -0
- package/os/system/tests/scenario-validator-check.test.ts +96 -0
- package/os/system/tests/system-task-dispatch.test.ts +4 -1
- package/os/system/tests/system-versionset.test.ts +7 -3
- package/os/system/tests/version-set-v2.test.ts +78 -0
- package/package.json +9 -1
- package/profiles/forge-shell.yaml +1 -2
- package/profiles/knowledge.yaml +1 -1
- package/profiles/system.yaml +2 -2
- package/profiles/typescript.yaml +0 -1
- package/skills/fo/fo-doctor/SKILL.md +151 -0
- package/skills/fo/fo-handoff/SKILL.md +22 -0
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +2 -1
- package/skills/fo/fo-idea-implement/SKILL.md +5 -2
- package/skills/fo/fo-idea-plan/SKILL.md +5 -5
- package/skills/fo/fo-session-retro/SKILL.md +37 -11
- package/skills/fo/fo-spec-ingest/SKILL.md +8 -0
- package/skills/fo/fo-system-dispatch/SKILL.md +1 -0
- package/skills/meta/skill-create/SKILL.md +2 -1
- package/src/bin-entry.test.ts +3 -1
- package/src/config/forge-config.ts +57 -13
- package/src/conformance/index.ts +46 -1
- package/src/formal/proof-runner.ts +10 -2
- package/src/migration-adapters/node-typescript-pnpm/index.ts +3 -1
- package/src/migration-adapters/phaser-pnpm/index.ts +3 -1
- package/src/onboarding/agents-generate.ts +4 -4
- package/src/onboarding/nested-agents-generate.ts +3 -1
- package/src/onboarding/scaffold-project.ts +2 -2
- package/src/onboarding/upgrade.ts +13 -2
- package/src/onboarding/workspace-discovery.ts +3 -1
- package/src/pipeline-status.test.ts +1 -1
- package/src/skill-schema.ts +9 -2
- package/src/spec/resolve-spec-source.ts +184 -0
- package/src/tests/acceptance-probe-kinds.test.ts +3 -1
- package/src/tests/agents-generate-domain.test.ts +3 -2
- package/src/tests/agents-generate.test.ts +2 -1
- package/src/tests/create-flow.test.ts +3 -1
- package/src/tests/create.test.ts +12 -2
- package/src/tests/editable-generated-region.test.ts +2 -2
- package/src/tests/fixtures/agents-generate-business-before.txt +2 -0
- package/src/tests/implement-stamp.test.ts +5 -2
- package/src/tests/profile-flow-hooks.test.ts +15 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +6 -2
- package/src/tests/rfc-verification-verdict-ingest.test.ts +5 -1
- package/src/tests/scaffold-project.test.ts +3 -1
- package/src/tests/upgrade.test.ts +79 -3
- package/src/tests/workspace-discovery.test.ts +4 -3
- package/src/utils/command-inventory.ts +105 -0
- package/src/utils/io.ts +6 -1
- package/src/utils/repo-path.ts +49 -0
- package/src/utils/spawn.ts +88 -0
- package/src/tests/rfc-evidence-sync.test.ts +0 -369
- package/src/tests/skill-agents-sync.test.ts +0 -192
|
@@ -54,6 +54,15 @@ describe("RFC-1500: built-in profiles ship flow hooks (AC-4)", () => {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
// forge validate exits 1 on a profile without artifacts, so such a gate
|
|
58
|
+
// would refuse every integration as soon as forge is installed.
|
|
59
|
+
it("integration-gate.sh runs forge validate only when the profile declares artifacts", () => {
|
|
60
|
+
const gate = files.find((f) => f.path === "hooks/integration-gate.sh");
|
|
61
|
+
expect(gate).toBeDefined();
|
|
62
|
+
const callsValidate = /\bforge validate\b/.test(gate!.content);
|
|
63
|
+
expect(callsValidate && (profile.artifacts ?? []).length === 0).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
57
66
|
for (const hookPath of HOOK_PATHS) {
|
|
58
67
|
it(`${hookPath} starts with #!/bin/sh and parses with sh -n`, async () => {
|
|
59
68
|
const entry = files.find((f) => f.path === hookPath);
|
|
@@ -74,4 +83,10 @@ describe("RFC-1500: built-in profiles ship flow hooks (AC-4)", () => {
|
|
|
74
83
|
}
|
|
75
84
|
});
|
|
76
85
|
}
|
|
86
|
+
|
|
87
|
+
it("the system profile gates integrations on system.map.validate", () => {
|
|
88
|
+
const system = profiles.find((p) => p.id === "system");
|
|
89
|
+
const gate = system?.workspace.files.find((f) => f.path === "hooks/integration-gate.sh");
|
|
90
|
+
expect(gate?.content).toContain("pnpm exec forge system.map.validate");
|
|
91
|
+
});
|
|
77
92
|
});
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-1310: STAMP-GOV-01 fixtures — trailer provenance, injected-item provenance, candidate-set scan, retro-fix remedy, dry-run scan reporting</item>
|
|
11
10
|
<item>RFC-1310: governance-id parity guards on ecosystem.commit and rfc.implement.stamp</item>
|
|
12
11
|
<item>RFC-1321: lowercase --id satisfies an uppercase subject (AC-3)</item>
|
|
13
12
|
<item>RFC-1322: step 4 — --check-criteria resolvable/unresolvable matrix + dry-run residual-unchecked fix</item>
|
|
14
13
|
<item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
|
|
15
14
|
|
|
16
15
|
runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
|
|
16
|
+
<item>RFC-1516: add an evidence-freshness window to the stamp-sync chain for rfc-1516</item>
|
|
17
|
+
<history>RFC-1310</history>
|
|
17
18
|
</CHANGE_SUMMARY>
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -24,7 +25,10 @@ import { tmpdir } from "node:os";
|
|
|
24
25
|
import { execFileSync } from "node:child_process";
|
|
25
26
|
|
|
26
27
|
const { mockRunProbe } = vi.hoisted(() => ({ mockRunProbe: vi.fn() }));
|
|
27
|
-
vi.mock("../../os/rfc/acceptance.ts", () => ({
|
|
28
|
+
vi.mock("../../os/rfc/acceptance.ts", async (importOriginal) => ({
|
|
29
|
+
// RFC-1516: keep classifyProbeReuse (and every non-execution export) real —
|
|
30
|
+
// emit's reuse path calls it when a committed envelope is present.
|
|
31
|
+
...(await importOriginal<typeof import("../../os/rfc/acceptance.ts")>()),
|
|
28
32
|
runProbe: mockRunProbe,
|
|
29
33
|
// RFC-1489: emit (which stamp composes) drives runProbeSet — the shim
|
|
30
34
|
// preserves the per-probe mock contract.
|
|
@@ -15,6 +15,7 @@ criterion, silent no-op when absent.
|
|
|
15
15
|
<item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
|
|
16
16
|
|
|
17
17
|
runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
|
|
18
|
+
<item>RFC-1516: add an evidence-freshness window to the stamp-sync chain for rfc-1516</item>
|
|
18
19
|
</CHANGE_SUMMARY>
|
|
19
20
|
*/
|
|
20
21
|
|
|
@@ -35,7 +36,10 @@ const { mockRunProbe } = vi.hoisted(() => ({
|
|
|
35
36
|
mockRunProbe: vi.fn(),
|
|
36
37
|
}));
|
|
37
38
|
|
|
38
|
-
vi.mock("../../os/rfc/acceptance.ts", () => ({
|
|
39
|
+
vi.mock("../../os/rfc/acceptance.ts", async (importOriginal) => ({
|
|
40
|
+
// RFC-1516: keep classifyProbeReuse (and every non-execution export) real —
|
|
41
|
+
// emit's reuse path calls it when a committed envelope is present.
|
|
42
|
+
...(await importOriginal<typeof import("../../os/rfc/acceptance.ts")>()),
|
|
39
43
|
runProbe: mockRunProbe,
|
|
40
44
|
// RFC-1489: emit drives runProbeSet — the shim preserves the per-probe
|
|
41
45
|
// mock contract so these tests observe the same probe calls as before.
|
|
@@ -49,9 +49,11 @@ beforeEach(async () => {
|
|
|
49
49
|
tempDir = await mkdtemp(join(tmpdir(), "scaffold-test-"));
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
// rm of a scaffolded node_modules is minutes-slow on Windows — the 10s
|
|
53
|
+
// default hook budget cannot hold it.
|
|
52
54
|
afterEach(async () => {
|
|
53
55
|
await rm(tempDir, { recursive: true, force: true });
|
|
54
|
-
});
|
|
56
|
+
}, 180000);
|
|
55
57
|
|
|
56
58
|
test("forge.scaffold tolerates non-empty directory (RFC-0877 in-place mode)", async () => {
|
|
57
59
|
await writeFile(join(tempDir, "some-file.txt"), "hello", "utf8");
|
|
@@ -8,13 +8,14 @@ Unit tests for upgrade covering its documented public contract and regression-se
|
|
|
8
8
|
</non-goals>
|
|
9
9
|
</MODULE_CONTRACT>
|
|
10
10
|
<CHANGE_SUMMARY>
|
|
11
|
-
<item>RFC-0543: initial upgrade handler and VERSION sourcing tests.</item>
|
|
12
11
|
<item>RFC-0552: add test for Forge-vs-pack skill name conflict detection in upgrade.</item>
|
|
13
12
|
<item>RFC-1224: forge.yaml preservation test — consumer keys, comments, and unknown sections survive upgrade rewrites.</item>
|
|
14
13
|
<item>RFC-1224: preserve operator forge.yaml content on upgrade, promote adrImplementStamp binding</item>
|
|
15
14
|
<item>RFC-1481: add knowledge collision resolution and surfacing
|
|
16
15
|
|
|
17
16
|
Add the explicit resolver, namespace-aware parsing and validation, safe reference remapping, doctor/upgrade hints, and regression coverage.</item>
|
|
17
|
+
<item>RFC-1515: harden forge flow worktree lifecycle against vanished paths, forge-local state, dead-holder locks and generated drift</item>
|
|
18
|
+
<history>RFC-0543</history>
|
|
18
19
|
</CHANGE_SUMMARY>
|
|
19
20
|
*/
|
|
20
21
|
|
|
@@ -620,7 +621,7 @@ test("AC-7: forge.upgrade --dry-run reports nestedAgentsPlanned and nestedAgents
|
|
|
620
621
|
expect(
|
|
621
622
|
planned,
|
|
622
623
|
"planned must contain exactly the guides whose merged output differs from disk",
|
|
623
|
-
).toContain(
|
|
624
|
+
).toContain("packages/newpkg/AGENTS.md");
|
|
624
625
|
expect(skipped.some((s) => s.includes("unmapped") && s.includes("unmapped-customization"))).toBe(
|
|
625
626
|
true,
|
|
626
627
|
);
|
|
@@ -646,7 +647,7 @@ test("forge.upgrade executing path reports nestedAgentsPreserved for carried tai
|
|
|
646
647
|
const result = await runUpgrade({ argv: [], flags: {} }, makeContext(tempDir, false));
|
|
647
648
|
|
|
648
649
|
expect(result.data?.status).toBe("pass");
|
|
649
|
-
expect(result.data?.nestedAgentsPreserved).toContain(
|
|
650
|
+
expect(result.data?.nestedAgentsPreserved).toContain("packages/pkg/AGENTS.md");
|
|
650
651
|
const merged = await readFile(join(tempDir, "packages", "pkg", "AGENTS.md"), "utf8");
|
|
651
652
|
expect(merged).toContain("- keep me");
|
|
652
653
|
});
|
|
@@ -714,3 +715,78 @@ test("forge.upgrade preserves project-accumulated knowledge entries (append-only
|
|
|
714
715
|
const report = await readFile(join(tempDir, ".forge", "knowledge-conflicts.txt"), "utf8");
|
|
715
716
|
expect(report).toContain("fo-idea/qa-log.md#K-0001");
|
|
716
717
|
});
|
|
718
|
+
|
|
719
|
+
test("forge.upgrade self-ensures .forge/knowledge-conflicts.txt in .gitignore — idempotent (RFC-1515 AC-5)", async () => {
|
|
720
|
+
await setupForgeSource(tempDir, "0.2.0");
|
|
721
|
+
await writeFile(
|
|
722
|
+
join(tempDir, "packages", "forge", "skills", "fo", "fo-idea", "SKILL.md"),
|
|
723
|
+
"---\nname: fo-idea\nknowledge: [qa-log.md]\n---\n# fo-idea\n",
|
|
724
|
+
"utf8",
|
|
725
|
+
);
|
|
726
|
+
await writeFile(
|
|
727
|
+
join(tempDir, "packages", "forge", "skills", "fo", "fo-idea", "qa-log.md"),
|
|
728
|
+
qaLog([
|
|
729
|
+
{ id: "K-0001", title: "First", body: "Package body." },
|
|
730
|
+
{ id: "K-0003", title: "Third", body: "New package entry." },
|
|
731
|
+
]),
|
|
732
|
+
"utf8",
|
|
733
|
+
);
|
|
734
|
+
await setupConsumerForgeYaml(tempDir, null);
|
|
735
|
+
await mkdir(join(tempDir, ".agents", "skills", "fo-idea"), { recursive: true });
|
|
736
|
+
await writeFile(
|
|
737
|
+
join(tempDir, ".agents", "skills", "fo-idea", "qa-log.md"),
|
|
738
|
+
qaLog([
|
|
739
|
+
{ id: "K-0001", title: "First", body: "Locally edited body." },
|
|
740
|
+
{ id: "K-0002", title: "Local record", body: "Project-accumulated entry." },
|
|
741
|
+
]),
|
|
742
|
+
"utf8",
|
|
743
|
+
);
|
|
744
|
+
// Pre-seed .gitignore with the entry already present — the ensure must not duplicate it.
|
|
745
|
+
await writeFile(join(tempDir, ".gitignore"), "node_modules/\n.forge/knowledge-conflicts.txt\n");
|
|
746
|
+
|
|
747
|
+
const result = await runUpgrade({ argv: [], flags: {} }, makeContext(tempDir, false));
|
|
748
|
+
|
|
749
|
+
expect(result.data?.status).toBe("pass");
|
|
750
|
+
expect(result.data?.knowledgeConflictsReport).toBe(".forge/knowledge-conflicts.txt");
|
|
751
|
+
const gitignore = await readFile(join(tempDir, ".gitignore"), "utf8");
|
|
752
|
+
const occurrences = gitignore
|
|
753
|
+
.split("\n")
|
|
754
|
+
.filter((l) => l.trim() === ".forge/knowledge-conflicts.txt");
|
|
755
|
+
expect(occurrences).toHaveLength(1);
|
|
756
|
+
expect(gitignore).toContain("node_modules/");
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
test("forge.upgrade creates .gitignore for the conflicts report when none exists (RFC-1515 AC-5)", async () => {
|
|
760
|
+
await setupForgeSource(tempDir, "0.2.0");
|
|
761
|
+
await writeFile(
|
|
762
|
+
join(tempDir, "packages", "forge", "skills", "fo", "fo-idea", "SKILL.md"),
|
|
763
|
+
"---\nname: fo-idea\nknowledge: [qa-log.md]\n---\n# fo-idea\n",
|
|
764
|
+
"utf8",
|
|
765
|
+
);
|
|
766
|
+
await writeFile(
|
|
767
|
+
join(tempDir, "packages", "forge", "skills", "fo", "fo-idea", "qa-log.md"),
|
|
768
|
+
qaLog([
|
|
769
|
+
{ id: "K-0001", title: "First", body: "Package body." },
|
|
770
|
+
{ id: "K-0003", title: "Third", body: "New package entry." },
|
|
771
|
+
]),
|
|
772
|
+
"utf8",
|
|
773
|
+
);
|
|
774
|
+
await setupConsumerForgeYaml(tempDir, null);
|
|
775
|
+
await mkdir(join(tempDir, ".agents", "skills", "fo-idea"), { recursive: true });
|
|
776
|
+
await writeFile(
|
|
777
|
+
join(tempDir, ".agents", "skills", "fo-idea", "qa-log.md"),
|
|
778
|
+
qaLog([
|
|
779
|
+
{ id: "K-0001", title: "First", body: "Locally edited body." },
|
|
780
|
+
{ id: "K-0002", title: "Local record", body: "Project-accumulated entry." },
|
|
781
|
+
]),
|
|
782
|
+
"utf8",
|
|
783
|
+
);
|
|
784
|
+
|
|
785
|
+
const result = await runUpgrade({ argv: [], flags: {} }, makeContext(tempDir, false));
|
|
786
|
+
|
|
787
|
+
expect(result.data?.status).toBe("pass");
|
|
788
|
+
const gitignore = await readFile(join(tempDir, ".gitignore"), "utf8");
|
|
789
|
+
expect(gitignore.split("\n").map((l) => l.trim())).toContain(
|
|
790
|
+
".forge/knowledge-conflicts.txt",
|
|
791
|
+
);
|
|
792
|
+
});
|
|
@@ -130,11 +130,12 @@ test("discoverWorkspaces honors extraSkipDirs for consumer artifact dirs", async
|
|
|
130
130
|
await writeFile(join(tempDir, "packages", "real-pkg", "package.json"), "{}");
|
|
131
131
|
|
|
132
132
|
const without = discoverWorkspaces(tempDir);
|
|
133
|
-
|
|
133
|
+
// ws.path is a repo-relative logical path — forward slashes on all platforms.
|
|
134
|
+
expect(without.map((w) => w.path)).toContain("builds/out");
|
|
134
135
|
|
|
135
136
|
const withSkip = discoverWorkspaces(tempDir, undefined, ["builds"]);
|
|
136
|
-
expect(withSkip.map((w) => w.path)).not.toContain(
|
|
137
|
-
expect(withSkip.map((w) => w.path)).toContain(
|
|
137
|
+
expect(withSkip.map((w) => w.path)).not.toContain("builds/out");
|
|
138
|
+
expect(withSkip.map((w) => w.path)).toContain("packages/real-pkg");
|
|
138
139
|
});
|
|
139
140
|
|
|
140
141
|
test("discoverWorkspaces detects generated AGENTS.md", async () => {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Live command inventory — union of the runtime commandRegistry and
|
|
4
|
+
docs/command-manifest.generated.yaml (the getLiveCommands precedent from
|
|
5
|
+
os/rfc/handlers/lifecycle.ts, widened to full reads/writes/flags entries for
|
|
6
|
+
RFC-1528's owner-discovery and resolvability consumers). Required because
|
|
7
|
+
werkstatt run injects no commandRegistry and lazy-loaded modules are invisible
|
|
8
|
+
to it — a registry-only read silently disables any consumer on the primary
|
|
9
|
+
dispatch path (RFC-1518 r1, deviation D-001).</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No kernel or engine imports — portable src-layer helper.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1528: initial — loadManifestCommandEntries + loadLiveCommandInventory (review F-1 fix).</item>
|
|
16
|
+
<item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { readFileSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { parse as parseYaml } from "yaml";
|
|
23
|
+
import type { CommandRegistry, ForgeRegisteredCommandInfo } from "../types.ts";
|
|
24
|
+
|
|
25
|
+
export interface ManifestCommandEntry {
|
|
26
|
+
name: string;
|
|
27
|
+
module?: string;
|
|
28
|
+
siteScope?: boolean;
|
|
29
|
+
reads?: string[];
|
|
30
|
+
writes?: string[];
|
|
31
|
+
generates?: Array<{
|
|
32
|
+
path: string;
|
|
33
|
+
phase?: string;
|
|
34
|
+
conditional?: boolean;
|
|
35
|
+
markerPolicy?: string;
|
|
36
|
+
volatile?: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
flags?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const MANIFEST_RELATIVE_PATH = join("docs", "command-manifest.generated.yaml");
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Parse the generated command manifest into registered-command-shaped
|
|
45
|
+
* entries. Absent or unparsable manifest → empty list (registry still wins).
|
|
46
|
+
*/
|
|
47
|
+
export function loadManifestCommandEntries(workspaceRoot: string): ForgeRegisteredCommandInfo[] {
|
|
48
|
+
try {
|
|
49
|
+
const raw = readFileSync(join(workspaceRoot, MANIFEST_RELATIVE_PATH), "utf8");
|
|
50
|
+
const parsed = parseYaml(raw) as { commands?: ManifestCommandEntry[] } | null;
|
|
51
|
+
const entries: ForgeRegisteredCommandInfo[] = [];
|
|
52
|
+
for (const c of parsed?.commands ?? []) {
|
|
53
|
+
if (typeof c?.name !== "string" || c.name.length === 0) continue;
|
|
54
|
+
entries.push({
|
|
55
|
+
name: c.name,
|
|
56
|
+
provider: "workspace",
|
|
57
|
+
description: "",
|
|
58
|
+
scope: "workspace",
|
|
59
|
+
...(c.module !== undefined ? { module: c.module } : {}),
|
|
60
|
+
...(c.reads !== undefined ? { reads: c.reads } : {}),
|
|
61
|
+
...(c.writes !== undefined ? { writes: c.writes } : {}),
|
|
62
|
+
...(c.generates !== undefined
|
|
63
|
+
? {
|
|
64
|
+
generates: c.generates.map((g) => ({
|
|
65
|
+
path: g.path,
|
|
66
|
+
phase: (g.phase ?? "on-demand") as "on-demand",
|
|
67
|
+
})),
|
|
68
|
+
}
|
|
69
|
+
: {}),
|
|
70
|
+
flags: (c.flags ?? {}) as ForgeRegisteredCommandInfo["flags"],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return entries;
|
|
74
|
+
} catch {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Union runtime registry with the generated manifest — the D-001 merge.
|
|
81
|
+
* Registry entries win on collision; manifest entries cover commands whose
|
|
82
|
+
* modules are not loaded in the current dispatch.
|
|
83
|
+
*/
|
|
84
|
+
export function loadLiveCommandInventory(
|
|
85
|
+
workspaceRoot: string,
|
|
86
|
+
commandRegistry?: CommandRegistry,
|
|
87
|
+
): ForgeRegisteredCommandInfo[] {
|
|
88
|
+
const byName = new Map<string, ForgeRegisteredCommandInfo>();
|
|
89
|
+
for (const entry of loadManifestCommandEntries(workspaceRoot)) {
|
|
90
|
+
byName.set(entry.name, entry);
|
|
91
|
+
}
|
|
92
|
+
for (const entry of commandRegistry?.listCommands() ?? []) {
|
|
93
|
+
const prev = byName.get(entry.name);
|
|
94
|
+
byName.set(entry.name, {
|
|
95
|
+
...prev,
|
|
96
|
+
...entry,
|
|
97
|
+
module: entry.module ?? prev?.module,
|
|
98
|
+
reads: entry.reads ?? prev?.reads,
|
|
99
|
+
writes: entry.writes ?? prev?.writes,
|
|
100
|
+
generates: entry.generates ?? prev?.generates,
|
|
101
|
+
flags: entry.flags ?? prev?.flags,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return [...byName.values()];
|
|
105
|
+
}
|
package/src/utils/io.ts
CHANGED
|
@@ -36,12 +36,17 @@ import { spawn } from "node:child_process";
|
|
|
36
36
|
import { dirname } from "node:path";
|
|
37
37
|
import type { ExecOptions, ExecResult, WorkspaceIO } from "../types.ts";
|
|
38
38
|
import { writeFileAtomic } from "./fs-atomic.ts";
|
|
39
|
+
import { resolveSpawnPlan } from "./spawn.ts";
|
|
39
40
|
|
|
40
41
|
async function execImpl(command: string, args: string[], opts?: ExecOptions): Promise<ExecResult> {
|
|
41
42
|
return new Promise((resolve, reject) => {
|
|
42
|
-
|
|
43
|
+
// Bare names (pnpm/npm/sh) need PATHEXT resolution on Windows — .cmd
|
|
44
|
+
// shims route through cmd.exe; unresolved names keep ENOENT semantics.
|
|
45
|
+
const plan = resolveSpawnPlan(command, args);
|
|
46
|
+
const child = spawn(plan.command, plan.args, {
|
|
43
47
|
cwd: opts?.cwd,
|
|
44
48
|
env: opts?.env ? { ...process.env, ...opts.env } : undefined,
|
|
49
|
+
windowsVerbatimArguments: plan.verbatim,
|
|
45
50
|
});
|
|
46
51
|
let stdout = "";
|
|
47
52
|
let stderr = "";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Canonical directory spelling for cross-frame path comparison. Git answers
|
|
5
|
+
path queries (`worktree list`, `rev-parse`) in its own resolved frame —
|
|
6
|
+
forward slashes and the on-disk long name — while Node-side callers often
|
|
7
|
+
carry the user's raw path, which on Windows may be an 8.3 alias or differ
|
|
8
|
+
in casing. String math between the two frames silently produces `..`
|
|
9
|
+
escapes instead of matches; canonicalRepoDir normalizes a directory to the
|
|
10
|
+
native real path so comparisons mean what they look like.
|
|
11
|
+
</purpose>
|
|
12
|
+
<non-goals>
|
|
13
|
+
<item>Not a symlink policy — callers that must NOT resolve symlinks keep plain path.resolve.</item>
|
|
14
|
+
</non-goals>
|
|
15
|
+
</MODULE_CONTRACT>
|
|
16
|
+
<KEY_DECISIONS>
|
|
17
|
+
<item>realpathSync.native resolves 8.3 aliases and on-disk casing; on failure the input passes through so degrade paths stay inspectable.</item>
|
|
18
|
+
<item>The `\\?\` extended-length prefix native realpath returns on Windows is stripped — plain path.relative/join math still applies to the result.</item>
|
|
19
|
+
</KEY_DECISIONS>
|
|
20
|
+
<CHANGE_SUMMARY>
|
|
21
|
+
<item>T-0007: promoted from os/compass git-revision so os/flow worktree/registry helpers share one canonicalization.</item>
|
|
22
|
+
</CHANGE_SUMMARY>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { realpathSync } from "./sync-fs.ts";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Canonical directory form for cross-source path comparisons. On Windows a
|
|
29
|
+
* tempdir may arrive as an 8.3 alias (`...\RUNNER~1\...`) while git reports
|
|
30
|
+
* the long form from `--show-toplevel` — string math between the two frames
|
|
31
|
+
* silently produces `..` escapes instead of matches. The native realpath
|
|
32
|
+
* resolves aliases and on-disk casing; the `\\?\` extended-length prefix it
|
|
33
|
+
* returns there is stripped so plain path.relative math still applies.
|
|
34
|
+
*/
|
|
35
|
+
export function canonicalRepoDir(dir: string): string {
|
|
36
|
+
let real: string;
|
|
37
|
+
try {
|
|
38
|
+
real = realpathSync.native(dir);
|
|
39
|
+
} catch {
|
|
40
|
+
try {
|
|
41
|
+
real = realpathSync(dir);
|
|
42
|
+
} catch {
|
|
43
|
+
return dir;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (real.startsWith("\\\\?\\UNC\\")) return `\\\\${real.slice(8)}`;
|
|
47
|
+
if (real.startsWith("\\\\?\\")) return real.slice(4);
|
|
48
|
+
return real;
|
|
49
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Portable command resolution for spawn seams. Node's spawn cannot exec a
|
|
5
|
+
bare package-manager name on Windows — pnpm/npm/yarn/bun ship as `*.cmd`
|
|
6
|
+
PATHEXT shims, and CreateProcess never consults PATHEXT the way cmd.exe
|
|
7
|
+
does. resolveSpawnable scans PATH × PATHEXT to find the real executable;
|
|
8
|
+
resolveSpawnPlan wraps a resolved .cmd/.bat in `cmd.exe /d /s /c` because
|
|
9
|
+
Node refuses to spawn batch files without a shell since the CVE-2024-27980
|
|
10
|
+
hardening. Unresolvable names return the original argv untouched so a
|
|
11
|
+
missing tool still surfaces as spawn ENOENT — callers that map ENOENT to
|
|
12
|
+
"unavailable" keep their contract.
|
|
13
|
+
</purpose>
|
|
14
|
+
<non-goals>
|
|
15
|
+
<item>Does not resolve scripts inside node_modules/.bin — those are POSIX sh shims, callers exec them via `sh` explicitly.</item>
|
|
16
|
+
</non-goals>
|
|
17
|
+
</MODULE_CONTRACT>
|
|
18
|
+
<KEY_DECISIONS>
|
|
19
|
+
<item>Resolution is upfront, not retry-on-ENOENT — a retry via cmd would turn a genuinely missing binary into exit 9009 and silently change "unavailable" verdicts into refusals.</item>
|
|
20
|
+
<item>Paths and extension-bearing names pass through unresolved — CreateProcess handles them directly on every platform.</item>
|
|
21
|
+
</KEY_DECISIONS>
|
|
22
|
+
<CHANGE_SUMMARY>
|
|
23
|
+
<item>T-0007: Windows forge-tests remediation — one PATH+PATHEXT resolver shared by the ambient exec adapter, the proof runner, and the probe batcher.</item>
|
|
24
|
+
</CHANGE_SUMMARY>
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { existsSync } from "./sync-fs.ts";
|
|
28
|
+
import { delimiter, join } from "node:path";
|
|
29
|
+
|
|
30
|
+
const IS_WIN = process.platform === "win32";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a bare command name through Windows PATH × PATHEXT (the search
|
|
34
|
+
* cmd.exe performs and CreateProcess does not). Returns the command
|
|
35
|
+
* unchanged when it already names a path (contains a separator or an
|
|
36
|
+
* extension) or when the platform is not Windows. Returns `null` when a
|
|
37
|
+
* bare name resolves to nothing — the caller keeps the original argv so
|
|
38
|
+
* the spawn still reports ENOENT.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveSpawnable(command: string): string | null {
|
|
41
|
+
if (!IS_WIN) return command;
|
|
42
|
+
if (/[/\\]/.test(command) || /\.[a-zA-Z0-9]+$/.test(command)) return command;
|
|
43
|
+
const pathext = (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";");
|
|
44
|
+
for (const rawDir of (process.env.PATH ?? "").split(delimiter)) {
|
|
45
|
+
const dir = rawDir.replace(/^"|"$/g, "");
|
|
46
|
+
if (!dir) continue;
|
|
47
|
+
for (const ext of pathext) {
|
|
48
|
+
const candidate = join(dir, `${command}${ext}`);
|
|
49
|
+
if (existsSync(candidate)) return candidate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface SpawnPlan {
|
|
56
|
+
command: string;
|
|
57
|
+
args: string[];
|
|
58
|
+
/** Pass through to spawn's windowsVerbatimArguments — args are pre-quoted. */
|
|
59
|
+
verbatim: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** cmd.exe-safe quoting: only needed when whitespace or shell metachars appear. */
|
|
63
|
+
function quoteCmdArg(arg: string): string {
|
|
64
|
+
if (!/[\s"&|<>^()%!]/.test(arg)) return arg;
|
|
65
|
+
// Trailing backslashes doubled so they cannot escape the closing quote;
|
|
66
|
+
// inner quotes are backslash-escaped (MSVCRT convention the .cmd inherits).
|
|
67
|
+
const inner = arg.replace(/(\\)+$/, "$1$1").replace(/"/g, '\\"');
|
|
68
|
+
return `"${inner}"`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Build the spawn pair for `command` + `args`. A bare name resolved to a
|
|
73
|
+
* .cmd/.bat shim is re-routed through `cmd.exe /d /s /c` with the args
|
|
74
|
+
* pre-quoted (windowsVerbatimArguments must be set on the spawn so Node
|
|
75
|
+
* does not re-mangle the quoting). Everything else spawns directly.
|
|
76
|
+
*/
|
|
77
|
+
export function resolveSpawnPlan(command: string, args: string[]): SpawnPlan {
|
|
78
|
+
const resolved = resolveSpawnable(command);
|
|
79
|
+
if (resolved === null) return { command, args, verbatim: false };
|
|
80
|
+
if (IS_WIN && /\.(cmd|bat)$/i.test(resolved)) {
|
|
81
|
+
return {
|
|
82
|
+
command: process.env.COMSPEC ?? "cmd.exe",
|
|
83
|
+
args: ["/d", "/s", "/c", quoteCmdArg(resolved), ...args.map(quoteCmdArg)],
|
|
84
|
+
verbatim: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { command: resolved, args, verbatim: false };
|
|
88
|
+
}
|