Skip to content

fix(cli): index <path> never rebuilds an ancestor instead - #1689

Open
danusha2345 wants to merge 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1524-index-explicit-path
Open

fix(cli): index <path> never rebuilds an ancestor instead#1689
danusha2345 wants to merge 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1524-index-explicit-path

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

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 bare codegraph 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.ts against the built binary: the parent's DB is untouched and no .codegraph appears in the child; an initialized explicit path and a bare index from a subdirectory both still rebuild. Full suite green.

🤖 Generated with Claude Code

…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.
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.

codegraph index <path> silently ignores <path> and rebuilds an ancestor's index when <path> is not initialized

1 participant