Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:07:47 +08:00
commit e68188c52b
12 changed files with 1861 additions and 0 deletions

48
hooks/hooks.json Normal file
View File

@@ -0,0 +1,48 @@
{
"hooks": {
"PreToolUse": [
{
"filter": "Edit(*backlog/tasks/*)|Write(*backlog/tasks/*)",
"command": "bash",
"args": [
"-c",
"echo '❌ BLOCKED: Direct editing of task files is prohibited!' && echo '' && echo 'Task files must only be modified via CLI:' && echo ' backlog task edit <id> [options]' && echo '' && echo 'This ensures file naming (task-{id} - {title}.md) and metadata stay synchronized.' && echo '' && echo '📖 Use /backlog-start, /backlog-create, or /backlog-complete commands for guidance.' && exit 1"
]
},
{
"filter": "Read(*backlog/tasks/*)",
"command": "bash",
"args": [
"-c",
"echo ' NOTE: Prefer CLI for task access: backlog task <id> --plain' && echo 'Direct file reading is allowed but CLI provides better formatting.'"
]
}
],
"PostToolUse": [
{
"filter": "Bash(backlog task create*)|Bash(backlog task edit*)",
"command": "bash",
"args": [
"-c",
"if [ -d backlog/tasks ]; then LAST_FILE=$(ls -t backlog/tasks/*.md 2>/dev/null | head -1 | xargs basename 2>/dev/null); if [ -n \"$LAST_FILE\" ] && ! echo \"$LAST_FILE\" | grep -qE '^task-[0-9]+ - .+\\.md$'; then echo '⚠️ WARNING: Task file naming may be incorrect: '$LAST_FILE; echo 'Expected pattern: task-{id} - {title}.md'; echo 'Run /backlog-validate to check all tasks.'; fi; fi"
]
}
],
"UserPromptSubmit": [
{
"command": "bash",
"args": [
"-c",
"if echo \"$PROMPT\" | grep -qiE '(complete|done|finish).*(task|backlog)'; then echo ' Reminder: Verify all Definition of Done items before marking task as Done'; echo ' Use /backlog-complete for guided completion workflow'; fi"
]
},
{
"command": "bash",
"args": [
"-c",
"if echo \"$PROMPT\" | grep -qiE '(start|begin|work on).*(task|backlog)'; then echo ' Reminder: Start task workflow:'; echo ' 1. Assign yourself: backlog task edit <id> -a @myself'; echo ' 2. Set status: backlog task edit <id> -s \"In Progress\"'; echo ' 3. Add plan: backlog task edit <id> --plan ...'; echo ' Or use /backlog-start for guided workflow'; fi"
]
}
]
}
}