@devobsessed/code-captain 0.1.0 → 0.2.1

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.
@@ -1,12 +1,13 @@
1
1
  ---
2
- mode: agent
2
+ agent: agent
3
+ description: "Generate comprehensive code explanations with diagrams"
3
4
  ---
4
5
 
5
- # Explain Code Command
6
+ # You are executing the Explain Code command.
6
7
 
7
- ## Overview
8
+ You MUST follow these instructions exactly. Do NOT describe this process — execute it.
8
9
 
9
- Provide comprehensive, AI-powered explanations of code segments, functions, classes, or entire files. This command combines natural language explanations with visual diagrams to help developers understand complex code quickly and thoroughly.
10
+ Your mission: Provide a comprehensive, visual explanation of the specified code target. Combine natural language explanations with Mermaid diagrams to help the developer understand the code quickly and thoroughly.
10
11
 
11
12
  ## Parameters
12
13
 
@@ -46,31 +47,31 @@ The command automatically:
46
47
 
47
48
  ## Output Structure
48
49
 
49
- All explanations are displayed in chat and automatically saved to `.code-captain/explanations/`
50
+ Display in chat and automatically save to `.code-captain/explanations/`.
50
51
 
51
52
  ### Chat Display
52
53
 
53
54
  ```
54
- 📋 Function Overview
55
+ Function Overview
55
56
  ├── Purpose: What this code does
56
57
  ├── Parameters: Input expectations
57
58
  ├── Return Value: What it outputs
58
59
  ├── Key Logic: Step-by-step breakdown
59
60
  └── Usage Examples: How to call it
60
61
 
61
- 🔄 Execution Flow
62
+ Execution Flow
62
63
  ├── [Flowchart diagram showing decision paths]
63
64
  ├── Decision points and branches
64
65
  ├── Error handling paths
65
66
  └── Performance characteristics
66
67
 
67
- 🏗️ Architecture Context
68
+ Architecture Context
68
69
  ├── Where this fits in the system
69
70
  ├── Dependencies and related components
70
71
  ├── Design patterns used
71
72
  └── Integration points
72
73
 
73
- Technical Details
74
+ Technical Details
74
75
  ├── Time complexity
75
76
  ├── Memory usage
76
77
  ├── Potential issues
@@ -79,6 +80,8 @@ All explanations are displayed in chat and automatically saved to `.code-captain
79
80
 
80
81
  ### Saved Format
81
82
 
83
+ Save as `.code-captain/explanations/[DATE]-[target-name].md`:
84
+
82
85
  ````markdown
83
86
  # Code Explanation: [Target Name]
84
87
 
@@ -116,99 +119,11 @@ _Generated by Code Captain on [timestamp]_
116
119
  _Last updated: [timestamp]_
117
120
  ````
118
121
 
119
- ## File Organization
120
-
121
- Saved explanations are stored with date prefixes for chronological organization:
122
-
123
- ```
124
- .code-captain/
125
- └── explanations/
126
- ├── 2024-01-15-AuthenticationFlow.md
127
- ├── 2024-01-16-PaymentProcessor.md
128
- ├── 2024-01-16-UserService.md
129
- └── 2024-01-17-SearchAlgorithm.md
130
- ```
131
-
132
- Files are named using the format: `[DATE]-[target-name].md` where DATE is YYYY-MM-DD format.
133
-
134
122
  ## Auto-Save Behavior
135
123
 
136
- All explanations are automatically saved to `.code-captain/explanations/` using the format `[DATE]-[target-name].md`.
137
-
138
124
  Get current date by running: `npx @devobsessed/code-captain date`
139
125
 
