Skip to content

feat: store config in ~/.config/keeptui on macOS (XDG) - #40

Merged
stanlyzoolo merged 1 commit into
mainfrom
feat/xdg-config-dir
Jul 24, 2026
Merged

feat: store config in ~/.config/keeptui on macOS (XDG)#40
stanlyzoolo merged 1 commit into
mainfrom
feat/xdg-config-dir

Conversation

@stanlyzoolo

Copy link
Copy Markdown
Owner

os.UserConfigDir() returns ~/Library/Application Support on macOS, so the config dir diverged from Linux and from what the docs claimed (~/.config/keeptui). This unifies macOS and Linux on ~/.config/keeptui.

Change

New stdlib-only leaf internal/configdir resolves the base config dir:

OS Base
macOS, Linux $XDG_CONFIG_HOME else ~/.config
Windows %AppData% (os.UserConfigDir(), unchanged)

Pure baseFor(goos, getenv, userConfigDir, userHomeDir) core + thin Base() wrapper (the shellCommand/planFor idiom), table-tested across all three GOOS branches. The four path sites — loader.MetaPath, version cache + token, logx.logDir — route through configdir.Base(). Test seams unchanged (they short-circuit before the resolver). migrateConfigDir now targets the new base, so the legacy keyskeeptui migration lands where the app reads.

configdir is the new bottom leaf of the import graph; logx's only project import is now this leaf.

Not included

No in-app migration from the old macOS ~/Library/Application Support/keeptui. The app isn't released yet, so there are no users to migrate (my own data was moved by hand).

Docs

CLAUDE.md, ARCHITECTURE.md (package table, mermaid graph, storage table) and README.md updated: base dir per OS, configdir package, logx no longer "dependency-free".

Testing

go build · go vet ./... · go test -race ./... · golangci-lint run — all green. New configdir_test.go covers the three GOOS branches plus the home/config error paths.

🤖 Generated with Claude Code

…on Support

os.UserConfigDir() returns ~/Library/Application Support on macOS, so the
config dir diverged from Linux and from what the docs claimed. Add a
stdlib-only internal/configdir leaf that resolves the base dir uniformly:
~/.config/keeptui on macOS and Linux ($XDG_CONFIG_HOME else ~/.config),
%AppData%\keeptui on Windows (unchanged). meta.yaml, cache.json, token and
logs all route through configdir.Base().

Pure baseFor(goos, getenv, userConfigDir, userHomeDir) core + Base() wrapper,
table-tested across all three GOOS branches. migrateConfigDir now targets the
new base so the legacy keys->keeptui migration lands where the app reads.

Docs synced (CLAUDE.md, ARCHITECTURE.md incl. the mermaid graph, README.md).
No in-app migration for the old macOS path — the app isn't released yet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@stanlyzoolo
stanlyzoolo merged commit 5dc1e9f into main Jul 24, 2026
3 checks passed
@stanlyzoolo
stanlyzoolo deleted the feat/xdg-config-dir branch July 25, 2026 20:16
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.

1 participant