Fixes #106. Three root causes identified and fixed: 1. Session catchup not working after /clear: Added UserPromptSubmit hook to all 7 IDE SKILL.md files. When task_plan.md exists, injects a directive to read all planning files before proceeding. Fires on every user message, ensuring context recovery after /clear or compaction. 2. Progress not updating consistently: PostToolUse hook message now leads with "Update progress.md" instead of only mentioning task_plan.md. Added plan existence guard to avoid noise when no plan is active. 3. Post-plan additions not tracked: check-complete scripts now output re-entry guidance when all phases are complete. Copilot agent-stop scripts now return continuation context instead of empty JSON. Added Critical Rule #7 (Continue After Completion) to SKILL.md body. Applied across: 7 IDE SKILL.md files, 16 synced check-complete scripts, 4 Copilot hook scripts, CHANGELOG, plugin.json, marketplace.json.
47 lines
1.7 KiB
Bash
Executable File
47 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# planning-with-files: Agent stop hook for GitHub Copilot
|
|
# Checks if all phases in task_plan.md are complete.
|
|
# Injects continuation context if phases are incomplete.
|
|
# Always exits 0 — outputs JSON to stdout.
|
|
|
|
# Read stdin (required — Copilot pipes JSON to stdin)
|
|
INPUT=$(cat)
|
|
|
|
PLAN_FILE="task_plan.md"
|
|
|
|
if [ ! -f "$PLAN_FILE" ]; then
|
|
echo '{}'
|
|
exit 0
|
|
fi
|
|
|
|
# Count total phases
|
|
TOTAL=$(grep -c "### Phase" "$PLAN_FILE" || true)
|
|
|
|
# Check for **Status:** format first
|
|
COMPLETE=$(grep -cF "**Status:** complete" "$PLAN_FILE" || true)
|
|
IN_PROGRESS=$(grep -cF "**Status:** in_progress" "$PLAN_FILE" || true)
|
|
PENDING=$(grep -cF "**Status:** pending" "$PLAN_FILE" || true)
|
|
|
|
# Fallback: check for [complete] inline format
|
|
if [ "$COMPLETE" -eq 0 ] && [ "$IN_PROGRESS" -eq 0 ] && [ "$PENDING" -eq 0 ]; then
|
|
COMPLETE=$(grep -c "\[complete\]" "$PLAN_FILE" || true)
|
|
IN_PROGRESS=$(grep -c "\[in_progress\]" "$PLAN_FILE" || true)
|
|
PENDING=$(grep -c "\[pending\]" "$PLAN_FILE" || true)
|
|
fi
|
|
|
|
# Default to 0 if empty
|
|
: "${TOTAL:=0}"
|
|
: "${COMPLETE:=0}"
|
|
: "${IN_PROGRESS:=0}"
|
|
: "${PENDING:=0}"
|
|
|
|
if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
|
|
MSG="[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL). If the user has additional work, add new phases to task_plan.md before starting."
|
|
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"AgentStop\",\"additionalContext\":\"$MSG\"}}"
|
|
exit 0
|
|
fi
|
|
|
|
MSG="[planning-with-files] Task incomplete ($COMPLETE/$TOTAL phases done). Update progress.md, then read task_plan.md and continue working on the remaining phases."
|
|
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"AgentStop\",\"additionalContext\":\"$MSG\"}}"
|
|
exit 0
|