Skip to content

Default auto-doctor to --current so bare gx stays in this repo#410

Merged
NagyVikt merged 1 commit intomainfrom
agent/claude/auto-doctor-stay-current-repo-2026-04-24-00-25
Apr 23, 2026
Merged

Default auto-doctor to --current so bare gx stays in this repo#410
NagyVikt merged 1 commit intomainfrom
agent/claude/auto-doctor-stay-current-repo-2026-04-24-00-25

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by gx branch finish (PR flow).

Before: bare `gx` on a degraded repo auto-ran `gx doctor --target <root>`
which recursively walked every git repo it could find under the parent
directory (16 repos in the reported case) before returning control to
the user. That blew up a quick status check into a multi-minute repair
sweep across unrelated repos.

After: the auto-doctor path passes `--current` so it only repairs the
repo the user is actually standing in. Recursive repair stays available
explicitly via `gx doctor` (no `--current`).

Also bumps `@imdeadpool/guardex` to 7.0.30 so the fix ships.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NagyVikt NagyVikt merged commit 0840e4e into main Apr 23, 2026
@NagyVikt NagyVikt deleted the agent/claude/auto-doctor-stay-current-repo-2026-04-24-00-25 branch April 23, 2026 22:26
NagyVikt added a commit that referenced this pull request Apr 23, 2026
Bare `gx` already lists inactive companions (cavekit, caveman,
oh-my-codex, etc.) but stops at "run `gx setup`". This wires the
existing install pipeline into the default banner so the user gets
a single `[y/n]` prompt inline:

    [gitguardex] Missing companion tools: cavekit, caveman.
    Guardex needs … Install missing companion tools now?
    (npm i -g … && npx … ) [y/n]

On approval, `performCompanionInstall(...)` runs the same `npm i -g`
and local `npx` commands `gx setup` does today. Banner then re-runs
`collectServicesSnapshot()` so the final `Global services:` line and
`Next:` hint already reflect the installed tools.

New knobs:

- `GUARDEX_SKIP_COMPANION_PROMPT=1` fully disables the inline prompt
  (keeps the prior banner behavior verbatim).
- `GUARDEX_AUTO_COMPANION_APPROVAL=yes|no` (symmetric with the existing
  `GUARDEX_AUTO_UPDATE_APPROVAL`) lets non-interactive callers accept
  or decline without a TTY.

Non-interactive runs (`--json`, piped stdout, missing stdin TTY) without
the auto-approval env var skip the prompt so CI / tests / pipes stay
byte-compatible with the prior output.

Factoring:

- `src/toolchain/index.js` exports `performCompanionInstall` +
  `buildMissingCompanionInstallPrompt` so bare `gx` can run the install
  directly without the `gx setup` preamble ("Already installed globally: …").
- `src/cli/main.js` extracts service detection into
  `collectServicesSnapshot()` so the banner can refresh after an install.

Also updates `test/status.test.js` auto-doctor assertion to match the
`--current` upgrade from PR #410 (the regex was still pinned to the
pre-upgrade wording).

Bumps `@imdeadpool/guardex` to 7.0.31.

Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant