axonflowCacheDir (cache-dir)

axonflow-openclaw-plugin · infra, cache-directory, xdg-paths, platform-detection, storage

Resolves the platform-specific cache directory for AxonFlow, honoring an explicit override, XDG, and OS conventions. Centralizes state location logic for portability and testability.

export function axonflowCacheDir(): string {
  // Explicit override wins. Useful for sandboxed containers (read-only HOME),
  // CI test isolation (os.homedir() ignores process.env.HOME on macOS), and
  // users who want to redirect AxonFlow state to a non-default location.
  const override = process.env["AXONFLOW_CACHE_DIR"];
  if (override && override.length > 0) {
    return override;
  }

  const platform = process.platform;
  const home = os.homedir();

  if (platform === "win32") {
    const localAppData = process.env["LOCALAPPDATA"];
    if (localAppData && localAppData.length > 0) {
      return path.join(localAppData, "axonflow");
    }
    const appData = process.env["APPDATA"];
    if (appData && appData.length > 0) {
      return path.join(appData, "axonflow");
    }
    if (ho

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key