fix: check stderr for Claude Code detection and exclude empty env from deeplink#181
Merged
ichoosetoaccept merged 1 commit intomainfrom Feb 18, 2026
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR makes two targeted fixes to the MCP client installation system:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_find_claude_command()"] --> B{"shutil.which('claude')"}
B -->|found| C["subprocess.run\n[claude, --version]"]
C --> D{"'Claude Code' in stdout\nOR stderr?"}
D -->|yes| E["Return path"]
D -->|no| F["Check potential_paths"]
B -->|not found| F
F --> G{"path.exists()?"}
G -->|yes| H["subprocess.run\n[path, --version]"]
H --> I{"'Claude Code' in stdout\nOR stderr?"}
I -->|yes| J["Return path"]
I -->|no| G
G -->|no more paths| K["Return None"]
L["cmd_cursor()"] --> M["_build_server_config()"]
M --> N["model_dump_json\n(exclude_none, exclude_defaults)"]
N --> O{"env == {}?"}
O -->|yes| P["Exclude env from JSON"]
O -->|no| Q["Include env in JSON"]
P --> R["Base64 encode → deeplink URL"]
Q --> R
Last reviewed commit: 56fa49f |
Member
Author
Merge activity
|
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.

Summary
Address two Greptile review findings from PR #178 (merged before comments were visible due to stacked PR limitations).
Changes
Check stderr for Claude Code CLI detection — Some CLI tools (including Node.js-based CLIs) print version info to stderr rather than stdout.
_find_claude_commandnow checks bothresult.stdoutandresult.stderrfor the "Claude Code" string. Applied to both the PATH lookup and the known-locations fallback.Exclude empty
envfrom Cursor deeplink —model_dump_json(exclude_none=True)still serialized"env": {}into the base64 payload when no env vars were provided. Addedexclude_defaults=Trueto omit the empty dict, keeping the deeplink payload clean and consistent withmcp-jsonoutput.Tests added
test_found_via_stderr— verifies Claude Code detection when version string is only in stderrtest_deeplink_excludes_empty_env— decodes the base64 deeplink config and assertsenvkey is absent when no env vars providedtest_not_claude_codeto also setstderr=""for completenessRelated
Filed #180 for the codereviewbuddy bug where
list_review_commentsmissed these inline Greptile threads entirely.