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,224 @@
1
+ ---
2
+ description: Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
3
+ scripts:
4
+ sh: spec-kitty agent check-prerequisites --json --paths-only
5
+ ps: spec-kitty agent -Json -PathsOnly
6
+ ---
7
+ **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.
8
+
9
+
10
+ *Path: [templates/commands/clarify.md](templates/commands/clarify.md)*
11
+
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ---
22
+
23
+ ## Location Pre-flight Check
24
+
25
+ **BEFORE PROCEEDING:** Verify you are working in the feature worktree.
26
+
27
+ ```bash
28
+ pwd
29
+ git branch --show-current
30
+ ```
31
+
32
+ **Expected output:**
33
+ - `pwd`: Should end with `.worktrees/001-feature-name` (or similar feature worktree)
34
+ - Branch: Should show your feature branch name like `001-feature-name` (NOT `main`)
35
+
36
+ **If you see the main branch or main repository path:**
37
+
38
+ ⛔ **STOP - You are in the wrong location!**
39
+
40
+ This command updates your feature's spec.md file. You must be in the feature worktree to ensure changes go to the correct location.
41
+
42
+ **Correct the issue:**
43
+ 1. Navigate to your feature worktree: `cd .worktrees/001-feature-name`
44
+ 2. Verify you're on the correct feature branch: `git branch --show-current`
45
+ 3. Then run this clarify command again
46
+
47
+ ---
48
+
49
+ ## What You Have Available
50
+
51
+ After running `{SCRIPT}`, you will have paths to:
52
+ - **FEATURE_DIR**: Absolute path to your feature directory (kitty-specs/001-feature-name/)
53
+ - **FEATURE_SPEC**: Absolute path to spec.md (the file you'll be clarifying)
54
+
55
+ You may also have:
56
+ - **plan.md**: If planning has started (optional)
57
+ - **tasks.md**: If task breakdown exists (optional)
58
+
59
+ ---
60
+
61
+ ## Workflow Context
62
+
63
+ **Before this**: `/spec-kitty.specify` created spec.md (your starting requirements)
64
+
65
+ **This command**:
66
+ - Identifies ambiguities and gaps in your spec
67
+ - Asks clarification questions (max 5)
68
+ - Updates spec.md with clarifications directly
69
+ - Reduces downstream rework risk
70
+
71
+ **After this**:
72
+ - Review clarified spec
73
+ - Run `/spec-kitty.plan` to create implementation plan
74
+ - Or run `/spec-kitty.clarify` again if more questions arise post-planning
75
+
76
+ This command is optional but recommended before planning to reduce rework.
77
+
78
+ ---
79
+
80
+ ## Outline
81
+
82
+ Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
83
+
84
+ Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/spec-kitty.plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
85
+
86
+ Execution steps:
87
+
88
+ 1. Run `{SCRIPT}` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
89
+ - `FEATURE_DIR`
90
+ - `FEATURE_SPEC`
91
+ - (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
92
+ - If JSON parsing fails, abort and instruct user to re-run `/spec-kitty.specify` or verify feature branch environment.
93
+
94
+ 2. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
95
+
96
+ Functional Scope & Behavior:
97
+ - Core user goals & success criteria
98
+ - Explicit out-of-scope declarations
99
+ - User roles / personas differentiation
100
+
101
+ Domain & Data Model:
102
+ - Entities, attributes, relationships
103
+ - Identity & uniqueness rules
104
+ - Lifecycle/state transitions
105
+ - Data volume / scale assumptions
106
+
107
+ Interaction & UX Flow:
108
+ - Critical user journeys / sequences
109
+ - Error/empty/loading states
110
+ - Accessibility or localization notes
111
+
112
+ Non-Functional Quality Attributes:
113
+ - Performance (latency, throughput targets)
114
+ - Scalability (horizontal/vertical, limits)
115
+ - Reliability & availability (uptime, recovery expectations)
116
+ - Observability (logging, metrics, tracing signals)
117
+ - Security & privacy (authN/Z, data protection, threat assumptions)
118
+ - Compliance / regulatory constraints (if any)
119
+
120
+ Integration & External Dependencies:
121
+ - External services/APIs and failure modes
122
+ - Data import/export formats
123
+ - Protocol/versioning assumptions
124
+
125
+ Edge Cases & Failure Handling:
126
+ - Negative scenarios
127
+ - Rate limiting / throttling
128
+ - Conflict resolution (e.g., concurrent edits)
129
+
130
+ Constraints & Tradeoffs:
131
+ - Technical constraints (language, storage, hosting)
132
+ - Explicit tradeoffs or rejected alternatives
133
+
134
+ Terminology & Consistency:
135
+ - Canonical glossary terms
136
+ - Avoided synonyms / deprecated terms
137
+
138
+ Completion Signals:
139
+ - Acceptance criteria testability
140
+ - Measurable Definition of Done style indicators
141
+
142
+ Misc / Placeholders:
143
+ - TODO markers / unresolved decisions
144
+ - Ambiguous adjectives ("robust", "intuitive") lacking quantification
145
+
146
+ For each category with Partial or Missing status, add a candidate question opportunity unless:
147
+ - Clarification would not materially change implementation or validation strategy
148
+ - Information is better deferred to planning phase (note internally)
149
+
150
+ 3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
151
+ - Maximum of 10 total questions across the whole session.
152
+ - Each question must be answerable with EITHER:
153
+ * A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR
154
+ * A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words").
155
+ - Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
156
+ - Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
157
+ - Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
158
+ - Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
159
+ - Scale thoroughness to the feature’s complexity: a lightweight enhancement may only need one or two confirmations, while multi-system efforts warrant the full question budget if gaps remain critical.
160
+ - If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
161
+
162
+ 4. Sequential questioning loop (interactive):
163
+ - Present EXACTLY ONE question at a time.
164
+ - For multiple-choice questions, list options inline using letter prefixes rather than tables, e.g.
165
+ `Options: (A) describe option A · (B) describe option B · (C) describe option C · (D) short custom answer (<=5 words)`
166
+ Ask the user to reply with the letter (or short custom text when offered).
167
+ - For short-answer style (no meaningful discrete options), output a single line after the question: `Format: Short answer (<=5 words)`.
168
+ - After the user answers:
169
+ * Validate the answer maps to one option or fits the <=5 word constraint.
170
+ * If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
171
+ * Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
172
+ - Stop asking further questions when:
173
+ * All critical ambiguities resolved early (remaining queued items become unnecessary), OR
174
+ * User signals completion ("done", "good", "no more"), OR
175
+ * You reach 5 asked questions.
176
+ - Never reveal future queued questions in advance.
177
+ - If no valid questions exist at start, immediately report no critical ambiguities.
178
+
179
+ 5. Integration after EACH accepted answer (incremental update approach):
180
+ - Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
181
+ - For the first integrated answer in this session:
182
+ * Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
183
+ * Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
184
+ - Append a bullet line immediately after acceptance: `- Q: <question> → A: <final answer>`.
185
+ - Then immediately apply the clarification to the most appropriate section(s):
186
+ * Functional ambiguity → Update or add a bullet in Functional Requirements.
187
+ * User interaction / actor distinction → Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
188
+ * Data shape / entities → Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
189
+ * Non-functional constraint → Add/modify measurable criteria in Non-Functional / Quality Attributes section (convert vague adjective to metric or explicit target).
190
+ * Edge case / negative flow → Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
191
+ * Terminology conflict → Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
192
+ - If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
193
+ - Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
194
+ - Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
195
+ - Keep each inserted clarification minimal and testable (avoid narrative drift).
196
+
197
+ 6. Validation (performed after EACH write plus final pass):
198
+ - Clarifications session contains exactly one bullet per accepted answer (no duplicates).
199
+ - Total asked (accepted) questions ≤ 5.
200
+ - Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
201
+ - No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
202
+ - Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
203
+ - Terminology consistency: same canonical term used across all updated sections.
204
+
205
+ 7. Write the updated spec back to `FEATURE_SPEC`.
206
+
207
+ 8. Report completion (after questioning loop ends or early termination):
208
+ - Number of questions asked & answered.
209
+ - Path to updated spec.
210
+ - Sections touched (list names).
211
+ - Coverage summary listing each taxonomy category with a status label (Resolved / Deferred / Clear / Outstanding). Present as plain text or bullet list, not a table.
212
+ - If any Outstanding or Deferred remain, recommend whether to proceed to `/spec-kitty.plan` or run `/spec-kitty.clarify` again later post-plan.
213
+ - Suggested next command.
214
+
215
+ Behavior rules:
216
+ - If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
217
+ - If spec file missing, instruct user to run `/spec-kitty.specify` first (do not create a new spec here).
218
+ - Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
219
+ - Avoid speculative tech stack questions unless the absence blocks functional clarity.
220
+ - Respect user early termination signals ("stop", "done", "proceed").
221
+ - If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
222
+ - If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
223
+
224
+ Context for prioritization: {ARGS}
@@ -0,0 +1,432 @@
1
+ ---
2
+ description: Create or update the project constitution through interactive phase-based discovery.
3
+ ---
4
+ **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.
5
+
6
+ *Path: [templates/commands/constitution.md](templates/commands/constitution.md)*
7
+
8
+ ## User Input
9
+
10
+ ```text
11
+ $ARGUMENTS
12
+ ```
13
+
14
+ You **MUST** consider the user input before proceeding (if not empty).
15
+
16
+ ---
17
+
18
+ ## What This Command Does
19
+
20
+ This command creates or updates the **project constitution** through an interactive, phase-based discovery workflow.
21
+
22
+ **Location**: `.kittify/memory/constitution.md` (project root, not worktrees)
23
+ **Scope**: Project-wide principles that apply to ALL features
24
+
25
+ **Important**: The constitution is OPTIONAL. All spec-kitty commands work without it.
26
+
27
+ **Constitution Purpose**:
28
+ - Capture technical standards (languages, testing, deployment)
29
+ - Document code quality expectations (review process, quality gates)
30
+ - Record tribal knowledge (team conventions, lessons learned)
31
+ - Define governance (how the constitution changes, who enforces it)
32
+
33
+ ---
34
+
35
+ ## Discovery Workflow
36
+
37
+ This command uses a **4-phase discovery process**:
38
+
39
+ 1. **Phase 1: Technical Standards** (Recommended)
40
+ - Languages, frameworks, testing requirements
41
+ - Performance targets, deployment constraints
42
+ - ~3-4 questions, creates a lean foundation
43
+
44
+ 2. **Phase 2: Code Quality** (Optional)
45
+ - PR requirements, review checklist, quality gates
46
+ - Documentation standards
47
+ - ~3-4 questions
48
+
49
+ 3. **Phase 3: Tribal Knowledge** (Optional)
50
+ - Team conventions, lessons learned
51
+ - Historical decisions (optional)
52
+ - ~2-4 questions
53
+
54
+ 4. **Phase 4: Governance** (Optional)
55
+ - Amendment process, compliance validation
56
+ - Exception handling (optional)
57
+ - ~2-3 questions
58
+
59
+ **Paths**:
60
+ - **Minimal** (~1 page): Phase 1 only → ~3-5 questions
61
+ - **Comprehensive** (~2-3 pages): All phases → ~8-12 questions
62
+
63
+ ---
64
+
65
+ ## Execution Outline
66
+
67
+ ### Step 1: Initial Choice
68
+
69
+ Ask the user:
70
+ ```
71
+ Do you want to establish a project constitution?
72
+
73
+ A) No, skip it - I don't need a formal constitution
74
+ B) Yes, minimal - Core technical standards only (~1 page, 3-5 questions)
75
+ C) Yes, comprehensive - Full governance and tribal knowledge (~2-3 pages, 8-12 questions)
76
+ ```
77
+
78
+ Handle responses:
79
+ - **A (Skip)**: Create a minimal placeholder at `.kittify/memory/constitution.md`:
80
+ - Title + short note: "Constitution skipped - not required for spec-kitty usage. Run /spec-kitty.constitution anytime to create one."
81
+ - Exit successfully.
82
+ - **B (Minimal)**: Continue with Phase 1 only.
83
+ - **C (Comprehensive)**: Continue through all phases, asking whether to skip each optional phase.
84
+
85
+ ### Step 2: Phase 1 - Technical Standards
86
+
87
+ Context:
88
+ ```
89
+ Phase 1: Technical Standards
90
+ These are the non-negotiable technical requirements that all features must follow.
91
+ This phase is recommended for all projects.
92
+ ```
93
+
94
+ Ask one question at a time:
95
+
96
+ **Q1: Languages and Frameworks**
97
+ ```
98
+ What languages and frameworks are required for this project?
99
+ Examples:
100
+ - "Python 3.11+ with FastAPI for backend"
101
+ - "TypeScript 4.9+ with React 18 for frontend"
102
+ - "Rust 1.70+ with no external dependencies"
103
+ ```
104
+
105
+ **Q2: Testing Requirements**
106
+ ```
107
+ What testing framework and coverage requirements?
108
+ Examples:
109
+ - "pytest with 80% line coverage, 100% for critical paths"
110
+ - "Jest with 90% coverage, unit + integration tests required"
111
+ - "cargo test, no specific coverage target but all features must have tests"
112
+ ```
113
+
114
+ **Q3: Performance and Scale Targets**
115
+ ```
116
+ What are the performance and scale expectations?
117
+ Examples:
118
+ - "Handle 1000 requests/second at p95 < 200ms"
119
+ - "Support 10k concurrent users, 1M daily active users"
120
+ - "CLI operations complete in < 2 seconds"
121
+ - "N/A - performance not a primary concern"
122
+ ```
123
+
124
+ **Q4: Deployment and Constraints**
125
+ ```
126
+ What are the deployment constraints or platform requirements?
127
+ Examples:
128
+ - "Docker-only, deployed to Kubernetes"
129
+ - "Must run on Ubuntu 20.04 LTS without external dependencies"
130
+ - "Cross-platform: Linux, macOS, Windows 10+"
131
+ - "N/A - no specific deployment constraints"
132
+ ```
133
+
134
+ ### Step 3: Phase 2 - Code Quality (Optional)
135
+
136
+ Ask only if comprehensive path is selected:
137
+ ```
138
+ Phase 2: Code Quality
139
+ Skip this if your team uses standard practices without special requirements.
140
+
141
+ Do you want to define code quality standards?
142
+ A) Yes, ask questions
143
+ B) No, skip this phase (use standard practices)
144
+ ```
145
+
146
+ If yes, ask one at a time:
147
+
148
+ **Q5: PR Requirements**
149
+ ```
150
+ What are the requirements for pull requests?
151
+ Examples:
152
+ - "2 approvals required, 1 must be from core team"
153
+ - "1 approval required, PR must pass CI checks"
154
+ - "Self-merge allowed after CI passes for maintainers"
155
+ ```
156
+
157
+ **Q6: Code Review Checklist**
158
+ ```
159
+ What should reviewers check during code review?
160
+ Examples:
161
+ - "Tests added, docstrings updated, follows PEP 8, no security issues"
162
+ - "Type annotations present, error handling robust, performance considered"
163
+ - "Standard review - correctness, clarity, maintainability"
164
+ ```
165
+
166
+ **Q7: Quality Gates**
167
+ ```
168
+ What quality gates must pass before merging?
169
+ Examples:
170
+ - "All tests pass, coverage ≥80%, linter clean, security scan clean"
171
+ - "Tests pass, type checking passes, manual QA approved"
172
+ - "CI green, no merge conflicts, PR approved"
173
+ ```
174
+
175
+ **Q8: Documentation Standards**
176
+ ```
177
+ What documentation is required?
178
+ Examples:
179
+ - "All public APIs must have docstrings + examples"
180
+ - "README updated for new features, ADRs for architectural decisions"
181
+ - "Inline comments for complex logic, keep docs up to date"
182
+ - "Minimal - code should be self-documenting"
183
+ ```
184
+
185
+ ### Step 4: Phase 3 - Tribal Knowledge (Optional)
186
+
187
+ Ask only if comprehensive path is selected:
188
+ ```
189
+ Phase 3: Tribal Knowledge
190
+ Skip this for new projects or if team conventions are minimal.
191
+
192
+ Do you want to capture tribal knowledge?
193
+ A) Yes, ask questions
194
+ B) No, skip this phase
195
+ ```
196
+
197
+ If yes, ask:
198
+
199
+ **Q9: Team Conventions**
200
+ ```
201
+ What team conventions or coding styles should everyone follow?
202
+ Examples:
203
+ - "Use Result<T, E> for fallible operations, never unwrap() in prod"
204
+ - "Prefer composition over inheritance, keep classes small (<200 lines)"
205
+ - "Use feature flags for gradual rollouts, never merge half-finished features"
206
+ ```
207
+
208
+ **Q10: Lessons Learned**
209
+ ```
210
+ What past mistakes or lessons learned should guide future work?
211
+ Examples:
212
+ - "Always version APIs from day 1"
213
+ - "Write integration tests first"
214
+ - "Keep dependencies minimal - every dependency is a liability"
215
+ - "N/A - no major lessons yet"
216
+ ```
217
+
218
+ Optional follow-up:
219
+ ```
220
+ Do you want to document historical architectural decisions?
221
+ A) Yes
222
+ B) No
223
+ ```
224
+
225
+ **Q11: Historical Decisions** (only if yes)
226
+ ```
227
+ Any historical architectural decisions that should guide future work?
228
+ Examples:
229
+ - "Chose microservices for independent scaling"
230
+ - "Chose monorepo for atomic changes across services"
231
+ - "Chose SQLite for simplicity over PostgreSQL"
232
+ ```
233
+
234
+ ### Step 5: Phase 4 - Governance (Optional)
235
+
236
+ Ask only if comprehensive path is selected:
237
+ ```
238
+ Phase 4: Governance
239
+ Skip this to use simple defaults.
240
+
241
+ Do you want to define governance process?
242
+ A) Yes, ask questions
243
+ B) No, skip this phase (use simple defaults)
244
+ ```
245
+
246
+ If skipped, use defaults:
247
+ - Amendment: Any team member can propose changes via PR
248
+ - Compliance: Team validates during code review
249
+ - Exceptions: Discuss with team, document in PR
250
+
251
+ If yes, ask:
252
+
253
+ **Q12: Amendment Process**
254
+ ```
255
+ How should the constitution be amended?
256
+ Examples:
257
+ - "PR with 2 approvals, announce in team chat, 1 week discussion"
258
+ - "Any maintainer can update via PR"
259
+ - "Quarterly review, team votes on changes"
260
+ ```
261
+
262
+ **Q13: Compliance Validation**
263
+ ```
264
+ Who validates that features comply with the constitution?
265
+ Examples:
266
+ - "Code reviewers check compliance, block merge if violated"
267
+ - "Team lead reviews architecture"
268
+ - "Self-managed - developers responsible"
269
+ ```
270
+
271
+ Optional follow-up:
272
+ ```
273
+ Do you want to define exception handling?
274
+ A) Yes
275
+ B) No
276
+ ```
277
+
278
+ **Q14: Exception Handling** (only if yes)
279
+ ```
280
+ How should exceptions to the constitution be handled?
281
+ Examples:
282
+ - "Document in ADR, require 3 approvals, set sunset date"
283
+ - "Case-by-case discussion, strong justification required"
284
+ - "Exceptions discouraged - update constitution instead"
285
+ ```
286
+
287
+ ### Step 6: Summary and Confirmation
288
+
289
+ Present a summary and ask for confirmation:
290
+ ```
291
+ Constitution Summary
292
+ ====================
293
+
294
+ You've completed [X] phases and answered [Y] questions.
295
+ Here's what will be written to .kittify/memory/constitution.md:
296
+
297
+ Technical Standards:
298
+ - Languages: [Q1]
299
+ - Testing: [Q2]
300
+ - Performance: [Q3]
301
+ - Deployment: [Q4]
302
+
303
+ [If Phase 2 completed]
304
+ Code Quality:
305
+ - PR Requirements: [Q5]
306
+ - Review Checklist: [Q6]
307
+ - Quality Gates: [Q7]
308
+ - Documentation: [Q8]
309
+
310
+ [If Phase 3 completed]
311
+ Tribal Knowledge:
312
+ - Conventions: [Q9]
313
+ - Lessons Learned: [Q10]
314
+ - Historical Decisions: [Q11 if present]
315
+
316
+ Governance: [Custom if Phase 4 completed, otherwise defaults]
317
+
318
+ Estimated length: ~[50-80 lines minimal] or ~[150-200 lines comprehensive]
319
+
320
+ Proceed with writing constitution?
321
+ A) Yes, write it
322
+ B) No, let me start over
323
+ C) Cancel, don't create constitution
324
+ ```
325
+
326
+ Handle responses:
327
+ - **A**: Write the constitution file.
328
+ - **B**: Restart from Step 1.
329
+ - **C**: Exit without writing.
330
+
331
+ ### Step 7: Write Constitution File
332
+
333
+ Generate the constitution as Markdown:
334
+
335
+ ```markdown
336
+ # [PROJECT_NAME] Constitution
337
+
338
+ > Auto-generated by spec-kitty constitution command
339
+ > Created: [YYYY-MM-DD]
340
+ > Version: 1.0.0
341
+
342
+ ## Purpose
343
+
344
+ This constitution captures the technical standards, code quality expectations,
345
+ tribal knowledge, and governance rules for [PROJECT_NAME]. All features and
346
+ pull requests should align with these principles.
347
+
348
+ ## Technical Standards
349
+
350
+ ### Languages and Frameworks
351
+ [Q1]
352
+
353
+ ### Testing Requirements
354
+ [Q2]
355
+
356
+ ### Performance and Scale
357
+ [Q3]
358
+
359
+ ### Deployment and Constraints
360
+ [Q4]
361
+
362
+ [If Phase 2 completed]
363
+ ## Code Quality
364
+
365
+ ### Pull Request Requirements
366
+ [Q5]
367
+
368
+ ### Code Review Checklist
369
+ [Q6]
370
+
371
+ ### Quality Gates
372
+ [Q7]
373
+
374
+ ### Documentation Standards
375
+ [Q8]
376
+
377
+ [If Phase 3 completed]
378
+ ## Tribal Knowledge
379
+
380
+ ### Team Conventions
381
+ [Q9]
382
+
383
+ ### Lessons Learned
384
+ [Q10]
385
+
386
+ [If Q11 present]
387
+ ### Historical Decisions
388
+ [Q11]
389
+
390
+ ## Governance
391
+
392
+ [If Phase 4 completed]
393
+ ### Amendment Process
394
+ [Q12]
395
+
396
+ ### Compliance Validation
397
+ [Q13]
398
+
399
+ [If Q14 present]
400
+ ### Exception Handling
401
+ [Q14]
402
+
403
+ [If Phase 4 skipped, use defaults]
404
+ ### Amendment Process
405
+ Any team member can propose amendments via pull request. Changes are discussed
406
+ and merged following standard PR review process.
407
+
408
+ ### Compliance Validation
409
+ Code reviewers validate compliance during PR review. Constitution violations
410
+ should be flagged and addressed before merge.
411
+
412
+ ### Exception Handling
413
+ Exceptions discussed case-by-case with team. Strong justification required.
414
+ Consider updating constitution if exceptions become common.
415
+ ```
416
+
417
+ ### Step 8: Success Message
418
+
419
+ After writing, provide:
420
+ - Location of the file
421
+ - Phases completed and questions answered
422
+ - Next steps (review, share with team, run /spec-kitty.plan)
423
+
424
+ ---
425
+
426
+ ## Required Behaviors
427
+
428
+ - Ask one question at a time.
429
+ - Offer skip options and explain when to skip.
430
+ - Keep responses concise and user-focused.
431
+ - Ensure the constitution stays lean (1-3 pages, not 10 pages).
432
+ - If user chooses to skip entirely, still create the minimal placeholder file and exit successfully.