feat: automate stack repair and enable restack by default in sync#25
Merged
feat: automate stack repair and enable restack by default in sync#25
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
5f85eac to
ba0dc1f
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the CLI’s sync/maintenance workflow to better “repair” stacks after manual merges, including enabling restack by default and adding state metadata to track reconciliation outcomes.
Changes:
- Add
last_reconciled_versionbranch metadata and roundtrip/submit/sync updates for it. - Introduce shared stack-maintenance helpers to retarget PR bases and refresh stacks via submit after maintenance actions.
- Add
git cherry-based detection to skip restack steps when a branch has no unique patch content; update sync default to restack unless--no-restack.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/lib/state.ts | Adds last_reconciled_version to persisted branch state and normalizes it. |
| packages/cli/src/lib/state.test.ts | Adds roundtrip test coverage for reconciliation metadata. |
| packages/cli/src/lib/git.ts | Adds hasUniquePatchCommits() helper using git cherry. |
| packages/cli/src/lib/git.test.ts | Adds tests for hasUniquePatchCommits() including squash-merge equivalence. |
| packages/cli/src/index.ts | Makes sync --restack default-on via option default and updates conflict guidance text. |
| packages/cli/src/commands/sync.ts | Enables restack by default; tracks reparenting, retargets PR bases, refreshes stacks, and records reconciliation sources. |
| packages/cli/src/commands/sync.test.ts | Updates restack-default behavior and adds tests for retarget/refresh flows. |
| packages/cli/src/commands/submit.ts | Records last_reconciled_version during submit. |
| packages/cli/src/commands/submit.test.ts | Adds assertion for last_reconciled_version on submit. |
| packages/cli/src/commands/stack-maintenance.ts | New shared helpers for PR base retargeting, preferred branch selection, and stack refresh submit. |
| packages/cli/src/commands/restack.ts | Skips restack steps when no unique patch commits exist (via git cherry). |
| packages/cli/src/commands/post-merge.ts | Refactors to use shared maintenance helpers; adjusts submit refresh behavior and messaging. |
| packages/cli/src/commands/post-merge.test.ts | Updates expectations for stack refresh mode and adds trunk-origin refresh behavior test. |
| README.md | Documents new sync behavior (repair + restack default, recovery guidance). |
| QUICKSTART.md | Updates recommended manual-merge recovery flow to prefer dub sync. |
| .agents/skills/dubstack/references/workflows.md | Updates documented workflows to reflect restack-by-default and manual-merge guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 DubStack