@warpgogol/forge 9.3.1 → 9.4.1
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 +40 -0
- package/README.md +6 -4
- package/README.uk.md +10 -8
- 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 +51 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -0
- package/dist/os/flow/dirty-classify.js +83 -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 +110 -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 +75 -38
- 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 +54 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +614 -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-peers.d.ts +24 -0
- package/dist/os/flow/handlers/flow-peers.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-peers.js +99 -0
- package/dist/os/flow/handlers/flow-peers.js.map +1 -0
- 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 +3 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +7 -2
- 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/ops-registry.d.ts +33 -0
- package/dist/os/flow/ops-registry.d.ts.map +1 -0
- package/dist/os/flow/ops-registry.js +177 -0
- package/dist/os/flow/ops-registry.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +157 -0
- package/dist/os/flow/preflight.d.ts.map +1 -0
- package/dist/os/flow/preflight.js +772 -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 +8 -2
- 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/standalone-invoke.d.ts +11 -0
- package/dist/os/flow/standalone-invoke.d.ts.map +1 -0
- package/dist/os/flow/standalone-invoke.js +75 -0
- package/dist/os/flow/standalone-invoke.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/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +12 -8
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/importer-block.d.ts +19 -0
- package/dist/os/mission/importer-block.d.ts.map +1 -0
- package/dist/os/mission/importer-block.js +124 -0
- package/dist/os/mission/importer-block.js.map +1 -0
- package/dist/os/mission/lockfile.d.ts +17 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -1
- package/dist/os/mission/lockfile.js +38 -0
- package/dist/os/mission/lockfile.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 +107 -10
- 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 +42 -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-collect.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-collect.js +11 -5
- package/dist/os/system/handlers/system-task-collect.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/prettierignore.d.ts.map +1 -1
- package/dist/src/onboarding/prettierignore.js +2 -0
- package/dist/src/onboarding/prettierignore.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 +120 -0
- package/os/flow/flow.module.ts +119 -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 +124 -56
- 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 +933 -180
- package/os/flow/handlers/flow-open.ts +135 -11
- package/os/flow/handlers/flow-peers.ts +142 -0
- package/os/flow/handlers/flow-status.ts +45 -13
- package/os/flow/index.ts +8 -2
- package/os/flow/line-version.ts +2 -1
- package/os/flow/locks.ts +56 -14
- package/os/flow/ops-registry.ts +194 -0
- package/os/flow/preflight.ts +974 -0
- package/os/flow/publish.ts +200 -5
- package/os/flow/registry.ts +43 -7
- package/os/flow/scripts.ts +13 -2
- package/os/flow/session-checkout.ts +186 -0
- package/os/flow/standalone-invoke.ts +85 -0
- package/os/flow/tests/dirty-classify.test.ts +251 -0
- package/os/flow/tests/fixtures/branch-names.yaml +40 -40
- package/os/flow/tests/flow-cut.test.ts +21 -0
- 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 +565 -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 +698 -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/ops-registry.test.ts +136 -0
- package/os/flow/tests/scripts.test.ts +5 -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/handlers/archive.ts +22 -14
- package/os/mission/importer-block.ts +119 -0
- package/os/mission/lockfile.ts +41 -0
- 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 +126 -0
- package/os/rfc/handlers/list-create.ts +130 -10
- 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 +31 -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-collect.ts +11 -5
- 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-collect.test.ts +16 -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/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 +45 -13
- 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/prettierignore.ts +2 -0
- 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/prettierignore-manage.test.ts +11 -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
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Prove RFC-1539 package consumers: consumer.package runs the installed validator bin, never self-skips, and forge.conformance.validate enforces CONF-07/08/09.</purpose>
|
|
4
|
+
<non-goals><item>Do not re-test the RFC-1365 root-form legs (conformance.test.ts owns them).</item></non-goals>
|
|
5
|
+
</MODULE_CONTRACT>
|
|
6
|
+
<CHANGE_SUMMARY>
|
|
7
|
+
<item>RFC-1539: package consumer tests</item>
|
|
8
|
+
<item>RFC-1539: package-sourced specs and published consumer validators in Forge</item>
|
|
9
|
+
<item>RFC-1539: amend dna-55 and dna-115 for published spec packages
|
|
10
|
+
|
|
11
|
+
Guides, fo-spec-ingest routing, command descriptions and regenerated command docs, remediation entries for SPEC-15..18 and CONF-07..09; resyncs the stale .agents fo-system-dispatch mirror (ADR-0126 source line).</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
16
|
+
import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import {
|
|
20
|
+
runProducerConformance,
|
|
21
|
+
type ContractProducerDecl,
|
|
22
|
+
} from "../../../../src/conformance/index.ts";
|
|
23
|
+
import { runConformanceValidate } from "../conformance-validate.ts";
|
|
24
|
+
import type { ForgeRuntimeContext } from "../../../../src/types.ts";
|
|
25
|
+
|
|
26
|
+
const NODE = process.execPath;
|
|
27
|
+
const PKG = "@acme/intake-validator";
|
|
28
|
+
const EMIT = `require("node:fs").writeFileSync(require("node:path").join(process.argv[1],"bundle.txt"),"x")`;
|
|
29
|
+
|
|
30
|
+
let ws: string;
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
ws = mkdtempSync(join(tmpdir(), "conformance-pkg-"));
|
|
33
|
+
});
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
rmSync(ws, { recursive: true, force: true });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function ctx(): ForgeRuntimeContext {
|
|
39
|
+
const noop = () => {};
|
|
40
|
+
return {
|
|
41
|
+
workspaceRoot: ws,
|
|
42
|
+
dryRun: false,
|
|
43
|
+
outputFormat: "json",
|
|
44
|
+
logger: { section: noop, info: noop, warn: noop, error: noop, success: noop },
|
|
45
|
+
} as ForgeRuntimeContext;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Install a fake validator package with an `intake-validate` bin that exits `code` when bundle.txt exists. */
|
|
49
|
+
function installValidator(opts: { conformanceValidator?: boolean; bin?: boolean } = {}): void {
|
|
50
|
+
const dir = join(ws, "node_modules", ...PKG.split("/"));
|
|
51
|
+
mkdirSync(dir, { recursive: true });
|
|
52
|
+
writeFileSync(
|
|
53
|
+
join(dir, "package.json"),
|
|
54
|
+
JSON.stringify({
|
|
55
|
+
name: PKG,
|
|
56
|
+
version: "1.0.0",
|
|
57
|
+
...(opts.conformanceValidator ? { forge: { conformanceValidator: true } } : {}),
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
if (opts.bin === false) return;
|
|
61
|
+
const binDir = join(ws, "node_modules", ".bin");
|
|
62
|
+
mkdirSync(binDir, { recursive: true });
|
|
63
|
+
const bin = join(binDir, "intake-validate");
|
|
64
|
+
writeFileSync(
|
|
65
|
+
bin,
|
|
66
|
+
`#!/bin/sh\nexec "${NODE}" -e 'const f=require("node:path").join(process.argv.at(-1),"bundle.txt");process.exit(require("node:fs").existsSync(f)?0:4)' -- "$2"\n`,
|
|
67
|
+
);
|
|
68
|
+
chmodSync(bin, 0o755);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function rootManifest(devDependencies: Record<string, string>): void {
|
|
72
|
+
writeFileSync(
|
|
73
|
+
join(ws, "package.json"),
|
|
74
|
+
JSON.stringify({ name: "producer", private: true, devDependencies }),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function packageDecl(): ContractProducerDecl {
|
|
79
|
+
return {
|
|
80
|
+
id: "intake",
|
|
81
|
+
emit: { argv: [NODE, "-e", EMIT, "{bundle}"] },
|
|
82
|
+
consumer: { package: PKG, validator: { argv: ["intake-validate", "--bundle", "{bundle}"] } },
|
|
83
|
+
test: "conformance.test.ts",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function writeForgeYaml(consumerYaml: string): void {
|
|
88
|
+
writeFileSync(
|
|
89
|
+
join(ws, "forge.yaml"),
|
|
90
|
+
`schema: forge/config@1
|
|
91
|
+
project:
|
|
92
|
+
name: producer
|
|
93
|
+
paths: {}
|
|
94
|
+
contractProducers:
|
|
95
|
+
- id: intake
|
|
96
|
+
emit:
|
|
97
|
+
argv: ["${NODE}", "-e", "1", "{bundle}"]
|
|
98
|
+
consumer:
|
|
99
|
+
${consumerYaml}
|
|
100
|
+
validator:
|
|
101
|
+
argv: ["intake-validate", "--bundle", "{bundle}"]
|
|
102
|
+
test: conformance.test.ts
|
|
103
|
+
`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
describe("runProducerConformance — consumer.package (RFC-1539)", () => {
|
|
108
|
+
it("AC-10: runs the installed validator bin and passes", async () => {
|
|
109
|
+
installValidator();
|
|
110
|
+
const verdict = await runProducerConformance(packageDecl(), { repoRoot: ws });
|
|
111
|
+
expect(verdict.status).toBe("pass");
|
|
112
|
+
expect(verdict.legs.map((l) => [l.leg, l.status])).toEqual([
|
|
113
|
+
["emit", "pass"],
|
|
114
|
+
["consumer", "pass"],
|
|
115
|
+
]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("a failing validator fails the consumer leg", async () => {
|
|
119
|
+
installValidator();
|
|
120
|
+
const d = packageDecl();
|
|
121
|
+
d.emit = {
|
|
122
|
+
argv: [
|
|
123
|
+
NODE,
|
|
124
|
+
"-e",
|
|
125
|
+
`require("node:fs").writeFileSync(require("node:path").join(process.argv[1],"other.txt"),"x")`,
|
|
126
|
+
"{bundle}",
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
const verdict = await runProducerConformance(d, { repoRoot: ws });
|
|
130
|
+
expect(verdict).toMatchObject({ status: "fail", failedLeg: "consumer" });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("AC-11: an absent package fails and never reports skipped", async () => {
|
|
134
|
+
const verdict = await runProducerConformance(packageDecl(), { repoRoot: ws });
|
|
135
|
+
expect(verdict.status).toBe("fail");
|
|
136
|
+
expect(verdict.failedLeg).toBe("consumer");
|
|
137
|
+
expect(verdict.legs.some((l) => l.status === "skip")).toBe(false);
|
|
138
|
+
expect(verdict.diagnostics.join(" ")).toContain("never self-skips");
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe("forge.conformance.validate — CONF-07/08/09 (RFC-1539)", () => {
|
|
143
|
+
const codes = async () =>
|
|
144
|
+
(
|
|
145
|
+
(await runConformanceValidate({ argv: [], flags: {} }, ctx())).data as {
|
|
146
|
+
diagnostics: { ruleId: string; severity: string }[];
|
|
147
|
+
}
|
|
148
|
+
).diagnostics;
|
|
149
|
+
|
|
150
|
+
it("AC-12: CONF-07 fails a range-pinned consumer package", async () => {
|
|
151
|
+
installValidator();
|
|
152
|
+
rootManifest({ [PKG]: "^1.0.0" });
|
|
153
|
+
writeForgeYaml(` package: "${PKG}"`);
|
|
154
|
+
expect(await codes()).toContainEqual(
|
|
155
|
+
expect.objectContaining({ ruleId: "CONF-07", severity: "error" }),
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("an exact pin with an installed bin raises neither CONF-07 nor CONF-08", async () => {
|
|
160
|
+
installValidator();
|
|
161
|
+
rootManifest({ [PKG]: "1.0.0" });
|
|
162
|
+
writeForgeYaml(` package: "${PKG}"`);
|
|
163
|
+
const ids = (await codes()).map((d) => d.ruleId);
|
|
164
|
+
expect(ids).not.toContain("CONF-07");
|
|
165
|
+
expect(ids).not.toContain("CONF-08");
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("AC-13: CONF-08 fails an uninstalled package", async () => {
|
|
169
|
+
rootManifest({ [PKG]: "1.0.0" });
|
|
170
|
+
writeForgeYaml(` package: "${PKG}"`);
|
|
171
|
+
expect(await codes()).toContainEqual(
|
|
172
|
+
expect.objectContaining({ ruleId: "CONF-08", severity: "error" }),
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("AC-13: CONF-08 fails an installed package without the argv[0] bin", async () => {
|
|
177
|
+
installValidator({ bin: false });
|
|
178
|
+
rootManifest({ [PKG]: "1.0.0" });
|
|
179
|
+
writeForgeYaml(` package: "${PKG}"`);
|
|
180
|
+
expect(await codes()).toContainEqual(expect.objectContaining({ ruleId: "CONF-08" }));
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("AC-14: CONF-09 warns on consumer.root while a published conformance validator is installed", async () => {
|
|
184
|
+
installValidator({ conformanceValidator: true });
|
|
185
|
+
rootManifest({ [PKG]: "1.0.0" });
|
|
186
|
+
mkdirSync(join(ws, "consumer"));
|
|
187
|
+
writeForgeYaml(` root: ./consumer`);
|
|
188
|
+
expect(await codes()).toContainEqual(
|
|
189
|
+
expect.objectContaining({ ruleId: "CONF-09", severity: "warning" }),
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it("no CONF-09 for consumer.root without a published validator", async () => {
|
|
194
|
+
installValidator();
|
|
195
|
+
rootManifest({ [PKG]: "1.0.0" });
|
|
196
|
+
mkdirSync(join(ws, "consumer"));
|
|
197
|
+
writeForgeYaml(` root: ./consumer`);
|
|
198
|
+
expect((await codes()).map((d) => d.ruleId)).not.toContain("CONF-09");
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>docs.archive owner-regeneration (RFC-1528) — collect the generated artifacts
|
|
4
|
+
invalidated by archive moves and re-invoke their owner commands through
|
|
5
|
+
context.invoke. Owner selection is registry-driven: a command owns a generated
|
|
6
|
+
artifact when it declares it via generates[].path, or via a writes[] entry that
|
|
7
|
+
resolves to a generated file (marker, .generated. infix, or command:/generatedAt:
|
|
8
|
+
header convention — index.yaml/ecosystem.generated.yaml carry no GENERATED_MARKER
|
|
9
|
+
line). Manifest-generation logic itself is never duplicated here.</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No generation logic — owners are invoked by name through the kernel port.</item>
|
|
12
|
+
<item>Standalone forge CLI has no invoke port — degrade with a note, never block.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1528: docs.archive regenerates invalidated generated artifacts
|
|
17
|
+
|
|
18
|
+
After moves, invoke owner commands whose reads[] match a moved path via context.invoke (manifest generator last); report regenerated paths; degrade with a note without a kernel host.</item>
|
|
19
|
+
<item>RFC-1528: extract dry-run regen gate for AC-6 evidence
|
|
20
|
+
|
|
21
|
+
shouldRunArchiveRegen makes the report-only contract a tested unit instead of an inline closure check.</item>
|
|
22
|
+
<item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
|
|
23
|
+
<item>F-0126: tighten owner predicate — generates[] or all-generated writes[]; required flags must be REGEN_FLAGS-covered; excluded[] diagnostics</item>
|
|
24
|
+
<item>RFC-1528: exclude non-generator commands from docs.archive owner regen (F-0126)</item>
|
|
25
|
+
<item>RFC-1535: stageMovedPairs — self-staging helper for move pairs (F-0038)</item>
|
|
26
|
+
<history>RFC-1528</history>
|
|
27
|
+
</CHANGE_SUMMARY>
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
31
|
+
import path from "node:path";
|
|
32
|
+
import picomatch from "picomatch";
|
|
33
|
+
import { hasGeneratedMarker } from "../../src/utils/generated-marker.ts";
|
|
34
|
+
import { loadLiveCommandInventory } from "../../src/utils/command-inventory.ts";
|
|
35
|
+
import type {
|
|
36
|
+
ExecResult,
|
|
37
|
+
ForgeFlagValue,
|
|
38
|
+
ForgeRegisteredCommandInfo,
|
|
39
|
+
ForgeRuntimeContext,
|
|
40
|
+
} from "../../src/types.ts";
|
|
41
|
+
|
|
42
|
+
/** Per-owner flag overrides — generator commands that persist only under a flag. */
|
|
43
|
+
export const REGEN_FLAGS: Record<string, Record<string, ForgeFlagValue>> = {
|
|
44
|
+
"rfc.index.generate": { write: true },
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Ordering contract: ecosystem.manifest.generate hashes the other generated
|
|
49
|
+
* artifacts, so it always runs last among the invalidated owners.
|
|
50
|
+
*/
|
|
51
|
+
const MANIFEST_GENERATOR = "ecosystem.manifest.generate";
|
|
52
|
+
|
|
53
|
+
/** The invoking command can never be its own regen owner. */
|
|
54
|
+
const SELF_COMMAND = "docs.archive";
|
|
55
|
+
|
|
56
|
+
export interface ArchiveRegenCandidate {
|
|
57
|
+
command: string;
|
|
58
|
+
flags: Record<string, ForgeFlagValue>;
|
|
59
|
+
artifactPaths: string[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ArchiveRegenOutcome {
|
|
63
|
+
/** Workspace-relative paths owner invokes reported as modified. */
|
|
64
|
+
regenerated: string[];
|
|
65
|
+
/** Owner commands invoked. */
|
|
66
|
+
invoked: string[];
|
|
67
|
+
/** Candidate owners skipped because context.invoke is absent. */
|
|
68
|
+
skipped: string[];
|
|
69
|
+
/** Per-owner failures — reported, never fatal to the archive run. */
|
|
70
|
+
failures: Array<{ command: string; error: string }>;
|
|
71
|
+
/** Reads-matched commands excluded from ownership (F-0126 diagnostics). */
|
|
72
|
+
excluded: Array<{ command: string; reason: RegenExcludeReason }>;
|
|
73
|
+
/** Why regen did not invoke, when it did not invoke at all. */
|
|
74
|
+
skipReason: "no-invoke" | "no-inventory" | null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Generated-by-name: the `.generated.` infix convention (ecosystem.generated.yaml). */
|
|
78
|
+
export function isGeneratedPathName(relPath: string): boolean {
|
|
79
|
+
return path.basename(relPath).includes(".generated.");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generated-by-content: GENERATED_MARKER/EDITABLE_GENERATED_MARKER, or the
|
|
84
|
+
* self-describing YAML header (`command:` + `generatedAt:`) emitted by the
|
|
85
|
+
* manifest family of generators (docs/rfcs/index.yaml carries no marker line).
|
|
86
|
+
*/
|
|
87
|
+
export function isGeneratedContent(content: string): boolean {
|
|
88
|
+
if (hasGeneratedMarker(content)) return true;
|
|
89
|
+
const head = content
|
|
90
|
+
.split("\n")
|
|
91
|
+
.filter((line) => line.trim().length > 0)
|
|
92
|
+
.slice(0, 10);
|
|
93
|
+
return (
|
|
94
|
+
head.some((line) => /^command:\s*\S/.test(line)) &&
|
|
95
|
+
head.some((line) => /^generatedAt:/.test(line))
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Workspace-backed probe for declared writes[] paths. */
|
|
100
|
+
export function generatedPathProbe(workspaceRoot: string): (relPath: string) => boolean {
|
|
101
|
+
return (relPath) => {
|
|
102
|
+
if (isGeneratedPathName(relPath)) return true;
|
|
103
|
+
if (relPath.includes("*")) return false;
|
|
104
|
+
const abs = path.join(workspaceRoot, relPath);
|
|
105
|
+
if (!existsSync(abs)) return false;
|
|
106
|
+
try {
|
|
107
|
+
return isGeneratedContent(readFileSync(abs, "utf8"));
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Why a reads-matched command was excluded from owner selection (F-0126). */
|
|
115
|
+
export type RegenExcludeReason = "mixed-writes" | "required-flags";
|
|
116
|
+
|
|
117
|
+
export interface ArchiveRegenSelection {
|
|
118
|
+
candidates: ArchiveRegenCandidate[];
|
|
119
|
+
/**
|
|
120
|
+
* Commands whose reads[] intersected a moved path but that cannot act as
|
|
121
|
+
* regen owners — diagnostics only, never invoked.
|
|
122
|
+
*/
|
|
123
|
+
excluded: Array<{ command: string; reason: RegenExcludeReason }>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Pure selection: owners whose declared generated artifacts are invalidated by
|
|
128
|
+
* the moved paths — i.e. the command reads at least one glob matching a moved
|
|
129
|
+
* from/to path. Order: registry order with ecosystem.manifest.generate last.
|
|
130
|
+
*
|
|
131
|
+
* F-0126 ownership contract: a mutator that emits generated side-artifacts
|
|
132
|
+
* among hand-authored writes (e.g. rfc.implement.stamp writing verification
|
|
133
|
+
* envelopes alongside docs/rfcs/**\/*.md) is not a regen owner — ownership
|
|
134
|
+
* requires an explicit generates[] declaration or a fully generated writes[]
|
|
135
|
+
* surface. Batch regen invokes owners bare, so any required flag not covered
|
|
136
|
+
* by REGEN_FLAGS excludes the command outright.
|
|
137
|
+
*/
|
|
138
|
+
export function collectInvalidatedGenerators(
|
|
139
|
+
movedPaths: string[],
|
|
140
|
+
commands: ForgeRegisteredCommandInfo[],
|
|
141
|
+
isGeneratedPath: (relPath: string) => boolean,
|
|
142
|
+
): ArchiveRegenSelection {
|
|
143
|
+
const candidates: ArchiveRegenCandidate[] = [];
|
|
144
|
+
const excluded: ArchiveRegenSelection["excluded"] = [];
|
|
145
|
+
for (const command of commands) {
|
|
146
|
+
if (command.name === SELF_COMMAND) continue;
|
|
147
|
+
const writes = command.writes ?? [];
|
|
148
|
+
const generatedWrites = writes.filter((w) => isGeneratedPath(w));
|
|
149
|
+
const declared = (command.generates ?? []).map((g) => g.path);
|
|
150
|
+
if (declared.length === 0 && generatedWrites.length === 0) continue;
|
|
151
|
+
const reads = command.reads ?? [];
|
|
152
|
+
const invalidated = movedPaths.some((moved) =>
|
|
153
|
+
reads.some((glob) => picomatch.isMatch(moved, glob)),
|
|
154
|
+
);
|
|
155
|
+
if (!invalidated) continue;
|
|
156
|
+
if (declared.length === 0 && generatedWrites.length !== writes.length) {
|
|
157
|
+
excluded.push({ command: command.name, reason: "mixed-writes" });
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const flags = REGEN_FLAGS[command.name] ?? {};
|
|
161
|
+
const uncoveredRequired = Object.entries(command.flags ?? {}).some(
|
|
162
|
+
([flagName, spec]) => spec?.required === true && !(flagName in flags),
|
|
163
|
+
);
|
|
164
|
+
if (uncoveredRequired) {
|
|
165
|
+
excluded.push({ command: command.name, reason: "required-flags" });
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
candidates.push({
|
|
169
|
+
command: command.name,
|
|
170
|
+
flags,
|
|
171
|
+
artifactPaths: [...declared, ...generatedWrites],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
candidates: candidates.sort((a, b) => {
|
|
176
|
+
if (a.command === MANIFEST_GENERATOR) return 1;
|
|
177
|
+
if (b.command === MANIFEST_GENERATOR) return -1;
|
|
178
|
+
return 0;
|
|
179
|
+
}),
|
|
180
|
+
excluded,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* AC-6 gate: owner regeneration fires only on a real run that moved files —
|
|
186
|
+
* a `--dry-run` docs.archive is report-only and never invokes generators.
|
|
187
|
+
*/
|
|
188
|
+
export function shouldRunArchiveRegen(dryRun: boolean, totalMoved: number): boolean {
|
|
189
|
+
return !dryRun && totalMoved > 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Invoke seam: run each invalidated owner through context.invoke. Absent invoke
|
|
194
|
+
* (standalone forge CLI) → all candidates skipped with a note, never a crash.
|
|
195
|
+
*/
|
|
196
|
+
export async function runArchiveRegen(options: {
|
|
197
|
+
movedPaths: string[];
|
|
198
|
+
context: ForgeRuntimeContext;
|
|
199
|
+
isGeneratedPath?: (relPath: string) => boolean;
|
|
200
|
+
/** Test seam — overrides the live inventory union (registry + command manifest). */
|
|
201
|
+
commands?: ForgeRegisteredCommandInfo[];
|
|
202
|
+
}): Promise<ArchiveRegenOutcome> {
|
|
203
|
+
const { movedPaths, context } = options;
|
|
204
|
+
const commands =
|
|
205
|
+
options.commands ?? loadLiveCommandInventory(context.workspaceRoot, context.commandRegistry);
|
|
206
|
+
const probe = options.isGeneratedPath ?? generatedPathProbe(context.workspaceRoot);
|
|
207
|
+
const { candidates, excluded } = collectInvalidatedGenerators(movedPaths, commands, probe);
|
|
208
|
+
const outcome: ArchiveRegenOutcome = {
|
|
209
|
+
regenerated: [],
|
|
210
|
+
invoked: [],
|
|
211
|
+
skipped: [],
|
|
212
|
+
failures: [],
|
|
213
|
+
excluded,
|
|
214
|
+
skipReason: null,
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
if (!context.invoke || commands.length === 0) {
|
|
218
|
+
outcome.skipped = candidates.map((c) => c.command);
|
|
219
|
+
outcome.skipReason = !context.invoke ? "no-invoke" : "no-inventory";
|
|
220
|
+
return outcome;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
for (const candidate of candidates) {
|
|
224
|
+
try {
|
|
225
|
+
const result = await context.invoke(candidate.command, candidate.flags);
|
|
226
|
+
if (result.ok === false || (result.exitCode !== undefined && result.exitCode !== 0)) {
|
|
227
|
+
outcome.failures.push({
|
|
228
|
+
command: candidate.command,
|
|
229
|
+
error: result.summary ?? `exit code ${result.exitCode}`,
|
|
230
|
+
});
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
outcome.invoked.push(candidate.command);
|
|
234
|
+
// Prefer the child's reported writes; fall back to the invalidated
|
|
235
|
+
// declared paths so `regenerated` always names what refreshed (AC-7).
|
|
236
|
+
const reported =
|
|
237
|
+
result.filesModified && result.filesModified.length > 0
|
|
238
|
+
? result.filesModified
|
|
239
|
+
: candidate.artifactPaths.filter((p) => !p.includes("*"));
|
|
240
|
+
for (const modified of reported) {
|
|
241
|
+
if (!outcome.regenerated.includes(modified)) outcome.regenerated.push(modified);
|
|
242
|
+
}
|
|
243
|
+
} catch (error) {
|
|
244
|
+
outcome.failures.push({
|
|
245
|
+
command: candidate.command,
|
|
246
|
+
error: error instanceof Error ? error.message : String(error),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return outcome;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* RFC-1535 (F-0038): self-staging — every moved pair lands BOTH sides in the
|
|
255
|
+
* index (destination add + source delete) so the next commit captures the
|
|
256
|
+
* move as one unit instead of a split add/delete across two commits.
|
|
257
|
+
* `git add -A` on the union of moved from/to paths covers both sides; a
|
|
258
|
+
* non-git or already-clean tree degrades to a warn-only outcome — the
|
|
259
|
+
* commit-side EC-31 check is the safety net for any half-staged survivor.
|
|
260
|
+
*/
|
|
261
|
+
export async function stageMovedPairs(options: {
|
|
262
|
+
movedPaths: string[];
|
|
263
|
+
workspaceRoot: string;
|
|
264
|
+
exec: (command: string, args: string[], opts?: { cwd?: string }) => Promise<ExecResult>;
|
|
265
|
+
}): Promise<{ staged: number; error?: string }> {
|
|
266
|
+
const { movedPaths, workspaceRoot, exec } = options;
|
|
267
|
+
if (movedPaths.length === 0) return { staged: 0 };
|
|
268
|
+
try {
|
|
269
|
+
const result = await exec("git", ["add", "-A", "--", ...movedPaths], {
|
|
270
|
+
cwd: workspaceRoot,
|
|
271
|
+
});
|
|
272
|
+
if (result.exitCode !== 0) {
|
|
273
|
+
return { staged: 0, error: result.stderr || `git add exit ${result.exitCode}` };
|
|
274
|
+
}
|
|
275
|
+
return { staged: movedPaths.length };
|
|
276
|
+
} catch (error) {
|
|
277
|
+
return { staged: 0, error: error instanceof Error ? error.message : String(error) };
|
|
278
|
+
}
|
|
279
|
+
}
|