Repository navigation
Keep pip extras and long hints intact in installer output - #149
Merged
Merged
Conversation
`powermcp install` printed its pip hints through Rich, which reads `[andes,ltspice]` as a markup tag and drops it. The dry-run and non-interactive hints read `pip install powermcp` with no extras, so anyone copying them installed none of the selected tools. The actual pip subprocess call was unaffected. Escape the spec in every wizard message that shows it, and escape the user-derived values (config and client paths, detected paths, unknown tool ids, exception text) that also go through Rich markup. doctor already escaped its table; its config-file line now does too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a TTY Rich renders at 80 columns and folds any word wider than that. With every Windows tool selected the spec is ~110 characters, so the hint split `powermcp[...]` across lines and a copied command broke. Long config paths in the "Done" and "Configured" lines wrapped the same way. Print those lines with soft_wrap=True so they stay intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
powermcp installprints its pip hints through Rich, and Rich reads[andes,ltspice]as a markup tag and drops it. So every hint that shows the spec loses its extras.To reproduce on 0.4.1 / current
main:Anyone (or any AI agent) who copies that hint installs none of the selected tools. The real install call,
subprocess.run([..., "pip", "install", spec]), was never affected. Only the displayed text was wrong.A second display problem shows up once the extras are visible. Without a TTY, Rich renders at 80 columns and folds any word wider than that. With every Windows tool selected the spec is about 110 characters, so the hint broke
powermcp[...]across two lines and a copied command failed. Long config paths in the "Done" line wrapped the same way.Fix
wizard._pip_install: pass the spec throughrich.markup.escapein the dry-run, non-interactive, "Skipped", "Installing" and "pip install failed" messages, and print those lines withsoft_wrap=Trueso the command stays on one line. The questionary confirm prompt is not Rich markup, so it keeps the raw spec. The subprocess still gets the raw spec.console.printcalls that include user-derived text are escaped too: the config path in the "Done" line, client config paths, detected install paths, unknown--toolsids, and exception text. A path like~/cfg[old]/config.tomlwas losing[old]the same way. The "Done" and "Configured" path lines also usesoft_wrap=True.doctor.pyalready escaped its table cells and status lines (install_hintgoes through there). Only its trailing "Config file:" line was unescaped, and now it is escaped and soft-wrapped.After the fix:
The change is limited to output. Selection and install behaviour are unchanged.
Tests
New tests in
tests/test_wizard.pycapture the output:powermcp[andes]appears in dry-run and non-TTY modes (parametrized),powermcp[andes]).--tools allspec stays on one line at 80 columns.The first five fail on
main. The last one, plus the wider-path version of the "Done" test, fail withoutsoft_wrap. All pass on this branch.pytest tests/test_wizard.py tests/test_doctor.py -qgives 41 passed (Python 3.12 venv,pip install -e .).🤖 Generated with Claude Code