fix(banner): plugin rows follow the effective profile, not user scope

The ✅ row and detect_uiux_pro_max read user-scope settings.json and the
plugin cache, so a dev project showed ui-ux-pro-max on and an audit
project hid pr-review-toolkit. list_on_plugins now resolves the effective
profile (user scope for unmanaged ids); status-reporter and the plugin
advisor read per-project state from it.
This commit is contained in:
bchanot committed 2026-11-10 12:39:50 +01:00
1 parent 9f9821eab7
commit 556d0e6ddf
6 files changed
+179 -17

No files matched your search

+30 -4
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
# ============================================================
# lib/detect-plugins.sh — Single source of truth for plugin detection
# Sourced by: session-start.sh, doctor.sh
# Sourced by: session-start.sh, doctor.sh, agents/status-reporter.md
#
# Each function returns 0 (detected) or 1 (not detected).
# No output — callers handle messaging.
# detect_* return 0 (detected) or 1 (not detected), silently — callers
# handle messaging. detect_plan and list_on_plugins print to stdout.
# ============================================================
# --- Always-on plugins ---
@@ -23,6 +23,30 @@ detect_superpowers() {
}
# --- Effective plugin state ---
list_on_plugins() {
# Enabled plugin ids for this project and conversation, one per line:
# the effective profile for the ids lib/profiles manages (BDR-134),
# user-scope true for the others (LRN-005). Always returns 0.
# shortcut: unmanaged ids read user scope only (not project/local) and
# a skills-dir mod set in no scope (memory) is not seen, nor a mod's
# ~/.claude/<name>.json off switch; upgrade = jq merge of the scopes +
# plugin manifests.
local plain="${PROFILE_PLAIN:-}" user
[ -n "$plain" ] || plain="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" \
current --plain 2>/dev/null)" || plain=""
user="$(grep -oE '"[A-Za-z0-9_-]+@[A-Za-z0-9_-]+"[[:space:]]*:[[:space:]]*true' \
"$HOME/.claude/settings.json" 2>/dev/null)" || user=""
awk -F= 'FNR == NR { if (sub(/^plugin:/, "", $1)) { m[$1] = 1
if ($2 == "on") print $1 }; next }
{ sub(/^"/, ""); sub(/".*$/, "") }
$0 != "" && !($0 in m) && $0 !~ /^pack-.*@skills-dir$/' \
<(printf '%s\n' "$plain") <(printf '%s\n' "$user")
return 0
}
# --- Toggle plugins ---
detect_gstack() {
@@ -47,8 +71,10 @@ detect_plugin_dev() {
}
detect_uiux_pro_max() {
# installed (cache) AND enabled for this project (here-string: no pipe)
local cache_dir="$HOME/.claude/plugins/cache"
[ -d "$cache_dir" ] && compgen -G "$cache_dir"/*ui-ux-pro-max* &>/dev/null
[ -d "$cache_dir" ] && compgen -G "$cache_dir"/*ui-ux-pro-max* &>/dev/null \
&& grep -q '^ui-ux-pro-max@' <<<"$(list_on_plugins)"
}
detect_context7() {