fix: honor CLAUDE_CONFIG_DIR in ts init global scope and transcript discovery#66
Open
andrebrait wants to merge 2 commits into
Open
fix: honor CLAUDE_CONFIG_DIR in ts init global scope and transcript discovery#66andrebrait wants to merge 2 commits into
ts init global scope and transcript discovery#66andrebrait wants to merge 2 commits into
Conversation
…iscovery Claude Code supports relocating its config directory via the CLAUDE_CONFIG_DIR environment variable. settings_path() resolved the claude global scope from a hardcoded ~/.claude/settings.json, so 'ts init --agent claude --global' wrote hooks into a file Claude Code never loads; transcript_root() likewise read ~/.claude/projects, so transcript discovery and the stats features scanned the wrong directory. Resolve both from CLAUDE_CONFIG_DIR when set; an explicit home override (used by tests) still wins. Fixes Mibayy#65 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #65.
What
Claude Code supports relocating its configuration directory via the
CLAUDE_CONFIG_DIRenvironment variable. Two spots resolved Claude paths from a hardcoded~/.claude:settings_path("claude", "global")(cli_init/agent_paths.py) —ts init --agent claude --globalwrote hooks into~/.claude/settings.json, which Claude Code never loads on such setups, so the install silently had no effect.transcript_root()(discover/transcript_scanner.py) — transcript discovery and the stats features scanned~/.claude/projectsinstead of the active config dir.Both now honor
CLAUDE_CONFIG_DIRwhen set and keep the~/.claudedefault otherwise. The explicithomeoverride used by tests still wins over the environment variable.Tests
Four new tests (two per module): env var honored, and default/explicit-
homebehavior preserved. Written first and confirmed failing on unpatchedmain, passing unchanged after the fix.Full suite: 1793 passed, 9 skipped, 1 failed — the failure (
tests/test_daemon_client.py::test_successful_call_returns_text) also fails on untouchedupstream/mainin the same environment, so it is pre-existing and unrelated.🤖 Generated with Claude Code