@devobsessed/code-captain 0.0.6 → 0.0.8
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.
- package/README.md +1 -10
- package/bin/install.js +178 -182
- package/claude-code/agents/code-captain.md +17 -20
- package/copilot/README.md +26 -16
- package/copilot/chatmodes/Code Captain.chatmode.md +11 -16
- package/copilot/prompts/create-spec.prompt.md +5 -8
- package/copilot/prompts/explain-code.prompt.md +5 -8
- package/copilot/prompts/new-command.prompt.md +60 -21
- package/copilot/prompts/research.prompt.md +5 -8
- package/copilot/prompts/status.prompt.md +13 -2
- package/copilot/prompts/swab.prompt.md +1 -0
- package/cursor/README.md +8 -23
- package/cursor/cc.md +2 -29
- package/cursor/cc.mdc +3 -10
- package/cursor/commands/create-adr.md +1 -1
- package/cursor/commands/create-spec.md +9 -12
- package/cursor/commands/explain-code.md +5 -8
- package/cursor/commands/initialize.md +1 -1
- package/cursor/commands/new-command.md +5 -4
- package/cursor/commands/research.md +6 -9
- package/cursor/commands/status.md +13 -2
- package/cursor/commands/swab.md +61 -2
- package/manifest.json +150 -166
- package/package.json +12 -2
- package/windsurf/workflows/explain-code.md +4 -8
- package/windsurf/workflows/plan-product.md +330 -0
- package/windsurf/workflows/research.md +240 -0
- package/windsurf/workflows/swab.md +212 -0
- package/cursor/integrations/azure-devops/create-azure-work-items.md +0 -403
- package/cursor/integrations/azure-devops/sync-azure-work-items.md +0 -486
- package/cursor/integrations/github/create-github-issues.md +0 -765
- package/cursor/integrations/github/scripts/create-issues-batch.sh +0 -272
- package/cursor/integrations/github/sync-github-issues.md +0 -237
- package/cursor/integrations/github/sync.md +0 -305
|
@@ -1,765 +0,0 @@
|
|
|
1
|
-
# Create GitHub Issues Command (cc: create-github-issues)
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
Automatically create GitHub issues from existing user stories and tasks, establishing parent-child relationships through sub-issues and updating source documents with issue numbers for traceability.
|
|
6
|
-
|
|
7
|
-
**🚨 EXECUTION METHOD:**
|
|
8
|
-
**This command uses a dedicated shell script (`scripts/create-issues-batch.sh`) for reliable issue creation with dynamic rate limiting. The LLM's role is to parse specs and prepare data, then call the script for execution.**
|
|
9
|
-
|
|
10
|
-
## Usage
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
cc: create-github-issues [spec-folder-path]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Examples:**
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
cc: create-github-issues .code-captain/specs/2024-12-28-user-profile-dashboard/
|
|
20
|
-
cc: create-github-issues # Auto-detect latest spec folder
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Command Process
|
|
24
|
-
|
|
25
|
-
**📋 LLM Responsibilities:**
|
|
26
|
-
1. **Parse spec documents** and extract user stories/tasks
|
|
27
|
-
2. **Prepare JSON data files** for script consumption
|
|
28
|
-
3. **Call shell script** for reliable issue creation
|
|
29
|
-
4. **Process results** and update documentation
|
|
30
|
-
5. **Trigger sync** to update local cache
|
|
31
|
-
|
|
32
|
-
**🛠️ Shell Script Handles:**
|
|
33
|
-
- Dynamic rate limiting and batch sizing
|
|
34
|
-
- Parallel issue creation within limits
|
|
35
|
-
- Error handling and retry logic
|
|
36
|
-
- Progress tracking and logging
|
|
37
|
-
|
|
38
|
-
### Step 1: Context Discovery & Validation
|
|
39
|
-
|
|
40
|
-
**Auto-detect spec folder (if no path provided):**
|
|
41
|
-
|
|
42
|
-
- Search `.code-captain/specs/` for most recent dated folder
|
|
43
|
-
- Validate folder contains required files: `user-stories.md` and `tasks.md`
|
|
44
|
-
- Confirm GitHub repository context is available
|
|
45
|
-
|
|
46
|
-
**Validate required files exist:**
|
|
47
|
-
|
|
48
|
-
- `user-stories.md` - Source for main issues
|
|
49
|
-
- `tasks.md` - Source for sub-task issues
|
|
50
|
-
- Optional: `spec.md` for additional context
|
|
51
|
-
|
|
52
|
-
**GitHub CLI and repository validation:**
|
|
53
|
-
|
|
54
|
-
- Verify GitHub CLI is installed using `gh --version`
|
|
55
|
-
- Check if current directory is a git repository using `git remote get-url origin`
|
|
56
|
-
- Extract repository owner/name from remote origin
|
|
57
|
-
- Validate GitHub CLI authentication using `gh auth status`
|
|
58
|
-
- Verify repository access using `gh repo view {owner/repo}`
|
|
59
|
-
|
|
60
|
-
**Ensure required labels exist:**
|
|
61
|
-
|
|
62
|
-
- Create or verify standard labels exist in repository
|
|
63
|
-
- Use `gh label create` with platform-appropriate error handling to handle existing labels gracefully
|
|
64
|
-
- Set up consistent label schema for issue organization
|
|
65
|
-
|
|
66
|
-
### Step 2: Label Management & Setup
|
|
67
|
-
|
|
68
|
-
**Create required labels:**
|
|
69
|
-
|
|
70
|
-
Create all required labels (Code Captain will use platform-appropriate error handling based on your shell from `state.json`):
|
|
71
|
-
- "user-story" (blue #0052cc) - User story issues
|
|
72
|
-
- "feature" (light blue #a2eeef) - New feature
|
|
73
|
-
- "task" (purple #d4c5f9) - Implementation tasks
|
|
74
|
-
- "subtask" (pink #f9c5d4) - Sub-implementation tasks
|
|
75
|
-
- "enhancement" (blue #84b6eb) - Enhancement to existing feature
|
|
76
|
-
- "testing" (yellow #fef2c0) - Testing related work
|
|
77
|
-
|
|
78
|
-
Use `gh label create` commands with appropriate error handling for existing labels.
|
|
79
|
-
|
|
80
|
-
**Verify label creation:**
|
|
81
|
-
- Use `gh label list` to confirm all labels were created successfully
|
|
82
|
-
- Handle any label creation failures gracefully
|
|
83
|
-
- Continue with issue creation only after labels are confirmed
|
|
84
|
-
|
|
85
|
-
### Step 3: Prepare Script Dependencies
|
|
86
|
-
|
|
87
|
-
**Verify batch creation script exists:**
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
SCRIPT_PATH="integrations/github/scripts/create-issues-batch.sh"
|
|
91
|
-
|
|
92
|
-
if [ ! -f "$SCRIPT_PATH" ]; then
|
|
93
|
-
echo "🚨 ERROR: Batch creation script not found at $SCRIPT_PATH"
|
|
94
|
-
exit 1
|
|
95
|
-
fi
|
|
96
|
-
|
|
97
|
-
if [ ! -x "$SCRIPT_PATH" ]; then
|
|
98
|
-
echo "📝 Making script executable..."
|
|
99
|
-
chmod +x "$SCRIPT_PATH"
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
echo "✅ Batch creation script ready: $SCRIPT_PATH"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Create temporary working directory:**
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
TEMP_DIR="/tmp/cc-github-issues-$$"
|
|
109
|
-
Create temporary directory (Code Captain will use platform-appropriate commands based on your shell from `state.json`)
|
|
110
|
-
|
|
111
|
-
echo "📁 Working directory: $TEMP_DIR"
|
|
112
|
-
echo " - user-stories.json (to be created)"
|
|
113
|
-
echo " - tasks.json (to be created)"
|
|
114
|
-
echo " - subtasks.json (to be created)"
|
|
115
|
-
echo " - results/ (for script output)"
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Step 4: Create Todo Tracking
|
|
119
|
-
|
|
120
|
-
**Use `todo_write` to track the complete issue creation process:**
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"todos": [
|
|
125
|
-
{
|
|
126
|
-
"id": "github-setup",
|
|
127
|
-
"content": "Validate GitHub CLI and create required labels",
|
|
128
|
-
"status": "completed"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"id": "github-issues-parse",
|
|
132
|
-
"content": "Parse user stories and tasks from spec documents",
|
|
133
|
-
"status": "in_progress"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"id": "github-issues-create-stories",
|
|
137
|
-
"content": "Create ALL user story issues (no skipping)",
|
|
138
|
-
"status": "pending"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"id": "github-issues-create-tasks",
|
|
142
|
-
"content": "Create ALL main task issues (no skipping)",
|
|
143
|
-
"status": "pending"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"id": "github-issues-create-subtasks",
|
|
147
|
-
"content": "Create ALL subtask issues (no skipping)",
|
|
148
|
-
"status": "pending"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"id": "github-issues-update-docs",
|
|
152
|
-
"content": "Update all spec documents with issue numbers",
|
|
153
|
-
"status": "pending"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"id": "github-issues-verify",
|
|
157
|
-
"content": "Verify all issues created and documents updated",
|
|
158
|
-
"status": "pending"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"id": "github-sync-trigger",
|
|
162
|
-
"content": "Trigger sync to update cache with new issues",
|
|
163
|
-
"status": "pending"
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Enhanced progress tracking:**
|
|
170
|
-
- Track exact counts: "Creating user story 3 of 6: [title]"
|
|
171
|
-
- Mark each individual creation as it completes
|
|
172
|
-
- **No skipping allowed** - all tasks from spec must be created
|
|
173
|
-
- Show percentage completion throughout process
|
|
174
|
-
|
|
175
|
-
### Step 5: Parse Spec Documents
|
|
176
|
-
|
|
177
|
-
**Read and parse user-stories.md:**
|
|
178
|
-
|
|
179
|
-
- Extract each user story with its structure:
|
|
180
|
-
- Title
|
|
181
|
-
- "As a/I want to/So that" format
|
|
182
|
-
- Acceptance criteria list
|
|
183
|
-
- Definition of done checklist
|
|
184
|
-
|
|
185
|
-
**Read and parse tasks.md:**
|
|
186
|
-
|
|
187
|
-
- Extract main tasks and their subtasks
|
|
188
|
-
- Identify task hierarchy (1.0, 1.1, 1.2, etc.)
|
|
189
|
-
- Preserve task descriptions and checkboxes
|
|
190
|
-
|
|
191
|
-
**Create mapping structure:**
|
|
192
|
-
|
|
193
|
-
```javascript
|
|
194
|
-
{
|
|
195
|
-
userStories: [
|
|
196
|
-
{
|
|
197
|
-
title: "Story Title",
|
|
198
|
-
description: "As a user...",
|
|
199
|
-
acceptanceCriteria: ["Given...", "When...", "Then..."],
|
|
200
|
-
definitionOfDone: ["Testable requirement 1", "..."],
|
|
201
|
-
originalLineRange: [25, 45]
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
tasks: [
|
|
205
|
-
{
|
|
206
|
-
title: "Main Task Title",
|
|
207
|
-
subtasks: [
|
|
208
|
-
{ title: "Subtask 1", description: "...", originalLineRange: [10, 12] },
|
|
209
|
-
{ title: "Subtask 2", description: "...", originalLineRange: [13, 15] }
|
|
210
|
-
],
|
|
211
|
-
originalLineRange: [8, 20]
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Step 6: Create User Story Issues via Shell Script
|
|
218
|
-
|
|
219
|
-
**Prepare user stories JSON data:**
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
echo "📝 Preparing user stories data for batch creation..."
|
|
223
|
-
|
|
224
|
-
# Create JSON array for user stories
|
|
225
|
-
USER_STORIES_JSON="$TEMP_DIR/user-stories.json"
|
|
226
|
-
cat > "$USER_STORIES_JSON" << 'EOF'
|
|
227
|
-
[
|
|
228
|
-
EOF
|
|
229
|
-
|
|
230
|
-
STORY_COUNT=0
|
|
231
|
-
while IFS= read -r story_line; do
|
|
232
|
-
if [[ "$story_line" =~ ^##[[:space:]]*Story[[:space:]]*[0-9]+: ]]; then
|
|
233
|
-
STORY_TITLE=$(echo "$story_line" | sed 's/^## Story [0-9]*: //' | sed 's/ \[#[0-9]*\]$//')
|
|
234
|
-
|
|
235
|
-
# Extract story body (As a/I want/So that + acceptance criteria)
|
|
236
|
-
STORY_BODY=$(extract_story_body_from_file "$story_line")
|
|
237
|
-
|
|
238
|
-
# Add to JSON array
|
|
239
|
-
cat >> "$USER_STORIES_JSON" << EOF
|
|
240
|
-
{
|
|
241
|
-
"title": "[USER STORY] $STORY_TITLE",
|
|
242
|
-
"body": "$STORY_BODY",
|
|
243
|
-
"labels": ["user-story", "feature"]
|
|
244
|
-
}$([ $STORY_COUNT -lt $((TOTAL_STORIES - 1)) ] && echo ",")
|
|
245
|
-
EOF
|
|
246
|
-
|
|
247
|
-
STORY_COUNT=$((STORY_COUNT + 1))
|
|
248
|
-
fi
|
|
249
|
-
done < user-stories.md
|
|
250
|
-
|
|
251
|
-
cat >> "$USER_STORIES_JSON" << 'EOF'
|
|
252
|
-
]
|
|
253
|
-
EOF
|
|
254
|
-
|
|
255
|
-
echo "✅ Prepared $STORY_COUNT user stories in $USER_STORIES_JSON"
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
**Execute batch creation via shell script:**
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
echo "🚀 Executing user story creation via batch script..."
|
|
262
|
-
|
|
263
|
-
# Call the shell script for reliable creation
|
|
264
|
-
USER_STORY_RESULTS=$(
|
|
265
|
-
cd "$(dirname "$0")" &&
|
|
266
|
-
./integrations/github/scripts/create-issues-batch.sh \
|
|
267
|
-
"$USER_STORIES_JSON" \
|
|
268
|
-
"user-story"
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
# Parse results into array
|
|
272
|
-
IFS=$'\n' read -d '' -r -a USER_STORY_ISSUE_NUMBERS <<< "$USER_STORY_RESULTS"
|
|
273
|
-
|
|
274
|
-
echo "✅ Created ${#USER_STORY_ISSUE_NUMBERS[@]} user story issues:"
|
|
275
|
-
for i in "${!USER_STORY_ISSUE_NUMBERS[@]}"; do
|
|
276
|
-
echo " Story $((i + 1)): Issue #${USER_STORY_ISSUE_NUMBERS[$i]}"
|
|
277
|
-
done
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Simple and reliable execution:**
|
|
281
|
-
- **LLM parses** user stories and creates JSON data file
|
|
282
|
-
- **Shell script handles** all rate limiting, batching, and parallel creation
|
|
283
|
-
- **Results parsed** back into arrays for document updates
|
|
284
|
-
- **No complex rate limiting logic** in LLM-generated code
|
|
285
|
-
|
|
286
|
-
### Step 7: Create Task and Subtask Issues via Shell Script
|
|
287
|
-
|
|
288
|
-
**For each main task:**
|
|
289
|
-
|
|
290
|
-
**Main task issue title format:**
|
|
291
|
-
|
|
292
|
-
```
|
|
293
|
-
[TASK] {Main Task Title}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**Main task issue body:**
|
|
297
|
-
|
|
298
|
-
```markdown
|
|
299
|
-
## Task Overview
|
|
300
|
-
|
|
301
|
-
{Main Task Description}
|
|
302
|
-
|
|
303
|
-
## Sub-Tasks
|
|
304
|
-
|
|
305
|
-
This task is broken down into the following sub-issues:
|
|
306
|
-
|
|
307
|
-
{List of sub-task issues with links - populated after creation}
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
_Generated from spec: {spec-folder-name}_
|
|
312
|
-
_Source: tasks.md_
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
**For each subtask:**
|
|
316
|
-
|
|
317
|
-
**Subtask issue title format:**
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
[SUBTASK] {Subtask Title}
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
**Subtask issue body:**
|
|
324
|
-
|
|
325
|
-
```markdown
|
|
326
|
-
## Subtask Details
|
|
327
|
-
|
|
328
|
-
{Subtask Description}
|
|
329
|
-
|
|
330
|
-
## Parent Task
|
|
331
|
-
|
|
332
|
-
This subtask belongs to: #{parent-task-issue-number}
|
|
333
|
-
|
|
334
|
-
---
|
|
335
|
-
|
|
336
|
-
_Generated from spec: {spec-folder-name}_
|
|
337
|
-
_Source: tasks.md_
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
**Prepare tasks JSON data:**
|
|
341
|
-
|
|
342
|
-
```bash
|
|
343
|
-
echo "📝 Preparing main tasks data for batch creation..."
|
|
344
|
-
|
|
345
|
-
# Create JSON array for main tasks
|
|
346
|
-
TASKS_JSON="$TEMP_DIR/tasks.json"
|
|
347
|
-
cat > "$TASKS_JSON" << 'EOF'
|
|
348
|
-
[
|
|
349
|
-
EOF
|
|
350
|
-
|
|
351
|
-
TASK_COUNT=0
|
|
352
|
-
while IFS= read -r task_line; do
|
|
353
|
-
if [[ "$task_line" =~ ^###[[:space:]]*Task[[:space:]]*[0-9]+\.[0-9]+: ]]; then
|
|
354
|
-
TASK_TITLE=$(echo "$task_line" | sed 's/^### Task [0-9]*\.[0-9]*: //' | sed 's/ \[#[0-9]*\]$//')
|
|
355
|
-
TASK_BODY=$(extract_task_body_from_file "$task_line")
|
|
356
|
-
|
|
357
|
-
# Add to JSON array
|
|
358
|
-
cat >> "$TASKS_JSON" << EOF
|
|
359
|
-
{
|
|
360
|
-
"title": "[TASK] $TASK_TITLE",
|
|
361
|
-
"body": "$TASK_BODY",
|
|
362
|
-
"labels": ["task"]
|
|
363
|
-
}$([ $TASK_COUNT -lt $((TOTAL_TASKS - 1)) ] && echo ",")
|
|
364
|
-
EOF
|
|
365
|
-
|
|
366
|
-
TASK_COUNT=$((TASK_COUNT + 1))
|
|
367
|
-
fi
|
|
368
|
-
done < tasks.md
|
|
369
|
-
|
|
370
|
-
cat >> "$TASKS_JSON" << 'EOF'
|
|
371
|
-
]
|
|
372
|
-
EOF
|
|
373
|
-
|
|
374
|
-
echo "✅ Prepared $TASK_COUNT main tasks in $TASKS_JSON"
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
**Execute main task creation via shell script:**
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
echo "🚀 Executing main task creation via batch script..."
|
|
381
|
-
|
|
382
|
-
TASK_RESULTS=$(
|
|
383
|
-
./integrations/github/scripts/create-issues-batch.sh \
|
|
384
|
-
"$TASKS_JSON" \
|
|
385
|
-
"task"
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
# Parse results into array
|
|
389
|
-
IFS=$'\n' read -d '' -r -a TASK_ISSUE_NUMBERS <<< "$TASK_RESULTS"
|
|
390
|
-
|
|
391
|
-
echo "✅ Created ${#TASK_ISSUE_NUMBERS[@]} main task issues"
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
**Prepare subtasks JSON data:**
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
echo "📝 Preparing subtasks data for batch creation..."
|
|
398
|
-
|
|
399
|
-
# Create JSON array for subtasks
|
|
400
|
-
SUBTASKS_JSON="$TEMP_DIR/subtasks.json"
|
|
401
|
-
cat > "$SUBTASKS_JSON" << 'EOF'
|
|
402
|
-
[
|
|
403
|
-
EOF
|
|
404
|
-
|
|
405
|
-
SUBTASK_COUNT=0
|
|
406
|
-
# Parse subtasks from tasks.md and associate with parent tasks
|
|
407
|
-
while IFS= read -r subtask_line; do
|
|
408
|
-
if [[ "$subtask_line" =~ ^-[[:space:]]*\[[[:space:]]*\] ]]; then
|
|
409
|
-
SUBTASK_TITLE=$(echo "$subtask_line" | sed 's/^- \[ \] //')
|
|
410
|
-
PARENT_TASK_INDEX=$(get_parent_task_index_for_subtask "$subtask_line")
|
|
411
|
-
PARENT_TASK_NUMBER=${TASK_ISSUE_NUMBERS[$PARENT_TASK_INDEX]}
|
|
412
|
-
|
|
413
|
-
SUBTASK_BODY="## Subtask Details\n\n$SUBTASK_TITLE\n\n## Parent Task\n\nThis subtask belongs to: #$PARENT_TASK_NUMBER"
|
|
414
|
-
|
|
415
|
-
# Add to JSON array
|
|
416
|
-
cat >> "$SUBTASKS_JSON" << EOF
|
|
417
|
-
{
|
|
418
|
-
"title": "[SUBTASK] $SUBTASK_TITLE",
|
|
419
|
-
"body": "$SUBTASK_BODY",
|
|
420
|
-
"labels": ["subtask"]
|
|
421
|
-
}$([ $SUBTASK_COUNT -lt $((TOTAL_SUBTASKS - 1)) ] && echo ",")
|
|
422
|
-
EOF
|
|
423
|
-
|
|
424
|
-
SUBTASK_COUNT=$((SUBTASK_COUNT + 1))
|
|
425
|
-
fi
|
|
426
|
-
done < tasks.md
|
|
427
|
-
|
|
428
|
-
cat >> "$SUBTASKS_JSON" << 'EOF'
|
|
429
|
-
]
|
|
430
|
-
EOF
|
|
431
|
-
|
|
432
|
-
echo "✅ Prepared $SUBTASK_COUNT subtasks in $SUBTASKS_JSON"
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
**Execute subtask creation via shell script:**
|
|
436
|
-
|
|
437
|
-
```bash
|
|
438
|
-
echo "🚀 Executing subtask creation via batch script..."
|
|
439
|
-
|
|
440
|
-
SUBTASK_RESULTS=$(
|
|
441
|
-
./integrations/github/scripts/create-issues-batch.sh \
|
|
442
|
-
"$SUBTASKS_JSON" \
|
|
443
|
-
"subtask"
|
|
444
|
-
)
|
|
445
|
-
|
|
446
|
-
# Parse results into array
|
|
447
|
-
IFS=$'\n' read -d '' -r -a SUBTASK_ISSUE_NUMBERS <<< "$SUBTASK_RESULTS"
|
|
448
|
-
|
|
449
|
-
echo "✅ Created ${#SUBTASK_ISSUE_NUMBERS[@]} subtask issues"
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
**Execution summary:**
|
|
453
|
-
- **LLM parses** tasks.md and creates JSON data files for main tasks and subtasks
|
|
454
|
-
- **Shell script handles** all rate limiting, batching, and parallel creation
|
|
455
|
-
- **Parent-child relationships** established via issue numbers in subtask bodies
|
|
456
|
-
- **Results captured** and parsed back for document updates
|
|
457
|
-
- **No complex batching logic** required in LLM-generated code
|
|
458
|
-
|
|
459
|
-
### Step 8: Update Source Documents with Issue Numbers
|
|
460
|
-
|
|
461
|
-
**Update user-stories.md:**
|
|
462
|
-
|
|
463
|
-
For each user story, add issue number reference:
|
|
464
|
-
|
|
465
|
-
```markdown
|
|
466
|
-
## Story 1: User Profile Creation [#123]
|
|
467
|
-
|
|
468
|
-
**As a** new user
|
|
469
|
-
**I want to** create a profile with basic information
|
|
470
|
-
**So that** I can personalize my experience
|
|
471
|
-
|
|
472
|
-
### Issue: [#123](https://github.com/owner/repo/issues/123)
|
|
473
|
-
|
|
474
|
-
### Acceptance Criteria
|
|
475
|
-
|
|
476
|
-
...
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
**Update tasks.md:**
|
|
480
|
-
|
|
481
|
-
For each task and subtask, add issue number references:
|
|
482
|
-
|
|
483
|
-
```markdown
|
|
484
|
-
## Tasks
|
|
485
|
-
|
|
486
|
-
- [ ] 1. User Authentication System [#124]
|
|
487
|
-
|
|
488
|
-
- [ ] 1.1 Write tests for authentication middleware [#125]
|
|
489
|
-
- [ ] 1.2 Implement JWT token generation [#126]
|
|
490
|
-
- [ ] 1.3 Create password hashing utilities [#127]
|
|
491
|
-
|
|
492
|
-
### Task Issues:
|
|
493
|
-
|
|
494
|
-
- Main Task: [#124](https://github.com/owner/repo/issues/124)
|
|
495
|
-
- Subtasks: [#125](https://github.com/owner/repo/issues/125), [#126](https://github.com/owner/repo/issues/126), [#127](https://github.com/owner/repo/issues/127)
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
**Document update strategy:**
|
|
499
|
-
|
|
500
|
-
- Use `MultiEdit` tool for efficient multiple edits
|
|
501
|
-
- Preserve existing formatting and structure
|
|
502
|
-
- Add issue links in consistent format
|
|
503
|
-
- Maintain original content integrity
|
|
504
|
-
|
|
505
|
-
### Step 9: Create Issue Relationship Mapping
|
|
506
|
-
|
|
507
|
-
**Generate mapping document:**
|
|
508
|
-
|
|
509
|
-
Create `.code-captain/specs/{spec-folder}/github-issues-mapping.md`:
|
|
510
|
-
|
|
511
|
-
```markdown
|
|
512
|
-
# GitHub Issues Mapping
|
|
513
|
-
|
|
514
|
-
> Generated: {current-date}
|
|
515
|
-
> Spec: {spec-folder-name}
|
|
516
|
-
> Repository: {owner/repo}
|
|
517
|
-
|
|
518
|
-
## User Story Issues
|
|
519
|
-
|
|
520
|
-
| Story Title | Issue # | GitHub Link |
|
|
521
|
-
| ------------- | ------- | ------------------------------------------------ |
|
|
522
|
-
| Story 1 Title | #123 | [Link](https://github.com/owner/repo/issues/123) |
|
|
523
|
-
| Story 2 Title | #124 | [Link](https://github.com/owner/repo/issues/124) |
|
|
524
|
-
|
|
525
|
-
## Task Issues
|
|
526
|
-
|
|
527
|
-
| Task Title | Main Issue | Sub-Issues |
|
|
528
|
-
| ------------ | ------------ | -------------------------- |
|
|
529
|
-
| Task 1 Title | [#125](link) | [#126](link), [#127](link) |
|
|
530
|
-
| Task 2 Title | [#128](link) | [#129](link), [#130](link) |
|
|
531
|
-
|
|
532
|
-
## Summary
|
|
533
|
-
|
|
534
|
-
- **Total Issues Created:** {count}
|
|
535
|
-
- **User Stories:** {count}
|
|
536
|
-
- **Main Tasks:** {count}
|
|
537
|
-
- **Subtasks:** {count}
|
|
538
|
-
|
|
539
|
-
## Source Files Updated
|
|
540
|
-
|
|
541
|
-
- ✅ user-stories.md - Added issue references
|
|
542
|
-
- ✅ tasks.md - Added issue references and links
|
|
543
|
-
- ✅ github-issues-mapping.md - Created mapping document
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
### Step 10: Verification & Summary
|
|
547
|
-
|
|
548
|
-
**Verify all issues created using GitHub CLI:**
|
|
549
|
-
|
|
550
|
-
- Use `gh issue list` to check each created issue number exists
|
|
551
|
-
- Verify issue URLs are valid and accessible
|
|
552
|
-
- Use `gh issue view {issue-number}` to confirm parent-child relationships
|
|
553
|
-
- Validate all labels were applied correctly
|
|
554
|
-
|
|
555
|
-
**Update final todos:**
|
|
556
|
-
|
|
557
|
-
- Mark all todos as completed
|
|
558
|
-
- Provide summary of created issues
|
|
559
|
-
- Confirm document updates successful
|
|
560
|
-
|
|
561
|
-
### Step 11: Sync Integration & Cache Update
|
|
562
|
-
|
|
563
|
-
**Trigger GitHub sync to update local cache:**
|
|
564
|
-
|
|
565
|
-
- **Automatic sync trigger**: Run `cc: sync` to update `.code-captain/github/cache/` with new issues
|
|
566
|
-
- **Cache consistency**: Ensure local cache reflects newly created issues
|
|
567
|
-
- **Available tasks update**: Refresh available tasks list with new unassigned issues
|
|
568
|
-
- **Traceability**: Update spec mapping to include GitHub issue states
|
|
569
|
-
|
|
570
|
-
**Integration verification:**
|
|
571
|
-
```bash
|
|
572
|
-
# Verify sync integration worked
|
|
573
|
-
gh issue list --limit 50 --json number,title,state | jq '.[] | select(.title | test("\\[(USER STORY|TASK|SUBTASK)\\]"))'
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
- Confirm all created issues appear in sync cache
|
|
577
|
-
- Verify issue counts match between creation log and cache
|
|
578
|
-
- Update project dashboard with new available work
|
|
579
|
-
|
|
580
|
-
**Present completion summary:**
|
|
581
|
-
|
|
582
|
-
```
|
|
583
|
-
✅ GitHub Issues Creation Complete
|
|
584
|
-
|
|
585
|
-
📊 Summary:
|
|
586
|
-
- User Stories: {count} issues created
|
|
587
|
-
- Main Tasks: {count} issues created
|
|
588
|
-
- Subtasks: {count} issues created
|
|
589
|
-
- Total: {total-count} issues
|
|
590
|
-
|
|
591
|
-
📁 Updated Files:
|
|
592
|
-
- user-stories.md - Added issue references
|
|
593
|
-
- tasks.md - Added issue references and task links
|
|
594
|
-
- github-issues-mapping.md - Created mapping document
|
|
595
|
-
|
|
596
|
-
🔄 Sync Status:
|
|
597
|
-
- GitHub cache updated with new issues
|
|
598
|
-
- Available tasks refreshed: {available-count} tasks ready
|
|
599
|
-
- Project dashboard reflects current state
|
|
600
|
-
|
|
601
|
-
🔗 Repository: {owner/repo}
|
|
602
|
-
📋 All issues available at: https://github.com/{owner/repo}/issues
|
|
603
|
-
|
|
604
|
-
Next Steps:
|
|
605
|
-
- Use `cc: sync` to synchronize with GitHub and update local cache
|
|
606
|
-
- Use `cc: execute-task` to begin implementation
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
### Step 12: Cleanup Temporary Resources
|
|
610
|
-
|
|
611
|
-
**Clean up temporary working directory:**
|
|
612
|
-
|
|
613
|
-
```bash
|
|
614
|
-
echo "🧹 Cleaning up temporary resources..."
|
|
615
|
-
|
|
616
|
-
# Remove temporary working directory and files
|
|
617
|
-
if [ -d "$TEMP_DIR" ]; then
|
|
618
|
-
rm -rf "$TEMP_DIR"
|
|
619
|
-
echo "✅ Cleaned up temporary directory: $TEMP_DIR"
|
|
620
|
-
fi
|
|
621
|
-
|
|
622
|
-
# Remove any temporary issue result files
|
|
623
|
-
rm -f /tmp/issue_result_$$_*
|
|
624
|
-
|
|
625
|
-
echo "✅ Cleanup complete"
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
**Final status:**
|
|
629
|
-
- All temporary JSON files removed
|
|
630
|
-
- Working directory cleaned up
|
|
631
|
-
- System resources freed
|
|
632
|
-
- Process complete and ready for next operation
|
|
633
|
-
|
|
634
|
-
## Tool Integration
|
|
635
|
-
|
|
636
|
-
**Uses Code Captain tools:**
|
|
637
|
-
|
|
638
|
-
- `codebase_search` to find and validate spec folders
|
|
639
|
-
- `file_search` to locate user stories and tasks files
|
|
640
|
-
- `read_file` to parse spec documents
|
|
641
|
-
- `MultiEdit` to update source documents with issue numbers
|
|
642
|
-
- `todo_write` for progress tracking throughout process
|
|
643
|
-
- `run_terminal_cmd` for all GitHub CLI command executions
|
|
644
|
-
|
|
645
|
-
**Uses shell script for issue creation:**
|
|
646
|
-
|
|
647
|
-
- `scripts/create-issues-batch.sh` - Handles all GitHub CLI operations
|
|
648
|
-
- Dynamic rate limiting and batch sizing
|
|
649
|
-
- Parallel issue creation within limits
|
|
650
|
-
- Error handling and retry logic
|
|
651
|
-
- Progress tracking and logging
|
|
652
|
-
|
|
653
|
-
**GitHub CLI commands (via shell script):**
|
|
654
|
-
|
|
655
|
-
- `gh auth status` to validate GitHub access
|
|
656
|
-
- `gh api rate_limit` for rate limit monitoring
|
|
657
|
-
- `gh issue create` for batch issue creation
|
|
658
|
-
- `gh label create` for label management
|
|
659
|
-
- `gh issue list` for verification
|
|
660
|
-
|
|
661
|
-
**Execution flow optimization:**
|
|
662
|
-
|
|
663
|
-
- LLM handles parsing and JSON preparation
|
|
664
|
-
- Shell script handles all rate-limited operations
|
|
665
|
-
- Clean separation of concerns for reliability
|
|
666
|
-
- Create main issues in parallel batches
|
|
667
|
-
- Update multiple document sections concurrently
|
|
668
|
-
- Verify multiple issue links simultaneously
|
|
669
|
-
|
|
670
|
-
## Error Handling & Edge Cases
|
|
671
|
-
|
|
672
|
-
**Missing spec files:**
|
|
673
|
-
|
|
674
|
-
- If user-stories.md missing: Error with guidance to run `create-spec` first
|
|
675
|
-
- If tasks.md missing: Create issues only from user stories
|
|
676
|
-
- If no spec folder found: Prompt user to specify path
|
|
677
|
-
|
|
678
|
-
**GitHub CLI access issues:**
|
|
679
|
-
|
|
680
|
-
- Verify GitHub CLI is installed and authenticated using `gh auth status`
|
|
681
|
-
- Check repository permissions with `gh repo view` before starting
|
|
682
|
-
- Handle rate limiting and network errors from CLI commands
|
|
683
|
-
- Provide clear error messages for authentication failures (`gh auth login` guidance)
|
|
684
|
-
|
|
685
|
-
**Document parsing errors:**
|
|
686
|
-
|
|
687
|
-
- Handle malformed user story structures gracefully
|
|
688
|
-
- Skip invalid task hierarchies with warnings
|
|
689
|
-
- Continue processing valid entries when possible
|
|
690
|
-
|
|
691
|
-
**GitHub CLI command failures (Enhanced):**
|
|
692
|
-
|
|
693
|
-
- **Retry logic**: 3 attempts for each `gh issue create` command with 2-second delays
|
|
694
|
-
- **Exit code tracking**: Capture and log specific failure reasons (network, auth, rate limiting)
|
|
695
|
-
- **URL validation**: Parse CLI output to confirm issue creation success via URL regex
|
|
696
|
-
- **Fail-fast approach**: Stop execution on any permanent failure (don't continue with partial success)
|
|
697
|
-
- **Label creation failures**: Handle missing labels gracefully with `|| true` fallback
|
|
698
|
-
- **Rate limiting**: Detect and handle GitHub API rate limiting with exponential backoff
|
|
699
|
-
- **Network timeouts**: Implement timeout handling for CLI commands
|
|
700
|
-
- **Authentication issues**: Provide clear guidance for `gh auth login` when auth fails
|
|
701
|
-
|
|
702
|
-
**Deterministic execution guarantees:**
|
|
703
|
-
- **No AI discretion**: All tasks and subtasks from spec must be created - no selective skipping allowed
|
|
704
|
-
- **Complete or fail**: Either create ALL issues successfully or fail completely
|
|
705
|
-
- **Progress transparency**: Show exact counts and progress percentages throughout
|
|
706
|
-
- **Consistent state**: Ensure documents are only updated after ALL issues are created successfully
|
|
707
|
-
|
|
708
|
-
## Integration with Existing Commands
|
|
709
|
-
|
|
710
|
-
**Works with create-spec:**
|
|
711
|
-
|
|
712
|
-
- Automatically detects create-spec output format
|
|
713
|
-
- Reads user-stories.md and tasks.md generated by create-spec
|
|
714
|
-
- Maintains consistency with spec folder structure
|
|
715
|
-
|
|
716
|
-
**Enhances project workflow:**
|
|
717
|
-
|
|
718
|
-
- Links GitHub issues to specification documents
|
|
719
|
-
- Creates traceable connection between requirements and work items
|
|
720
|
-
- Enables GitHub-based project tracking from Code Captain specs
|
|
721
|
-
|
|
722
|
-
**Cross-references:**
|
|
723
|
-
|
|
724
|
-
- Updates spec documents with issue links for easy navigation
|
|
725
|
-
- Creates bidirectional traceability between specs and GitHub
|
|
726
|
-
- Maintains consistency with existing Code Captain file organization
|
|
727
|
-
|
|
728
|
-
## Usage Notes
|
|
729
|
-
|
|
730
|
-
**Prerequisites:**
|
|
731
|
-
|
|
732
|
-
- Existing spec folder with user-stories.md and tasks.md
|
|
733
|
-
- GitHub repository with appropriate permissions
|
|
734
|
-
- GitHub CLI (`gh`) installed and authenticated (`gh auth login`)
|
|
735
|
-
- Current directory must be within the target git repository
|
|
736
|
-
|
|
737
|
-
**Best practices:**
|
|
738
|
-
|
|
739
|
-
- Run after completing spec creation and review with `cc: create-spec`
|
|
740
|
-
- Ensure spec documents are finalized before creating issues
|
|
741
|
-
- Verify GitHub CLI authentication before running: `gh auth status`
|
|
742
|
-
- Check repository permissions with: `gh repo view {owner/repo}`
|
|
743
|
-
- Run during periods of stable network connectivity for best results
|
|
744
|
-
- Review created issues after completion for quality assurance
|
|
745
|
-
- Use `cc: sync` after completion to update local cache
|
|
746
|
-
|
|
747
|
-
**Enhanced capabilities:**
|
|
748
|
-
|
|
749
|
-
- **Shell script architecture** - reliable execution with dynamic rate limiting
|
|
750
|
-
- **Intelligent batching** - adapts batch sizes based on GitHub quota status
|
|
751
|
-
- **Complete deterministic execution** - creates ALL tasks without skipping
|
|
752
|
-
- **Robust error handling** - retry logic and fail-fast for reliability
|
|
753
|
-
- **Label management** - automatically creates required labels
|
|
754
|
-
- **Sync integration** - updates local cache automatically
|
|
755
|
-
- **Progress tracking** - shows detailed progress throughout execution
|
|
756
|
-
- **Quality assurance** - verifies all issues before completion
|
|
757
|
-
- **Resource cleanup** - automatically removes temporary files and directories
|
|
758
|
-
|
|
759
|
-
**Limitations:**
|
|
760
|
-
|
|
761
|
-
- Requires GitHub repository context and proper permissions
|
|
762
|
-
- Creates new issues only (does not modify existing issues)
|
|
763
|
-
- Depends on specific user story and task formatting from `cc: create-spec`
|
|
764
|
-
- Requires stable network connection for GitHub CLI operations
|
|
765
|
-
- **Cannot be run multiple times on same spec** - creates duplicate issues
|