feat(paths): use XDG base directories instead of ~/.plannotator#568
Open
cwrau wants to merge 1 commit intobacknotprop:mainfrom
Open
feat(paths): use XDG base directories instead of ~/.plannotator#568cwrau wants to merge 1 commit intobacknotprop:mainfrom
cwrau wants to merge 1 commit intobacknotprop:mainfrom
Conversation
New installations now store data, state, and config under the XDG Base Directory Specification: data -> $XDG_DATA_HOME/plannotator (plans, version history) state -> $XDG_STATE_HOME/plannotator (drafts, sessions, debug logs) config -> $XDG_CONFIG_HOME/plannotator (config.json, hooks) Existing installations are unaffected: the legacy ~/.plannotator directory is detected at runtime and used as-is for all three bases, so no migration is required for current users. The central logic lives in packages/shared/paths.ts, which exports getDataBase(), getStateBase(), and getConfigBase(). All six call sites (storage, draft, config, improvement-hooks, sessions, codex-review) now import from there instead of hardcoding homedir(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
I understand this on one hand. And the code organization is great. On the other, this is a fairly big lift I need to just map out mentally. Also, there is a lot of convenience in ~/ dot directories. |
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.
Summary
packages/shared/paths.tswith three helpers:getDataBase(),getStateBase(),getConfigBase()plans/,history/) under$XDG_DATA_HOME/plannotator(default:~/.local/share/plannotator)drafts/,sessions/, debug logs) under$XDG_STATE_HOME/plannotator(default:~/.local/state/plannotator)config.json, improvement hooks) under$XDG_CONFIG_HOME/plannotator(default:~/.config/plannotator)~/.plannotatoralready exists on disk, all three helpers return it — zero migration requiredCall sites updated
packages/shared/storage.tsgetDataBase()for plans + historypackages/shared/draft.tsgetStateBase()for draftspackages/shared/config.tsgetConfigBase()for config.jsonpackages/shared/improvement-hooks.tsgetConfigBase()for hooks dirpackages/server/sessions.tsgetStateBase()for sessionspackages/server/codex-review.tsgetStateBase()for schema file + debug logMigration for existing users
No action needed —
~/.plannotatorcontinues to work unchanged. To adopt XDG paths, simply move the directory:Config and state can be split further if desired:
Test plan
~/.local/share/plannotator/, state in~/.local/state/plannotator/, config in~/.config/plannotator/~/.plannotatorpresent: verify all paths still resolve to~/.plannotator(no regression)XDG_DATA_HOME,XDG_STATE_HOME,XDG_CONFIG_HOME: verify respected on fresh install🤖 Generated with Claude Code