Claude.Core.Settings (claude v0.1.0)

Generic settings management for Claude configuration files. Handles JSON-based settings that can be used by any feature.

Summary

Functions

Checks if settings are effectively empty.

Checks if the settings file exists.

Gets a value from settings using a path of keys.

Returns the path to the settings.json file.

Sets a value in settings using a path of keys.

Reads settings from the JSON file. Returns {:ok, map} or {:error, reason}.

Removes the settings file if it exists.

Updates settings by applying a function to the current settings.

Writes settings to the JSON file. Creates the directory structure if needed.

Functions

empty?(settings)

Checks if settings are effectively empty.

exists?()

Checks if the settings file exists.

get(key_path, default \\ nil)

Gets a value from settings using a path of keys.

Examples

get(["hooks", "PostToolUse"])
get(["memory", "auto_update"], false)

path()

Returns the path to the settings.json file.

put(key_path, value)

Sets a value in settings using a path of keys.

read()

Reads settings from the JSON file. Returns {:ok, map} or {:error, reason}.

remove()

Removes the settings file if it exists.

update(fun)

Updates settings by applying a function to the current settings.

write(settings)

Writes settings to the JSON file. Creates the directory structure if needed.