Skip to content

Derive store_dir from watched_dir instead of the cwd#62

Merged
Neverdecel merged 1 commit into
masterfrom
claude/coderag-store-dir-config-bl7xdu
Jun 21, 2026
Merged

Derive store_dir from watched_dir instead of the cwd#62
Neverdecel merged 1 commit into
masterfrom
claude/coderag-store-dir-config-bl7xdu

Conversation

@Neverdecel

Copy link
Copy Markdown
Owner

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

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
@Neverdecel Neverdecel merged commit ab0bb12 into master Jun 21, 2026
12 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

3 participants