@codemcp/workflows-core 3.1.22 → 3.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.
Files changed (80) hide show
  1. package/package.json +8 -3
  2. package/resources/templates/architecture/arc42/arc42-template-EN.md +1077 -0
  3. package/resources/templates/architecture/arc42/images/01_2_iso-25010-topics-EN.drawio-2023.png +0 -0
  4. package/resources/templates/architecture/arc42/images/01_2_iso-25010-topics-EN.drawio.png +0 -0
  5. package/resources/templates/architecture/arc42/images/05_building_blocks-EN.png +0 -0
  6. package/resources/templates/architecture/arc42/images/08-concepts-EN.drawio.png +0 -0
  7. package/resources/templates/architecture/arc42/images/arc42-logo.png +0 -0
  8. package/resources/templates/architecture/c4.md +224 -0
  9. package/resources/templates/architecture/freestyle.md +53 -0
  10. package/resources/templates/architecture/none.md +17 -0
  11. package/resources/templates/design/comprehensive.md +207 -0
  12. package/resources/templates/design/freestyle.md +37 -0
  13. package/resources/templates/design/none.md +17 -0
  14. package/resources/templates/requirements/ears.md +90 -0
  15. package/resources/templates/requirements/freestyle.md +42 -0
  16. package/resources/templates/requirements/none.md +17 -0
  17. package/resources/workflows/big-bang-conversion.yaml +539 -0
  18. package/resources/workflows/boundary-testing.yaml +334 -0
  19. package/resources/workflows/bugfix.yaml +185 -0
  20. package/resources/workflows/business-analysis.yaml +671 -0
  21. package/resources/workflows/c4-analysis.yaml +485 -0
  22. package/resources/workflows/epcc.yaml +161 -0
  23. package/resources/workflows/greenfield.yaml +189 -0
  24. package/resources/workflows/minor.yaml +127 -0
  25. package/resources/workflows/posts.yaml +207 -0
  26. package/resources/workflows/slides.yaml +256 -0
  27. package/resources/workflows/tdd.yaml +157 -0
  28. package/resources/workflows/waterfall.yaml +195 -0
  29. package/.turbo/turbo-build.log +0 -4
  30. package/src/config-manager.ts +0 -96
  31. package/src/conversation-manager.ts +0 -489
  32. package/src/database.ts +0 -427
  33. package/src/file-detection-manager.ts +0 -302
  34. package/src/git-manager.ts +0 -64
  35. package/src/index.ts +0 -28
  36. package/src/instruction-generator.ts +0 -210
  37. package/src/interaction-logger.ts +0 -109
  38. package/src/logger.ts +0 -353
  39. package/src/path-validation-utils.ts +0 -261
  40. package/src/plan-manager.ts +0 -323
  41. package/src/project-docs-manager.ts +0 -523
  42. package/src/state-machine-loader.ts +0 -365
  43. package/src/state-machine-types.ts +0 -72
  44. package/src/state-machine.ts +0 -370
  45. package/src/system-prompt-generator.ts +0 -122
  46. package/src/template-manager.ts +0 -328
  47. package/src/transition-engine.ts +0 -386
  48. package/src/types.ts +0 -60
  49. package/src/workflow-manager.ts +0 -606
  50. package/test/unit/conversation-manager.test.ts +0 -179
  51. package/test/unit/custom-workflow-loading.test.ts +0 -174
  52. package/test/unit/directory-linking-and-extensions.test.ts +0 -338
  53. package/test/unit/file-linking-integration.test.ts +0 -256
  54. package/test/unit/git-commit-integration.test.ts +0 -91
  55. package/test/unit/git-manager.test.ts +0 -86
  56. package/test/unit/install-workflow.test.ts +0 -138
  57. package/test/unit/instruction-generator.test.ts +0 -247
  58. package/test/unit/list-workflows-filtering.test.ts +0 -68
  59. package/test/unit/none-template-functionality.test.ts +0 -224
  60. package/test/unit/project-docs-manager.test.ts +0 -337
  61. package/test/unit/state-machine-loader.test.ts +0 -234
  62. package/test/unit/template-manager.test.ts +0 -217
  63. package/test/unit/validate-workflow-name.test.ts +0 -150
  64. package/test/unit/workflow-domain-filtering.test.ts +0 -75
  65. package/test/unit/workflow-enum-generation.test.ts +0 -92
  66. package/test/unit/workflow-manager-enhanced-path-resolution.test.ts +0 -369
  67. package/test/unit/workflow-manager-path-resolution.test.ts +0 -150
  68. package/test/unit/workflow-migration.test.ts +0 -155
  69. package/test/unit/workflow-override-by-name.test.ts +0 -116
  70. package/test/unit/workflow-prioritization.test.ts +0 -38
  71. package/test/unit/workflow-validation.test.ts +0 -303
  72. package/test/utils/e2e-test-setup.ts +0 -453
  73. package/test/utils/run-server-in-dir.sh +0 -27
  74. package/test/utils/temp-files.ts +0 -308
  75. package/test/utils/test-access.ts +0 -79
  76. package/test/utils/test-helpers.ts +0 -286
  77. package/test/utils/test-setup.ts +0 -78
  78. package/tsconfig.build.json +0 -21
  79. package/tsconfig.json +0 -8
  80. package/vitest.config.ts +0 -18
