spec-kitty-cli 0.12.1__py3-none-any.whl

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 (242) hide show
  1. spec_kitty_cli-0.12.1.dist-info/METADATA +1767 -0
  2. spec_kitty_cli-0.12.1.dist-info/RECORD +242 -0
  3. spec_kitty_cli-0.12.1.dist-info/WHEEL +4 -0
  4. spec_kitty_cli-0.12.1.dist-info/entry_points.txt +2 -0
  5. spec_kitty_cli-0.12.1.dist-info/licenses/LICENSE +21 -0
  6. specify_cli/__init__.py +171 -0
  7. specify_cli/acceptance.py +627 -0
  8. specify_cli/agent_utils/README.md +157 -0
  9. specify_cli/agent_utils/__init__.py +9 -0
  10. specify_cli/agent_utils/status.py +356 -0
  11. specify_cli/cli/__init__.py +6 -0
  12. specify_cli/cli/commands/__init__.py +46 -0
  13. specify_cli/cli/commands/accept.py +189 -0
  14. specify_cli/cli/commands/agent/__init__.py +22 -0
  15. specify_cli/cli/commands/agent/config.py +382 -0
  16. specify_cli/cli/commands/agent/context.py +191 -0
  17. specify_cli/cli/commands/agent/feature.py +1057 -0
  18. specify_cli/cli/commands/agent/release.py +11 -0
  19. specify_cli/cli/commands/agent/tasks.py +1253 -0
  20. specify_cli/cli/commands/agent/workflow.py +801 -0
  21. specify_cli/cli/commands/context.py +246 -0
  22. specify_cli/cli/commands/dashboard.py +85 -0
  23. specify_cli/cli/commands/implement.py +973 -0
  24. specify_cli/cli/commands/init.py +827 -0
  25. specify_cli/cli/commands/init_help.py +62 -0
  26. specify_cli/cli/commands/merge.py +755 -0
  27. specify_cli/cli/commands/mission.py +240 -0
  28. specify_cli/cli/commands/ops.py +265 -0
  29. specify_cli/cli/commands/orchestrate.py +640 -0
  30. specify_cli/cli/commands/repair.py +175 -0
  31. specify_cli/cli/commands/research.py +165 -0
  32. specify_cli/cli/commands/sync.py +364 -0
  33. specify_cli/cli/commands/upgrade.py +249 -0
  34. specify_cli/cli/commands/validate_encoding.py +186 -0
  35. specify_cli/cli/commands/validate_tasks.py +186 -0
  36. specify_cli/cli/commands/verify.py +310 -0
  37. specify_cli/cli/helpers.py +123 -0
  38. specify_cli/cli/step_tracker.py +91 -0
  39. specify_cli/cli/ui.py +192 -0
  40. specify_cli/core/__init__.py +53 -0
  41. specify_cli/core/agent_context.py +311 -0
  42. specify_cli/core/config.py +96 -0
  43. specify_cli/core/context_validation.py +362 -0
  44. specify_cli/core/dependency_graph.py +351 -0
  45. specify_cli/core/git_ops.py +129 -0
  46. specify_cli/core/multi_parent_merge.py +323 -0
  47. specify_cli/core/paths.py +260 -0
  48. specify_cli/core/project_resolver.py +110 -0
  49. specify_cli/core/stale_detection.py +263 -0
  50. specify_cli/core/tool_checker.py +79 -0
  51. specify_cli/core/utils.py +43 -0
  52. specify_cli/core/vcs/__init__.py +114 -0
  53. specify_cli/core/vcs/detection.py +341 -0
  54. specify_cli/core/vcs/exceptions.py +85 -0
  55. specify_cli/core/vcs/git.py +1304 -0
  56. specify_cli/core/vcs/jujutsu.py +1208 -0
  57. specify_cli/core/vcs/protocol.py +285 -0
  58. specify_cli/core/vcs/types.py +249 -0
  59. specify_cli/core/version_checker.py +261 -0
  60. specify_cli/core/worktree.py +506 -0
  61. specify_cli/dashboard/__init__.py +28 -0
  62. specify_cli/dashboard/diagnostics.py +204 -0
  63. specify_cli/dashboard/handlers/__init__.py +17 -0
  64. specify_cli/dashboard/handlers/api.py +143 -0
  65. specify_cli/dashboard/handlers/base.py +65 -0
  66. specify_cli/dashboard/handlers/features.py +390 -0
  67. specify_cli/dashboard/handlers/router.py +81 -0
  68. specify_cli/dashboard/handlers/static.py +50 -0
  69. specify_cli/dashboard/lifecycle.py +541 -0
  70. specify_cli/dashboard/scanner.py +437 -0
  71. specify_cli/dashboard/server.py +123 -0
  72. specify_cli/dashboard/static/dashboard/dashboard.css +722 -0
  73. specify_cli/dashboard/static/dashboard/dashboard.js +1424 -0
  74. specify_cli/dashboard/static/spec-kitty.png +0 -0
  75. specify_cli/dashboard/templates/__init__.py +36 -0
  76. specify_cli/dashboard/templates/index.html +258 -0
  77. specify_cli/doc_generators.py +621 -0
  78. specify_cli/doc_state.py +408 -0
  79. specify_cli/frontmatter.py +384 -0
  80. specify_cli/gap_analysis.py +915 -0
  81. specify_cli/gitignore_manager.py +300 -0
  82. specify_cli/guards.py +145 -0
  83. specify_cli/legacy_detector.py +83 -0
  84. specify_cli/manifest.py +286 -0
  85. specify_cli/merge/__init__.py +63 -0
  86. specify_cli/merge/executor.py +653 -0
  87. specify_cli/merge/forecast.py +215 -0
  88. specify_cli/merge/ordering.py +126 -0
  89. specify_cli/merge/preflight.py +230 -0
  90. specify_cli/merge/state.py +185 -0
  91. specify_cli/merge/status_resolver.py +354 -0
  92. specify_cli/mission.py +654 -0
  93. specify_cli/missions/documentation/command-templates/implement.md +309 -0
  94. specify_cli/missions/documentation/command-templates/plan.md +275 -0
  95. specify_cli/missions/documentation/command-templates/review.md +344 -0
  96. specify_cli/missions/documentation/command-templates/specify.md +206 -0
  97. specify_cli/missions/documentation/command-templates/tasks.md +189 -0
  98. specify_cli/missions/documentation/mission.yaml +113 -0
  99. specify_cli/missions/documentation/templates/divio/explanation-template.md +192 -0
  100. specify_cli/missions/documentation/templates/divio/howto-template.md +168 -0
  101. specify_cli/missions/documentation/templates/divio/reference-template.md +179 -0
  102. specify_cli/missions/documentation/templates/divio/tutorial-template.md +146 -0
  103. specify_cli/missions/documentation/templates/generators/jsdoc.json.template +18 -0
  104. specify_cli/missions/documentation/templates/generators/sphinx-conf.py.template +36 -0
  105. specify_cli/missions/documentation/templates/plan-template.md +269 -0
  106. specify_cli/missions/documentation/templates/release-template.md +222 -0
  107. specify_cli/missions/documentation/templates/spec-template.md +172 -0
  108. specify_cli/missions/documentation/templates/task-prompt-template.md +140 -0
  109. specify_cli/missions/documentation/templates/tasks-template.md +159 -0
  110. specify_cli/missions/research/command-templates/merge.md +388 -0
  111. specify_cli/missions/research/command-templates/plan.md +125 -0
  112. specify_cli/missions/research/command-templates/review.md +144 -0
  113. specify_cli/missions/research/command-templates/tasks.md +225 -0
  114. specify_cli/missions/research/mission.yaml +115 -0
  115. specify_cli/missions/research/templates/data-model-template.md +33 -0
  116. specify_cli/missions/research/templates/plan-template.md +161 -0
  117. specify_cli/missions/research/templates/research/evidence-log.csv +18 -0
  118. specify_cli/missions/research/templates/research/source-register.csv +18 -0
  119. specify_cli/missions/research/templates/research-template.md +35 -0
  120. specify_cli/missions/research/templates/spec-template.md +64 -0
  121. specify_cli/missions/research/templates/task-prompt-template.md +148 -0
  122. specify_cli/missions/research/templates/tasks-template.md +114 -0
  123. specify_cli/missions/software-dev/command-templates/accept.md +75 -0
  124. specify_cli/missions/software-dev/command-templates/analyze.md +183 -0
  125. specify_cli/missions/software-dev/command-templates/checklist.md +286 -0
  126. specify_cli/missions/software-dev/command-templates/clarify.md +157 -0
  127. specify_cli/missions/software-dev/command-templates/constitution.md +432 -0
  128. specify_cli/missions/software-dev/command-templates/dashboard.md +101 -0
  129. specify_cli/missions/software-dev/command-templates/implement.md +41 -0
  130. specify_cli/missions/software-dev/command-templates/merge.md +383 -0
  131. specify_cli/missions/software-dev/command-templates/plan.md +171 -0
  132. specify_cli/missions/software-dev/command-templates/review.md +32 -0
  133. specify_cli/missions/software-dev/command-templates/specify.md +321 -0
  134. specify_cli/missions/software-dev/command-templates/tasks.md +566 -0
  135. specify_cli/missions/software-dev/mission.yaml +100 -0
  136. specify_cli/missions/software-dev/templates/plan-template.md +132 -0
  137. specify_cli/missions/software-dev/templates/spec-template.md +116 -0
  138. specify_cli/missions/software-dev/templates/task-prompt-template.md +140 -0
  139. specify_cli/missions/software-dev/templates/tasks-template.md +159 -0
  140. specify_cli/orchestrator/__init__.py +75 -0
  141. specify_cli/orchestrator/agent_config.py +224 -0
  142. specify_cli/orchestrator/agents/__init__.py +170 -0
  143. specify_cli/orchestrator/agents/augment.py +112 -0
  144. specify_cli/orchestrator/agents/base.py +243 -0
  145. specify_cli/orchestrator/agents/claude.py +112 -0
  146. specify_cli/orchestrator/agents/codex.py +106 -0
  147. specify_cli/orchestrator/agents/copilot.py +137 -0
  148. specify_cli/orchestrator/agents/cursor.py +139 -0
  149. specify_cli/orchestrator/agents/gemini.py +115 -0
  150. specify_cli/orchestrator/agents/kilocode.py +94 -0
  151. specify_cli/orchestrator/agents/opencode.py +132 -0
  152. specify_cli/orchestrator/agents/qwen.py +96 -0
  153. specify_cli/orchestrator/config.py +455 -0
  154. specify_cli/orchestrator/executor.py +642 -0
  155. specify_cli/orchestrator/integration.py +1230 -0
  156. specify_cli/orchestrator/monitor.py +898 -0
  157. specify_cli/orchestrator/scheduler.py +832 -0
  158. specify_cli/orchestrator/state.py +508 -0
  159. specify_cli/orchestrator/testing/__init__.py +122 -0
  160. specify_cli/orchestrator/testing/availability.py +346 -0
  161. specify_cli/orchestrator/testing/fixtures.py +684 -0
  162. specify_cli/orchestrator/testing/paths.py +218 -0
  163. specify_cli/plan_validation.py +107 -0
  164. specify_cli/scripts/debug-dashboard-scan.py +61 -0
  165. specify_cli/scripts/tasks/acceptance_support.py +695 -0
  166. specify_cli/scripts/tasks/task_helpers.py +506 -0
  167. specify_cli/scripts/tasks/tasks_cli.py +848 -0
  168. specify_cli/scripts/validate_encoding.py +180 -0
  169. specify_cli/task_metadata_validation.py +274 -0
  170. specify_cli/tasks_support.py +447 -0
  171. specify_cli/template/__init__.py +47 -0
  172. specify_cli/template/asset_generator.py +206 -0
  173. specify_cli/template/github_client.py +334 -0
  174. specify_cli/template/manager.py +193 -0
  175. specify_cli/template/renderer.py +99 -0
  176. specify_cli/templates/AGENTS.md +190 -0
  177. specify_cli/templates/POWERSHELL_SYNTAX.md +229 -0
  178. specify_cli/templates/agent-file-template.md +35 -0
  179. specify_cli/templates/checklist-template.md +42 -0
  180. specify_cli/templates/claudeignore-template +58 -0
  181. specify_cli/templates/command-templates/accept.md +141 -0
  182. specify_cli/templates/command-templates/analyze.md +253 -0
  183. specify_cli/templates/command-templates/checklist.md +352 -0
  184. specify_cli/templates/command-templates/clarify.md +224 -0
  185. specify_cli/templates/command-templates/constitution.md +432 -0
  186. specify_cli/templates/command-templates/dashboard.md +175 -0
  187. specify_cli/templates/command-templates/implement.md +190 -0
  188. specify_cli/templates/command-templates/merge.md +374 -0
  189. specify_cli/templates/command-templates/plan.md +171 -0
  190. specify_cli/templates/command-templates/research.md +88 -0
  191. specify_cli/templates/command-templates/review.md +510 -0
  192. specify_cli/templates/command-templates/specify.md +321 -0
  193. specify_cli/templates/command-templates/status.md +92 -0
  194. specify_cli/templates/command-templates/tasks.md +199 -0
  195. specify_cli/templates/git-hooks/pre-commit +22 -0
  196. specify_cli/templates/git-hooks/pre-commit-agent-check +37 -0
  197. specify_cli/templates/git-hooks/pre-commit-encoding-check +142 -0
  198. specify_cli/templates/plan-template.md +108 -0
  199. specify_cli/templates/spec-template.md +118 -0
  200. specify_cli/templates/task-prompt-template.md +165 -0
  201. specify_cli/templates/tasks-template.md +161 -0
  202. specify_cli/templates/vscode-settings.json +13 -0
  203. specify_cli/text_sanitization.py +225 -0
  204. specify_cli/upgrade/__init__.py +18 -0
  205. specify_cli/upgrade/detector.py +239 -0
  206. specify_cli/upgrade/metadata.py +182 -0
  207. specify_cli/upgrade/migrations/__init__.py +65 -0
  208. specify_cli/upgrade/migrations/base.py +80 -0
  209. specify_cli/upgrade/migrations/m_0_10_0_python_only.py +359 -0
  210. specify_cli/upgrade/migrations/m_0_10_12_constitution_cleanup.py +99 -0
  211. specify_cli/upgrade/migrations/m_0_10_14_update_implement_slash_command.py +176 -0
  212. specify_cli/upgrade/migrations/m_0_10_1_populate_slash_commands.py +174 -0
  213. specify_cli/upgrade/migrations/m_0_10_2_update_slash_commands.py +172 -0
  214. specify_cli/upgrade/migrations/m_0_10_6_workflow_simplification.py +174 -0
  215. specify_cli/upgrade/migrations/m_0_10_8_fix_memory_structure.py +252 -0
  216. specify_cli/upgrade/migrations/m_0_10_9_repair_templates.py +168 -0
  217. specify_cli/upgrade/migrations/m_0_11_0_workspace_per_wp.py +182 -0
  218. specify_cli/upgrade/migrations/m_0_11_1_improved_workflow_templates.py +173 -0
  219. specify_cli/upgrade/migrations/m_0_11_1_update_implement_slash_command.py +160 -0
  220. specify_cli/upgrade/migrations/m_0_11_2_improved_workflow_templates.py +173 -0
  221. specify_cli/upgrade/migrations/m_0_11_3_workflow_agent_flag.py +114 -0
  222. specify_cli/upgrade/migrations/m_0_12_0_documentation_mission.py +155 -0
  223. specify_cli/upgrade/migrations/m_0_12_1_remove_kitty_specs_from_gitignore.py +183 -0
  224. specify_cli/upgrade/migrations/m_0_2_0_specify_to_kittify.py +80 -0
  225. specify_cli/upgrade/migrations/m_0_4_8_gitignore_agents.py +118 -0
  226. specify_cli/upgrade/migrations/m_0_5_0_encoding_hooks.py +141 -0
  227. specify_cli/upgrade/migrations/m_0_6_5_commands_rename.py +169 -0
  228. specify_cli/upgrade/migrations/m_0_6_7_ensure_missions.py +228 -0
  229. specify_cli/upgrade/migrations/m_0_7_2_worktree_commands_dedup.py +89 -0
  230. specify_cli/upgrade/migrations/m_0_7_3_update_scripts.py +114 -0
  231. specify_cli/upgrade/migrations/m_0_8_0_remove_active_mission.py +82 -0
  232. specify_cli/upgrade/migrations/m_0_8_0_worktree_agents_symlink.py +148 -0
  233. specify_cli/upgrade/migrations/m_0_9_0_frontmatter_only_lanes.py +346 -0
  234. specify_cli/upgrade/migrations/m_0_9_1_complete_lane_migration.py +656 -0
  235. specify_cli/upgrade/migrations/m_0_9_2_research_mission_templates.py +221 -0
  236. specify_cli/upgrade/registry.py +121 -0
  237. specify_cli/upgrade/runner.py +284 -0
  238. specify_cli/validators/__init__.py +14 -0
  239. specify_cli/validators/paths.py +154 -0
  240. specify_cli/validators/research.py +428 -0
  241. specify_cli/verify_enhanced.py +270 -0
  242. specify_cli/workspace_context.py +224 -0
