feat(health): parsec health Phase 1 — lock/uncommitted/stale worktree checks#325
Merged
Conversation
…eleton (#324) Add `parsec health` command that scans all active worktrees for three lightweight health indicators: - has_lock — .git/index.lock exists (interrupted git process) - uncommitted — count of staged + unstaged files - stale — last commit older than 7 days Output (human mode): colored table with ✓/⚠/✗ per worktree and a summary line. JSON mode emits a structured array with `all_healthy` flag. Files changed: - src/cli/commands/health.rs (new, ~99 lines) - src/cli/commands/mod.rs (+2 lines, re-export) - src/cli/mod.rs (+11 lines, Health variant + dispatch) - src/output/mod.rs (+15 lines, HealthRecord + dispatch_output!) - src/output/human.rs (+66 lines, colored table renderer) - src/output/json.rs (+34 lines, JSON renderer) CI-status overlay deferred to Phase 2 (depends on #309/#310). All checks are read-only; no worktree state is modified. Closes #324 Refs #299 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
erishforG
added a commit
that referenced
this pull request
May 30, 2026
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>
erishforG
added a commit
that referenced
this pull request
May 30, 2026
* test(health): parsec health CLI 통합 테스트 5개 추가 (#324) 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> * feat(smartlog): Phase 2 — PR/CI status overlay (Refs #245) 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> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
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 health신규 명령 추가 (v0.5 milestone, Issue #299 Phase 1).모든 active worktree를 순회해 3가지 경량 건강 지표를 표시:
.git/index.lock잔여 여부 — 인터럽트된 git 프로세스 신호예시 출력:
--json지원:{ "worktrees": [{"ticket":"PROJ-123","has_lock":false,"uncommitted":0,"stale_days":2,"stale":false}], "all_healthy": false }왜
Issue #299 (parsec health epic)의 Phase 1 구현. CI-status overlay는 #309/#310 선행 이슈 완료 후 Phase 2에서 추가 예정.
parsec doctor가 환경(git 버전, 토큰 등)을 점검한다면parsec health는 worktree 상태 자체를 점검한다.변경
src/cli/commands/health.rssrc/cli/commands/mod.rssrc/cli/mod.rsHealth커맨드 variant + dispatch (+11줄)src/output/mod.rsHealthRecordstruct +dispatch_output!(+15줄)src/output/human.rssrc/output/json.rs리스크
None으로 처리)롤백
git revert <commit>—Healthvariant 제거만으로 완전 롤백 가능.Test plan
기능 테스트:
다음 단계
health명령 unit/integration test@erishforG 검토 부탁드립니다 🖤
Closes #324
Refs #299