Skip to content

Commit 417deaa

Browse files
committed
CM-61986-remove-windows-path-impl
1 parent 61f2522 commit 417deaa

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

cycode/cli/apps/ai_guardrails/scan/claude_config.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,18 @@
1-
"""Reader for Claude Code configuration file.
1+
"""Reader for ~/.claude.json configuration file.
22
33
Extracts user email from the Claude Code global config file
44
for 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

117
import json
12-
import os
13-
import platform
148
from pathlib import Path
159
from typing import Optional
1610

1711
from cycode.logger import get_logger
1812

1913
logger = 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

4418
def load_claude_config(config_path: Optional[Path] = None) -> Optional[dict]:

0 commit comments

Comments
 (0)