Resolve the setup's folders in one module
CI / tests (pull_request) Successful in 4m39s

This commit is contained in:
2026-12-03 11:19:04 +01:00
parent 45eeef846d
commit 08afc3df85
31 changed files with 115 additions and 35 deletions
+21 -1
View File
@@ -1,6 +1,26 @@
"""Where the setup's folders are: the one module that names them, so that moving one is a change here alone."""
import dataclasses
from collections.abc import Mapping
import pathlib
# The release root: the folder the running code ships in, with bin/, skills/ and agents/.
RELEASE_ROOT = pathlib.Path(__file__).resolve().parents[2]
# Each folder below is named relative to the person's home folder.
# The Claude home. A release is deployed into it, so the deployed CLAUDE.md, rules/ and agents/ are read there too.
CLAUDE_HOME = ".claude"
# The config folder, which holds one folder per project.
CONFIG_FOLDER = ".claude-projects"
# The state folder, which holds one folder per tool.
STATE_FOLDER = ".local/state"
def state_folder(env: Mapping[str, str], home: pathlib.Path) -> pathlib.Path:
"""The state folder of a tool that honours `XDG_STATE_HOME`."""
return pathlib.Path(env.get("XDG_STATE_HOME") or home / STATE_FOLDER)
@dataclasses.dataclass(frozen=True)
class Paths:
@@ -14,7 +34,7 @@ class Paths:
def paths_from(home: pathlib.Path) -> Paths:
claude = home / ".claude"
claude = home / CLAUDE_HOME
return Paths(
claude_code_transcripts=claude / "projects",
claude_dir=claude,