@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,485 @@
1
+ # yaml-language-server: $schema=../state-machine-schema.json
2
+ ---
3
+ name: 'c4-analysis'
4
+ description: 'A comprehensive workflow for analyzing legacy systems using C4 methodology. Progressively understand system architecture from context to components, with scope limiting for large codebases.'
5
+ initial_state: 'discovery'
6
+
7
+ # Enhanced metadata for better discoverability
8
+ metadata:
9
+ domain: 'architecture'
10
+ complexity: 'medium'
11
+ bestFor:
12
+ - 'Legacy system analysis'
13
+ - 'System understanding and documentation'
14
+ - 'Architecture discovery'
15
+ - 'Modernization planning'
16
+ useCases:
17
+ - 'Analyze existing codebase for modernization'
18
+ - 'Document undocumented legacy systems'
19
+ - 'Understand system architecture before enhancements'
20
+ examples:
21
+ - 'Analyze a legacy Java monolith for microservices migration'
22
+ - 'Document architecture of inherited Node.js application'
23
+ - 'Understand legacy system before adding new features'
24
+ requiresDocumentation: true
25
+
26
+ # States with default instructions and transitions
27
+ states:
28
+ discovery:
29
+ description: 'Initial system discovery and inventory with scope limiting'
30
+ default_instructions: >
31
+ You are in the legacy system discovery phase. Create discovery notes file at .vibe/docs/DISCOVERY.md with this exact template content:
32
+
33
+ ```markdown
34
+ # Legacy System Discovery Notes
35
+
36
+ *This file serves as long-term memory for the C4 analysis workflow. It contains comprehensive findings and insights that persist across all analysis phases. Progress tracking is handled in the plan file.*
37
+
38
+ ## System Overview
39
+
40
+ ### Technology Stack
41
+ <!-- Record the identified technology stack -->
42
+ - **Primary Language**:
43
+ - **Framework**:
44
+ - **Build System**:
45
+ - **Database**:
46
+ - **Other Technologies**:
47
+
48
+ ### Repository Structure
49
+ <!-- Map the basic folder structure -->
50
+ ```
51
+ project-root/
52
+ ├── src/ # Source code
53
+ ├── docs/ # Documentation (if exists)
54
+ ├── tests/ # Test files
55
+ ├── config/ # Configuration files
56
+ ├── [other folders] # Other significant folders
57
+ └── [key files] # Important root-level files
58
+ ```
59
+
60
+ ### Key Configuration Files
61
+ <!-- List important configuration files found -->
62
+ - **package.json / pom.xml / build.gradle**: Build and dependency configuration
63
+ - **README.md**: Project documentation (if exists)
64
+ - **[Other config files]**: Purpose and significance
65
+
66
+ ## Existing Documentation
67
+ <!-- Record any existing documentation found -->
68
+ - **[Document 1]**: Location and content summary
69
+ - **[Document 2]**: Location and content summary
70
+ - **Documentation Quality**: Assessment of existing docs
71
+
72
+ ## System Architecture Findings
73
+
74
+ ### Context Level (C4 Level 1)
75
+ <!-- System context findings - updated during context analysis phase -->
76
+
77
+ #### External Systems
78
+ - **[External System 1]**: Purpose, communication method, data exchanged
79
+ - **[External System 2]**: Purpose, communication method, data exchanged
80
+
81
+ #### User Types
82
+ - **[User Type 1]**: Role, needs, interaction patterns
83
+ - **[User Type 2]**: Role, needs, interaction patterns
84
+
85
+ #### System Boundaries
86
+ - **Inside the system**: Core components and responsibilities
87
+ - **Outside the system**: External dependencies and interfaces
88
+
89
+ ### Container Level (C4 Level 2)
90
+ <!-- Container architecture findings - updated during container analysis phase -->
91
+
92
+ #### Identified Containers
93
+ - **[Container 1 Name]** - `path/to/container`
94
+ - **Technology**:
95
+ - **Purpose**:
96
+ - **Interfaces**:
97
+ - **Data Storage**:
98
+ - **Communication**: How it communicates with other containers
99
+
100
+ - **[Container 2 Name]** - `path/to/container`
101
+ - **Technology**:
102
+ - **Purpose**:
103
+ - **Interfaces**:
104
+ - **Data Storage**:
105
+ - **Communication**: How it communicates with other containers
106
+
107
+ #### Container Interactions
108
+ - **[Container A] → [Container B]**: Communication method and purpose
109
+ - **[Container B] → [External System]**: Communication method and purpose
110
+
111
+ ### Component Level (C4 Level 3)
112
+ <!-- Component analysis findings - updated during component analysis phase -->
113
+
114
+ #### Container 1 Components
115
+ - **[Component 1.1]** - `path/to/component`
116
+ - **Responsibilities**:
117
+ - **Interfaces**:
118
+ - **Dependencies**:
119
+ - **Design Patterns**:
120
+ - **Key Insights**:
121
+
122
+ - **[Component 1.2]** - `path/to/component`
123
+ - **Responsibilities**:
124
+ - **Interfaces**:
125
+ - **Dependencies**:
126
+ - **Design Patterns**:
127
+ - **Key Insights**:
128
+
129
+ #### Container 2 Components
130
+ - **[Component 2.1]** - `path/to/component`
131
+ - **Responsibilities**:
132
+ - **Interfaces**:
133
+ - **Dependencies**:
134
+ - **Design Patterns**:
135
+ - **Key Insights**:
136
+
137
+ - **[Component 2.2]** - `path/to/component`
138
+ - **Responsibilities**:
139
+ - **Interfaces**:
140
+ - **Dependencies**:
141
+ - **Design Patterns**:
142
+ - **Key Insights**:
143
+
144
+ ## Analysis Insights and Observations
145
+
146
+ ### Discovery Phase Insights
147
+ <!-- Key insights discovered during initial discovery -->
148
+
149
+ ### Context Analysis Insights
150
+ <!-- Important findings about system context and external interfaces -->
151
+
152
+ ### Container Analysis Insights
153
+ <!-- Key architectural insights about container structure and communication -->
154
+
155
+ ### Component Analysis Insights
156
+ <!-- Detailed insights about individual components and their design -->
157
+
158
+ ### Cross-Cutting Concerns
159
+ <!-- Insights that span multiple components or containers -->
160
+ - **Security**:
161
+ - **Performance**:
162
+ - **Data Flow**:
163
+ - **Error Handling**:
164
+
165
+ ## Technical Debt and Improvement Opportunities
166
+
167
+ ### Technical Debt Identified
168
+ <!-- Technical debt discovered during analysis -->
169
+ - **[Debt Item 1]**: Description, impact, and location
170
+ - **[Debt Item 2]**: Description, impact, and location
171
+
172
+ ### Modernization Opportunities
173
+ <!-- Areas identified for potential modernization -->
174
+ - **[Opportunity 1]**: Description, benefits, and approach
175
+ - **[Opportunity 2]**: Description, benefits, and approach
176
+
177
+ ### Architecture Improvements
178
+ <!-- Potential architectural improvements identified -->
179
+ - **[Improvement 1]**: Description, benefits, and implementation approach
180
+ - **[Improvement 2]**: Description, benefits, and implementation approach
181
+
182
+ ## API and Integration Analysis
183
+
184
+ ### External APIs
185
+ <!-- External APIs the system uses or provides -->
186
+ - **[API 1]**: Purpose, technology, testing approach
187
+ - **[API 2]**: Purpose, technology, testing approach
188
+
189
+ ### Internal Interfaces
190
+ <!-- Internal interfaces between components/containers -->
191
+ - **[Interface 1]**: Components involved, communication method
192
+ - **[Interface 2]**: Components involved, communication method
193
+
194
+ ### Testing Strategy Recommendations
195
+ <!-- Recommendations for end-to-end API testing -->
196
+ - **External API Testing**: Approach and tools
197
+ - **Internal Interface Testing**: Approach and tools
198
+ - **Test Data Strategy**: Data management approach
199
+
200
+ ## Questions and Unknowns
201
+
202
+ ### Open Questions
203
+ <!-- Questions that arose during analysis and need investigation -->
204
+ - **[Question 1]**: Description and why it's important
205
+ - **[Question 2]**: Description and why it's important
206
+
207
+ ### Areas Needing Further Investigation
208
+ <!-- Areas that need deeper analysis -->
209
+ - **[Area 1]**: What needs investigation and why
210
+ - **[Area 2]**: What needs investigation and why
211
+
212
+ ## Enhancement Readiness Assessment
213
+
214
+ ### Current State Assessment
215
+ - **Documentation Quality**:
216
+ - **Code Quality**:
217
+ - **Test Coverage**:
218
+ - **Development Environment**:
219
+ - **Deployment Process**:
220
+
221
+ ### Enhancement Recommendations
222
+ - **Immediate Improvements**: Quick wins that would help
223
+ - **Medium-term Enhancements**: Larger improvements to consider
224
+ - **Long-term Modernization**: Strategic modernization opportunities
225
+
226
+ ---
227
+
228
+ ## Instructions for Use
229
+
230
+ **Purpose**: This file serves as the comprehensive long-term memory for the C4 analysis workflow. All findings, insights, and discoveries should be recorded here for future reference.
231
+
232
+ **For the LLM**:
233
+ - **During Discovery**: Fill in system overview, technology stack, and initial architecture sketch
234
+ - **During Context Analysis**: Add context findings to the Context Level section
235
+ - **During Container Analysis**: Document container findings in the Container Level section
236
+ - **During Component Analysis**: Add detailed component analysis to the Component Level section
237
+ - **Throughout**: Add insights, observations, technical debt, and improvement opportunities as discovered
238
+
239
+ **Long-term Memory**: This file preserves all analysis findings and serves as the knowledge base for future development work. Unlike the plan file (which tracks progress), this file maintains the comprehensive understanding of the system.
240
+
241
+ **Reference**: This file should be referenced throughout the workflow and used as input for the final documentation consolidation phase.
242
+
243
+ ---
244
+
245
+ *This discovery file was created during C4 legacy system analysis and serves as the comprehensive long-term memory of all findings, insights, and architectural understanding.*
246
+ ```
247
+
248
+ **SCOPE LIMIT**: Focus ONLY on repository root, main config files, and top-level structure.
249
+
250
+ Tasks:
251
+ 1. Scan repository root for key files (package.json, pom.xml, build.gradle, README.md, etc.)
252
+ 2. Map basic folder structure (src/, docs/, tests/, config/, etc.)
253
+ 3. Identify technology stack from configuration files
254
+ 4. Look for existing documentation files
255
+ 5. Create hierarchical sketch of potential containers and components from folder structure
256
+ 6. Fill in the DISCOVERY.md template with your findings
257
+
258
+ Examples for Java: Look for Maven/Gradle structure, Spring configuration, package organization.
259
+ Examples for Node.js: Check package.json, identify Express/framework, examine folder structure.
260
+
261
+ Update plan file with discovery progress and add discovered containers/components as tasks for later phases.
262
+ transitions:
263
+ - trigger: 'continue_discovery'
264
+ to: 'discovery'
265
+ instructions: >
266
+ Continue discovery work. Expand the repository scan, refine the technology stack identification,
267
+ and enhance the hierarchical sketch of containers/components. Update DISCOVERY.md with new findings.
268
+ Add newly discovered items to the plan file as tasks for later analysis phases.
269
+ transition_reason: 'Discovery needs more investigation and refinement'
270
+
271
+ - trigger: 'discovery_complete'
272
+ to: 'context_analysis'
273
+ additional_instructions: >
274
+ Discovery is complete! ✅ Now set up project documentation and transition to context analysis.
275
+
276
+ 1. First, set up project documents for living documentation:
277
+ setup_project_docs({ architecture: "c4", requirements: "none", design: "comprehensive" })
278
+
279
+ 2. Read the created $ARCHITECTURE_DOC and $DESIGN_DOC files to understand their structure
280
+
281
+ 3. Begin enhancing these documents based on DISCOVERY.md findings and continue throughout context analysis.
282
+
283
+ Update the plan file with context analysis tasks and mark completed discovery tasks.
284
+ transition_reason: 'Initial discovery complete, ready for context analysis'
285
+
286
+ context_analysis:
287
+ description: 'System context analysis (C4 Level 1) - boundaries and external interfaces'
288
+ default_instructions: >
289
+ You are in the context analysis phase (C4 Level 1). Reference DISCOVERY.md for long-term memory.
290
+
291
+ **SCOPE LIMIT**: Focus ONLY on external interfaces and system boundaries.
292
+
293
+ Tasks:
294
+ 1. Identify external systems the legacy system communicates with
295
+ 2. Map user types and personas who interact with the system
296
+ 3. Document external dependencies (databases, APIs, services)
297
+ 4. Understand system boundaries and what's inside vs outside
298
+ 5. Map data flows between system and external entities
299
+ 6. **Continuously enhance $ARCHITECTURE_DOC with context findings**
300
+ 7. **Update $DESIGN_DOC with external interface details**
301
+
302
+ Examples for Java: Look for database connections, REST clients, message queues, external service calls.
303
+ Examples for Node.js: Check API endpoints, database connections, external service integrations.
304
+
305
+ Document findings in both DISCOVERY.md and the living architecture/design documents. Update plan file with context analysis progress.
306
+ transitions:
307
+ - trigger: 'refine_context'
308
+ to: 'context_analysis'
309
+ instructions: >
310
+ Continue context analysis. Investigate more external interfaces, clarify system boundaries,
311
+ and refine the understanding of external dependencies. Update DISCOVERY.md and plan file.
312
+ transition_reason: 'Context analysis needs further refinement'
313
+
314
+ - trigger: 'need_more_discovery'
315
+ to: 'discovery'
316
+ additional_instructions: 'Context analysis revealed gaps in discovery. Focus on the specific areas that need more investigation.'
317
+ transition_reason: 'Context work revealed need for additional discovery'
318
+
319
+ - trigger: 'context_complete'
320
+ to: 'container_analysis'
321
+ additional_instructions: >
322
+ Context analysis is complete! ✅ Now transition to container analysis phase (C4 Level 2).
323
+ Update the plan file with container analysis tasks and mark completed context tasks.
324
+ Before you start analyzing the containers, elaborate a plan together with the user how to document the container analysis:
325
+ - How to structure the files (one file per container or all in one file, shall a folder be created per container in which the components will be included later on?)
326
+ - How a component factsheet shall look like.
327
+ transition_reason: 'System context is understood, ready for container analysis'
328
+
329
+ container_analysis:
330
+ description: 'Container analysis (C4 Level 2) - high-level system architecture'
331
+ default_instructions: >
332
+ You are in the container analysis phase (C4 Level 2). Reference DISCOVERY.md for container sketch and long-term memory.
333
+
334
+ **SCOPE LIMIT**: Focus on major containers/services/modules only.
335
+
336
+ Tasks:
337
+ 1. Identify main application containers (web app, API, services)
338
+ 2. Map databases and data stores
339
+ 3. Understand deployment architecture
340
+ 4. Document communication patterns between containers
341
+ 5. **Enhance $ARCHITECTURE_DOC with C4 Level 2 (Container) findings**
342
+ 6. **Update $DESIGN_DOC with container interaction details**
343
+ 7. Update DISCOVERY.md with container analysis findings
344
+
345
+ Examples for Java: Identify Spring Boot applications, microservices, database layers, message brokers.
346
+ Examples for Node.js: Map Express apps, API services, database connections, background workers.
347
+
348
+ Document findings in DISCOVERY.md and continuously enhance the living architecture/design documents. Update plan file with container analysis progress and add component analysis tasks.
349
+ transitions:
350
+ - trigger: 'continue_container_analysis'
351
+ to: 'container_analysis'
352
+ instructions: >
353
+ Continue container analysis. Investigate more containers, refine communication patterns,
354
+ and enhance the architectural understanding. Update DISCOVERY.md and plan file.
355
+ transition_reason: 'Container analysis continues with more containers to analyze'
356
+
357
+ - trigger: 'need_context_refinement'
358
+ to: 'context_analysis'
359
+ additional_instructions: 'Container analysis revealed issues with context understanding. Refine the system context based on container insights.'
360
+ transition_reason: 'Container work revealed need to refine context understanding'
361
+
362
+ - trigger: 'containers_complete'
363
+ to: 'component_analysis'
364
+ additional_instructions: >
365
+ Container analysis is complete! ✅ Now transition to component analysis phase (C4 Level 3).
366
+ Before you start analyzing the components, elaborate a plan together with the user how to document the component analysis:
367
+ - How to structure the files (one file per component or all in one file)
368
+ - How a component factsheet shall look like.
369
+ Once this is done,
370
+ - note the template in the development plan
371
+ - include instructions how to create and link the files
372
+ transition_reason: 'Container architecture is understood, ready for detailed component analysis'
373
+
374
+ component_analysis:
375
+ description: 'Component analysis (C4 Level 3) - detailed component-by-component analysis'
376
+ default_instructions: >
377
+ You are in the component analysis phase (C4 Level 3). Reference DISCOVERY.md for component information and long-term memory.
378
+
379
+ **SCOPE LIMIT**: Analyze ONE component at a time. User selects which components to focus on.
380
+
381
+ Tasks:
382
+ 1. Select next component from plan file task list
383
+ 2. Deep dive into component responsibilities and interfaces
384
+ 3. Map internal component relationships and dependencies
385
+ 4. Document component-level design patterns
386
+ 5. **Enhance $DESIGN_DOC with detailed component analysis**
387
+ 6. **Update $ARCHITECTURE_DOC with C4 Level 3 (Component) details**
388
+ 7. Update DISCOVERY.md with component analysis findings
389
+ 8. Mark component as complete in plan file
390
+ 9. Ask user which component to analyze next
391
+
392
+ Examples for Java: Analyze Spring components, service classes, repository layers, controllers.
393
+ Examples for Node.js: Examine route handlers, service modules, data access layers, middleware.
394
+
395
+ Document findings in DISCOVERY.md and continuously enhance the living architecture/design documents. Track progress in plan file by marking completed component tasks.
396
+ transitions:
397
+ - trigger: 'analyze_next_component'
398
+ to: 'component_analysis'
399
+ instructions: >
400
+ Continue with next component analysis. Select another component from plan file task list,
401
+ perform detailed analysis, and mark it complete in plan file. Ask user for component priorities.
402
+ transition_reason: 'Continuing systematic component analysis'
403
+
404
+ - trigger: 'need_container_refinement'
405
+ to: 'container_analysis'
406
+ additional_instructions: 'Component analysis revealed issues with container understanding. Refine the container architecture based on component insights.'
407
+ transition_reason: 'Component work revealed need to refine container understanding'
408
+
409
+ - trigger: 'components_complete'
410
+ to: 'documentation_consolidation'
411
+ additional_instructions: >
412
+ Component analysis is complete! ✅ Now transition to documentation consolidation phase.
413
+ Update the plan file with documentation tasks and mark completed component tasks.
414
+ transition_reason: 'Component analysis complete, ready to consolidate documentation'
415
+
416
+ documentation_consolidation:
417
+ description: 'Consolidate findings into comprehensive documentation'
418
+ default_instructions: >
419
+ You are in the documentation consolidation phase. The $ARCHITECTURE_DOC and $DESIGN_DOC have been enhanced throughout the analysis phases.
420
+
421
+ Tasks:
422
+ 1. Review DISCOVERY.md for all findings and insights
423
+ 2. **Final review and polish of $ARCHITECTURE_DOC** (already created and enhanced)
424
+ 3. **Final review and polish of $DESIGN_DOC** (already created and enhanced)
425
+ 4. Ensure all C4 levels are comprehensively documented in architecture doc
426
+ 5. Prepare enhancement recommendations based on analysis
427
+ 6. Document modernization opportunities and technical debt
428
+ 7. Finalize API testing strategy recommendations
429
+
430
+ The documentation should capture:
431
+ - System context (C4 Level 1) ✅ Already enhanced during context analysis
432
+ - Container architecture (C4 Level 2) ✅ Already enhanced during container analysis
433
+ - Component details (C4 Level 3) ✅ Already enhanced during component analysis
434
+ - Enhancement recommendations
435
+ - API testing strategy recommendations
436
+
437
+ **Note**: Project documents were set up early and enhanced throughout analysis phases, so focus on final polish and recommendations.
438
+
439
+ Update plan file with consolidation progress.
440
+ transitions:
441
+ - trigger: 'refine_documentation'
442
+ to: 'documentation_consolidation'
443
+ instructions: >
444
+ Continue refining documentation. Enhance the architecture and design docs,
445
+ add more detail to recommendations, and improve the consolidation quality.
446
+ transition_reason: 'Documentation needs further refinement and enhancement'
447
+
448
+ - trigger: 'need_more_analysis'
449
+ to: 'component_analysis'
450
+ additional_instructions: 'Documentation revealed gaps in component analysis. Focus on the specific components that need more investigation.'
451
+ transition_reason: 'Documentation work revealed need for additional component analysis'
452
+
453
+ - trigger: 'documentation_complete'
454
+ to: 'analysis_complete'
455
+ additional_instructions: >
456
+ Documentation consolidation is complete! ✅ Now transition to analysis complete phase.
457
+ Update the plan file and mark completed documentation tasks.
458
+ transition_reason: 'Documentation is complete, analysis finished'
459
+
460
+ analysis_complete:
461
+ description: 'Legacy system analysis complete'
462
+ default_instructions: >
463
+ Legacy system analysis is complete! The system has been thoroughly analyzed using C4 methodology.
464
+
465
+ Final deliverables:
466
+ - Comprehensive system documentation (C4-based architecture + design docs)
467
+ - DISCOVERY.md long-term memory with complete analysis findings
468
+ - Enhancement recommendations
469
+ - API testing strategy
470
+ - Modernization roadmap
471
+
472
+ The analysis provides a solid foundation for future development work. If enhancements are needed,
473
+ consider using other workflows (waterfall, epcc, etc.) with the comprehensive understanding gained.
474
+ transitions:
475
+ - trigger: 'analysis_complete'
476
+ to: 'analysis_complete'
477
+ instructions: >
478
+ Analysis is complete! The legacy system is now well-documented and understood.
479
+ Use the comprehensive documentation and DISCOVERY.md findings for any future development work.
480
+ transition_reason: 'Analysis complete, ready for future development'
481
+
482
+ - trigger: 'refine_analysis'
483
+ to: 'component_analysis'
484
+ additional_instructions: 'Need to refine specific aspects of the analysis. Focus on the areas that need additional investigation.'
485
+ transition_reason: 'Analysis review revealed need for additional component analysis'
@@ -0,0 +1,161 @@
1
+ # yaml-language-server: $schema=../state-machine-schema.json
2
+ ---
3
+ name: 'epcc'
4
+ description: "A comprehensive development workflow based on Anthropic's best practices: Explore, Plan, Code, Commit - ideal for smaller features and iterative development"
5
+ initial_state: 'explore'
6
+
7
+ # Enhanced metadata for better discoverability
8
+ metadata:
9
+ domain: 'code'
10
+ complexity: 'medium'
11
+ bestFor:
12
+ - 'Medium-sized features'
13
+ - 'Iterative development'
14
+ - 'Research-heavy tasks'
15
+ - 'Exploratory coding'
16
+ useCases:
17
+ - 'Adding a new API endpoint'
18
+ - 'Implementing a new algorithm'
19
+ - 'Integrating a third-party service'
20
+ examples:
21
+ - 'Add user profile management'
22
+ - 'Implement search functionality'
23
+ - 'Create data export feature'
24
+
25
+ # States with default instructions and transitions
26
+ states:
27
+ explore:
28
+ description: 'Research and exploration phase - understanding the problem space'
29
+ default_instructions: |
30
+ You are in the exploration phase. Research the codebase, understand existing patterns, and gather context about the problem space.
31
+ If you are not certain about conventions or rules, ask the user about them.
32
+ Read relevant files and documentation. If $REQUIREMENTS_DOC exists, understand and document requirements there, otherwise document them in the plan file. Don't write code yet - focus on understanding. Document your findings in the plan file.
33
+ transitions:
34
+ - trigger: 'exploration_complete'
35
+ to: 'plan'
36
+ additional_instructions: 'Exploration is complete! ✅ Now transition to planning phase. Present the plan to the user, describing the impact of the changes. Mark completed exploration tasks.'
37
+ transition_reason: 'Sufficient understanding gained, ready to create implementation plan'
38
+
39
+ - trigger: 'abandon_feature'
40
+ to: 'explore'
41
+ instructions: >
42
+ Feature development abandoned. Return to exploration state for new tasks.
43
+ The plan file will remain for future reference if needed.
44
+ additional_instructions: 'Feature development abandoned. Clean up any work in progress and prepare for new tasks.'
45
+ transition_reason: 'User decided to abandon current feature development'
46
+
47
+ plan:
48
+ description: 'Planning phase - creating a detailed implementation strategy'
49
+ default_instructions: 'You are in the planning phase. Create a detailed implementation strategy based on your exploration. If $REQUIREMENTS_DOC exists, base your strategy on requirements from $REQUIREMENTS_DOC, otherwise use the plan file context. Break down the work into specific, actionable tasks. Consider edge cases, dependencies, and potential challenges. If it impacts the general architecture and $ARCHITECTURE_DOC exists, document this in $ARCHITECTURE_DOC, otherwise use the plan file. If $DESIGN_DOC exists, make sure to adhere to the design in $DESIGN_DOC. Document the plan thoroughly. Important: Tasks that you identify for the actual coding shall be in the Code section in the plan.'
50
+ transitions:
51
+ - trigger: 'need_more_exploration'
52
+ to: 'explore'
53
+ additional_instructions: 'Planning revealed gaps in understanding. Focus on the specific areas that need clarification and ask the user about needs and preferences.'
54
+ transition_reason: 'Planning work revealed need for more exploration'
55
+
56
+ - trigger: 'plan_complete'
57
+ to: 'code'
58
+ additional_instructions: 'Plan is complete! ✅ Now transition to implementation. Mark completed planning tasks.'
59
+ transition_reason: 'Implementation plan is complete and ready for coding'
60
+ review_perspectives:
61
+ - perspective: 'architect'
62
+ prompt: 'Review implementation strategy, design decisions, and integration approach for soundness and maintainability. Ensure the plan aligns with existing system architecture and follows best practices.'
63
+ - perspective: 'security_expert'
64
+ prompt: 'Assess security considerations and potential risks in the planned implementation approach. Review data handling, authentication, and potential vulnerabilities.'
65
+
66
+ - trigger: 'abandon_feature'
67
+ to: 'explore'
68
+ instructions: >
69
+ Feature development abandoned during planning. Return to exploration state for new tasks.
70
+ The plan file will remain for future reference.
71
+ additional_instructions: 'Feature development abandoned during planning. Clean up any planning work and prepare for new tasks.'
72
+ transition_reason: 'User decided to abandon feature during planning phase'
73
+
74
+ code:
75
+ description: 'Implementation phase - writing and building the solution'
76
+ default_instructions: 'You are in the implementation phase. Follow your plan and if $DESIGN_DOC exists, follow the design from $DESIGN_DOC to build the solution. If $ARCHITECTURE_DOC exists, build according to the architecture in $ARCHITECTURE_DOC. If $REQUIREMENTS_DOC exists, ensure requirements from $REQUIREMENTS_DOC are met, otherwise ensure plan file requirements are met. Write clean, well-structured code with proper error handling. Prevent regression by building, linting and executing existing tests. Stay flexible and adapt the plan as you learn more during implementation. Update progress in the plan file. Important: Tasks that you identify for the actual coding shall be in the Code section in the plan.'
77
+ transitions:
78
+ - trigger: 'need_replanning'
79
+ to: 'plan'
80
+ additional_instructions: "Implementation revealed issues with the current plan. Consider what you've learned during coding and adjust the plan accordingly. Document the changes and reasons."
81
+ transition_reason: 'Implementation work revealed need to revise the plan'
82
+
83
+ - trigger: 'need_more_exploration'
84
+ to: 'explore'
85
+ additional_instructions: 'Implementation revealed gaps in understanding of the codebase or requirements. Focus on the specific areas that are blocking implementation progress.'
86
+ transition_reason: 'Implementation work revealed need for more exploration'
87
+
88
+ - trigger: 'code_complete'
89
+ to: 'commit'
90
+ additional_instructions: 'Implementation is complete! ✅ Now transition to commit phase. Summarize the changes for the user. Mark completed implementation tasks.'
91
+ transition_reason: 'Core implementation is complete, ready for finalization'
92
+ review_perspectives:
93
+ - perspective: 'senior_software_developer'
94
+ prompt: 'Review code quality, best practices, testing coverage, and readiness for production deployment. Ensure the implementation follows coding standards and is maintainable.'
95
+ - perspective: 'performance_engineer'
96
+ prompt: 'Evaluate performance impact, resource efficiency, and scalability of the implemented solution. Check for potential bottlenecks or optimization opportunities.'
97
+
98
+ - trigger: 'abandon_feature'
99
+ to: 'explore'
100
+ instructions: >
101
+ Feature development abandoned during implementation. Clean up any incomplete code and return to exploration.
102
+ The plan file and any completed work will remain for future reference.
103
+ additional_instructions: 'Feature development abandoned during implementation. Clean up any incomplete code and prepare for new tasks.'
104
+ transition_reason: 'User decided to abandon feature during implementation'
105
+
106
+ commit:
107
+ description: 'Code cleanup and documentation finalization'
108
+ default_instructions: >
109
+ You are in the commit phase. This phase ensures code quality and documentation accuracy through systematic cleanup and review.
110
+
111
+ **STEP 1: Code Cleanup**
112
+ Systematically clean up development artifacts:
113
+
114
+ 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during development.
115
+ Look for language-specific debug output methods (console logging, print statements, debug output functions).
116
+ Remove any debugging statements that were added for development purposes.
117
+
118
+ 2. **Review TODO/FIXME Comments**:
119
+ - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred
120
+ - Remove completed TODOs
121
+ - Convert remaining TODOs to proper issue tracking if needed
122
+
123
+ 3. **Remove Debugging Code Blocks**:
124
+ - Remove temporary debugging code, test code blocks, and commented-out code
125
+ - Clean up any experimental code that's no longer needed
126
+ - Ensure proper error handling replaces temporary debug logging
127
+
128
+ **STEP 2: Documentation Review**
129
+ Review and update documentation to reflect final implementation:
130
+
131
+ 1. **Update Long-Term Memory Documents**: Based on what was actually implemented:
132
+ • Update $REQUIREMENTS_DOC if requirements changed during development
133
+ • Update $ARCHITECTURE_DOC if architectural impacts were identified
134
+ • Update $DESIGN_DOC if design details were refined or changed
135
+ 2. **Compare Against Implementation**: Review documentation against actual implemented functionality
136
+ 3. **Update Changed Sections**: Only modify documentation sections that have functional changes
137
+ 4. **Remove Development Progress**: Remove references to development iterations, progress notes, and temporary decisions
138
+ 5. **Focus on Final State**: Ensure documentation describes the final implemented state, not the development process
139
+ 6. **Ask User to Review Document Updates**
140
+
141
+ **STEP 3: Final Validation**
142
+ - Run existing tests to ensure cleanup didn't break functionality
143
+ - Verify documentation accuracy with a final review
144
+ - Ensure code is ready for production/delivery
145
+
146
+ Update the plan file with commit progress and mark completed tasks.
147
+ transitions:
148
+ - trigger: 'need_code_changes'
149
+ to: 'code'
150
+ additional_instructions: 'Finalization revealed issues that require code changes. Focus on the problems identified during final review.'
151
+ transition_reason: 'Final review found issues requiring code changes'
152
+
153
+ - trigger: 'commit_complete'
154
+ to: 'explore'
155
+ additional_instructions: 'Feature is complete and committed! All work is finished and ready for delivery. Prepare for the next development task.'
156
+ transition_reason: 'Feature delivery complete, ready for next task'
157
+
158
+ - trigger: 'abandon_feature'
159
+ to: 'explore'
160
+ additional_instructions: 'Feature development abandoned during finalization. Clean up any finalization artifacts and prepare for new tasks.'
161
+ transition_reason: 'User decided to abandon feature during finalization'