Skip to main content

Module inventory

Module inventory 

Source
Expand description

Inventory enumeration: turn the fixed target-root list into hashed PathEntry rows.

§Target roots

Hard-coded list in target_roots. Two classes:

  • Home-rooted — Claude Code config / skills / agents / plugins under crate::Paths::user_home joined with .claude/, and <user_home>/.claude.json.
  • Project-rooted.claude/settings.json, .mcp.json, dependency manifests + lockfiles, .env resolved relative to the current working directory.

Missing targets are silently skipped (no error). Directories are walked recursively, with SKIP_DIRS / SKIP_FILES noise filtered out. Symlinks are not followed.

§~/.claude.json decomposition

path_entries treats local_config as a special category and splits the JSON into virtual fragments keyed by <file>#<json-path> for the three security-relevant blocks (mcpServers, hooks, permissions, both top-level and per-project under projects.<p>.<key>). This prevents unrelated background writes (session counters, cache, last-used timestamps) from appearing as “modified” in the diff. If the file is present but unparseable, the entry falls back to a single full-file hash; if no watched block is present, a single #(no-watched-block) sentinel entry is emitted so creation / deletion is still tracked.

Structs§

PathEntry
One hashed file or virtual JSON fragment.

Functions§

collect
Walk all target_roots and return a sorted list of PathEntry.