@@ -0,0 +1,334 @@
1
+ # yaml-language-server: $schema=../state-machine-schema.json
2
+ ---
3
+ name: 'boundary-testing'
4
+ description: 'A comprehensive workflow for creating boundary and API tests for systems. Focuses on establishing comprehensive test coverage of system interfaces and business boundaries for validation, compliance, or modernization purposes.'
5
+ initial_state: 'architecture_analysis'
6
+
7
+ # Enhanced metadata for better discoverability
8
+ metadata:
9
+ domain: 'architecture'
10
+ complexity: 'medium'
11
+ bestFor:
12
+ - 'System boundary testing'
13
+ - 'API and interface validation'
14
+ - 'Compliance testing requirements'
15
+ - 'System behavior documentation'
16
+ useCases:
17
+ - 'Create comprehensive test suite for existing system'
18
+ - 'Establish system behavior baseline for compliance'
19
+ - 'Document and validate system interfaces'
20
+ examples:
21
+ - 'Create API test suite for microservices architecture'
22
+ - 'Build boundary tests for compliance validation'
23
+ - 'Establish comprehensive system test coverage'
24
+
25
+ # States with default instructions and transitions
26
+ states:
27
+ architecture_analysis:
28
+ description: 'Analyze existing system architecture and identify system boundaries'
29
+ default_instructions: >
30
+ You are in the architecture analysis phase for boundary testing workflow.
31
+
32
+ **Your Tasks:**
33
+ 1. **Reference Architecture Documentation**: Check if $ARCHITECTURE_DOC exists and reference it for system understanding
34
+ 2. **Search for Architecture**: If $ARCHITECTURE_DOC is not available, search the project for architecture documentation (README.md, docs/, ARCHITECTURE.md, etc.). Enhance the existing $ARCHITECTURE_DOC with your findings
35
+ 3. **Analyze Codebase**: Examine the codebase to understand system structure, technology stack, and architectural patterns
36
+ 4. **Identify System Boundaries**: Map external interfaces, APIs, and integration points
37
+ 5. **Document Findings**: Update the plan file with architecture analysis findings
38
+
39
+ **Interview the User (External Factors Only):**
40
+ - "Who are the main consumers or users of this system?"
41
+ - "What are the performance requirements or SLAs for this system?"
42
+ - "Are there any compliance or regulatory requirements we need to consider?"
43
+ - "What are the peak usage patterns or load characteristics?"
44
+
45
+ **Best Practices to Apply:**
46
+ - Focus on understanding system boundaries rather than internal implementation details
47
+ - Identify all external touchpoints (APIs, databases, file systems, message queues)
48
+ - Consider both synchronous and asynchronous communication patterns
49
+ - Understand business context and criticality of different system functions
50
+
51
+ Update the plan file with your findings and mark completed tasks.
52
+ transitions:
53
+ - trigger: 'analysis_complete'
54
+ to: 'interface_discovery'
55
+ additional_instructions: 'Architecture analysis complete! Now systematically identify all system interfaces, APIs, and external boundaries. Use your architecture understanding to guide the discovery process.'
56
+ transition_reason: 'System architecture is understood, ready for interface discovery'
57
+
58
+ interface_discovery:
59
+ description: 'Discover and catalog all system interfaces, APIs, and external boundaries'
60
+ default_instructions: >
61
+ You are in the interface discovery phase. Use your architecture analysis to systematically identify all system interfaces.
62
+
63
+ **Your Tasks:**
64
+ 1. **Catalog APIs**: Identify all REST APIs, SOAP services, GraphQL endpoints, or other web services
65
+ 2. **Database Interfaces**: Document database connections, schemas, and data access patterns
66
+ 3. **File System Interfaces**: Identify file I/O operations, configuration files, and data files
67
+ 4. **Message Interfaces**: Find message queues, event streams, or pub/sub mechanisms
68
+ 5. **External Service Calls**: Document calls to external systems, third-party APIs, or services
69
+ 6. **User Interfaces**: Identify web UIs, desktop applications, or command-line interfaces
70
+ 7. **Document Interface Contracts**: For each interface, document expected inputs, outputs, and protocols
71
+
72
+ **Interview the User (External Context Only):**
73
+ - "What are the expected response times for different types of requests?"
74
+ - "Are there any seasonal or time-based usage patterns we should consider?"
75
+ - "Are there any data privacy or security constraints on specific interfaces?"
76
+
77
+ **Best Practices to Apply:**
78
+ - Use code analysis to scan for HTTP clients, database connections, file operations
79
+ - Look for configuration files that might reveal external dependencies
80
+ - Check for API documentation, OpenAPI specs, or service contracts
81
+ - Consider both inbound interfaces (what calls this system) and outbound interfaces (what this system calls)
82
+ - Document data formats, protocols, and authentication mechanisms
83
+
84
+ Update the plan file with discovered interfaces and mark completed tasks.
85
+ transitions:
86
+ - trigger: 'need_more_analysis'
87
+ to: 'architecture_analysis'
88
+ additional_instructions: 'Interface discovery revealed gaps in architecture understanding. Focus on the specific areas that need clarification.'
89
+ transition_reason: 'Interface work revealed need for additional architecture analysis'
90
+
91
+ - trigger: 'discovery_complete'
92
+ to: 'business_domain_analysis'
93
+ additional_instructions: 'Interface discovery complete! Now organize the cataloged interfaces by business domains using Domain-Driven Design principles. Focus on identifying logical boundaries and domain relationships.'
94
+ transition_reason: 'System interfaces are cataloged, ready for business domain organization'
95
+
96
+ business_domain_analysis:
97
+ description: 'Organize system interfaces by business domains and logical boundaries using DDD principles'
98
+ default_instructions: >
99
+ You are in the business domain analysis phase. Apply Domain-Driven Design principles to organize interfaces by business boundaries.
100
+
101
+ **Your Tasks:**
102
+ 1. **Apply DDD Principles**: Use Domain-Driven Design concepts to identify bounded contexts and business domains
103
+ 2. **Group Interfaces**: Organize discovered interfaces by business functionality and logical boundaries
104
+ 3. **Identify Business Capabilities**: Map interfaces to business capabilities and use cases
105
+ 4. **Define Domain Boundaries**: Establish clear boundaries between different business domains
106
+ 5. **Document Domain Model**: Create a clear mapping of business domains to system interfaces
107
+
108
+ **Interview the User (Business Context Only):**
109
+ - "What are the main business capabilities or functions this system provides?"
110
+ - "Which business functions are most critical to your organization?"
111
+ - "Are there any business processes that span multiple system interfaces?"
112
+
113
+ **Best Practices to Apply:**
114
+ - Use DDD concepts: Bounded Context, Aggregate, Domain Service, Repository patterns
115
+ - Group interfaces that serve the same business capability
116
+ - Consider data ownership and business rules when defining boundaries
117
+ - Look for natural seams where business logic is separated
118
+ - Think about how business users would naturally group functionality
119
+
120
+ **Domain Organization Methodologies:**
121
+ - **Event Storming**: Consider business events and workflows
122
+ - **Capability Mapping**: Group by business capabilities
123
+ - **Data Flow Analysis**: Follow data ownership and lifecycle
124
+ - **User Journey Mapping**: Group by user workflows and scenarios
125
+
126
+ Update the plan file with domain organization and validate with the user.
127
+ transitions:
128
+ - trigger: 'refine_domains'
129
+ to: 'business_domain_analysis'
130
+ transition_reason: 'Domain organization needs refinement based on user feedback'
131
+
132
+ - trigger: 'need_more_discovery'
133
+ to: 'interface_discovery'
134
+ additional_instructions: 'Domain analysis revealed missing interfaces or unclear boundaries. Focus on discovering additional interfaces in the identified business domains.'
135
+ transition_reason: 'Domain work revealed need for additional interface discovery'
136
+
137
+ - trigger: 'domains_complete'
138
+ to: 'test_strategy_design'
139
+ additional_instructions: 'Business domain organization complete! Now design a comprehensive testing strategy based on the identified business boundaries. Focus on creating domain-specific test approaches.'
140
+ transition_reason: 'Business domains are organized, ready for test strategy design'
141
+
142
+ test_strategy_design:
143
+ description: 'Design comprehensive testing strategy organized by business boundaries'
144
+ default_instructions: >
145
+ You are in the test strategy design phase. Create a comprehensive testing approach based on business domain organization.
146
+
147
+ **Your Tasks:**
148
+ 1. **Design Domain-Based Testing**: Create test strategies for each business domain identified
149
+ 2. **Define Test Objectives**: Establish clear objectives for what the tests should validate
150
+ 3. **Plan Test Types**: Design mix of unit, integration, API, and end-to-end tests
151
+ 4. **Test Data Strategy**: Plan test data management and test environment setup
152
+ 5. **Coverage Strategy**: Ensure comprehensive coverage of all business boundaries
153
+ 6. **Validation Approach**: Define how to validate that tests meet their objectives
154
+
155
+ **Interview the User (Requirements & Constraints):**
156
+ - "Are there specific compliance or regulatory testing requirements?"
157
+ - "What are the acceptable performance thresholds for different operations?"
158
+ - "Are there any budget or timeline constraints for test development?"
159
+
160
+ **Best Practices to Apply:**
161
+ - **Test Pyramid**: Balance unit tests, integration tests, and end-to-end tests
162
+ - **Contract Testing**: Test API contracts and interface agreements
163
+ - **Property-Based Testing**: Test business rules and invariants
164
+ - **Boundary Testing**: Focus on edge cases and boundary conditions
165
+ - **Error Path Testing**: Ensure error handling is properly tested
166
+ - **Data-Driven Testing**: Use realistic data scenarios
167
+
168
+ **Testing Strategy Framework:**
169
+ - **Functional Validation**: Ensure system functions meet business requirements
170
+ - **Business Rule Validation**: Core business logic behaves correctly
171
+ - **Integration Testing**: External system interactions work correctly
172
+ - **Error Handling**: Failures and exceptions are handled appropriately
173
+ - **Performance Baseline**: Establish performance expectations
174
+
175
+ Update the plan file with detailed test strategy and validate with the user.
176
+ transitions:
177
+ - trigger: 'refine_strategy'
178
+ to: 'test_strategy_design'
179
+ transition_reason: 'Test strategy needs refinement based on user feedback'
180
+
181
+ - trigger: 'need_domain_refinement'
182
+ to: 'business_domain_analysis'
183
+ additional_instructions: 'Test strategy design revealed issues with domain boundaries. Refine the business domain organization based on testing insights.'
184
+ transition_reason: 'Test strategy work revealed need to refine domain boundaries'
185
+
186
+ - trigger: 'strategy_complete'
187
+ to: 'test_suite_implementation'
188
+ additional_instructions: 'Test strategy design complete! Now implement the comprehensive test suite based on your strategy. Focus on building domain-organized tests that validate system boundaries.'
189
+ transition_reason: 'Test strategy is complete, ready for implementation'
190
+
191
+ test_suite_implementation:
192
+ description: 'Implement comprehensive test suite organized by business domains'
193
+ default_instructions: >
194
+ You are in the test suite implementation phase. Build the comprehensive test suite based on your strategy.
195
+
196
+ **Your Tasks:**
197
+ 1. **Implement Domain Tests**: Create test suites for each business domain
198
+ 2. **API Testing**: Implement comprehensive API tests for all discovered interfaces
199
+ 3. **Integration Testing**: Build tests for external system interactions
200
+ 4. **End-to-End Testing**: Create business workflow tests that span multiple domains
201
+ 5. **Test Data Management**: Implement test data setup and teardown
202
+ 6. **Test Organization**: Structure tests clearly by business domain and functionality
203
+ 7. **Documentation**: Document test purposes, expected outcomes, and maintenance procedures
204
+
205
+ **Interview the User (Priorities & Preferences):**
206
+ - "Which business domain should we prioritize for test implementation?"
207
+ - "Are there any specific test frameworks or tools you prefer or are required to use?"
208
+
209
+ **Best Practices to Apply:**
210
+ - **Clear Test Organization**: Group tests by business domain and functionality
211
+ - **Descriptive Test Names**: Make test purposes clear from names
212
+ - **Independent Tests**: Ensure tests can run independently and in any order
213
+ - **Reliable Test Data**: Use consistent, predictable test data
214
+ - **Fast Feedback**: Prioritize fast-running tests for quick validation
215
+ - **Maintainable Tests**: Write tests that are easy to understand and modify
216
+
217
+ **Implementation Guidelines:**
218
+ - Start with the most critical business domains
219
+ - Implement happy path scenarios first, then edge cases
220
+ - Use appropriate test frameworks for the technology stack
221
+ - Mock external dependencies appropriately
222
+ - Include both positive and negative test cases
223
+ - Document test setup and execution procedures
224
+
225
+ Update the plan file with implementation progress and mark completed tasks.
226
+ transitions:
227
+ - trigger: 'need_strategy_refinement'
228
+ to: 'test_strategy_design'
229
+ additional_instructions: 'Test implementation revealed issues with the strategy. Refine the test strategy based on implementation learnings.'
230
+ transition_reason: 'Implementation work revealed need to refine test strategy'
231
+
232
+ - trigger: 'implementation_complete'
233
+ to: 'validation'
234
+ additional_instructions: 'Test suite implementation complete! Now validate the comprehensive test suite and establish system testing baseline. Focus on verifying test coverage and effectiveness.'
235
+ transition_reason: 'Test suite implementation complete, ready for validation'
236
+
237
+ validation:
238
+ description: 'Validate test coverage and establish comprehensive system testing baseline'
239
+ default_instructions: >
240
+ You are in the validation phase. Validate the comprehensive test suite and establish system testing baseline.
241
+
242
+ **Your Tasks:**
243
+ 1. **Test Coverage Analysis**: Validate that all business domains and interfaces are covered
244
+ 2. **Baseline Establishment**: Run all tests against the system to establish baseline behavior
245
+ 3. **Test Quality Review**: Ensure tests are reliable, maintainable, and comprehensive
246
+ 4. **Documentation Review**: Validate that test documentation is complete and clear
247
+ 5. **Execution Validation**: Ensure all tests run successfully and provide clear results
248
+ 6. **Handoff Preparation**: Prepare test suite for ongoing use and maintenance
249
+
250
+ **Review and Present to User:**
251
+ - Review test coverage across all business domains and present findings
252
+ - Present test organization and structure for user evaluation
253
+ - Review test documentation completeness and present summary
254
+ - Present test execution results and reliability assessment
255
+
256
+ **Best Practices to Apply:**
257
+ - **Coverage Validation**: Ensure all critical paths are tested
258
+ - **Baseline Documentation**: Document expected results and behaviors
259
+ - **Test Reliability**: Verify tests are stable and repeatable
260
+ - **Clear Reporting**: Ensure test results are easy to understand
261
+ - **Maintenance Planning**: Document how to maintain and update tests
262
+ - **Knowledge Transfer**: Ensure team understands test suite organization
263
+
264
+ **Validation Checklist:**
265
+ - All business domains have comprehensive test coverage
266
+ - All discovered interfaces are tested
267
+ - Tests run successfully against the system
268
+ - Test results establish clear behavioral baseline
269
+ - Test documentation is complete and clear
270
+ - Test suite is ready for ongoing use and maintenance
271
+
272
+ Update the plan file with validation results and mark completed tasks.
273
+ transitions:
274
+ - trigger: 'refine_validation'
275
+ to: 'validation'
276
+ transition_reason: 'Validation needs refinement to ensure test suite quality'
277
+
278
+ - trigger: 'need_more_implementation'
279
+ to: 'test_suite_implementation'
280
+ additional_instructions: 'Validation revealed gaps in test implementation. Focus on implementing additional tests for the identified gaps.'
281
+ transition_reason: 'Validation work revealed need for additional test implementation'
282
+
283
+ - trigger: 'validation_complete'
284
+ to: 'finalize'
285
+ additional_instructions: 'Validation is complete! Clean up test development artifacts and finalize documentation to ensure everything is ready for delivery.'
286
+ transition_reason: 'Test suite validation complete, ready for finalization'
287
+
288
+ finalize:
289
+ description: 'Code cleanup and documentation finalization'
290
+ default_instructions: >
291
+ You are in the finalize phase. This phase ensures code quality and documentation accuracy through systematic cleanup and review.
292
+
293
+ **STEP 1: Code Cleanup**
294
+ Systematically clean up development artifacts:
295
+
296
+ 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during test development.
297
+ Look for language-specific debug output methods (console logging, print statements, debug output functions).
298
+ Remove any debugging statements that were added for development purposes.
299
+
300
+ 2. **Review TODO/FIXME Comments**:
301
+ - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred
302
+ - Remove completed TODOs
303
+ - Convert remaining TODOs to proper issue tracking if needed
304
+
305
+ 3. **Remove Debugging Code Blocks**:
306
+ - Remove temporary debugging code, test code blocks, and commented-out code
307
+ - Clean up any experimental code that's no longer needed
308
+ - Ensure proper error handling replaces temporary debug logging
309
+
310
+ **STEP 2: Documentation Review**
311
+ Review and update documentation to reflect final test implementation:
312
+
313
+ 1. **Compare Against Implementation**: Review documentation against actual implemented test suite
314
+ 2. **Update Changed Sections**: Only modify documentation sections that have functional changes
315
+ 3. **Remove Development Progress**: Remove references to development iterations, progress notes, and temporary decisions
316
+ 4. **Focus on Final State**: Ensure documentation describes the final test suite state, not the development process
317
+ 5. **Verify Test Documentation**: Ensure test documentation and maintenance procedures are complete and accurate
318
+
319
+ **STEP 3: Final Validation**
320
+ - Run existing tests to ensure cleanup didn't break functionality
321
+ - Verify test documentation accuracy with a final review
322
+ - Ensure test suite is ready for ongoing use and maintenance
323
+
324
+ Update the plan file with finalization progress and mark completed tasks.
325
+ transitions:
326
+ - trigger: 'need_test_changes'
327
+ to: 'test_suite_implementation'
328
+ additional_instructions: 'Finalization revealed issues with the test suite. Focus on addressing the specific problems identified during final review.'
329
+ transition_reason: 'Finalization revealed issues requiring test implementation changes'
330
+
331
+ - trigger: 'finalization_complete'
332
+ to: 'architecture_analysis'
333
+ additional_instructions: 'Boundary testing workflow complete! Test suite is ready for ongoing use and maintenance. Prepare for next boundary testing project.'
334
+ transition_reason: 'Test suite finalization complete, ready for production use'
@@ -0,0 +1,185 @@
1
+ # yaml-language-server: $schema=../state-machine-schema.json
2
+ ---
3
+ name: 'bugfix'
4
+ description: 'A focused workflow for bug fixing: Reproduce, Analyze, Fix, Verify - optimized for debugging and fixing existing issues'
5
+ initial_state: 'reproduce'
6
+
7
+ # Enhanced metadata for better discoverability
8
+ metadata:
9
+ domain: 'code'
10
+ complexity: 'medium'
11
+ bestFor:
12
+ - 'Bug fixes'
13
+ - 'Issue resolution'
14
+ - 'Error debugging'
15
+ - 'Performance problems'
16
+ useCases:
17
+ - 'Fixing a crash or error'
18
+ - 'Resolving incorrect behavior'
19
+ - 'Performance optimization'
20
+ examples:
21
+ - 'Fix login authentication error'
22
+ - 'Resolve memory leak issue'
23
+ - 'Fix incorrect calculation in reports'
24
+
25
+ # States with default instructions and transitions
26
+ states:
27
+ reproduce:
28
+ description: 'Reproduce and understand the bug'
29
+ default_instructions: |
30
+ You are in the bug reproduction phase. Work to reliably reproduce the reported bug by gathering specific information:
31
+ • What are the exact OS, browser/runtime versions, and hardware specs?
32
+ • What is the precise sequence of actions that trigger the bug?
33
+ • What error messages, logs, or stack traces are available?
34
+ • Does this happen every time or intermittently?
35
+ • How many users are affected and what is the business impact?
36
+ Create test cases that demonstrate the problem. Document your findings in the plan file.
37
+ transitions:
38
+ - trigger: 'bug_reproduced'
39
+ to: 'analyze'
40
+ additional_instructions: 'Bug successfully reproduced! ✅ Now transition to analysis phase.'
41
+ transition_reason: 'Bug reproduced successfully, ready to analyze root cause'
42
+
43
+ - trigger: 'bug_not_reproducible'
44
+ to: 'reproduce'
45
+ instructions: >
46
+ Unable to reproduce the bug with current information. Gather more details about the environment,
47
+ conditions, or steps that might be missing. Contact the reporter for additional information if needed.
48
+ Continue attempting reproduction with new information.
49
+ transition_reason: 'Bug could not be reproduced, need more information'
50
+
51
+ - trigger: 'abandon_bug'
52
+ to: 'reproduce'
53
+ additional_instructions: 'Bug investigation abandoned. Clean up any reproduction work and prepare for new bug reports.'
54
+ transition_reason: 'Bug investigation abandoned'
55
+
56
+ analyze:
57
+ description: 'Analyze the bug and identify root cause'
58
+ default_instructions: 'You are in the bug analysis phase. Examine the code paths involved in the bug, identify the root cause, and understand why the issue occurs. Use debugging tools, add logging, and trace through the problematic code. Document your analysis in the plan file.'
59
+ transitions:
60
+ - trigger: 'need_more_reproduction'
61
+ to: 'reproduce'
62
+ additional_instructions: 'Analysis revealed need for additional reproduction scenarios. Focus on reproducing the specific conditions identified during analysis.'
63
+ transition_reason: 'Analysis revealed need for additional reproduction work'
64
+
65
+ - trigger: 'root_cause_identified'
66
+ to: 'fix'
67
+ additional_instructions: 'Root cause identified! ✅ Now transition to fix phase. Document the fix approach in the plan file.'
68
+ transition_reason: 'Root cause identified, ready to implement fix'
69
+ review_perspectives:
70
+ - perspective: 'architect'
71
+ prompt: "Review root cause analysis and ensure the proposed fix doesn't introduce architectural issues or technical debt. Consider the broader system impact of the proposed solution."
72
+ - perspective: 'security_expert'
73
+ prompt: "Evaluate if the bug has security implications and ensure the fix doesn't introduce new vulnerabilities. Review the security aspects of the proposed solution."
74
+
75
+ - trigger: 'abandon_bug'
76
+ to: 'reproduce'
77
+ additional_instructions: 'Bug analysis abandoned. Clean up any analysis work and prepare for new bug reports.'
78
+ transition_reason: 'Bug analysis abandoned'
79
+
80
+ fix:
81
+ description: 'Implement the bug fix'
82
+ default_instructions: |
83
+ Implement the solution based on your analysis. If $DESIGN_DOC exists, follow the design from $DESIGN_DOC. Before implementing, assess the approach:
84
+ • How critical is this system? What is the blast radius if the fix causes issues?
85
+ • Should this be a minimal fix or a more comprehensive solution?
86
+ Make targeted changes that address the root cause without introducing new issues. Be careful to maintain existing functionality while fixing the bug.
87
+ transitions:
88
+ - trigger: 'need_more_analysis'
89
+ to: 'analyze'
90
+ additional_instructions: 'Fix implementation revealed additional complexity or issues. Focus on analyzing the newly discovered aspects of the problem.'
91
+ transition_reason: 'Fix work revealed need for additional analysis'
92
+
93
+ - trigger: 'fix_implemented'
94
+ to: 'verify'
95
+ additional_instructions: 'Fix implemented! ✅ Now transition to verification phase. Document verification results in the plan file.'
96
+ transition_reason: 'Fix implemented, ready for verification'
97
+ review_perspectives:
98
+ - perspective: 'senior_software_developer'
99
+ prompt: 'Review fix implementation, code quality, and ensure the solution properly addresses the root cause. Check for potential side effects and code maintainability.'
100
+ - perspective: 'performance_engineer'
101
+ prompt: "Verify that the fix doesn't introduce performance regressions or new bottlenecks. Assess the performance impact of the implemented solution."
102
+
103
+ - trigger: 'abandon_bug'
104
+ to: 'reproduce'
105
+ additional_instructions: 'Bug fix abandoned. Clean up any fix work and prepare for new bug reports.'
106
+ transition_reason: 'Bug fix abandoned'
107
+
108
+ verify:
109
+ description: 'Verify the fix and ensure no regressions'
110
+ default_instructions: 'You are in the bug verification phase. Test the fix thoroughly to ensure the original bug is resolved and no new issues were introduced. Run existing tests, create new ones if needed, and verify the solution is robust.'
111
+ transitions:
112
+ - trigger: 'fix_needs_adjustment'
113
+ to: 'fix'
114
+ additional_instructions: 'Verification revealed issues with the current fix. Focus on addressing the specific problems identified during verification.'
115
+ transition_reason: 'Verification found issues requiring fix adjustments'
116
+
117
+ - trigger: 'need_more_analysis'
118
+ to: 'analyze'
119
+ additional_instructions: "Verification revealed the fix doesn't fully address the root cause. Focus on deeper analysis of the remaining issues."
120
+ transition_reason: 'Verification revealed need for additional analysis'
121
+
122
+ - trigger: 'bug_fixed'
123
+ to: 'finalize'
124
+ additional_instructions: 'Bug successfully fixed and verified! ✅ Now transition to finalization phase. Mark all verification tasks complete. Clean up verification work and prepare for new bug reports.'
125
+ transition_reason: 'Bug fix complete and verified, ready for next issue'
126
+
127
+ - trigger: 'abandon_bug'
128
+ to: 'reproduce'
129
+ additional_instructions: 'Bug verification abandoned. Clean up any verification work and prepare for new bug reports.'
130
+ transition_reason: 'Bug verification abandoned'
131
+
132
+ finalize:
133
+ description: 'Code cleanup and documentation finalization'
134
+ default_instructions: >
135
+ You are in the finalize phase. This phase ensures code quality and documentation accuracy through systematic cleanup and review.
136
+
137
+ **STEP 1: Code Cleanup**
138
+ Systematically clean up development artifacts:
139
+
140
+ 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during bug investigation.
141
+ Look for language-specific debug output methods (console logging, print statements, debug output functions).
142
+ Remove any debugging statements that were added for investigation purposes.
143
+
144
+ 2. **Review TODO/FIXME Comments**:
145
+ - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred
146
+ - Remove completed TODOs
147
+ - Convert remaining TODOs to proper issue tracking if needed
148
+
149
+ 3. **Remove Debugging Code Blocks**:
150
+ - Remove temporary debugging code, test code blocks, and commented-out code
151
+ - Clean up any experimental code that's no longer needed
152
+ - Ensure proper error handling replaces temporary debug logging
153
+
154
+ **STEP 2: Documentation Review**
155
+ Review and update documentation to reflect the bug fix:
156
+
157
+ 1. **Update Long-Term Memory Documents**: Based on what was actually implemented:
158
+ • If $DESIGN_DOC exists, update $DESIGN_DOC if design details were refined or changed during the fix
159
+ 2. **Compare Against Implementation**: Review documentation against the actual bug fix implemented
160
+ 3. **Update Changed Sections**: Only modify documentation sections that have functional changes
161
+ 4. **Remove Development Progress**: Remove references to investigation iterations, progress notes, and temporary decisions
162
+ 5. **Focus on Final State**: Ensure documentation describes the final fixed state, not the debugging process
163
+ 6. **Ask User to Review Document Updates**: Ask the document changes
164
+
165
+ **STEP 3: Final Validation**
166
+ - Run existing tests to ensure cleanup didn't break functionality
167
+ - Verify documentation accuracy with a final review
168
+ - Ensure bug fix is ready for production
169
+
170
+ Update the plan file with finalization progress and mark completed tasks.
171
+ transitions:
172
+ - trigger: 'need_fix_changes'
173
+ to: 'fix'
174
+ additional_instructions: 'Finalization revealed issues with the bug fix. Focus on addressing the specific problems identified during final review.'
175
+ transition_reason: 'Finalization revealed issues requiring fix changes'
176
+
177
+ - trigger: 'finalization_complete'
178
+ to: 'reproduce'
179
+ additional_instructions: 'Bug fix complete and finalized! Clean up finalization work and prepare for new bug reports.'
180
+ transition_reason: 'Bug fix complete and finalized, ready for next issue'
181
+
182
+ - trigger: 'abandon_bug'
183
+ to: 'reproduce'
184
+ additional_instructions: 'Bug finalization abandoned. Clean up any finalization work and prepare for new bug reports.'
185
+ transition_reason: 'Bug finalization abandoned'