@devobsessed/code-captain 0.0.3

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 (55) hide show
  1. package/README.md +214 -0
  2. package/bin/install.js +1048 -0
  3. package/claude-code/README.md +276 -0
  4. package/claude-code/agents/code-captain.md +121 -0
  5. package/claude-code/agents/spec-generator.md +271 -0
  6. package/claude-code/agents/story-creator.md +309 -0
  7. package/claude-code/agents/tech-spec.md +440 -0
  8. package/claude-code/commands/cc-initialize.md +520 -0
  9. package/copilot/README.md +210 -0
  10. package/copilot/chatmodes/Code Captain.chatmode.md +60 -0
  11. package/copilot/docs/best-practices.md +74 -0
  12. package/copilot/prompts/create-adr.prompt.md +468 -0
  13. package/copilot/prompts/create-spec.prompt.md +430 -0
  14. package/copilot/prompts/edit-spec.prompt.md +396 -0
  15. package/copilot/prompts/execute-task.prompt.md +144 -0
  16. package/copilot/prompts/explain-code.prompt.md +292 -0
  17. package/copilot/prompts/initialize.prompt.md +65 -0
  18. package/copilot/prompts/new-command.prompt.md +310 -0
  19. package/copilot/prompts/plan-product.prompt.md +450 -0
  20. package/copilot/prompts/research.prompt.md +329 -0
  21. package/copilot/prompts/status.prompt.md +424 -0
  22. package/copilot/prompts/swab.prompt.md +217 -0
  23. package/cursor/README.md +224 -0
  24. package/cursor/cc.md +183 -0
  25. package/cursor/cc.mdc +69 -0
  26. package/cursor/commands/create-adr.md +504 -0
  27. package/cursor/commands/create-spec.md +430 -0
  28. package/cursor/commands/edit-spec.md +405 -0
  29. package/cursor/commands/execute-task.md +514 -0
  30. package/cursor/commands/explain-code.md +289 -0
  31. package/cursor/commands/initialize.md +397 -0
  32. package/cursor/commands/new-command.md +312 -0
  33. package/cursor/commands/plan-product.md +466 -0
  34. package/cursor/commands/research.md +317 -0
  35. package/cursor/commands/status.md +413 -0
  36. package/cursor/commands/swab.md +209 -0
  37. package/cursor/docs/best-practices.md +74 -0
  38. package/cursor/integrations/azure-devops/create-azure-work-items.md +403 -0
  39. package/cursor/integrations/azure-devops/sync-azure-work-items.md +486 -0
  40. package/cursor/integrations/github/create-github-issues.md +765 -0
  41. package/cursor/integrations/github/scripts/create-issues-batch.sh +272 -0
  42. package/cursor/integrations/github/sync-github-issues.md +237 -0
  43. package/cursor/integrations/github/sync.md +305 -0
  44. package/manifest.json +381 -0
  45. package/package.json +58 -0
  46. package/windsurf/README.md +254 -0
  47. package/windsurf/rules/cc.md +5 -0
  48. package/windsurf/workflows/create-adr.md +331 -0
  49. package/windsurf/workflows/create-spec.md +280 -0
  50. package/windsurf/workflows/edit-spec.md +273 -0
  51. package/windsurf/workflows/execute-task.md +276 -0
  52. package/windsurf/workflows/explain-code.md +292 -0
  53. package/windsurf/workflows/initialize.md +298 -0
  54. package/windsurf/workflows/new-command.md +321 -0
  55. package/windsurf/workflows/status.md +213 -0
