@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.
Files changed (34) hide show
  1. package/README.md +1 -10
  2. package/bin/install.js +178 -182
  3. package/claude-code/agents/code-captain.md +17 -20
  4. package/copilot/README.md +26 -16
  5. package/copilot/chatmodes/Code Captain.chatmode.md +11 -16
  6. package/copilot/prompts/create-spec.prompt.md +5 -8
  7. package/copilot/prompts/explain-code.prompt.md +5 -8
  8. package/copilot/prompts/new-command.prompt.md +60 -21
  9. package/copilot/prompts/research.prompt.md +5 -8
  10. package/copilot/prompts/status.prompt.md +13 -2
  11. package/copilot/prompts/swab.prompt.md +1 -0
  12. package/cursor/README.md +8 -23
  13. package/cursor/cc.md +2 -29
  14. package/cursor/cc.mdc +3 -10
  15. package/cursor/commands/create-adr.md +1 -1
  16. package/cursor/commands/create-spec.md +9 -12
  17. package/cursor/commands/explain-code.md +5 -8
  18. package/cursor/commands/initialize.md +1 -1
  19. package/cursor/commands/new-command.md +5 -4
  20. package/cursor/commands/research.md +6 -9
  21. package/cursor/commands/status.md +13 -2
  22. package/cursor/commands/swab.md +61 -2
  23. package/manifest.json +150 -166
  24. package/package.json +12 -2
  25. package/windsurf/workflows/explain-code.md +4 -8
  26. package/windsurf/workflows/plan-product.md +330 -0
  27. package/windsurf/workflows/research.md +240 -0
  28. package/windsurf/workflows/swab.md +212 -0
  29. package/cursor/integrations/azure-devops/create-azure-work-items.md +0 -403
  30. package/cursor/integrations/azure-devops/sync-azure-work-items.md +0 -486
  31. package/cursor/integrations/github/create-github-issues.md +0 -765
  32. package/cursor/integrations/github/scripts/create-issues-batch.sh +0 -272
  33. package/cursor/integrations/github/sync-github-issues.md +0 -237
  34. package/cursor/integrations/github/sync.md +0 -305
