Stats
Actions
Tags
From dm-cc-assistant
Runs a shell script on session start to initialize the plugin environment. Executes bash commands.
1 event · 1 hook
Where this hook configuration is defined
Defined in hooks/hooks.json
Event handlers and matchers — expand Raw Configuration for the full JSON
bash -c '
set -e
echo "dm-cc-assistant v0.3 loaded."
if [ ! -f ./CLAUDE.md ]; then
echo " No CLAUDE.md found. Run /dm-cc-assistant:project-init to bootstrap."
echo " Commands: :project-init"
exit 0
fi
if [ ! -f .task/backlog.md ]; then
echo " No backlog yet. Run /dm-cc-assistant:backlog to create one."
echo " Commands: :backlog | :plan | :execute | :release"
exit 0
fi
IS_V02=0
IS_V03=0
if grep -qE "^- \*\*T-[0-9]+" .task/backlog.md 2>/dev/null; then IS_V02=1; fi
if grep -qE "^### E-[0-9]+" .task/backlog.md 2>/dev/null; then IS_V03=1; fi
if [ "$IS_V02" = "1" ] && [ "$IS_V03" = "0" ]; then
echo " Backlog в формате v0.2 (плоский T-ID). Запусти /dm-cc-assistant:backlog для миграции на v0.3."
echo " Commands: :backlog"
exit 0
fi
if [ "$IS_V03" = "0" ]; then
echo " Backlog в неизвестном формате — проверь .task/backlog.md вручную."
exit 0
fi
IN_PROGRESS_BLOCK=$(awk '/^## In Progress$/{f=1; next} /^## /{f=0} f' .task/backlog.md)
TODO_BLOCK=$(awk '/^## Todo$/{f=1; next} /^## /{f=0} f' .task/backlog.md)
DONE_BLOCK=$(awk '/^## Done$/{f=1; next} /^## /{f=0} f' .task/backlog.md)
CANCELLED_BLOCK=$(awk '/^## Cancelled$/{f=1; next} /^## /{f=0} f' .task/backlog.md)
IN_PROGRESS=$(echo "$IN_PROGRESS_BLOCK" | grep -cE "^### E-" || true)
TODO=$(echo "$TODO_BLOCK" | grep -cE "^### E-" || true)
DONE=$(echo "$DONE_BLOCK" | grep -cE "^### E-" || true)
CANCELLED=$(echo "$CANCELLED_BLOCK" | grep -cE "^### E-" || true)
MSG=" Backlog: $IN_PROGRESS in progress, $TODO todo, $DONE done"
if [ "$CANCELLED" -gt 0 ]; then MSG="$MSG, $CANCELLED cancelled"; fi
echo "$MSG"
if [ "$IN_PROGRESS" -ge 1 ]; then
ACTIVE_LINE=$(echo "$IN_PROGRESS_BLOCK" | grep -E "^### E-" | head -1)
ACTIVE_ID=$(echo "$ACTIVE_LINE" | grep -oE "E-[0-9]+" | head -1)
ACTIVE_TITLE=$(echo "$ACTIVE_LINE" | sed -E "s/^### E-[0-9]+ \[[^]]+\] (\([^)]+\) )?//")
TOTAL_SUB=$(echo "$IN_PROGRESS_BLOCK" | grep -cE "^ - \*\*E-[0-9]+\.[0-9]+" || true)
DONE_SUB=$(echo "$IN_PROGRESS_BLOCK" | grep -cE "^ - \*\*E-[0-9]+\.[0-9]+\*\* \[[^]]+\] Done" || true)
if [ "$IN_PROGRESS" -gt 1 ]; then
echo " ⚠ Больше одного эпика в In Progress — сломанное состояние. Зайди в /backlog (Unselect active epic)."
fi
if [ "$TOTAL_SUB" = "0" ]; then
echo " Active: $ACTIVE_ID «$ACTIVE_TITLE» (no plan yet — run /plan)"
else
echo " Active: $ACTIVE_ID «$ACTIVE_TITLE» ($DONE_SUB/$TOTAL_SUB done)"
fi
if [ -f ".task/plan-${ACTIVE_ID}.md" ]; then
echo " .task/plan-${ACTIVE_ID}.md ready"
fi
if [ -f ".task/report-${ACTIVE_ID}.md" ]; then
echo " .task/report-${ACTIVE_ID}.md ready — review needed (final dialog in /execute or /release)"
fi
fi
if [ -f .task/.execute-active ]; then
MARKER=$(head -1 .task/.execute-active 2>/dev/null || true)
echo " ⚠ /execute is active: $MARKER — не редактируй backlog руками"
fi
echo " Commands: :backlog | :plan | :execute | :release"
'npx claudepluginhub dmatryus/dm-cc-assistant --plugin dm-cc-assistant