Skip to content

refactor: UX improvements — reduce prompts and simplify doctor - #68

Merged
tonythethompson merged 28 commits into
masterfrom
refactor/ux-improvements
Aug 3, 2026
Merged

refactor: UX improvements — reduce prompts and simplify doctor#68
tonythethompson merged 28 commits into
masterfrom
refactor/ux-improvements

Conversation

@tonythethompson

@tonythethompson tonythethompson commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

UX improvements to reduce unnecessary prompts and simplify the doctor command.

Changes

Doctor Command Simplification

  • Removed --fix and --yes flags
  • Added --scan flag for report-only mode
  • New behavior:
    • numan doctor applies fixes by default
    • numan doctor --scan reports without fixing
  • Kept --json for structured output (works with both modes)
numan doctor                # apply fixes (default)
numan doctor --scan         # report only, no fixes
numan doctor --json         # apply fixes, JSON output
numan doctor --scan --json  # report only, JSON output

Removed --yes Flags

Removed --yes from commands where prompts were unnecessary:

  • install — routine operation, no prompt needed
  • activate — reversible operation, no prompt needed
  • deactivate — reversible operation, no prompt needed
  • try — starter install, no prompt needed

Updated nu_pin_offer

  • Removed auto_yes parameter from offer_managed_nu_pin()
  • Non-interactive mode prints hints and returns false (no auto-download)
  • Interactive mode still prompts for significant Nu version switch

Testing

  • All 414 tests pass
  • Clippy clean (-D warnings)
  • cargo fmt applied

Future Work

  • setup nu and setup loader still have --yes flags (not addressed due to complexity of overwrite scenarios)
  • Could simplify these in a follow-up PR

- doctor: removed --fix and --yes flags, added --scan for report-only mode
  - Default behavior now applies fixes automatically
  - --scan flag shows issues without applying fixes
  - Kept --json for structured output

- install: removed --yes flag (no prompt for routine install)

- activate: removed --yes flag (no prompt for reversible operation)

- deactivate: removed --yes flag (no prompt for reversible operation)

- try: removed --yes flag (no prompt for starter install)

- nu_pin_offer: removed auto_yes parameter from offer_managed_nu_pin()
  - Non-interactive mode prints hints and returns false
  - Interactive mode still prompts for significant Nu version switch

All 414 tests pass, clippy clean, fmt applied.

Note: setup nu and setup loader still have --yes flags (not addressed in this PR
due to complexity of overwrite scenarios). Future work could simplify these too.
Copilot AI review requested due to automatic review settings August 1, 2026 16:03

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @tonythethompson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8191487a-7cec-4d99-86c9-d7df6ec6a80b

📥 Commits

Reviewing files that changed from the base of the PR and between c5ef084 and 32f4944.

📒 Files selected for processing (8)
  • AGENTS.md
  • docs/numan-doctor.md
  • docs/snapshots-and-rollback.md
  • src/cmd/doctor.rs
  • src/cmd/init.rs
  • src/cmd/try_cmd.rs
  • src/state/snapshot.rs
  • tests/doctor_test.rs
📝 Walkthrough

Walkthrough

The CLI removes --yes confirmation handling from activation, deactivation, installation, doctor, and managed Nu flows. numan doctor now repairs by default, while --scan reports findings without mutation. Tests, hints, onboarding text, and documentation use the new behavior.

Changes

Confirmation removal across command flows

Layer / File(s) Summary
Activation and deactivation flow updates
src/cmd/activate.rs, src/cmd/deactivate.rs, src/cli.rs, tests/...
Removed confirmation fields and prompts. Deactivation reclassifies targets after lock acquisition and reports planning-time changes.
Doctor scan and repair semantics
src/cmd/doctor.rs, tests/doctor_test.rs
Replaced fix and yes with scan. Repairs run when scanning is disabled. JSON repair output is separated from stdout.
Managed Nu pin behavior
src/cmd/install.rs, src/cmd/nu_pin_offer.rs, src/cmd/try_cmd.rs
Removed automatic confirmation. Non-interactive sessions print setup instructions without downloading Nu.
Cross-platform output redirection
Cargo.toml, src/util/mod.rs, src/util/stdio_redirect.rs
Added an RAII guard that redirects stdout to stderr and restores stdout after JSON repairs.
Documentation and repair guidance
AGENTS.md, README.md, docs/numan-doctor.md, src/cmd/init.rs, src/util/hints.rs
Documented default repairs and --scan report-only output. Removed obsolete --fix and --yes instructions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main UX changes to reduce prompts and simplify the doctor command.
Description check ✅ Passed The description directly explains the doctor changes, removed confirmation flags, and updated Nu pin behavior.
Docstring Coverage ✅ Passed Docstring coverage is 86.81% which is sufficient. The required threshold is 60.00%.
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.
Pipeline Stage Enum Ordering ✅ Passed No SessionWorkflowStage enum or references to its listed members exist in the repository; the ordering check is not applicable to this pull request.
Gpu/Cpu Runtime Boundary ✅ Passed The full PR diff changes only Rust, documentation, and test files; no inference/, managed CPU/GPU requirements, main.py, or diarization boundary code is modified.
Managed Host Restart Safety ✅ Passed The patch changes only CLI imports and TryArgs documentation; no managed-host, container, readiness, lease, or restart code is present or modified.
✨ 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 refactor/ux-improvements
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/ux-improvements

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

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

UX: simplify doctor mode and remove unnecessary confirmation flags

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Make doctor apply safe repairs by default; add --scan for report-only mode
• Remove --yes prompts from reversible/routine commands (activate, deactivate, install, try)
• Tighten nu_pin_offer to never auto-download in non-interactive sessions; update tests
Diagram

graph TD
  A["CLI (numan)"] --> B["doctor cmd"] --> C["checks + report"]
  B["doctor cmd"] --> D["repairs (default)"] --> E["activate cmd"]
  D["repairs (default)"] --> F["deactivate cmd"]
  A["CLI (numan)"] --> G["install/try cmds"] --> H["nu_pin_offer"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep `doctor --fix` and add `--scan` (deprecate later)
  • ➕ Avoids a breaking behavior change for users who expect report-only by default
  • ➕ Allows gradual migration with warnings and docs
  • ➖ Extends the flag surface area and keeps the old mental model around longer
  • ➖ Delays UX simplification goal
2. Split doctor into explicit subcommands (`doctor scan` / `doctor fix`)
  • ➕ Clear, discoverable intent; avoids boolean-flag ambiguity
  • ➕ Easier to document and extend with future modes
  • ➖ Larger CLI change (docs, completions, muscle memory)
  • ➖ More code churn than a flag swap for this PR
3. Keep prompts but auto-confirm only in non-interactive sessions
  • ➕ Retains a safety gate for interactive users
  • ➕ Minimizes surprise when behavior changes
  • ➖ Continues “extra prompts” complaint in common interactive workflows
  • ➖ Harder to maintain consistent UX across commands

Recommendation: Current approach is reasonable if the project explicitly prioritizes reducing friction over preserving legacy defaults. The main risk is user surprise from doctor now mutating state by default; mitigate via clear help text/release notes and possibly a short-term warning when running without --scan in interactive sessions.

Files changed (7) +70 / -125

Enhancement (5) +55 / -98
activate.rsRemove '--yes' and make activation non-interactive +7/-11

Remove '--yes' and make activation non-interactive

• Drops the '--yes' flag from 'ActivateArgs' and removes the confirmation prompt before mutating state. Updates '--list' flag conflict rules and adjusts tests to construct args without 'yes'.

src/cmd/activate.rs

deactivate.rsRemove '--yes' and make deactivation non-interactive +17/-21

Remove '--yes' and make deactivation non-interactive

• Removes the '--yes' flag and skips the confirmation prompt after showing the consent table. Updates unit tests to reflect the new argument shape.

src/cmd/deactivate.rs

doctor.rsDefault doctor to apply repairs; add '--scan' report-only mode +25/-47

Default doctor to apply repairs; add '--scan' report-only mode

• Replaces '--fix/--yes' with '--scan', making repairs the default and scan-only the opt-out. Removes terminal-detection prompting logic so confirm-tier repairs always proceed, and updates repair calls to activate/deactivate without 'yes'. Updates output messaging and rewrites affected tests.

src/cmd/doctor.rs

install.rsRemove install '--yes' and simplify Nu pin offer call +2/-10

Remove install '--yes' and simplify Nu pin offer call

• Eliminates the '--yes' flag and stops passing an auto-confirm parameter into 'offer_managed_nu_pin'. Install now relies on explicit confirmation inside the offer flow only when interactive.

src/cmd/install.rs

try_cmd.rsRemove try '--yes'; align Nu pin offer + activation calls +4/-9

Remove try '--yes'; align Nu pin offer + activation calls

• Drops '--yes' from 'TryArgs' and updates the Nu pin offer invocation accordingly. Adjusts activation call sites and tests to build 'ActivateArgs' without a 'yes' field, and updates the test assertion message to match new semantics.

src/cmd/try_cmd.rs

Bug fix (1) +4 / -5
nu_pin_offer.rsRemove auto-yes pin installs; print hints in non-interactive mode +4/-5

Remove auto-yes pin installs; print hints in non-interactive mode

• Removes the 'auto_yes' parameter and clarifies behavior: non-interactive sessions only print guidance and return 'false' (no automatic managed Nu download). Updates hint text to remove '--yes' from suggested commands.

src/cmd/nu_pin_offer.rs

Tests (1) +11 / -22
doctor_test.rsUpdate doctor integration tests for '--scan' and default-repair behavior +11/-22

Update doctor integration tests for '--scan' and default-repair behavior

• Replaces 'fix/yes' combinations with the new 'scan' flag across doctor tests. Ensures report-only runs don’t mutate the root and repair-mode runs still perform expected layout/repair actions.

tests/doctor_test.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

It still produces/validates doctor fix hints that reference the removed --fix flag and the non-interactive Nu switch hint omits --yes, which can mislead or break non-interactive workflows.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR streamlines CLI UX by removing unnecessary confirmation flags/prompts and simplifying doctor into two modes: default “apply fixes” vs --scan report-only, aligning with Numan’s goal of reducing friction for routine/reversible operations.

Changes:

  • Simplifies numan doctor by removing --fix/--yes, adding --scan, and making repairs the default behavior.
  • Removes --yes from install, try, activate, and deactivate, and drops the “Proceed?” prompt while keeping informational consent tables.
  • Updates Nu pin offer flow to never auto-install in non-interactive sessions and to require explicit interactive confirmation.
File summaries
File Description
tests/doctor_test.rs Updates DoctorArgs usage to the new scan mode.
src/cmd/try_cmd.rs Removes --yes path and updates Nu pin offer + activation call sites accordingly.
src/cmd/nu_pin_offer.rs Removes auto_yes and makes non-interactive sessions hint-only (no auto-download).
src/cmd/install.rs Removes --yes and always uses interactive Nu pin offer behavior when applicable.
src/cmd/doctor.rs Implements --scan and default-repair behavior; removes --yes plumbing.
src/cmd/deactivate.rs Removes --yes and proceeds without prompting after showing consent table.
src/cmd/activate.rs Removes --yes and proceeds without prompting after showing consent table; updates clap conflicts.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread src/cmd/nu_pin_offer.rs Outdated
Comment thread src/cmd/doctor.rs
@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR inverts the default doctor mode (repairs run without flags; --scan opts into report-only), removes --yes from activate, deactivate, install, and try, and fixes several stale --yes hints that would have caused CLI errors for users following the printed recovery instructions. The confirm-tier logic is also corrected: previously non-TTY sessions would run confirm-tier repairs (counterintuitively running setup nu in CI); now confirm-tier requires an interactive TTY and is skipped with not_confirmed in non-TTY environments.

  • Doctor gains an injectable confirm_repairs seam in DoctorOptions, a StdoutToStderr RAII guard that keeps nested repair println! output off stdout during --json runs, and a pre-mutation Doctor snapshot before any repair executes.
  • init --refresh now unconditionally acquires the mutation lock (fixing a race when no packages were active) and creates a PreMutation/Init snapshot.
  • All previously flagged issues — stale assert!(args.yes) in test mocks, stale --yes hints in try_cmd.rs and update.rs, and the dead confirm_repairs function — are addressed.

Confidence Score: 5/5

Safe to merge. All previously reported blocking issues are addressed, the confirm-tier logic inversion is intentional and correct, and the new StdoutToStderr guard is well-implemented with a fork-isolated test.

Every changed code path has tests, including the new confirm-gate seam, the off-path repair regression guard, and the JSON stdout-cleanliness integration tests. The only finding is a cosmetic no-op fallback in a niche platform branch of the stdio redirect utility.

Files Needing Attention: src/util/stdio_redirect.rs — the non-Unix/non-Windows fallback silently skips the redirect; acceptable for now but worth a comment.

Important Files Changed

Filename Overview
src/cmd/doctor.rs Major refactor: --fix/--yes flags replaced by --scan (report-only); confirm-tier now gates on TTY presence instead of --yes; confirm_repairs injectable seam added to DoctorOptions; pre-mutation snapshot created before any repair; stdout redirected to stderr during JSON repair passes. Previously flagged dead-function/dead-branch issue resolved.
src/util/stdio_redirect.rs New file: RAII StdoutToStderr guard using dup/dup2 on Unix and SetStdHandle on Windows. Intentionally !Send + !Sync. Has a no-op fallback for non-Unix/non-Windows platforms (silently leaves JSON output unguarded on those targets). Fork-based unit test avoids corrupting parent process stdio.
src/cmd/nu_pin_offer.rs Removed auto_yes parameter; split into offer_managed_nu_pin (public) and offer_managed_nu_pin_with_tty (testing seam). Non-interactive path now always prints hints and returns false, consistent with updated semantics.
src/cmd/activate.rs Removed yes field from ActivateArgs and removed confirm_or_bail call; consent table is now informational only. conflicts_with_all on list simplified to conflicts_with after yes removal.
src/cmd/deactivate.rs Removed yes field from DeactivateArgs and removed confirm_or_bail call; reclassify_confirmed_targets renamed to reclassify_targets. Tests and error message updated consistently.
src/cmd/init.rs init --refresh now always acquires the mutation lock (fixes a race window when no packages were active) and creates a PreMutation/Init snapshot. New test refresh_without_active_packages_still_locks_and_snapshots verifies this behaviour.
tests/doctor_test.rs All fix/yes fields updated to scan: bool; stale assert!(args.yes) assertions corrected; test_doctor_options() now injects confirm_repairs_always so confirm-tier exercises run in CI; two new process-spawn integration tests verify JSON stdout cleanliness.
src/state/snapshot.rs Two new SnapshotTrigger variants: Doctor and Init, used by the new pre-mutation snapshots in doctor repairs and init --refresh.
src/cmd/try_cmd.rs Removed --yes flag from TryArgs; stale --yes hint in the --no-activate message replaced with the correct numan activate {package_id} (fixes the previously-flagged CLI error).
src/cmd/update.rs Four stale numan activate {} --yes hints replaced with numan activate {}, fixing the previously-flagged CLI errors users would hit when following error-recovery instructions.

Reviews (13): Last reviewed commit: "fix: harden doctor off-path skip test an..." | Re-trigger Greptile

Comment thread src/cmd/doctor.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52ad910c58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cmd/doctor.rs Outdated
Comment thread src/cmd/activate.rs
@qodo-code-review

qodo-code-review Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 17 rules
✅ REVIEW.md

Grey Divider


Action required

1. DeactivateArgs.yes compile breaks ✓ Resolved 🐞 Bug ≡ Correctness
Description
DeactivateArgs no longer has a yes field, but tests still access args.yes and build
DeactivateArgs { yes: true, ... }, which is a Rust compile-time error. This will break `cargo
test` and the doctor deactivate repair test seam.
Code

src/cmd/deactivate.rs[L42-44]

-    /// Skip confirmation prompts
-    #[arg(long)]
-    pub yes: bool,
Relevance

●●● Strong

Same as ActivateArgs: updating removed-field references is necessary to keep tests/build compiling.

PR-#66

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
DeactivateArgs is defined without yes, but the tests still reference that field directly and via
struct literals, which cannot compile.

src/cmd/deactivate.rs[37-45]
tests/doctor_test.rs[285-293]
tests/module_autoload_test.rs[181-188]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`DeactivateArgs` had its `yes` field removed, but tests still reference it (both in struct literals and via `args.yes`). This will not compile.

### Issue Context
Doctor’s injected `deactivate_repair` test fake must match the new `DeactivateArgs` shape.

### Fix Focus Areas
- src/cmd/deactivate.rs[37-45]
- tests/doctor_test.rs[285-293]
- tests/module_autoload_test.rs[181-188]

### Implementation notes
- Remove `assert!(args.yes);` in `fake_deactivate_repair` (replace with assertions that still make sense, e.g. `args.verbose == false` and packages match).
- Remove `yes: true` from all `DeactivateArgs { ... }` literals.
- Re-run `cargo test` to confirm all test crates compile.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. ActivateArgs.yes compile breaks ✓ Resolved 🐞 Bug ≡ Correctness
Description
ActivateArgs no longer has a yes field, but several tests still construct `ActivateArgs { yes:
true, ... }, which is a Rust compile-time error. This will break cargo test` (and any downstream
crate code building ActivateArgs literals).
Code

src/cmd/activate.rs[L28-30]

-    /// Skip confirmation prompts
-    #[arg(long)]
-    pub yes: bool,
Relevance

●●● Strong

Removing a struct field requires updating all struct literals; otherwise tests won’t compile.

PR-#66

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ActivateArgs is defined without yes, but multiple tests still try to set yes: true, which
cannot compile in Rust.

src/cmd/activate.rs[23-39]
tests/activate_test.rs[137-155]
tests/activate_test.rs[353-359]
tests/module_autoload_test.rs[170-178]
tests/nupm_compat_test.rs[542-548]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`ActivateArgs` had its `yes` field removed, but multiple tests still initialize that field. This will fail compilation.

### Issue Context
`ActivateArgs` is used as a public args struct across unit/integration tests; any remaining struct literal fields must match the struct definition.

### Fix Focus Areas
- tests/activate_test.rs[137-155]
- tests/activate_test.rs[353-359]
- tests/module_autoload_test.rs[170-178]
- tests/nupm_compat_test.rs[542-548]
- src/cmd/activate.rs[23-39]

### Implementation notes
- Remove the `yes: true` field from all `ActivateArgs { ... }` literals.
- Update any helper comments mentioning `--yes` for activate test helpers.
- Re-run `cargo test` to confirm all targets compile.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Stale activate --yes hints ✓ Resolved 🐞 Bug ≡ Correctness
Description
The PR removed the activate --yes flag, but several user-facing messages still instruct running
numan activate … --yes. Copy/pasting those hints will now fail with an unknown-argument error.
Code

src/cmd/activate.rs[L28-30]

-    /// Skip confirmation prompts
-    #[arg(long)]
-    pub yes: bool,
Relevance

●●● Strong

Team often accepts fixes to user-facing guidance to avoid broken flags/commands in copy-paste hints.

PR-#35
PR-#47
PR-#58

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Multiple output strings still mention activate --yes even though ActivateArgs (and thus the CLI)
no longer has a yes flag.

src/cmd/activate.rs[23-39]
src/cmd/try_cmd.rs[147-151]
src/cmd/update.rs[309-317]
src/cmd/update.rs[342-350]
src/cmd/update.rs[387-397]
src/cmd/update.rs[446-459]
src/nu/bootstrap.rs[707-712]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Activate no longer supports `--yes`, but runtime messages still recommend it.

### Issue Context
These strings are shown in common workflows (starter installs, update recovery, setup next-steps). They must match current CLI syntax.

### Fix Focus Areas
- src/cmd/try_cmd.rs[147-151]
- src/cmd/update.rs[309-317]
- src/cmd/update.rs[342-350]
- src/cmd/update.rs[387-397]
- src/cmd/update.rs[446-459]
- src/nu/bootstrap.rs[707-712]
- src/cmd/activate.rs[23-39]

### Implementation notes
- Replace `numan activate <pkg> --yes` with `numan activate <pkg>`.
- If the intent was “non-interactive”, consider mentioning `NUMAN_ROOT`/CI guidance separately, but don’t reference removed flags.
- Add/adjust tests (if any) that assert exact message strings.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Doctor docs/hints stale ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Doctor now applies fixes by default and uses --scan for report-only, but docs and canonical hint
strings still instruct users to run numan doctor --fix --yes and describe default report-only
behavior. Users following these instructions will hit unknown-flag errors and misunderstand the new
default semantics.
Code

src/cmd/doctor.rs[R44-46]

+    /// Scan only — report issues without applying fixes
    #[arg(long)]
-    pub fix: bool,
-
-    /// Skip confirmation prompts for confirm-tier repairs
-    #[arg(long)]
-    pub yes: bool,
+    pub scan: bool,
Relevance

●●● Strong

Docs and canonical hint strings drifting from CLI behavior are usually corrected to prevent user
confusion/unknown flags.

PR-#53
PR-#58
PR-#66

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
DoctorArgs now only has scan/json/nupm_home, but docs and hint constants still reference removed
flags and the old default behavior.

src/cmd/doctor.rs[42-55]
docs/numan-doctor.md[8-12]
docs/numan-doctor.md[22-40]
src/util/hints.rs[15-20]
README.md[269-274]
AGENTS.md[55-68]
src/cmd/init.rs[129-156]
src/state/journal.rs[36-41]
src/state/plugin_deactivate_journal.rs[35-40]
REVIEW.md[35-42]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Doctor’s CLI contract changed (`--fix/--yes` removed, `--scan` added, default behavior now mutates), but multiple docs and hint constants still describe the old interface.

### Issue Context
This repo treats docs and hint strings as part of the user contract (see REVIEW.md checklist).

### Fix Focus Areas
- docs/numan-doctor.md[8-12]
- docs/numan-doctor.md[22-40]
- src/util/hints.rs[15-20]
- README.md[269-274]
- AGENTS.md[55-68]
- src/cmd/init.rs[129-156]
- src/state/journal.rs[36-41]
- src/state/plugin_deactivate_journal.rs[35-40]
- REVIEW.md[35-42]

### Implementation notes
- Replace `--fix/--yes` references with the new model:
 - `numan doctor` (repairs by default)
 - `numan doctor --scan` (report-only)
 - `--json` remains.
- Update `CMD_DOCTOR_FIX` (and any tests asserting it) to the new recommended command.
- Ensure docs describe the new default-mutating behavior clearly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Prompting comments restate behavior ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
Several new/modified comments simply restate the adjacent code’s control flow (e.g., default fix
behavior and “no prompt”), rather than capturing non-obvious rationale. This reduces signal-to-noise
in code review and violates the project rule for comment content.
Code

src/cmd/doctor.rs[141]

+    // Apply fixes by default; --scan skips repairs (report-only mode).
Relevance

●● Moderate

Comment signal-to-noise is subjective; no clear precedent found for removing “restating behavior”
comments.

PR-#50
PR-#66

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2452624 requires comments to capture non-obvious rationale, not restate behavior.
The cited lines add/modify comments that narrate the immediately-adjacent logic (e.g., “--scan skips
repairs”, “no prompt”, “Apply fixes (default behavior)”), which is directly inferable from the code.

Rule 2452624: Restrict code comments to non-obvious rationale, not restating behavior
src/cmd/doctor.rs[141-141]
src/cmd/doctor.rs[1567-1567]
src/cmd/doctor.rs[1601-1601]
src/cmd/doctor.rs[1607-1607]
src/cmd/activate.rs[153-153]
src/cmd/deactivate.rs[145-145]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
New/modified comments restate behavior that is already obvious from the adjacent code, instead of documenting non-obvious rationale.

## Issue Context
The review checklist requires comments to focus on rationale/constraints rather than narrating the code.

## Fix Focus Areas
- src/cmd/doctor.rs[141-141]
- src/cmd/doctor.rs[1567-1567]
- src/cmd/doctor.rs[1601-1601]
- src/cmd/doctor.rs[1607-1607]
- src/cmd/activate.rs[153-153]
- src/cmd/deactivate.rs[145-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

6. Stale confirmation wording ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Deactivation no longer prompts, but the concurrent-change abort path still says “changed after
confirmation” and related tests assert that wording. This is now ambiguous/misleading because the
flow proceeds without an interactive confirmation step.
Code

src/cmd/deactivate.rs[R145-149]

+    // 5. Show consent table (informational only; no prompt)
    print_consent_table(&targets_requested, &nu_paths.plugin_registry_path);

-    crate::util::confirm::confirm_or_bail("Proceed?", args.yes, "Deactivation cancelled.")?;
+    // Proceed without prompting (UX improvement: reduce prompts for reversible operations).
Relevance

●●● Strong

They’ve accepted prior changes aligning diagnostics/hints with actual behavior to reduce misleading
UX wording.

PR-#47
PR-#58

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The execute flow explicitly says it proceeds without prompting, yet the abort message and test still
reference “confirmation.”

src/cmd/deactivate.rs[145-151]
src/cmd/deactivate.rs[504-515]
src/cmd/deactivate.rs[1562-1592]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The deactivate flow no longer has an interactive confirmation, but internal naming and error text still reference “confirmation,” which is confusing.

### Issue Context
The behavior (reclassify and abort if targets changed) can still be correct; the problem is the stale terminology.

### Fix Focus Areas
- src/cmd/deactivate.rs[145-151]
- src/cmd/deactivate.rs[504-515]
- src/cmd/deactivate.rs[1562-1592]

### Implementation notes
- Update the bail message to describe what actually happened, e.g.:
 - “Activation state changed since planning; no packages were deactivated. Retry to review current targets.”
- Consider renaming `reclassify_confirmed_targets` / related test names to remove “confirmed” if it no longer maps to a user confirmation step.
- Update the unit test assertion to match the new message.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread src/cmd/doctor.rs Outdated
Comment thread src/cmd/activate.rs
Comment thread src/cmd/deactivate.rs
Comment thread src/cmd/doctor.rs
Comment thread src/cmd/activate.rs
Comment thread src/cmd/deactivate.rs Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

✅ Committed (6) · ☑ Fixed (6)

Grey Divider

Commits pushed directly to this PR — no separate fix PR opened.

Process — 6 fixed
  • ☑ Fixed: DeactivateArgs.yes compile breaks
  • ☑ Fixed: ActivateArgs.yes compile breaks
  • ☑ Fixed: Stale activate --yes hints
  • ☑ Fixed: Doctor docs/hints stale
  • ☑ Fixed: Prompting comments restate behavior
  • ☑ Fixed: Stale confirmation wording

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread src/cmd/doctor.rs Outdated
Comment thread src/cmd/doctor.rs
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 1, 2026
@tonythethompson

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

tonythethompson and others added 7 commits August 2, 2026 18:08
Fixed 7 file(s) based on 4 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Replace a capturing closure with a Mutex-backed fn pointer for
discover_off_path, add a DoctorOptions confirm_repairs test seam so
non-TTY CI can exercise confirm-tier repairs, and align the off-PATH
setup helper with yes=false.

Co-authored-by: Anthony Thompson <github@trackdub.com>
Clarify doctor --json repairs docs and --help for --scan, force the
confirm_repairs seam in the off-PATH skip unit test, drop dead try --yes,
remove deactivate --yes from ignored active-update acceptance, and update
the activate no-prompt test comments.

Co-authored-by: Anthony Thompson <github@trackdub.com>
Redirect nested repair println! chatter to stderr during --json repair
passes via StdoutToStderr. Rename CMD_DOCTOR_FIX to CMD_DOCTOR (keep
alias) and add a subprocess regression test for parseable JSON stdout.

Co-authored-by: Anthony Thompson <github@trackdub.com>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 3, 2026
greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 3, 2026
greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 3, 2026
Bring std::io::IsTerminal into scope for doctor confirm_repairs so
stdin().is_terminal() compiles, and drop the blank line in TryArgs.

Co-authored-by: Anthony Thompson <github@trackdub.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/numan-doctor.md`:
- Around line 265-270: Fix the compilation error in src/cmd/doctor.rs by
bringing the std::io::IsTerminal trait into scope before calling
stdin().is_terminal(). Then rerun the required Format, Clippy, MSRV, Package,
and Ubuntu checks, and leave the definition-of-done checklist incomplete until
they pass.
- Line 31: Add a regression test in tests/doctor_test.rs covering the doctor
--json --scan invocation, parse the output as JSON, and assert that the repairs
field is omitted while preserving the documented single-object JSON contract.

In `@src/cmd/doctor.rs`:
- Around line 1023-1026: Replace the `confirm_repairs` TTY-only gate with real
confirmation for confirm-tier repairs, preserving `options.confirm_repairs` as
the override hook and ensuring direct mutations such as `nu_paths.refresh`,
`activation.reconcile`, and `plugin_deactivate.reconcile` do not run without
approval. Alternatively, if retaining TTY detection, rename the gate, report the
`not_confirmed` reason and remediation in the plain-text output near the
existing counts, and update `docs/numan-doctor.md` plus command help to document
that repairs are enabled by default only in interactive sessions.
- Around line 988-993: Add the std::io::IsTerminal trait import alongside the
existing std::io::Write import so confirm_repairs can resolve
stdin().is_terminal() and the crate compiles.

In `@src/cmd/try_cmd.rs`:
- Around line 446-456: Rename the test containing the shown
offer_managed_nu_pin_with_tty call to
offer_managed_nu_pin_non_interactive_refuses_silent_switch, replacing the
outdated name that includes “yes”; leave the test behavior unchanged.

In `@tests/doctor_test.rs`:
- Around line 549-570: Harden the doctor JSON test around the spawned `numan`
command: provide null stdin to make the confirmation path deterministic, disable
network-dependent repairs using the available CLI or environment controls (or
mark the test ignored for the acceptance suite if none exist), and assert that
`output.status` is successful before parsing stdout. Keep the existing JSON and
repairs assertions for successful, offline execution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d09f4785-6f7f-4782-8382-4184559238b8

📥 Commits

Reviewing files that changed from the base of the PR and between 0f775bc and 708b24e.

📒 Files selected for processing (15)
  • AGENTS.md
  • Cargo.toml
  • README.md
  • docs/numan-doctor.md
  • src/cli.rs
  • src/cmd/doctor.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/try_cmd.rs
  • src/util/hints.rs
  • src/util/mod.rs
  • src/util/stdio_redirect.rs
  • tests/activate_test.rs
  • tests/doctor_test.rs
  • tests/plugin_active_update_real_nu.rs
  • tests/support/acceptance/model.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Trackdubllc/Trackdub (manual)
  • tonythethompson/QuickShell (manual)
  • tonythethompson/numan (manual)
  • tonythethompson/dependency-chain-substrate (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Greptile Review
  • GitHub Check: Analyze (rust)
⚠️ CI failures not shown inline (4)

GitHub Actions: CI / Test (windows-latest): refactor: UX improvements — reduce prompts and simplify doctor

Conclusion: failure

View job details

##[group]Run rustup toolchain install stable --profile minimal --no-self-update
 �[36;1mrustup toolchain install stable --profile minimal --no-self-update�[0m
 shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_TERM_COLOR: always
   CARGO_HOME: C:\Users\runneradmin\.cargo
   RUSTUP_PERMIT_COPY_RENAME: 1
 ##[endgroup]
 info: syncing channel updates for stable-x86_64-pc-windows-msvc
 info: latest update on 2026-07-16 for version 1.97.1 (8bab26f4f 2026-07-14)
 info: removing previous version of component clippy
 info: removing previous version of component rustfmt
 info: removing previous version of component rust-std for target x86_64-pc-windows-gnu
 info: removing previous version of component rust-std for target i686-pc-windows-msvc
 info: removing previous version of component cargo
 info: removing previous version of component rust-std
 info: removing previous version of component rustc
 info: downloading 7 components
   stable-x86_64-pc-windows-msvc updated - rustc 1.97.1 (8bab26f4f 2026-07-14) (from rustc 1.97.0 (2d8144b78 2026-07-07))
 ##[error]The operation was canceled.

GitHub Actions: CI / Real-Nu acceptance (windows-latest): refactor: UX improvements — reduce prompts and simplify doctor

Conclusion: failure

View job details

##[group]Cache Configuration
 Cache Provider:
     github
 Workspaces:
     D:\a\numan\numan
 Cache Paths:
     C:\Users\runneradmin\.cargo\bin
     C:\Users\runneradmin\.cargo\.crates.toml
     C:\Users\runneradmin\.cargo\.crates2.json
     C:\Users\runneradmin\.cargo\registry
     C:\Users\runneradmin\.cargo\git
     D:\a\numan\numan\target
 Restore Key:
     v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a
 Cache Key:
     v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a-ee16a705
 .. Prefix:
   - v0-rust-real-nu-acceptance-Windows_NT-x64
 .. Environment considered:
   - Rust Versions:
     - 1.97.1 x86_64-pc-windows-msvc 8bab26f4f68e0e26f0bb7960be334d5b520ea452
     - 1.97.1 x86_64-pc-windows-msvc 8bab26f4f68e0e26f0bb7960be334d5b520ea452
   - CARGO_HOME
   - CARGO_INCREMENTAL
   - CARGO_TERM_COLOR
 .. Lockfiles considered:
   - D:\a\numan\numan\Cargo.lock
   - D:\a\numan\numan\Cargo.toml
 ##[endgroup]
 ... Restoring cache ...
 Cache hit for restore-key: v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a-6c16b325
 Received 192937984 of 231791840 (83.2%), 181.5 MBs/sec
 Received 231791840 of 231791840 (100.0%), 178.3 MBs/sec
 Cache Size: ~221 MB (231791840 B)
 [command]"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/d61898f6-1e7a-462d-b7f5-2b77df284772/cache.tzst -P -C D:/a/numan/numan --force-local --use-compress-program "zstd -d"
 ##[error]The operation was canceled.

GitHub Actions: CI / 3_Test (windows-latest).txt: refactor: UX improvements — reduce prompts and simplify doctor

Conclusion: failure

View job details

##[group]Run rustup toolchain install stable --profile minimal --no-self-update
 �[36;1mrustup toolchain install stable --profile minimal --no-self-update�[0m
 shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_TERM_COLOR: always
   CARGO_HOME: C:\Users\runneradmin\.cargo
   RUSTUP_PERMIT_COPY_RENAME: 1
 ##[endgroup]
 info: syncing channel updates for stable-x86_64-pc-windows-msvc
 info: latest update on 2026-07-16 for version 1.97.1 (8bab26f4f 2026-07-14)
 info: removing previous version of component clippy
 info: removing previous version of component rustfmt
 info: removing previous version of component rust-std for target x86_64-pc-windows-gnu
 info: removing previous version of component rust-std for target i686-pc-windows-msvc
 info: removing previous version of component cargo
 info: removing previous version of component rust-std
 info: removing previous version of component rustc
 info: downloading 7 components
   stable-x86_64-pc-windows-msvc updated - rustc 1.97.1 (8bab26f4f 2026-07-14) (from rustc 1.97.0 (2d8144b78 2026-07-07))
 ##[error]The operation was canceled.

GitHub Actions: CI / 1_Real-Nu acceptance (windows-latest).txt: refactor: UX improvements — reduce prompts and simplify doctor

Conclusion: failure

View job details

##[group]Cache Configuration
 Cache Provider:
     github
 Workspaces:
     D:\a\numan\numan
 Cache Paths:
     C:\Users\runneradmin\.cargo\bin
     C:\Users\runneradmin\.cargo\.crates.toml
     C:\Users\runneradmin\.cargo\.crates2.json
     C:\Users\runneradmin\.cargo\registry
     C:\Users\runneradmin\.cargo\git
     D:\a\numan\numan\target
 Restore Key:
     v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a
 Cache Key:
     v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a-ee16a705
 .. Prefix:
   - v0-rust-real-nu-acceptance-Windows_NT-x64
 .. Environment considered:
   - Rust Versions:
     - 1.97.1 x86_64-pc-windows-msvc 8bab26f4f68e0e26f0bb7960be334d5b520ea452
     - 1.97.1 x86_64-pc-windows-msvc 8bab26f4f68e0e26f0bb7960be334d5b520ea452
   - CARGO_HOME
   - CARGO_INCREMENTAL
   - CARGO_TERM_COLOR
 .. Lockfiles considered:
   - D:\a\numan\numan\Cargo.lock
   - D:\a\numan\numan\Cargo.toml
 ##[endgroup]
 ... Restoring cache ...
 Cache hit for restore-key: v0-rust-real-nu-acceptance-Windows_NT-x64-8af1e26a-6c16b325
 Received 192937984 of 231791840 (83.2%), 181.5 MBs/sec
 Received 231791840 of 231791840 (100.0%), 178.3 MBs/sec
 Cache Size: ~221 MB (231791840 B)
 [command]"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/d61898f6-1e7a-462d-b7f5-2b77df284772/cache.tzst -P -C D:/a/numan/numan --force-local --use-compress-program "zstd -d"
 ##[error]The operation was canceled.
🧰 Additional context used
📓 Path-based instructions (9)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Use anyhow::Result with .context("what failed") for application code, thiserror for library types callers match on, and avoid panics in library code by returning Result.

**/*.rs: Use Rust 2021 edition conventions and match existing naming, module layout, and documentation level in edited files.
Use anyhow::Result with .context(...) in application code; use thiserror for library error types that callers match on.
Use clap derive macros for CLI definitions.
Use serde with serde_json or toml for serialization.
Function parameters must use &Path, not &PathBuf.
Error paths must return anyhow::Result with context, and library code must not panic.
Unit tests must use injectable seams such as FakeCandidateRunner and registrars; do not spawn real nu in unit tests.
Real-Nu acceptance tests should be marked #[ignore] and run separately when activation or nupm-import behavior changes.
Every new mutating code path must acquire the mutation lock and snapshot the lockfile before writes.
Mutating commands, including install, remove, update, gc, and nupm import, must call acquire_mutation_lock(root).
Lockfiles, journals, and state files must be written atomically using write_json_atomic.
numan install must write only to $NUMAN_ROOT and must not invoke Nu or register plugins/autoloads.
Only activate and deactivate may modify Nu integration state.
Treat the lockfile as the authoritative source of truth; derived projections such as autoload state are not authoritative.
Install payloads must use versioned, content-addressed paths and must never be overwritten in place.
Never overwrite foreign autoload files; respect OWNERSHIP_MARKER.
Pass plugin paths through environment variables only; do not use runtime interpolation in Nu program strings.
The nupm boundary must remain read-only toward NUPM_HOME, must not execute build.nu, and must not perform bidirectional synchronization.

**/*.rs: Use Rust 2021 edition conventions a...

Files:

  • src/util/mod.rs
  • tests/plugin_active_update_real_nu.rs
  • tests/support/acceptance/model.rs
  • tests/activate_test.rs
  • src/util/hints.rs
  • src/cli.rs
  • src/cmd/try_cmd.rs
  • tests/doctor_test.rs
  • src/util/stdio_redirect.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,toml}: All changes must pass formatting and linting: cargo fmt and cargo clippy -- -D warnings.
Behavior changes require corresponding tests, including relevant failure paths.

Files:

  • src/util/mod.rs
  • tests/plugin_active_update_real_nu.rs
  • Cargo.toml
  • tests/support/acceptance/model.rs
  • tests/activate_test.rs
  • src/util/hints.rs
  • src/cli.rs
  • src/cmd/try_cmd.rs
  • tests/doctor_test.rs
  • src/util/stdio_redirect.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
**/*.{rs,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when changing structure, conventions, or user-visible behavior, using AGENTS.md, docs/, or command help as appropriate.

Files:

  • src/util/mod.rs
  • tests/plugin_active_update_real_nu.rs
  • README.md
  • AGENTS.md
  • tests/support/acceptance/model.rs
  • tests/activate_test.rs
  • src/util/hints.rs
  • src/cli.rs
  • src/cmd/try_cmd.rs
  • tests/doctor_test.rs
  • docs/numan-doctor.md
  • src/util/stdio_redirect.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Redact secrets when reporting relevant logs or lockfile excerpts in issues.

Files:

  • src/util/mod.rs
  • tests/plugin_active_update_real_nu.rs
  • Cargo.toml
  • README.md
  • AGENTS.md
  • tests/support/acceptance/model.rs
  • tests/activate_test.rs
  • src/util/hints.rs
  • src/cli.rs
  • src/cmd/try_cmd.rs
  • tests/doctor_test.rs
  • docs/numan-doctor.md
  • src/util/stdio_redirect.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Pass Nu executable paths and names only through NUMAN_PLUGIN_BINARY, NUMAN_PLUGIN_CONFIG, and NUMAN_PLUGIN_NAME; the Nu program must be a compile-time constant with no runtime interpolation.

Files:

  • src/util/mod.rs
  • src/util/hints.rs
  • src/cli.rs
  • src/cmd/try_cmd.rs
  • src/util/stdio_redirect.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Keep integration tests under tests/, unit tests inline with source modules, and use mock platforms for platform-specific behavior.

Files:

  • tests/plugin_active_update_real_nu.rs
  • tests/support/acceptance/model.rs
  • tests/activate_test.rs
  • tests/doctor_test.rs
Cargo.toml

📄 CodeRabbit inference engine (AGENTS.md)

Declare and preserve the project MSRV as Rust 1.88 via rust-version.

Files:

  • Cargo.toml
src/{cmd,state,install}/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Call create_snapshot() before mutations performed by install, update, remove, activate, deactivate, or nupm-import; garbage collection must treat payloads referenced by every snapshot as live roots.

Files:

  • src/cmd/try_cmd.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
src/cmd/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Keep clap subcommand handlers thin; delegate domain logic to core/ or installation logic to install/.

Files:

  • src/cmd/try_cmd.rs
  • src/cmd/nu_pin_offer.rs
  • src/cmd/doctor.rs
🪛 GitHub Actions: CI / 0_Test (ubuntu-latest).txt
src/cmd/doctor.rs

[error] 992-992: cargo test --verbose failed to compile numan-cli: method is_terminal is not found for std::io::Stdin because the required std::io::IsTerminal or is_terminal_polyfill::IsTerminal trait is not imported. Rust error E0599.

🪛 GitHub Actions: CI / 10_Package.txt
src/cmd/doctor.rs

[error] 992-992: cargo package --locked failed to verify the package: no method named is_terminal found for std::io::Stdin because the required IsTerminal trait is not in scope. Import std::io::IsTerminal or is_terminal_polyfill::IsTerminal.

🪛 GitHub Actions: CI / 11_Format.txt
src/cmd/try_cmd.rs

[error] 20-20: cargo fmt --all -- --check failed because the file is not formatted. Remove the extra blank line before the Install only; do not activate documentation comment.

🪛 GitHub Actions: CI / 4_MSRV (1.88).txt
src/cmd/doctor.rs

[error] 992-992: cargo +1.88 check --locked --all-targets failed: method is_terminal is unavailable for std::io::Stdin because the std::io::IsTerminal trait is not in scope. Import std::io::IsTerminal.

🪛 GitHub Actions: CI / 6_Real-Nu acceptance (macos-latest).txt
src/cmd/doctor.rs

[error] 992-992: cargo test compilation failed: no method named is_terminal found for std::io::Stdin. Import std::io::IsTerminal (or is_terminal_polyfill::IsTerminal) before calling std::io::stdin().is_terminal().

🪛 GitHub Actions: CI / 7_Clippy.txt
src/cmd/doctor.rs

[error] 992-992: cargo clippy -- -D warnings failed to compile: no method named is_terminal found for std::io::Stdin. Import the std::io::IsTerminal trait (or is_terminal_polyfill::IsTerminal) before calling std::io::stdin().is_terminal().

🪛 GitHub Actions: CI / 8_Real-Nu acceptance (ubuntu-latest).txt
src/cmd/doctor.rs

[error] 992-992: Rust compilation failed: no method named is_terminal found for std::io::Stdin because the required std::io::IsTerminal or is_terminal_polyfill::IsTerminal trait is not in scope. The cargo test --verbose -- --ignored --skip acceptance_process_helper --skip stage1_official_registry --skip real_nu_active_update_ command failed with exit code 101.

🪛 GitHub Actions: CI / 9_Test (macos-latest).txt
src/cmd/doctor.rs

[error] 992-992: cargo test --verbose failed to compile numan-cli: no method named is_terminal found for std::io::Stdin (E0599). Import std::io::IsTerminal or is_terminal_polyfill::IsTerminal.

🪛 GitHub Actions: CI / Clippy
src/cmd/doctor.rs

[error] 992-992: cargo clippy -- -D warnings failed: no method named is_terminal found for std::io::Stdin because the required std::io::IsTerminal trait is not in scope. Import std::io::IsTerminal.

🪛 GitHub Actions: CI / Format
src/cmd/try_cmd.rs

[error] 20-20: cargo fmt formatting check failed. Remove the extra blank line before the 'Install only; do not activate' documentation comment, then rerun 'cargo fmt --all -- --check'.

🪛 GitHub Actions: CI / MSRV (1.88)
src/cmd/doctor.rs

[error] 992-992: cargo +1.88 check --locked --all-targets failed: no method named is_terminal found for std::io::Stdin (Rust E0599). Import the std::io::IsTerminal trait.

🪛 GitHub Actions: CI / Package
src/cmd/doctor.rs

[error] 992-992: cargo package --locked failed to verify the package: Rust error E0599, no method named 'is_terminal' found for 'Stdin'. Import the 'std::io::IsTerminal' trait (or the suggested polyfill) before calling std::io::stdin().is_terminal().

🪛 GitHub Actions: CI / Real-Nu acceptance (macos-latest)
src/cmd/doctor.rs

[error] 992-992: cargo test --verbose failed to compile: std::io::stdin().is_terminal() requires the std::io::IsTerminal trait to be imported. Add use std::io::IsTerminal;.

🪛 GitHub Actions: CI / Real-Nu acceptance (ubuntu-latest)
src/cmd/doctor.rs

[error] 992-992: cargo test compilation failed: no method named is_terminal found for std::io::Stdin because the std::io::IsTerminal trait is not in scope. Import std::io::IsTerminal (or is_terminal_polyfill::IsTerminal) to fix this error.

🪛 GitHub Actions: CI / Test (macos-latest)
src/cmd/doctor.rs

[error] 992-992: cargo test --verbose failed to compile numan-cli: no method named 'is_terminal' found for 'std::io::Stdin' because the required trait is not in scope. Import 'std::io::IsTerminal' or 'is_terminal_polyfill::IsTerminal'.

🪛 GitHub Actions: CI / Test (ubuntu-latest)
src/cmd/doctor.rs

[error] 992-992: cargo test --verbose failed to compile numan-cli: no method named is_terminal found for std::io::Stdin (Rust error E0599). Import std::io::IsTerminal or is_terminal_polyfill::IsTerminal.

🔍 Remote MCP GitHub Copilot

Additional review context

  • Build is currently broken: src/cmd/doctor.rs calls std::io::stdin().is_terminal() but imports only std::io::Write; the IsTerminal trait is not in scope. This likely explains the failed Format, Clippy, MSRV, Package, and Ubuntu test checks.
  • CI is not green: Ubuntu tests and real-Nu acceptance failed; MSRV, Package, Clippy, and Format failed. Windows/macOS jobs were cancelled, and Rust analysis remained in progress at retrieval time.
  • doctor --json redirects process-global stdout using dup2 on Unix and SetStdHandle on Windows. The implementation explicitly notes this is process-global and unsafe with concurrent use, so this utility should remain confined to the synchronous repair section as currently intended.
🔇 Additional comments (22)
src/cmd/nu_pin_offer.rs (2)

48-49: LGTM!


21-23: 🎯 Functional Correctness

No caller still passes auto_yes. All callers use the updated API.

			> Likely an incorrect or invalid review comment.
src/cmd/try_cmd.rs (1)

22-23: LGTM!

Also applies to: 93-93, 149-156

src/cmd/doctor.rs (4)

134-136: LGTM!


1004-1020: LGTM!


1490-1496: LGTM!

Also applies to: 1596-1612, 1960-1977, 2229-2284


1096-1100: 🩺 Stability & Availability

Keep yes: false for this repair path. TTY confirmation occurs before managed-install removal. Non-TTY execution fails with a readable error, and doctor records that error as Failed.

tests/doctor_test.rs (1)

46-50: LGTM!

Also applies to: 430-444

Cargo.toml (1)

79-82: LGTM!

src/util/mod.rs (1)

5-5: LGTM!

src/util/stdio_redirect.rs (2)

39-126: LGTM!

Also applies to: 128-223


31-37: 📐 Maintainability & Code Quality

No change required. unsafe extern "system" is compatible with edition 2021 and the declared Rust 1.88 MSRV.

src/cli.rs (1)

39-41: LGTM!

Also applies to: 57-57

tests/activate_test.rs (1)

25-25: LGTM!

Also applies to: 139-139, 148-148, 352-352, 608-610, 624-631

tests/support/acceptance/model.rs (1)

94-98: LGTM!

tests/plugin_active_update_real_nu.rs (1)

178-178: 📐 Maintainability & Code Quality

Confirm the dedicated acceptance job runs this ignored test separately.

real_nu_active_update_resume_lockfile_updated_reactivates is marked #[ignore], but the acceptance-job configuration remains unknown.

AGENTS.md (2)

57-57: Update the doctor test entry in AGENTS.md.

Line 112 still describes tests/doctor_test.rs as covering the --fix auto tier. The current contract is default repairs with --scan for report-only mode. Update Line 112 to match Line 57.

As per coding guidelines, update documentation when changing user-visible behavior.

Source: Coding guidelines


67-67: LGTM!

docs/numan-doctor.md (2)

25-30: Remove the remaining --fix references from the doctor specification.

The invocation table is correct, but this document still mentions --fix at Lines 55, 118, 119, and 165. Replace those references with default repair or --scan wording. Otherwise, the specification defines two CLI contracts.

As per coding guidelines, update documentation when changing user-visible behavior.

Source: Coding guidelines


8-10: LGTM!

Also applies to: 34-37, 66-84, 98-98, 205-208, 272-278

README.md (1)

272-273: LGTM!

Also applies to: 311-311, 339-355

src/util/hints.rs (1)

18-22: LGTM!

Also applies to: 127-127, 305-305

Comment thread docs/numan-doctor.md
Comment thread docs/numan-doctor.md
Comment thread src/cmd/doctor.rs
Comment thread src/cmd/doctor.rs
Comment thread src/cmd/try_cmd.rs
Comment thread tests/doctor_test.rs
Document confirm-tier as a TTY allow-gate, print not_confirmed
remediation in plain-text output, harden doctor --json spawn tests,
add --json --scan repairs-omitted coverage, and rename the stale
try_cmd pin-offer unit test.

Co-authored-by: Anthony Thompson <github@trackdub.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/cmd/doctor.rs (2)

2229-2284: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make the off-PATH regression test observe the repair.

test_noop_setup_repair cannot detect a setup invocation because it does nothing. The test also discards the execute_with_options result. It can pass when setup runs or when execution fails before repair dispatch. Use a call-counting seam, require successful execution, assert that nu.binary.found_off_path is Skipped, and then assert that managed_binary still exists.

As per coding guidelines: “Behavior changes require corresponding tests, including relevant failure paths.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/doctor.rs` around lines 2229 - 2284, Update
doctor_found_off_path_repair_preserves_managed_install_when_not_confirmed to use
a call-counting setup seam instead of test_noop_setup_repair, require
execute_with_options to succeed, and assert the nu.binary.found_off_path result
is Skipped before verifying managed_binary still exists. Ensure the test fails
if repair dispatch occurs or execution errors before repair handling.

Source: Coding guidelines


145-145: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Add a snapshot before doctor repairs.

apply_repairs acquires the mutation lock but never creates a snapshot. init::execute_refresh also skips the lock when no active packages exist and never creates a snapshot before writing the lockfile, autoload state, and Nu paths. Add an unconditional lock and pre-mutation snapshot before these writes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cmd/doctor.rs` at line 145, Update the repair and refresh flows around
apply_repairs and init::execute_refresh to unconditionally acquire the mutation
lock and create a pre-mutation snapshot before writing any repair changes,
lockfiles, autoload state, or Nu paths; do not skip this protection when no
active packages exist.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/cmd/doctor.rs`:
- Around line 2229-2284: Update
doctor_found_off_path_repair_preserves_managed_install_when_not_confirmed to use
a call-counting setup seam instead of test_noop_setup_repair, require
execute_with_options to succeed, and assert the nu.binary.found_off_path result
is Skipped before verifying managed_binary still exists. Ensure the test fails
if repair dispatch occurs or execution errors before repair handling.
- Line 145: Update the repair and refresh flows around apply_repairs and
init::execute_refresh to unconditionally acquire the mutation lock and create a
pre-mutation snapshot before writing any repair changes, lockfiles, autoload
state, or Nu paths; do not skip this protection when no active packages exist.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8856128d-6691-477f-b6df-a9cd061fd196

📥 Commits

Reviewing files that changed from the base of the PR and between 708b24e and c5ef084.

📒 Files selected for processing (2)
  • src/cmd/doctor.rs
  • src/cmd/try_cmd.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Trackdubllc/Trackdub (manual)
  • tonythethompson/QuickShell (manual)
  • tonythethompson/numan (manual)
  • tonythethompson/dependency-chain-substrate (manual)
💤 Files with no reviewable changes (1)
  • src/cmd/try_cmd.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Greptile Review
  • GitHub Check: Real-Nu acceptance (windows-latest)
  • GitHub Check: Test (windows-latest)
  • GitHub Check: Analyze (rust)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Use anyhow::Result with .context("what failed") for application code, thiserror for library types callers match on, and avoid panics in library code by returning Result.

**/*.rs: Use Rust 2021 edition conventions and match existing naming, module layout, and documentation level in edited files.
Use anyhow::Result with .context(...) in application code; use thiserror for library error types that callers match on.
Use clap derive macros for CLI definitions.
Use serde with serde_json or toml for serialization.
Function parameters must use &Path, not &PathBuf.
Error paths must return anyhow::Result with context, and library code must not panic.
Unit tests must use injectable seams such as FakeCandidateRunner and registrars; do not spawn real nu in unit tests.
Real-Nu acceptance tests should be marked #[ignore] and run separately when activation or nupm-import behavior changes.
Every new mutating code path must acquire the mutation lock and snapshot the lockfile before writes.
Mutating commands, including install, remove, update, gc, and nupm import, must call acquire_mutation_lock(root).
Lockfiles, journals, and state files must be written atomically using write_json_atomic.
numan install must write only to $NUMAN_ROOT and must not invoke Nu or register plugins/autoloads.
Only activate and deactivate may modify Nu integration state.
Treat the lockfile as the authoritative source of truth; derived projections such as autoload state are not authoritative.
Install payloads must use versioned, content-addressed paths and must never be overwritten in place.
Never overwrite foreign autoload files; respect OWNERSHIP_MARKER.
Pass plugin paths through environment variables only; do not use runtime interpolation in Nu program strings.
The nupm boundary must remain read-only toward NUPM_HOME, must not execute build.nu, and must not perform bidirectional synchronization.

**/*.rs: Use Rust 2021 edition conventions; ...

Files:

  • src/cmd/doctor.rs
src/{cmd,state,install}/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Call create_snapshot() before mutations performed by install, update, remove, activate, deactivate, or nupm-import; garbage collection must treat payloads referenced by every snapshot as live roots.

Files:

  • src/cmd/doctor.rs
src/cmd/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Keep clap subcommand handlers thin; delegate domain logic to core/ or installation logic to install/.

Files:

  • src/cmd/doctor.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,toml}: All changes must pass formatting and linting: cargo fmt and cargo clippy -- -D warnings.
Behavior changes require corresponding tests, including relevant failure paths.

Files:

  • src/cmd/doctor.rs
**/*.{rs,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update documentation when changing structure, conventions, or user-visible behavior, using AGENTS.md, docs/, or command help as appropriate.

Files:

  • src/cmd/doctor.rs
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Redact secrets when reporting relevant logs or lockfile excerpts in issues.

Files:

  • src/cmd/doctor.rs
src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Use #[cfg(target_env)]-based platform detection from the binary build target rather than runtime platform constants.

Files:

  • src/cmd/doctor.rs
🔍 Remote MCP GitHub Copilot

Additional review context

  • The PR is #68, currently open and marked mergeable_state: blocked; its CodeRabbit status is pending, while most CI checks currently pass. Windows tests and real-Nu acceptance remain in progress.
  • Issues #76 and #77 independently concluded that activate and deactivate are reversible, journaled, ownership-guarded operations and should retain their confirmation prompts and --yes flags. This conflicts directly with removing those flags in this PR.
  • The PR’s current src/cmd/doctor.rs includes std::io::IsTerminal, so the previously reported missing-trait compile issue is not present on PR #68’s current head.
  • Follow-up PR #79 describes this work as a doctor-UX follow-up and records additional decisions around snapshots, off-PATH repairs, and non-interactive behavior; it may represent the intended resolution path for findings from #68.
🔇 Additional comments (3)
src/cmd/doctor.rs (3)

988-992: Duplicate: non-interactive repair gating and reporting remain unresolved.

The TTY-only approval, removed nested yes overrides, and count-only skipped-repair output are covered by the previous review comment for Lines 1023-1026. Keep this finding linked to that comment.

Also applies to: 1004-1026, 1259-1260, 1316-1317, 1455-1456


5-5: LGTM!

Also applies to: 47-47, 136-136, 1490-1496, 1540-1540, 1557-1557, 1597-1612, 1632-1638, 1656-1656, 1670-1670, 1688-1688, 1717-1717, 1781-1781, 1850-1850, 1935-1935, 1960-1974, 1987-1987, 2045-2045, 2087-2087, 2128-2128, 2167-2167, 2210-2210


1098-1100: 🎯 Functional Correctness

No change required. confirm_repairs only allows confirm-tier repairs in a TTY; it does not collect user consent. The nested setup call correctly performs the actual prompt, and non-interactive doctor runs skip the repair before setup executes.

			> Likely an incorrect or invalid review comment.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 3, 2026
Require a call-counting setup seam and not_confirmed Skipped record for
found_off_path when confirm-tier is closed. Always lock and PreMutation-
snapshot init --refresh (even with no active packages) and doctor repair
passes before writes.

Co-authored-by: Anthony Thompson <github@trackdub.com>
@tonythethompson
tonythethompson merged commit edf105d into master Aug 3, 2026
21 checks passed
@tonythethompson
tonythethompson deleted the refactor/ux-improvements branch August 3, 2026 02:23
@linear-code

linear-code Bot commented Aug 3, 2026

Copy link
Copy Markdown

NUM-47

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.

3 participants