[245] feat(smartlog): skeleton — DAG data model + ASCII tree + JSON output#305
Merged
Conversation
…utput Phase 1 of #245. Establishes the command surface and rendering path without any forge-side enrichment. Adds `parsec smartlog` (alias `sl`): - `SmartlogNode` per active worktree: ticket, branch, base, commits, plus `pr` / `ci` placeholder fields gated on `skip_serializing_if` so the JSON output stays clean until follow-up PRs populate them. - `collect_commits` shells out to `git log <base>..<branch>` (no `git2` dependency — matches the rest of `git/`). Soft-fails per worktree so a corrupt worktree can't take the whole command down. - `render_text` groups nodes by base branch and draws ASCII tree glyphs (○ │ ├─● └─). Returns the rendered string for testability. - `--json` emits the same structure for tooling. - `--depth N` caps commits per worktree (default 10). Out of scope for this PR (follow-ups on the same epic): - PR overlay (open/draft/merged) - CI overlay (passed/failed/running) - Review state (approved / changes requested) - Stack relationship visualization - Color / smarter wrapping Tests (9 new in `cli::commands::smartlog::tests`): - `parse_commit_line` happy path + tab-in-subject + garbage + empty SHA - `render_text` empty / single / no-commits / multi-base grouping - JSON serialization omits placeholder overlay fields Smoke run on parsec's own worktrees produces: ○ develop (base) ├─● 207 #207 [feature/207] │ └─ (no commits since develop) └─● 279 #279 [feature/279] └─ (no commits since develop)
This was referenced May 14, 2026
This was referenced May 25, 2026
erishforG
added a commit
that referenced
this pull request
May 25, 2026
…317) develop에 머지됐지만 CHANGELOG.md [Unreleased]에 누락된 항목 4개를 추가한다: - parsec smartlog (alias sl): commit DAG 시각화 (#245, #305) - parsec __complete: 동적 shell completion 헬퍼 (#291, #312) - 에러 메시지 3줄 표준화 (error/caused by/help) (#303, #306) - Windows VS2026 pre-validation CI job (#307, #311) Closes #316 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 26, 2026
erishforG
added a commit
that referenced
this pull request
May 26, 2026
parsec smartlog (#305)과 sl 별칭이 develop에 머지됐지만 CLI 통합 테스트가 전혀 없었음. 5개 시나리오 추가: - test_smartlog_empty_repo: 빈 repo → 'No active worktrees' 확인 - test_sl_alias_works_like_smartlog: sl == smartlog 동일 출력 확인 - test_smartlog_json_empty_is_array: --json 빈 repo → [] JSON 배열 - test_smartlog_shows_worktree: worktree 1개 → 티켓·(base) 마커 표시 - test_smartlog_json_one_worktree: --json 1 worktree → 필드 검증 (ticket, branch, base_branch, commits, pr/ci 미노출) Closes #318 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
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>
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.
배경
v0.5 milestone 의 smartlog (#245) 첫 PR — Phase 1 skeleton.
변경
`parsec smartlog` (alias `sl`) 명령 추가:
출력 예시 (parsec 자체 worktrees)
```
○ develop (base)
│
├─● 207 #207 [feature/207]
│ └─ (no commits since develop)
│
└─● 279 #279 [feature/279]
└─ (no commits since develop)
```
JSON 도 동일 구조로 출력 (PR/CI 필드는 `skip_serializing_if` 로 미노출).
설계
후속 PR (별도)
테스트
관련
🤖 Generated with Claude Code