Skip to content

feat(cli): load Config in run() and inject resolvers into cmd_show - #193

Open
ecalifornica wants to merge 1 commit into
robert/config-composition-rootfrom
robert/config-cmd-show
Open

feat(cli): load Config in run() and inject resolvers into cmd_show#193
ecalifornica wants to merge 1 commit into
robert/config-composition-rootfrom
robert/config-cmd-show

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

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

What

  • run() loads one Config after clap parsing and passes &Config to cmd_show. No other command takes it yet.
  • New providers module: one function per provider builds its PathResolver from Config::home_dir(). Call sites chain per-site overrides onto the result.
  • opencode and copilot get their directory injected (with_data_dir, with_copilot_dir): their internal $XDG_DATA_HOME / $COPILOT_HOME reads win against with_home, and only an injected directory wins against the read. cursor gets $APPDATA\Cursor injected on Windows only; its resolver consults $APPDATA only there.
  • The injections carry the opencode and Cursor path segments in the CLI. Proposal to move them back into the crates: Remove env reads from the provider crates #185 (comment)
  • cmd_show constructs every provider via with_resolver. The pi arm chains with_sessions_dir when --base is given, so --base wins over the injected home.
  • providers is compiled out on emscripten, like cmd_show. opencode and cursor are not dependencies on that target.

Behavior change

  • show 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, show pi resolves %USERPROFILE%\.pi\agent\sessions.

Tests

  • providers tests pin each resolver path to config-supplied values. Assertions stay on paths fully determined by injected values; resolver defaults that read the ambient environment are not asserted.

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

)

run() extracts one Config and passes &Config to cmd_show. The
providers module builds each provider's PathResolver from
Config::home_dir(). opencode, copilot, and cursor (Windows) get
their directory injected, since their internal env reads win
against with_home. cmd_show constructs every provider via
with_resolver.
@github-actions

Copy link
Copy Markdown

🔍 Preview deployed: https://a5a8be23.toolpath.pages.dev

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.

1 participant