feat(hooks,doctor): statusline and banner read profile.sh current --plain once; doctor runs the pack census and checks cc.sh sourcing, user-scope residue and the opus default
This commit is contained in:
1 parent
58958229d9
commit
6509ab2958
10 files changed
+131
-202
No files matched your search
+17
-2
@@ -64,6 +64,10 @@ unset _gg_lib
|
||||
|
||||
# ── Toggle plugin detection ──
|
||||
|
||||
# One profile.sh run, shared with detect_gstack through PROFILE_PLAIN.
|
||||
PROFILE_PLAIN="$(bash "$HOME/.claude/lib/profile.sh" -C "$PWD" current --plain 2>/dev/null)" || PROFILE_PLAIN=""
|
||||
export PROFILE_PLAIN
|
||||
|
||||
TOGGLE_ACTIVE=()
|
||||
TOGGLE_INACTIVE=()
|
||||
|
||||
@@ -88,6 +92,17 @@ done
|
||||
ACTIVE_STR="${TOGGLE_ACTIVE[*]:-none}"
|
||||
INACTIVE_STR="${TOGGLE_INACTIVE[*]:-none}"
|
||||
|
||||
# Profile row: the project's local profile, the conversation's --settings
|
||||
# one, or none (manifest defaults = full) with the /plugin-check pointer.
|
||||
_pname="$(sed -n 's/^profile=//p' <<<"$PROFILE_PLAIN" | head -1)"
|
||||
case "$(sed -n 's/^source=//p' <<<"$PROFILE_PLAIN" | head -1)" in
|
||||
flag) PROFILE_ROW="profile: ${_pname} (conv)" ;;
|
||||
local) PROFILE_ROW="profile: ${_pname} (local)" ;;
|
||||
default) PROFILE_ROW="profile: none (full), try /plugin-check" ;;
|
||||
*) PROFILE_ROW="profile: ? (profile.sh failed)" ;;
|
||||
esac
|
||||
unset _pname
|
||||
|
||||
# GSD v2 — standalone CLI (not a Claude Code plugin — shown separately)
|
||||
if detect_gsd 2>/dev/null; then
|
||||
GSD_STATUS="gsd v2 ✓"
|
||||
@@ -289,7 +304,7 @@ if [ -n "$_remote_ver" ] && [ "$_remote_ver" != "$CONFIG_VERSION" ]; then
|
||||
fi
|
||||
unset _remote_ver REPO_DIR
|
||||
|
||||
echo "│ 💡 /plugin-check before starting a new project │"
|
||||
printf "│ 🎛 %-46s│\n" "$PROFILE_ROW"
|
||||
echo "│ 🩺 make doctor full diagnostic │"
|
||||
echo "└───────────────────────────────────────────────────┘"
|
||||
[ -n "$EFFORT_WARN" ] && printf '%s\n' "$EFFORT_WARN"
|
||||
@@ -309,4 +324,4 @@ EOF
|
||||
fi
|
||||
unset _gx_root
|
||||
echo ""
|
||||
unset TOKEN_WARN
|
||||
unset TOKEN_WARN PROFILE_PLAIN
|
||||
+8
-12
@@ -6,6 +6,7 @@ INPUT=$(cat)
|
||||
|
||||
MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "?"')
|
||||
DIR=$(echo "$INPUT" | jq -r '.cwd // "?"')
|
||||
PROJ=$(echo "$INPUT" | jq -r '.workspace.project_dir // .cwd // "."' 2>/dev/null)
|
||||
FOLDER="${DIR##*/}"
|
||||
PCT=$(echo "$INPUT" | jq -r \
|
||||
'.context_window.used_percentage // 0' \
|
||||
@@ -20,18 +21,13 @@ BRANCH_STR="${BRANCH:+ ($BRANCH)}"
|
||||
|
||||
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
# Default profile — same constant as lib/profile.sh's active_profile(),
|
||||
# read without sourcing the lib (speed). Unreadable lib → literal fallback.
|
||||
DEFAULT_PROFILE=$(sed -n 's/^DEFAULT_PROFILE="\([^"]*\)".*/\1/p' "$REPO/lib/profile.sh" 2>/dev/null)
|
||||
[ -n "$DEFAULT_PROFILE" ] || DEFAULT_PROFILE=full
|
||||
|
||||
# Active profile (written by lib/profile.sh set|apply|reset to <repo>/.active-profile).
|
||||
# Read directly — `profile.sh current` is 12s+ and unusable in a statusline.
|
||||
# Cache absent/empty/legacy "none" (same rule as active_profile()) → default.
|
||||
PROFILE=$(head -n1 "$REPO/.active-profile" 2>/dev/null | tr -d '[:space:]')
|
||||
if [ -z "$PROFILE" ] || [ "$PROFILE" = "none" ]; then
|
||||
PROFILE="$DEFAULT_PROFILE"
|
||||
fi
|
||||
# Profile of this project and conversation: `profile.sh current --plain`
|
||||
# (two jq calls) on the session's project dir. `(conv)` = a --settings
|
||||
# conversation. Any failure -> "?".
|
||||
_plain="$(bash "$REPO/lib/profile.sh" -C "$PROJ" current --plain 2>/dev/null)" || _plain=""
|
||||
PROFILE="$(sed -n 's/^profile=//p' <<<"$_plain" | head -1)"
|
||||
[ -n "$PROFILE" ] || PROFILE="?"
|
||||
[ "$(sed -n 's/^source=//p' <<<"$_plain" | head -1)" = flag ] && PROFILE="$PROFILE (conv)"
|
||||
|
||||
# Effort level: the live value when the harness exports it (skill/agent
|
||||
# `effort:` shifts included, BDR-107), else the persisted settings.json key
|
||||
|
||||
Reference in new issue
Block a user