fix(cli): index <path> never rebuilds an ancestor instead - #1689
Open
danusha2345 wants to merge 1 commit into
Open
fix(cli): index <path> never rebuilds an ancestor instead#1689danusha2345 wants to merge 1 commit into
danusha2345 wants to merge 1 commit into
Conversation
…ry#1524) An explicit path names the project to rebuild; it is not a hint to go looking for one. resolveProjectPath's upward walk is right for a query run from a subdirectory, but for a full re-index it silently rebuilt the nearest initialized parent's graph when <path> had no index of its own. Refuse with the parent's path and the way to index <path> itself; a bare `codegraph index` still resolves from cwd as before.
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.
Fixes #1524.
Problem
codegraph index <path>resolved an uninitialized<path>upward to the nearest initialized parent and rebuilt THAT under a normal "Done", never saying which project it actually indexed. From a monorepo package that meant re-indexing the whole container; from a fresh clone beside a stale ancestor, rebuilding the wrong graph.Change
An explicit path names the project to rebuild — it is not a hint to go looking for one. When
<path>has no index the command exits 1, names the ancestor it would have picked, and says how to index<path>on its own. A barecodegraph index(cwd) still resolves upward exactly as before, and so do the query commands, whose upward walk is the right behaviour.Verification
New
__tests__/cli-index-explicit-path.test.tsagainst the built binary: the parent's DB is untouched and no.codegraphappears in the child; an initialized explicit path and a bareindexfrom a subdirectory both still rebuild. Full suite green.🤖 Generated with Claude Code