Skip to content

feat(ship): --no-cleanup flag + wire auto_cleanup Phase 3 · Closes #313 - #423

Merged
erishforG merged 1 commit into
developfrom
feat/313-ship-no-cleanup
Sep 5, 2026
Merged

feat(ship): --no-cleanup flag + wire auto_cleanup Phase 3 · Closes #313#423
erishforG merged 1 commit into
developfrom
feat/313-ship-no-cleanup

Conversation

@erishforG

Copy link
Copy Markdown
Owner

무엇

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.rs Command::Ship--no-cleanup 플래그 추가, dispatch + dry-run 메시지 업데이트
src/cli/commands/ship.rs no_cleanup: bool 파라미터 추가; Phase 3 블록: !no_cleanup이면 manager.ship_cleanup() 호출 (config.ship.auto_cleanup 여전히 존중)
src/cli/commands/stack.rs 업데이트된 시그니처에 no_cleanup = false 전달 (stack ship은 config 기본값 사용)
tests/cli_tests.rs 2개 통합 테스트: test_ship_no_cleanup_preserves_worktree, test_ship_auto_cleanup_removes_worktree

사용법

# 기존 동작 (변경 없음) — auto_cleanup=true면 worktree 제거
parsec ship CL-2428

# 새 플래그 — worktree 유지 (점진적 커밋 워크플로우)
parsec ship CL-2428 --no-cleanup   # push + PR, worktree 보존
# ... 추가 작업 후 ...
parsec ship CL-2428 --no-cleanup   # 또 push (PR 업데이트)
# ... 완료 후 ...
parsec ship CL-2428                # 마지막 ship, worktree 제거

다음 Phase 힌트

리스크

기존에 ship이 cleanup을 하지 않던 상태 → 이제 auto_cleanup=true 시 ship이 worktree를 제거함. 이는 원래 의도된 동작이지만, --no-cleanup escape hatch로 기존 수동 워크플로우 보호.

롤백

git revert <commit> 또는 config에서 ship.auto_cleanup = false 설정.

Test plan

  • cargo build
  • cargo clippy -- -D warnings
  • cargo fmt --check
  • cargo test 173 tests pass ✅
  • test_ship_no_cleanup_preserves_worktree: --no-cleanup 시 worktree 디렉토리 물리적으로 유지 확인
  • test_ship_auto_cleanup_removes_worktree: auto_cleanup 시 worktree 제거 확인

Closes #313
@erishforG

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>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label Sep 5, 2026
@erishforG
erishforG merged commit 38b2a54 into develop Sep 5, 2026
12 checks passed
@erishforG
erishforG deleted the feat/313-ship-no-cleanup branch September 5, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-improvement Daily auto-generated improvement PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant