mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-07 10:19:09 +02:00
Report Claude permission mode in diagnostics
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
# Diagnose installation, registration, routing, indexing, and recorded savings without
|
# Diagnose installation, registration, routing, indexing, permissions, and recorded savings without
|
||||||
# printing MCP environment values (which may contain the Home Assistant access token).
|
# printing MCP environment values (which may contain the Home Assistant access token).
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
set +e
|
set +e
|
||||||
@@ -22,10 +22,31 @@ for tool in claude claude-desktop headroom rtk tokensave git gh rg jq shellcheck
|
|||||||
done
|
done
|
||||||
|
|
||||||
section "Configured switches"
|
section "Configured switches"
|
||||||
for option in install_headroom headroom_wrap_claude_code expose_headroom_dashboard install_rtk install_tokensave install_caveman enable_tools_health_report; do
|
for option in permission_mode install_headroom headroom_wrap_claude_code expose_headroom_dashboard install_rtk install_tokensave install_caveman enable_tools_health_report; do
|
||||||
printf '%-30s %s\n' "$option" "$(bashio::config "$option")"
|
printf '%-30s %s\n' "$option" "$(bashio::config "$option")"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
section "Claude Code permission state"
|
||||||
|
python3 - <<'PY'
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
path = Path.home() / ".claude/settings.json"
|
||||||
|
try:
|
||||||
|
data = json.loads(path.read_text())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("settings: MISSING")
|
||||||
|
except Exception as exc:
|
||||||
|
print(f"settings: INVALID: {exc}")
|
||||||
|
else:
|
||||||
|
permissions = data.get("permissions", {})
|
||||||
|
if isinstance(permissions, dict):
|
||||||
|
print(f"permissions.defaultMode: {permissions.get('defaultMode', '<upstream default>')}")
|
||||||
|
else:
|
||||||
|
print("permissions: INVALID")
|
||||||
|
print(f"managed-state marker: {(Path.home() / '.claude/.addon-permission-mode.json').exists()}")
|
||||||
|
PY
|
||||||
|
|
||||||
section "MCP registrations (environment values redacted)"
|
section "MCP registrations (environment values redacted)"
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
import json
|
import json
|
||||||
@@ -118,11 +139,11 @@ if bashio::config.true 'install_tokensave'; then
|
|||||||
tokensave gain --all --range 30d || true
|
tokensave gain --all --range 30d || true
|
||||||
while IFS= read -r configured_path; do
|
while IFS= read -r configured_path; do
|
||||||
[ -n "$configured_path" ] || continue
|
[ -n "$configured_path" ] || continue
|
||||||
repo_root="$(git -C "$configured_path" rev-parse --show-toplevel 2> /dev/null || true)"
|
repo_root="$(s6-setuidgid abc env HOME="$HOME" git -c safe.directory='*' -C "$configured_path" rev-parse --show-toplevel 2> /dev/null || true)"
|
||||||
if [ -z "$repo_root" ]; then
|
if [ -z "$repo_root" ]; then
|
||||||
echo "${configured_path}: not a Git repository"
|
echo "${configured_path}: not a Git repository"
|
||||||
elif [ -f "$repo_root/.tokensave/tokensave.db" ]; then
|
elif [ -f "$repo_root/.tokensave/tokensave.db" ]; then
|
||||||
tokensave status "$repo_root" --short || true
|
s6-setuidgid abc env HOME="$HOME" tokensave status "$repo_root" --short || true
|
||||||
else
|
else
|
||||||
echo "${repo_root}: NOT INITIALIZED"
|
echo "${repo_root}: NOT INITIALIZED"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user