paths

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package paths resolves filesystem locations for budgetclaw's config, state, data, and cache, following the XDG Base Directory Specification.

XDG is the 2026 expectation for new CLI tools: Linux, macOS, and modern shells all respect it, and it keeps user home directories clean. Legacy tools that drop a single ~/.toolname directory are increasingly seen as anti-patterns. budgetclaw goes XDG-first from day one.

Layout:

$XDG_CONFIG_HOME/budgetclaw/   config.toml, limit rules
$XDG_STATE_HOME/budgetclaw/    state.db (rollups, events)
$XDG_DATA_HOME/budgetclaw/     lockfiles/, plugin bundles
$XDG_CACHE_HOME/budgetclaw/    pricing table cache

Defaults when XDG_* are unset (per the spec):

XDG_CONFIG_HOME → $HOME/.config
XDG_STATE_HOME  → $HOME/.local/state
XDG_DATA_HOME   → $HOME/.local/share
XDG_CACHE_HOME  → $HOME/.cache

Every function returns an absolute path with "budgetclaw" appended. Callers are responsible for MkdirAll before writing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() (string, error)

CacheDir returns the directory holding the pricing table cache and any other regenerable artifacts. Honors XDG_CACHE_HOME, defaults to $HOME/.cache/budgetclaw.

func ClaudeProjectsDir

func ClaudeProjectsDir() (string, error)

ClaudeProjectsDir returns $HOME/.claude/projects, the directory Claude Code writes its session JSONL logs to. This path is Claude-Code-owned and not configurable via XDG.

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the directory holding config.toml and limit rules. Honors XDG_CONFIG_HOME, defaults to $HOME/.config/budgetclaw.

func DataDir

func DataDir() (string, error)

DataDir returns the directory holding lockfiles and plugin bundles. Honors XDG_DATA_HOME, defaults to $HOME/.local/share/budgetclaw.

func StateDir

func StateDir() (string, error)

StateDir returns the directory holding state.db and rollups. Honors XDG_STATE_HOME, defaults to $HOME/.local/state/budgetclaw.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL