Repository navigation
feat(install): add one-command install/update/doctor wrappers (install.sh + install.ps1) - #390
Conversation
Add thin install.sh (macOS/Linux) and install.ps1 (Windows) wrappers that
route to the canonical Python installer path — python -m pip install sumo-qa,
python -m sumo_qa.installer, and sumo-qa-doctor — without reimplementing any
install logic or bypassing installer validation.
Modes: bare install, --update (pip --upgrade + re-run installer + doctor),
--doctor (read-only), --host {claude-code,vscode,jetbrains} platform select,
and --print-plan/-PrintPlan to emit the exact delegated commands without
running them (the test/audit seam).
Uninstall is deferred on purpose and documented: the installer has no
ownership-aware uninstall, so the wrappers route --uninstall/-Uninstall to
the manual docs/INSTALL.md#uninstall steps and run nothing destructive —
they never touch host config entries they cannot prove they own, never use
sudo, and never delete .sumo-qa artifacts. Failures print the failing
command plus the next safe manual step.
Tests: tests/test_install_wrapper.py drives --print-plan over the (mode x
host) decision table plus the verified/rejected host partition; PowerShell
parity is checked statically with a pwsh-gated parser test that skips when
no interpreter is present. CI: shellcheck mirror in lint.yml now covers
install.sh, and install-smoke runs both wrappers in print-plan mode on
Linux/macOS/Windows. Docs: README quickstart + docs/INSTALL.md wrapper
section, and the stale 'no automated uninstall / wrapper on the roadmap'
note is corrected.
- install.sh: replace Bash 4 associative array with a case-based host_flag
function so the script runs on stock macOS Bash 3.2 (declare -A died at
load time under the env-bash shebang).
- install.sh: capture the delegated command's real exit code (set +e; run;
status=$?; set -e) instead of the negation's status, so a failing step
propagates non-zero instead of silently exiting 0.
- install.ps1: rename $Host param to $TargetHost with [Alias('Host')] so it
no longer shadows PowerShell's read-only automatic $Host (which made the
whole script fail to run on pwsh); public -Host flag unchanged.
- Both: execute delegated commands as argv arrays (no eval / no
Invoke-Expression), removing the SUMO_QA_PYTHON metacharacter-injection path
while keeping --print-plan output identical.
- Both: reject mutually-exclusive mode flags (update/doctor/uninstall) with
exit 2 instead of silently letting precedence win.
- install.ps1: surface the exact failing command + next-safe-step for both
native-nonzero AND command-not-found, propagating the real exit code; use
a non-terminating error write so explicit exit codes survive.
- Tests: lock in conflicting-mode rejection and exit-code propagation; assert
the -Host alias / $TargetHost rename and the no-Invoke-Expression contract.
- install-smoke.yml: join the -PrintPlan array before matching so the pwsh
membership checks work now that the script actually runs on pwsh.
The interpreter override is a single executable path, not a whitespace- split command line. Build the command argv from it as one token in both install.sh and install.ps1 so a path containing spaces (e.g. "/Applications/Python 3/python") is preserved verbatim and exec'd correctly, and a value like "python *" is never glob-expanded into argv. Remove the now-unneeded SC2206 suppression. --print-plan / echoed lines single-quote any space-containing token so the printed plan is copy-pasteable and matches what is executed. Add regression tests driving a space-containing SUMO_QA_PYTHON through both wrappers.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eec25c7551
ℹ️ 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".
… the wrappers; git-bash in tests install.sh: --print-plan emits the plan line-by-line, so a reader auditing it with `grep -q`/`head` closes the pipe after the first match. The next write then took SIGPIPE (exit 141) or a broken-pipe error that `set -e` turned into a failure, breaking the CI smoke step and a real user's audit. Ignore SIGPIPE and drop errexit for the print walk (the exec path keeps errexit), and silence the broken-pipe write error — --print-plan only prints and always exits 0. tests/test_install_wrapper.py: a bare `bash` on a Windows runner resolves to the WSL launcher stub (C:\Windows\System32\bash.exe), which has no distro and exits 1 with a UTF-16 notice — failing every install.sh test. Resolve a real POSIX bash (prefer git-bash, treat the System32 WSL stub as unusable) and skip cleanly when none exists. pyproject.toml: add install.sh / install.ps1 to mutmut `also_copy` so they exist under the mutants/ mirror. The new install-wrapper test resolves them via parents[1] and shells out, so without mirroring the test exits 127 under mutmut and the pre-push hook aborts on any test-touching push. Same root-level-resource pattern as release-please-config.json / .github/ / assets/.
…onger tests Codex adversarial pass on the wrappers. Production paths (arg parsing, host allowlisting, conflicting-mode rejection, exit-code propagation, SIGPIPE guard) were sound; these close robustness + test-quality gaps: - install.sh / install.ps1: the plan renderer single-quoted whitespace tokens but did not escape an embedded single quote, so an interpreter path like /O'Brien/python rendered invalid copy-paste shell. Escape via '\'' (bash) and doubled '' (PowerShell), and trigger quoting on an embedded quote too. - install.ps1: an explicit `-Host ''` bypassed host validation (all-host install) while install.sh rejects it. Validate whenever -Host is supplied (PSBoundParameters), so `-Host ''` exits 2 — parity with install.sh. - tests: add a regression test that --print-plan survives a consumer closing the pipe early (deterministic `| true` under pipefail; verified to fail without the guard); pin the exact ordered bare-install plan (count+order+tail); make the WSL-stub detection case-insensitive (system32); scope the bash skip to bash-dependent tests only (pwsh parity tests no longer over-skipped); point the ps1 uninstall-safety check at the real switch-case body (the old split landed on the assignment line and guarded nothing — verified it now fails on an injected destructive call); fix a dead split-path assertion that built a fragment that never appears.
Merge-readiness proof — finish-pr-batchTip reviewed: CI was red on entry — two real defects, both fixed
Per-file review —
|
…ppers route to it) The wrappers' --uninstall/-Uninstall previously printed manual steps and ran nothing — undercutting the one-command promise. The installer writes a fixed, known-key entry (`mcpServers["sumo-qa"]` / `servers["sumo-qa"]`) and already removes exactly that key on reinstall, so ownership IS provable. Add a real uninstall that reuses that: - installer.py: `--uninstall` removes, per host, exactly the sumo-qa entry (preserving every other server), the Claude Code skill symlinks (only symlinks or dirs whose SKILL.md matches the shipped skill — a customised skill is never deleted), and the `claude mcp remove` registration. JetBrains prints the one manual step (nothing was written programmatically). No binary install on the uninstall path; same host-selection logic (default all). - install.sh / install.ps1: --uninstall now routes to `python -m sumo_qa.installer --uninstall [host-flag]` (no doctor after); the wrapper itself still runs nothing destructive. - docs: INSTALL.md Uninstall section rewritten from "deferred" to the real ownership-aware flow (manual steps kept as the by-hand alternative); README wrapper summary now lists --uninstall. - tests: new tests/test_installer_uninstall.py (per-host: removes our entry, preserves co-existing servers, idempotent no-op, not-detected; skills safety: never deletes unrelated or customised skills; main() dispatch skips the binary install); rewrote the two wrapper deferral tests to assert routing. Discriminator-verified: breaking the entry-pop fails 9 tests across all hosts.
…mmand-install-wrappers # Conflicts: # pyproject.toml
Add tests for the remaining uncovered lines in the uninstall path: a non-dict JSON root in _remove_server_entry (no-op), a legacy sumo-qa wrapper left as a plain file and as a real directory (both removed), the Linux ~/.config/JetBrains path, and a JetBrains config dir present but holding no recognised IDE. Restores the repo's 100% coverage gate.
…redef main()'s uninstall branch and install path both bound `results`; the install path's annotated `results: list[HostResult]` tripped mypy [no-redef] against the branch's earlier bind. Rename the branch's local to `uninstall_results`.
Final merge-readiness — CI green, uninstall gap closedTip: The "one-command uninstall" gap is now closed (was the open product concern)
Verification
ACs (issue #158) — all 8 metIncluding AC #3 (update/uninstall paths) now delivered as a real automated, ownership-aware uninstall rather than a documented deferral. No open review threads. Ready for the merge gate. |
Behavioral verification (finish-pr 4.7) — real install→uninstall round-tripRan the feature the way a user does — Install (claude-code): Uninstall via the wrapper:
Behavioral note (not a blocker, symmetric with install): a default The earlier "merge-ready" went up before this 4.7 run — that was out of order; the real-execution gate should precede the merge ask, and now it has. |
…-host (codex P1s) Two P1 review findings on the wrapper's verification step: 1. Forward the selected host to the doctor. `install.sh --host claude-code` filtered the installer but ran `sumo-qa-doctor` with no host filter, so the doctor still ran the VS Code workspace check — which FAILs whenever cwd lacks .vscode/mcp.json — and a successful host-only install exited nonzero. The doctor now gets `--host <name>` in install/update/doctor modes (both wrappers). 2. Invoke the doctor through the resolved Python. The bare `sumo-qa-doctor` console script is command-not-found when pip's scripts dir isn't on PATH (the documented `pip install --user` case), failing the one-command install at the last step even though pip + installer succeeded. Build it from the resolved interpreter as `-m sumo_qa.doctor` so verification doesn't depend on PATH. Added `add_doctor` (install.sh) / `Add-Doctor` (install.ps1) helpers; updated the plan assertions to the module form and added a test that --host is forwarded to the doctor in every mode (and not added to a bare all-host install).
…longer fails a successful install The full per-file review found a sibling of the two doctor P1s on the BARE all-host path the --host fix didn't cover: `./install.sh` (no --host) runs the doctor with no host filter, so its VS Code workspace check FAILs whenever cwd lacks .vscode/mcp.json (e.g. installing from $HOME) — even though pip + the installer succeeded and the installer correctly SKIPPED VS Code as "not a workspace". `doctor.main()` returns 1 on any FAIL, `run_cmd` propagated it, and a successful install reported "command failed" and exited 1. Fix: in install/update modes the post-install doctor is ADVISORY — its output is shown and a non-zero exit prints a NOTE, but it does NOT fail the install. Standalone --doctor stays STRICT (there the exit code IS the requested output). Implemented with a second record separator (install.sh) / a parallel advisory- flag list (install.ps1). docs/INSTALL.md documents the advisory-vs-strict split. Verified end-to-end: real bare `python -m sumo_qa.doctor` in a non-workspace dir exits 1 (FAIL vscode_workspace_config); `--host claude-code` exits 0; a stub- interpreter exec test confirms install mode swallows the doctor's non-zero exit (exit 0 + NOTE) while --doctor mode propagates it (exit 3).
…umo_qa.doctor The wrapper now builds the doctor step as `<python> -m sumo_qa.doctor` (resolved interpreter, PATH-independent) instead of the bare `sumo-qa-doctor` console script, so the --print-plan smoke must grep for the module form. The separate console-script checks (command -v / --help / uvx) are unchanged — that entry point still ships and works; the wrapper just no longer depends on it being on PATH.
Doctor P1 round — found, fixed, re-verified (tip 97f5ff1, CI 31/31 green incl. Windows pwsh)I'd surfaced "merge-ready" prematurely; pulling the PR's review threads + running the full per-file review (which I'd skipped) then surfaced three P1s on the doctor step — all now fixed and re-verified. P1a + P1b (codex GitHub-app threads, both resolved):
P1c (found by the full per-file review — the backstop I'd skipped): the bare all-host path ( Verification (real execution, before this merge-ready):
The earlier "merge-ready" preceded the per-file review + the 4.7 real run — that ordering was the failure; both are now done first. |
🤖 I have created a release *beep* *boop* --- ## [0.42.0](v0.41.0...v0.42.0) (2026-06-10) ### Features * **install:** add one-command install/update/doctor wrappers (install.sh + install.ps1) ([#390](#390)) ([bbf81ab](bbf81ab)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
Closes #158. Part of epic #154 (product-grade packaging polish).
What
One-command install/update/doctor/uninstall wrappers that route to the canonical Python installer — they add no install logic of their own:
install.sh(macOS/Linux) andinstall.ps1(Windows) →pip install sumo-qa→python -m sumo_qa.installer [host-flag]→sumo-qa-doctor.--update/-Update,--doctor/-Doctor,--uninstall/-Uninstall,--host/-Host {claude-code,vscode,jetbrains}, and a side-effect-free--print-plan/-PrintPlandry-run seam.lint.ymlshellcheck coversinstall.sh;install-smoke.ymlruns both wrappers in print-plan mode on Linux/macOS/Windows. Docs: README quickstart +docs/INSTALL.md.Ownership-aware uninstall (new — closes the "one-command uninstall" gap)
The wrappers'
--uninstallpreviously printed manual steps and ran nothing, which undercut the one-command promise. The installer writes a fixed, known-key entry (mcpServers["sumo-qa"]/servers["sumo-qa"]) and already removes exactly that key on reinstall, so ownership is provable. Added a realpython -m sumo_qa.installer --uninstallthat reuses it:SKILL.mdmatches the shipped skill — a customised skill is never deleted), and theclaude mcp removeregistration. JetBrains prints the one manual step (nothing was ever written programmatically). No binary install on the uninstall path; same host-selection (--hostscopes it). Nosudo, no.sumo-qa/deletion.install.sh/install.ps1--uninstallnow route to the installer (no doctor after); the wrapper itself still runs nothing destructive directly.docs/INSTALL.md+ README rewritten from "deferred" to the real ownership-aware flow.Review trail (sumo-qa per-file + codex adversarial, at the orchestrator)
Earlier rounds (miss-logged in #389) fixed: Bash-3.2-safe
casemap, exit-code propagation, the$Hostpwsh crash (→$TargetHost+[Alias('Host')]),eval/Invoke-Expressionremoved, mutually-exclusive-mode rejection, single-tokenSUMO_QA_PYTHON.This (finish-pr-batch) round:
install.shSIGPIPE/broken-pipe underset -e -o pipefail(--print-plan | grep -qclosed the pipe early → 141) and the Windows test resolving the WSLbashstub instead of git-bash; addedinstall.sh/install.ps1/.claude-plugin/to mutmutalso_copy.'\''/''),-Host ''rejection parity, a deterministic--print-plan | trueSIGPIPE regression guard, exact-ordered-plan assertions, case-insensitive WSL-stub detection, bash-skip scoped off the pwsh tests, the ps1 uninstall-safety check fixed to slice the real switch body, a dead split-path assertion fixed.SKILL.mdcontent-match → the customised-skill test fails; removing the key-present guard → 3 no-op tests fail. Verdict: SAFE, no blockers.Evidence
marketplace.json): 100% coverage gate met; shellcheck clean.tests/test_installer_uninstall.py(per host: removes our entry, preserves co-existing servers, idempotent no-op, not-detected; skills safety: never deletes unrelated or customised skills;main()dispatch skips the binary install) — discriminator-verified.src/change is confined toinstaller.py(the uninstall path) — no MCP tool/resource/router/response-shape change;using_sumo_qarouting untouched. Eval gate not required (noskills/*/SKILL.mdor eval YAML touched).Not verified locally
install.ps1runtime + the Windows skill-copytree uninstall path can't run on the macOS dev box (pwsh-gated tests skip locally) — covered by the Windows CI leg. Local green; cross-platform CI on the pushed tip is the gate.Doctor P1 round (post per-file review)
Pulling the PR review threads + running the full per-file review surfaced three P1s on the post-install doctor, all fixed + re-reviewed SAFE:
--hostto the doctor (a host-scoped install no longer fails on an unrelated host's check).-m sumo_qa.doctor(resolved interpreter), not the PATH-fragile bare console script.--doctorstays strict.install-smoke.ymlgrep updated to the module form.Verified by real install→uninstall round-trip + real doctor exit behaviour; CI 31/31 green incl. the Windows pwsh leg; 100% coverage; 0 unresolved threads. See the proof comments for the full evidence.