@cognite/cli 0.5.2 → 0.6.0-alpha.26

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 (54) hide show
  1. package/README.md +94 -33
  2. package/_templates/app/new/config/eslint.config.mjs.ejs.t +99 -0
  3. package/_templates/app/new/config/tsconfig.json.ejs.t +35 -0
  4. package/_templates/app/new/config/tsconfig.node.json.ejs.t +27 -0
  5. package/_templates/app/new/config/vite.config.ts.ejs.t +28 -0
  6. package/_templates/app/new/config/vitest.config.ts.ejs.t +14 -0
  7. package/_templates/app/new/config/vitest.setup.ts.ejs.t +4 -0
  8. package/_templates/app/new/github/ci.yml.ejs.t +36 -0
  9. package/_templates/app/new/prompt.js +49 -0
  10. package/_templates/app/new/root/.npmrc.ejs.t +4 -0
  11. package/_templates/app/new/root/AGENTS.md.ejs.t +215 -0
  12. package/_templates/app/new/root/SPEC.md.ejs.t +77 -0
  13. package/_templates/app/new/root/app.json.ejs.t +20 -0
  14. package/_templates/app/new/root/gitignore.ejs.t +21 -0
  15. package/_templates/app/new/root/index.html.ejs.t +36 -0
  16. package/_templates/app/new/root/manifest.json.ejs.t +9 -0
  17. package/_templates/app/new/root/package.json.ejs.t +65 -0
  18. package/_templates/app/new/src/App.test.tsx.ejs.t +45 -0
  19. package/_templates/app/new/src/App.tsx.ejs.t +234 -0
  20. package/_templates/app/new/src/lib/utils.ts.ejs.t +9 -0
  21. package/_templates/app/new/src/main.tsx.ejs.t +27 -0
  22. package/_templates/app/new/src/styles.css.ejs.t +12 -0
  23. package/_vendor/spec-kit/.version +4 -0
  24. package/_vendor/spec-kit/README.md +39 -0
  25. package/_vendor/spec-kit/commands/speckit.analyze.md +249 -0
  26. package/_vendor/spec-kit/commands/speckit.checklist.md +361 -0
  27. package/_vendor/spec-kit/commands/speckit.clarify.md +247 -0
  28. package/_vendor/spec-kit/commands/speckit.implement.md +198 -0
  29. package/_vendor/spec-kit/commands/speckit.plan.md +149 -0
  30. package/_vendor/spec-kit/commands/speckit.specify.md +327 -0
  31. package/_vendor/spec-kit/commands/speckit.tasks.md +200 -0
  32. package/_vendor/spec-kit/scripts/bash/check-prerequisites.sh +190 -0
  33. package/_vendor/spec-kit/scripts/bash/common.sh +645 -0
  34. package/_vendor/spec-kit/scripts/bash/setup-plan.sh +75 -0
  35. package/_vendor/spec-kit/templates/checklist-template.md +40 -0
  36. package/_vendor/spec-kit/templates/plan-template.md +104 -0
  37. package/_vendor/spec-kit/templates/spec-template.md +128 -0
  38. package/_vendor/spec-kit/templates/tasks-template.md +251 -0
  39. package/dist/chunk-6IFTGM5Y.js +6 -0
  40. package/dist/chunk-6JBK3X6U.js +2 -0
  41. package/dist/chunk-7BIIU2MQ.js +8 -0
  42. package/dist/chunk-CQ5OFVL5.js +2 -0
  43. package/dist/chunk-F3TJC2SP.js +2 -0
  44. package/dist/cli/cli.js +350 -0
  45. package/dist/esm-OFTP7G2W.js +34 -0
  46. package/dist/getMachineId-bsd-3GB6MPGO.js +2 -0
  47. package/dist/getMachineId-darwin-4AJ74CH4.js +3 -0
  48. package/dist/getMachineId-linux-IEUC3AW3.js +2 -0
  49. package/dist/getMachineId-unsupported-YOCUE26C.js +2 -0
  50. package/dist/getMachineId-win-DDKCA2D6.js +2 -0
  51. package/dist/skills-R7PLBJFQ.js +2 -0
  52. package/package.json +26 -17
  53. package/index.js +0 -116
  54. package/operations.js +0 -113
