Skip to content

Translate wheelgap diagnostics for MCP clients - #624

Merged
patrickballard merged 11 commits into
wheelgap:mainfrom
kunalkshah1:fix/mcp-cli-diagnostics
Nov 21, 2026
Merged

patrickballard merged 11 commits into
wheelgap:mainfrom
kunalkshah1:fix/mcp-cli-diagnostics

Conversation

@kunalkshah1

Copy link
Copy Markdown
Contributor

Closes #607

What this changes

Translate CLI advice from errors and notes to the corresponding MCP arguments. Explicit offline: false on check_lockfile overrides a project's offline default for that call. Omitting the argument still uses project defaults. check_dockerfile advises changing the project setting when it cannot accept that override.

Tests cover both diagnostics from the issue, the explicit override, and representative failures across the CLI-backed tools.

AI tools used: Codex

Ruff formatting and lint, mypy, and the full pytest suite passed. The Unreleased entry will be added with the PR number.

@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1, this looks good overall: the CLI-to-MCP translations now live in one table applied to every error and note, and offline: false on check_lockfile passes --online as #607 asked, with docs/mcp.md and the schema description updated to match.

CI is green on this commit.

#607 is a help wanted issue, so Patrick will review and merge this one himself. Nothing more needed from you for now.

(Review assisted by Claude.)

patrickballard and others added 4 commits November 21, 2026 10:48
… tool

offline: false runs --online, whose notes named --online, --explain and --json; --build-arg, --environment and '-t and --glibc' also reached clients as flags. check_dockerfile and check_dist were told to pass dependencies: true or to 'drop check_dist', arguments they don't have. pip's own options in a Dockerfile (-r FILE, --no-cache-dir) are left as written. Adds a table test of each mapping, the unknown-group case the issue asks for, and a uv.lock checked with offline: false.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
CHANGELOG keeps both bullets. main's new check_lockfile test for a stale gap wheel list (wheelgap#620) read the note as the command line words it; through the MCP tool it now starts with 'the fix argument'.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
--environment is in the MCP advice table now, so check_lockfile's error for environment: "" no longer quotes the flag.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
CHANGELOG keeps both bullets, this PR's first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1! One table applied where the CLI's messages reach an MCP client is the design #607 asked for.

The table covered only some of the flags a client can see, so we've made these changes:

  • Added the flags that offline: false itself brings into notes (--online, --explain, --json), plus --build-arg, --environment and -t/--glibc.
  • The advice now depends on the tool, so check_dockerfile and check_dist are never pointed at arguments they don't have.
  • pip's own options quoted in Dockerfile errors are left as written.
  • A match right after a backslash is skipped, so a Windows path is not rewritten.
  • A table test covers every mapping, and the unknown-group case from the issue is tested.

It'll merge once a final review passes.

(Review assisted by Claude.)

patrickballard and others added 5 commits November 21, 2026 11:15
…s as written

The flag table rewrote --group in 'pip install --group: --dockerfile-inputs only reads ...' (the user's Dockerfile line, not a wheelgap flag) and in the command the no-lockfile hint says to run (`wheelgap DIR/pyproject.toml --group NAME`). A flag right after 'pip install ' (so 'uv pip install ' too) and anything inside backticks now stay as they are. docs/mcp.md and the schema also say what offline: false costs: one index request per PyPI package, and that leaving it out is not the same as false.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard
patrickballard merged commit ac3cbca into wheelgap:main Nov 21, 2026
13 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @kunalkshah1! The final review added three things: a pip option quoted from the Dockerfile (pip install --group) is left as written, a command shown in backticks is left as written, and the docs say that offline: false asks the index again for every package, which is not the same as leaving it out.

(Reply assisted by Claude.)

patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
…reads as rules

Two cases where a file the image doesn't have was read:

- A symlink is matched against the ignore rules by its own name, so a link
  whose target the rules leave out (a linked folder under `COPY . .`, or a
  linked file a COPY names) was read although it dangles in the image. When
  the ignore file has rules, a COPY source or a file under a folder COPY that
  is, or is reached through, a symlink below the build context is now an
  error. With no ignore file, or one with no rules, nothing changes.
- Moby's patternmatcher.New cleans an exception with its ! still on, so
  `!../../requirements.txt` becomes the rule `requirements.txt`, which
  excludes. The port kept it as an exception that matches nothing; it is now
  refused, naming the ignore file's line.

Merges main (wheelgap#624); CHANGELOG keeps every bullet once, this PR's first.
docs/cli.md says both, and the over-long line is wrapped.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
…t be pinned

main gained -c FILE and harmless pip flags (wheelgap#622), verified includes (wheelgap#621),
.dockerignore rules (wheelgap#626), install provenance (wheelgap#630), uv's Requires-Python
lower-bound rule (wheelgap#623) and MCP wording (wheelgap#624) since this branch was written.

_pip_install_files returns (files, constraints, prefer_binary, uv) and has one
flag loop with the uv branch first. On a uv line only uv's own flags are read:
--system, -r/--requirements, -c/--constraints, --no-cache, --no-cache-dir,
--upgrade/-U and --quiet/-q (checked against `uv pip install --help`, 0.13.1).
pip's --no-input, --root-user-action and --prefer-binary don't exist in uv, and
--disable-pip-version-check only warns there, so they are refused.

A uv line's files are found by the same copied_requirements closure as pip's,
so the ignore rules and the include checks apply. Three things are uv's own:
- every requirement must be pinned with == (through includes; a pin from a
  constraints file counts), using the gate --prefer-binary already had, and
  --deps is refused: wheelgap resolves a range as pip does, and uv can pick
  another release;
- a -r inside a constraints file is refused: pip installs what it names and uv
  only constrains with it (uv 0.13.1 against pip 26.2);
- included and -c files must be named *.txt or *.in, like the -r file.
A file installed by pip on one line and uv on another is refused, and a caller
that doesn't pass uv_installs gets an error rather than pip's answer.

cli.py: the stderr note keeps main's list of every file read and says which
installer ran; uv-installed files get restore_uv_python_files, as a uv.lock
with --online does, so the pip_refuses note is main's.

docs/cli.md has one paragraph for uv; CHANGELOG keeps every bullet once, this
PR's first, reworded.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.

MCP: tool errors tell the client to pass --online or drop --deps, which an MCP client can't do

2 participants