Initial commit: Flutter 无书应用项目
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# planning-with-files: Post-tool-use hook for Cursor (PowerShell)
|
||||
# Reminds the agent to update task_plan.md after file modifications.
|
||||
|
||||
if (Test-Path "task_plan.md") {
|
||||
Write-Output "[planning-with-files] Update progress.md with what you just did. If a phase is now complete, update task_plan.md status."
|
||||
}
|
||||
exit 0
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# planning-with-files: Post-tool-use hook for Cursor
|
||||
# Reminds the agent to update task_plan.md after file modifications.
|
||||
|
||||
if [ -f task_plan.md ]; then
|
||||
echo "[planning-with-files] Update progress.md with what you just did. If a phase is now complete, update task_plan.md status."
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,12 @@
|
||||
# planning-with-files: Pre-tool-use hook for Cursor (PowerShell)
|
||||
# Reads the first 30 lines of task_plan.md to keep goals in context.
|
||||
# Returns {"decision": "allow"} — this hook never blocks tools.
|
||||
|
||||
$PlanFile = "task_plan.md"
|
||||
|
||||
if (Test-Path $PlanFile) {
|
||||
Get-Content $PlanFile -TotalCount 30 | Write-Host
|
||||
}
|
||||
|
||||
Write-Output '{"decision": "allow"}'
|
||||
exit 0
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# planning-with-files: Pre-tool-use hook for Cursor
|
||||
# Reads the first 30 lines of task_plan.md to keep goals in context.
|
||||
# Returns {"decision": "allow"} — this hook never blocks tools.
|
||||
|
||||
PLAN_FILE="task_plan.md"
|
||||
|
||||
if [ -f "$PLAN_FILE" ]; then
|
||||
# Log plan context to stderr (visible in Cursor's hook logs)
|
||||
head -30 "$PLAN_FILE" >&2
|
||||
fi
|
||||
|
||||
echo '{"decision": "allow"}'
|
||||
exit 0
|
||||
34
.trae/skills/planning-with-files/.cursor/hooks/stop.ps1
Normal file
34
.trae/skills/planning-with-files/.cursor/hooks/stop.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
# planning-with-files: Stop hook for Cursor (PowerShell)
|
||||
# Checks if all phases in task_plan.md are complete.
|
||||
# Returns followup_message to auto-continue if phases are incomplete.
|
||||
# Always exits 0 — uses JSON stdout for control.
|
||||
|
||||
$PlanFile = "task_plan.md"
|
||||
|
||||
if (-not (Test-Path $PlanFile)) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
$content = Get-Content $PlanFile -Raw
|
||||
|
||||
$TOTAL = ([regex]::Matches($content, "### Phase")).Count
|
||||
|
||||
# Check for **Status:** format first
|
||||
$COMPLETE = ([regex]::Matches($content, "\*\*Status:\*\* complete")).Count
|
||||
$IN_PROGRESS = ([regex]::Matches($content, "\*\*Status:\*\* in_progress")).Count
|
||||
$PENDING = ([regex]::Matches($content, "\*\*Status:\*\* pending")).Count
|
||||
|
||||
# Fallback: check for [complete] inline format
|
||||
if ($COMPLETE -eq 0 -and $IN_PROGRESS -eq 0 -and $PENDING -eq 0) {
|
||||
$COMPLETE = ([regex]::Matches($content, "\[complete\]")).Count
|
||||
$IN_PROGRESS = ([regex]::Matches($content, "\[in_progress\]")).Count
|
||||
$PENDING = ([regex]::Matches($content, "\[pending\]")).Count
|
||||
}
|
||||
|
||||
if ($COMPLETE -eq $TOTAL -and $TOTAL -gt 0) {
|
||||
Write-Host "{`"followup_message`": `"[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL). If the user has additional work, add new phases to task_plan.md before starting.`"}"
|
||||
exit 0
|
||||
} else {
|
||||
Write-Host "{`"followup_message`": `"[planning-with-files] Task incomplete ($COMPLETE/$TOTAL phases done). Update progress.md, then read task_plan.md and continue working on the remaining phases.`"}"
|
||||
exit 0
|
||||
}
|
||||
43
.trae/skills/planning-with-files/.cursor/hooks/stop.sh
Normal file
43
.trae/skills/planning-with-files/.cursor/hooks/stop.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
# planning-with-files: Stop hook for Cursor
|
||||
# Checks if all phases in task_plan.md are complete.
|
||||
# Returns followup_message to auto-continue if phases are incomplete.
|
||||
# Always exits 0 — uses JSON stdout for control.
|
||||
|
||||
PLAN_FILE="task_plan.md"
|
||||
|
||||
if [ ! -f "$PLAN_FILE" ]; then
|
||||
# No plan file = no planning session, allow stop
|
||||
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
|
||||
# All phases complete — provide re-entry guidance
|
||||
echo "{\"followup_message\": \"[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL). If the user has additional work, add new phases to task_plan.md before starting.\"}"
|
||||
exit 0
|
||||
else
|
||||
# Phases incomplete — auto-continue via followup_message
|
||||
echo "{\"followup_message\": \"[planning-with-files] Task incomplete ($COMPLETE/$TOTAL phases done). Update progress.md, then read task_plan.md and continue working on the remaining phases.\"}"
|
||||
exit 0
|
||||
fi
|
||||
@@ -0,0 +1,16 @@
|
||||
# planning-with-files: User prompt submit hook for Cursor (PowerShell)
|
||||
# Injects plan context on every user message.
|
||||
# Critical for session recovery after /clear — dumps actual content, not just advice.
|
||||
|
||||
if (Test-Path "task_plan.md") {
|
||||
Write-Output "[planning-with-files] ACTIVE PLAN — current state:"
|
||||
Get-Content "task_plan.md" -TotalCount 50 -Encoding UTF8
|
||||
Write-Output ""
|
||||
Write-Output "=== recent progress ==="
|
||||
if (Test-Path "progress.md") {
|
||||
Get-Content "progress.md" -Tail 20 -Encoding UTF8
|
||||
}
|
||||
Write-Output ""
|
||||
Write-Output "[planning-with-files] Read findings.md for research context. Continue from the current phase."
|
||||
}
|
||||
exit 0
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
# planning-with-files: User prompt submit hook for Cursor
|
||||
# Injects plan context on every user message.
|
||||
# Critical for session recovery after /clear — dumps actual content, not just advice.
|
||||
|
||||
if [ -f task_plan.md ]; then
|
||||
echo "[planning-with-files] ACTIVE PLAN — current state:"
|
||||
head -50 task_plan.md
|
||||
echo ""
|
||||
echo "=== recent progress ==="
|
||||
tail -20 progress.md 2>/dev/null
|
||||
echo ""
|
||||
echo "[planning-with-files] Read findings.md for research context. Continue from the current phase."
|
||||
fi
|
||||
exit 0
|
||||
Reference in New Issue
Block a user