140
- **Example filename:** `.code-captain/explanations/2025-09-27-AuthenticationFlow.md`
141
-
142
- ## Integration Points
143
-
144
- ### With Other Commands
145
-
146
- ```
147
- # Saved explanations can be referenced by other commands
148
- /research authentication
149
- /create-spec payment-processing
150
- /execute-task "optimize the user search"
151
-
152
- # AI can access saved explanations from .code-captain/explanations/
153
- # to provide better context for other commands
154
- ```
155
-
156
- ### With IDE Integration
157
-
158
- - Hover over function calls to see saved explanations
159
- - Right-click context menu: "Explain with Code Captain"
160
- - Inline explanation widgets for complex code blocks
161
-
162
- ## Management Commands
163
-
164
- ```
165
- # List all saved explanations
166
- /list-explanations
167
-
168
- # Search explanations
169
- /search-explanations "authentication"
170
-
171
- # Show explanation history
172
- /explanation-history calculateDiscount
173
-
174
- # Update outdated explanations when code changes
175
- /refresh-explanations --check-code-changes
176
- ```
177
-
178
- ## Diagram Types Generated
179
-
180
- ### Flowcharts
181
-
182
- - Control flow through functions
183
- - Decision trees for complex logic
184
- - Error handling paths
185
-
186
- ### Sequence Diagrams
187
-
188
- - Function call sequences
189
- - API interaction flows
190
- - Database transaction flows
191
-
192
- ### Class Diagrams
193
-
194
- - Object relationships
195
- - Inheritance hierarchies
196
- - Dependency structures
197
-
198
- ### Architecture Diagrams
199
-
200
- - Component interactions
201
- - Data flow through system
202
- - Service communication patterns
203
-
204
- ## Output Characteristics
205
-
206
- All explanations use a consistent intermediate technical level that balances accessibility with depth:
207
-
208
- - **Technical but accessible**: Explains how the code works with some optimization details
209
- - **Full context**: Always includes related functions, dependencies, and architectural context
210
- - **Visual diagrams**: Every explanation includes appropriate flowcharts, sequence diagrams, or class diagrams
211
- - **Comprehensive coverage**: Shows how the code fits in the entire system
126
+ Save all explanations automatically to `.code-captain/explanations/` using the format `[DATE]-[target-name].md`.
212
127
 
213
128
  ## AI Processing Workflow
214
129
 
@@ -217,7 +132,7 @@ All explanations use a consistent intermediate technical level that balances acc
217
132
  3. **Explanation Generation**: Create intermediate-level natural language description
218
133
  4. **Diagram Creation**: Generate appropriate visual representations (flowcharts, sequence, class diagrams)
219
134
  5. **Formatting**: Structure output for both chat display and markdown file
220
- 6. **Auto-Save**: Save explanation to `.code-captain/explanations/` with date-prefixed filename `[DATE]-[target-name].md`
135
+ 6. **Auto-Save**: Save explanation to `.code-captain/explanations/` with date-prefixed filename
221
136
 
222
137
  ## Tool Integration
223
138
 
@@ -234,43 +149,3 @@ All explanations use a consistent intermediate technical level that balances acc
234
149
  - Explanations stored in `.code-captain/explanations/`
235
150
  - Date-prefixed filenames for chronological organization
236
151
  - Cross-references to related explanations and components
237
-
238
- ## Error Handling
239
-
240
- ### Common Issues
241
-
242
- - **Code not found**: "Could not locate [target]. Please check the path/name."
243
- - **Too complex**: "This code is very complex. Consider breaking into smaller explanations."
244
- - **Limited context**: "Some context may be missing. Ensure related files are accessible."
245
-
246
- ### Fallback Behaviors
247
-
248
- - If diagrams fail to generate, provide text-based flow description
249
- - If target is ambiguous, offer multiple options to choose from
250
- - If code is too large, suggest breaking into smaller segments
251
-
252
- ## Success Metrics
253
-
254
- Track effectiveness through:
255
-
256
- - Explanation clarity ratings from users
257
- - Frequency of re-explanations for same code
258
- - Time saved in code reviews and onboarding
259
- - Reduction in "what does this do?" questions during development
260
-
261
- ## Future Enhancements
262
-
263
- ### Planned Features
264
-
265
- - Interactive explanations with expandable sections
266
- - Voice-generated explanations for accessibility
267
- - Integration with code review tools
268
- - Automatic explanation updates when code changes
269
- - Explanation versioning and history tracking
270
-
271
- ### Advanced Capabilities
272
-
273
- - Performance profiling integration
274
- - Security vulnerability highlighting in explanations
275
- - Code quality suggestions as part of explanations
276
- - Integration with documentation generation tools
@@ -1,14 +1,13 @@
1
1
  ---
