Skip to content

refactor(cursor): PathResolver::new takes a required home argument - #211

Open
ecalifornica wants to merge 1 commit into
robert/config-opencodefrom
robert/config-cursor
Open

refactor(cursor): PathResolver::new takes a required home argument#211
ecalifornica wants to merge 1 commit into
robert/config-opencodefrom
robert/config-cursor

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Part of #185: the crate reads no environment variable, Config owns every read, and the caller supplies what the crate used to resolve itself.

Judgment calls:

  • appdata is a dedicated argument, not a pre-computed with_user_data_dir(appdata.join("Cursor")) in the CLI. Context: %APPDATA% is the Windows roaming-application-data root, and only Cursor's Windows default user-data directory consults it. with_appdata(appdata) stores the root and the resolver appends Cursor: the crate owns the layout, the CLI owns only the value. Every other platform's default ignores the value, and with_user_data_dir wins against both.
  • The CLI injects $APPDATA under #[cfg(windows)]. The gate is belt-and-braces: a non-Windows resolver takes and ignores the value, so injection elsewhere would change nothing.

@ecalifornica ecalifornica changed the title robert/config cursor refactor(cursor): PathResolver::new takes a required home argument Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://3aba5a36.toolpath.pages.dev

Comment on lines +118 to 120
// The resolver applies $APPDATA only on Windows; injecting it on
// other platforms would change resolution there.
#[cfg(windows)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment, non-Windows ignores the value.

@ecalifornica
ecalifornica marked this pull request as ready for review August 17, 2026 18:02
@ecalifornica
ecalifornica requested a review from akesling August 17, 2026 18:02
@ecalifornica ecalifornica assigned akesling and unassigned akesling Aug 17, 2026
)

toolpath-cursor reads no environment variable. The caller supplies
the home directory and the Windows roaming-application-data root.
The crate keeps the layout below them: the Anysphere tree is
<home>/.cursor, and the Electron user-data root is the per-platform
default.

CursorConvo::new(home) and CursorIO::new(home) take the same
argument. Deleted: the Default impls on PathResolver, CursorIO, and
CursorConvo; PathResolver::with_home; the private home-directory
helper; the NoHomeDirectory error variant. with_anysphere_dir and
with_user_data_dir stay as the full overrides.

PathResolver::with_appdata(appdata) sets %APPDATA%, the Windows
roaming-application-data root. The Windows default user-data
directory is <appdata>/Cursor. Every other platform ignores the
value.

The home directory is always present, so the 10 path accessors and
CursorIO::db_path return a value instead of a Result. The CHANGELOG
lists them. find_workspace_id and ensure_workspace_storage_entry
keep their Result.

path-cli: providers::cursor_resolver returns Option<PathResolver>,
harness_bundle omits Cursor when it is None, and the 5 commands that
target Cursor go through providers::require_cursor_resolver. Config
reads $APPDATA and passes it to the resolver on Windows.
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.

2 participants