feat(ship): --no-cleanup flag + wire auto_cleanup Phase 3 · Closes #313 - #423
Merged
Conversation
Add `--no-cleanup` flag to `parsec ship` so users working incrementally (multiple commits / ships on the same ticket) can push + create/update the PR without losing their worktree. Also fix a latent gap: `ship_cleanup()` existed in WorktreeManager but was never called from the `ship` command handler. The combined `manager.ship()` (dead_code) already called it, but the refactored command path (ship_push → PR creation) forgot Phase 3. Now wired correctly with the escape hatch. ## Changes - `src/cli/mod.rs`: add `no_cleanup: bool` to `Command::Ship`, pass through to handler and dry-run message - `src/cli/commands/ship.rs`: add `no_cleanup` param; Phase 3 block calls `manager.ship_cleanup(ticket)` when `!no_cleanup` (still respects `config.ship.auto_cleanup`) - `src/cli/commands/stack.rs`: forward `no_cleanup = false` in stack-ship call to satisfy updated signature (stack always uses config default) - `tests/cli_tests.rs`: two new integration tests — `test_ship_no_cleanup_preserves_worktree` and `test_ship_auto_cleanup_removes_worktree` Refs #313 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
무엇
parsec ship에--no-cleanup플래그를 추가하고, 오랫동안 호출되지 않았던ship_cleanup()Phase 3를 ship 커맨드 핸들러에 연결합니다.문제 1 (이슈 #313): 점진적 마이그레이션 작업(동일 ticket에 여러 번 commit + ship)을 할 때
parsec ship이 worktree를 제거해 불편함.문제 2 (코드 갭):
WorktreeManager::ship_cleanup()이 존재하지만commands/ship.rs핸들러에서 호출되지 않음. 리팩토링 과정에서 Phase 3 연결이 누락됨 (manager.ship()은#[allow(dead_code)]로만 남아있었음).왜
config.ship.auto_cleanup = true(기본값)이고 CLI help도 "removes the worktree"라고 명시하지만, 실제 ship 커맨드는 worktree를 제거하지 않는 불일치 상태였음. 이 PR이 두 문제를 동시에 해결합니다.변경
src/cli/mod.rsCommand::Ship에--no-cleanup플래그 추가, dispatch + dry-run 메시지 업데이트src/cli/commands/ship.rsno_cleanup: bool파라미터 추가; Phase 3 블록:!no_cleanup이면manager.ship_cleanup()호출 (config.ship.auto_cleanup 여전히 존중)src/cli/commands/stack.rsno_cleanup = false전달 (stack ship은 config 기본값 사용)tests/cli_tests.rstest_ship_no_cleanup_preserves_worktree,test_ship_auto_cleanup_removes_worktree사용법
다음 Phase 힌트
parsec merge --no-cleanup도 동일하게 추가 가능 (ship: add --no-cleanup flag to skip worktree removal #313 관련 UX 통일)리스크
기존에 ship이 cleanup을 하지 않던 상태 → 이제 auto_cleanup=true 시 ship이 worktree를 제거함. 이는 원래 의도된 동작이지만,
--no-cleanupescape hatch로 기존 수동 워크플로우 보호.롤백
git revert <commit>또는 config에서ship.auto_cleanup = false설정.Test plan
cargo build✅cargo clippy -- -D warnings✅cargo fmt --check✅cargo test173 tests pass ✅test_ship_no_cleanup_preserves_worktree: --no-cleanup 시 worktree 디렉토리 물리적으로 유지 확인test_ship_auto_cleanup_removes_worktree: auto_cleanup 시 worktree 제거 확인Closes #313
@erishforG