feat(completion): Phase 2 — dynamic zsh/bash/fish shell scripts#328
Merged
Conversation
…291) Phase 1 (#312) 가 `parsec __complete <kind>` 내부 명령을 만들어 shell completion 스크립트가 동적으로 worktree/branch 후보를 가져올 수 있게 했음. 이번에는 그 위에 실제 zsh/bash/fish 스크립트 3개를 추가해서 사용자가 sourcing 만 하면 `parsec switch <Tab>` 처럼 live ticket 자동완성을 받을 수 있게 함. ## 변경 - `completions/_parsec` (zsh, #compdef) — `_parsec_worktrees` / `_parsec_branches` helper + 모든 주요 subcommand 의 positional/option 자동완성 - `completions/parsec.bash` — `complete -F _parsec parsec`. bash-completion 의존 (`_init_completion`). prev word 기반 dispatch + `compgen -W` - `completions/parsec.fish` — `__fish_seen_subcommand_from` 기반. per-subcommand 옵션 (`--base`, `--on`, `--branch`) 도 동적 branch/worktree 후보 연결 - README "Install > Shell completion" 섹션 추가 (3개 shell install 명령) ## 커버 범위 (Tier 1 + 2) - ticket 받는 subcommand: start, switch, ship, open, clean, status, ticket, pr-status, ci, merge, diff, sync, log, compress, adopt, rename - branch 받는 옵션: `start --base|--on|--branch`, `ship --base`, `adopt --branch` - smartlog: `--depth`, `--no-overlay` (PR #327 와 호환) ## __complete kind 추가 없음. Phase 1 의 `worktrees` / `branches` 두 개로 충분 — future Phase 3 에서 필요하면 추가 (예: `tickets` 트래커, `reviewers` GitHub 사용자). ## 드라이브-바이 PR #327 에서 같이 잡았던 `tests/cli_tests.rs:1725` clippy 회귀 (#326) develop 머지 전이라 또 한 번 적용. PR #327 머지되면 충돌 안 남. ## 테스트 - 신규 4개 통합 테스트: - `completion_zsh_present_and_dynamic` — `#compdef parsec` + `__complete` 호출 + 핵심 sub 7개 - `completion_bash_present_and_dynamic` — `complete -F _parsec parsec` + 동일 - `completion_fish_present_and_dynamic` — `__parsec_worktrees` 함수 + 동일 - `completion_scripts_reference_phase1_subcommand_signature` — 스크립트가 Phase 1 가 지원하지 않는 kind 부르지 않는지 (silent fail 방지) - 전체 62 통합 테스트 + smartlog 14 단위 + health 5 통과 - cargo build / clippy -D warnings / fmt --check 전부 clean ## 다음 Phase 힌트 - Phase 3: `__complete tickets` (트래커 미해결 티켓), `__complete reviewers` (GitHub mention) - Phase 4: shell auto-install hook (parsec init 에서 자동 설치 옵션) Refs #291 Co-Authored-By: Claude Opus 4.7 <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.
무엇
Issue #291 (shell completion) Phase 2: 실제 zsh/bash/fish 스크립트 3개를 `completions/` 디렉터리에 추가. PR #312 가 만든 `parsec __complete ` 내부 명령을 호출해서 live worktree 와 branch 후보를 동적으로 자동완성.
이번 PR 후 사용자가 `parsec switch ` 누르면 본인이 작업 중인 티켓 목록이 바로 나옴.
왜
Phase 1 (#312) 의 `__complete` 는 candidate emitter 만 만들었지 실제 shell hook 이 없었음. clap_complete 의 정적 completion 으로는 ticket/branch 인자가 모두 `_default` (파일명) 로 떨어져서 실용성이 낮음.
issue #291 의 핵심 가치 ("실제로 입력하는 동안 내 worktree 가 보임") 가 이번 PR 로 동작:
변경
신규 파일 (3개 shell)
커버 범위 (Tier 1 + 2)
README
`Install` 섹션 아래에 `Shell completion` 서브섹션 추가 (3개 shell 설치 명령 1줄씩).
`__complete` kind 추가
없음. Phase 1 의 `worktrees` / `branches` 두 개로 충분. 추후 Phase 3 에서 필요 시 추가 (예: `tickets` 트래커, `reviewers` GitHub 사용자).
드라이브-바이
PR #327 (smartlog Phase 2) 에서도 같이 잡았던 `tests/cli_tests.rs:1725` clippy 경고 (#326 회귀) 재적용. PR #327 머지되면 충돌 자동 해소.
다음 Phase 힌트
리스크
low — 신규 파일 3개 + README 추가. 기존 `parsec config completions ` 정적 path 그대로 작동, 사용자가 dynamic 원하면 sourcing 만 선택.
롤백
`completions/` 디렉터리 삭제 + README diff revert.
Test plan
Refs #291
@erishforG
🤖 Generated with Claude Code