Skip to content

fix: automatic recognition of root#76

Merged
isink17 merged 2 commits into
masterfrom
fix/mcp_tool
Apr 28, 2026
Merged

fix: automatic recognition of root#76
isink17 merged 2 commits into
masterfrom
fix/mcp_tool

Conversation

@isink17
Copy link
Copy Markdown
Owner

@isink17 isink17 commented Apr 28, 2026

What

Makes --repo-root optional across all CLI commands and MCP tools.

Why

Users had to hardcode absolute paths in editor configs, causing setup
failures (especially on Windows where Claude Code doesn't inherit PATH).

How

Added config.ResolveRepoRoot() with 5-step fallback:

  1. explicit --repo-root flag
  2. per-call MCP tool parameter
  3. git rev-parse --show-toplevel
  4. os.Getwd()
  5. error

All CLI commands and MCP tools route through this helper.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements automatic repository root detection for the codegraph tool, making the --repo-root flag optional across various commands and the MCP server. The resolution logic follows a fallback chain including explicit flags, tool parameters, git root detection, and the current working directory. Review feedback identifies a priority issue in the ResolveRepoRoot function where the global CLI flag currently takes precedence over the more specific MCP tool parameter; it is recommended to swap these to ensure local overrides are respected. Corresponding updates to the test suite are also suggested to verify this corrected behavior.

Comment thread internal/config/reporoot.go
Comment thread internal/config/reporoot_test.go Outdated
@isink17 isink17 merged commit 0a77c8a into master Apr 28, 2026
3 checks passed
@isink17 isink17 deleted the fix/mcp_tool branch April 28, 2026 18:38
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.

1 participant