@@ -0,0 +1,510 @@
1
+ ---
2
+ description: Perform structured code review and kanban transitions for completed task prompt files.
3
+ scripts:
4
+ sh: spec-kitty agent check-prerequisites --json --include-tasks
5
+ ps: spec-kitty agent -Json -IncludeTasks
6
+ ---
7
+ *Path: [templates/commands/review.md](templates/commands/review.md)*
8
+
9
+
10
+ ## User Input
11
+
12
+ ```text
13
+ $ARGUMENTS
14
+ ```
15
+
16
+ You **MUST** consider the user input before proceeding (if not empty).
17
+
18
+ ## Location Pre-flight Check (CRITICAL for AI Agents)
19
+
20
+ Before proceeding with review, verify you are in the correct working directory by running the shared pre-flight validation:
21
+
22
+ ```python
23
+ ```
24
+
25
+ **What this validates**:
26
+ - Current branch follows the feature pattern like `001-feature-name`
27
+ - You're not attempting to run from `main` or any release branch
28
+ - The validator prints clear navigation instructions if you're outside the feature worktree
29
+
30
+ **Path reference rule:** When you mention directories or files, provide either the absolute path or a path relative to the project root (for example, `kitty-specs/<feature>/tasks/`). Never refer to a folder by name alone.
31
+
32
+ This is intentional - worktrees provide isolation for parallel feature development.
33
+
34
+ ## Outline
35
+
36
+ 1. Run `{SCRIPT}` from repo root; capture `FEATURE_DIR`, `AVAILABLE_DOCS`, and `tasks.md` path.
37
+
38
+ 2. Determine the review target:
39
+ - If user input specifies a filename, validate it exists under `tasks/` (flat structure, check `lane: "for_review"` in frontmatter).
40
+ - Otherwise, select the oldest file in `tasks/` (lexical order is sufficient because filenames retain task ordering).
41
+ - Abort with instructional message if no files are waiting for review.
42
+
43
+ 3. Load context for the selected task:
44
+ - Read the prompt file frontmatter (lane MUST be `for_review`); note `task_id`, `phase`, `agent`, `shell_pid`, and `dependencies` (if present).
45
+ - Read the body sections (Objective, Context, Implementation Guidance, etc.).
46
+ - Consult supporting documents as referenced: constitution, plan, spec, data-model, contracts, research, quickstart, code changes.
47
+ - Review the associated code in the repository (diffs, tests, docs) to validate the implementation.
48
+ - **Workspace-per-WP checks** (v0.11.0+):
49
+ * dependency_check: If this WP has `dependencies: [WP##, ...]` in frontmatter, verify each dependency WP is merged to main before review; confirm your branch includes those commits.
50
+ * dependent_check: Identify any WPs that list this WP as a dependency (scan `tasks/*.md`); list them with their current lane.
51
+ * rebase_warning: If you request changes AND any dependents exist, warn those agents that a rebase is required and provide a concrete rebase command.
52
+ * verify_instruction: Cross-check dependency declarations against actual code coupling (imports, shared modules, API contracts) and flag mismatches.
53
+
54
+ 4. Conduct the review with **adversarial mindset**:
55
+
56
+ **CRITICAL**: Your job is to FIND PROBLEMS, not just verify checkboxes. Assume the implementation has issues until proven otherwise.
57
+
58
+ ### 4.1 Completeness Scrutiny
59
+
60
+ **Beyond checkbox-ticking:**
61
+ - [ ] ALL subtasks from the prompt actually implemented (not just mentioned in comments)
62
+ - [ ] ALL acceptance criteria from spec actually satisfied (test them, don't assume)
63
+ - [ ] ALL files mentioned in prompt actually created/modified (grep to verify)
64
+ - [ ] ALL error cases handled (not just happy path)
65
+ - [ ] ALL edge cases from spec addressed (check the "Edge Cases" section)
66
+
67
+ **Red flags**:
68
+ - ❌ Comments saying "TODO: implement X" or "FIXME: handle Y"
69
+ - ❌ Functions that return hardcoded/mock data instead of real implementation
70
+ - ❌ Tests that pass but don't actually validate the requirement
71
+ - ❌ Incomplete error messages ("Error occurred" instead of actionable detail)
72
+ - ❌ Missing validation for user input or external data
73
+ - ❌ Deferred features ("will implement in future PR")
74
+
75
+ ### 4.2 Implementation Quality Scrutiny
76
+
77
+ **Code actually works:**
78
+ - [ ] Run the actual code (don't just read it) - does it execute without errors?
79
+ - [ ] Test with invalid inputs - does it fail gracefully with helpful errors?
80
+ - [ ] Check return values - are they the actual result or mocked placeholders?
81
+ - [ ] Verify database/file operations - are changes persisted or just in-memory?
82
+ - [ ] Check API calls - do they actually call the API or return fake data?
83
+
84
+ **Anti-patterns to reject:**
85
+ - ❌ **Simulated results**: `return {"status": "success", "data": "simulated"}`
86
+ - ❌ **Mock implementations**: `def fetch_data(): return [] # TODO: implement API call`
87
+ - ❌ **Pass-through functions**: `def process(x): return x # Will add validation later`
88
+ - ❌ **Commented-out logic**: `# This should validate input but skipping for now`
89
+ - ❌ **Empty exception handlers**: `except Exception: pass # Ignoring errors`
90
+
91
+ ### 4.3 Efficiency & Performance Scrutiny
92
+
93
+ **Implementation is efficient, not just correct:**
94
+ - [ ] No O(n²) algorithms where O(n) or O(log n) possible
95
+ - [ ] No redundant file reads (read once, cache if needed)
96
+ - [ ] No unnecessary subprocess calls (use library if available)
97
+ - [ ] No polling when event-driven approach possible
98
+ - [ ] No synchronous blocking when async available (if performance-critical)
99
+
100
+ **Red flags**:
101
+ - ❌ Nested loops over large datasets without justification
102
+ - ❌ Reading same file multiple times in a loop
103
+ - ❌ Running same grep/find command repeatedly
104
+ - ❌ `time.sleep()` in loops without exponential backoff
105
+ - ❌ Loading entire dataset into memory when streaming possible
106
+
107
+ ### 4.4 Test Quality Scrutiny
108
+
109
+ **Tests actually validate requirements, not just pass:**
110
+ - [ ] Tests cover failure cases, not just happy path
111
+ - [ ] Tests use real data, not just `test_value = "test"`
112
+ - [ ] Tests verify behavior, not implementation details
113
+ - [ ] Test names describe WHAT is being tested, not HOW
114
+ - [ ] Assertions check meaningful outcomes, not just "no exception raised"
115
+
116
+ **Red flags**:
117
+ - ❌ Tests that always pass (assert True, assert 1 == 1)
118
+ - ❌ Tests with no assertions
119
+ - ❌ Tests that don't actually call the code being tested
120
+ - ❌ Mock-heavy tests that don't validate real behavior
121
+ - ❌ Tests marked skip/xfail without explanation
122
+
123
+ ### 4.5 Error Handling & Robustness Scrutiny
124
+
125
+ **Code fails safely and informatively:**
126
+ - [ ] All external calls wrapped in try/except with specific exceptions
127
+ - [ ] Error messages are actionable (tell user what to do)
128
+ - [ ] Resource cleanup happens even on error (files closed, connections released)
129
+ - [ ] Invalid input rejected with clear validation errors
130
+ - [ ] Edge cases explicitly handled (empty lists, None values, zero-length strings)
131
+
132
+ **Red flags**:
133
+ - ❌ `except Exception: pass` (swallowing all errors)
134
+ - ❌ Generic error messages ("An error occurred")
135
+ - ❌ No cleanup in exception handlers (file handles leaked)
136
+ - ❌ Assumptions about input validity without validation
137
+ - ❌ No fallback behavior when external service fails
138
+
139
+ ### 4.6 Cross-Platform Compatibility Scrutiny
140
+
141
+ **Code works on Linux, macOS, AND Windows:**
142
+ - [ ] Path operations use `pathlib.Path`, not string concatenation
143
+ - [ ] No hardcoded `/` or `\` in paths
144
+ - [ ] No POSIX-only commands (grep, find, lsof) without Windows alternatives
145
+ - [ ] No assumptions about line endings (use universal newlines)
146
+ - [ ] No assumptions about case sensitivity (macOS insensitive, Linux sensitive)
147
+
148
+ **Red flags**:
149
+ - ❌ `os.path.join` with `/` hardcoded
150
+ - ❌ Shell commands without platform detection
151
+ - ❌ Signal handling without Windows compatibility (signal.SIGKILL, etc.)
152
+ - ❌ File permissions logic that assumes POSIX
153
+ - ❌ Symlinks without fallback for Windows
154
+
155
+ ### 4.7 Security Scrutiny (CRITICAL - ALWAYS CHECK)
156
+
157
+ **Treat every implementation as potentially vulnerable until proven secure.**
158
+
159
+ #### 4.7.1 Injection Vulnerabilities
160
+
161
+ **SQL Injection:**
162
+ - [ ] All database queries use parameterized queries/ORMs (NEVER string concatenation)
163
+ - [ ] No `f"SELECT * FROM {table}"` or similar patterns
164
+ - [ ] Table/column names validated against whitelist if user-provided
165
+
166
+ **Command Injection:**
167
+ - [ ] All shell commands use list form: `["ls", "-la", user_file]` not `f"ls -la {user_file}"`
168
+ - [ ] No `os.system(f"rm {path}")` or `subprocess.run(f"git commit -m '{msg}'")`
169
+ - [ ] User input to shell commands validated/escaped
170
+ - [ ] Subprocess calls use `shell=False` (default)
171
+
172
+ **Path Traversal:**
173
+ - [ ] File paths validated before access (no `../../../etc/passwd`)
174
+ - [ ] Paths resolved and checked: `Path(user_input).resolve()` stays within allowed directory
175
+ - [ ] No direct concatenation: `f"{base_dir}/{user_file}"` → use `Path(base_dir) / sanitize(user_file)`
176
+
177
+ **Template Injection:**
178
+ - [ ] User input in templates is escaped
179
+ - [ ] No `eval()`, `exec()`, `compile()` on user data
180
+ - [ ] YAML/JSON parsing uses safe loaders (yaml.safe_load, not yaml.load)
181
+
182
+ **Red flags:**
183
+ - ❌ `f"SELECT * FROM users WHERE name = '{user_input}'"`
184
+ - ❌ `subprocess.run(f"git clone {url}", shell=True)`
185
+ - ❌ `open(f"data/{user_filename}")` without path validation
186
+ - ❌ `yaml.load()` instead of `yaml.safe_load()`
187
+ - ❌ `eval(user_expression)` or `exec(user_code)`
188
+
189
+ #### 4.7.2 Authentication & Authorization
190
+
191
+ **If code handles auth/authz:**
192
+ - [ ] Authentication required before privileged operations
193
+ - [ ] Authorization checked (not just authentication)
194
+ - [ ] Session tokens cryptographically secure (not guessable)
195
+ - [ ] No hardcoded credentials or API keys
196
+ - [ ] Password hashing uses modern algorithms (bcrypt, argon2, scrypt)
197
+
198
+ **Red flags:**
199
+ - ❌ `if username == "admin":` (no password check)
200
+ - ❌ `token = "secret123"` hardcoded
201
+ - ❌ `hashlib.md5(password)` or `hashlib.sha1(password)` for passwords
202
+ - ❌ Predictable tokens: `token = str(user_id) + timestamp`
203
+ - ❌ No authorization: user A can access user B's data
204
+
205
+ #### 4.7.3 Sensitive Data Handling
206
+
207
+ **Secrets must never leak:**
208
+ - [ ] No passwords/tokens/keys in logs, error messages, or stack traces
209
+ - [ ] No secrets in git commits (even in test data)
210
+ - [ ] Environment variables used for secrets, not config files
211
+ - [ ] Secrets redacted in debug output: `password=***` not `password=hunter2`
212
+ - [ ] No secrets in URLs (query parameters logged by proxies)
213
+
214
+ **Red flags:**
215
+ - ❌ `logger.info(f"Connecting with password: {password}")`
216
+ - ❌ `config.yaml` containing `api_key: sk-abc123...`
217
+ - ❌ `print(f"Token: {token}")` in production code
218
+ - ❌ Exception messages exposing tokens: `"API call failed with key {api_key}"`
219
+ - ❌ `url = f"https://api.com?secret={secret}"` (secrets in URLs)
220
+
221
+ #### 4.7.4 Data Validation & Sanitization
222
+
223
+ **Never trust user input:**
224
+ - [ ] All user input validated against expected format
225
+ - [ ] String lengths limited (prevent DoS via huge inputs)
226
+ - [ ] Numeric values range-checked
227
+ - [ ] File uploads validated (type, size, content)
228
+ - [ ] URLs validated and normalized before use
229
+
230
+ **Red flags:**
231
+ - ❌ No validation: `user_age = int(request.get('age'))` (what if negative? 99999999?)
232
+ - ❌ No length limits: `name = input()` (what if 1GB string?)
233
+ - ❌ No type validation: assuming input is string when could be list/dict
234
+ - ❌ No allowlist: accepting any file extension instead of specific types
235
+ - ❌ Trusting client-side validation (always validate server-side)
236
+
237
+ #### 4.7.5 File System Security
238
+
239
+ **File operations must be safe:**
240
+ - [ ] File permissions set appropriately (not world-readable for sensitive files)
241
+ - [ ] Temp files created securely (`tempfile.NamedTemporaryFile`, not `/tmp/predictable`)
242
+ - [ ] File deletions validated (not deleting outside project)
243
+ - [ ] Symlink attacks prevented (resolve symlinks before security checks)
244
+ - [ ] Race conditions prevented (TOCTOU: time-of-check vs time-of-use)
245
+
246
+ **Red flags:**
247
+ - ❌ `open("/tmp/myapp_123", "w")` (predictable temp file)
248
+ - ❌ `os.chmod(file, 0o777)` (world-writable)
249
+ - ❌ `if os.path.exists(file): os.remove(file)` (race condition)
250
+ - ❌ Not checking if path is symlink before security checks
251
+ - ❌ Following symlinks without validating destination
252
+
253
+ #### 4.7.6 Dependency Security
254
+
255
+ **Dependencies must be trustworthy:**
256
+ - [ ] All dependencies pinned or have minimum version (no `package` without version)
257
+ - [ ] No suspicious/unmaintained packages (check PyPI, npm, etc.)
258
+ - [ ] Dependency licenses compatible with project
259
+ - [ ] No dependencies with known vulnerabilities (check CVE databases)
260
+ - [ ] Minimal dependency set (fewer dependencies = smaller attack surface)
261
+
262
+ **Red flags:**
263
+ - ❌ `dependencies = ["some-random-package"]` (no version, unknown maintainer)
264
+ - ❌ Adding dependency for feature that could be implemented in 10 lines
265
+ - ❌ Using deprecated packages with security vulnerabilities
266
+ - ❌ Transitive dependencies not reviewed
267
+
268
+ #### 4.7.7 Cryptography (If Applicable)
269
+
270
+ **Crypto must be correct:**
271
+ - [ ] Using established libraries (cryptography, nacl), not rolling own
272
+ - [ ] Using modern algorithms (AES-256-GCM, ChaCha20-Poly1305)
273
+ - [ ] Random values use `secrets` module, not `random`
274
+ - [ ] No weak algorithms (MD5, SHA1 for security, DES, RC4)
275
+ - [ ] Proper key management (keys not hardcoded)
276
+
277
+ **Red flags:**
278
+ - ❌ `random.randint()` for security tokens (use `secrets.token_bytes()`)
279
+ - ❌ Implementing own encryption algorithm
280
+ - ❌ `hashlib.md5()` for password hashing (use bcrypt/argon2)
281
+ - ❌ Keys in code: `AES_KEY = b"sixteen byte key"`
282
+ - ❌ Using ECB mode (use GCM or CBC with authentication)
283
+
284
+ #### 4.7.8 API Security (If Applicable)
285
+
286
+ **APIs must be secure:**
287
+ - [ ] Authentication required for non-public endpoints
288
+ - [ ] Rate limiting implemented (prevent abuse)
289
+ - [ ] CORS configured properly (not `allow-origin: *` in production)
290
+ - [ ] Input validated at API boundary
291
+ - [ ] Output doesn't leak sensitive info in error messages
292
+
293
+ **Red flags:**
294
+ - ❌ No authentication on sensitive endpoints
295
+ - ❌ No rate limiting (API can be DoS'd)
296
+ - ❌ `Access-Control-Allow-Origin: *` with credentials
297
+ - ❌ Detailed error messages exposing internals: `"SQL error: table users not found"`
298
+ - ❌ No input size limits (can send 1GB JSON)
299
+
300
+ #### 4.7.9 Privilege & Permission Issues
301
+
302
+ **Principle of least privilege:**
303
+ - [ ] Code runs with minimum required permissions
304
+ - [ ] No unnecessary sudo/admin rights required
305
+ - [ ] Privilege escalation only when absolutely needed and validated
306
+ - [ ] No SUID binaries or equivalent
307
+ - [ ] File operations respect user permissions
308
+
309
+ **Red flags:**
310
+ - ❌ Requiring sudo when not needed
311
+ - ❌ Creating world-writable files
312
+ - ❌ Assuming root/admin privileges
313
+ - ❌ Not checking permissions before operations
314
+ - ❌ Privilege escalation without user confirmation
315
+
316
+ #### 4.7.10 Mandatory Security Verification Commands
317
+
318
+ **For EVERY work package, run these checks:**
319
+
320
+ ```bash
321
+ # 1. Injection check
322
+ grep -rn "subprocess.run.*shell=True" <files>
323
+ grep -rn 'f".*{.*}"' <files> | grep -i "select\|insert\|delete\|update\|exec\|eval"
324
+ # Expected: Empty or justified
325
+
326
+ # 2. Secret exposure check
327
+ git diff | grep -i "password\|secret\|token\|api_key" | grep -v "# "
328
+ # Expected: Empty or all in test fixtures/examples
329
+
330
+ # 3. Unsafe operations check
331
+ grep -rn "rm -rf\|shutil.rmtree\|os.remove" <files>
332
+ # Verify: All have path validation before deletion
333
+
334
+ # 4. Crypto check
335
+ grep -rn "random\.\|md5\|sha1" <files>
336
+ # Verify: Using secrets module for security, not random
337
+
338
+ # 5. Exception handling check
339
+ grep -rn "except.*:$" <files> | grep -v "pass #"
340
+ # Verify: All have comments explaining why catching broad exception
341
+
342
+ # 6. Eval/exec check
343
+ grep -rn "eval\|exec\|compile" <files>
344
+ # Expected: Empty unless absolutely necessary and input validated
345
+
346
+ # 7. YAML safety check
347
+ grep -rn "yaml\.load[^_]" <files>
348
+ # Expected: Empty (should use yaml.safe_load)
349
+ ```
350
+
351
+ **If ANY security check fails → AUTOMATIC REJECTION**
352
+
353
+ ### 4.8 Logical Fallacies & Design Flaws Scrutiny
354
+
355
+ **Design makes sense, logic is sound:**
356
+ - [ ] No circular dependencies (A depends on B depends on A)
357
+ - [ ] No race conditions (proper locking/synchronization)
358
+ - [ ] No assumption that operations are atomic when they're not
359
+ - [ ] No missing null checks before dereferencing
360
+ - [ ] State management is consistent (no orphaned state)
361
+
362
+ **Red flags**:
363
+ - ❌ `if x is not None: x.method()` after code that could set x = None
364
+ - ❌ Checking file exists, then reading (race condition)
365
+ - ❌ Multiple processes modifying same file without locking
366
+ - ❌ Assuming list is non-empty without checking
367
+ - ❌ Using mutable default arguments: `def foo(items=[]):`
368
+
369
+ ### 4.9 Documentation & Maintainability Scrutiny
370
+
371
+ **Code is understandable and maintainable:**
372
+ - [ ] Complex logic has explanatory comments (why, not what)
373
+ - [ ] Public functions have docstrings with examples
374
+ - [ ] Magic numbers replaced with named constants
375
+ - [ ] Cryptic variable names replaced with descriptive ones
376
+ - [ ] Non-obvious behavior documented
377
+
378
+ **Red flags**:
379
+ - ❌ Functions longer than 50 lines without clear sections
380
+ - ❌ No docstrings on public APIs
381
+ - ❌ Magic numbers: `if count > 42:` without explanation
382
+ - ❌ Single-letter variables in complex logic: `x`, `y`, `z`
383
+ - ❌ Surprising behavior not documented
384
+
385
+ ### 4.10 Verification Commands (ACTUALLY RUN THESE)
386
+
387
+ **Don't assume - verify:**
388
+ ```bash
389
+ # 1. Grep for red flags
390
+ grep -rn "TODO\|FIXME\|HACK\|XXX" <changed_files>
391
+ grep -rn "simulated\|mock_\|fake_" <changed_files>
392
+ grep -rn "pass # " <changed_files> # Empty exception handlers
393
+
394
+ # 2. Run tests (actually execute, don't just check they exist)
395
+ pytest <test_files> -v --tb=short
396
+ # Verify: All pass, coverage >80%, no skipped tests
397
+
398
+ # 3. Run linter (check code quality)
399
+ ruff check <changed_files>
400
+ # Verify: No errors, minimal warnings
401
+
402
+ # 4. Test actual behavior (not just unit tests)
403
+ # Example: If implementing file sync, create file, sync, verify synced
404
+ # Example: If implementing dashboard, start it, access URL, verify response
405
+
406
+ # 5. Check for performance issues
407
+ grep -rn "sleep\|time.sleep" <changed_files>
408
+ # Justify each sleep - is it necessary or lazy coding?
409
+
410
+ # 6. Check error handling
411
+ grep -rn "except.*:" <changed_files>
412
+ # Each exception handler should be specific, not generic
413
+
414
+ # 7. Verify documentation updated
415
+ # If README/docs mention this feature, verify they're current
416
+ ```
417
+
418
+ ### 4.11 Adversarial Test Cases
419
+
420
+ **Think like an attacker/user trying to break it:**
421
+ - Run with empty input - does it crash or handle gracefully?
422
+ - Run with extremely large input - does it OOM or handle gracefully?
423
+ - Run with malicious input - does it validate/escape properly?
424
+ - Run with missing dependencies - does it provide helpful error?
425
+ - Run concurrent operations - does it handle race conditions?
426
+ - Run on different platforms - does it work on all target platforms?
427
+ - Kill process mid-operation - is state left in consistent state?
428
+
429
+ ### 4.12 Review Decision Criteria
430
+
431
+ **REJECT (send back to planned) if ANY of these:**
432
+ - Any TODOs/FIXMEs in production code (tests OK)
433
+ - Any simulated/mocked functionality (except in tests)
434
+ - Any empty exception handlers without justification
435
+ - Tests don't actually run the code or use mocks everywhere
436
+ - Missing error handling for external operations (file I/O, network, subprocess)
437
+ - Performance issue that will cause problems at scale
438
+ - Security vulnerability (injection, data exposure, unsafe operations)
439
+ - Cross-platform issue on target platforms
440
+ - Incomplete implementation of stated requirements
441
+ - Logical flaw or race condition
442
+
443
+ **APPROVE ONLY if ALL of these:**
444
+ - Every subtask fully implemented (no shortcuts)
445
+ - All tests pass and actually validate behavior
446
+ - Error handling comprehensive and helpful
447
+ - No performance red flags or justified if present
448
+ - No security issues (ran all security checks in 4.7.10)
449
+ - Works on all target platforms (or platform-specific code isolated)
450
+ - Code is maintainable and documented
451
+ - No logical flaws or race conditions
452
+ - All verification commands (4.10) executed and passed
453
+
454
+ **Default stance: REJECT.** Only approve when you've actively tried to find problems and found none. "Looks good" is not good enough - you must prove it's good.
455
+
456
+ 5. Decide outcome:
457
+ - **Needs changes**:
458
+ * **CRITICAL**: Insert detailed feedback in the `## Review Feedback` section (located immediately after the frontmatter, before Objectives). This is the FIRST thing implementers will see when they re-read the prompt.
459
+ * Use a clear structure:
460
+ ```markdown
461
+ ## Review Feedback
462
+
463
+ **Status**: ❌ **Needs Changes**
464
+
465
+ **Key Issues**:
466
+ 1. [Issue 1] - Why it's a problem and what to do about it
467
+ 2. [Issue 2] - Why it's a problem and what to do about it
468
+
469
+ **What Was Done Well**:
470
+ - [Positive note 1]
471
+ - [Positive note 2]
472
+
473
+ **Action Items** (must complete before re-review):
474
+ - [ ] Fix [specific thing 1]
475
+ - [ ] Add [missing thing 2]
476
+ - [ ] Verify [validation point 3]
477
+ ```
478
+ * Update frontmatter:
479
+ - Set `lane: "planned"`
480
+ - Set `review_status: "has_feedback"`
481
+ - Set `reviewed_by: <YOUR_AGENT_ID>`
482
+ - Clear `assignee` if needed
483
+ * Append a new entry in the prompt's **Activity Log** with timestamp, reviewer agent, shell PID, and summary of feedback.
484
+ * Run `spec-kitty agent move-task <FEATURE> <TASK_ID> planned --note "Code review complete: [brief summary of issues]"` (use the PowerShell equivalent on Windows) so the move and history update are staged consistently.
485
+ - **Approved**:
486
+ * Append Activity Log entry capturing approval details (capture shell PID via `echo $$` or helper script, e.g., `2025-11-11T13:45:00Z – claude – shell_pid=1234 – lane=done – Approved without changes`).
487
+ * Update frontmatter:
488
+ - Sets `lane: "done"`
489
+ - Sets `review_status: "approved without changes"` (or your custom status)
490
+ - Sets `reviewed_by: <YOUR_AGENT_ID>`
491
+ - Updates `agent: <YOUR_AGENT_ID>` and `shell_pid: <YOUR_SHELL_PID>`
492
+ - Appends Activity Log entry with reviewer's info (NOT implementer's)
493
+ - Handles git operations (add new location, remove old location)
494
+ * **Alternative:** For custom review statuses, use `--review-status "approved with minor notes"` or `--target-lane "planned"` for rejected tasks.
495
+ * Use helper script to mark the task complete in `tasks.md` (see Step 7).
496
+
497
+ 7. Update `tasks.md` automatically:
498
+ - Run `spec-kitty agent mark-status --task-id <TASK_ID> --status done` (POSIX) or `spec-kitty agent -TaskId <TASK_ID> -Status done` (PowerShell) from repo root.
499
+ - Confirm the task entry now shows `[X]` and includes a reference to the prompt file in its notes.
500
+
501
+ 7. Produce a review report summarizing:
502
+ - Task ID and filename reviewed.
503
+ - Approval status and key findings.
504
+ - Tests executed and their results.
505
+ - Follow-up actions (if any) for other team members.
506
+ - Reminder to push changes or notify teammates as per project conventions.
507
+
508
+ Context for review: {ARGS} (resolve this to the prompt's relative path, e.g., `kitty-specs/<feature>/tasks/WPXX.md`)
509
+
510
+ All review feedback must live inside the prompt file, ensuring future implementers understand historical decisions before revisiting the task.