From devflow
Sync advisor for after a PR/MR has been merged. Assesses local git state, explains what needs to happen, and guides the developer through each step with explicit approval. Never makes destructive changes without the developer's conscious authorization.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-4 --plugin codingthefuturewithai-claude-code-primitivesThis skill is limited to using the following tools:
I'll assess your current repository state and help you sync safely after a merge.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
I'll assess your current repository state and help you sync safely after a merge.
Important: I will explain each step and its implications before doing anything. No git operations run without your explicit approval.
Gather a complete picture before touching anything.
# Current branch
git branch --show-current
# Uncommitted changes (staged and unstaged)
git status --short
# Untracked files
git ls-files --others --exclude-standard
# How far behind origin/main
git fetch origin --dry-run 2>&1 || true
git rev-list HEAD..origin/main --count 2>/dev/null || echo "0"
# Other local branches with uncommitted/unpushed work
git branch --format='%(refname:short)' | grep -v "^$(git branch --show-current)$" | while read b; do
staged=$(git diff --cached --name-only "$b" 2>/dev/null | wc -l | tr -d ' ')
unstaged=$(git diff --name-only "$b" 2>/dev/null | wc -l | tr -d ' ')
unpushed=$(git rev-list "origin/$b..$b" --count 2>/dev/null || echo "0")
if [ "$staged" -gt 0 ] || [ "$unstaged" -gt 0 ] || [ "$unpushed" -gt 0 ]; then
echo "$b: staged=$staged unstaged=$unstaged unpushed=$unpushed"
fi
done
Report the full picture to the developer before proposing anything:
Current state:
Branch: [current branch name]
Uncommitted changes: [none / N staged, N unstaged files]
Untracked files: [none / N files]
main is: [N commits ahead of local / up to date]
Other branches with work in progress:
[branch-name]: N uncommitted, N unpushed ← these will NOT be affected
(none)
If the developer is NOT on a feature branch (e.g., already on main):
If the developer IS on a feature branch:
Present the recommended steps as a numbered list. Explain each one:
Recommended steps:
1. Fetch and pull main
What: git checkout main && git pull
Why: Brings your local main up to date with all merged PRs (including yours).
Risk: None. This only fast-forwards main — no local work is affected.
2. Delete local branch: [branch-name]
What: git branch -d [branch-name]
Why: The branch was merged. Keeping it creates clutter.
Risk: Git will refuse if the branch has unmerged commits (safe guard).
If refused, I will report the error — not force it.
⚠️ You will need to confirm this in your terminal — I cannot delete branches.
3. [Optional] Update dependencies
What: [npm install / composer install / etc. based on package manager]
Why: Dependencies may have changed in the merged PRs.
Risk: Low. Will not delete node_modules or lockfiles without asking.
4. [Optional] Run tests
What: [detected test command]
Why: Verify the merged state is clean.
Risk: None.
Ask:
"Shall I proceed with steps 1 through [N]? Or select individual steps to skip."
Respect any answer. The developer may want only step 1. They may want to skip tests. That is their call.
Only proceed if developer approved.
git checkout main
git pull
Show result: how many commits were pulled, what's new.
This requires the developer to run themselves. Due to the DevFlow safety hook, branch deletion is blocked when Claude runs it. Tell the developer:
"To delete the local branch, run this command yourself:
git branch -d [branch-name]Git will refuse this safely if the branch has unmerged commits."
Do NOT attempt to run this command — the safety hook will block it and confuse the workflow. Simply provide the command and explain what it does.
Detect package manager:
package.json → npm install or yarn install or pnpm installcomposer.json → composer installGemfile → bundle installrequirements.txt / pyproject.toml → pip install -r requirements.txtgo.mod → go mod tidyRun only the detected installer. If multiple detected, ask which to run.
Use whatever test command is in CLAUDE.md or detect from package.json scripts. Show pass/fail summary.
✅ Sync complete
main updated: [N commits pulled / already up to date]
Branch cleanup: [command provided to developer]
Dependencies: [updated / skipped]
Tests: [passed / skipped]
Suggest next actions:
Capture session learnings: If you have the
claude-md-managementplugin installed, run/revise-claude-mdto update CLAUDE.md with anything learned during this session.Start next issue:
/devflow:build:fetch-issue [ISSUE-KEY]
Developer has uncommitted changes on current branch:
"You have [N] uncommitted changes on [branch]. Checking out main will NOT affect these — they stay on this branch. However, if you plan to discard this branch, you would lose those changes. Do you want to review them first?" Stop until developer confirms.
Developer is on main with uncommitted changes:
"You are on main with [N] uncommitted changes. A
git pullmay cause a merge commit or conflict if remote has diverged. Review your changes before I proceed." Stop until developer confirms.
git pull produces a merge conflict:
"There is a merge conflict. I will not attempt to resolve it automatically. Here are the conflicting files: [list]. Resolve these manually, then run
git addandgit committo finish the merge." Stop completely.
Branch has unpushed commits (unexpected):
"Branch [name] has [N] commits that were never pushed to origin. If you delete this branch, those commits will be lost permanently. Review them first with:
git log origin/main..[branch-name]" Do not proceed with deletion suggestion until developer acknowledges.
Developer is multiple PRs behind (common on teams):
"main is [N] commits ahead of your local — that's approximately [N] merged PRs. A single
git pullwill bring in all of them at once." This is normal. Proceed normally.
Do not continue beyond what the developer has approved.