@@ -1,272 +0,0 @@
1
- #!/bin/bash
2
-
3
- # GitHub Issues Batch Creation Script
4
- # Handles dynamic rate limiting and parallel creation
5
- # Usage: ./create-issues-batch.sh <issues_json_file> <issue_type>
6
-
7
- set -euo pipefail
8
-
9
- if [ "$#" -lt 2 ]; then
10
- echo "Usage: $(basename "$0") <issues_json_file> <issue_type>" >&2
11
- exit 1
12
- fi
13
-
14
- ISSUES_FILE="$1"
15
- ISSUE_TYPE="$2" # user-story, task, subtask
16
-
17
- # Rate limiting constants
18
- CONTENT_LIMIT_PER_MINUTE=80
19
- CONTENT_LIMIT_PER_HOUR=500
20
- NORMAL_BATCH_SIZE=20
21
- CONSERVATIVE_BATCH_SIZE=10
22
- CRITICAL_QUOTA_THRESHOLD=100
23
- LOW_QUOTA_THRESHOLD=200
24
-
25
- # Logging functions
26
- log_info() { echo "ℹ️ $1" >&2; }
27
- log_success() { echo "✅ $1" >&2; }
28
- log_warning() { echo "⚠️ $1" >&2; }
29
- log_error() { echo "🚨 $1" >&2; }
30
- log_progress() { echo "📦 $1" >&2; }
31
-
32
- # Check if required tools are available
33
- check_dependencies() {
34
- if ! command -v gh &> /dev/null; then
35
- log_error "GitHub CLI (gh) is not installed or not in PATH"
36
- exit 1
37
- fi
38
-
39
- if ! command -v jq &> /dev/null; then
40
- log_error "jq is not installed or not in PATH"
41
- exit 1
42
- fi
43
-
44
- # Verify GitHub CLI authentication
45
- if ! gh auth status &> /dev/null; then
46
- log_error "GitHub CLI is not authenticated. Run 'gh auth login'"
47
- exit 1
48
- fi
49
- }
50
-
51
- # Get current rate limit status
52
- get_rate_limit_status() {
53
- local rate_status
54
- rate_status=$(gh api rate_limit)
55
-
56
- local remaining=$(echo "$rate_status" | jq '.resources.core.remaining')
57
- local reset_time=$(echo "$rate_status" | jq '.resources.core.reset')
58
- local current_time=$(date +%s)
59
- local minutes_until_reset=$(( (reset_time - current_time) / 60 ))
60
-
61
- echo "$remaining $reset_time $minutes_until_reset"
62
- }
63
-
64
- # Determine batch strategy based on rate limits
65
- calculate_batch_strategy() {
66
- local remaining=$1
67
- local total_issues=$2
68
-
69
- log_info "Rate Limit Assessment:"
70
- log_info " Available quota: $remaining requests"
71
- log_info " Issues to create: $total_issues"
72
-
73
- if [ "$remaining" -lt "$total_issues" ]; then
74
- log_error "INSUFFICIENT QUOTA: Need $total_issues, have $remaining"
75
- log_error "Wait for rate limit reset or reduce issue count"
76
- return 1
77
- elif [ "$remaining" -lt "$CRITICAL_QUOTA_THRESHOLD" ]; then
78
- echo "critical"
79
- elif [ "$remaining" -lt "$LOW_QUOTA_THRESHOLD" ]; then
80
- echo "conservative"
81
- else
82
- echo "normal"
83
- fi
84
- }
85
-
86
- # Create a single issue with retry logic
87
- create_single_issue() {
88
- local issue_data="$1"
89
- local max_retries=3
90
- local retry_count=0
91
-
92
- local title=$(echo "$issue_data" | jq -r '.title')
93
- local body=$(echo "$issue_data" | jq -r '.body')
94
- local labels=$(echo "$issue_data" | jq -r '.labels | join(",")')
95
-
96
- while [ $retry_count -lt $max_retries ]; do
97
- local start_time=$(date +%s)
98
-
99
- local result
100
- result=$(gh issue create \
101
- --title "$title" \
102
- --body "$body" \
103
- --label "$labels" 2>&1)
104
-
105
- local exit_code=$?
106
- local end_time=$(date +%s)
107
- local duration=$((end_time - start_time))
108
-
109
- if [ $exit_code -eq 0 ]; then
110
- local issue_number=$(echo "$result" | grep -o '[0-9]*$')
111
- log_success "Created issue #$issue_number (${duration}s): $title"
112
- echo "$issue_number"
113
- return 0
114
- elif echo "$result" | grep -q "rate limit"; then
115
- log_warning "Rate limited - waiting before retry..."
116
- sleep $((60 + RANDOM % 30)) # 60-90 second wait
117
- retry_count=$((retry_count + 1))
118
- else
119
- retry_count=$((retry_count + 1))
120
- log_warning "Attempt $retry_count failed (${duration}s): $result"
121
- sleep $((retry_count * 3)) # Exponential backoff
122
- fi
123
- done
124
-
125
- log_error "FAILED to create issue after $max_retries attempts: $title"
126
- return 1
127
- }
128
-
129
- # Create issues in batches with rate limiting
130
- create_issues_batch() {
131
- local issues_array=("$@")
132
- local total_issues=${#issues_array[@]}
133
- local processed=0
134
- local created_issues=()
135
-
136
- log_progress "Creating $total_issues $ISSUE_TYPE issues with dynamic rate limiting..."
137
-
138
- while [ $processed -lt $total_issues ]; do
139
- # Get current rate limit status
140
- local rate_info
141
- rate_info=$(get_rate_limit_status)
142
- local remaining=$(echo "$rate_info" | cut -d' ' -f1)
143
- local minutes_until_reset=$(echo "$rate_info" | cut -d' ' -f3)
144
-
145
- log_info "Pre-batch check: $remaining remaining, ${minutes_until_reset}m until reset"
146
-
147
- # Calculate batch strategy
148
- local strategy
149
- strategy=$(calculate_batch_strategy "$remaining" $((total_issues - processed)))
150
- if [ $? -ne 0 ]; then
151
- exit 1
152
- fi
153
-
154
- # Determine batch size based on strategy
155
- local current_batch_size
156
- case $strategy in
157
- "critical")
158
- log_warning "CRITICAL quota - waiting 5 minutes for reset..."
159
- sleep 300
160
- continue
161
- ;;
162
- "conservative")
163
- current_batch_size=$CONSERVATIVE_BATCH_SIZE
164
- log_info "Using conservative batch size: $current_batch_size"
165
- ;;
166
- "normal")
167
- current_batch_size=$NORMAL_BATCH_SIZE
168
- log_info "Using normal batch size: $current_batch_size"
169
- ;;
170
- esac
171
-
172
- # Don't exceed remaining issues
173
- local remaining_issues=$((total_issues - processed))
174
- if [ $current_batch_size -gt $remaining_issues ]; then
175
- current_batch_size=$remaining_issues
176
- fi
177
-
178
- log_progress "Creating batch of $current_batch_size issues..."
179
- log_progress "Progress: $processed/$total_issues ($(( processed * 100 / total_issues ))%)"
180
-
181
- # Create batch in parallel
182
- local batch_start_time=$(date +%s)
183
- local batch_pids=()
184
- local batch_results=()
185
-
186
- for ((i=0; i<current_batch_size; i++)); do
187
- local issue_index=$((processed + i))
188
- local issue_data="${issues_array[$issue_index]}"
189
-
190
- {
191
- local issue_number
192
- issue_number=$(create_single_issue "$issue_data")
193
- echo "$issue_number" > "/tmp/issue_result_$$_$i"
194
- } &
195
- batch_pids+=($!)
196
- done
197
-
198
- # Wait for batch completion
199
- local batch_failures=0
200
- for i in "${!batch_pids[@]}"; do
201
- local pid=${batch_pids[$i]}
202
- if wait "$pid"; then
203
- local issue_number
204
- issue_number=$(cat "/tmp/issue_result_$$_$i")
205
- created_issues+=("$issue_number")
206
- rm -f "/tmp/issue_result_$$_$i"
207
- else
208
- batch_failures=$((batch_failures + 1))
209
- rm -f "/tmp/issue_result_$$_$i"
210
- fi
211
- done
212
-
213
- local batch_end_time=$(date +%s)
214
- local batch_duration=$((batch_end_time - batch_start_time))
215
-
216
- if [ $batch_failures -gt 0 ]; then
217
- log_error "$batch_failures issues failed in this batch"
218
- log_error "STOPPING - Manual intervention required"
219
- exit 1
220
- fi
221
-
222
- log_success "Batch completed in ${batch_duration}s"
223
- processed=$((processed + current_batch_size))
224
-
225
- # Smart cooldown between batches
226
- if [ $processed -lt $total_issues ]; then
227
- if [ "$strategy" = "conservative" ]; then
228
- log_info "Conservative cooldown (90s)..."
229
- sleep 90
230
- else
231
- log_info "Standard cooldown (45s)..."
232
- sleep 45
233
- fi
234
- fi
235
- done
236
-
237
- log_success "All $total_issues $ISSUE_TYPE issues created successfully"
238
-
239
- # Output created issue numbers (one per line)
240
- printf '%s\n' "${created_issues[@]}"
241
- }
242
-
243
- # Main execution
244
- main() {
245
- check_dependencies
246
-
247
- if [ ! -f "$ISSUES_FILE" ]; then
248
- log_error "Issues file not found: $ISSUES_FILE"
249
- exit 1
250
- fi
251
-
252
- # Read issues from JSON file
253
- local issues_json
254
- issues_json=$(cat "$ISSUES_FILE")
255
-
256
- # Convert JSON array to bash array
257
- local issues_array=()
258
- local issue_count
259
- issue_count=$(echo "$issues_json" | jq '. | length')
260
-
261
- for ((i=0; i<issue_count; i++)); do
262
- local issue_data
263
- issue_data=$(echo "$issues_json" | jq ".[$i]")
264
- issues_array+=("$issue_data")
265
- done
266
-
267
- # Create issues in batches
268
- create_issues_batch "${issues_array[@]}"
269
- }
270
-
271
- # Run main function
272
- main "$@"
@@ -1,237 +0,0 @@
1
- # Sync GitHub Issues Command (cc: sync-github-issues)
2
-
3
- ## Overview
4
-
5
- Automatically retrieve all GitHub issues, save them to a file, and update matching spec documents with current issue statuses.
6
-
7
- ## Usage
8
-
9
- ```bash
10
- cc: sync-github-issues
11
- ```
12
-
13
- **Example:**
14
-
15
- ```bash
16
- cc: sync-github-issues # Lists all issues, saves to file, and updates matching specs
17
- ```
18
-
19
- ## Command Process
20
-
21
- ### Step 1: Repository Context & Validation
22
-
23
- **GitHub repository detection:**
24
-
25
- - Verify current directory is a git repository
26
- - Extract repository owner/name from remote origin
27
- - Validate GitHub access permissions
28
- - Confirm repository has issues enabled
29
-
30
- **Spec folder detection:**
31
-
32
- - Auto-detect all spec folders in the project
33
- - Find documents containing issue number references (#123 format)
34
- - Prepare list of files that may need updating
35
-
36
- ### Step 2: Create Todo Tracking
37
-
38
- **Use `todo_write` to track the sync process:**
39
-
40
- ```json
41
- {
42
- "todos": [
43
- {
44
- "id": "github-sync-fetch",
45
- "content": "Fetch all GitHub issues from repository",
46
- "status": "in_progress"
47
- },
48
- {
49
- "id": "github-sync-save",
50
- "content": "Save issues to github-issues.json file",
51
- "status": "pending"
52
- },
53
- {
54
- "id": "github-sync-update-specs",
55
- "content": "Update spec documents with matching issue statuses",
56
- "status": "pending"
57
- }
58
- ]
59
- }
60
- ```
61
-
62
- ### Step 3: Fetch GitHub Issues
63
-
64
- **Use GitHub MCP tools to retrieve all issues:**
65
-
66
- - `mcp_github_list_issues` to fetch all issues (open and closed)
67
- - Handle pagination for repositories with many issues
68
- - Sort by issue number for consistent ordering
69
-
70
- **Fetch all issue states:**
71
-
72
- ```javascript
73
- const allIssues = await fetchAllPages([
74
- mcp_github_list_issues({ state: "all", sort: "created", direction: "asc" }),
75
- ]);
76
- ```
77
-
78
- ### Step 4: Save Issues to File
79
-
80
- **Create issues data structure:**
81
-
82
- ```javascript
83
- {
84
- lastSync: "2024-12-29T10:30:00Z",
85
- repository: "owner/repo",
86
- totalIssues: number,
87
- issues: [
88
- {
89
- number: 123,
90
- title: "User Profile Creation",
91
- state: "open",
92
- assignee: "username",
93
- labels: ["user-story", "feature"],
94
- created: "2024-12-28",
95
- updated: "2024-12-29",
96
- url: "https://github.com/owner/repo/issues/123",
97
- body: "Issue description..."
98
- }
99
- ]
100
- }
101
- ```
102
-
103
- **Save to file:**
104
-
105
- - Save all issue data to `github-issues.json` in project root
106
- - Include complete issue information for reference
107
- - Update file timestamp with current sync time
108
-
109
- ### Step 5: Update Spec Documents with Issue Status
110
-
111
- **Scan for matching issue references:**
112
-
113
- - Search all `.md` files in the project for issue number patterns (`#123`)
114
- - Create mapping of issue numbers to file locations and line numbers
115
- - Extract current issue statuses from fetched GitHub data
116
-
117
- **Update matching spec documents:**
118
-
119
- **For each found issue reference:**
120
-
121
- 1. **Find issue number in document** (e.g., `#123`)
122
- 2. **Look up current status** from fetched GitHub data
123
- 3. **Update status indicators** next to issue references:
124
-
125
- ```markdown
126
- # Original:
127
-
128
- ## Story 1: User Profile Creation [#123]
129
-
130
- # Updated based on issue status:
131
-
132
- ## Story 1: User Profile Creation [#123] ✅ (if closed)
133
-
134
- ## Story 1: User Profile Creation [#123] 🔄 (if open)
135
- ```
136
-
137
- **Status indicator patterns:**
138
-
139
- - `✅` - Closed/Completed issues
140
- - `🔄` - Open/In Progress issues
141
- - `❌` - Issues that couldn't be found
142
-
143
- **Update process:**
144
-
145
- - Use `grep_search` to find all issue number references
146
- - Use `MultiEdit` to update status indicators in multiple files
147
- - Preserve original content, only update status symbols
148
-
149
- ### Step 6: Complete Sync Process
150
-
151
- **Provide sync summary:**
152
-
153
- ```markdown
154
- ✅ GitHub issues sync completed successfully!
155
-
156
- - **Issues fetched:** {total_count}
157
- - **Issues saved to:** github-issues.json
158
- - **Spec files updated:** {updated_files_count}
159
- - **Issue references updated:** {updated_references_count}
160
-
161
- **Files updated:**
162
-
163
- - {list of files with updated status indicators}
164
- ```
165
-
166
- **Mark todos as complete:**
167
-
168
- Update all todo items to completed status and provide final summary of work done.
169
-
170
- ## Tool Integration
171
-
172
- **Uses Code Captain tools:**
173
-
174
- - `todo_write` for progress tracking throughout sync process
175
- - `grep_search` to find issue number references in all markdown files
176
- - `read_file` to parse spec documents
177
- - `MultiEdit` to update status indicators in multiple files
178
- - `write` to save issues data to github-issues.json
179
-
180
- **Uses GitHub MCP tools:**
181
-
182
- - `mcp_github_list_issues` to fetch all repository issues
183
- - `mcp_github_get_me` to validate GitHub access
184
-
185
- **Parallel execution optimization:**
186
-
187
- - Fetch all issues with pagination handling
188
- - Search for issue references across multiple files simultaneously
189
- - Update multiple files with status indicators in parallel
190
-
191
- ## Error Handling & Edge Cases
192
-
193
- **GitHub API Issues:**
194
-
195
- - Handle rate limiting with appropriate backoff
196
- - Provide clear error messages for authentication failures
197
- - Continue with partial results if some API calls fail
198
-
199
- **Missing Local Documents:**
200
-
201
- - If no markdown files found: Complete sync but skip spec updates
202
- - If issue references not found: Save issues to file but note no updates made
203
-
204
- **Large Repositories:**
205
-
206
- - Handle pagination for repositories with hundreds of issues
207
- - Provide progress indicators for long-running syncs
208
-
209
- ## Integration with Existing Commands
210
-
211
- **Works with create-github-issues:**
212
-
213
- - Updates status indicators for issues created from specs
214
- - Maintains consistency with Code Captain issue formatting
215
-
216
- **Enhances project workflow:**
217
-
218
- - Provides current status of all GitHub-tracked work in a simple file
219
- - Updates spec documents with current issue statuses automatically
220
- - Creates feedback loop between GitHub activity and local specs
221
-
222
- ## Usage Notes
223
-
224
- **Prerequisites:**
225
-
226
- - GitHub repository with existing issues
227
- - GitHub authentication configured in environment
228
-
229
- **Best practices:**
230
-
231
- - Run regularly (daily/weekly) to maintain current status indicators
232
- - Review github-issues.json file for complete issue information
233
-
234
- **Performance considerations:**
235
-
236
- - Large repositories handled through pagination
237
- - Parallel updates for efficiency