File tree Expand file tree Collapse file tree 1 file changed +2
-28
lines changed
cycode/cli/apps/ai_guardrails/scan Expand file tree Collapse file tree 1 file changed +2
-28
lines changed Original file line number Diff line number Diff line change 1- """Reader for Claude Code configuration file.
1+ """Reader for ~/.claude.json configuration file.
22
33Extracts user email from the Claude Code global config file
44for use in AI guardrails scan enrichment.
5-
6- Config file locations:
7- - macOS/Linux: ~/.claude.json
8- - Windows: %APPDATA%/Claude/claude.json (fallback: ~/.claude.json)
95"""
106
117import json
12- import os
13- import platform
148from pathlib import Path
159from typing import Optional
1610
1711from cycode .logger import get_logger
1812
1913logger = get_logger ('AI Guardrails Claude Config' )
2014
21- _CLAUDE_CONFIG_FILENAME = 'claude.json'
22-
23-
24- def _get_claude_config_path () -> Path :
25- """Get Claude config file path based on platform.
26-
27- Claude Code uses ~/.claude.json on macOS/Linux.
28- On Windows, checks %APPDATA%/Claude/claude.json first,
29- then falls back to ~/.claude.json.
30- """
31- if platform .system () == 'Windows' :
32- appdata = os .environ .get ('APPDATA' )
33- if appdata :
34- appdata_path = Path (appdata ) / 'Claude' / _CLAUDE_CONFIG_FILENAME
35- if appdata_path .exists ():
36- return appdata_path
37-
38- return Path .home () / f'.{ _CLAUDE_CONFIG_FILENAME } '
39-
40-
41- _CLAUDE_CONFIG_PATH = _get_claude_config_path ()
15+ _CLAUDE_CONFIG_PATH = Path .home () / '.claude.json'
4216
4317
4418def load_claude_config (config_path : Optional [Path ] = None ) -> Optional [dict ]:
You can’t perform that action at this time.
0 commit comments