Skip to content

feat: respect $XDG_DATA_HOME for the data directory (legacy ~/.plannotator preserved)#1093

Merged
backnotprop merged 1 commit into
mainfrom
feat/xdg-data-home-fallback
Jul 20, 2026
Merged

feat: respect $XDG_DATA_HOME for the data directory (legacy ~/.plannotator preserved)#1093
backnotprop merged 1 commit into
mainfrom
feat/xdg-data-home-fallback

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

What

Adds XDG-aware placement for the Plannotator data directory, using the git-style legacy-first pattern. New resolution order:

  1. PLANNOTATOR_DATA_DIR — unchanged, remains the top-priority override (with ~ expansion)
  2. ~/.plannotator if it exists — the legacy default always wins
  3. $XDG_DATA_HOME/plannotator — when XDG_DATA_HOME is set to a non-empty absolute path
  4. ~/.plannotator — default for everyone else

Zero change for existing users — the fallback only fires when ~/.plannotator does not exist and $XDG_DATA_HOME is set. All macOS/Windows users and anyone who doesn't set XDG vars keep ~/.plannotator exactly as before. The XDG spec's implicit ~/.local/share default is deliberately not applied — only an explicitly-set $XDG_DATA_HOME moves the directory.

Where

  • packages/shared/data-dir.ts — the shared resolver (Pi picks it up automatically via vendor.sh)
  • apps/amp-plugin/plannotator.ts — the Amp plugin's private copy, mirrored
  • scripts/install.sh / install.ps1 / install.cmd — config.json resolution mirrored (XDG honored on Windows too if set, same rule)
  • packages/shared/data-dir.test.ts — new unit tests covering all four branches (run in subprocesses with a faked HOME, since Bun resolves homedir() at process start)
  • Docs: README.md (new PLANNOTATOR_DATA_DIR mention + export example), AGENTS.md/CLAUDE.md, and the marketing env-var reference

History

This builds on the direction from #568 (@cwrau) and #612 (@Joao-O-Santos), which proposed full XDG base-directory support, and the single monolithic-directory model established in #795 (@IstPlayer). Per the maintainer feedback on those PRs, this change deliberately stops short of a config/data/cache split — it only adds XDG-aware placement of the one directory, and PLANNOTATOR_DATA_DIR remains the top-priority override for anyone who wants full control.

Closes #1051

https://claude.ai/code/session_01YXkgsNucxDwAL4GdR4XYRk

…otator does not exist

New resolution order for the Plannotator data directory:

  1. PLANNOTATOR_DATA_DIR (unchanged, top priority, ~ expansion)
  2. ~/.plannotator when it already exists (legacy default — existing
     installs never move)
  3. $XDG_DATA_HOME/plannotator when XDG_DATA_HOME is set to a
     non-empty absolute path
  4. ~/.plannotator (default for everyone else)

This is git's legacy-first pattern: the XDG branch only fires for fresh
installs whose user has explicitly set XDG_DATA_HOME. The XDG spec's
implicit ~/.local/share default is deliberately NOT applied, and the
directory stays monolithic (no config/data/cache split).

Mirrored in every private copy of the resolver: the Amp plugin,
scripts/install.sh, scripts/install.ps1, and scripts/install.cmd. The
Pi runtime picks the change up automatically via vendor.sh. Docs updated
in README.md, AGENTS.md/CLAUDE.md, and the marketing env-var reference.

Claude-Session: https://claude.ai/code/session_01YXkgsNucxDwAL4GdR4XYRk
@backnotprop
backnotprop merged commit 9ddb87a into main Jul 20, 2026
13 checks passed
@backnotprop
backnotprop deleted the feat/xdg-data-home-fallback branch July 20, 2026 15:55
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.

Please don't put data/config directly in ~/

1 participant