Skip to content

feat(smartlog): Phase 2 — PR/CI status overlay#327

Merged
erishforG merged 3 commits into
developfrom
feat/auto-smartlog-phase2-pr-overlay
May 30, 2026
Merged

feat(smartlog): Phase 2 — PR/CI status overlay#327
erishforG merged 3 commits into
developfrom
feat/auto-smartlog-phase2-pr-overlay

Conversation

@erishforG
Copy link
Copy Markdown
Owner

무엇

Issue #245 (smartlog) 의 Phase 2: 각 worktree row 에 GitHub PR 번호 + state + CI 상태 + review 상태를 한 줄로 표시.

Phase 1 (#305) skeleton 에서 SmartlogNode.pr 가 placeholder 로만 있던 걸 실제로 채움.

#245 의 메인 가치는 "워크트리 + PR + CI 를 한 화면에" 인데, 지금까지는 worktree 만 보였음. PR/CI overlay 가 빠진 smartlog 는 `parsec list` + commit log 와 차이가 없음.

이번 PR 로 issue 본문의 예시가 그대로 동작:

○ main
│
├─● CL-2283 Add rate limiting [feature/CL-2283]
│  ├─ [PR #42 ● open ✓ CI ✓ approved]
│  └─ a1b2c3d Implement rate limiter

변경

  • SmartlogPrOverlay struct 신설 (number/state/ci_status/review_status/url)
  • smartlog() 가 GitHubClient 통해 `find_pr_by_branch` → `get_pr_status` 호출 후 `node.pr` 채움
  • Best-effort: 토큰 없거나 비-GitHub remote 거나 HTTP 실패 = overlay 생략 (명령 자체는 정상 완료)
  • `--no-overlay` 플래그 (강제 offline)
  • ASCII 렌더러: ticket 라인 아래에 1줄 추가
  • 글리프: 기존 `parsec pr status` / `parsec ci` 와 동일 (✓/✗/●/○)
  • `node.ci` 필드는 None 유지 — overlay 가 CI 요약을 이미 포함 (per-check 디테일은 `parsec ci` 담당)

드라이브-바이

`tests/cli_tests.rs:1725` 의 `assert_eq!(bool, false)` clippy 경고 (#326 회귀) → `assert!(!...)` 로 수정. develop 의 clippy strict 빌드 회복.

다음 Phase 힌트

  • Phase 3: per-worktree filtering (`--ticket CL-2283` 등)
  • Phase 4: stack 관계 시각화 (PR base = 다른 PR head)
  • Phase 5: review state 색상 강조

리스크

low — 기존 동작 (overlay 없는 경우) 그대로, overlay 는 가산적. 실패해도 stderr 로그 + 명령 완료.

롤백

`git revert` 한 번. `SmartlogPrOverlay` 사용처는 smartlog 내부 한정.

Test plan

  • cargo build --quiet 통과
  • cargo fmt --check 통과
  • cargo clippy --all-targets -- -D warnings 통과 (test(health): parsec health CLI 통합 테스트 5개 추가 #326 회귀 함께 수정)
  • cargo test 전체 통과 (단위 14개 smartlog + 통합 58개 + 5개 health)
  • 신규 단위 5개 추가 (format_pr_badge x3 + render_text overlay + JSON 직렬화)

Refs #245

@erishforG

🤖 Generated with Claude Code

erishforG and others added 2 commits May 30, 2026 09:32
Phase 1 구현(#325)을 커버하는 통합 테스트:

- test_health_empty_repo: 빈 repo → 'No active worktrees.' 확인
- test_health_empty_repo_json: 빈 repo → --json 시 '[]' 출력 확인
- test_health_shows_worktree: 워크트리 1개 → 티켓명 포함 출력 확인
- test_health_json_one_worktree: --json 구조 검증
  (worktrees 배열, all_healthy 불리언, ticket/has_lock/uncommitted/stale_days/stale 필드)
- test_health_exit_zero_with_issues: lock 파일 존재해도 exit 0 (정보성 only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Phase 1 (#305) skeleton에서 `SmartlogNode.pr` 가 placeholder로 남아있던 걸
실제 GitHub PR/CI 데이터로 채움. Issue #245 의 예시 (`[PR #42 ✓ CI passed,
✓ approved]`) 가 이제 ASCII 트리에 그대로 렌더링됨.

## 변경
- `SmartlogPrOverlay` struct 신설 (number/state/ci_status/review_status/url)
- `smartlog()` 가 GitHubClient 통해 brach → PR 매칭 + PrStatus 조회 후
  node.pr 채움. 토큰 없거나 비-GitHub remote거나 HTTP 실패 = 그냥 overlay
  생략 (best-effort, 명령 실패 안 함)
- `--no-overlay` 플래그 추가 (강제 offline 모드)
- ASCII 렌더러: ticket 라인 아래 `├─ [PR #N ● open ✓ CI ✓ approved]` 한 줄
- 글리프 규칙: 기존 `parsec pr status` / `parsec ci` 와 동일 (✓/✗/●/○)

## CI 필드는?
`SmartlogNode.ci` 는 일단 None 유지. Phase 2 는 CI 요약을 overlay 안에
포함시켜 한 줄로 표시 (스마트로그 본질은 한눈 — per-check 디테일은
`parsec ci` 가 이미 담당).

## 드라이브-바이
tests/cli_tests.rs:1725 에 `assert_eq!(bool, false)` clippy 경고 (#326
회귀) → `assert!(!...)` 로 수정. develop 의 clippy strict 빌드 회복.

## 테스트
- 신규 unit 5개 (format_pr_badge × 3 + render_text overlay + JSON 직렬화)
- 기존 9개 smartlog unit + 5개 통합 테스트 모두 통과
- cargo build / clippy -D warnings / fmt --check / test 전체 clean

## 다음 Phase 힌트
- Phase 3: per-worktree filtering (`--ticket CL-2283` 등)
- Phase 4: stack 관계 시각화 (PR base = 다른 PR head)
- Phase 5: review state 색상 강조 (terminal color)

Refs #245

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label May 30, 2026
…-phase2-pr-overlay

# Conflicts:
#	tests/cli_tests.rs
@erishforG erishforG merged commit 6701447 into develop May 30, 2026
12 checks passed
erishforG added a commit that referenced this pull request May 30, 2026
…291) (#328)

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>
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