Standalone implementation of the stash → ff → pop pipeline used by the upcoming mergeAdvanceAutoSync merger hook. Returns a discriminated union (clean-pull | stash-pull-pop | stash-pop-conflict | skipped-dirty | skipped-not-on-branch | failed) and emits structured audit events via an optional callback. The dashboard's user-triggered Pull keeps using the existing /api/git/pull integration path; smartPull stays free of AI conflict resolution so the merger's post-advance auto-sync is safe to run inline without escalating to a model call. Backstopped by smart-pull.slow.test.ts (engine-slow lane): clean-pull, stash-pull-pop, ff-only skip, off-branch skip, audit-emitter exception tolerance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
974 B
@fusion/engine
| @fusion/engine |
|---|
| minor |
feat(engine): export smartPull() library for stash-aware fast-forward of a worktree
Standalone stash → fast-forward → pop implementation that the merger's upcoming mergeAdvanceAutoSync hook calls after advancing the integration-branch ref to auto-sync other worktrees still pinned at the previous tip. Returns a discriminated union (clean-pull | stash-pull-pop | stash-pop-conflict | skipped-dirty | skipped-not-on-branch | failed) and accepts an optional audit emitter so callers can record pull:fast-forward, stash:push, stash:pop, and stash:pop-conflict run-audit events.
The dashboard's user-triggered Pull continues to use the existing POST /api/git/pull integration path (which runs the AI-aware autostash through restoreUnrelatedRootDirChanges) and is unchanged by this changeset — smartPull() is intentionally simpler so the merger's post-advance auto-sync stays free of mid-merge AI conflict resolution.