Skip to content

feat(cli): inject resolvers into cmd_list - #195

Open
ecalifornica wants to merge 1 commit into
robert/config-cmd-showfrom
robert/config-cmd-list
Open

feat(cli): inject resolvers into cmd_list#195
ecalifornica wants to merge 1 commit into
robert/config-cmd-showfrom
robert/config-cmd-list

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Part of #184 (PR 3 of the plan there). Stacked on #193. path-cli only.

Why

The command modules convert one per PR, so each diff stays reviewable and a regression bisects to one command. cmd_list converts second: it is the next-smallest surface after cmd_show, and it is the first command that constructs providers on emscripten, which forces the providers module to compile there. The module loses its target gate and keeps per-function gates on opencode_resolver and cursor_resolver, the two resolvers whose crates are absent from the emscripten dependency table. Every target then constructs resolvers through the same functions, and the gates sit exactly where the capability boundary is.

What

  • run() passes &Config to cmd_p::run, which passes it to cmd_list::run. No other p subcommand takes it yet.
  • cmd_list constructs every conversation provider via with_resolver(providers::*_resolver(config)). The pi arm chains with_sessions_dir when --base is given, so --base wins over the injected home. The git and github arms construct no provider and do not change.
  • providers compiles on emscripten: cmd_list compiles there, and its claude/gemini/codex/copilot/pi arms construct providers. opencode_resolver and cursor_resolver carry #[cfg(not(target_os = "emscripten"))]; the opencode and cursor crates are absent from the emscripten dependency table, and the matching cmd_list arms bail on emscripten before any construction.
  • config is used on every target in run(), and Config::home_dir is used on emscripten. Their emscripten lint expectations (expect(unused_variables), expect(dead_code)) are gone.

Behavior change

  • p list pi, Windows only: the CLI injects Config::home_dir(), which falls back to $USERPROFILE. The pi resolver's internal lookup reads $HOME only (pi: resolver home lookup ignores $USERPROFILE #192). With $HOME unset, p list pi resolves %USERPROFILE%\.pi\agent\sessions.

Tests

  • The cmd_list unit tests build managers from injected resolvers and call the list_* helpers directly; the run_* signature change does not touch them.
  • No new resolver functions; the providers tests do not change. Assertions stay on paths fully determined by injected values.
  • The integration test list_copilot_tsv_shows_session exercises the $COPILOT_HOME value through Config and copilot_resolver end to end.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://92d73cea.toolpath.pages.dev

@ecalifornica
ecalifornica force-pushed the robert/config-cmd-list branch from 06c40e0 to fc76de7 Compare August 14, 2026 19:49

@ecalifornica ecalifornica left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

}

pub fn run(command: PCommand, pretty: bool) -> Result<()> {
pub fn run(command: PCommand, pretty: bool, config: &crate::config::Config) -> Result<()> {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&Config instead?

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.

2 participants