2
- mode: agent
2
+ agent: agent
3
+ description: "Analyze and set up project foundation with documentation"
3
4
  ---
4
5
 
5
- # Initialize Command
6
+ # You are executing the Initialize command.
6
7
 
7
- ## Overview
8
+ You MUST follow these instructions exactly. Do NOT describe this process — execute it.
8
9
 
9
- Analyze and set up technical foundation for either greenfield (new) or brownfield (existing) projects. This command intelligently detects project type, scans the codebase, and generates foundational documentation including technology stack analysis, code style guide, and architectural overview.
10
-
11
- ## Command Process
10
+ Your mission: Analyze the current project and set up the technical foundation. Detect whether this is a greenfield (new) or brownfield (existing) project, scan the codebase, and generate foundational documentation.
12
11
 
13
12
  ### Step 1: Project Type Detection
14
13
 
@@ -35,10 +34,10 @@ Analyze and set up technical foundation for either greenfield (new) or brownfiel
35
34
 
36
35
  Generate foundational documents in `.code-captain/docs/`:
37
36
 
38
- **tech-stack.md** - Complete technology inventory and analysis
39
- **code-style.md** - Observed patterns and coding conventions
40
- **objective.md** - Inferred or defined project purpose and goals
41
- **architecture.md** - System architecture overview and decisions
37
+ - **tech-stack.md** - Complete technology inventory and analysis
38
+ - **code-style.md** - Observed patterns and coding conventions
39
+ - **objective.md** - Inferred or defined project purpose and goals
40
+ - **architecture.md** - System architecture overview and decisions
42
41
 
43
42
  ### Step 4: Next Steps Recommendation
44
43
 
@@ -61,5 +60,3 @@ Provide clear guidance on next steps, typically:
61
60
  **Documentation organization:**
62
61
  - Progress documented in `.code-captain/initialization-progress.md`
63
62
  - Results organized in `.code-captain/docs/` folder
64
-
65
- This command provides comprehensive project analysis and setup using GitHub Copilot's native capabilities.
@@ -1,12 +1,13 @@
1
1
  ---
2
- mode: agent
2
+ agent: agent
3
+ description: "Create new Code Captain commands following established patterns"
3
4
  ---
4
5
 
5
- # New Command Creator
6
+ # You are executing the New Command command.
6
7
 
7
- ## Overview
8
+ You MUST follow these instructions exactly. Do NOT describe this process — execute it.
8
9
 
9
- A meta command that creates new Code Captain commands following established patterns and conventions. This command generates properly structured command files, updates documentation, and ensures consistency across the Code Captain ecosystem.
10
+ Your mission: Create a new Code Captain command file following established patterns and conventions. Generate a properly structured prompt file and provide integration guidance.
10
11
 
11
12
  ## Examples
12
13
 
@@ -14,15 +15,13 @@ A meta command that creates new Code Captain commands following established patt
14
15
  # Create optimization command
15
16
  /new-command "optimize" "Performance optimization for slow code sections"
16
17
 
17
- # Create deployment command
18
+ # Create deployment command
18
19
  /new-command "deploy" "Deploy applications to various cloud platforms"
19
20
 
20
21
  # Create test generation command
21
22
  /new-command "test-gen" "Generate comprehensive test suites from existing code"
22
23
  ```
23
24
 
24
- ## Command Process
25
-
26
25
  ### Step 1: Command Specification Gathering
27
26
 
28
27
  **Initial Input Processing:**
@@ -47,15 +46,15 @@ Ask clarifying questions to build complete command specification:
47
46
 
48
47
  ```markdown