@@ -0,0 +1,327 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ handoffs:
4
+ - label: Build Technical Plan
5
+ agent: speckit.plan
6
+ prompt: Create a plan for the spec. I am building with...
7
+ - label: Clarify Spec Requirements
8
+ agent: speckit.clarify
9
+ prompt: Clarify specification requirements
10
+ send: true
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
+ ## Pre-Execution Checks
22
+
23
+ **Check for extension hooks (before specification)**:
24
+ - Check if `.specify/extensions.yml` exists in the project root.
25
+ - If it exists, read it and look for entries under the `hooks.before_specify` key
26
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
27
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
28
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
29
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
30
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
31
+ - For each executable hook, output the following based on its `optional` flag:
32
+ - **Optional hook** (`optional: true`):
33
+ ```
34
+ ## Extension Hooks
35
+
36
+ **Optional Pre-Hook**: {extension}
37
+ Command: `/{command}`
38
+ Description: {description}
39
+
40
+ Prompt: {prompt}
41
+ To execute: `/{command}`
42
+ ```
43
+ - **Mandatory hook** (`optional: false`):
44
+ ```
45
+ ## Extension Hooks
46
+
47
+ **Automatic Pre-Hook**: {extension}
48
+ Executing: `/{command}`
49
+ EXECUTE_COMMAND: {command}
50
+
51
+ Wait for the result of the hook command before proceeding to the Outline.
52
+ ```
53
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
54
+
55
+ ## Outline
56
+
57
+ The text the user typed after `/speckit.specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `$ARGUMENTS` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
58
+
59
+ Given that feature description, do this:
60
+
61
+ 1. **Generate a concise short name** (2-4 words) for the feature:
62
+ - Analyze the feature description and extract the most meaningful keywords
63
+ - Create a 2-4 word short name that captures the essence of the feature
64
+ - Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
65
+ - Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
66
+ - Keep it concise but descriptive enough to understand the feature at a glance
67
+ - Examples:
68
+ - "I want to add user authentication" → "user-auth"
69
+ - "Implement OAuth2 integration for the API" → "oauth2-api-integration"
70
+ - "Create a dashboard for analytics" → "analytics-dashboard"
71
+ - "Fix payment processing timeout bug" → "fix-payment-timeout"
72
+
73
+ 2. **Branch creation** (optional, via hook):
74
+
75
+ If a `before_specify` hook ran successfully in the Pre-Execution Checks above, it will have created/switched to a git branch and output JSON containing `BRANCH_NAME` and `FEATURE_NUM`. Note these values for reference, but the branch name does **not** dictate the spec directory name.
76
+
77
+ If the user explicitly provided `GIT_BRANCH_NAME`, pass it through to the hook so the branch script uses the exact value as the branch name (bypassing all prefix/suffix generation).
78
+
79
+ 3. **Create the spec feature directory**:
80
+
81
+ Specs live under the default `specs/` directory unless the user explicitly provides `SPECIFY_FEATURE_DIRECTORY`.
82
+
83
+ **Resolution order for `SPECIFY_FEATURE_DIRECTORY`**:
84
+ 1. If the user explicitly provided `SPECIFY_FEATURE_DIRECTORY` (e.g., via environment variable, argument, or configuration), use it as-is
85
+ 2. Otherwise, auto-generate it under `specs/`:
86
+ - Check `.specify/init-options.json` for `branch_numbering`
87
+ - If `"timestamp"`: prefix is `YYYYMMDD-HHMMSS` (current timestamp)
88
+ - If `"sequential"` or absent: prefix is `NNN` (next available 3-digit number after scanning existing directories in `specs/`)
89
+ - Construct the directory name: `<prefix>-<short-name>` (e.g., `003-user-auth` or `20260319-143022-user-auth`)
90
+ - Set `SPECIFY_FEATURE_DIRECTORY` to `specs/<directory-name>`
91
+
92
+ **Create the directory and spec file**:
93
+ - `mkdir -p SPECIFY_FEATURE_DIRECTORY`
94
+ - Copy `.specify/templates/spec-template.md` to `SPECIFY_FEATURE_DIRECTORY/spec.md` as the starting point
95
+ - Set `SPEC_FILE` to `SPECIFY_FEATURE_DIRECTORY/spec.md`
96
+ - Persist the resolved path to `.specify/feature.json`:
97
+ ```json
98
+ {
99
+ "feature_directory": "<resolved feature dir>"
100
+ }
101
+ ```
102
+ Write the actual resolved directory path value (for example, `specs/003-user-auth`), not the literal string `SPECIFY_FEATURE_DIRECTORY`.
103
+ This allows downstream commands (`/speckit.plan`, `/speckit.tasks`, etc.) to locate the feature directory without relying on git branch name conventions.
104
+
105
+ **IMPORTANT**:
106
+ - You must only create one feature per `/speckit.specify` invocation
107
+ - The spec directory name and the git branch name are independent — they may be the same but that is the user's choice
108
+ - The spec directory and file are always created by this command, never by the hook
109
+
110
+ 4. Load `.specify/templates/spec-template.md` to understand required sections.
111
+
112
+ 5. Follow this execution flow:
113
+ 1. Parse user description from arguments
114
+ If empty: ERROR "No feature description provided"
115
+ 2. Extract key concepts from description
116
+ Identify: actors, actions, data, constraints
117
+ 3. For unclear aspects:
118
+ - Make informed guesses based on context and industry standards
119
+ - Only mark with [NEEDS CLARIFICATION: specific question] if:
120
+ - The choice significantly impacts feature scope or user experience
121
+ - Multiple reasonable interpretations exist with different implications
122
+ - No reasonable default exists
123
+ - **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
124
+ - Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
125
+ 4. Fill User Scenarios & Testing section
126
+ If no clear user flow: ERROR "Cannot determine user scenarios"
127
+ 5. Generate Functional Requirements
128
+ Each requirement must be testable
129
+ Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
130
+ 6. Define Success Criteria
131
+ Create measurable, technology-agnostic outcomes
132
+ Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
133
+ Each criterion must be verifiable without implementation details
134
+ 7. Identify Key Entities (if data involved)
135
+ 8. Return: SUCCESS (spec ready for planning)
136
+
137
+ 6. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
138
+
139
+ 7. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
140
+
141
+ a. **Create Spec Quality Checklist**: Generate a checklist file at `SPECIFY_FEATURE_DIRECTORY/checklists/requirements.md` using the checklist template structure with these validation items:
142
+
143
+ ```markdown
144
+ # Specification Quality Checklist: [FEATURE NAME]
145
+
146
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
147
+ **Created**: [DATE]
148
+ **Feature**: [Link to spec.md]
149
+
150
+ ## Content Quality
151
+
152
+ - [ ] No implementation details (languages, frameworks, APIs)
153
+ - [ ] Focused on user value and business needs
154
+ - [ ] Written for non-technical stakeholders
155
+ - [ ] All mandatory sections completed
156
+
157
+ ## Requirement Completeness
158
+
159
+ - [ ] No [NEEDS CLARIFICATION] markers remain
160
+ - [ ] Requirements are testable and unambiguous
161
+ - [ ] Success criteria are measurable
162
+ - [ ] Success criteria are technology-agnostic (no implementation details)
163
+ - [ ] All acceptance scenarios are defined
164
+ - [ ] Edge cases are identified
165
+ - [ ] Scope is clearly bounded
166
+ - [ ] Dependencies and assumptions identified
167
+
168
+ ## Feature Readiness
169
+
170
+ - [ ] All functional requirements have clear acceptance criteria
171
+ - [ ] User scenarios cover primary flows
172
+ - [ ] Feature meets measurable outcomes defined in Success Criteria
173
+ - [ ] No implementation details leak into specification
174
+
175
+ ## Notes
176
+
177
+ - Items marked incomplete require spec updates before `/speckit.clarify` or `/speckit.plan`
178
+ ```
179
+
180
+ b. **Run Validation Check**: Review the spec against each checklist item:
181
+ - For each item, determine if it passes or fails
182
+ - Document specific issues found (quote relevant spec sections)
183
+
184
+ c. **Handle Validation Results**:
185
+
186
+ - **If all items pass**: Mark checklist complete and proceed to step 7
187
+
188
+ - **If items fail (excluding [NEEDS CLARIFICATION])**:
189
+ 1. List the failing items and specific issues
190
+ 2. Update the spec to address each issue
191
+ 3. Re-run validation until all items pass (max 3 iterations)
192
+ 4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
193
+
194
+ - **If [NEEDS CLARIFICATION] markers remain**:
195
+ 1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
196
+ 2. **LIMIT CHECK**: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
197
+ 3. For each clarification needed (max 3), present options to user in this format:
198
+
199
+ ```markdown
200
+ ## Question [N]: [Topic]
201
+
202
+ **Context**: [Quote relevant spec section]
203
+
204
+ **What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
205
+
206
+ **Suggested Answers**:
207
+
208
+ | Option | Answer | Implications |
209
+ |--------|--------|--------------|
210
+ | A | [First suggested answer] | [What this means for the feature] |
211
+ | B | [Second suggested answer] | [What this means for the feature] |
212
+ | C | [Third suggested answer] | [What this means for the feature] |
213
+ | Custom | Provide your own answer | [Explain how to provide custom input] |
214
+
215
+ **Your choice**: _[Wait for user response]_
216
+ ```
217
+
218
+ 4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
219
+ - Use consistent spacing with pipes aligned
220
+ - Each cell should have spaces around content: `| Content |` not `|Content|`
221
+ - Header separator must have at least 3 dashes: `|--------|`
222
+ - Test that the table renders correctly in markdown preview
223
+ 5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
224
+ 6. Present all questions together before waiting for responses
225
+ 7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
226
+ 8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
227
+ 9. Re-run validation after all clarifications are resolved
228
+
229
+ d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
230
+
231
+ 8. **Report completion** to the user with:
232
+ - `SPECIFY_FEATURE_DIRECTORY` — the feature directory path
233
+ - `SPEC_FILE` — the spec file path
234
+ - Checklist results summary
235
+ - Readiness for the next phase (`/speckit.clarify` or `/speckit.plan`)
236
+
237
+ 9. **Check for extension hooks**: After reporting completion, check if `.specify/extensions.yml` exists in the project root.
238
+ - If it exists, read it and look for entries under the `hooks.after_specify` key
239
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
240
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
241
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
242
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
243
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
244
+ - For each executable hook, output the following based on its `optional` flag:
245
+ - **Optional hook** (`optional: true`):
246
+ ```
247
+ ## Extension Hooks
248
+
249
+ **Optional Hook**: {extension}
250
+ Command: `/{command}`
251
+ Description: {description}
252
+
253
+ Prompt: {prompt}
254
+ To execute: `/{command}`
255
+ ```
256
+ - **Mandatory hook** (`optional: false`):
257
+ ```
258
+ ## Extension Hooks
259
+
260
+ **Automatic Hook**: {extension}
261
+ Executing: `/{command}`
262
+ EXECUTE_COMMAND: {command}
263
+ ```
264
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
265
+
266
+ **NOTE:** Branch creation is handled by the `before_specify` hook (git extension). Spec directory and file creation are always handled by this core command.
267
+
268
+ ## Quick Guidelines
269
+
270
+ - Focus on **WHAT** users need and **WHY**.
271
+ - Avoid HOW to implement (no tech stack, APIs, code structure).
272
+ - Written for business stakeholders, not developers.
273
+ - DO NOT create any checklists that are embedded in the spec. That will be a separate command.
274
+
275
+ ### Section Requirements
276
+
277
+ - **Mandatory sections**: Must be completed for every feature
278
+ - **Optional sections**: Include only when relevant to the feature
279
+ - When a section doesn't apply, remove it entirely (don't leave as "N/A")
280
+
281
+ ### For AI Generation
282
+
283
+ When creating this spec from a user prompt:
284
+
285
+ 1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
286
+ 2. **Document assumptions**: Record reasonable defaults in the Assumptions section
287
+ 3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
288
+ - Significantly impact feature scope or user experience
289
+ - Have multiple reasonable interpretations with different implications
290
+ - Lack any reasonable default
291
+ 4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
292
+ 5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
293
+ 6. **Common areas needing clarification** (only if no reasonable default exists):
294
+ - Feature scope and boundaries (include/exclude specific use cases)
295
+ - User types and permissions (if multiple conflicting interpretations possible)
296
+ - Security/compliance requirements (when legally/financially significant)
297
+
298
+ **Examples of reasonable defaults** (don't ask about these):
299
+
300
+ - Data retention: Industry-standard practices for the domain
301
+ - Performance targets: Standard web/mobile app expectations unless specified
302
+ - Error handling: User-friendly messages with appropriate fallbacks
303
+ - Authentication method: Standard session-based or OAuth2 for web apps
304
+ - Integration patterns: Use project-appropriate patterns (REST/GraphQL for web services, function calls for libraries, CLI args for tools, etc.)
305
+
306
+ ### Success Criteria Guidelines
307
+
308
+ Success criteria must be:
309
+
310
+ 1. **Measurable**: Include specific metrics (time, percentage, count, rate)
311
+ 2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
312
+ 3. **User-focused**: Describe outcomes from user/business perspective, not system internals
313
+ 4. **Verifiable**: Can be tested/validated without knowing implementation details
314
+
315
+ **Good examples**:
316
+
317
+ - "Users can complete checkout in under 3 minutes"
318
+ - "System supports 10,000 concurrent users"
319
+ - "95% of searches return results in under 1 second"
320
+ - "Task completion rate improves by 40%"
321
+
322
+ **Bad examples** (implementation-focused):
323
+
324
+ - "API response time is under 200ms" (too technical, use "Users see results instantly")
325
+ - "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
326
+ - "React components render efficiently" (framework-specific)
327
+ - "Redis cache hit rate above 80%" (technology-specific)
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ handoffs:
4
+ - label: Analyze For Consistency
5
+ agent: speckit.analyze
6
+ prompt: Run a project analysis for consistency
7
+ send: true
8
+ - label: Implement Project
9
+ agent: speckit.implement
10
+ prompt: Start the implementation in phases
11
+ send: true
12
+ ---
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ ## Pre-Execution Checks
23
+
24
+ **Check for extension hooks (before tasks generation)**:
25
+ - Check if `.specify/extensions.yml` exists in the project root.
26
+ - If it exists, read it and look for entries under the `hooks.before_tasks` key
27
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
28
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
29
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
30
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
31
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
32
+ - For each executable hook, output the following based on its `optional` flag:
33
+ - **Optional hook** (`optional: true`):
34
+ ```
35
+ ## Extension Hooks
36
+
37
+ **Optional Pre-Hook**: {extension}
38
+ Command: `/{command}`
39
+ Description: {description}
40
+
41
+ Prompt: {prompt}
42
+ To execute: `/{command}`
43
+ ```
44
+ - **Mandatory hook** (`optional: false`):
45
+ ```
46
+ ## Extension Hooks
47
+
48
+ **Automatic Pre-Hook**: {extension}
49
+ Executing: `/{command}`
50
+ EXECUTE_COMMAND: {command}
51
+
52
+ Wait for the result of the hook command before proceeding to the Outline.
53
+ ```
54
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
55
+
56
+ ## Outline
57
+
58
+ 1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
59
+
60
+ 2. **Load design documents**: Read from FEATURE_DIR:
61
+ - **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
62
+ - **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
63
+ - Note: Not all projects have all documents. Generate tasks based on what's available.
64
+
65
+ 3. **Execute task generation workflow**:
66
+ - Load plan.md and extract tech stack, libraries, project structure
67
+ - Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
68
+ - If data-model.md exists: Extract entities and map to user stories
69
+ - If contracts/ exists: Map interface contracts to user stories
70
+ - If research.md exists: Extract decisions for setup tasks
71
+ - Generate tasks organized by user story (see Task Generation Rules below)
72
+ - Generate dependency graph showing user story completion order
73
+ - Create parallel execution examples per user story
74
+ - Validate task completeness (each user story has all needed tasks, independently testable)
75
+
76
+ 4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
77
+ - Correct feature name from plan.md
78
+ - Phase 1: Setup tasks (project initialization)
79
+ - Phase 2: Foundational tasks (blocking prerequisites for all user stories)
80
+ - Phase 3+: One phase per user story (in priority order from spec.md)
81
+ - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
82
+ - Final Phase: Polish & cross-cutting concerns
83
+ - All tasks must follow the strict checklist format (see Task Generation Rules below)
84
+ - Clear file paths for each task
85
+ - Dependencies section showing story completion order
86
+ - Parallel execution examples per story
87
+ - Implementation strategy section (MVP first, incremental delivery)
88
+
89
+ 5. **Report**: Output path to generated tasks.md and summary:
90
+ - Total task count
91
+ - Task count per user story
92
+ - Parallel opportunities identified
93
+ - Independent test criteria for each story
94
+ - Suggested MVP scope (typically just User Story 1)
95
+ - Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
96
+
97
+ 6. **Check for extension hooks**: After tasks.md is generated, check if `.specify/extensions.yml` exists in the project root.
98
+ - If it exists, read it and look for entries under the `hooks.after_tasks` key
99
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
100
+ - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
101
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
102
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
103
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
104
+ - For each executable hook, output the following based on its `optional` flag:
105
+ - **Optional hook** (`optional: true`):
106
+ ```
107
+ ## Extension Hooks
108
+
109
+ **Optional Hook**: {extension}
110
+ Command: `/{command}`
111
+ Description: {description}
112
+
113
+ Prompt: {prompt}
114
+ To execute: `/{command}`
115
+ ```
116
+ - **Mandatory hook** (`optional: false`):
117
+ ```
118
+ ## Extension Hooks
119
+
120
+ **Automatic Hook**: {extension}
121
+ Executing: `/{command}`
122
+ EXECUTE_COMMAND: {command}
123
+ ```
124
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
125
+
126
+ Context for task generation: $ARGUMENTS
127
+
128
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
129
+
130
+ ## Task Generation Rules
131
+
132
+ **CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
133
+
134
+ **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
135
+
136
+ ### Checklist Format (REQUIRED)
137
+
138
+ Every task MUST strictly follow this format:
139
+
140
+ ```text
141
+ - [ ] [TaskID] [P?] [Story?] Description with file path
142
+ ```
143
+
144
+ **Format Components**:
145
+
146
+ 1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
147
+ 2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
148
+ 3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
149
+ 4. **[Story] label**: REQUIRED for user story phase tasks only
150
+ - Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
151
+ - Setup phase: NO story label
152
+ - Foundational phase: NO story label
153
+ - User Story phases: MUST have story label
154
+ - Polish phase: NO story label
155
+ 5. **Description**: Clear action with exact file path
156
+
157
+ **Examples**:
158
+
159
+ - ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
160
+ - ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
161
+ - ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
162
+ - ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
163
+ - ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
164
+ - ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
165
+ - ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
166
+ - ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
167
+
168
+ ### Task Organization
169
+
170
+ 1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
171
+ - Each user story (P1, P2, P3...) gets its own phase
172
+ - Map all related components to their story:
173
+ - Models needed for that story
174
+ - Services needed for that story
175
+ - Interfaces/UI needed for that story
176
+ - If tests requested: Tests specific to that story
177
+ - Mark story dependencies (most stories should be independent)
178
+
179
+ 2. **From Contracts**:
180
+ - Map each interface contract → to the user story it serves
181
+ - If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
182
+
183
+ 3. **From Data Model**:
184
+ - Map each entity to the user story(ies) that need it
185
+ - If entity serves multiple stories: Put in earliest story or Setup phase
186
+ - Relationships → service layer tasks in appropriate story phase
187
+
188
+ 4. **From Setup/Infrastructure**:
189
+ - Shared infrastructure → Setup phase (Phase 1)
190
+ - Foundational/blocking tasks → Foundational phase (Phase 2)
191
+ - Story-specific setup → within that story's phase
192
+
193
+ ### Phase Structure
194
+
195
+ - **Phase 1**: Setup (project initialization)
196
+ - **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
197
+ - **Phase 3+**: User Stories in priority order (P1, P2, P3...)
198
+ - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
199
+ - Each phase should be a complete, independently testable increment
200
+ - **Final Phase**: Polish & Cross-Cutting Concerns