Documentation
¶
Overview ¶
Package datadir resolves and (lazily) creates tai's global per-user data directory.
Precedence (per add-tai-foundation/specs/cli-framework/spec.md):
- $TAI_DATA_DIR if set and non-empty (used verbatim — no suffix).
- $XDG_DATA_HOME/tai/ if $XDG_DATA_HOME is set and non-empty.
- $HOME/.local/share/tai/ on Linux and macOS.
- %LOCALAPPDATA%\tai\ on Windows.
Resolve MUST NOT touch the filesystem. EnsureWritable creates the directory tree lazily and reports DATA_DIR_UNWRITABLE on failure.
Stability contract: this package is part of the pkg/ public surface — its exported functions and the DATA_DIR_UNWRITABLE errcode are append-only. Promoted from plugins/triage/internal/datadir in Phase 2 of pivot-to-ai-as-code (when core/internal/sync started needing data-directory resolution).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureWritable ¶
EnsureWritable resolves the data directory and creates it (and any missing parents) if absent, returning the resolved path on success.
Returns a *errcode.Error{Code: DataDirUnwritable} if the directory cannot be created or is not writable. The remediation block points at $TAI_DATA_DIR as the most direct fix.
func Resolve ¶
Resolve returns the path tai should use for its data directory. It reads environment variables and (on POSIX) the user's home directory, but creates no files or directories.
Returns an error only when the home directory cannot be located AND no explicit override is set — a rare configuration on real machines.
Types ¶
This section is empty.