Skip to content

feat(cli): thread Config through the export path - #199

Draft
ecalifornica wants to merge 1 commit into
robert/config-importfrom
robert/config-export
Draft

feat(cli): thread Config through the export path#199
ecalifornica wants to merge 1 commit into
robert/config-importfrom
robert/config-export

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

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

What

  • cmd_p passes &Config to cmd_export::run, cmd_project::run, and cmd_incept::run. The two forwarders pass it straight to cmd_export::run.
  • Every run_<harness> and every write_into_<harness> helper takes &Config. Each one builds its PathResolver from providers::<harness>_resolver(config).
  • The pub(crate) project_<harness> wrappers take &Config and forward it.
  • cmd_resume::project_into_harness takes &Config. cmd_resume is threaded by its own PR; run_with_strategy loads a transitional Config at that call site.
  • The pathbase arm is unchanged. $PATHBASE_URL, the credentials path, and the upload-side reads stay where they are; a later PR owns them.
  • The cache store's config_dir() call is unchanged for the same reason.
  • Emscripten gating is unchanged: every providers:: call site sits inside an existing #[cfg(not(target_os = "emscripten"))] function, and the bail blocks consume config (verified by reading the cfg attributes; host test/clippy do not compile the wasm target).

Behavior change

  • p export pi / p project / p incept / resume of a pi session, 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, these resolve %USERPROFILE%\.pi\agent\sessions. This matches the import and sync changes earlier in the series.

Tests

  • The cmd_export unit tests inject a Config in place of setting $HOME around each call. Two helpers build them: config_with_home for the harnesses that resolve from the home, and config_with_opencode_home, which also injects xdg_data_home because the opencode resolver's internal $XDG_DATA_HOME read wins against the home.
  • Eleven tests drop their $HOME save/restore block and their TEST_ENV_LOCK guard. They no longer serialize against the rest of the suite.
  • pathbase_repo_flag_requires_login keeps its $TOOLPATH_CONFIG_DIR scaffolding: the pathbase arm still reads the environment.
  • cmd_resume's project_into_harness_claude_round_trip loads a Config inside its scoped-home guard.
  • tests/resume.rs runs the projection end to end for all seven harnesses under a ScopedHome, so $HOME reaches the resolvers through Config.

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

Copy link
Copy Markdown

🔍 Preview deployed: https://d7432faf.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