( commandsDir: string, specName: string, task: ParsedTask )
| 188 | * Generate a command file for a specific task |
| 189 | */ |
| 190 | export async function generateTaskCommand( |
| 191 | commandsDir: string, |
| 192 | specName: string, |
| 193 | task: ParsedTask |
| 194 | ): Promise<void> { |
| 195 | const fs = await import('fs/promises'); |
| 196 | const pathModule = await import('path'); |
| 197 | |
| 198 | const commandFile = pathModule.join(commandsDir, `task-${task.id}.md`); |
| 199 | |
| 200 | // Determine project path from commandsDir (commandsDir is typically .claude/commands/{specName}) |
| 201 | const projectPath = pathModule.resolve(commandsDir, '../../..'); |
| 202 | |
| 203 | // Load actual content |
| 204 | const steeringContext = loadSteeringContext(projectPath); |
| 205 | const specContext = loadSpecContext(specName, projectPath); |
| 206 | |
| 207 | let content = `# ${specName} - Task ${task.id} |
| 208 | |
| 209 | Execute task ${task.id} for the ${specName} specification. |
| 210 | |
| 211 | ## Task Description |
| 212 | ${task.description} |
| 213 | |
| 214 | `; |
| 215 | |
| 216 | // Add Code Reuse section if leverage info exists |
| 217 | if (task.leverage) { |
| 218 | content += `## Code Reuse |
| 219 | **Leverage existing code**: ${task.leverage} |
| 220 | |
| 221 | `; |
| 222 | } |
| 223 | |
| 224 | // Add Requirements section if requirements exist |
| 225 | if (task.requirements) { |
| 226 | content += `## Requirements Reference |
| 227 | **Requirements**: ${task.requirements} |
| 228 | |
| 229 | `; |
| 230 | } |
| 231 | |
| 232 | content += `## Usage |
| 233 | \`\`\` |
| 234 | /Task:${task.id}-${specName} |
| 235 | \`\`\` |
| 236 | |
| 237 | ## Instructions |
| 238 | |
| 239 | Execute with @spec-task-executor agent the following task: "${task.description}" |
| 240 | |
| 241 | \`\`\` |
| 242 | Use the @spec-task-executor agent to implement task ${task.id}: "${task.description}" for the ${specName} specification and include all the below context. |
| 243 | |
| 244 | # Steering Context |
| 245 | ${steeringContext} |
| 246 | |
| 247 | # Specification Context |
no test coverage detected