auto-detect plan, complexity scoring, ctx7 cache, graphify in workflows

- detect_plan() auto-detects Max/Pro/Free from ~/.claude.json
- session-start budget adapts to plan (Max=20k, Pro=11k, Free=5k)
- token counting now uses only ACTIVE plugins, not installed binaries
- statusline shows plan label + session duration instead of start time
- plugin-advisor: complexity assessment (0-100%) drives tool selection
- plugin-advisor: auto-activation with confirmation (PHASE 4)
- ruflo OFF by default, GSD v2 preferred for multi-session
- init-project: ctx7 pre-fetch + graphify scaffold + graphify full
- ship-feature: ctx7 cache check before implementation
- frontend-design disabled in installer (doublon with ui-ux-pro-max)
- python3 -c moved from deny to ask (unblocks graphify)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
bastien
2026-04-12 14:56:22 +02:00
co-authored by Claude Opus 4.6
parent 0dac12b885
commit 66beae16b7
8 changed files with 264 additions and 93 deletions
+30 -12
View File
@@ -86,25 +86,43 @@ fi
REPO_DIR="${_repo_dir:-}"
unset _claude_real _repo_dir
# Quick passive token cost estimate (Pro session budget = ~11k tokens)
# Detect plan and set passive token budget
PLAN=$(detect_plan 2>/dev/null || echo "pro")
case "$PLAN" in
max) _budget=20000; PLAN_LABEL="Max" ;;
pro) _budget=11000; PLAN_LABEL="Pro" ;;
free) _budget=5000; PLAN_LABEL="Free" ;;
*) _budget=11000; PLAN_LABEL="Pro" ;;
esac
# Quick passive token cost estimate
# Only count plugins that are ACTIVE (detected as ON), not just installed
_passive_t=0
detect_superpowers 2>/dev/null && _passive_t=$((_passive_t + 800))
detect_gstack 2>/dev/null && _passive_t=$((_passive_t + 2750))
detect_frontend_design 2>/dev/null && _passive_t=$((_passive_t + 200))
detect_plugin_dev 2>/dev/null && _passive_t=$((_passive_t + 100))
detect_uiux_pro_max 2>/dev/null && _passive_t=$((_passive_t + 400))
detect_context7 2>/dev/null && _passive_t=$((_passive_t + 200))
detect_ruflo 2>/dev/null && _passive_t=$((_passive_t + 1000))
detect_graphifyy 2>/dev/null && _passive_t=$((_passive_t + 300))
_budget_pct=$((_passive_t * 100 / 11000))
# Token costs for toggle plugins — map display name to cost
declare -A _plugin_costs=(
[gstack]=2750
[ui-ux-pro-max]=400
[frontend-design]=200
[plugin-dev]=100
[context7]=200
[ruflo]=1000
[graphifyy]=300
)
for _p in "${TOGGLE_ACTIVE[@]}"; do
_cost="${_plugin_costs[$_p]:-0}"
_passive_t=$((_passive_t + _cost))
done
_budget_pct=$((_passive_t * 100 / _budget))
if [ "$_budget_pct" -gt 50 ]; then
TOKEN_WARN="⚠️ ~${_passive_t}t passif (${_budget_pct}% budget)"
TOKEN_WARN="⚠️ ~${_passive_t}t passif (${_budget_pct}% budget $PLAN_LABEL)"
elif [ "$_budget_pct" -gt 25 ]; then
TOKEN_WARN="~${_passive_t}t passif (${_budget_pct}% budget)"
TOKEN_WARN="~${_passive_t}t passif (${_budget_pct}% budget $PLAN_LABEL)"
else
TOKEN_WARN=""
fi
unset _passive_t _budget_pct
unset _passive_t _budget_pct _budget
echo ""
echo "┌─ Claude Code config ──────────────────────────────────┐"
+24 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Claude Code statusline — folder, git branch, model, context %
# Claude Code statusline — model, folder, branch, plan, context bar, session start
# Receives JSON on stdin from Claude Code.
INPUT=$(cat)
@@ -18,6 +18,28 @@ if [ -d "$DIR" ]; then
fi
BRANCH_STR="${BRANCH:+ ($BRANCH)}"
# Plan detection (reuse shared lib)
_lib="$(dirname "${BASH_SOURCE[0]}")/../lib/detect-plugins.sh"
if [ -f "$_lib" ]; then
source "$_lib"
PLAN=$(detect_plan 2>/dev/null || echo "pro")
else
PLAN="pro"
fi
PLAN_UPPER=$(echo "$PLAN" | tr '[:lower:]' '[:upper:]' | head -c1)$(echo "$PLAN" | tail -c+2)
# Session duration (from total_duration_ms)
DURATION_MS=$(echo "$INPUT" | jq -r \
'.cost.total_duration_ms // 0' | cut -d. -f1)
DURATION_S=$((DURATION_MS / 1000))
if [ "$DURATION_S" -ge 3600 ]; then
DURATION="$((DURATION_S / 3600))h$((DURATION_S % 3600 / 60))m"
elif [ "$DURATION_S" -ge 60 ]; then
DURATION="$((DURATION_S / 60))m"
else
DURATION="<1m"
fi
# Progress bar (20 chars wide)
WIDTH=20
FILLED=$((PCT * WIDTH / 100))
@@ -45,4 +67,4 @@ fi
RESET="\033[0m"
# Output: single line
echo -e "$MODEL | $FOLDER${BRANCH_STR} | ${COLOR}${BAR}${RESET} ${PCT}%"
echo -e "$MODEL | $FOLDER${BRANCH_STR} | $PLAN_UPPER | ${COLOR}${BAR}${RESET} ${PCT}% | ${DURATION}"