cc-devflow 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/.claude/CLAUDE.md +83 -0
  2. package/.claude/agents/architecture-designer.md +443 -0
  3. package/.claude/agents/bug-analyzer.md +382 -0
  4. package/.claude/agents/checklist-agent.md +175 -0
  5. package/.claude/agents/clarify-analyst.md +50 -0
  6. package/.claude/agents/code-reviewer.md +71 -0
  7. package/.claude/agents/codex-analyzer.md +39 -0
  8. package/.claude/agents/compatibility-checker.md +580 -0
  9. package/.claude/agents/consistency-checker.md +532 -0
  10. package/.claude/agents/impact-analyzer.md +441 -0
  11. package/.claude/agents/planner.md +230 -0
  12. package/.claude/agents/prd-writer.md +320 -0
  13. package/.claude/agents/project-guidelines-generator.md +1329 -0
  14. package/.claude/agents/qa-tester.md +313 -0
  15. package/.claude/agents/release-manager.md +295 -0
  16. package/.claude/agents/security-reviewer.md +314 -0
  17. package/.claude/agents/style-guide-generator.md +458 -0
  18. package/.claude/agents/tech-architect.md +516 -0
  19. package/.claude/agents/ui-designer.md +485 -0
  20. package/.claude/commands/code-review-high.md +58 -0
  21. package/.claude/commands/core-architecture.md +429 -0
  22. package/.claude/commands/core-guidelines.md +486 -0
  23. package/.claude/commands/core-roadmap.md +439 -0
  24. package/.claude/commands/core-style.md +293 -0
  25. package/.claude/commands/flow-archive.md +245 -0
  26. package/.claude/commands/flow-checklist.md +260 -0
  27. package/.claude/commands/flow-clarify.md +136 -0
  28. package/.claude/commands/flow-constitution.md +82 -0
  29. package/.claude/commands/flow-dev.md +134 -0
  30. package/.claude/commands/flow-epic.md +150 -0
  31. package/.claude/commands/flow-fix.md +104 -0
  32. package/.claude/commands/flow-ideate.md +214 -0
  33. package/.claude/commands/flow-init.md +313 -0
  34. package/.claude/commands/flow-new.md +394 -0
  35. package/.claude/commands/flow-prd.md +131 -0
  36. package/.claude/commands/flow-qa.md +93 -0
  37. package/.claude/commands/flow-release.md +92 -0
  38. package/.claude/commands/flow-restart.md +98 -0
  39. package/.claude/commands/flow-status.md +64 -0
  40. package/.claude/commands/flow-tech.md +142 -0
  41. package/.claude/commands/flow-ui.md +189 -0
  42. package/.claude/commands/flow-update.md +111 -0
  43. package/.claude/commands/flow-upgrade.md +115 -0
  44. package/.claude/commands/flow-verify.md +96 -0
  45. package/.claude/commands/problem-analyzer.md +60 -0
  46. package/.claude/config/quality-rules.yml +161 -0
  47. package/.claude/docs/SPEC_KIT_CONSTITUTION_ANALYSIS.md +426 -0
  48. package/.claude/docs/design/consistency-conflict-detection-algorithms.md +658 -0
  49. package/.claude/docs/design/intent-driven-input-design.md +380 -0
  50. package/.claude/docs/design/prd-version-management-design.md +437 -0
  51. package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +117 -0
  52. package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +151 -0
  53. package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +188 -0
  54. package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +338 -0
  55. package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +633 -0
  56. package/.claude/docs/templates/BACKLOG_TEMPLATE.md +261 -0
  57. package/.claude/docs/templates/CHECKLIST_TEMPLATE.md +52 -0
  58. package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +206 -0
  59. package/.claude/docs/templates/CODE_REVIEW_TEMPLATE.md +71 -0
  60. package/.claude/docs/templates/EPIC_TEMPLATE.md +805 -0
  61. package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +213 -0
  62. package/.claude/docs/templates/INTENT_CLARIFICATION_TEMPLATE.md +57 -0
  63. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +148 -0
  64. package/.claude/docs/templates/PRD_TEMPLATE.md +562 -0
  65. package/.claude/docs/templates/RESEARCH_TEMPLATE.md +276 -0
  66. package/.claude/docs/templates/REVIEW-HIGH.md +57 -0
  67. package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +198 -0
  68. package/.claude/docs/templates/ROADMAP_TEMPLATE.md +310 -0
  69. package/.claude/docs/templates/STYLE_TEMPLATE.md +1266 -0
  70. package/.claude/docs/templates/TASKS_TEMPLATE.md +523 -0
  71. package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +1019 -0
  72. package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +1436 -0
  73. package/.claude/guides/agent-guides/agent-coordination-guide.md +459 -0
  74. package/.claude/guides/project-guidelines-system.md +463 -0
  75. package/.claude/guides/technical-guides/datetime-handling-guide.md +563 -0
  76. package/.claude/guides/technical-guides/git-github-guide.md +642 -0
  77. package/.claude/guides/technical-guides/test-execution-guide.md +618 -0
  78. package/.claude/guides/workflow-guides/bug-fix-orchestrator.md +217 -0
  79. package/.claude/guides/workflow-guides/flow-orchestrator.md +282 -0
  80. package/.claude/hooks/checklist-gate.js +397 -0
  81. package/.claude/hooks/error-handling-reminder.sh +12 -0
  82. package/.claude/hooks/error-handling-reminder.ts +459 -0
  83. package/.claude/hooks/post-tool-use-tracker.sh +280 -0
  84. package/.claude/hooks/pre-tool-use-guardrail.sh +36 -0
  85. package/.claude/hooks/pre-tool-use-guardrail.ts +342 -0
  86. package/.claude/hooks/skill-activation-prompt.sh +36 -0
  87. package/.claude/hooks/skill-activation-prompt.ts +214 -0
  88. package/.claude/hooks/state/skills-used-test-guard.json +3 -0
  89. package/.claude/rules/devflow-conventions.md +305 -0
  90. package/.claude/rules/project-constitution.md +748 -0
  91. package/.claude/schemas/constitution.schema.json +43 -0
  92. package/.claude/scripts/analyze-upgrade-impact.sh +200 -0
  93. package/.claude/scripts/archive-requirement.sh +351 -0
  94. package/.claude/scripts/calculate-checklist-completion.sh +243 -0
  95. package/.claude/scripts/calculate-quarter.sh +206 -0
  96. package/.claude/scripts/check-dependencies.sh +409 -0
  97. package/.claude/scripts/check-prerequisites.sh +232 -0
  98. package/.claude/scripts/check-task-status.sh +264 -0
  99. package/.claude/scripts/checklist-errors.sh +131 -0
  100. package/.claude/scripts/common.sh +570 -0
  101. package/.claude/scripts/consolidate-research.sh +182 -0
  102. package/.claude/scripts/create-requirement.sh +426 -0
  103. package/.claude/scripts/export-contracts.sh +117 -0
  104. package/.claude/scripts/extract-data-model.sh +78 -0
  105. package/.claude/scripts/generate-clarification-questions.sh +377 -0
  106. package/.claude/scripts/generate-clarification-report.sh +463 -0
  107. package/.claude/scripts/generate-quickstart.sh +146 -0
  108. package/.claude/scripts/generate-research-tasks.sh +157 -0
  109. package/.claude/scripts/generate-status-report.sh +523 -0
  110. package/.claude/scripts/generate-tech-analysis.sh +46 -0
  111. package/.claude/scripts/locate-requirement-in-roadmap.sh +233 -0
  112. package/.claude/scripts/manage-constitution.sh +602 -0
  113. package/.claude/scripts/mark-task-complete.sh +198 -0
  114. package/.claude/scripts/populate-research-tasks.sh +259 -0
  115. package/.claude/scripts/recover-workflow.sh +460 -0
  116. package/.claude/scripts/run-clarify-scan.sh +601 -0
  117. package/.claude/scripts/run-high-review.sh +62 -0
  118. package/.claude/scripts/run-problem-analysis.sh +68 -0
  119. package/.claude/scripts/setup-epic.sh +173 -0
  120. package/.claude/scripts/sync-roadmap-progress.sh +300 -0
  121. package/.claude/scripts/sync-task-marks.sh +199 -0
  122. package/.claude/scripts/test-clarify-scan.sh +515 -0
  123. package/.claude/scripts/update-agent-context.sh +806 -0
  124. package/.claude/scripts/validate-constitution.sh +567 -0
  125. package/.claude/scripts/validate-hooks.sh +487 -0
  126. package/.claude/scripts/validate-research.sh +332 -0
  127. package/.claude/scripts/validate-scope-boundary.sh +493 -0
  128. package/.claude/scripts/verify-setup.sh +37 -0
  129. package/.claude/settings.json +76 -0
  130. package/.claude/skills/_reference-implementations/README.md +96 -0
  131. package/.claude/skills/_reference-implementations/backend-express-prisma/SKILL.md +302 -0
  132. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/architecture-overview.md +451 -0
  133. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/async-and-errors.md +307 -0
  134. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/complete-examples.md +638 -0
  135. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/configuration.md +275 -0
  136. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/database-patterns.md +224 -0
  137. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/middleware-guide.md +213 -0
  138. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/routing-and-controllers.md +756 -0
  139. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/sentry-and-monitoring.md +336 -0
  140. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/services-and-repositories.md +789 -0
  141. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/testing-guide.md +235 -0
  142. package/.claude/skills/_reference-implementations/backend-express-prisma/resources/validation-patterns.md +754 -0
  143. package/.claude/skills/_reference-implementations/frontend-react-mui/SKILL.md +399 -0
  144. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/common-patterns.md +331 -0
  145. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/complete-examples.md +872 -0
  146. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/component-patterns.md +502 -0
  147. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/data-fetching.md +767 -0
  148. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/file-organization.md +502 -0
  149. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/loading-and-error-states.md +501 -0
  150. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/performance.md +406 -0
  151. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/routing-guide.md +364 -0
  152. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/styling-guide.md +428 -0
  153. package/.claude/skills/_reference-implementations/frontend-react-mui/resources/typescript-standards.md +418 -0
  154. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +229 -0
  155. package/.claude/skills/constitution-guardian/SKILL.md +306 -0
  156. package/.claude/skills/devflow-constitution-quick-ref/SKILL.md +374 -0
  157. package/.claude/skills/devflow-file-standards/SKILL.md +353 -0
  158. package/.claude/skills/devflow-tdd-enforcer/SKILL.md +192 -0
  159. package/.claude/skills/skill-developer/ADVANCED.md +197 -0
  160. package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +306 -0
  161. package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +152 -0
  162. package/.claude/skills/skill-developer/SKILL.md +426 -0
  163. package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +315 -0
  164. package/.claude/skills/skill-developer/TRIGGER_TYPES.md +305 -0
  165. package/.claude/skills/skill-developer/TROUBLESHOOTING.md +514 -0
  166. package/.claude/skills/skill-rules.json +213 -0
  167. package/.claude/tests/README.md +300 -0
  168. package/.claude/tests/TODO.md +69 -0
  169. package/.claude/tests/__pycache__/test_analyze_upgrade_impact.cpython-311-pytest-7.2.2.pyc +0 -0
  170. package/.claude/tests/__pycache__/test_consolidate_research.cpython-311-pytest-7.2.2.pyc +0 -0
  171. package/.claude/tests/__pycache__/test_export_contracts.cpython-311-pytest-7.2.2.pyc +0 -0
  172. package/.claude/tests/__pycache__/test_extract_data_model.cpython-311-pytest-7.2.2.pyc +0 -0
  173. package/.claude/tests/__pycache__/test_generate_quickstart.cpython-311-pytest-7.2.2.pyc +0 -0
  174. package/.claude/tests/__pycache__/test_generate_research_tasks.cpython-311-pytest-7.2.2.pyc +0 -0
  175. package/.claude/tests/constitution/run_all_constitution_tests.sh +111 -0
  176. package/.claude/tests/constitution/test_agent_assignment.sh +207 -0
  177. package/.claude/tests/constitution/test_article_coverage.sh +201 -0
  178. package/.claude/tests/constitution/test_template_completeness.sh +150 -0
  179. package/.claude/tests/constitution/test_version_consistency.sh +120 -0
  180. package/.claude/tests/fixtures/spec_delta_full.md +16 -0
  181. package/.claude/tests/fixtures/tasks_progress_sample.md +5 -0
  182. package/.claude/tests/run-all-tests.sh +229 -0
  183. package/.claude/tests/scripts/run.sh +30 -0
  184. package/.claude/tests/scripts/test-framework.sh +128 -0
  185. package/.claude/tests/scripts/test_check_prerequisites.sh +511 -0
  186. package/.claude/tests/scripts/test_check_prerequisites.sh.bak +504 -0
  187. package/.claude/tests/scripts/test_check_prerequisites.sh.bak2 +505 -0
  188. package/.claude/tests/scripts/test_check_prerequisites.sh.bak3 +506 -0
  189. package/.claude/tests/scripts/test_check_prerequisites.sh.bak4 +507 -0
  190. package/.claude/tests/scripts/test_check_prerequisites.sh.bak5 +508 -0
  191. package/.claude/tests/scripts/test_check_task_status.sh +499 -0
  192. package/.claude/tests/scripts/test_common.sh +244 -0
  193. package/.claude/tests/scripts/test_generate_status_report.sh +71 -0
  194. package/.claude/tests/scripts/test_mark_task_complete.sh +441 -0
  195. package/.claude/tests/scripts/test_mark_task_complete.sh.backup +410 -0
  196. package/.claude/tests/scripts/test_recover_workflow.sh +304 -0
  197. package/.claude/tests/scripts/test_setup_epic.sh +437 -0
  198. package/.claude/tests/scripts/test_sync_task_marks.sh +196 -0
  199. package/.claude/tests/scripts/test_validate_constitution.sh +74 -0
  200. package/.claude/tests/scripts/test_validate_research.sh +462 -0
  201. package/.claude/tests/slugify.bats +82 -0
  202. package/.claude/tests/test-framework.sh +732 -0
  203. package/.claude/tests/test_analyze_upgrade_impact.py +34 -0
  204. package/.claude/tests/test_consolidate_research.py +48 -0
  205. package/.claude/tests/test_export_contracts.py +43 -0
  206. package/.claude/tests/test_extract_data_model.py +33 -0
  207. package/.claude/tests/test_generate_quickstart.py +50 -0
  208. package/.claude/tests/test_generate_research_tasks.py +52 -0
  209. package/.claude/tsc-cache/6e64f818-6398-49ca-8623-581a9af85c44/edited-files.log +1 -0
  210. package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +1 -0
  211. package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/edited-files.log +1 -0
  212. package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +1 -0
  213. package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/edited-files.log +1 -0
  214. package/CHANGELOG.md +507 -0
  215. package/LICENSE +21 -0
  216. package/README.md +534 -0
  217. package/README.zh-CN.md +530 -0
  218. package/bin/adapt.js +240 -0
  219. package/bin/cc-devflow-cli.js +185 -0
  220. package/bin/cc-devflow.js +78 -0
  221. package/config/adapters.yml +5 -0
  222. package/config/schema/adapters.schema.json +44 -0
  223. package/docs/CLAUDE.md +26 -0
  224. package/docs/commands/README.md +61 -0
  225. package/docs/commands/README.zh-CN.md +55 -0
  226. package/docs/commands/core-roadmap.md +106 -0
  227. package/docs/commands/core-roadmap.zh-CN.md +102 -0
  228. package/docs/commands/core-style.md +405 -0
  229. package/docs/commands/core-style.zh-CN.md +405 -0
  230. package/docs/commands/flow-init.md +134 -0
  231. package/docs/commands/flow-init.zh-CN.md +163 -0
  232. package/docs/commands/flow-new.md +274 -0
  233. package/docs/commands/flow-new.zh-CN.md +270 -0
  234. package/docs/guides/getting-started.md +204 -0
  235. package/docs/guides/getting-started.zh-CN.md +152 -0
  236. package/lib/adapters/adapter-interface.js +57 -0
  237. package/lib/adapters/claude-adapter.js +74 -0
  238. package/lib/adapters/codex-adapter.js +40 -0
  239. package/lib/adapters/config-validator.js +68 -0
  240. package/lib/adapters/logger.js +42 -0
  241. package/lib/adapters/registry.js +153 -0
  242. package/lib/compiler/CLAUDE.md +92 -0
  243. package/lib/compiler/__tests__/drift.test.js +215 -0
  244. package/lib/compiler/__tests__/errors.test.js +184 -0
  245. package/lib/compiler/__tests__/incremental.test.js +174 -0
  246. package/lib/compiler/__tests__/integration.test.js +174 -0
  247. package/lib/compiler/__tests__/manifest.test.js +233 -0
  248. package/lib/compiler/__tests__/parser.test.js +456 -0
  249. package/lib/compiler/__tests__/schemas.test.js +301 -0
  250. package/lib/compiler/__tests__/skills-registry.test.js +125 -0
  251. package/lib/compiler/__tests__/transformer.test.js +286 -0
  252. package/lib/compiler/emitters/antigravity-emitter.js +171 -0
  253. package/lib/compiler/emitters/base-emitter.js +73 -0
  254. package/lib/compiler/emitters/codex-emitter.js +52 -0
  255. package/lib/compiler/emitters/cursor-emitter.js +31 -0
  256. package/lib/compiler/emitters/index.js +50 -0
  257. package/lib/compiler/emitters/qwen-emitter.js +39 -0
  258. package/lib/compiler/errors.js +119 -0
  259. package/lib/compiler/index.js +256 -0
  260. package/lib/compiler/manifest.js +242 -0
  261. package/lib/compiler/parser.js +258 -0
  262. package/lib/compiler/platforms.js +113 -0
  263. package/lib/compiler/resource-copier.js +320 -0
  264. package/lib/compiler/rules-emitters/__tests__/antigravity-rules-emitter.test.js +191 -0
  265. package/lib/compiler/rules-emitters/__tests__/codex-rules-emitter.test.js +109 -0
  266. package/lib/compiler/rules-emitters/__tests__/cursor-rules-emitter.test.js +123 -0
  267. package/lib/compiler/rules-emitters/__tests__/qwen-rules-emitter.test.js +123 -0
  268. package/lib/compiler/rules-emitters/antigravity-rules-emitter.js +253 -0
  269. package/lib/compiler/rules-emitters/base-rules-emitter.js +83 -0
  270. package/lib/compiler/rules-emitters/codex-rules-emitter.js +116 -0
  271. package/lib/compiler/rules-emitters/cursor-rules-emitter.js +98 -0
  272. package/lib/compiler/rules-emitters/index.js +71 -0
  273. package/lib/compiler/rules-emitters/qwen-rules-emitter.js +70 -0
  274. package/lib/compiler/schemas.js +144 -0
  275. package/lib/compiler/skills-registry.js +225 -0
  276. package/lib/compiler/transformer.js +236 -0
  277. package/package.json +50 -0
