Skip to content

No persisted active-workspace state; every invocation must specify --db or CWD-discover #1710

Description

@Widthdom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions