feat(cli): upgrade doctor to interactive resolution queue#51
Merged
JacksonFergusonDev merged 8 commits intomainfrom Feb 21, 2026
Merged
feat(cli): upgrade doctor to interactive resolution queue#51JacksonFergusonDev merged 8 commits intomainfrom
JacksonFergusonDev merged 8 commits intomainfrom
Conversation
Establishes a two-stage pipeline for `git pulsar doctor` by separating the diagnostic scanning phase from an interactive resolution phase. Introduces the `DoctorAction` dataclass to encapsulate actionable fixes and adds the execution loop at the end of the doctor routine.
Ports elementary system-level checks to the interactive resolution queue. Modifies registry cleanup to explicitly prompt before removing ghost directories. Adds prompts to install the background service if stopped, and to enable systemd user lingering on Linux if it is currently disabled.
Implements interactive resolutions for repository-specific issues during the diagnostic run. Adds auto-fixes for detected remote session drift (triggering a sync), resuming paused repositories, and a new check to identify and safely remove orphaned `.git/index.lock` files older than 2 hours.
Updates diagnostic reporting for Tier 2 issues that cannot be safely auto-fixed. Enhances warnings for SSH connectivity failures, large file blockers, and strict git hooks by providing explicit, copy-pasteable terminal commands and actionable resolution steps directly in the output.
Introduces test coverage for the two-stage interactive doctor pipeline. Validates that the execution loop respects user prompts (executing confirmed closures and bypassing declined ones). Adds specific coverage for Tier 1 auto-fixes (stale index lock removal, ghost registry cleanup, session drift syncing, and unpausing repositories) and verifies the exact stdout formatting for Tier 2 guided manual interventions (large files and strict git hooks).
Updates the tests/README.md to document the verification strategy for the new two-stage interactive doctor pipeline. Adds coverage descriptions for the Interactive Resolution Queue, auto-fix closures, and stdout formatting for guided manual interventions within `test_cli.py`.
Updates the `src/README.md` module map to document the two-stage interactive diagnostic pipeline within `cli.py`. Outlines the separation between the scanning phase and the interactive resolution queue, and introduces a new invariant guaranteeing explicit user confirmation before state-altering auto-fixes.
Updates the root README to reflect the completion of the "Active Doctor" roadmap item. Modifies the feature highlight and command reference for `git pulsar doctor` to note its new interactive auto-fix capabilities, maintaining a clean diff for surrounding context.
1312873 to
a679178
Compare
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.
Summary
This PR transitions
git pulsar doctorfrom a purely read-only diagnostic tool into a two-stage pipeline. To optimize for both safety and UX, the doctor now runs its standard silent diagnostic scans behind spinners (Stage 1), but instead of just printing warnings, it appends actionable fixes to an interactive resolution queue (Stage 2). At the end of the run, the user is explicitly prompted[y/N]to execute safe auto-fixes.This closes the Phase 1 roadmap item: "Active Doctor".
Key Changes
1. Two-Stage Pipeline Architecture (
cli.py)DoctorActiondataclass to encapsulate issue descriptions, prompt text, and execution closures.rich.console.status.2. Tier 1 Safe Auto-Fixes (Interactive)
The following issues now prompt the user for automatic resolution:
~/.local/state/git-pulsar/registry.service.install()if the daemon is stopped.loginctl enable-linger $USERif background lingering is disabled.git pulsar syncif a newer remote session is detected..git/pulsar_paused)..git/index.lockfiles older than 2 hours and safely prompts to delete them, resolving a classic git lockup state.3. Tier 2 Guided Manual Interventions (Read-Only)
For issues that require user context, the doctor now provides explicit, copy-pasteable resolution steps instead of generic warnings:
if [[ $GIT_REFLOG_ACTION == *"wip/pulsar"* ]]; then exit 0; fi) needed to bypass strictpre-commitorpre-pushhooks.git pulsar ignore <filename>) needed to bypass size limit blockers.ssh-agentkeys.Testing & Verification (
test_cli.py)yand bypassed onN.Documentation Updates
README.md: Marked "Active Doctor" as complete in the Phase 1 roadmap and updated the command reference.src/README.md: Updated the module map and added an architecture invariant guaranteeing explicit user confirmation before state-altering auto-fixes.tests/README.md: Documented the new interactive UI testing strategies.