claudesettings

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 5 Imported by: 0

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 New

func New() *Reader

New constructs a Reader pointing at the default settings path.

func NewAt

func NewAt(path string) *Reader

NewAt constructs a Reader pointing at a specific path.

func (*Reader) Read

func (r *Reader) Read() Settings

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.

type Settings

type Settings struct {
	EnabledPlugins map[string]bool
}

Settings is the parsed subset of `~/.claude/settings.json` that adapters in this codebase consume. Fields not listed here are ignored.

Jump to

Keyboard shortcuts

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