Skip to content

feat(cli): add dub modify --into stack branch workflow#32

Open
dubscode wants to merge 2 commits intomainfrom
codex/ds-3wn-modify-into
Open

feat(cli): add dub modify --into stack branch workflow#32
dubscode wants to merge 2 commits intomainfrom
codex/ds-3wn-modify-into

Conversation

@dubscode
Copy link
Contributor

Summary

  • Add dub modify --into <branch> to edit older branches in the current stack and keep descendants up-to-date.
  • Add guardrails for invalid targets (non-existent branch, non-stack branch, root branches, and conflicting --into/--interactive-rebase combinations).
  • Add restore behavior that keeps the user on original branch unless restack conflicts require manual recovery.
  • Update help/docs in README.md, QUICKSTART.md, and command docs for the new flow.
  • Add dedicated unit tests and an integration test for stack rebase correctness when modifying older branch.

Testing

  • pnpm checks
  • pnpm typecheck
  • pnpm test

Respects issue ds-3wn and includes second-pass verification.

@vercel
Copy link

vercel bot commented Mar 13, 2026

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

Project Deployment Actions Updated (UTC)
dubstack Ready Ready Preview, Comment Mar 13, 2026 1:18am

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

Adds a new dub modify --into <branch> workflow to apply the modify flow to another branch in the current stack and then restack descendants, with accompanying guardrails, docs, and tests.

Changes:

  • Add --into <branch> flag to dub modify and implement target-branch modify + descendant restack behavior (with restore-to-original-branch behavior).
  • Add unit tests covering --into validation/restoration plus restack conflict/failure messaging.
  • Add an integration test and update docs (README, QUICKSTART, command docs) to document the new workflow.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/cli/src/index.ts Exposes the new dub modify --into <branch> CLI option and help text.
packages/cli/src/commands/modify.ts Implements --into validation, branch switching, modify flow execution, and restoration logic.
packages/cli/src/commands/modify.test.ts Adds unit coverage for --into behavior and restack status messaging.
packages/cli/src/commands/modify-into.test.ts Adds an integration-level test exercising modify --into against a real repo.
apps/docs/content/docs/commands/modify.mdx Documents --into usage and adds it to the flags table.
README.md Adds --into example + flag mention.
QUICKSTART.md Adds guidance for applying changes to a middle/older branch via --into.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 142 to +145
await amendCommit(cwd, { message, noEdit });
}

await restackChildren(cwd);
return restackChildren(cwd);
Comment on lines +48 to +57
expect(await getCurrentBranch(dir)).toBe('feat/b');

const targetLastCommit = (
await gitInRepo(dir, ['log', '-1', '--format=%s', 'feat/a'])
).stdout.trim();
expect(targetLastCommit).toBe('fix(a): apply targeted fix');

const fileContent = fs.readFileSync(path.join(dir, 'a.txt'), 'utf8');
expect(fileContent).toContain('hotfix');
});
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