49
48
  ---
50
- mode: agent
49
+ agent: agent
50
+ description: "[Short description]"
51
51
  ---
52
52
 
53
- # [Command Name] Command
53
+ # You are executing the [Command Name] command.
54
54
 
55
- ## Overview
56
- [Generated from description and clarifying questions]
55
+ You MUST follow these instructions exactly. Do NOT describe this process — execute it.
57
56
 
58
- ## Command Process
57
+ Your mission: [Generated from description and clarifying questions]
59
58
 
60
59
  ### Step 1: [Phase Name]
61
60
  [Generated workflow steps]
@@ -65,15 +64,9 @@ mode: agent
65
64
 
66
65
  ## Tool Integration
67
66
  [Generated based on command type]
68
-
69
- ## AI Implementation Prompt
70
- [Generated if AI coordination needed]
71
-
72
- ## Integration Notes
73
- [Generated integration details]
74
67
  ```
75
68
 
76
- **Template Sections Based on Command Type and Execution Style:**
69
+ **Template Adaptation Based on Execution Style:**
77
70
 
78
71
  **Contract Style Commands** (like `/create-spec`, `/create-adr`):
79
72
  - Phase 1: Contract Establishment (No File Creation)
@@ -88,36 +81,6 @@ mode: agent
88
81
  - Clear step-by-step execution
89
82
  - Progress feedback and completion confirmation
90
83
 
91
- **Foundation Commands:**
92
- - Project initialization steps
93
- - Planning and product setup workflows
94
- - Configuration and environment setup
95
-
96
- **Analysis Commands:**
97
- - Context scanning steps
98
- - Research and analysis workflows
99
- - Documentation review and assessment
100
-
101
- **Specification Commands:**
102
- - Specification creation and editing
103
- - Structured documentation workflows
104
- - Contract-based clarification processes
105
-
106
- **Implementation Commands:**
107
- - TDD workflows if applicable
108
- - Code modification steps
109
- - Task execution procedures
110
-
111
- **Quality Commands:**
112
- - Health and status reporting
113
- - QA-oriented checks and validations
114
- - Lightweight remediation workflows
115
-
116
- **Meta Commands:**
117
- - Command scaffolding and documentation updates
118
- - Code understanding and explanation
119
- - Process and tooling refinements
120
-
121
84
  ### Step 3: Documentation Integration
122
85
 
123
86
  **Provide guidance for documentation updates:**
@@ -142,15 +105,15 @@ mode: agent
142
105
 
143
106
  **Present Summary:**
144
107
  ```
145
- New command prompt created successfully!
108
+ New command prompt created successfully!
146
109
 
147
- 📁 Generated Content:
110
+ Generated Content:
148
111
  - .github/prompts/[command-name].prompt.md
149
112
  - Complete prompt file structure with frontmatter
150
113
  - Usage examples and documentation
151
114
  - Integration guidelines and recommendations
152
115
 
153
- 🚀 Command Ready:
116
+ Command Ready:
154
117
  Usage: /[command-name] [args]
155
118
  Implementation: Follow generated prompt structure
