Skip to content

Remove env reads from the provider crates #185

Description

@ecalifornica

Part of #183. Breaking change. One minor version bump and one PR per crate.

Work, per resolver

  • Replace PathResolver::new() with new(home): a required home-directory argument. Delete the Default impl.
    • Stale callers fail to compile. That is the intended signal.
    • Each crate keeps the knowledge of its harness's data location (for example: claude data is in <home>/.claude). Only "what is home" moves to the caller.
  • With home always present, the path accessors become infallible. Delete the NoHomeDirectory error variants.
  • Where a crate builds a resolver from an override directory alone, add a from_<dir> constructor (for example from_claude_dir).
  • Keep the per-crate with_* overrides, for example:
    let resolver = PathResolver::new(home).with_claude_dir("/custom/.claude");
  • Add setters that take the env value, so harness layout knowledge stays in the crate:
    • opencode: with_xdg_data_home(xdg); the resolver appends opencode.
    • cursor: with_appdata(appdata); the resolver appends Cursor. Only the Windows default consults it.
    • with_data_dir and with_user_data_dir stay as full overrides.
    • copilot needs no setter: $COPILOT_HOME replaces the whole root, so the injected value carries no layout knowledge.
  • pi: delete the ./.pi/agent/sessions cwd fallback.
  • Delete the six duplicate home_dir() helpers.
  • Delete the XDG_DATA_HOME, COPILOT_HOME, and APPDATA reads.

Work, reader flags

  • Convert CODEX_ROLLOUT_STRICT, CLAUDE_CLI_DEBUG, and COPILOT_EVENTS_STRICT to parameters.
  • path-cli reads each variable into Config. A bool flows inward as a builder setter on the reader type, default false.
  • copilot's private read_lines_impl(path, strict) is the target shape. Delete the env read in the public read_lines.

Note

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions