Documentation
¶
Overview ¶
Package claudesettings reads and caches Claude Code's settings file (`~/.claude/settings.json`). Multiple TUI adapters need data from this file (lspscan reads enabledPlugins to flag LSPs; mcpconfig reads it to list MCP plugins). Without coordination, both would re-read and re-parse the file on every snapshot tick.
A single Reader serves all callers. The cached parse is invalidated only when the file's (mtime, size) fingerprint changes — which happens when the user edits plugins in Claude Code, not on a per-second cadence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// Path overrides the default `~/.claude/settings.json` location.
// Tests pin this to a fixture; production leaves it empty.
Path string
// contains filtered or unexported fields
}
Reader returns parsed Settings, caching the result across calls. Safe for concurrent use.
func (*Reader) Read ¶
Read returns the parsed settings. Returns an empty Settings (not an error) when the file is missing, unreadable, or malformed — adapters must degrade gracefully.
Reads are cache-served when the file's (mtime, size) match the last observed state. The Stat call is cheap; the avoided ReadFile + json.Unmarshal would otherwise run on every TUI snapshot tick.