Skip to content

refactor(claude): PathResolver::new takes a required home argument - #208

Draft
ecalifornica wants to merge 1 commit into
robert/config-codexfrom
robert/config-claude
Draft

refactor(claude): PathResolver::new takes a required home argument#208
ecalifornica wants to merge 1 commit into
robert/config-codexfrom
robert/config-claude

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Part of #185.

toolpath-claude reads no environment variable. The caller supplies the home directory. The crate keeps the layout below it: Claude data is in <home>/.claude.

toolpath-claude, breaking, 0.13.0

  • PathResolver::new(home) takes the home directory as a required argument. ClaudeConvo::new(home) and ConvoIO::new(home) take the same argument.
  • Deleted: the Default impls on PathResolver, ConvoIO, and ClaudeConvo; PathResolver::with_home; the private dirs::home_dir helper; the NoHomeDirectory error variant.
  • with_claude_dir stays as the full override.
  • The home directory is always present, so the 10 pure path and existence accessors return a value instead of a Result. The CHANGELOG lists them.
  • list_project_dirs, list_conversations, and every read path keep their Result. Their error is a failed directory or file read, not a missing home.

Verbose parse warnings are a parameter:

  • Context: a conversation file is a Claude Code session log (~/.claude/projects/**/*.jsonl). The reader tolerates unparseable lines; by default it warns about the first 5, and verbose warnings cover every one. The flag is in this PR because $CLAUDE_CLI_DEBUG selects it, and this refactor moves every environment read out of the crate.
  • ConversationReader::read_conversation_with(path, verbose_warnings) takes the flag directly. ConversationReader::read_conversation(path) stays on the first-5 default.
  • ConvoIO::with_verbose_warnings(bool) and ClaudeConvo::with_verbose_warnings(bool) store the flag, default false, and pass it down.
  • The crate reads no environment variable for it.

path-cli

  • providers::claude_resolver returns Option<PathResolver>. None means Config carries no home directory, so the Claude harness is out of reach.
  • harness_bundle omits the Claude manager when the resolver is None.
  • providers::require_claude_resolver turns None into an error. The 6 commands that target Claude use it: p list claude, p import claude, p export claude --project, the plugin-facing session lookup in p export, show claude, and the single-session derive.
  • Config reads $CLAUDE_CLI_DEBUG. providers::claude_verbose_warnings turns its presence into the flag every ClaudeConvo receives, so the variable keeps its behavior for CLI users.

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

)

toolpath-claude reads no environment variable. The caller supplies the
home directory; the crate keeps the layout below it (`<home>/.claude`).

Library (breaking, 0.13.0):

- `PathResolver::new(home)` takes the home directory as a required
  argument. `ClaudeConvo::new(home)` and `ConvoIO::new(home)` take the
  same argument.
- Delete the `Default` impls on the three types, `with_home`, the
  private `dirs::home_dir` helper, and the `NoHomeDirectory` error
  variant.
- Keep `with_claude_dir` as the full override.
- The home directory is always present, so `home_dir()`, `claude_dir()`,
  `projects_dir()`, `history_file()`, `project_dir()`,
  `conversation_file()`, `ConvoIO::claude_dir_path()`, and
  `ConvoIO::conversation_exists()` return a value, not a `Result`.
  Callers inside the crate drop the dead error arms.
- Verbose parse warnings are a `bool` parameter.
  `ConversationReader::read_conversation_with(path, verbose_warnings)`
  takes it directly. `ConvoIO::with_verbose_warnings` and
  `ClaudeConvo::with_verbose_warnings` store it and pass it down.
  `ConversationReader::read_conversation(path)` warns about the first 5
  unparseable lines only.

path-cli:

- `providers::claude_resolver` returns `Option<PathResolver>`. `None`
  means `Config` carries no home directory, so Claude is out of reach.
- `harness_bundle` omits the Claude manager in that case.
- `providers::require_claude_resolver` reports "cannot determine the
  home directory" for the 6 commands that target Claude.
- `Config` reads `$CLAUDE_CLI_DEBUG`. `providers::claude_verbose_warnings`
  turns its presence into the flag every `ClaudeConvo` receives, so the
  variable keeps its behavior for CLI users.

Version bump per the release checklist: crate manifest, workspace
dependency, site/_data/crates.json, CHANGELOG.md.
@github-actions

Copy link
Copy Markdown

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