156
119
  ```
@@ -159,159 +122,30 @@ mode: agent
159
122
 
160
123
  1. **Consistent Structure** - All generated commands follow established patterns
161
124
  2. **Clear Documentation** - Each section has purpose and implementation details
162
- 3. **Integration Guidance** - Provides recommendations for documentation and workflow integration
125
+ 3. **Integration Guidance** - Provide recommendations for documentation and workflow integration
163
126
  4. **Validation Required** - Check for conflicts and proper structure
164
127
  5. **Template Flexibility** - Adapt template based on command type and requirements
165
- 6. **Language & Shell Agnostic** - Commands should work across different programming languages and shell environments, using Code Captain's existing tools rather than making assumptions about tech stack
166
-
167
- ## AI Implementation Prompt
128
+ 6. **Language & Shell Agnostic** - Commands should work across different programming languages and shell environments
168
129
 
169
- ```
170
- You are creating a new Code Captain command following established patterns.
171
-
172
- MISSION: Generate a complete, well-structured command file and update documentation.
173
-
174
- COMMAND SPECIFICATION:
175
- - Name: {command_name}
176
- - Description: {description}
177
- - Category: {category}
178
- - Execution Style: {contract_style_or_direct_execution}
179
- - Usage Pattern: {usage_pattern}
180
- - AI Coordination: {needs_ai_prompts}
181
- - Output Location: {output_location}
182
- - Tool Integration: {copilot_tools}
183
- - Workflow Steps: {workflow_phases}
184
-
185
- TEMPLATE STRUCTURE:
186
- 1. Frontmatter: mode: agent
187
- 2. Title: # [Command Name] Command
188
- 3. Overview: Purpose and capabilities
189
- 4. Command Process: Detailed step-by-step workflow
190
- 5. Tool Integration: GitHub Copilot tool coordination
191
- 6. AI Implementation Prompt: (if AI coordination needed)
192
- 7. Integration Notes: Platform coordination
193
-
194
- TEMPLATE ADAPTATION RULES:
195
- - Contract Style commands: Include clarification phases, contract establishment, critical analysis, user agreement checkpoints
196
- - Direct Execution commands: Include immediate action workflows, minimal interaction, clear progress feedback
197
- - Foundation commands: Include project initialization, planning workflows, configuration setup
198
- - Analysis commands: Include context scanning, research workflows, documentation assessment
199
- - Specification commands: Include specification creation, structured documentation, contract-based processes
200
- - Implementation commands: Include TDD workflows, code modification, task execution
201
- - Quality commands: Include health and status reporting, QA-oriented checks and validations, lightweight remediation workflows
202
- - Meta commands: Include command scaffolding and documentation updates, code understanding and explanation, process and tooling refinements
203
- - All commands: Include clear examples, tool coordination, progress tracking
204
- - CRITICAL: Be language and shell agnostic - use codebase, search instead of language-specific commands or hardcoded file extensions
205
-
206
- DOCUMENTATION GUIDANCE:
207
- Provide recommendations for integrating the new command:
208
- - Suggest workflow placement and related commands
209
- - Include usage examples and best practices
210
- - Recommend documentation structure and content
211
-
212
- OUTPUT REQUIREMENTS:
213
- 1. Generate complete .prompt.md file with frontmatter following the template
214
- 2. Provide integration recommendations and workflow guidance
215
- 3. Include clear usage examples and implementation notes
216
- 4. Ensure consistency with existing command patterns
217
- 5. Validate no conflicts with existing commands
218
-
219
- QUALITY CHECKS:
220
- - Command name follows naming conventions (lowercase, hyphens)
221
- - Usage examples are clear and practical
222
- - Workflow steps are actionable and specific
223
- - Integration points are clearly documented
224
- - All sections serve a clear purpose
225
- - No hardcoded language assumptions or shell-specific commands
226
- - Uses Code Captain's existing tools (codebase, search) rather than system-specific commands
227
- ```
228
-
229
- ## Implementation Details
230
-
231
- ### Command Name Validation
232
-
233
- **Validation Rules:**
234
- - Lowercase letters, numbers, hyphens only
235
- - No spaces or special characters
236
- - Maximum 20 characters
237
- - Cannot start with number or hyphen
238
- - Must not conflict with existing commands
239
-
240
- **Validation Process:**
241
- ```bash
242
- # Check format
243
- echo "command-name" | grep -E '^[a-z][a-z0-9-]*[a-z0-9]$'
244
-
245
- # Check conflicts
246
- ls .github/prompts/ | grep "^command-name.prompt.md$"
247
- ```
248
-
249
- ### Command Categories
130
+ ## Command Categories
250
131
 
251
132
  Commands are organized into logical categories:
252
133
 
253
134
  1. **Foundation** (`initialize`, `plan-product`)
254
- 2. **Analysis** (`research`, `create-adr`)
255
- 3. **Specification** (`create-spec`, `edit-spec`)
256
- 4. **Implementation** (`execute-task`)
257
- 5. **Quality** (`status`, `swab`)
258
- 6. **Meta** (`new-command`, `explain-code`)
259
-
260
- ### Template Selection Logic
261
-
262
- **Command Categories and Templates:**
263
-
264
- 1. **Foundation** (`initialize`, `plan-product`)
265
- - Project initialization workflows
266
- - Planning and setup processes
267
- - Configuration and environment preparation
268
-
269
135
  2. **Analysis** (`research`, `create-adr`)
270
- - Context scanning workflows
271
- - Documentation generation
272
- - Research and assessment emphasis
273
-
274
136
  3. **Specification** (`create-spec`, `edit-spec`)
275
- - Interactive clarification phases
276
- - Structured output formats
277
- - Contract-based workflows
278
-
279
137
  4. **Implementation** (`execute-task`)
280
- - Code modification workflows
281
- - TDD patterns
282
- - Task execution steps
283
-
284
138
  5. **Quality** (`status`, `swab`)
285
- - Health and status reporting
286
- - QA-oriented checks and validations
287
- - Lightweight remediation workflows
288
-
289
139
  6. **Meta** (`new-command`, `explain-code`)
290
- - Command scaffolding and documentation updates
291
- - Code understanding and explanation
292
- - Process and tooling refinements
293
-
294
-
295
-
296
- ### Error Handling
297
-
298
- **Common Issues:**
299
- - **Duplicate command name**: Check existing prompts, suggest alternatives
300
- - **Invalid command name format**: Provide format guidance and examples
301
- - **Documentation integration conflicts**: Use safe merge strategies, manual review if needed
302
- - **Template generation errors**: Validate inputs, provide clear error messages
303
-
304
- **Error Messages:**
305
- ```
306
- ❌ Command creation failed: [specific reason]
307
140
 
