Function: cacheDir()
cacheDir(
namespace?,options?):string
Defined in: packages/aiui-util/src/index.ts:62
Resolve the cache directory for aiui, creating it by default.
Resolution order:
$AIUI_CACHE— an explicit override; used verbatim as the aiui cache root.$XDG_CACHE_HOME/aiui— honoring the XDG Base Directory spec (the variable is ignored unless it's an absolute path, per the spec).~/.cache/aiui— the XDG default.
Pass namespace to carve out a subdirectory for a particular kind of cached data, e.g. cacheDir("claude") → ~/.cache/aiui/claude. Different callers cache different things, so each should pick its own namespace rather than writing into the shared root.
KEEP IN SYNC: bootstrap/aiui-registry/src/paths.ts carries an exact, deliberate duplicate of this resolution (the one accepted duplication in the registry design notes §7, git history). A change here that isn't mirrored there would make the two read different registries.
Parameters
namespace?
string
options?
CacheDirOptions = {}
Returns
string
Example
ts
const dir = cacheDir("screenshots"); // created, ready to write into
const dir = cacheDir("claude", { create: false }); // resolve the path only