#298: Extract shared git-root resolver for project key lookups#299
Merged
#298: Extract shared git-root resolver for project key lookups#299
Conversation
- Add ProjectDetector.resolveProjectKey(from:in:) to walk up from project root to git root when resolving ~/.claude.json project keys - Fix ConfigurationDiscovery.discoverMCPServers() using the shared utility (mcs export was silently missing MCP servers in subdirectory projects) - Refactor MCPServerCheck to use the shared utility instead of inline walk-up loop
…discovery - Walk-up finds servers keyed at git root from subdirectory project - Exact match when projectRoot equals gitRoot (regression) - Boundary: nested .git prevents escaping to outer repo
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
mcs exportfrom a subdirectory project silently missed project-scoped MCP servers becauseConfigurationDiscoverydid a directprojects[projectRoot.path]lookup without walking up to the git root. PR #297 fixed the same issue inMCPServerCheckbut with an inline loop — this PR extracts the walk-up logic into a shared utility and fixes the remaining bug.Closes #298
Changes
ProjectDetector.resolveProjectKey(from:in:)— walks up from a starting path, checking each ancestor against a set of known~/.claude.jsonproject keys, stopping at the.gitboundaryConfigurationDiscovery.discoverMCPServers()to use the shared utility instead of a direct single-key lookupMCPServerCheck.check()to use the shared utility instead of the inline walk-up loop from PR fix: MCPServerCheck false negative in subdirectory projects #297resolveProjectKey(exact match, walk-up, git boundary, no match, empty keys)MCPServerCheckwalk-up behavior (subdirectory pass, boundary stop, exact match regression)DoctorRunnerIntegrationTestsfor the full DoctorRunner → MCPServerCheck walk-up flowTest plan
swift testpasses locally (884 tests)swiftformat --lint .andswiftlintpass without violationsmcs sync,mcs doctor)Checklist for engine changes
LifecycleIntegrationTestsorDoctorRunnerIntegrationTests)