feat(advisor): remember the chosen repo scope across invocations#808
Conversation
b119b19 to
e3ae442
Compare
`actual advisor` now remembers which repository your questions are scoped to, so you set it once and every later question from the same working tree stays scoped without re-passing `--repo`. - The active scope is stored per repository. Whether you set it with `--repo <name|id>` or let auto-detection resolve it from the `origin` remote, a later bare `actual advisor "<question>"` reuses it. - `--show-scope` prints the active scope for the current repository and exits. - `--repo none` runs at the organization level and pins that choice; `--repo auto` forgets the pin and reverts to git-remote auto-detection. - `--org` without `--repo` runs a single question at the organization level without changing the remembered scope. - The question is optional when a scope command is used on its own, e.g. `actual advisor --repo my-service`. Scope resolution order: an explicit `--repo`, then an explicit `--org`, then the scope remembered for the repository, then git-remote auto-detection, then an organization-level fallback. `none` and `auto` are reserved `--repo` keywords; a repository literally named that is still reachable via its UUID or `owner/name` form. The scope persists in the existing config file, keyed per repository with the same SHA-256-of-origin-URL scheme the other per-repo settings use. Per-file line coverage stays at 100%. Generated by the operator's software factory. City: factory-main · Agent: local-core.builder-1 On behalf of: @benw5483 Co-Authored-By: <operator-factory-bot> <factory-bot@<operator-domain>.invalid>
d00a1e2 to
14c7aab
Compare
|
Wanted to provide some clarifications my agent shared, but otherwise this looks good:
|
Summary
The
actual advisorcommand now remembers which repository your questions are scoped to, so you set it once and every later question from the same working tree stays scoped without re-passing--repo.--repo <name|id>or let auto-detection resolve it from theoriginremote, a later bareactual advisor "<question>"reuses it.--show-scopeprints the active scope for the current repository and exits.--repo noneruns at the organization level and pins that choice;--repo autoforgets the pin and reverts to git-remote auto-detection.--org(without--repo) runs a single question at the organization level without changing the remembered scope.actual advisor --repo my-service.Behavior
Each query resolves its scope in this order: an explicit
--repovalue, then an explicit--org, then the scope remembered for this repository, then git-remote auto-detection, then an organization-level fallback. The CLI always states whether an answer is repo-scoped or organization-scoped, and it never silently guesses when a remote matches more than one connected repository. It lists the candidates instead.noneandautoare reserved--repokeywords. To scope to a repository literally namednoneorauto, pass its UUID orowner/nameform.Test plan
cargo test --lib advisor config::stickycovers the scope controls, persistence, precedence, and the reserved keywords.cargo clippy -- -D warningsis clean.cargo llvm-covreports 100% per-file line coverage on the changed files.actual advisor --repo <name>then a bareactual advisor "<question>"from the same repo, and confirm the second call reuses the scope;--show-scopereflects each change.Persistence uses the existing config file, keyed per repository with the same scheme the other per-repo settings use.
Design note: scope persistence
The remembered scope persists in the CLI's existing per-user config file (keyed per repository by a hash of the
originremote URL), so it survives across shell sessions until you change it with--repo autoor--repo none. The alternative we considered is shell-ephemeral persistence: a session-scoped file cleared when the shell exits. We chose the durable per-repository model because it reuses how the CLI already stores per-repo state, and because re-pinning in every new shell would undercut the "set it once" goal. If reviewers prefer the ephemeral model, swapping the storage layer is a contained change. Feedback welcome.