Skip to content

feat: automate stack repair and enable restack by default in sync#25

Merged
dubscode merged 3 commits intomainfrom
feat/sync-stack-maintenance
Mar 9, 2026
Merged

feat: automate stack repair and enable restack by default in sync#25
dubscode merged 3 commits intomainfrom
feat/sync-stack-maintenance

Conversation

@dubscode
Copy link
Contributor

@dubscode dubscode commented Mar 8, 2026


🥞 DubStack

Copilot AI review requested due to automatic review settings March 8, 2026 23:49
@vercel
Copy link

vercel bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
dubstack Skipped Skipped Mar 9, 2026 0:15am

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_version branch 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.

@dubscode dubscode merged commit 9efab16 into main Mar 9, 2026
6 checks passed
@dubscode dubscode deleted the feat/sync-stack-maintenance branch March 9, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants