Repository navigation
The preflight offers to install what is missing, starts the login, and --doctor runs just that (#59) - #62
Conversation
…d --doctor runs just that (#59) Brett Heap, 2026-09-05, after walking through the eight steps a new Mac user takes: "why not have an install program that will do all this? so the user gets our program and then runs that and we do all this?" then "yes" to this design. Two of those steps were already the program; the other four were commands the preflight NAMED and then left the user to type. Now it asks. setup-project.py: an offer table keyed by tool and platform, first row whose package manager is on PATH wins — xcode-select --install (Apple's dialog; the tool says run again when it finishes and stops), apt-get/dnf for git, brew install gh or the brew.sh link (Homebrew's installer is never run by us), the README's own apt and dnf blocks byte for byte, winget for git and gh, then gh auth login, then gh auth setup-git. Each is one typed yes, mirroring the scaffold's own prompt; --yes never answers an offer; no terminal means no prompt and today's refusal; EOF is no; re-check once. A too-old Python gets text only, because an install cannot change the interpreter already running. A missing credential helper is a warning plus an offer, never a refusal. --doctor runs the preflight with its offers and stops: exit 0 when everything is present and gh is authenticated (or --local-remote-dir is given), else 1. It returns before the git probe, the checkout probe and the org handshake, so it needs no --org and never clones the standard. The openRepoShape command forwards it without asking for an organisation or a project. setup.sh: a bare Mac fails in find_python before the shim's git probe, so both refusals gain a Darwin-only sentence pointing at xcode-select --install. Text only, bash 3.2 clean, otherwise byte-identical to #60. README § Quick start leads with "run it; it offers the rest, or --doctor first" and keeps the per-platform paragraphs as the reference for what the offers run. AGENTS.md: an assistant never answers the install, login or credential-helper prompt; the human types it. Caps 948 -> 967 and 273 -> 277. Tests (+20), all with a fake runner and a fake which so nothing is ever executed: the table per platform, a refused offer, no TTY, --yes does not install, --doctor exit codes, README <-> table parity, the command forwards --doctor, the shim's Darwin sentence. 611 pass on Linux. Adversarial Opus review before opening proved the CI-safety claim over a real pty and folded in four fixes (the AGENTS.md rule names all three prompts; the shim-flag allowance is tied to its one string; a rationale count; a usage-line assertion). Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 13 hours and 30 minutes by commenting @sourcery-ai review. Upgrade to get a review now.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's GuideThe PR turns preflight into a consent-driven, platform-aware setup assistant for missing Git, gh, login, and credential configuration, adds a non-scaffolding Sequence diagram for preflight installation offerssequenceDiagram
participant User
participant Preflight
participant PackageManager
participant Tool
Preflight->>Preflight: _check_git()
alt Git is missing and terminal is attached
Preflight->>User: offer(command)
User-->>Preflight: Type yes
Preflight->>PackageManager: run_command_text(install command)
PackageManager-->>Preflight: return code
Preflight->>Preflight: re-check Git once
else Offer declined or no terminal
Preflight-->>User: Keep existing failure and exit behavior
end
Preflight->>Preflight: _check_gh()
alt gh is missing
Preflight->>User: offer(command)
User-->>Preflight: Type yes
Preflight->>PackageManager: run_command_text(install command)
PackageManager-->>Preflight: return code
Preflight->>Preflight: Re-check gh once
else gh is unauthenticated
Preflight->>User: offer(gh auth login)
User-->>Preflight: Type yes
Preflight->>Tool: gh auth login
Tool-->>User: Interactive login and browser flow
Preflight->>Tool: gh auth status
end
Flow diagram for the --doctor diagnostic pathflowchart TD
A["--doctor"] --> B["preflight_checks(opts)"]
B --> C["Check Git, Python, bootstrap, and gh"]
C --> D{"Missing item has an install offer?"}
D -- Yes --> E["Ask for typed yes and run offer"]
D -- No --> F["Keep diagnostic failure"]
E --> G["Re-check once"]
F --> H["Compute readiness"]
G --> H
H --> I{"All required checks pass?"}
I -- Yes --> J["Exit 0; nothing was created"]
I -- No --> K["Exit 1; nothing was created"]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🔵 Needs a closer look
It adds new interactive “run install/login commands” execution paths that can directly affect user machines, so it warrants final human review despite strong test coverage.
Pull request overview
This PR implements the “guided preflight” experience: when prerequisites are missing and an interactive terminal is attached, setup-project.py offers to run the documented platform install/login commands (with explicit per-action consent), and introduces a --doctor mode that runs preflight+offers and then stops without scaffolding.
Changes:
- Add an install/offer table plus prompting + execution helpers in
setup-project.py, includinggh auth login/gh auth setup-gitoffers and a new--doctorearly-exit path. - Update the
openRepoShapewrapper andsetup.shshim to support--doctorand improve bare-macOS guidance (Command Line Tools hint). - Expand tests and docs to lock README↔offer parity, consent/TTY behavior, and
--doctorexit semantics; update AGENTS.md with the “never answer install/login prompts” rule.
File summaries
| File | Description |
|---|---|
| tests/test_setup_project_py.py | Adds extensive unit coverage for offer behavior, credential-helper warnings, and --doctor. |
| tests/test_repo_hygiene.py | Updates doc-length caps and enforces README↔offer-command parity; improves Windows py … checks. |
| tests/test_openreposhape_command.py | Adds --doctor usage assertions and passthrough behavior tests. |
| setup.sh | Adds macOS Command Line Tools hinting in refusals (text-only) for bare machines. |
| setup-project.py | Implements offer table, prompting/execution, credential-helper warning+offer, and --doctor. |
| README.md | Documents the new guided preflight behavior and --doctor, and aligns commands (incl. winget -e). |
| openRepoShape | Adds --doctor flag handling to avoid org/project prompting while still forwarding args. |
| AGENTS.md | Adds rule forbidding assistants from answering install/login/setup-git prompts. |
Review details
Suppressed comments (1)
setup.sh:79
- This refusal message concatenates the documentation URL and
$MAC_TOOLSwith no separator, producing output likehttps://git-scm.com/downloads On a Mac, ...that reads like a malformed URL. Add a sentence separator and strip the leading space from$MAC_TOOLSat the use site.
command -v git >/dev/null 2>&1 || die "git is not installed. Install it: https://git-scm.com/downloads$MAC_TOOLS"
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return 1 | ||
| } | ||
| PY="$(find_python)" || die "no Python 3.9 or newer on this machine (tried python3, python). Install Python 3.9 or newer and re-run: https://www.python.org/downloads/" | ||
| PY="$(find_python)" || die "no Python 3.9 or newer on this machine (tried python3, python). Install Python 3.9 or newer and re-run: https://www.python.org/downloads/$MAC_TOOLS" |
There was a problem hiding this comment.
Taken, in 610363c. The Mac sentence now starts on its own line, indented two spaces under the refusal, so the URL stands alone: bash 3.2-safe $'...' quoting, words unchanged, and die prints with printf '%s' so the newline is real. Both call sites render the same way.
Lane: xfactory-2 (xFactory-2)
…ot on #62) Copilot's one finding on PR #62: the Darwin-only Command Line Tools sentence ran straight on from the python.org or git-scm URL on the same line. It now begins with a newline and a two-space indent, so the URL stands alone and the sentence reads underneath it. Bash 3.2-safe $'...' quoting; the words are unchanged; `die` prints with printf '%s' so the newline is real. No test asserted the old separator. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
There was a problem hiding this comment.
🔵 Needs a closer look
Several user-facing messages/docs claim --doctor “creates nothing” even though --doctor can run installers (and the wrapper path creates a temporary checkout), so wording should be corrected for accuracy.
Review details
Suppressed comments (5)
Previously missed (3) — in code that hasn't changed since the last review.
README.md:116
- This paragraph says
--doctorruns "creating nothing", but--doctorcan run install commands (and the openRepoShape entry point self-bootstraps a temporary checkout). Consider rephrasing to "creating no repositories" to match actual behavior.
This issue also appears on line 269 of the same file.
openRepoShape:41
- The usage line says
--doctor"creates nothing", but--doctorcan offer to run installers; clarify that it creates no repositories (i.e., does not scaffold) rather than implying it makes no system changes.
setup-project.py:154 --doctorcan run install/login/setup commands (after a typedyes), so describing it as "Creates nothing" is misleading; it should be phrased as "creates no repositories" (or similar) to avoid implying it makes no system changes.
This issue also appears on line 1138 of the same file.
setup-project.py:1138
- The
--doctoroutput says "nothing was created", but a doctor run may execute installers (and when invoked via setup.sh/openRepoShape it also creates a temporary checkout). Wording like "no repositories were created" is accurate in all cases.
say(" nothing was created; this checked the machine only.")
README.md:270
- This sentence says
--doctor"creates nothing", but--doctorcan run installer commands after consent; consider clarifying to "creates no repositories" (i.e., it does not scaffold) to avoid implying no system changes.
Or run `openRepoShape --doctor`, which checks this machine, offers what is
missing and creates nothing.
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Lite



Lane: xfactory-2 (xFactory-2)
Claim: #59 (claim in the issue body)
Closes #59.
What this changes
The preflight offers to install what is missing, starts the login, and
--doctorruns just that. Brett Heap, 2026-09-05, in session, after walking through the eight steps a new Mac user takes: "why not have an install program that will do all this? so the user gets our program and then runs that and we do all this?" → "yes" to this design. Steps 5 and 7 of that walk were already the program; steps 1–4 were commands the preflight NAMED and then left the user to type. Now it asks.setup-project.pyonly. When a check fails and a terminal is attached, the preflight prints the platform's install command and asks once —Run \brew install gh` now? Type yes to continue:— runs it onyes, re-checks once, and continues. Anything else leaves today's text and today's exit code. The table (INSTALL_OFFERS, keyed by tool andsys.platform, first row whose package manager is on PATH wins): git →xcode-select --installon macOS (Apple's dialog; the tool says "run this again when it has finished" and stops, no re-check),sudo apt-get install -y git/sudo dnf install -y git,winget install --id Git.Git -e; gh →brew install ghwhen brew is present (no brew: the brew.sh link and stop — **Homebrew's installer is never run by us**), the README's own apt and dnf blocks byte for byte,winget install --id GitHub.cli -e; thengh auth login; thengh auth setup-git. A too-old Python gets text only (an install cannot change the interpreter already running);make` stays optional and unoffered; an unrecognised platform gets today's text.--yes.--yesskips the one scaffold question and cannot answer an offer. No terminal → no prompt, today's refusal. EOF on the prompt is "no". Nothing in the test suite has a terminal, and every offer in the tests runs against a fake runner and a fakewhich, so CI cannot execute an installer on any platform.gh auth login, attached to the user's terminal; the browser half is theirs. gh authenticated but git has no credential helper at all (neithercredential.https://github.com.helpernorcredential.helper) → a[??]warning and an offer ofgh auth setup-git, never a refusal: keychain, Windows credential manager and SSH remotes all work without gh's helper.--doctor. Preflight with its offers, then stop: exit 0 when everything is present and gh is authenticated (or--local-remote-diris given), 1 otherwise. It returns before the git probe and the checkout probe, so it needs no--organd never clones the standard.openRepoShape --doctorforwards it without asking for an organisation or a project;py setup-project.py --doctoron Windows.setup.shneeded no change for the flag.xcode-select --install, which supplies git, make and a python3. Text only, no prompt, bash 3.2 clean; the shim is otherwise byte-identical to setup.sh is a shim over setup-project.py: the flow exists once (#50) #60.--doctorfirst" and keeps the per-platform paragraphs as the reference for what the offers run;winget … -enow matches the table.AGENTS.mdgains the rule that an assistant never answers an install prompt — the human types it, exactly as for the repository-creation prompt.--yesdoes not install,--doctorexit codes with and without--local-remote-dir, README ↔ table parity (the fenced apt/dnf blocks and the one-line commands are the same bytes), the command forwards--doctorwithout an org, the shim's Darwin sentence, pure-ASCII still holds. One hygiene regex relaxed from single-match to all-match because the README now carriespy setup-project.pytwice.Adversarial Opus review before opening: proved the CI-safety claim live over a real pseudo-terminal (EOF at the prompt is "no";
--yeswith gh missing still asks; every offer in the tests runs against a fake runner and a fakewhich; the four new subprocess tests all go through the stdin-closing harnesses), AST-walked the offer table (every command is a string literal; nothing user-controlled can reachbash -c), and confirmed--doctorreturns before the git probe, the checkout probe and the org handshake by position. Four fixes folded in: the AGENTS.md rule now names all three prompts (install,gh auth login,gh auth setup-git), not installs alone; the shim-flag test's allowance is tied toxcode-select --installso a re-grown--install)case would still fail it; a README-rationale count corrected; the command's new usage line is asserted. Residual, stated:openRepoShape --doctoron a real machine still self-bootstraps a temp checkout of the standard first (git and network), as the design accepted;py setup-project.py --doctorclones nothing.Known and deliberately left. gh's own "is this our helper" rule is not transcribed: under the rule above any helper at all is silence, so identifying gh's would change no outcome. Pre-existing, not touched here:
tests/test_adopt_plan.py:27carries a host-absolute scratchpad path to an optional MedxEHR clone (skip-guarded; there since the first commits,6013a5b, 2026-09-02). An environment variable is the fix: #61, filed unclaimed.Evidence
Linux:
python3 -m pytest tests -q— 611 passed (591 onmainata0962e8). macOS and Windows: thetests-macosandtests-windowsjobs on this PR; every offer row is platform-pure (the platform is an argument), so the same tests run on all three. Live, nothing installed:--doctor --local-remote-direxits 0 and creates nothing; with an emptiedPATHit lists both faults and exits 1 with no prompt; with git's config emptied it warns about the helper and still exits 0;openRepoShape --doctorprompts for nothing.Merge word: Brett Heap, 2026-09-05, "merge #59 on green too".
🤖 Generated with Claude Code
Summary by Sourcery
Guide users through missing prerequisite installation and authentication during preflight, and provide a preflight-only doctor mode.
New Features:
--doctormode that runs preflight checks and exits without requiring project or organisation details or creating repositories.Bug Fixes:
xcode-select --install.Enhancements:
gh auth setup-gitwhen appropriate.--yescannot approve installation or authentication actions.Documentation:
--doctor, and revised Windows commands.Tests: