refactor(opencode): PathResolver::new takes a required home argument - #210
Open
ecalifornica wants to merge 1 commit into
Open
refactor(opencode): PathResolver::new takes a required home argument#210ecalifornica wants to merge 1 commit into
ecalifornica wants to merge 1 commit into
Conversation
|
🔍 Preview deployed: https://42c0bfc9.toolpath.pages.dev |
ecalifornica
force-pushed
the
robert/config-opencode
branch
from
August 14, 2026 19:49
61393ef to
c186b8a
Compare
ecalifornica
marked this pull request as ready for review
August 17, 2026 18:01
…185) toolpath-opencode reads no environment variable. The caller supplies the home directory and the XDG data root. The crate keeps the layout knowledge: the data directory is <xdg>/opencode, or <home>/.local/share/opencode. PathResolver::with_xdg_data_home sets the XDG data root, and the resolver appends opencode to it. with_data_dir stays as the full override. path-cli passes the configured value through verbatim, so $XDG_DATA_HOME keeps its behavior for CLI users. The 7 path accessors whose only failure mode was a missing home return a path instead of a Result. The SQLite reads and the directory reads keep their Result. The snapshot git repository needs a resolver. to_view and derive_path skip it; to_view_with_resolver, derive_path_with_resolver, and the ConversationProvider impl open it. path-cli: providers::opencode_resolver returns Option<PathResolver>, require_opencode_resolver serves the 5 commands that target opencode, and harness_bundle omits opencode when the configuration carries no home directory.
ecalifornica
force-pushed
the
robert/config-opencode
branch
from
August 18, 2026 20:09
c186b8a to
73d0fcd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #185: the crate reads no environment variable,
Configowns every read, and the caller supplies what the crate used to resolve itself.Judgment calls:
$XDG_DATA_HOME/opencodebefore the home fallback (<home>/.local/share/opencode).with_xdg_data_home(xdg)stores the root and the resolver appendsopencode: the append is layout knowledge, so it belongs to the crate, and the CLI owns only the value. The precedence is stated in one place and unit-tested:with_data_dir, thenwith_xdg_data_home, then the home default.$XDG_DATA_HOMEproduces the relative data diropencode, exactly as the in-crate read did (itsis_emptyguard never fired after thejoin). Empty-as-unset is a separate change.to_view(session)andderive_path(session, config)skip it; the_with_resolvervariants and theConversationProviderimpl open it.path-clicalls the resolver-bearing functions, so its file diffs are unchanged.