@torka/claude-qol 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Add to your `.claude/settings.local.json`:
|
|
|
45
45
|
"hooks": [
|
|
46
46
|
{
|
|
47
47
|
"type": "command",
|
|
48
|
-
"command": "python3
|
|
48
|
+
"command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/scripts/auto_approve_safe.py"
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
}
|
|
@@ -62,7 +62,7 @@ Add to your `.claude/settings.local.json`:
|
|
|
62
62
|
{
|
|
63
63
|
"statusLine": {
|
|
64
64
|
"type": "command",
|
|
65
|
-
"command": "python3
|
|
65
|
+
"command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/scripts/context-monitor.py"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
```
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"hooks": [
|
|
23
23
|
{
|
|
24
24
|
"type": "command",
|
|
25
|
-
"command": "python3
|
|
25
|
+
"command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/scripts/auto_approve_safe.py"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
28
|
}
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
},
|
|
61
61
|
"statusLine": {
|
|
62
62
|
"type": "command",
|
|
63
|
-
"command": "python3
|
|
63
|
+
"command": "python3 \"$CLAUDE_PROJECT_DIR\"/.claude/scripts/context-monitor.py"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -47,7 +47,8 @@ def load_rules() -> dict:
|
|
|
47
47
|
# print(f"Warning: Could not load global rules: {e}", file=sys.stderr)
|
|
48
48
|
|
|
49
49
|
# Load project-specific rules (merge with global)
|
|
50
|
-
|
|
50
|
+
# Use __file__ to find rules relative to script location (works from subdirectories)
|
|
51
|
+
project_rules_path = Path(__file__).parent / "auto_approve_safe.rules.json"
|
|
51
52
|
if project_rules_path.exists():
|
|
52
53
|
try:
|
|
53
54
|
with open(project_rules_path) as f:
|
|
@@ -106,7 +107,8 @@ def log_decision(tool_name: str, tool_input: dict, decision: str, reason: str) -
|
|
|
106
107
|
if not ENABLE_DECISION_LOG:
|
|
107
108
|
return
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
# Use __file__ to find log path relative to script location (works from subdirectories)
|
|
111
|
+
log_path = Path(__file__).parent.parent / "auto_approve_safe.decisions.jsonl"
|
|
110
112
|
record = {
|
|
111
113
|
"ts": datetime.now(timezone.utc).isoformat(),
|
|
112
114
|
"cwd": str(Path.cwd()),
|
package/install.js
CHANGED
|
@@ -160,7 +160,7 @@ function install() {
|
|
|
160
160
|
log(' "matcher": "Bash|Read|Grep|Glob|Write|Edit|MultiEdit",');
|
|
161
161
|
log(' "hooks": [{');
|
|
162
162
|
log(' "type": "command",');
|
|
163
|
-
log(' "command": "python3
|
|
163
|
+
log(' "command": "python3 \\"$CLAUDE_PROJECT_DIR\\"/.claude/scripts/auto_approve_safe.py"');
|
|
164
164
|
log(' }]');
|
|
165
165
|
log(' }]');
|
|
166
166
|
log(' }');
|
|
@@ -170,7 +170,7 @@ function install() {
|
|
|
170
170
|
log(' {');
|
|
171
171
|
log(' "statusLine": {');
|
|
172
172
|
log(' "type": "command",');
|
|
173
|
-
log(' "command": "python3
|
|
173
|
+
log(' "command": "python3 \\"$CLAUDE_PROJECT_DIR\\"/.claude/scripts/context-monitor.py"');
|
|
174
174
|
log(' }');
|
|
175
175
|
log(' }\n');
|
|
176
176
|
|
package/package.json
CHANGED
|
@@ -123,10 +123,15 @@ def get_directory_display(workspace_data):
|
|
|
123
123
|
else:
|
|
124
124
|
return "unknown"
|
|
125
125
|
|
|
126
|
-
def get_git_branch():
|
|
127
|
-
"""Get the current git branch name by reading .git/HEAD directly.
|
|
126
|
+
def get_git_branch(project_dir):
|
|
127
|
+
"""Get the current git branch name by reading .git/HEAD directly.
|
|
128
|
+
|
|
129
|
+
Uses project_dir from workspace data to work correctly from subdirectories.
|
|
130
|
+
"""
|
|
128
131
|
try:
|
|
129
|
-
|
|
132
|
+
if not project_dir:
|
|
133
|
+
return None
|
|
134
|
+
git_dir = os.path.join(project_dir, ".git")
|
|
130
135
|
if os.path.isdir(git_dir):
|
|
131
136
|
head_file = os.path.join(git_dir, "HEAD")
|
|
132
137
|
if os.path.isfile(head_file):
|
|
@@ -157,7 +162,7 @@ def main():
|
|
|
157
162
|
context_info = context_window_info(context_window)
|
|
158
163
|
context_display = get_context_display(context_info)
|
|
159
164
|
directory = get_directory_display(workspace)
|
|
160
|
-
git_branch = get_git_branch()
|
|
165
|
+
git_branch = get_git_branch(workspace.get('project_dir'))
|
|
161
166
|
git_display = f" \033[96m🌿 {git_branch}\033[0m" if git_branch else ""
|
|
162
167
|
|
|
163
168
|
model_display = f"\033[94m[{model_name}]\033[0m"
|