Skip to content

refactor(cli): extract status diagnostics boundary - #167

Merged
errfld merged 1 commit into
mainfrom
gh-164/status-diagnostics-boundary
Jun 22, 2026
Merged

refactor(cli): extract status diagnostics boundary#167
errfld merged 1 commit into
mainfrom
gh-164/status-diagnostics-boundary

Conversation

@errfld

@errfld errfld commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extract git smee status report models, builders, and text rendering into a focused status module.
  • Keep main.rs as the top-level command dispatcher for status while preserving the existing JSON/text output schemas.
  • Add focused unit coverage around repository-relative status path rendering.

Refs #164

Validation

  • cargo fmt --all -- --check
  • cargo test -p git-smee-cli
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • Smoke: git smee doctor, git smee doctor --json, git smee status, and git smee status --json in a temporary Git repository

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced status reporting now provides comprehensive per-hook analysis with detailed health indicators
    • Automatic detection of misconfigured or obsolete hooks with specific remediation recommendations
    • Added JSON output format for integration with external automation and reporting tools

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 10c02351-8ae6-4226-9c43-3e6fac3b86bd

📥 Commits

Reviewing files that changed from the base of the PR and between 1f4e8a3 and 8f4fb31.

📒 Files selected for processing (2)
  • crates/git-smee-cli/src/main.rs
  • crates/git-smee-cli/src/status.rs

📝 Walkthrough

Walkthrough

Extracts the run_status function and all supporting status-report logic from main.rs into a new crates/git-smee-cli/src/status.rs module. The new file introduces a structured StatusReport data model, a build_status_report pipeline, rendering helpers, and unit tests. main.rs is updated to declare the module and delegate to it.

Changes

Status Module Extraction

Layer / File(s) Summary
Status data model, entrypoint, and module wiring
crates/git-smee-cli/src/status.rs, crates/git-smee-cli/src/main.rs
Defines StatusReport, StatusState, HookState, and related structs with lowercase serde serialization; exposes pub(crate) fn run_status; adds mod status; to main.rs and routes Command::Status { json } to status::run_status.
build_status_report: hook inspection and drift detection
crates/git-smee-cli/src/status.rs
Resolves repo root and hooks directory, evaluates configured phase hooks via filesystem checks and managed-header inspection, assigns HookState variants and stale reasons, scans for obsolete managed hooks, de-duplicates next_actions, and derives StatusState::Ok vs Drift.
Rendering helpers, display utilities, and tests
crates/git-smee-cli/src/status.rs
Implements print_status_report for human-readable output, as_text enum-to-label converters, print_status_section list printer, display_repo_path for repo-relative path normalization, and unit tests for path formatting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • errfld/git-smee#162: Introduced the original git smee status command and status reporting behavior that this PR refactors into status.rs.

Poem

🐇 Hop hop, the status code roams free,
No longer cramped in main.rs, you see!
A tidy status.rs holds every state,
Drift or Ok — each hook meets its fate.
The rabbit tidied modules with glee! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: extracting status command logic from main.rs into a dedicated status module, which is the core refactoring objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gh-164/status-diagnostics-boundary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@errfld
errfld merged commit 6e5be5c into main Jun 22, 2026
28 checks passed
@errfld
errfld deleted the gh-164/status-diagnostics-boundary branch June 22, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants