@lumenflow/core 4.23.0 → 5.0.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/dist/arg-parser.d.ts.map +1 -1
- package/dist/arg-parser.js +16 -0
- package/dist/arg-parser.js.map +1 -1
- package/dist/atomic-merge.d.ts.map +1 -1
- package/dist/atomic-merge.js +25 -18
- package/dist/atomic-merge.js.map +1 -1
- package/dist/client-ids.d.ts +1 -15
- package/dist/client-ids.d.ts.map +1 -1
- package/dist/client-ids.js +4 -13
- package/dist/client-ids.js.map +1 -1
- package/dist/code-path-validator.d.ts.map +1 -1
- package/dist/code-path-validator.js +6 -3
- package/dist/code-path-validator.js.map +1 -1
- package/dist/config-contract.d.ts +1 -30
- package/dist/config-contract.d.ts.map +1 -1
- package/dist/config-contract.js +4 -60
- package/dist/config-contract.js.map +1 -1
- package/dist/constants/backlog-patterns.d.ts +1 -20
- package/dist/constants/backlog-patterns.d.ts.map +1 -1
- package/dist/constants/backlog-patterns.js +2 -23
- package/dist/constants/backlog-patterns.js.map +1 -1
- package/dist/constants/dora-constants.d.ts +19 -2
- package/dist/constants/dora-constants.d.ts.map +1 -1
- package/dist/constants/dora-constants.js +20 -2
- package/dist/constants/dora-constants.js.map +1 -1
- package/dist/constants/duration-constants.d.ts +1 -28
- package/dist/constants/duration-constants.d.ts.map +1 -1
- package/dist/constants/duration-constants.js +4 -28
- package/dist/constants/duration-constants.js.map +1 -1
- package/dist/constants/gate-constants.d.ts +1 -23
- package/dist/constants/gate-constants.d.ts.map +1 -1
- package/dist/constants/gate-constants.js +4 -23
- package/dist/constants/gate-constants.js.map +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/lock-constants.d.ts +1 -28
- package/dist/constants/lock-constants.d.ts.map +1 -1
- package/dist/constants/lock-constants.js +2 -28
- package/dist/constants/lock-constants.js.map +1 -1
- package/dist/core/tool.schemas.d.ts +11 -11
- package/dist/core/worktree-guard.js +2 -2
- package/dist/core/worktree-guard.js.map +1 -1
- package/dist/cycle-detector.d.ts +4 -48
- package/dist/cycle-detector.d.ts.map +1 -1
- package/dist/cycle-detector.js +4 -78
- package/dist/cycle-detector.js.map +1 -1
- package/dist/date-utils.d.ts +1 -65
- package/dist/date-utils.d.ts.map +1 -1
- package/dist/date-utils.js +4 -140
- package/dist/date-utils.js.map +1 -1
- package/dist/delegation-monitor.d.ts +2 -0
- package/dist/delegation-monitor.d.ts.map +1 -1
- package/dist/delegation-monitor.js +29 -2
- package/dist/delegation-monitor.js.map +1 -1
- package/dist/delegation-recovery.d.ts +36 -17
- package/dist/delegation-recovery.d.ts.map +1 -1
- package/dist/delegation-recovery.js +285 -82
- package/dist/delegation-recovery.js.map +1 -1
- package/dist/delegation-registry-schema.d.ts +257 -31
- package/dist/delegation-registry-schema.d.ts.map +1 -1
- package/dist/delegation-registry-schema.js +43 -34
- package/dist/delegation-registry-schema.js.map +1 -1
- package/dist/delegation-registry-store.d.ts +4 -128
- package/dist/delegation-registry-store.d.ts.map +1 -1
- package/dist/delegation-registry-store.js +39 -178
- package/dist/delegation-registry-store.js.map +1 -1
- package/dist/delegation-tree.d.ts +12 -20
- package/dist/delegation-tree.d.ts.map +1 -1
- package/dist/delegation-tree.js +40 -29
- package/dist/delegation-tree.js.map +1 -1
- package/dist/delivery-review-contract.d.ts +1 -1
- package/dist/delivery-review-contract.d.ts.map +1 -1
- package/dist/docs-layout-presets.d.ts +1 -30
- package/dist/docs-layout-presets.d.ts.map +1 -1
- package/dist/docs-layout-presets.js +4 -38
- package/dist/docs-layout-presets.js.map +1 -1
- package/dist/domain/context.schemas.d.ts +3 -3
- package/dist/domain/orchestration.constants.d.ts +1 -110
- package/dist/domain/orchestration.constants.d.ts.map +1 -1
- package/dist/domain/orchestration.constants.js +2 -127
- package/dist/domain/orchestration.constants.js.map +1 -1
- package/dist/domain/orchestration.schemas.d.ts +1 -306
- package/dist/domain/orchestration.schemas.d.ts.map +1 -1
- package/dist/domain/orchestration.schemas.js +2 -211
- package/dist/domain/orchestration.schemas.js.map +1 -1
- package/dist/domain/orchestration.types.d.ts +1 -133
- package/dist/domain/orchestration.types.d.ts.map +1 -1
- package/dist/domain/orchestration.types.js +2 -2
- package/dist/domain/orchestration.types.js.map +1 -1
- package/dist/domain/recovery.schemas.d.ts +3 -3
- package/dist/domain/validation.schemas.d.ts +4 -4
- package/dist/error-handler.d.ts +4 -173
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +4 -244
- package/dist/error-handler.js.map +1 -1
- package/dist/file-classifiers.d.ts.map +1 -1
- package/dist/file-classifiers.js +26 -0
- package/dist/file-classifiers.js.map +1 -1
- package/dist/git-adapter.d.ts +4 -448
- package/dist/git-adapter.d.ts.map +1 -1
- package/dist/git-adapter.js +4 -772
- package/dist/git-adapter.js.map +1 -1
- package/dist/git-context-extractor.d.ts +4 -98
- package/dist/git-context-extractor.d.ts.map +1 -1
- package/dist/git-context-extractor.js +4 -563
- package/dist/git-context-extractor.js.map +1 -1
- package/dist/git-staged-validator.d.ts +4 -29
- package/dist/git-staged-validator.d.ts.map +1 -1
- package/dist/git-staged-validator.js +4 -46
- package/dist/git-staged-validator.js.map +1 -1
- package/dist/incremental-lint.d.ts.map +1 -1
- package/dist/incremental-lint.js +3 -2
- package/dist/incremental-lint.js.map +1 -1
- package/dist/incremental-test.d.ts +1 -32
- package/dist/incremental-test.d.ts.map +1 -1
- package/dist/incremental-test.js +4 -61
- package/dist/incremental-test.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/integration-target.d.ts +30 -0
- package/dist/integration-target.d.ts.map +1 -0
- package/dist/integration-target.js +51 -0
- package/dist/integration-target.js.map +1 -0
- package/dist/lane-checker.d.ts.map +1 -1
- package/dist/lane-checker.js +8 -0
- package/dist/lane-checker.js.map +1 -1
- package/dist/lumenflow-config-schema.d.ts +73 -29
- package/dist/lumenflow-config-schema.d.ts.map +1 -1
- package/dist/lumenflow-config-schema.js +1 -1
- package/dist/lumenflow-config-schema.js.map +1 -1
- package/dist/lumenflow-config.d.ts +10 -34
- package/dist/lumenflow-config.d.ts.map +1 -1
- package/dist/lumenflow-config.js +32 -142
- package/dist/lumenflow-config.js.map +1 -1
- package/dist/manual-test-validator.d.ts +1 -96
- package/dist/manual-test-validator.d.ts.map +1 -1
- package/dist/manual-test-validator.js +4 -245
- package/dist/manual-test-validator.js.map +1 -1
- package/dist/micro-worktree-shared.d.ts.map +1 -1
- package/dist/micro-worktree-shared.js +10 -9
- package/dist/micro-worktree-shared.js.map +1 -1
- package/dist/micro-worktree.d.ts.map +1 -1
- package/dist/micro-worktree.js +26 -23
- package/dist/micro-worktree.js.map +1 -1
- package/dist/normalize-config-keys.d.ts +1 -10
- package/dist/normalize-config-keys.d.ts.map +1 -1
- package/dist/normalize-config-keys.js +7 -73
- package/dist/normalize-config-keys.js.map +1 -1
- package/dist/object-guards.d.ts +1 -10
- package/dist/object-guards.d.ts.map +1 -1
- package/dist/object-guards.js +7 -20
- package/dist/object-guards.js.map +1 -1
- package/dist/ports/config.ports.d.ts +1 -82
- package/dist/ports/config.ports.d.ts.map +1 -1
- package/dist/ports/config.ports.js +2 -1
- package/dist/ports/config.ports.js.map +1 -1
- package/dist/ports/dashboard-renderer.port.d.ts +1 -112
- package/dist/ports/dashboard-renderer.port.d.ts.map +1 -1
- package/dist/ports/dashboard-renderer.port.js +2 -1
- package/dist/ports/dashboard-renderer.port.js.map +1 -1
- package/dist/ports/git-validator.ports.d.ts +5 -110
- package/dist/ports/git-validator.ports.d.ts.map +1 -1
- package/dist/ports/git-validator.ports.js +8 -1
- package/dist/ports/git-validator.ports.js.map +1 -1
- package/dist/ports/sync-validator.ports.d.ts +1 -51
- package/dist/ports/sync-validator.ports.d.ts.map +1 -1
- package/dist/ports/sync-validator.ports.js +2 -1
- package/dist/ports/sync-validator.ports.js.map +1 -1
- package/dist/ports/wu-helpers.ports.d.ts +1 -156
- package/dist/ports/wu-helpers.ports.d.ts.map +1 -1
- package/dist/ports/wu-helpers.ports.js +2 -1
- package/dist/ports/wu-helpers.ports.js.map +1 -1
- package/dist/ports/wu-state.ports.d.ts +1 -208
- package/dist/ports/wu-state.ports.d.ts.map +1 -1
- package/dist/ports/wu-state.ports.js +2 -1
- package/dist/ports/wu-state.ports.js.map +1 -1
- package/dist/rebase-artifact-cleanup.d.ts.map +1 -1
- package/dist/rebase-artifact-cleanup.js +6 -3
- package/dist/rebase-artifact-cleanup.js.map +1 -1
- package/dist/sandbox-allowlist.d.ts +1 -15
- package/dist/sandbox-allowlist.d.ts.map +1 -1
- package/dist/sandbox-allowlist.js +4 -74
- package/dist/sandbox-allowlist.js.map +1 -1
- package/dist/sandbox-backend-linux.d.ts +1 -5
- package/dist/sandbox-backend-linux.d.ts.map +1 -1
- package/dist/sandbox-backend-linux.js +4 -64
- package/dist/sandbox-backend-linux.js.map +1 -1
- package/dist/sandbox-backend-macos.d.ts +1 -5
- package/dist/sandbox-backend-macos.d.ts.map +1 -1
- package/dist/sandbox-backend-macos.js +4 -109
- package/dist/sandbox-backend-macos.js.map +1 -1
- package/dist/sandbox-backend-windows.d.ts +1 -5
- package/dist/sandbox-backend-windows.d.ts.map +1 -1
- package/dist/sandbox-backend-windows.js +4 -27
- package/dist/sandbox-backend-windows.js.map +1 -1
- package/dist/sandbox-profile.d.ts +1 -57
- package/dist/sandbox-profile.d.ts.map +1 -1
- package/dist/sandbox-profile.js +4 -65
- package/dist/sandbox-profile.js.map +1 -1
- package/dist/schemas/agents-config.d.ts +47 -0
- package/dist/schemas/agents-config.d.ts.map +1 -1
- package/dist/schemas/agents-config.js +59 -0
- package/dist/schemas/agents-config.js.map +1 -1
- package/dist/schemas/command-schemas.d.ts +4 -4
- package/dist/schemas/flow-arg-validators.d.ts +2 -2
- package/dist/schemas/flow-schemas.d.ts +4 -4
- package/dist/schemas/gates-section-config.d.ts +32 -13
- package/dist/schemas/gates-section-config.d.ts.map +1 -1
- package/dist/schemas/gates-section-config.js +16 -1
- package/dist/schemas/gates-section-config.js.map +1 -1
- package/dist/schemas/initiative-arg-validators.d.ts +2 -2
- package/dist/schemas/initiative-schemas.d.ts +12 -12
- package/dist/schemas/lanes-config.d.ts +5 -5
- package/dist/schemas/memory-arg-validators.d.ts +6 -0
- package/dist/schemas/memory-arg-validators.d.ts.map +1 -1
- package/dist/schemas/memory-config.d.ts +4 -4
- package/dist/schemas/memory-schemas.d.ts +12 -0
- package/dist/schemas/memory-schemas.d.ts.map +1 -1
- package/dist/schemas/memory-schemas.js +12 -0
- package/dist/schemas/memory-schemas.js.map +1 -1
- package/dist/schemas/operational-config.d.ts +4 -4
- package/dist/schemas/setup-arg-validators.d.ts +3 -3
- package/dist/schemas/setup-schemas.d.ts +8 -8
- package/dist/schemas/wu-config.d.ts +3 -3
- package/dist/schemas/wu-lifecycle-arg-validators.d.ts +2 -2
- package/dist/schemas/wu-lifecycle-schemas.d.ts +4 -4
- package/dist/section-headings.d.ts +1 -34
- package/dist/section-headings.d.ts.map +1 -1
- package/dist/section-headings.js +2 -51
- package/dist/section-headings.js.map +1 -1
- package/dist/spawn-constraints-generator.js +3 -3
- package/dist/spawn-constraints-generator.js.map +1 -1
- package/dist/spawn-guidance-generators.d.ts +1 -1
- package/dist/spawn-guidance-generators.d.ts.map +1 -1
- package/dist/spawn-policy-resolver.d.ts +1 -1
- package/dist/spawn-policy-resolver.d.ts.map +1 -1
- package/dist/spawn-task-builder.d.ts +17 -1
- package/dist/spawn-task-builder.d.ts.map +1 -1
- package/dist/spawn-task-builder.js +63 -1
- package/dist/spawn-task-builder.js.map +1 -1
- package/dist/spawn-template-assembler.d.ts +1 -1
- package/dist/spawn-template-assembler.d.ts.map +1 -1
- package/dist/state-machine.d.ts +1 -9
- package/dist/state-machine.d.ts.map +1 -1
- package/dist/state-machine.js +2 -86
- package/dist/state-machine.js.map +1 -1
- package/dist/sync-validator.d.ts.map +1 -1
- package/dist/sync-validator.js +15 -12
- package/dist/sync-validator.js.map +1 -1
- package/dist/telemetry.d.ts +20 -6
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +27 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/work-classifier.d.ts +1 -102
- package/dist/work-classifier.d.ts.map +1 -1
- package/dist/work-classifier.js +2 -424
- package/dist/work-classifier.js.map +1 -1
- package/dist/worktree-symlink.d.ts +2 -2
- package/dist/worktree-symlink.d.ts.map +1 -1
- package/dist/worktree-symlink.js +37 -12
- package/dist/worktree-symlink.js.map +1 -1
- package/dist/wu-cli-constants.d.ts +1 -433
- package/dist/wu-cli-constants.d.ts.map +1 -1
- package/dist/wu-cli-constants.js +4 -436
- package/dist/wu-cli-constants.js.map +1 -1
- package/dist/wu-consistency-file-repairs.d.ts.map +1 -1
- package/dist/wu-consistency-file-repairs.js +5 -3
- package/dist/wu-consistency-file-repairs.js.map +1 -1
- package/dist/wu-context-constants.d.ts +22 -0
- package/dist/wu-context-constants.d.ts.map +1 -1
- package/dist/wu-context-constants.js +22 -0
- package/dist/wu-context-constants.js.map +1 -1
- package/dist/wu-doc-types.d.ts +1 -47
- package/dist/wu-doc-types.d.ts.map +1 -1
- package/dist/wu-domain-constants.d.ts +1 -295
- package/dist/wu-domain-constants.d.ts.map +1 -1
- package/dist/wu-domain-constants.js +4 -397
- package/dist/wu-domain-constants.js.map +1 -1
- package/dist/wu-done-branch-only.d.ts +1 -1
- package/dist/wu-done-branch-only.d.ts.map +1 -1
- package/dist/wu-done-branch-only.js +22 -13
- package/dist/wu-done-branch-only.js.map +1 -1
- package/dist/wu-done-branch-utils.d.ts.map +1 -1
- package/dist/wu-done-branch-utils.js +5 -3
- package/dist/wu-done-branch-utils.js.map +1 -1
- package/dist/wu-done-cleanup.d.ts.map +1 -1
- package/dist/wu-done-cleanup.js +66 -22
- package/dist/wu-done-cleanup.js.map +1 -1
- package/dist/wu-done-concurrent-merge.d.ts.map +1 -1
- package/dist/wu-done-concurrent-merge.js +9 -6
- package/dist/wu-done-concurrent-merge.js.map +1 -1
- package/dist/wu-done-errors.d.ts +3 -3
- package/dist/wu-done-errors.d.ts.map +1 -1
- package/dist/wu-done-inputs.d.ts.map +1 -1
- package/dist/wu-done-inputs.js +3 -0
- package/dist/wu-done-inputs.js.map +1 -1
- package/dist/wu-done-merge-phase.d.ts.map +1 -1
- package/dist/wu-done-merge-phase.js +4 -2
- package/dist/wu-done-merge-phase.js.map +1 -1
- package/dist/wu-done-merge.d.ts.map +1 -1
- package/dist/wu-done-merge.js +16 -8
- package/dist/wu-done-merge.js.map +1 -1
- package/dist/wu-done-merged-worktree.d.ts.map +1 -1
- package/dist/wu-done-merged-worktree.js +7 -8
- package/dist/wu-done-merged-worktree.js.map +1 -1
- package/dist/wu-done-messages.d.ts.map +1 -1
- package/dist/wu-done-messages.js +12 -5
- package/dist/wu-done-messages.js.map +1 -1
- package/dist/wu-done-metadata.d.ts.map +1 -1
- package/dist/wu-done-metadata.js +3 -8
- package/dist/wu-done-metadata.js.map +1 -1
- package/dist/wu-done-preflight-checks.d.ts.map +1 -1
- package/dist/wu-done-preflight-checks.js +21 -15
- package/dist/wu-done-preflight-checks.js.map +1 -1
- package/dist/wu-done-rebase.d.ts.map +1 -1
- package/dist/wu-done-rebase.js +10 -8
- package/dist/wu-done-rebase.js.map +1 -1
- package/dist/wu-done-retry-helpers.d.ts.map +1 -1
- package/dist/wu-done-retry-helpers.js +13 -11
- package/dist/wu-done-retry-helpers.js.map +1 -1
- package/dist/wu-done-validation.d.ts.map +1 -1
- package/dist/wu-done-validation.js +4 -2
- package/dist/wu-done-validation.js.map +1 -1
- package/dist/wu-done-worktree-services.d.ts.map +1 -1
- package/dist/wu-done-worktree-services.js +4 -2
- package/dist/wu-done-worktree-services.js.map +1 -1
- package/dist/wu-done-worktree.d.ts.map +1 -1
- package/dist/wu-done-worktree.js +4 -2
- package/dist/wu-done-worktree.js.map +1 -1
- package/dist/wu-git-constants.d.ts +1 -175
- package/dist/wu-git-constants.d.ts.map +1 -1
- package/dist/wu-git-constants.js +4 -175
- package/dist/wu-git-constants.js.map +1 -1
- package/dist/wu-helpers.d.ts +24 -0
- package/dist/wu-helpers.d.ts.map +1 -1
- package/dist/wu-helpers.js +37 -4
- package/dist/wu-helpers.js.map +1 -1
- package/dist/wu-id-format.d.ts +1 -137
- package/dist/wu-id-format.d.ts.map +1 -1
- package/dist/wu-id-format.js +2 -249
- package/dist/wu-id-format.js.map +1 -1
- package/dist/wu-id-generator.d.ts.map +1 -1
- package/dist/wu-id-generator.js +8 -5
- package/dist/wu-id-generator.js.map +1 -1
- package/dist/wu-paths-constants.d.ts +1 -253
- package/dist/wu-paths-constants.d.ts.map +1 -1
- package/dist/wu-paths-constants.js +4 -273
- package/dist/wu-paths-constants.js.map +1 -1
- package/dist/wu-paths.d.ts +1 -274
- package/dist/wu-paths.d.ts.map +1 -1
- package/dist/wu-paths.js +4 -236
- package/dist/wu-paths.js.map +1 -1
- package/dist/wu-rules-resolvers.d.ts.map +1 -1
- package/dist/wu-rules-resolvers.js +11 -6
- package/dist/wu-rules-resolvers.js.map +1 -1
- package/dist/wu-schema.d.ts +1 -830
- package/dist/wu-schema.d.ts.map +1 -1
- package/dist/wu-schema.js +4 -929
- package/dist/wu-schema.js.map +1 -1
- package/dist/wu-spawn-helpers.d.ts.map +1 -1
- package/dist/wu-spawn-helpers.js +5 -2
- package/dist/wu-spawn-helpers.js.map +1 -1
- package/dist/wu-spawn.d.ts +2 -2
- package/dist/wu-spawn.d.ts.map +1 -1
- package/dist/wu-spawn.js +2 -2
- package/dist/wu-spawn.js.map +1 -1
- package/dist/wu-state-schema.d.ts +1 -291
- package/dist/wu-state-schema.d.ts.map +1 -1
- package/dist/wu-state-schema.js +4 -212
- package/dist/wu-state-schema.js.map +1 -1
- package/dist/wu-status-transition.d.ts +3 -1
- package/dist/wu-status-transition.d.ts.map +1 -1
- package/dist/wu-status-transition.js +9 -24
- package/dist/wu-status-transition.js.map +1 -1
- package/dist/wu-statuses.d.ts +1 -208
- package/dist/wu-statuses.d.ts.map +1 -1
- package/dist/wu-statuses.js +4 -242
- package/dist/wu-statuses.js.map +1 -1
- package/dist/wu-transaction-collectors.d.ts +1 -0
- package/dist/wu-transaction-collectors.d.ts.map +1 -1
- package/dist/wu-transaction-collectors.js +13 -8
- package/dist/wu-transaction-collectors.js.map +1 -1
- package/dist/wu-type-helpers.d.ts +1 -27
- package/dist/wu-type-helpers.d.ts.map +1 -1
- package/dist/wu-type-helpers.js +4 -46
- package/dist/wu-type-helpers.js.map +1 -1
- package/dist/wu-ui-constants.d.ts +1 -235
- package/dist/wu-ui-constants.d.ts.map +1 -1
- package/dist/wu-ui-constants.js +5 -235
- package/dist/wu-ui-constants.js.map +1 -1
- package/dist/wu-validation-constants.d.ts +1 -60
- package/dist/wu-validation-constants.d.ts.map +1 -1
- package/dist/wu-validation-constants.js +4 -66
- package/dist/wu-validation-constants.js.map +1 -1
- package/dist/wu-yaml.d.ts +1 -112
- package/dist/wu-yaml.d.ts.map +1 -1
- package/dist/wu-yaml.js +4 -304
- package/dist/wu-yaml.js.map +1 -1
- package/package.json +12 -9
- package/dist/coverage-gate.d.ts +0 -128
- package/dist/coverage-gate.d.ts.map +0 -1
- package/dist/coverage-gate.js +0 -211
- package/dist/coverage-gate.js.map +0 -1
- package/dist/gates-agent-mode.d.ts +0 -108
- package/dist/gates-agent-mode.d.ts.map +0 -1
- package/dist/gates-agent-mode.js +0 -138
- package/dist/gates-agent-mode.js.map +0 -1
- package/dist/gates-config-internal.d.ts +0 -54
- package/dist/gates-config-internal.d.ts.map +0 -1
- package/dist/gates-config-internal.js +0 -107
- package/dist/gates-config-internal.js.map +0 -1
- package/dist/gates-config.d.ts +0 -68
- package/dist/gates-config.d.ts.map +0 -1
- package/dist/gates-config.js +0 -193
- package/dist/gates-config.js.map +0 -1
- package/dist/gates-coverage.d.ts +0 -42
- package/dist/gates-coverage.d.ts.map +0 -1
- package/dist/gates-coverage.js +0 -162
- package/dist/gates-coverage.js.map +0 -1
- package/dist/gates-presets.d.ts +0 -52
- package/dist/gates-presets.d.ts.map +0 -1
- package/dist/gates-presets.js +0 -117
- package/dist/gates-presets.js.map +0 -1
- package/dist/gates-schemas.d.ts +0 -143
- package/dist/gates-schemas.d.ts.map +0 -1
- package/dist/gates-schemas.js +0 -67
- package/dist/gates-schemas.js.map +0 -1
- package/dist/package-manager-resolver.d.ts +0 -80
- package/dist/package-manager-resolver.d.ts.map +0 -1
- package/dist/package-manager-resolver.js +0 -245
- package/dist/package-manager-resolver.js.map +0 -1
- package/dist/resolve-policy.d.ts +0 -293
- package/dist/resolve-policy.d.ts.map +0 -1
- package/dist/resolve-policy.js +0 -303
- package/dist/resolve-policy.js.map +0 -1
package/dist/git-adapter.js
CHANGED
|
@@ -1,778 +1,10 @@
|
|
|
1
1
|
// Copyright (c) 2026 Hellmai Ltd
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @description Git operations adapter using simple-git library
|
|
6
|
-
* WU-1082: Extract shared utilities (eliminate run() duplication)
|
|
7
|
-
* WU-1213: Refactor to use simple-git library (eliminate execSync)
|
|
8
|
-
* WU-2242: Add runtime type assertions to prevent silent API misuse
|
|
4
|
+
* Git Adapter — Re-export shim (ADR-012, INIT-058 Layer 4b, WU-2682).
|
|
9
5
|
*
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
* - tools/wu-done.ts
|
|
13
|
-
* - tools/wu-block.ts
|
|
14
|
-
* - tools/wu-unblock.ts
|
|
15
|
-
* - tools/wu-create.ts
|
|
16
|
-
* - tools/wu-cleanup.ts
|
|
17
|
-
* - tools/gates-pre-commit.ts
|
|
18
|
-
* - tools/validate.ts
|
|
19
|
-
* - tools/guard-worktree-commit.ts
|
|
6
|
+
* Moved to `@lumenflow/host/git/git-adapter`. This shim preserves the legacy
|
|
7
|
+
* import path for in-repo consumers until the barrel slim in Layer 7.
|
|
20
8
|
*/
|
|
21
|
-
|
|
22
|
-
import { existsSync, rmSync } from 'node:fs';
|
|
23
|
-
import { GIT_COMMANDS, GIT_FLAGS, GIT_REFS } from './wu-constants.js';
|
|
24
|
-
import { createError, ErrorCodes } from './error-handler.js';
|
|
25
|
-
// WU-2242: Runtime assertion helpers
|
|
26
|
-
/**
|
|
27
|
-
* Assert that a value is a non-empty string
|
|
28
|
-
* @param {*} value - Value to check
|
|
29
|
-
* @param {string} name - Parameter name for error message
|
|
30
|
-
* @throws {TypeError} If value is not a string
|
|
31
|
-
* @throws {Error} If value is an empty string
|
|
32
|
-
*/
|
|
33
|
-
function assertNonEmptyString(value, name) {
|
|
34
|
-
if (typeof value !== 'string') {
|
|
35
|
-
throw new TypeError(`${name} must be a string, got ${typeof value}`);
|
|
36
|
-
}
|
|
37
|
-
if (value === '') {
|
|
38
|
-
throw createError(ErrorCodes.INVALID_ARGUMENT, `${name} must be a non-empty string`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Assert that a value is a string (if provided)
|
|
43
|
-
* @param {*} value - Value to check
|
|
44
|
-
* @param {string} name - Parameter name for error message
|
|
45
|
-
* @throws {TypeError} If value is not a string (and not null/undefined)
|
|
46
|
-
*/
|
|
47
|
-
function assertOptionalString(value, name) {
|
|
48
|
-
if (value !== undefined && value !== null && typeof value !== 'string') {
|
|
49
|
-
throw new TypeError(`${name} must be a string, got ${typeof value}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Assert that a value is a string or array of strings
|
|
54
|
-
* @param {*} value - Value to check
|
|
55
|
-
* @param {string} name - Parameter name for error message
|
|
56
|
-
* @throws {TypeError} If value is not a string or array
|
|
57
|
-
* @throws {Error} If value is empty string or empty array
|
|
58
|
-
*/
|
|
59
|
-
function assertStringOrArray(value, name) {
|
|
60
|
-
if (typeof value === 'string') {
|
|
61
|
-
if (value === '') {
|
|
62
|
-
throw createError(ErrorCodes.INVALID_ARGUMENT, `${name} must be a non-empty string or array`);
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (Array.isArray(value)) {
|
|
67
|
-
if (value.length === 0) {
|
|
68
|
-
throw createError(ErrorCodes.INVALID_ARGUMENT, `${name} must be a non-empty string or array`);
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
throw new TypeError(`${name} must be a string or array, got ${typeof value}`);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Assert that a value is an array
|
|
76
|
-
* @param {*} value - Value to check
|
|
77
|
-
* @param {string} name - Parameter name for error message
|
|
78
|
-
* @throws {TypeError} If value is not an array
|
|
79
|
-
*/
|
|
80
|
-
function assertArray(value, name) {
|
|
81
|
-
if (!Array.isArray(value)) {
|
|
82
|
-
throw new TypeError(`${name} must be an array, got ${typeof value}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Git operations adapter with dependency injection support
|
|
87
|
-
* @class GitAdapter
|
|
88
|
-
*/
|
|
89
|
-
export class GitAdapter {
|
|
90
|
-
git;
|
|
91
|
-
/**
|
|
92
|
-
* Create a GitAdapter instance
|
|
93
|
-
* @param {object} [options] - Configuration options
|
|
94
|
-
* @param {object} [options.git] - simple-git instance (for testing)
|
|
95
|
-
* @param {string} [options.baseDir] - Base directory for git operations
|
|
96
|
-
*/
|
|
97
|
-
constructor(options = {}) {
|
|
98
|
-
this.git = options.git || simpleGit(options.baseDir);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get current branch name
|
|
102
|
-
* @returns {Promise<string>} Current branch name
|
|
103
|
-
* @example
|
|
104
|
-
* await git.getCurrentBranch(); // "lane/operations/wu-1213"
|
|
105
|
-
*/
|
|
106
|
-
async getCurrentBranch() {
|
|
107
|
-
const result = await this.git.revparse([GIT_FLAGS.ABBREV_REF, 'HEAD']);
|
|
108
|
-
return result.trim();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get git status (porcelain format string for compatibility)
|
|
112
|
-
* @returns {Promise<string>} Status output in porcelain format
|
|
113
|
-
* @example
|
|
114
|
-
* await git.getStatus(); // " M file.txt\n?? untracked.txt"
|
|
115
|
-
*/
|
|
116
|
-
async getStatus() {
|
|
117
|
-
const result = await this.git.raw(['status', GIT_FLAGS.PORCELAIN]);
|
|
118
|
-
return result.trim();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Get unpushed commits (compared to upstream)
|
|
122
|
-
* @returns {Promise<string>} Oneline log output for unpushed commits
|
|
123
|
-
* @example
|
|
124
|
-
* await git.getUnpushedCommits(); // "abc123 fix: ...\n"
|
|
125
|
-
*/
|
|
126
|
-
async getUnpushedCommits() {
|
|
127
|
-
const result = await this.git.raw([
|
|
128
|
-
GIT_COMMANDS.LOG,
|
|
129
|
-
GIT_REFS.UPSTREAM_RANGE,
|
|
130
|
-
GIT_FLAGS.ONELINE,
|
|
131
|
-
]);
|
|
132
|
-
return result.trim();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Check if a branch exists
|
|
136
|
-
* @param {string} branch - Branch name
|
|
137
|
-
* @returns {Promise<boolean>} True if branch exists
|
|
138
|
-
* @throws {TypeError} If branch is not a string
|
|
139
|
-
* @throws {Error} If branch is empty
|
|
140
|
-
* @example
|
|
141
|
-
* await git.branchExists('main'); // true
|
|
142
|
-
* await git.branchExists('nonexistent'); // false
|
|
143
|
-
*/
|
|
144
|
-
async branchExists(branch) {
|
|
145
|
-
assertNonEmptyString(branch, 'branch');
|
|
146
|
-
try {
|
|
147
|
-
await this.git.raw(['rev-parse', '--verify', branch]);
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Check if a remote branch exists via git ls-remote --heads
|
|
156
|
-
* @param {string} remote - Remote name (e.g., 'origin')
|
|
157
|
-
* @param {string} branch - Branch name
|
|
158
|
-
* @returns {Promise<boolean>} True if remote branch exists
|
|
159
|
-
* @throws {TypeError} If remote or branch is not a string
|
|
160
|
-
* @throws {Error} If remote or branch is empty
|
|
161
|
-
* @example
|
|
162
|
-
* await git.remoteBranchExists('origin', 'lane/operations/wu-123'); // true/false
|
|
163
|
-
*/
|
|
164
|
-
async remoteBranchExists(remote, branch) {
|
|
165
|
-
assertNonEmptyString(remote, 'remote');
|
|
166
|
-
assertNonEmptyString(branch, 'branch');
|
|
167
|
-
const result = await this.git.raw(['ls-remote', '--heads', remote, branch]);
|
|
168
|
-
return result.trim().length > 0;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Fetch from remote
|
|
172
|
-
* @param {string} [remote] - Remote name (defaults to fetching all)
|
|
173
|
-
* @param {string} [branch] - Branch name
|
|
174
|
-
* @throws {TypeError} If remote or branch is not a string (when provided)
|
|
175
|
-
* @example
|
|
176
|
-
* await git.fetch('origin', 'main');
|
|
177
|
-
* await git.fetch(); // Fetch all remotes
|
|
178
|
-
*/
|
|
179
|
-
async fetch(remote, branch) {
|
|
180
|
-
assertOptionalString(remote, 'remote');
|
|
181
|
-
assertOptionalString(branch, 'branch');
|
|
182
|
-
if (remote && branch) {
|
|
183
|
-
await this.git.fetch(remote, branch);
|
|
184
|
-
}
|
|
185
|
-
else if (remote) {
|
|
186
|
-
await this.git.fetch(remote);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
await this.git.fetch();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Pull from remote branch
|
|
194
|
-
* @param {string} remote - Remote name
|
|
195
|
-
* @param {string} branch - Branch name
|
|
196
|
-
* @throws {TypeError} If remote or branch is not a string
|
|
197
|
-
* @example
|
|
198
|
-
* await git.pull('origin', 'main');
|
|
199
|
-
*/
|
|
200
|
-
async pull(remote, branch) {
|
|
201
|
-
assertNonEmptyString(remote, 'remote');
|
|
202
|
-
assertNonEmptyString(branch, 'branch');
|
|
203
|
-
await this.git.pull(remote, branch);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Get git config value
|
|
207
|
-
* @param {string} key - Config key (e.g., 'user.email')
|
|
208
|
-
* @returns {Promise<string>} Config value
|
|
209
|
-
* @example
|
|
210
|
-
* await git.getConfigValue('user.email'); // "user@example.com"
|
|
211
|
-
*/
|
|
212
|
-
async getConfigValue(key) {
|
|
213
|
-
const result = await this.git.raw(['config', key]);
|
|
214
|
-
return result.trim();
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Check if working tree is clean (no uncommitted changes)
|
|
218
|
-
* @returns {Promise<boolean>} True if clean
|
|
219
|
-
* @example
|
|
220
|
-
* await git.isClean(); // true or false
|
|
221
|
-
*/
|
|
222
|
-
async isClean() {
|
|
223
|
-
const status = await this.getStatus();
|
|
224
|
-
return status === '';
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Add files to staging area
|
|
228
|
-
* @param {string|string[]} files - Files to add
|
|
229
|
-
* @throws {TypeError} If files is not a string or array
|
|
230
|
-
* @throws {Error} If files is empty string or empty array
|
|
231
|
-
* @example
|
|
232
|
-
* await git.add('file.txt');
|
|
233
|
-
* await git.add(['file1.txt', 'file2.txt']);
|
|
234
|
-
* await git.add('.'); // Add all
|
|
235
|
-
*/
|
|
236
|
-
async add(files) {
|
|
237
|
-
assertStringOrArray(files, 'files');
|
|
238
|
-
await this.git.add(files);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Return the subset of supplied paths that are matched by `.gitignore`.
|
|
242
|
-
*
|
|
243
|
-
* WU-2572: Wraps `git check-ignore` (via simple-git's `checkIgnore`). Unlike
|
|
244
|
-
* `check-ignore` on the CLI, which exits non-zero when there are no matches,
|
|
245
|
-
* simple-git's wrapper normalises the result to an array. Returns an empty
|
|
246
|
-
* array when no paths are ignored OR when git reports an error (fail-open —
|
|
247
|
-
* a broken check must not silently drop paths from a downstream stage).
|
|
248
|
-
*
|
|
249
|
-
* @param paths - Candidate paths to test (relative or absolute; git resolves)
|
|
250
|
-
* @returns Array of paths that ARE gitignored
|
|
251
|
-
*/
|
|
252
|
-
async checkIgnore(paths) {
|
|
253
|
-
if (!paths || paths.length === 0) {
|
|
254
|
-
return [];
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
return await this.git.checkIgnore(paths);
|
|
258
|
-
}
|
|
259
|
-
catch {
|
|
260
|
-
return [];
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Add files to staging area including deletions
|
|
265
|
-
*
|
|
266
|
-
* WU-1813: Stages modifications, additions, AND deletions for specified files.
|
|
267
|
-
* Unlike add(), this uses `git add -A` which properly handles tracked file deletions.
|
|
268
|
-
*
|
|
269
|
-
* When files array is empty, stages all changes in the working directory (git add -A .)
|
|
270
|
-
* to catch UnsafeAny deletions that might not have been explicitly listed.
|
|
271
|
-
*
|
|
272
|
-
* WU-2572: Silently filter out gitignored paths before staging. Previously,
|
|
273
|
-
* any consumer whose `.gitignore` covered a file in the stage list (e.g.
|
|
274
|
-
* `LUMENFLOW.local.md` under the File Ownership Model) saw:
|
|
275
|
-
* `The following paths are ignored by one of your .gitignore files: ...`
|
|
276
|
-
* emitted to stderr, and the add then failed — which for the upgrade flow
|
|
277
|
-
* triggered a fallback to the direct-upgrade path. Filtering here makes
|
|
278
|
-
* every micro-worktree staging call gitignore-safe without each caller
|
|
279
|
-
* needing to know which of its paths might be ignored in the consumer
|
|
280
|
-
* repo's .gitignore.
|
|
281
|
-
*
|
|
282
|
-
* @param {string[]} files - Files to add (empty array = add all)
|
|
283
|
-
* @example
|
|
284
|
-
* await git.addWithDeletions(['modified.txt', 'deleted.txt']);
|
|
285
|
-
* await git.addWithDeletions([]); // Add all changes including deletions
|
|
286
|
-
*/
|
|
287
|
-
async addWithDeletions(files) {
|
|
288
|
-
if (files && files.length > 0) {
|
|
289
|
-
// WU-2572: Drop gitignored paths so `git add -A -- <list>` cannot
|
|
290
|
-
// trip on user-owned files (see File Ownership Model). The generic
|
|
291
|
-
// check handles any gitignored path, not just LUMENFLOW.local.md,
|
|
292
|
-
// so future additions to the stage list are covered automatically.
|
|
293
|
-
const ignored = new Set(await this.checkIgnore(files));
|
|
294
|
-
const safe = files.filter((f) => !ignored.has(f));
|
|
295
|
-
if (safe.length === 0) {
|
|
296
|
-
// Every candidate was ignored — nothing to stage. Don't fall
|
|
297
|
-
// through to `git add -A .` (would stage UnsafeAny unrelated
|
|
298
|
-
// tracked changes the caller didn't ask for).
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
// Stage specific files with -A flag to include deletions
|
|
302
|
-
// Using -- separator for safety with paths that might look like flags
|
|
303
|
-
await this.git.raw(['add', '-A', '--', ...safe]);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
// Stage all changes including deletions
|
|
307
|
-
await this.git.raw(['add', '-A', '.']);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Commit changes
|
|
312
|
-
* @param {string} message - Commit message
|
|
313
|
-
* @throws {TypeError} If message is not a string
|
|
314
|
-
* @throws {Error} If message is empty
|
|
315
|
-
* @example
|
|
316
|
-
* await git.commit('feat: add new feature');
|
|
317
|
-
*/
|
|
318
|
-
async commit(message) {
|
|
319
|
-
assertNonEmptyString(message, 'message');
|
|
320
|
-
await this.git.commit(message);
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Push to remote
|
|
324
|
-
* @param {string} [remote='origin'] - Remote name
|
|
325
|
-
* @param {string} [branch] - Branch name (uses current branch if not specified)
|
|
326
|
-
* @param {object} [options] - Push options
|
|
327
|
-
* @param {boolean} [options.setUpstream] - Set upstream tracking (-u flag)
|
|
328
|
-
* @throws {TypeError} If remote or branch is not a string (when provided)
|
|
329
|
-
* @example
|
|
330
|
-
* await git.push('origin', 'main');
|
|
331
|
-
* await git.push('origin', 'feature', { setUpstream: true });
|
|
332
|
-
*/
|
|
333
|
-
async push(remote = 'origin', branch, options = {}) {
|
|
334
|
-
assertOptionalString(remote, 'remote');
|
|
335
|
-
assertOptionalString(branch, 'branch');
|
|
336
|
-
const pushOptions = {};
|
|
337
|
-
if (options.setUpstream) {
|
|
338
|
-
pushOptions[GIT_FLAGS.UPSTREAM] = null;
|
|
339
|
-
}
|
|
340
|
-
await this.git.push(remote, branch, pushOptions);
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Push using refspec to push local ref to different remote ref
|
|
344
|
-
*
|
|
345
|
-
* WU-1435: Enables push-only pattern to keep local main pristine.
|
|
346
|
-
* Pushes directly to origin/main without updating local main.
|
|
347
|
-
*
|
|
348
|
-
* @param {string} remote - Remote name (e.g., 'origin')
|
|
349
|
-
* @param {string} localRef - Local ref to push (e.g., 'tmp/wu-claim/wu-123')
|
|
350
|
-
* @param {string} remoteRef - Remote ref to update (e.g., 'main')
|
|
351
|
-
* @example
|
|
352
|
-
* await git.pushRefspec('origin', 'tmp/wu-claim/wu-123', 'main');
|
|
353
|
-
* // Equivalent to: git push origin tmp/wu-claim/wu-123:main
|
|
354
|
-
*/
|
|
355
|
-
async pushRefspec(remote, localRef, remoteRef) {
|
|
356
|
-
const refspec = `${localRef}:${remoteRef}`;
|
|
357
|
-
await this.git.push(remote, refspec);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Create and checkout a new branch
|
|
361
|
-
* @param {string} branch - Branch name
|
|
362
|
-
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
363
|
-
* @throws {TypeError} If branch is not a string, or startPoint is not a string (when provided)
|
|
364
|
-
* @throws {Error} If branch is empty
|
|
365
|
-
* @example
|
|
366
|
-
* await git.createBranch('feature/new-feature');
|
|
367
|
-
* await git.createBranch('hotfix/bug', 'main');
|
|
368
|
-
*/
|
|
369
|
-
async createBranch(branch, startPoint) {
|
|
370
|
-
assertNonEmptyString(branch, 'branch');
|
|
371
|
-
assertOptionalString(startPoint, 'startPoint');
|
|
372
|
-
const args = [GIT_FLAGS.BRANCH, branch];
|
|
373
|
-
if (startPoint) {
|
|
374
|
-
args.push(startPoint);
|
|
375
|
-
}
|
|
376
|
-
await this.git.checkout(args);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Checkout a branch
|
|
380
|
-
* @param {string} branch - Branch name
|
|
381
|
-
* @throws {TypeError} If branch is not a string
|
|
382
|
-
* @throws {Error} If branch is empty
|
|
383
|
-
* @example
|
|
384
|
-
* await git.checkout('main');
|
|
385
|
-
*/
|
|
386
|
-
async checkout(branch) {
|
|
387
|
-
assertNonEmptyString(branch, 'branch');
|
|
388
|
-
await this.git.checkout(branch);
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Get commit hash
|
|
392
|
-
* @param {string} [ref='HEAD'] - Git ref
|
|
393
|
-
* @returns {Promise<string>} Commit hash
|
|
394
|
-
* @example
|
|
395
|
-
* await git.getCommitHash(); // "a1b2c3d..."
|
|
396
|
-
* await git.getCommitHash('main'); // "e4f5g6h..."
|
|
397
|
-
*/
|
|
398
|
-
async getCommitHash(ref = 'HEAD') {
|
|
399
|
-
const result = await this.git.revparse([ref]);
|
|
400
|
-
return result.trim();
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Merge a branch
|
|
404
|
-
*
|
|
405
|
-
* WU-1749: Bug 1 fix - Return success status and handle false positive failures.
|
|
406
|
-
* simple-git's merge() returns a MergeSummary that we now properly handle.
|
|
407
|
-
*
|
|
408
|
-
* @param {string} branch - Branch to merge
|
|
409
|
-
* @param {object} [options] - Merge options
|
|
410
|
-
* @param {boolean} [options.ffOnly] - Fast-forward only merge
|
|
411
|
-
* @returns {Promise<{success: boolean}>} Merge result
|
|
412
|
-
* @throws {TypeError} If branch is not a string
|
|
413
|
-
* @throws {Error} If branch is empty
|
|
414
|
-
* @example
|
|
415
|
-
* await git.merge('feature-branch');
|
|
416
|
-
* await git.merge('feature-branch', { ffOnly: true });
|
|
417
|
-
*/
|
|
418
|
-
async merge(branch, options = {}) {
|
|
419
|
-
assertNonEmptyString(branch, 'branch');
|
|
420
|
-
const args = [];
|
|
421
|
-
if (options.ffOnly) {
|
|
422
|
-
args.push(GIT_FLAGS.FF_ONLY);
|
|
423
|
-
}
|
|
424
|
-
args.push(branch);
|
|
425
|
-
await this.git.merge(args);
|
|
426
|
-
// If we get here without throwing, merge succeeded
|
|
427
|
-
return { success: true };
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Get commit log
|
|
431
|
-
*
|
|
432
|
-
* WU-1749: Bug 4 fix - Add log() method for counting commits.
|
|
433
|
-
* Used by wu-done-retry-helpers.ts to count previous completion attempts.
|
|
434
|
-
*
|
|
435
|
-
* @param {object} [options] - Log options
|
|
436
|
-
* @param {number} [options.maxCount] - Maximum number of commits to return
|
|
437
|
-
* @returns {Promise<{all: Array<{hash: string, message: string}>, total: number}>} Log result
|
|
438
|
-
* @example
|
|
439
|
-
* await git.log({ maxCount: 50 });
|
|
440
|
-
*/
|
|
441
|
-
async log(options = {}) {
|
|
442
|
-
return await this.git.log(options);
|
|
443
|
-
}
|
|
444
|
-
// New semantic methods for wu- scripts (WU-1213)
|
|
445
|
-
/**
|
|
446
|
-
* Find common ancestor (merge base) of two refs
|
|
447
|
-
* @param {string} ref1 - First ref
|
|
448
|
-
* @param {string} ref2 - Second ref
|
|
449
|
-
* @returns {Promise<string>} Common ancestor commit hash
|
|
450
|
-
* @throws {TypeError} If ref1 or ref2 is not a string
|
|
451
|
-
* @example
|
|
452
|
-
* await git.mergeBase('main', 'feature'); // "abc123def456"
|
|
453
|
-
*/
|
|
454
|
-
async mergeBase(ref1, ref2) {
|
|
455
|
-
assertNonEmptyString(ref1, 'ref1');
|
|
456
|
-
assertNonEmptyString(ref2, 'ref2');
|
|
457
|
-
const result = await this.git.raw(['merge-base', ref1, ref2]);
|
|
458
|
-
return result.trim();
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Simulate merge and detect conflicts without touching working tree
|
|
462
|
-
* @param {string} base - Base commit hash
|
|
463
|
-
* @param {string} ref1 - First ref to merge
|
|
464
|
-
* @param {string} ref2 - Second ref to merge
|
|
465
|
-
* @returns {Promise<string>} Merge tree output (contains conflict markers if conflicts exist)
|
|
466
|
-
* @example
|
|
467
|
-
* await git.mergeTree('base123', 'main', 'feature');
|
|
468
|
-
*/
|
|
469
|
-
async mergeTree(base, ref1, ref2) {
|
|
470
|
-
const result = await this.git.raw(['merge-tree', base, ref1, ref2]);
|
|
471
|
-
return result;
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* List commits with various options
|
|
475
|
-
* @param {string[]} args - Arguments to pass to git rev-list
|
|
476
|
-
* @returns {Promise<string>} Rev-list output
|
|
477
|
-
* @example
|
|
478
|
-
* await git.revList(['--count', '--left-right', 'main...feature']); // "5\t0"
|
|
479
|
-
*/
|
|
480
|
-
async revList(args) {
|
|
481
|
-
const result = await this.git.raw(['rev-list', ...args]);
|
|
482
|
-
return result.trim();
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Add a worktree with new branch
|
|
486
|
-
* @param {string} path - Worktree path
|
|
487
|
-
* @param {string} branch - Branch name
|
|
488
|
-
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
489
|
-
* @throws {TypeError} If path or branch is not a string
|
|
490
|
-
* @throws {Error} If path or branch is empty
|
|
491
|
-
* @example
|
|
492
|
-
* await git.worktreeAdd('worktrees/feature', 'feature-branch', 'main');
|
|
493
|
-
*/
|
|
494
|
-
async worktreeAdd(path, branch, startPoint) {
|
|
495
|
-
assertNonEmptyString(path, 'path');
|
|
496
|
-
assertNonEmptyString(branch, 'branch');
|
|
497
|
-
assertOptionalString(startPoint, 'startPoint');
|
|
498
|
-
const args = ['worktree', 'add', path, GIT_FLAGS.BRANCH, branch];
|
|
499
|
-
if (startPoint) {
|
|
500
|
-
args.push(startPoint);
|
|
501
|
-
}
|
|
502
|
-
await this.git.raw(args);
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Remove a worktree
|
|
506
|
-
*
|
|
507
|
-
* WU-1476: Layer 1 defense - explicit directory cleanup after git worktree remove.
|
|
508
|
-
* Git worktree remove can leave orphan directories when:
|
|
509
|
-
* - The worktree was forcefully removed
|
|
510
|
-
* - Git worktree metadata was corrupted
|
|
511
|
-
* - Previous wu:done failed mid-workflow
|
|
512
|
-
*
|
|
513
|
-
* @param {string} worktreePath - Worktree path
|
|
514
|
-
* @param {object} [options] - Remove options
|
|
515
|
-
* @param {boolean} [options.force] - Force removal
|
|
516
|
-
* @example
|
|
517
|
-
* await git.worktreeRemove('worktrees/feature');
|
|
518
|
-
* await git.worktreeRemove('worktrees/feature', { force: true });
|
|
519
|
-
*/
|
|
520
|
-
async worktreeRemove(worktreePath, options = {}) {
|
|
521
|
-
const args = ['worktree', 'remove'];
|
|
522
|
-
if (options.force) {
|
|
523
|
-
args.push(GIT_FLAGS.FORCE);
|
|
524
|
-
}
|
|
525
|
-
args.push(worktreePath);
|
|
526
|
-
// Attempt git worktree remove
|
|
527
|
-
try {
|
|
528
|
-
await this.git.raw(args);
|
|
529
|
-
}
|
|
530
|
-
catch (err) {
|
|
531
|
-
// If git fails, we still want to clean up the directory
|
|
532
|
-
// Re-throw after cleanup attempt to report the original error
|
|
533
|
-
if (existsSync(worktreePath)) {
|
|
534
|
-
rmSync(worktreePath, { recursive: true, force: true });
|
|
535
|
-
}
|
|
536
|
-
throw err;
|
|
537
|
-
}
|
|
538
|
-
// Layer 1 defense (WU-1476): Explicit cleanup if directory still exists
|
|
539
|
-
// This handles edge cases where git worktree remove succeeds but leaves the directory
|
|
540
|
-
if (existsSync(worktreePath)) {
|
|
541
|
-
try {
|
|
542
|
-
rmSync(worktreePath, { recursive: true, force: true });
|
|
543
|
-
}
|
|
544
|
-
catch (rmErr) {
|
|
545
|
-
// WU-1014: Log but don't throw - git worktree remove succeeded, directory cleanup is best-effort
|
|
546
|
-
console.warn(`[git-adapter] worktreeRemove: git succeeded but directory cleanup failed for ${worktreePath}: ${rmErr instanceof Error ? rmErr.message : String(rmErr)}`);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* List all worktrees
|
|
552
|
-
* @returns {Promise<string>} Worktree list in porcelain format
|
|
553
|
-
* @example
|
|
554
|
-
* await git.worktreeList();
|
|
555
|
-
*/
|
|
556
|
-
async worktreeList() {
|
|
557
|
-
const result = await this.git.raw(['worktree', 'list', GIT_FLAGS.PORCELAIN]);
|
|
558
|
-
return result;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Delete a branch
|
|
562
|
-
* @param {string} branch - Branch name
|
|
563
|
-
* @param {object} [options] - Delete options
|
|
564
|
-
* @param {boolean} [options.force] - Force delete (use -D instead of -d)
|
|
565
|
-
* @throws {TypeError} If branch is not a string
|
|
566
|
-
* @throws {Error} If branch is empty
|
|
567
|
-
* @example
|
|
568
|
-
* await git.deleteBranch('feature');
|
|
569
|
-
* await git.deleteBranch('feature', { force: true });
|
|
570
|
-
*/
|
|
571
|
-
async deleteBranch(branch, options = {}) {
|
|
572
|
-
assertNonEmptyString(branch, 'branch');
|
|
573
|
-
const flag = options.force ? GIT_FLAGS.DELETE_FORCE : GIT_FLAGS.DELETE;
|
|
574
|
-
await this.git.branch([flag, branch]);
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* Create a branch WITHOUT switching to it (WU-1262)
|
|
578
|
-
* Used for micro-worktree pattern where main checkout stays on main
|
|
579
|
-
* @param {string} branch - Branch name to create
|
|
580
|
-
* @param {string} [startPoint] - Starting commit (defaults to HEAD)
|
|
581
|
-
* @example
|
|
582
|
-
* await git.createBranchNoCheckout('tmp/wu-create/wu-123', 'main');
|
|
583
|
-
*/
|
|
584
|
-
async createBranchNoCheckout(branch, startPoint) {
|
|
585
|
-
const args = ['branch', branch];
|
|
586
|
-
if (startPoint) {
|
|
587
|
-
args.push(startPoint);
|
|
588
|
-
}
|
|
589
|
-
await this.git.raw(args);
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Add a worktree for an EXISTING branch (WU-1262)
|
|
593
|
-
* Unlike worktreeAdd, this doesn't create a new branch
|
|
594
|
-
* @param {string} path - Worktree path
|
|
595
|
-
* @param {string} branch - Existing branch name
|
|
596
|
-
* @example
|
|
597
|
-
* await git.worktreeAddExisting('/tmp/wu-create-xyz', 'tmp/wu-create/wu-123');
|
|
598
|
-
*/
|
|
599
|
-
async worktreeAddExisting(path, branch) {
|
|
600
|
-
await this.git.raw(['worktree', 'add', path, branch]);
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Rebase current branch onto target (WU-1262)
|
|
604
|
-
* Used in micro-worktree to rebase temp branch when main moves
|
|
605
|
-
* @param {string} onto - Target ref to rebase onto
|
|
606
|
-
* @throws {TypeError} If onto is not a string
|
|
607
|
-
* @throws {Error} If onto is empty
|
|
608
|
-
* @example
|
|
609
|
-
* await git.rebase('main');
|
|
610
|
-
*/
|
|
611
|
-
async rebase(onto) {
|
|
612
|
-
assertNonEmptyString(onto, 'onto');
|
|
613
|
-
const gitWithEditor = this.git.env({ ...process.env, GIT_EDITOR: 'true' });
|
|
614
|
-
await gitWithEditor.rebase([onto]);
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Reset HEAD to specified commit
|
|
618
|
-
* @param {string} [ref] - Commit ref to reset to (defaults to HEAD)
|
|
619
|
-
* @param {object} [options] - Reset options
|
|
620
|
-
* @param {boolean} [options.hard] - Hard reset (--hard flag)
|
|
621
|
-
* @example
|
|
622
|
-
* await git.reset('abc123', { hard: true });
|
|
623
|
-
*/
|
|
624
|
-
async reset(ref, options = {}) {
|
|
625
|
-
const args = ['reset'];
|
|
626
|
-
if (options.hard) {
|
|
627
|
-
args.push(GIT_FLAGS.HARD);
|
|
628
|
-
}
|
|
629
|
-
if (ref) {
|
|
630
|
-
args.push(ref);
|
|
631
|
-
}
|
|
632
|
-
await this.git.raw(args);
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Execute arbitrary git command via raw()
|
|
636
|
-
* @param {string[]} args - Git command arguments
|
|
637
|
-
* @returns {Promise<string>} Command output
|
|
638
|
-
* @throws {TypeError} If args is not an array
|
|
639
|
-
* @example
|
|
640
|
-
* await git.raw(['status', '--porcelain']);
|
|
641
|
-
*/
|
|
642
|
-
async raw(args) {
|
|
643
|
-
assertArray(args, 'args');
|
|
644
|
-
const result = await this.git.raw(args);
|
|
645
|
-
return result;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* WU-2208: List file/directory names at a given git ref and tree path.
|
|
649
|
-
*
|
|
650
|
-
* Uses `git ls-tree --name-only <ref> <path>/` to enumerate entries.
|
|
651
|
-
* Returns an array of filenames (not full paths) within the directory.
|
|
652
|
-
* Returns empty array if the path does not exist at the given ref.
|
|
653
|
-
*
|
|
654
|
-
* @param ref - Git ref (e.g., 'origin/main')
|
|
655
|
-
* @param path - Directory path relative to repo root
|
|
656
|
-
* @returns Array of filenames in the directory at the given ref
|
|
657
|
-
*/
|
|
658
|
-
async listTreeAtRef(ref, path) {
|
|
659
|
-
assertNonEmptyString(ref, 'ref');
|
|
660
|
-
assertNonEmptyString(path, 'path');
|
|
661
|
-
try {
|
|
662
|
-
// Ensure path ends with / for directory listing
|
|
663
|
-
const dirPath = path.endsWith('/') ? path : `${path}/`;
|
|
664
|
-
const result = await this.git.raw(['ls-tree', '--name-only', ref, dirPath]);
|
|
665
|
-
if (!result || result.trim().length === 0) {
|
|
666
|
-
return [];
|
|
667
|
-
}
|
|
668
|
-
return result
|
|
669
|
-
.trim()
|
|
670
|
-
.split('\n')
|
|
671
|
-
.filter((line) => line.length > 0);
|
|
672
|
-
}
|
|
673
|
-
catch {
|
|
674
|
-
// Path doesn't exist at ref, or ref doesn't exist
|
|
675
|
-
return [];
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* WU-2208: Show a file's content at a given git ref.
|
|
680
|
-
*
|
|
681
|
-
* Uses `git show <ref>:<path>` to retrieve file content.
|
|
682
|
-
* Returns empty string if the file does not exist at the given ref.
|
|
683
|
-
*
|
|
684
|
-
* @param ref - Git ref (e.g., 'origin/main')
|
|
685
|
-
* @param path - File path relative to repo root
|
|
686
|
-
* @returns File content as string, or empty string if not found
|
|
687
|
-
*/
|
|
688
|
-
async showFileAtRef(ref, path) {
|
|
689
|
-
assertNonEmptyString(ref, 'ref');
|
|
690
|
-
assertNonEmptyString(path, 'path');
|
|
691
|
-
try {
|
|
692
|
-
const result = await this.git.raw(['show', `${ref}:${path}`]);
|
|
693
|
-
return result ?? '';
|
|
694
|
-
}
|
|
695
|
-
catch {
|
|
696
|
-
// File doesn't exist at ref
|
|
697
|
-
return '';
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
// Deprecated methods (for backward compatibility during migration)
|
|
701
|
-
/**
|
|
702
|
-
* @deprecated Use async methods directly instead
|
|
703
|
-
* Legacy method for backward compatibility
|
|
704
|
-
* Execute a git command and return trimmed output
|
|
705
|
-
* @param {string} cmd - Command to execute
|
|
706
|
-
* @returns {string} Trimmed command output
|
|
707
|
-
*/
|
|
708
|
-
run(cmd) {
|
|
709
|
-
throw createError(ErrorCodes.DEPRECATED_API, 'GitAdapter.run() is deprecated (WU-1213). Use async methods instead. ' +
|
|
710
|
-
`Attempted to run: ${cmd}`);
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* @deprecated Use worktreeAdd() instead
|
|
714
|
-
*/
|
|
715
|
-
addWorktree(path, branch, startPoint) {
|
|
716
|
-
return this.worktreeAdd(path, branch, startPoint);
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* @deprecated Use worktreeRemove() instead
|
|
720
|
-
*/
|
|
721
|
-
removeWorktree(path, options) {
|
|
722
|
-
return this.worktreeRemove(path, options);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
// WU-1235: Factory functions for explicit directory control
|
|
726
|
-
/**
|
|
727
|
-
* Create a GitAdapter for a specific directory
|
|
728
|
-
* Use this when you need git operations in an explicit path (e.g., worktree vs main)
|
|
729
|
-
* @param {string} baseDir - Directory for git operations
|
|
730
|
-
* @returns {GitAdapter} New GitAdapter instance for the specified directory
|
|
731
|
-
* @example
|
|
732
|
-
* const gitWorktree = createGitForPath('/path/to/worktree');
|
|
733
|
-
* const gitMain = createGitForPath('/path/to/main');
|
|
734
|
-
*/
|
|
735
|
-
export function createGitForPath(baseDir) {
|
|
736
|
-
return new GitAdapter({ baseDir });
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Create a GitAdapter for the current working directory
|
|
740
|
-
* Captures process.cwd() at call time (not import time)
|
|
741
|
-
* Use this after process.chdir() to get an adapter for the new directory
|
|
742
|
-
* @returns {GitAdapter} New GitAdapter instance for current process.cwd()
|
|
743
|
-
* @example
|
|
744
|
-
* process.chdir(worktreePath);
|
|
745
|
-
* const git = getGitForCwd(); // Uses new directory
|
|
746
|
-
*/
|
|
747
|
-
export function getGitForCwd() {
|
|
748
|
-
return new GitAdapter({ baseDir: process.cwd() });
|
|
749
|
-
}
|
|
750
|
-
// Singleton deprecation tracking
|
|
751
|
-
let singletonWarned = false;
|
|
752
|
-
/**
|
|
753
|
-
* Reset singleton warning flag (for testing only)
|
|
754
|
-
* @internal
|
|
755
|
-
*/
|
|
756
|
-
export function _resetSingletonWarning() {
|
|
757
|
-
singletonWarned = false;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* @deprecated Use createGitForPath() or getGitForCwd() instead
|
|
761
|
-
* Singleton GitAdapter instance - captured cwd at module load time
|
|
762
|
-
* WARNING: Does not respect process.chdir() - use factory functions for worktree operations
|
|
763
|
-
* @type {GitAdapter}
|
|
764
|
-
*/
|
|
765
|
-
const gitSingleton = new GitAdapter();
|
|
766
|
-
export const git = new Proxy(gitSingleton, {
|
|
767
|
-
get(target, prop) {
|
|
768
|
-
if (!singletonWarned) {
|
|
769
|
-
console.warn('[DEPRECATED] git singleton captured cwd at import time. ' +
|
|
770
|
-
'Use createGitForPath(path) or getGitForCwd() for explicit directory control.');
|
|
771
|
-
singletonWarned = true;
|
|
772
|
-
}
|
|
773
|
-
const value = target[prop];
|
|
774
|
-
// Bind methods to preserve 'this' context
|
|
775
|
-
return typeof value === 'function' ? value.bind(target) : value;
|
|
776
|
-
},
|
|
777
|
-
});
|
|
9
|
+
export * from '@lumenflow/host/git/git-adapter';
|
|
778
10
|
//# sourceMappingURL=git-adapter.js.map
|