@@ -0,0 +1,264 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Check task completion status in TASKS.md
4
+ #
5
+ # This script checks the status of tasks in TASKS.md and provides
6
+ # progress information.
7
+ #
8
+ # Usage: ./check-task-status.sh [TASK_ID] [OPTIONS]
9
+ #
10
+ # ARGUMENTS:
11
+ # TASK_ID Optional specific task ID to check (e.g., T001)
12
+ #
13
+ # OPTIONS:
14
+ # --json Output in JSON format
15
+ # --verbose Show detailed task information
16
+ # --help, -h Show help message
17
+ #
18
+ # EXAMPLES:
19
+ # ./check-task-status.sh # Show overall progress
20
+ # ./check-task-status.sh T001 # Check specific task
21
+ # ./check-task-status.sh --json # JSON output
22
+ # ./check-task-status.sh --verbose # Detailed task list
23
+
24
+ set -e
25
+
26
+ # Parse command line arguments
27
+ TASK_ID=""
28
+ JSON_MODE=false
29
+ VERBOSE=false
30
+
31
+ while [[ $# -gt 0 ]]; do
32
+ case "$1" in
33
+ --json)
34
+ JSON_MODE=true
35
+ shift
36
+ ;;
37
+ --verbose|-v)
38
+ VERBOSE=true
39
+ shift
40
+ ;;
41
+ --help|-h)
42
+ cat << 'EOF'
43
+ Usage: check-task-status.sh [TASK_ID] [OPTIONS]
44
+
45
+ Check task completion status in TASKS.md.
46
+
47
+ ARGUMENTS:
48
+ TASK_ID Optional specific task ID to check (e.g., T001)
49
+
50
+ OPTIONS:
51
+ --json Output results in JSON format
52
+ --verbose, -v Show detailed task information
53
+ --help, -h Show this help message
54
+
55
+ EXAMPLES:
56
+ # Show overall progress
57
+ ./check-task-status.sh
58
+
59
+ # Check specific task status
60
+ ./check-task-status.sh T001
61
+
62
+ # JSON output for automation
63
+ ./check-task-status.sh --json
64
+
65
+ # Detailed task list
66
+ ./check-task-status.sh --verbose
67
+
68
+ OUTPUT:
69
+ - Overall progress (completed vs remaining)
70
+ - Phase breakdown
71
+ - Next pending task
72
+ - Specific task status (if TASK_ID provided)
73
+
74
+ EOF
75
+ exit 0
76
+ ;;
77
+ -*)
78
+ echo "ERROR: Unknown option '$1'. Use --help for usage information." >&2
79
+ exit 1
80
+ ;;
81
+ *)
82
+ if [[ -z "$TASK_ID" ]]; then
83
+ TASK_ID="$1"
84
+ else
85
+ echo "ERROR: Too many arguments. Use --help for usage information." >&2
86
+ exit 1
87
+ fi
88
+ shift
89
+ ;;
90
+ esac
91
+ done
92
+
93
+ # Normalize task ID to uppercase if provided
94
+ if [[ -n "$TASK_ID" ]]; then
95
+ TASK_ID=$(echo "$TASK_ID" | tr '[:lower:]' '[:upper:]')
96
+
97
+ # Validate task ID format
98
+ if [[ ! "$TASK_ID" =~ ^T[0-9]+$ ]]; then
99
+ echo "ERROR: Invalid task ID format: $TASK_ID" >&2
100
+ echo "Expected format: T001, T002, T003..." >&2
101
+ exit 1
102
+ fi
103
+ fi
104
+
105
+ # Source common functions
106
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
107
+ source "$SCRIPT_DIR/common.sh"
108
+
109
+ # Get all paths
110
+ eval $(get_requirement_paths)
111
+
112
+ # Validate requirement ID exists
113
+ if [[ -z "$REQ_ID" ]]; then
114
+ echo "ERROR: No requirement ID found" >&2
115
+ echo "Please ensure you are on a feature branch (feature/REQ-XXX-title)" >&2
116
+ echo "Or set DEVFLOW_REQ_ID environment variable" >&2
117
+ exit 1
118
+ fi
119
+
120
+ # Validate requirement directory exists
121
+ if [[ ! -d "$REQ_DIR" ]]; then
122
+ echo "ERROR: Requirement directory not found: $REQ_DIR" >&2
123
+ exit 1
124
+ fi
125
+
126
+ # Check for TASKS.md file
127
+ TASKS_FILE="$REQ_DIR/TASKS.md"
128
+ if [[ ! -f "$TASKS_FILE" ]]; then
129
+ echo "ERROR: TASKS.md not found at $TASKS_FILE" >&2
130
+ echo "Run planner agent first to create tasks." >&2
131
+ exit 1
132
+ fi
133
+
134
+ # Count tasks
135
+ TOTAL_INCOMPLETE=$(grep -c "^\- \[ \]" "$TASKS_FILE" 2>/dev/null || echo "0")
136
+ TOTAL_COMPLETE=$(grep -c "^\- \[x\]" "$TASKS_FILE" 2>/dev/null || echo "0")
137
+ TOTAL_TASKS=$((TOTAL_INCOMPLETE + TOTAL_COMPLETE))
138
+
139
+ # Calculate percentage
140
+ if [[ $TOTAL_TASKS -gt 0 ]]; then
141
+ PERCENTAGE=$((TOTAL_COMPLETE * 100 / TOTAL_TASKS))
142
+ else
143
+ PERCENTAGE=0
144
+ fi
145
+
146
+ # If specific task requested, check its status
147
+ if [[ -n "$TASK_ID" ]]; then
148
+ if grep -q "^\- \[x\] .*$TASK_ID" "$TASKS_FILE"; then
149
+ STATUS="complete"
150
+ TASK_LINE=$(grep "^\- \[x\] .*$TASK_ID" "$TASKS_FILE" | head -1)
151
+ elif grep -q "^\- \[ \] .*$TASK_ID" "$TASKS_FILE"; then
152
+ STATUS="pending"
153
+ TASK_LINE=$(grep "^\- \[ \] .*$TASK_ID" "$TASKS_FILE" | head -1)
154
+ else
155
+ STATUS="not_found"
156
+ TASK_LINE=""
157
+ fi
158
+
159
+ if $JSON_MODE; then
160
+ printf '{"task_id":"%s","status":"%s","task_line":"%s"}\n' \
161
+ "$TASK_ID" "$STATUS" "$TASK_LINE"
162
+ else
163
+ case "$STATUS" in
164
+ complete)
165
+ echo "✅ Task $TASK_ID is complete"
166
+ echo " $TASK_LINE"
167
+ ;;
168
+ pending)
169
+ echo "⏳ Task $TASK_ID is pending"
170
+ echo " $TASK_LINE"
171
+ ;;
172
+ not_found)
173
+ echo "❌ Task $TASK_ID not found"
174
+ exit 1
175
+ ;;
176
+ esac
177
+ fi
178
+ exit 0
179
+ fi
180
+
181
+ # Find next pending task
182
+ NEXT_TASK=$(grep "^\- \[ \]" "$TASKS_FILE" | head -1 || echo "")
183
+ if [[ -n "$NEXT_TASK" ]]; then
184
+ # Extract task ID from line (matches T001, T002, etc.)
185
+ NEXT_TASK_ID=$(echo "$NEXT_TASK" | grep -o 'T[0-9]\+' | head -1)
186
+ else
187
+ NEXT_TASK_ID=""
188
+ fi
189
+
190
+ # Get phase breakdown - ensure all values are clean integers
191
+ if grep -q "^## Phase 1:" "$TASKS_FILE" 2>/dev/null; then
192
+ PHASE_1_TOTAL=$(grep "^## Phase 1:" -A 100 "$TASKS_FILE" | grep -c "^\- \[")
193
+ PHASE_1_COMPLETE=$(grep "^## Phase 1:" -A 100 "$TASKS_FILE" | grep "^\- \[x\]" | wc -l | tr -d ' \n')
194
+ else
195
+ PHASE_1_TOTAL=0
196
+ PHASE_1_COMPLETE=0
197
+ fi
198
+
199
+ if grep -q "^## Phase 2:" "$TASKS_FILE" 2>/dev/null; then
200
+ PHASE_2_TOTAL=$(grep "^## Phase 2:" -A 100 "$TASKS_FILE" | grep -c "^\- \[")
201
+ PHASE_2_COMPLETE=$(grep "^## Phase 2:" -A 100 "$TASKS_FILE" | grep "^\- \[x\]" | wc -l | tr -d ' \n')
202
+ else
203
+ PHASE_2_TOTAL=0
204
+ PHASE_2_COMPLETE=0
205
+ fi
206
+
207
+ if grep -q "^## Phase 3:" "$TASKS_FILE" 2>/dev/null; then
208
+ PHASE_3_TOTAL=$(grep "^## Phase 3:" -A 100 "$TASKS_FILE" | grep -c "^\- \[")
209
+ PHASE_3_COMPLETE=$(grep "^## Phase 3:" -A 100 "$TASKS_FILE" | grep "^\- \[x\]" | wc -l | tr -d ' \n')
210
+ else
211
+ PHASE_3_TOTAL=0
212
+ PHASE_3_COMPLETE=0
213
+ fi
214
+
215
+ # Output results
216
+ if $JSON_MODE; then
217
+ # JSON output
218
+ printf '{"req_id":"%s","total_tasks":%d,"completed":%d,"remaining":%d,"percentage":%d,"next_task_id":"%s","phases":{"phase_1":{"total":%d,"complete":%d},"phase_2":{"total":%d,"complete":%d},"phase_3":{"total":%d,"complete":%d}}}\n' \
219
+ "$REQ_ID" "$TOTAL_TASKS" "$TOTAL_COMPLETE" "$TOTAL_INCOMPLETE" "$PERCENTAGE" "$NEXT_TASK_ID" \
220
+ "$PHASE_1_TOTAL" "$PHASE_1_COMPLETE" \
221
+ "$PHASE_2_TOTAL" "$PHASE_2_COMPLETE" \
222
+ "$PHASE_3_TOTAL" "$PHASE_3_COMPLETE"
223
+ else
224
+ # Human-readable output
225
+ echo "Task Status for $REQ_ID"
226
+ echo "════════════════════════════════════════"
227
+ echo ""
228
+ echo "Overall Progress:"
229
+ echo " ✅ Completed: $TOTAL_COMPLETE"
230
+ echo " ⏳ Remaining: $TOTAL_INCOMPLETE"
231
+ echo " 📊 Progress: $PERCENTAGE%"
232
+ echo ""
233
+
234
+ if [[ -n "$NEXT_TASK_ID" ]]; then
235
+ echo "Next Task: $NEXT_TASK_ID"
236
+ echo " $NEXT_TASK"
237
+ echo ""
238
+ else
239
+ echo "🎉 All tasks complete!"
240
+ echo ""
241
+ fi
242
+
243
+ # Phase breakdown
244
+ if [[ $PHASE_1_TOTAL -gt 0 || $PHASE_2_TOTAL -gt 0 || $PHASE_3_TOTAL -gt 0 ]]; then
245
+ echo "Phase Breakdown:"
246
+ if [[ $PHASE_1_TOTAL -gt 0 ]]; then
247
+ echo " Phase 1 (Setup): $PHASE_1_COMPLETE / $PHASE_1_TOTAL"
248
+ fi
249
+ if [[ $PHASE_2_TOTAL -gt 0 ]]; then
250
+ echo " Phase 2 (Tests First): $PHASE_2_COMPLETE / $PHASE_2_TOTAL"
251
+ fi
252
+ if [[ $PHASE_3_TOTAL -gt 0 ]]; then
253
+ echo " Phase 3 (Implementation): $PHASE_3_COMPLETE / $PHASE_3_TOTAL"
254
+ fi
255
+ echo ""
256
+ fi
257
+
258
+ # Verbose mode: show all tasks
259
+ if $VERBOSE; then
260
+ echo "All Tasks:"
261
+ echo "────────────────────────────────────────"
262
+ grep "^\- \[" "$TASKS_FILE"
263
+ fi
264
+ fi
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================================
3
+ # checklist-errors.sh
4
+ # ============================================================================
5
+ # Error codes and messages for /flow-checklist command and related hooks
6
+ #
7
+ # Usage: source this file in scripts that need checklist error handling
8
+ #
9
+ # Reference: TECH_DESIGN.md Section 4.4, contracts/command-interface.md Section 4
10
+ # ============================================================================
11
+
12
+ # ============================================================================
13
+ # Error Codes
14
+ # ============================================================================
15
+
16
+ # PRD.md not found in requirement directory
17
+ export ERR_MISSING_PRD="MISSING_PRD"
18
+
19
+ # Invalid checklist type specified
20
+ export ERR_INVALID_TYPE="INVALID_TYPE"
21
+
22
+ # No checklists found in directory
23
+ export ERR_NO_CHECKLISTS="NO_CHECKLISTS"
24
+
25
+ # Checklist item ID not found
26
+ export ERR_ITEM_NOT_FOUND="ITEM_NOT_FOUND"
27
+
28
+ # Checklist completion below gate threshold
29
+ export ERR_GATE_FAILED="GATE_FAILED"
30
+
31
+ # Skip reason required but not provided
32
+ export ERR_SKIP_REASON_REQUIRED="SKIP_REASON_REQUIRED"
33
+
34
+ # ============================================================================
35
+ # Valid Checklist Types (R001 Decision)
36
+ # ============================================================================
37
+ export VALID_CHECKLIST_TYPES="ux,api,security,performance,data,general"
38
+
39
+ # ============================================================================
40
+ # Error Message Functions
41
+ # ============================================================================
42
+
43
+ # Print error message to stderr
44
+ # Usage: print_error "ERROR_CODE" "additional message"
45
+ print_checklist_error() {
46
+ local code="$1"
47
+ local extra="${2:-}"
48
+
49
+ case "$code" in
50
+ "$ERR_MISSING_PRD")
51
+ echo "ERROR: $code" >&2
52
+ echo "PRD.md not found in requirement directory." >&2
53
+ echo "" >&2
54
+ echo "Run /flow-prd first." >&2
55
+ ;;
56
+ "$ERR_INVALID_TYPE")
57
+ echo "ERROR: $code" >&2
58
+ echo "Invalid checklist type: $extra" >&2
59
+ echo "" >&2
60
+ echo "Valid types: $VALID_CHECKLIST_TYPES" >&2
61
+ ;;
62
+ "$ERR_NO_CHECKLISTS")
63
+ echo "ERROR: $code" >&2
64
+ echo "No checklists found in checklists/ directory." >&2
65
+ echo "" >&2
66
+ echo "Run /flow-checklist --type <type> first." >&2
67
+ ;;
68
+ "$ERR_ITEM_NOT_FOUND")
69
+ echo "WARNING: $code" >&2
70
+ echo "Checklist item not found: $extra. Skipped." >&2
71
+ ;;
72
+ "$ERR_GATE_FAILED")
73
+ echo "ERROR: $code" >&2
74
+ echo "Checklist completion $extra" >&2
75
+ echo "" >&2
76
+ echo "Run /flow-checklist --status to review incomplete items." >&2
77
+ echo "Or use --skip-gate --reason \"your reason\" to bypass." >&2
78
+ ;;
79
+ "$ERR_SKIP_REASON_REQUIRED")
80
+ echo "ERROR: $code" >&2
81
+ echo "--reason is required when using --skip-gate" >&2
82
+ echo "" >&2
83
+ echo "Usage: --skip-gate --reason \"your reason\"" >&2
84
+ ;;
85
+ *)
86
+ echo "ERROR: Unknown error code: $code" >&2
87
+ if [[ -n "$extra" ]]; then
88
+ echo "$extra" >&2
89
+ fi
90
+ ;;
91
+ esac
92
+ }
93
+
94
+ # Return JSON error object
95
+ # Usage: json_error "ERROR_CODE" "message"
96
+ json_checklist_error() {
97
+ local code="$1"
98
+ local message="$2"
99
+ echo "{\"error\": \"$code\", \"message\": \"$message\"}"
100
+ }
101
+
102
+ # ============================================================================
103
+ # Validation Functions
104
+ # ============================================================================
105
+
106
+ # Validate checklist type
107
+ # Usage: validate_checklist_type "ux" && echo "valid"
108
+ validate_checklist_type() {
109
+ local type="$1"
110
+ if [[ ",$VALID_CHECKLIST_TYPES," == *",$type,"* ]]; then
111
+ return 0
112
+ else
113
+ return 1
114
+ fi
115
+ }
116
+
117
+ # Validate checklist item ID format (CHK + 3 digits)
118
+ # Usage: validate_item_id "CHK001" && echo "valid"
119
+ validate_item_id() {
120
+ local id="$1"
121
+ if [[ "$id" =~ ^CHK[0-9]{3}$ ]]; then
122
+ return 0
123
+ else
124
+ return 1
125
+ fi
126
+ }
127
+
128
+ # ============================================================================
129
+ # Gate Threshold Constants
130
+ # ============================================================================
131
+ export DEFAULT_GATE_THRESHOLD=80