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,388 @@
1
+ ---
2
+ description: Merge a completed feature into the main branch and clean up worktree
3
+ ---
4
+
5
+ # Merge Feature Branch
6
+
7
+ This command merges a completed feature branch into the main/target branch and handles cleanup of worktrees and branches.
8
+
9
+ ## Prerequisites
10
+
11
+ Before running this command:
12
+
13
+ 1. ✅ Feature must pass `/spec-kitty.accept` checks
14
+ 2. ✅ All work packages must be in `tasks/`
15
+ 3. ✅ Working directory must be clean (no uncommitted changes)
16
+ 4. ✅ You must be on the feature branch (or in its worktree)
17
+
18
+ ## ⛔ Location Pre-flight Check (CRITICAL)
19
+
20
+ **BEFORE PROCEEDING:** You MUST be in the feature worktree, NOT the main repository.
21
+
22
+ Verify your current location:
23
+ ```bash
24
+ pwd
25
+ git branch --show-current
26
+ ```
27
+
28
+ **Expected output:**
29
+ - `pwd`: Should end with `.worktrees/001-feature-name` (or similar feature worktree)
30
+ - Branch: Should show your feature branch name like `001-feature-name` (NOT `main` or `release/*`)
31
+
32
+ **If you see:**
33
+ - Branch showing `main` or `release/`
34
+ - OR pwd shows the main repository root
35
+
36
+ ⛔ **STOP - DANGER! You are in the wrong location!**
37
+
38
+ **Correct the issue:**
39
+ 1. Navigate to your feature worktree: `cd .worktrees/001-feature-name`
40
+ 2. Verify you're on the correct feature branch: `git branch --show-current`
41
+ 3. Then run this merge command again
42
+
43
+ **Exception (main branch):**
44
+ If you are on `main` and need to merge a workspace-per-WP feature, run:
45
+ ```bash
46
+ spec-kitty merge --feature <feature-slug>
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Location Pre-flight Check (CRITICAL for AI Agents)
52
+
53
+ Before merging, verify you are in the correct working directory by running this validation:
54
+
55
+ ```bash
56
+ python3 -c "
57
+ from specify_cli.guards import validate_worktree_location
58
+ result = validate_worktree_location()
59
+ if not result.is_valid:
60
+ print(result.format_error())
61
+ print('\nThis command MUST run from a feature worktree, not the main repository.')
62
+ print('\nFor workspace-per-WP features, run from ANY WP worktree:')
63
+ print(' cd /path/to/project/.worktrees/<feature>-WP01')
64
+ print(' # or any other WP worktree for this feature')
65
+ raise SystemExit(1)
66
+ else:
67
+ print('✓ Location verified:', result.branch_name)
68
+ "
69
+ ```
70
+
71
+ **What this validates**:
72
+ - Current branch follows the feature pattern like `001-feature-name`
73
+ - You're not attempting to run from `main` or any release branch
74
+ - The validator prints clear navigation instructions if you're outside the feature worktree
75
+
76
+ **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.
77
+
78
+ ## Final Research Integrity Check
79
+
80
+ Before merging research to main, perform final validation:
81
+
82
+ ```bash
83
+ # Quick citation validation
84
+ python -c "
85
+ from pathlib import Path
86
+ from specify_cli.validators.research import validate_citations, validate_source_register
87
+
88
+ feature_dir = Path('kitty-specs/$FEATURE_SLUG')
89
+ evidence = feature_dir / 'research' / 'evidence-log.csv'
90
+ sources = feature_dir / 'research' / 'source-register.csv'
91
+
92
+ if evidence.exists():
93
+ result = validate_citations(evidence)
94
+ if result.has_errors:
95
+ print('ERROR: Evidence log has citation errors')
96
+ exit(1)
97
+
98
+ if sources.exists():
99
+ result = validate_source_register(sources)
100
+ if result.has_errors:
101
+ print('ERROR: Source register has errors')
102
+ exit(1)
103
+
104
+ print('✓ Citations validated')
105
+ "
106
+ ```
107
+
108
+ ## What This Command Does
109
+
110
+ 1. **Detects** your current feature branch and worktree status
111
+ 2. **Runs** pre-flight validation across all worktrees and the target branch
112
+ 3. **Determines** merge order based on WP dependencies (workspace-per-WP)
113
+ 4. **Forecasts** conflicts during `--dry-run` and flags auto-resolvable status files
114
+ 5. **Verifies** working directory is clean (legacy single-worktree)
115
+ 6. **Switches** to the target branch (default: `main`)
116
+ 7. **Updates** the target branch (`git pull --ff-only`)
117
+ 8. **Merges** the feature using your chosen strategy
118
+ 9. **Auto-resolves** status file conflicts after each WP merge
119
+ 10. **Optionally pushes** to origin
120
+ 11. **Removes** the feature worktree (if in one)
121
+ 12. **Deletes** the feature branch
122
+
123
+ ## Usage
124
+
125
+ ### Basic merge (default: merge commit, cleanup everything)
126
+
127
+ ```bash
128
+ spec-kitty merge
129
+ ```
130
+
131
+ This will:
132
+ - Create a merge commit
133
+ - Remove the worktree
134
+ - Delete the feature branch
135
+ - Keep changes local (no push)
136
+
137
+ ### Merge with options
138
+
139
+ ```bash
140
+ # Squash all commits into one
141
+ spec-kitty merge --strategy squash
142
+
143
+ # Push to origin after merging
144
+ spec-kitty merge --push
145
+
146
+ # Keep the feature branch
147
+ spec-kitty merge --keep-branch
148
+
149
+ # Keep the worktree
150
+ spec-kitty merge --keep-worktree
151
+
152
+ # Merge into a different branch
153
+ spec-kitty merge --target develop
154
+
155
+ # See what would happen without doing it
156
+ spec-kitty merge --dry-run
157
+
158
+ # Run merge from main for a workspace-per-WP feature
159
+ spec-kitty merge --feature 017-feature-slug
160
+ ```
161
+
162
+ ### Common workflows
163
+
164
+ ```bash
165
+ # Feature complete, squash and push
166
+ spec-kitty merge --strategy squash --push
167
+
168
+ # Keep branch for reference
169
+ spec-kitty merge --keep-branch
170
+
171
+ # Merge into develop instead of main
172
+ spec-kitty merge --target develop --push
173
+ ```
174
+
175
+ ## Merge Strategies
176
+
177
+ ### `merge` (default)
178
+ Creates a merge commit preserving all feature branch commits.
179
+ ```bash
180
+ spec-kitty merge --strategy merge
181
+ ```
182
+ ✅ Preserves full commit history
183
+ ✅ Clear feature boundaries in git log
184
+ ❌ More commits in main branch
185
+
186
+ ### `squash`
187
+ Squashes all feature commits into a single commit.
188
+ ```bash
189
+ spec-kitty merge --strategy squash
190
+ ```
191
+ ✅ Clean, linear history on main
192
+ ✅ Single commit per feature
193
+ ❌ Loses individual commit details
194
+
195
+ ### `rebase`
196
+ Requires manual rebase first (command will guide you).
197
+ ```bash
198
+ spec-kitty merge --strategy rebase
199
+ ```
200
+ ✅ Linear history without merge commits
201
+ ❌ Requires manual intervention
202
+ ❌ Rewrites commit history
203
+
204
+ ## Options
205
+
206
+ | Option | Description | Default |
207
+ |--------|-------------|---------|
208
+ | `--strategy` | Merge strategy: `merge`, `squash`, or `rebase` | `merge` |
209
+ | `--delete-branch` / `--keep-branch` | Delete feature branch after merge | delete |
210
+ | `--remove-worktree` / `--keep-worktree` | Remove feature worktree after merge | remove |
211
+ | `--push` | Push to origin after merge | no push |
212
+ | `--target` | Target branch to merge into | `main` |
213
+ | `--dry-run` | Show what would be done without executing | off |
214
+ | `--feature` | Feature slug when merging from main branch | none |
215
+ | `--resume` | Resume an interrupted merge | off |
216
+
217
+ ## Worktree Strategy
218
+
219
+ Spec Kitty uses an **opinionated worktree approach**:
220
+
221
+ ### Workspace-per-WP Model (0.11.0+)
222
+
223
+ In the current model, each work package gets its own worktree:
224
+
225
+ ```
226
+ my-project/ # Main repo (main branch)
227
+ ├── .worktrees/
228
+ │ ├── 001-auth-system-WP01/ # WP01 worktree
229
+ │ ├── 001-auth-system-WP02/ # WP02 worktree
230
+ │ ├── 001-auth-system-WP03/ # WP03 worktree
231
+ │ └── 002-dashboard-WP01/ # Different feature
232
+ ├── .kittify/
233
+ ├── kitty-specs/
234
+ └── ... (main branch files)
235
+ ```
236
+
237
+ **Merge behavior for workspace-per-WP**:
238
+ - Run `spec-kitty merge` from **any** WP worktree for the feature
239
+ - The command automatically detects all WP branches (WP01, WP02, WP03, etc.)
240
+ - Merges each WP branch into main in sequence
241
+ - Cleans up all WP worktrees and branches
242
+
243
+ ### Legacy Pattern (0.10.x)
244
+ ```
245
+ my-project/ # Main repo (main branch)
246
+ ├── .worktrees/
247
+ │ ├── 001-auth-system/ # Feature 1 worktree (single)
248
+ │ ├── 002-dashboard/ # Feature 2 worktree (single)
249
+ │ └── 003-notifications/ # Feature 3 worktree (single)
250
+ ├── .kittify/
251
+ ├── kitty-specs/
252
+ └── ... (main branch files)
253
+ ```
254
+
255
+ ### The Rules
256
+ 1. **Main branch** stays in the primary repo root
257
+ 2. **Feature branches** live in `.worktrees/<feature-slug>/`
258
+ 3. **Work on features** happens in their worktrees (isolation)
259
+ 4. **Merge from worktrees** using this command
260
+ 5. **Cleanup is automatic** - worktrees removed after merge
261
+
262
+ ### Why Worktrees?
263
+ - ✅ Work on multiple features simultaneously
264
+ - ✅ Each feature has its own sandbox
265
+ - ✅ No branch switching in main repo
266
+ - ✅ Easy to compare features
267
+ - ✅ Clean separation of concerns
268
+
269
+ ### The Flow
270
+ ```
271
+ 1. /spec-kitty.specify → Creates branch + worktree
272
+ 2. cd .worktrees/<feature>/ → Enter worktree
273
+ 3. /spec-kitty.plan → Work in isolation
274
+ 4. /spec-kitty.tasks
275
+ 5. /spec-kitty.implement
276
+ 6. /spec-kitty.review
277
+ 7. /spec-kitty.accept
278
+ 8. /spec-kitty.merge → Merge + cleanup worktree
279
+ 9. Back in main repo! → Ready for next feature
280
+ ```
281
+
282
+ ## Error Handling
283
+
284
+ ### "Already on main branch"
285
+ You're not on a feature branch. Switch to your feature branch first:
286
+ ```bash
287
+ cd .worktrees/<feature-slug>
288
+ # or
289
+ git checkout <feature-branch>
290
+ ```
291
+
292
+ ### "Working directory has uncommitted changes"
293
+ Commit or stash your changes:
294
+ ```bash
295
+ git add .
296
+ git commit -m "Final changes"
297
+ # or
298
+ git stash
299
+ ```
300
+
301
+ ### "Could not fast-forward main"
302
+ Your main branch is behind origin:
303
+ ```bash
304
+ git checkout main
305
+ git pull
306
+ git checkout <feature-branch>
307
+ spec-kitty merge
308
+ ```
309
+
310
+ ### "Merge failed - conflicts"
311
+ Resolve conflicts manually:
312
+ ```bash
313
+ # Fix conflicts in files
314
+ git add <resolved-files>
315
+ git commit
316
+ # Then complete cleanup manually:
317
+ git worktree remove .worktrees/<feature>
318
+ git branch -d <feature-branch>
319
+ ```
320
+
321
+ ## Safety Features
322
+
323
+ 1. **Clean working directory check** - Won't merge with uncommitted changes
324
+ 2. **Fast-forward only pull** - Won't proceed if main has diverged
325
+ 3. **Graceful failure** - If merge fails, you can fix manually
326
+ 4. **Optional operations** - Push, branch delete, and worktree removal are configurable
327
+ 5. **Dry run mode** - Preview exactly what will happen
328
+
329
+ ## Examples
330
+
331
+ ### Complete feature and push
332
+ ```bash
333
+ cd .worktrees/001-auth-system
334
+ /spec-kitty.accept
335
+ /spec-kitty.merge --push
336
+ ```
337
+
338
+ ### Squash merge for cleaner history
339
+ ```bash
340
+ spec-kitty merge --strategy squash --push
341
+ ```
342
+
343
+ ### Merge but keep branch for reference
344
+ ```bash
345
+ spec-kitty merge --keep-branch --push
346
+ ```
347
+
348
+ ### Check what will happen first
349
+ ```bash
350
+ spec-kitty merge --dry-run
351
+ ```
352
+
353
+ ## After Merging
354
+
355
+ After a successful merge, you're back on the main branch with:
356
+ - ✅ Feature code integrated
357
+ - ✅ Worktree removed (if it existed)
358
+ - ✅ Feature branch deleted (unless `--keep-branch`)
359
+ - ✅ Ready to start your next feature!
360
+
361
+ ## Integration with Accept
362
+
363
+ The typical flow is:
364
+
365
+ ```bash
366
+ # 1. Run acceptance checks
367
+ /spec-kitty.accept --mode local
368
+
369
+ # 2. If checks pass, merge
370
+ /spec-kitty.merge --push
371
+ ```
372
+
373
+ Or combine conceptually:
374
+ ```bash
375
+ # Accept verifies readiness
376
+ /spec-kitty.accept --mode local
377
+
378
+ # Merge performs integration
379
+ /spec-kitty.merge --strategy squash --push
380
+ ```
381
+
382
+ The `/spec-kitty.accept` command **verifies** your feature is complete.
383
+ The `/spec-kitty.merge` command **integrates** your feature into main.
384
+
385
+ Together they complete the workflow:
386
+ ```
387
+ specify → plan → tasks → implement → review → accept → merge ✅
388
+ ```
@@ -0,0 +1,125 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Location Pre-flight Check (CRITICAL for AI Agents)
14
+
15
+ Before proceeding with planning, verify you are in the correct working directory by running the shared pre-flight validation:
16
+
17
+ ```python
18
+ ```
19
+
20
+ **What this validates**:
21
+ - Current branch follows the feature pattern like `001-feature-name`
22
+ - You're not attempting to run from `main` or any release branch
23
+ - The validator prints clear navigation instructions if you're outside the feature worktree
24
+
25
+ **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.
26
+
27
+ ## Planning Interrogation (mandatory)
28
+
29
+ Before executing any scripts or generating artifacts you must interrogate the specification and stakeholders.
30
+
31
+ - **Scope proportionality (CRITICAL)**: FIRST, assess the feature's complexity from the spec:
32
+ - **Trivial/Test Features** (hello world, simple static pages, basic demos): Ask 1-2 questions maximum about tech stack preference, then proceed with sensible defaults
33
+ - **Simple Features** (small components, minor API additions): Ask 2-3 questions about tech choices and constraints
34
+ - **Complex Features** (new subsystems, multi-component features): Ask 3-5 questions covering architecture, NFRs, integrations
35
+ - **Platform/Critical Features** (core infrastructure, security, payments): Full interrogation with 5+ questions
36
+
37
+ - **User signals to reduce questioning**: If the user says "use defaults", "just make it simple", "skip to implementation", "vanilla HTML/CSS/JS" - recognize these as signals to minimize planning questions and use standard approaches.
38
+
39
+ - **First response rule**:
40
+ - For TRIVIAL features: Ask ONE tech stack question, then if answer is simple (e.g., "vanilla HTML"), proceed directly to plan generation
41
+ - For other features: Ask a single architecture question and end with `WAITING_FOR_PLANNING_INPUT`
42
+
43
+ - If the user has not provided plan context, keep interrogating with one question at a time.
44
+
45
+ - **Conversational cadence**: After each reply, assess if you have SUFFICIENT context for this feature's scope. For trivial features, knowing the basic stack is enough. Only continue if critical unknowns remain.
46
+
47
+ Planning requirements (scale to complexity):
48
+
49
+ 1. Maintain a **Planning Questions** table internally covering questions appropriate to the feature's complexity (1-2 for trivial, up to 5+ for platform-level). Track columns `#`, `Question`, `Why it matters`, and `Current insight`. Do **not** render this table to the user.
50
+ 2. For trivial features, standard practices are acceptable (vanilla HTML, simple file structure, no build tools). Only probe if the user's request suggests otherwise.
51
+ 3. When you have sufficient context for the scope, summarize into an **Engineering Alignment** note and confirm.
52
+ 4. If user explicitly asks to skip questions or use defaults, acknowledge and proceed with best practices for that feature type.
53
+
54
+ ## Outline
55
+
56
+ 1. **Check planning discovery status**:
57
+ - If any planning questions remain unanswered or the user has not confirmed the **Engineering Alignment** summary, stay in the one-question cadence, capture the user’s response, update your internal table, and end with `WAITING_FOR_PLANNING_INPUT`. Do **not** surface the table. Do **not** run `{SCRIPT}` yet.
58
+ - Once every planning question has a concrete answer and the alignment summary is confirmed by the user, continue.
59
+
60
+ 2. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH.
61
+
62
+ 3. **Load context**: Read FEATURE_SPEC and `.kittify/memory/constitution.md` if it exists. If the constitution file is missing, skip Constitution Check and note that it is absent. Load IMPL_PLAN template (already copied).
63
+
64
+ 4. **Execute plan workflow**: Follow the structure in IMPL_PLAN template, using the validated planning answers as ground truth:
65
+ - Update Technical Context with explicit statements from the user or discovery research; mark `[NEEDS CLARIFICATION: …]` only when the user deliberately postpones a decision
66
+ - If a constitution exists, fill Constitution Check section from it and challenge any conflicts directly with the user. If no constitution exists, mark the section as skipped.
67
+ - Evaluate gates (ERROR if violations unjustified or questions remain unanswered)
68
+ - Phase 0: Generate research.md (commission research to resolve every outstanding clarification)
69
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md based on confirmed intent
70
+ - Phase 1: Update agent context by running the agent script
71
+ - Re-evaluate Constitution Check post-design, asking the user to resolve new gaps before proceeding
72
+
73
+ 5. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
74
+
75
+ ## Phases
76
+
77
+ ### Phase 0: Outline & Research
78
+
79
+ 1. **Extract unknowns from Technical Context** above:
80
+ - For each NEEDS CLARIFICATION → research task
81
+ - For each dependency → best practices task
82
+ - For each integration → patterns task
83
+
84
+ 2. **Generate and dispatch research agents**:
85
+ ```
86
+ For each unknown in Technical Context:
87
+ Task: "Research {unknown} for {feature context}"
88
+ For each technology choice:
89
+ Task: "Find best practices for {tech} in {domain}"
90
+ ```
91
+
92
+ 3. **Consolidate findings** in `research.md` using format:
93
+ - Decision: [what was chosen]
94
+ - Rationale: [why chosen]
95
+ - Alternatives considered: [what else evaluated]
96
+
97
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
98
+
99
+ ### Phase 1: Design & Contracts
100
+
101
+ **Prerequisites:** `research.md` complete
102
+
103
+ 1. **Extract entities from feature spec** → `data-model.md`:
104
+ - Entity name, fields, relationships
105
+ - Validation rules from requirements
106
+ - State transitions if applicable
107
+
108
+ 2. **Generate API contracts** from functional requirements:
109
+ - For each user action → endpoint
110
+ - Use standard REST/GraphQL patterns
111
+ - Output OpenAPI/GraphQL schema to `/contracts/`
112
+
113
+ 3. **Agent context update**:
114
+ - Run `{AGENT_SCRIPT}`
115
+ - These scripts detect which AI agent is in use
116
+ - Update the appropriate agent-specific context file
117
+ - Add only new technology from current plan
118
+ - Preserve manual additions between markers
119
+
120
+ **Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file
121
+
122
+ ## Key rules
123
+
124
+ - Use absolute paths
125
+ - ERROR on gate failures or unresolved clarifications
@@ -0,0 +1,144 @@
1
+ ---
2
+ description: Perform structured research review with citation validation.
3
+ ---
4
+
5
+ ## User Input
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ You **MUST** consider the user input before proceeding (if not empty).
12
+
13
+ ## Location Pre-flight Check (CRITICAL for AI Agents)
14
+
15
+ Before proceeding with review, verify you are in the correct working directory by running the shared pre-flight validation:
16
+
17
+ ```python
18
+ ```
19
+
20
+ **What this validates**:
21
+ - Current branch follows the feature pattern like `001-feature-name`
22
+ - You're not attempting to run from `main` or any release branch
23
+ - The validator prints clear navigation instructions if you're outside the feature worktree
24
+
25
+ **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.
26
+
27
+ ## Citation Validation (Research Mission Specific)
28
+
29
+ Before reviewing research tasks, validate all citations and sources:
30
+
31
+ ```python
32
+ from pathlib import Path
33
+ from specify_cli.validators.research import validate_citations, validate_source_register
34
+
35
+ # Validate evidence log
36
+ evidence_log = FEATURE_DIR / "research" / "evidence-log.csv"
37
+ if evidence_log.exists():
38
+ result = validate_citations(evidence_log)
39
+ if result.has_errors:
40
+ print(result.format_report())
41
+ print("\nERROR: Citation validation failed. Fix errors before proceeding.")
42
+ exit(1)
43
+ elif result.warning_count > 0:
44
+ print(result.format_report())
45
+ print("\nWarnings found - consider addressing for better citation quality.")
46
+
47
+ # Validate source register
48
+ source_register = FEATURE_DIR / "research" / "source-register.csv"
49
+ if source_register.exists():
50
+ result = validate_source_register(source_register)
51
+ if result.has_errors:
52
+ print(result.format_report())
53
+ print("\nERROR: Source register validation failed.")
54
+ exit(1)
55
+ ```
56
+
57
+ **Validation Requirements**:
58
+ - All sources must be documented with unique `source_id` entries.
59
+ - Citations must be present in both CSVs (format warnings are advisory).
60
+ - Confidence levels should be filled for evidence entries.
61
+ - Research review cannot proceed if validation reports blocking errors.
62
+
63
+ ## Outline
64
+
65
+ 1. Run `{SCRIPT}` from repo root; capture `FEATURE_DIR`, `AVAILABLE_DOCS`, and `tasks.md` path.
66
+
67
+ 2. Determine the review target:
68
+ - If user input specifies a filename, validate it exists under `tasks/` (flat structure, check `lane: "for_review"` in frontmatter).
69
+ - Otherwise, select the oldest file in `tasks/` (lexical order is sufficient because filenames retain task ordering).
70
+ - Abort with instructional message if no files are waiting for review.
71
+
72
+ 3. Load context for the selected task:
73
+ - Read the prompt file frontmatter (lane MUST be `for_review`); note `task_id`, `phase`, `agent`, `shell_pid`.
74
+ - Read the body sections (Objective, Context, Implementation Guidance, etc.).
75
+ - Consult supporting documents as referenced: constitution, plan, spec, data-model, research, quickstart, code changes.
76
+ - Review the associated code in the repository (diffs, tests, docs) to validate the implementation.
77
+
78
+ 4. Conduct the review:
79
+ - Verify implementation against the prompt’s Definition of Done and Review Guidance.
80
+ - Run required tests or commands; capture results.
81
+ - Document findings explicitly: bugs, regressions, missing tests, risks, or validation notes.
82
+
83
+ 5. Decide outcome:
84
+ - **Needs changes**:
85
+ * Append a new entry in the prompt’s **Activity Log** detailing feedback (include timestamp, reviewer agent, shell PID).
86
+ * Update frontmatter `lane` back to `planned`, clear `assignee` if necessary, keep history entry.
87
+ * Add/revise a `## Review Feedback` section (create if missing) summarizing action items.
88
+ * Run `spec-kitty agent tasks move-task <FEATURE> <TASK_ID> planned --note "Returned for changes"` (use the PowerShell equivalent on Windows) so the move and history update are staged consistently.
89
+ - **Approved**:
90
+ * Append Activity Log entry capturing approval details (capture shell PID via `echo $$` or helper script).
91
+ * Update frontmatter: set `lane=done`, set reviewer metadata (`agent`, `shell_pid`), optional `assignee` for approver.
92
+ * Use helper script to mark the task complete in `tasks.md` (see Step 6).
93
+ * Run `spec-kitty agent tasks move-task <FEATURE> <TASK_ID> done --note "Approved for release"` (PowerShell variant available) to transition the prompt into `tasks/`.
94
+
95
+ 6. Update `tasks.md` automatically:
96
+ - Run `spec-kitty agent tasks mark-status --task-id <TASK_ID> --status done` (POSIX) or `spec-kitty agent tasks mark-status --task-id <TASK_ID> --status done` (PowerShell) from repo root.
97
+ - Confirm the task entry now shows `[X]` and includes a reference to the prompt file in its notes.
98
+
99
+ 7. Produce a review report summarizing:
100
+ - Task ID and filename reviewed.
101
+ - Approval status and key findings.
102
+ - Tests executed and their results.
103
+ - Follow-up actions (if any) for other team members.
104
+ - Reminder to push changes or notify teammates as per project conventions.
105
+
106
+ Context for review: {ARGS}
107
+
108
+ All review feedback must live inside the prompt file, ensuring future implementers understand historical decisions before revisiting the task.
109
+
110
+ ## Citation Validation (Research Mission Specific)
111
+
112
+ Before reviewing research tasks, validate all citations and sources:
113
+
114
+ ```python
115
+ from pathlib import Path
116
+ from specify_cli.validators.research import validate_citations, validate_source_register
117
+
118
+ # Validate evidence log
119
+ evidence_log = FEATURE_DIR / "research" / "evidence-log.csv"
120
+ if evidence_log.exists():
121
+ result = validate_citations(evidence_log)
122
+ if result.has_errors:
123
+ print(result.format_report())
124
+ print("\nERROR: Citation validation failed. Fix errors before proceeding.")
125
+ exit(1)
126
+ elif result.warning_count > 0:
127
+ print(result.format_report())
128
+ print("\nWarnings found - consider addressing for better citation quality.")
129
+
130
+ # Validate source register
131
+ source_register = FEATURE_DIR / "research" / "source-register.csv"
132
+ if source_register.exists():
133
+ result = validate_source_register(source_register)
134
+ if result.has_errors:
135
+ print(result.format_report())
136
+ print("\nERROR: Source register validation failed.")
137
+ exit(1)
138
+ ```
139
+
140
+ **Validation Requirements**:
141
+ - All sources must be documented with unique `source_id` entries.
142
+ - Citations must be present in both CSVs (format warnings are advisory).
143
+ - Confidence levels should be filled for evidence entries.
144
+ - Research review cannot proceed if validation reports blocking errors.