Summary
There is no notion of a persisted "active workspace" — every CLI invocation must specify --db (or rely on CWD-based resolution) to find the right index. For users juggling multiple workspaces, this is repetitive and error-prone (e.g., running cdidx search foo in repo A's directory but accidentally hitting repo B's DB because of an env var or shell history). Tools like kubectl config use-context or gcloud config set project solve this with an explicit per-shell or per-user "active context" state.
Where
src/CodeIndex/Cli/DbPathResolver.cs:19-50 (no concept of active context)
- No
~/.config/cdidx/active.yml or shell-integration support
Suggested approach
(1) Add cdidx workspace use <name> that writes the active workspace into ~/.config/cdidx/active.yml. (2) Add cdidx workspace current to print the active workspace. (3) Resolution precedence: explicit --db > CDIDX_DB env var > active workspace file > CWD-based discovery (current behavior). (4) Print the active workspace in cdidx status. (5) Optional: support per-shell active state via env var integration (eval $(cdidx workspace env)). (6) Document in DEVELOPER_GUIDE; coordinate with #C304 (workspace manifest).
Summary
There is no notion of a persisted "active workspace" — every CLI invocation must specify
--db(or rely on CWD-based resolution) to find the right index. For users juggling multiple workspaces, this is repetitive and error-prone (e.g., runningcdidx search fooin repo A's directory but accidentally hitting repo B's DB because of an env var or shell history). Tools likekubectl config use-contextorgcloud config set projectsolve this with an explicit per-shell or per-user "active context" state.Where
src/CodeIndex/Cli/DbPathResolver.cs:19-50(no concept of active context)~/.config/cdidx/active.ymlor shell-integration supportSuggested approach
(1) Add
cdidx workspace use <name>that writes the active workspace into~/.config/cdidx/active.yml. (2) Addcdidx workspace currentto print the active workspace. (3) Resolution precedence: explicit--db>CDIDX_DBenv var > active workspace file > CWD-based discovery (current behavior). (4) Print the active workspace incdidx status. (5) Optional: support per-shell active state via env var integration (eval $(cdidx workspace env)). (6) Document in DEVELOPER_GUIDE; coordinate with #C304 (workspace manifest).