with one click
sync-target
// Merge this branch's target (open PR's base or repo default) into HEAD, resolve conflicts in branch context, push unless held. Use when the user asks to sync, merge main/dev/target into HEAD, or resolve merge conflicts.
// Merge this branch's target (open PR's base or repo default) into HEAD, resolve conflicts in branch context, push unless held. Use when the user asks to sync, merge main/dev/target into HEAD, or resolve merge conflicts.
Shared atom for running quality checks, committing, and pushing. Background knowledge for workflow commands -- not invoked directly.
Full PR workflow -- ticket, branch, verify, lint, test, commit, push, open PR. Use when the user asks to open, ship, or land a PR; handles fresh work, mid-fix state, and changes already verified in the session.
Shared atom for analyzing a diff and writing a structured PR description. Background knowledge for workflow commands -- not invoked directly.
Root-cause-first debugging by tracing expected behavior to the first unintended side effect before changing contracts, parsing, or types. Use when debugging protocol errors, deserialization failures, null payloads, missing fields, restore or hydration issues, state-ownership bugs, unexpected requests, background mutations, or reviewing code where the visible failure may be downstream noise. Also loaded by /implement during bug-fix flows.
Control and navigate a logged-in macOS GUI session with upstream trycua/cua `cua-driver`. Use for macOS app automation, native dialogs, screenshots, UI inspection, clicking, typing, hotkeys, and any task where a Droid needs reliable computer-use control of macOS.
Reference for using linear-cli (aliased as `linear`) to manage Linear.app issues, projects, cycles, and sprints from the terminal. Use when the user mentions Linear tickets, issues, project management, or sprint planning.
| name | sync-target |
| description | Merge this branch's target (open PR's base or repo default) into HEAD, resolve conflicts in branch context, push unless held. Use when the user asks to sync, merge main/dev/target into HEAD, or resolve merge conflicts. |
Load skills: pr-context, quality-ship, git-advanced. (worktree-setup is lazy โ see ยง5.)
Target = where this branch lands. Precedence: explicit arg โ open PR's baseRefName โ repo default (origin/HEAD). Never hardcode dev/main.
CURRENT=$(git rev-parse --abbrev-ref HEAD)
REMOTE=$(git remote | head -1)
git fetch "$REMOTE" --prune
TARGET=$(printf '%s\n' $ARGUMENTS | grep -v '^--' | head -1)
[ -z "$TARGET" ] && TARGET=$(gh pr view --json baseRefName --jq .baseRefName 2>/dev/null)
[ -z "$TARGET" ] && TARGET=$(git symbolic-ref refs/remotes/"$REMOTE"/HEAD 2>/dev/null | sed "s|refs/remotes/$REMOTE/||")
If $TARGET is empty or equals $CURRENT, ask. Surface "$REMOTE/$TARGET" โ "$CURRENT" and confirm โ stacked PRs miscall easily.
gh pr view --json title,body,headRefName,baseRefName 2>/dev/null
git log --oneline "$REMOTE/$TARGET".."$CURRENT"
git diff --stat "$REMOTE/$TARGET".."$CURRENT"
Note: files this branch owns, what it changes, what to preserve from upstream.
git merge "$REMOTE/$TARGET" --no-edit
Clean? Skip to ยง5. Else capture the targeted scope for ยง4โยง5:
CONFLICTS=$(git diff --name-only --diff-filter=U)
Hold in memory โ the U filter empties after staging.
For each file in $CONFLICTS, read both sides and classify. Tag each resolution High (mechanical, clear intent) or Low (judgment call on business logic) โ ยง6 gates on these tags.
| Type | Action |
|---|---|
| Non-overlapping | Integrate both |
| Superseding | Keep ours; adopt new deps/imports/types from theirs |
| Upstream improvement | Take theirs |
| Genuine collision | Judge from branch context |
Stage resolutions, then git commit --no-edit.
Targeted scope = $CONFLICTS โ not the full merge diff. Upstream lines came in pre-validated; widening scope rebuilds packages this branch never touched.
Run quality-ship with that scope:
$CONFLICTS paths.$CONFLICTS (e.g. turbo run โฆ --filter={<pkg>โฆ}).Worktree repair is lazy โ load worktree-setup only on Cannot find module / empty-dist/ errors for an in-scope package. Don't run verify.py proactively; its full-workspace manifest will demand artifacts (electron-forge bundles, โฆ) outside your scope.
$ARGUMENTS may include --full-scope to opt back into whole-diff validation.
Separate commits for fixes.
Hold if any:
$ARGUMENTS contains --no-pushWhen holding: summarize each resolution + confidence; for Low ones, name the ambiguity and the choice; ask before pushing.
Otherwise:
git push -u origin HEAD