308
- Suggestions:
309
- - Check command name format (lowercase, hyphens only)
310
- - Ensure name doesn't conflict with existing commands
311
- - Verify all required inputs are provided
141
+ ## Command Name Validation
312
142
 
313
- Try: /new-command "valid-name" "clear description"
314
- ```
143
+ **Validation Rules:**
144
+ - Lowercase letters, numbers, hyphens only
145
+ - No spaces or special characters
146
+ - Maximum 20 characters
147
+ - Cannot start with number or hyphen
148
+ - Must not conflict with existing commands
315
149
 
316
150
  ## Tool Integration
317
151
 
@@ -325,25 +159,3 @@ Try: /new-command "valid-name" "clear description"
325
159
  - Prompt files stored in `.github/prompts/`
326
160
  - Integration guidance for documentation updates
327
161
  - Validation and conflict checking before creation
328
-
329
- ## Integration Notes
330
-
331
- This command integrates with Code Captain by:
332
-
333
- 1. **Following Established Patterns** - Uses same structure as existing prompts
334
- 2. **Maintaining Consistency** - Ensures all new prompts match style and format
335
- 3. **Documentation Guidance** - Provides clear recommendations for integration and usage
336
- 4. **Extensibility** - Makes it easy to add new capabilities to Code Captain
337
- 5. **Quality Assurance** - Validates structure and prevents conflicts
338
-
339
- ## Future Enhancements
340
-
341
- Potential improvements (not in initial version):
342
-
343
- - **Template Library**: Multiple prompt templates for different use cases
344
- - **Interactive Wizard**: Step-by-step prompt creation with guidance
345
- - **Integration Testing**: Automated testing of generated prompts
346
- - **Version Control**: Track prompt changes and updates
347
- - **Command Dependencies**: Handle prompts that depend on other prompts
348
-
349
- But for now: Focus on core functionality - create well-structured prompts that integrate seamlessly with the existing Code Captain ecosystem.