cc-safe-setup 16.0.0 → 16.2.0
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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**One command to make Claude Code safe for autonomous operation.** [日本語](docs/README.ja.md)
|
|
8
8
|
|
|
9
|
-
8 built-in + 124 examples = **
|
|
9
|
+
8 built-in + 124 examples = **153 hooks**. 44 CLI commands. 561 tests. 5 languages. [**Hub**](https://yurukusa.github.io/cc-safe-setup/hub.html) · [Wizard](https://yurukusa.github.io/cc-safe-setup/wizard.html) · [Cheat Sheet](https://yurukusa.github.io/cc-safe-setup/hooks-cheatsheet.html) · [Builder](https://yurukusa.github.io/cc-safe-setup/builder.html) · [FAQ](https://yurukusa.github.io/cc-safe-setup/faq.html) · [Examples](https://yurukusa.github.io/cc-safe-setup/by-example.html) · [Matrix](https://yurukusa.github.io/cc-safe-setup/matrix.html) · [Playground](https://yurukusa.github.io/cc-hook-registry/playground.html)
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npx cc-safe-setup
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
COMMAND=$(cat | jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
2
|
+
[ -z "$COMMAND" ] && exit 0
|
|
3
|
+
if echo "$COMMAND" | grep -qE 'curl\s+.*(-X\s+POST|--data|--upload-file|-F\s).*[^localhost]'; then
|
|
4
|
+
HOST=$(echo "$COMMAND" | grep -oE 'https?://[^/ ]+' | head -1)
|
|
5
|
+
case "$HOST" in *localhost*|*127.0.0.1*|*github.com*|*npmjs.org*) exit 0 ;; esac
|
|
6
|
+
echo "WARNING: Data upload to external host: $HOST" >&2
|
|
7
|
+
fi
|
|
8
|
+
exit 0
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
FILE=$(cat | jq -r '.tool_input.file_path // empty' 2>/dev/null)
|
|
2
|
+
[ -z "$FILE" ] && exit 0
|
|
3
|
+
case "$FILE" in
|
|
4
|
+
*/src/*|*/test*/*|*/lib/*|*/app/*|*.md|*.json|*.yml|*.yaml|*.toml) exit 0 ;;
|
|
5
|
+
*/.claude/*|*/.github/*) exit 0 ;;
|
|
6
|
+
*) echo "NOTE: Writing outside standard directories: $FILE" >&2 ;;
|
|
7
|
+
esac
|
|
8
|
+
exit 0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# session-budget-alert.sh — Show session budget status on start
|
|
3
|
+
# TRIGGER: SessionStart MATCHER: ""
|
|
4
|
+
# Reads from token budget state if available
|
|
5
|
+
STATE_PREFIX="/tmp/cc-token-budget-"
|
|
6
|
+
STATES=$(ls ${STATE_PREFIX}* 2>/dev/null)
|
|
7
|
+
if [ -n "$STATES" ]; then
|
|
8
|
+
for f in $STATES; do
|
|
9
|
+
TOKENS=$(cat "$f" 2>/dev/null || echo 0)
|
|
10
|
+
COST=$((TOKENS * 75 / 10000))
|
|
11
|
+
if [ "$COST" -gt 100 ]; then
|
|
12
|
+
echo "NOTE: Previous session spent ~\$${COST%??}.${COST: -2} in estimated tokens." >&2
|
|
13
|
+
fi
|
|
14
|
+
done
|
|
15
|
+
fi
|
|
16
|
+
exit 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-safe-setup",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.0",
|
|
4
4
|
"description": "One command to make Claude Code safe. 59 hooks (8 built-in + 51 examples). 26 CLI commands: dashboard, create, audit, lint, diff, migrate, compare, generate-ci. 284 tests.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"bin": {
|