Derive store_dir from watched_dir instead of the cwd#62
Merged
Conversation
The index store location defaulted to `<cwd>/.coderag`, computed independently of the watched dir. This was a silent footgun: `coderag index --watched-dir /home/me` wrote the index to `/home/me/.coderag` only when you happened to run it from `/home/me`; running `coderag status`/`search` from any other directory then looked at a *different* (usually empty) `.coderag` and reported nothing — even though a fully built index existed elsewhere. Default `store_dir` to `<watched_dir>/.coderag` (resolved in `__post_init__`) so the index lives next to the code it indexes and is found regardless of the current working directory. An explicit `--store-dir` / `CODERAG_STORE_DIR` still wins, and overriding `watched_dir` alone now moves an auto-derived store with it. Behavior is unchanged for the common case of running inside the repo you're indexing (watched_dir defaults to cwd). Updates the CLI help, docs, AGENTS.md, and example.env, and adds regression tests covering cwd-independence, explicit overrides, the env var, and watched_dir re-pointing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JthREmD1twWpEgHJCV9r8v
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
The index store location defaulted to
<cwd>/.coderag, computed independentlyof the watched dir. This was a silent footgun:
coderag index --watched-dir /home/mewrote the index to/home/me/.coderagonly when you happened to runit from
/home/me; runningcoderag status/searchfrom any other directorythen looked at a different (usually empty)
.coderagand reported nothing —even though a fully built index existed elsewhere.
Default
store_dirto<watched_dir>/.coderag(resolved in__post_init__)so the index lives next to the code it indexes and is found regardless of the
current working directory. An explicit
--store-dir/CODERAG_STORE_DIRstill wins, and overriding
watched_diralone now moves an auto-derived storewith it. Behavior is unchanged for the common case of running inside the repo
you're indexing (watched_dir defaults to cwd).
Updates the CLI help, docs, AGENTS.md, and example.env, and adds regression
tests covering cwd-independence, explicit overrides, the env var, and
watched_dir re-pointing.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01JthREmD1twWpEgHJCV9r8v