@@ -0,0 +1,514 @@
1
+ # Execute Task Command (cc: execute-task)
2
+
3
+ ## Overview
4
+
5
+ Execute a specific task and its sub-tasks systematically following a Test-Driven Development (TDD) workflow. This command reads task specifications from `.code-captain/specs/` directories and implements features with comprehensive testing, following established code standards and best practices.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ cc: execute-task
11
+ ```
12
+
13
+ **Note:** This command automatically detects and lists available task specifications for selection, or executes a specific task if context is clear.
14
+
15
+ ## CRITICAL REQUIREMENT: 100% Test Pass Rate
16
+
17
+ **⚠️ ZERO TOLERANCE FOR FAILING TESTS ⚠️**
18
+
19
+ This command enforces strict test validation:
20
+ - **NO story can be marked "COMPLETED" with ANY failing tests**
21
+ - **100% test pass rate is MANDATORY before completion**
22
+ - **"Edge case" or "minor" test failures are NOT acceptable**
23
+ - **Implementation is considered incomplete until all tests pass**
24
+
25
+ If tests fail, the story remains "IN PROGRESS" until all failures are resolved.
26
+
27
+ ## Command Process
28
+
29
+ ### Step 1: Task Discovery & Selection
30
+
31
+ **Scan for available specifications:**
32
+
33
+ - Search `.code-captain/specs/` for dated specification folders
34
+ - Load user stories from `user-stories/` folders in each spec
35
+ - Read `user-stories/README.md` for story overview and progress
36
+ - Parse individual `story-N-{name}.md` files for available tasks
37
+ - Present available stories and tasks organized by specification
38
+
39
+ **Create execution todo tracking:**
40
+
41
+ Use `todo_write` to track the execution process:
42
+
43
+ ```json
44
+ {
45
+ "todos": [
46
+ {
47
+ "id": "task-discovery",
48
+ "content": "Discover and select task from available specifications",
49
+ "status": "in_progress"
50
+ },
51
+ {
52
+ "id": "context-gathering",
53
+ "content": "Gather context from spec documents and codebase analysis",
54
+ "status": "pending"
55
+ },
56
+ {
57
+ "id": "subtask-execution",
58
+ "content": "Execute all subtasks in TDD order",
59
+ "status": "pending"
60
+ },
61
+ {
62
+ "id": "test-verification",
63
+ "content": "Verify all task-specific tests pass",
64
+ "status": "pending"
65
+ },
66
+ {
67
+ "id": "task-completion",
68
+ "content": "Update task status and mark complete",
69
+ "status": "pending"
70
+ }
71
+ ]
72
+ }
73
+ ```
74
+
75
+ **Story selection process:**
76
+
77
+ 1. **If multiple specs exist**: Present selection menu with spec dates and story summaries
78
+ 2. **If single spec exists**: Show available stories and their tasks within that specification
79
+ 3. **If story/task specified**: Validate story exists and select specific task for execution
80
+ 4. **If no specs exist**: Guide user to run `cc: create-spec` first
81
+
82
+ **Selection format:**
83
+ ```
84
+ Available specifications:
85
+ ├── 2024-01-15-user-auth/ (3 stories, 12 total tasks)
86
+ │ ├── Story 1: User Registration (5 tasks) - Not Started
87
+ │ ├── Story 2: User Login (4 tasks) - Not Started
88
+ │ └── Story 3: Password Reset (3 tasks) - Not Started
89
+ └── 2024-01-20-payment-system/ (2 stories, 8 total tasks)
90
+ ├── Story 1: Payment Processing (5 tasks) - In Progress (2/5)
91
+ └── Story 2: Refund Management (3 tasks) - Not Started
92
+ ```
93
+
94
+ ### Step 2: Context Gathering & Analysis
95
+
96
+ **Load specification context:**
97
+
98
+ - Read primary spec document: `spec.md`
99
+ - Load user stories overview: `user-stories/README.md`
100
+ - Read selected story file: `user-stories/story-N-{name}.md`
101
+ - Review technical specifications: `sub-specs/technical-spec.md`
102
+ - Parse task breakdown from individual story file
103
+
104
+ **Analyze current codebase:**
105
+
106
+ Use `codebase_search` to understand:
107
+
108
+ - Current architecture and patterns
109
+ - Related existing functionality
110
+ - Integration points for new features
111
+ - Testing frameworks and conventions
112
+
113
+ **Load project standards:**
114
+
115
+ - Code style guide: `.code-captain/docs/code-style.md`
116
+ - Technology stack: `.code-captain/docs/tech-stack.md`
117
+ - Best practices: `.code-captain/docs/best-practices.md`
118
+
119
+ ### Step 3: Story & Task Analysis
120
+
121
+ **Parse selected story structure:**
122
+
123
+ - Load complete story file: `user-stories/story-N-{name}.md`
124
+ - Extract user story, acceptance criteria, and implementation tasks
125
+ - Analyze task dependencies and execution order within the story
126
+ - Understand test requirements (first task typically writes tests)
127
+ - Plan implementation approach based on story's task breakdown
128
+
129
+ **Validate TDD approach within story:**
130
+
131
+ - **First task**: Should write tests for the story functionality
132
+ - **Middle tasks**: Implement functionality to pass tests (max 5-7 tasks total)
133
+ - **Final task**: Verify all tests pass and acceptance criteria are met
134
+ - **Integration considerations**: Update adjacent/related tests as needed
135
+
136
+ **Example story structure verification:**
137
+
138
+ ```markdown
139
+ # Story 1: User Authentication
140
+
141
+ ## User Story
142
+ **As a** new user
143
+ **I want to** register with email and password
144
+ **So that** I can access personalized features
145
+
146
+ ## Acceptance Criteria
147
+ - [ ] User can register with valid email/password
148
+ - [ ] Email validation prevents invalid formats
149
+ - [ ] Password meets security requirements
150
+
151
+ ## Implementation Tasks
152
+ - [ ] 1.1 Write tests for authentication middleware
153
+ - [ ] 1.2 Implement JWT token generation
154
+ - [ ] 1.3 Create password hashing utilities
155
+ - [ ] 1.4 Build login/logout endpoints
156
+ - [ ] 1.5 Verify all tests pass and acceptance criteria met
157
+ ```
158
+
159
+ ### Step 4: Pre-Implementation Preparation
160
+
161
+ **Create execution tracking:**
162
+
163
+ Update todos to reflect specific story tasks:
164
+
165
+ ```json
166
+ {
167
+ "todos": [
168
+ {
169
+ "id": "story-1-task-1",
170
+ "content": "1.1 Write tests for authentication middleware (Story 1: User Authentication)",
171
+ "status": "in_progress"
172
+ },
173
+ {
174
+ "id": "story-1-task-2",
175
+ "content": "1.2 Implement JWT token generation (Story 1: User Authentication)",
176
+ "status": "pending"
177
+ },
178
+ {
179
+ "id": "story-1-task-3",
180
+ "content": "1.3 Create password hashing utilities (Story 1: User Authentication)",
181
+ "status": "pending"
182
+ },
183
+ {
184
+ "id": "story-1-task-4",
185
+ "content": "1.4 Build login/logout endpoints (Story 1: User Authentication)",
186
+ "status": "pending"
187
+ },
188
+ {
189
+ "id": "story-1-task-5",
190
+ "content": "1.5 Verify all tests pass and acceptance criteria met (Story 1: User Authentication)",
191
+ "status": "pending"
192
+ }
193
+ ]
194
+ }
195
+ ```
196
+
197
+ **Validate testing setup:**
198
+
199
+ - Confirm testing framework is configured
200
+ - Verify test directories and naming conventions
201
+ - Check existing test patterns and utilities
202
+ - Ensure test runner is functional
203
+
204
+ ### Step 5: Story Task Execution (TDD Workflow)
205
+
206
+ **Execute story tasks in sequential order:**
207
+
208
+ #### Task 1: Write Tests (Test-First Approach)
209
+
210
+ **Actions:**
211
+
212
+ - Write comprehensive test cases for the entire feature
213
+ - Include unit tests, integration tests, and edge cases
214
+ - Cover happy path, error conditions, and boundary cases
215
+ - Ensure tests fail appropriately (red phase)
216
+
217
+ **Test categories to include:**
218
+
219
+ - **Unit tests**: Individual function/method testing
220
+ - **Integration tests**: Component interaction testing
221
+ - **Edge cases**: Boundary conditions and error scenarios
222
+ - **Acceptance tests**: User story validation
223
+
224
+ #### Tasks 2-N: Implementation (Green Phase)
225
+
226
+ **For each implementation task within the story:**
227
+
228
+ 1. **Focus on specific functionality**: Implement only what's needed for current task
229
+ 2. **Make tests pass**: Write minimal code to satisfy failing tests
230
+ 3. **Update related tests**: Modify adjacent tests if behavior changes
231
+ 4. **Maintain compatibility**: Ensure no regressions in existing functionality
232
+ 5. **Refactor when green**: Improve code quality while tests remain passing
233
+
234
+ **Implementation approach:**
235
+
236
+ - Start with simplest implementation that passes tests
237
+ - Add complexity incrementally as required by test cases
238
+ - Keep tests passing at each step
239
+ - Refactor for clarity and maintainability
240
+
241
+ #### Final Task: Test & Acceptance Verification
242
+
243
+ **CRITICAL: 100% Test Pass Rate Required**
244
+
245
+ **Mandatory Actions (ALL must succeed before story completion):**
246
+
247
+ 1. **Run complete test suite for this story**
248
+ 2. **Achieve 100% pass rate for ALL tests** - NO EXCEPTIONS
249
+ 3. **Verify no regressions in existing test suites**
250
+ 4. **Validate all acceptance criteria are met for the user story**
251
+ 5. **Confirm story delivers the specified user value**
252
+
253
+ **⚠️ STORY CANNOT BE MARKED COMPLETE WITH ANY FAILING TESTS ⚠️**
254
+
255
+ If ANY tests fail:
256
+ - **STOP IMMEDIATELY** - Do not mark story as complete
257
+ - Debug and fix each failing test
258
+ - Re-run test suite until 100% pass rate achieved
259
+ - Only then proceed to mark story as complete
260
+
261
+ ### Step 6: Story-Specific Test Validation
262
+
263
+ **Run targeted test validation:**
264
+
265
+ Use available testing tools to verify:
266
+
267
+ - All tests written in first task are passing
268
+ - New functionality works as specified in user story
269
+ - All acceptance criteria are satisfied
270
+ - No regressions introduced to existing features
271
+ - Performance requirements are met (if specified)
272
+
273
+ **Test execution strategy:**
274
+
275
+ - **First**: Run only tests for current story/feature
276
+ - **Then**: Run related test suites to check for regressions
277
+ - **Finally**: Consider full test suite if significant changes made
278
+ - **Acceptance**: Validate user story acceptance criteria are met
279
+
280
+ **Failure handling:**
281
+
282
+ **ZERO TOLERANCE FOR FAILING TESTS:**
283
+ - **If ANY tests fail**: Story CANNOT be marked complete
284
+ - **Required action**: Debug and fix ALL failing tests before proceeding
285
+ - **No exceptions**: "Edge case" or "minor" failing tests are NOT acceptable
286
+ - **If performance issues**: Optimize implementation until all tests pass
287
+ - **If regressions found**: Fix regressions - story completion is blocked until resolved
288
+
289
+ **Failure Resolution Process:**
290
+ 1. Identify root cause of each failing test
291
+ 2. Fix implementation to make test pass
292
+ 3. Re-run ALL tests to ensure 100% pass rate
293
+ 4. Repeat until NO tests fail
294
+ 5. Only then mark story as complete
295
+
296
+ ### Step 7: Story Completion & Status Updates
297
+
298
+ **Update story file status:**
299
+
300
+ Mark completed tasks in the individual story file (`user-stories/story-N-{name}.md`):
301
+
302
+ ```markdown
303
+ # Story 1: User Authentication
304
+
305
+ > **Status:** Completed ✅
306
+ > **Priority:** High
307
+ > **Dependencies:** None
308
+
309
+ ## User Story
310
+ **As a** new user
311
+ **I want to** register with email and password
312
+ **So that** I can access personalized features
313
+
314
+ ## Acceptance Criteria
315
+ - [x] User can register with valid email/password ✅
316
+ - [x] Email validation prevents invalid formats ✅
317
+ - [x] Password meets security requirements ✅
318
+
319
+ ## Implementation Tasks
320
+ - [x] 1.1 Write tests for authentication middleware ✅
321
+ - [x] 1.2 Implement JWT token generation ✅
322
+ - [x] 1.3 Create password hashing utilities ✅
323
+ - [x] 1.4 Build login/logout endpoints ✅
324
+ - [x] 1.5 Verify all tests pass and acceptance criteria met ✅
325
+
326
+ ## Definition of Done
327
+ - [x] All tasks completed ✅
328
+ - [x] All acceptance criteria met ✅
329
+ - [x] **ALL tests passing (100% pass rate)** ✅ **MANDATORY**
330
+ - [x] Code reviewed ✅
331
+ - [x] Documentation updated ✅
332
+
333
+ **NOTE:** Story CANNOT be marked complete without 100% test pass rate
334
+ ```
335
+
336
+ **Update stories overview:**
337
+
338
+ Update progress tracking in `user-stories/README.md`:
339
+
340
+ ```markdown
341
+ | Story | Title | Status | Tasks | Progress |
342
+ |-------|-------|--------|-------|----------|
343
+ | 1 | User Authentication | Completed ✅ | 5 | 5/5 ✅ |
344
+ | 2 | Password Reset | Not Started | 4 | 0/4 |
345
+ | 3 | Profile Management | Not Started | 6 | 0/6 |
346
+
347
+ **Total Progress:** 5/15 tasks (33%)
348
+ ```
349
+
350
+ **Document completion:**
351
+
352
+ - Update spec status if all stories in the specification are complete
353
+ - Note any deviations from original plan in story notes
354
+ - Document lessons learned or improvements made
355
+ - Identify any follow-up tasks or technical debt
356
+
357
+ **Present completion summary:**
358
+
359
+ **ONLY present if ALL tests pass (100% pass rate):**
360
+
361
+ ```
362
+ Story completed successfully:
363
+
364
+ **Story:** Story 1: User Authentication
365
+ **Tasks completed:** 5/5 ✅
366
+ **Acceptance criteria met:** 3/3 ✅
367
+ **Tests written:** 12 test cases
368
+ **Tests passing:** 12/12 (100%) ✅ REQUIRED FOR COMPLETION
369
+ **Files modified:** 6 files
370
+ **User value delivered:** New users can register with email/password and access personalized features
371
+
372
+ Current specification progress: 5/15 tasks (33%)
373
+
374
+ Next available stories:
375
+ - Story 2: Password Reset (4 tasks) - Not Started
376
+ - Story 3: Profile Management (6 tasks) - Not Started
377
+
378
+ Would you like to proceed with the next story?
379
+ ```
380
+
381
+ **If ANY tests fail, present this instead:**
382
+
383
+ ```
384
+ Story implementation INCOMPLETE - Tests failing:
385
+
386
+ **Story:** Story 1: User Authentication
387
+ **Tasks completed:** 5/5 (implementation done, but validation failed)
388
+ **Tests written:** 12 test cases
389
+ **Tests passing:** 10/12 (83%) ❌ COMPLETION BLOCKED
390
+ **Failing tests:** 2 tests must be fixed before story completion
391
+ **Status:** IN PROGRESS - Cannot mark complete until 100% test pass rate
392
+
393
+ REQUIRED ACTIONS:
394
+ 1. Debug and fix all failing tests
395
+ 2. Re-run test suite to achieve 100% pass rate
396
+ 3. Only then mark story as complete
397
+ ```
398
+
399
+ ## Tool Integration
400
+
401
+ **Primary Code Captain tools:**
402
+
403
+ - `todo_write` - Progress tracking throughout execution
404
+ - `codebase_search` - Understanding existing architecture and patterns
405
+ - `file_search` - Locating relevant specifications and test files
406
+ - `read_file` - Loading spec documents and existing code
407
+ - `search_replace` / `MultiEdit` - Implementing code changes
408
+ - `run_terminal_cmd` - Executing tests and build processes
409
+
410
+ **Parallel execution opportunities:**
411
+
412
+ - Context gathering (multiple spec files, codebase analysis)
413
+ - Test file analysis (existing patterns, framework configuration)
414
+ - Implementation validation (running tests, checking integration)
415
+
416
+ ## Integration with Code Captain Ecosystem
417
+
418
+ **Specification dependency:**
419
+
420
+ - Requires existing spec created by `cc: create-spec`
421
+ - Uses story breakdown from `user-stories/` folder in spec directories
422
+ - Loads individual story files: `user-stories/story-N-{name}.md`
423
+ - Tracks progress in `user-stories/README.md`
424
+ - Follows technical approach from `sub-specs/technical-spec.md`
425
+
426
+ **Code style compliance:**
427
+
428
+ - Adheres to patterns in `.code-captain/docs/code-style.md`
429
+ - Uses technology stack from `.code-captain/docs/tech-stack.md`
430
+ - Follows best practices from `.code-captain/docs/best-practices.md`
431
+
432
+ **Cross-command integration:**
433
+
434
+ - Complements `cc: create-spec` for complete development workflow
435
+ - Can trigger `cc: research` if unknown technologies encountered
436
+ - Integrates with testing and validation workflows
437
+
438
+ ## Quality Standards
439
+
440
+ **Test-Driven Development:**
441
+
442
+ - Tests written before implementation
443
+ - **100% test pass rate MANDATORY before task completion**
444
+ - **ZERO TOLERANCE for failing tests - no story completion with any failures**
445
+ - Comprehensive coverage including edge cases
446
+ - Regression testing for existing functionality
447
+ - Failed tests = incomplete implementation that must be fixed
448
+
449
+ **Code quality requirements:**
450
+
451
+ - Follows established project patterns and conventions
452
+ - Maintains backward compatibility unless specified otherwise
453
+ - Implements proper error handling and validation
454
+ - Includes appropriate logging and monitoring
455
+
456
+ **Documentation standards:**
457
+
458
+ - Code changes include appropriate comments
459
+ - Complex logic is documented inline
460
+ - API changes are reflected in technical specifications
461
+ - Task completion updates specification status
462
+
463
+ ## Error Handling & Recovery
464
+
465
+ **Common failure scenarios:**
466
+
467
+ - **No specifications found**: Guide to `cc: create-spec`
468
+ - **Test framework issues**: Provide setup guidance
469
+ - **Implementation conflicts**: Suggest conflict resolution
470
+ - **Performance issues**: Recommend optimization approaches
471
+
472
+ **Blocking issue management:**
473
+
474
+ If blocked by technical issues:
475
+
476
+ ```markdown
477
+ - [ ] N.X Task description ⚠️ Blocking issue: [DESCRIPTION]
478
+ ```
479
+
480
+ Update story status and notes section to document the blocking issue.
481
+
482
+ **Resolution strategies:**
483
+
484
+ 1. Try alternative implementation approach
485
+ 2. Research solution using `cc: research`
486
+ 3. Break down task into smaller components
487
+ 4. Maximum 3 attempts before escalating or documenting as blocked
488
+
489
+ ## Best Practices
490
+
491
+ **TDD adherence:**
492
+
493
+ - Always start with failing tests
494
+ - Implement minimal code to pass tests
495
+ - Refactor only when tests are green
496
+ - **MANDATORY: 100% test pass rate before story completion**
497
+ - **NO EXCEPTIONS: Failing tests = incomplete story**
498
+
499
+ **Incremental development:**
500
+
501
+ - Complete story tasks sequentially
502
+ - Verify functionality at each step
503
+ - Commit working code frequently
504
+ - Test integration points early
505
+ - Validate acceptance criteria incrementally
506
+
507
+ **Communication:**
508
+
509
+ - Update story file status immediately after task completion
510
+ - Update README.md progress tracking after story completion
511
+ - Document any deviations from specification in story notes
512
+ - Note technical decisions and rationale in story file
513
+ - Highlight areas requiring future attention
514
+ - Ensure user value is clearly demonstrated upon story completion