Implements core/paths (Config/Data/State/Cache/Runtime/Log/Bin
directory resolution with canonical-vs-search-dir separation, XDG on
Unix, native APPDATA/LOCALAPPDATA/PROGRAMDATA layering on Windows,
~/Library on macOS Desktop, injectable environment/platform for
deterministic cross-platform tests) and core/config (file search,
first-match resolution, layered YAML merging, safe ${VAR} expansion,
Explain/doctor introspection) on top of the shared Application/
Kind/Scope model in the core package.
4.5 KiB
4.5 KiB
TODO / open architecture questions
Deliberately not resolved in this V1 (see spec section 63 and AGENTS.md's "no over-abstraction" rule) -- tracked here rather than solved speculatively.
Migration
- Migrate
yetontocore/paths/core/config.yet'sinternal/store.Home()($YETANO_HOME, defaulting toos.UserConfigDir()/yetano) andinternal/config(fixed/etc/yetano/yetano.yaml->~/.config/yetano/yetano.yaml->./yetano.yaml->--configcascade) predate this library and overlap with what it now provides. Migrating is a deliberately separate follow-up, not part of this change --yet's existing behavior needs to be evaluated field-by-field (e.g.$YETANO_HOME's default ofos.UserConfigDir()/yetanois not the same locationcore/pathswould resolve for an app named "yetano"/"yet"; that divergence needs a conscious decision, not a silent behavior change). - Once
yetmigrates, evaluateyasta,yamocir,yaiam, andyalsh-adjacent projects the same way (per the original task description) -- each on its own merits, not as a blanket sweep.
Platform tuning
- FreeBSD's flavor (
freebsd.go) is a best-effort first pass. Other BSD and Unix-familyGOOSvalues (openbsd,netbsd,dragonfly,solaris,illumos, ...) currently fall back to the Linux flavor (flavor()'s default case) -- verified to compile and behave sensibly, not verified against each OS's actual convention. Adding a dedicated flavor table for one of them is a small, additive change (a new<os>.gofile plus onecaseinflavor()), never a redesign. - macOS Desktop's
RuntimeDir()(~/Library/Application Support/<App>/Runtime) is a placeholder -- macOS has no strong native convention for a GUI app's ephemeral runtime directory the way XDG_RUNTIME_DIR does on Linux. Revisit if a real Desktop consumer needs something more specific (e.g. aTemporaryItems-based location). LogAliasDir()(spec section 39:~/.local/log/<app>as a Unix convenience symlink target) is resolved but never created -- no symlink-creation API exists yet. Decide whether this is worth adding before any consumer actually wants it.
Windows
- BinDir / installer strategy.
paths.BinDir()for Windows resolves%LOCALAPPDATA%\Yetano\bin(user) /%PROGRAMDATA%\Yetano\bin(system) as locations, per spec section 19. Whether/howyetactually adds either toPATH, and how a package gets "activated" there (symlink vs. junction vs. copy/shim launcher, spec section 20) is explicitly out of scope forcore-- path resolution and package activation stay separate concerns (spec section 20's own instruction). - The native
SHGetKnownFolderPathfallback inknownfolders_windows.gohas only been verified to compile (GOOS=windows go build/go vet), never run on an actual Windows host. It is a secondary fallback below environment variables, so a latent bug there would only matter in the edge case whereAPPDATA/LOCALAPPDATA/PROGRAMDATAare all unset in the process environment on real Windows.
Portability / distribution model
paths.WithRoot/YETANO_HOME-style portable mode:WithRootexists and is tested, but there is no ecosystem-wide "portable install" concept wired up yet (spec section 41's "optional later:YETANO_HOMEor portable mode").- The future
yetpackage store model (spec sections 2/37/38: package store vs. application data vs. config vs. state vs. cache vs. runtime vs. executables, as distinct concepts) is intentionally not implemented here --core/pathsonly provides the primitives (scoped, prioritized directories) a future store implementation would sit on top of. - Plugin/extension search paths: no dedicated category exists yet;
paths.FindFileis generic enough that a caller can build one today (e.g. overDataSearchDirs()with aplugins/suffix) without needing a newPathKind. - Atomic package activation, versioning/rollback for that future store: out of scope, same as above.
Central Yetano config
config.WithYetanoDefaults(true)resolves the shared~/.config/yetano/(or platform equivalent) via a pseudo-Application {Name: "yetano", Kind: core.CLI}. This is deliberately always CLI-shaped (XDG-flavored everywhere), even for a Desktop or Service caller, since it's a shared, admin/CLI-facing location -- revisit only if a real consumer needs the shared config to follow a different convention on macOS/Windows Desktop apps specifically.