doit-toolkit-cli 0.1.10__py3-none-any.whl

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.

Potentially problematic release.


This version of doit-toolkit-cli might be problematic. Click here for more details.

Files changed (135) hide show
  1. doit_cli/__init__.py +1356 -0
  2. doit_cli/cli/__init__.py +26 -0
  3. doit_cli/cli/analytics_command.py +616 -0
  4. doit_cli/cli/context_command.py +213 -0
  5. doit_cli/cli/diagram_command.py +304 -0
  6. doit_cli/cli/fixit_command.py +641 -0
  7. doit_cli/cli/hooks_command.py +211 -0
  8. doit_cli/cli/init_command.py +613 -0
  9. doit_cli/cli/memory_command.py +293 -0
  10. doit_cli/cli/roadmapit_command.py +10 -0
  11. doit_cli/cli/status_command.py +117 -0
  12. doit_cli/cli/sync_prompts_command.py +248 -0
  13. doit_cli/cli/validate_command.py +196 -0
  14. doit_cli/cli/verify_command.py +204 -0
  15. doit_cli/cli/workflow_mixin.py +224 -0
  16. doit_cli/cli/xref_command.py +555 -0
  17. doit_cli/formatters/__init__.py +8 -0
  18. doit_cli/formatters/base.py +38 -0
  19. doit_cli/formatters/json_formatter.py +126 -0
  20. doit_cli/formatters/markdown_formatter.py +97 -0
  21. doit_cli/formatters/rich_formatter.py +257 -0
  22. doit_cli/main.py +51 -0
  23. doit_cli/models/__init__.py +139 -0
  24. doit_cli/models/agent.py +74 -0
  25. doit_cli/models/analytics_models.py +384 -0
  26. doit_cli/models/context_config.py +464 -0
  27. doit_cli/models/crossref_models.py +182 -0
  28. doit_cli/models/diagram_models.py +363 -0
  29. doit_cli/models/fixit_models.py +355 -0
  30. doit_cli/models/hook_config.py +125 -0
  31. doit_cli/models/project.py +91 -0
  32. doit_cli/models/results.py +121 -0
  33. doit_cli/models/search_models.py +228 -0
  34. doit_cli/models/status_models.py +195 -0
  35. doit_cli/models/sync_models.py +146 -0
  36. doit_cli/models/template.py +77 -0
  37. doit_cli/models/validation_models.py +175 -0
  38. doit_cli/models/workflow_models.py +319 -0
  39. doit_cli/prompts/__init__.py +5 -0
  40. doit_cli/prompts/fixit_prompts.py +344 -0
  41. doit_cli/prompts/interactive.py +390 -0
  42. doit_cli/rules/__init__.py +5 -0
  43. doit_cli/rules/builtin_rules.py +160 -0
  44. doit_cli/services/__init__.py +79 -0
  45. doit_cli/services/agent_detector.py +168 -0
  46. doit_cli/services/analytics_service.py +218 -0
  47. doit_cli/services/architecture_generator.py +290 -0
  48. doit_cli/services/backup_service.py +204 -0
  49. doit_cli/services/config_loader.py +113 -0
  50. doit_cli/services/context_loader.py +1123 -0
  51. doit_cli/services/coverage_calculator.py +142 -0
  52. doit_cli/services/crossref_service.py +237 -0
  53. doit_cli/services/cycle_time_calculator.py +134 -0
  54. doit_cli/services/date_inferrer.py +349 -0
  55. doit_cli/services/diagram_service.py +337 -0
  56. doit_cli/services/drift_detector.py +109 -0
  57. doit_cli/services/entity_parser.py +301 -0
  58. doit_cli/services/er_diagram_generator.py +197 -0
  59. doit_cli/services/fixit_service.py +699 -0
  60. doit_cli/services/github_service.py +192 -0
  61. doit_cli/services/hook_manager.py +258 -0
  62. doit_cli/services/hook_validator.py +528 -0
  63. doit_cli/services/input_validator.py +322 -0
  64. doit_cli/services/memory_search.py +527 -0
  65. doit_cli/services/mermaid_validator.py +334 -0
  66. doit_cli/services/prompt_transformer.py +91 -0
  67. doit_cli/services/prompt_writer.py +133 -0
  68. doit_cli/services/query_interpreter.py +428 -0
  69. doit_cli/services/report_exporter.py +219 -0
  70. doit_cli/services/report_generator.py +256 -0
  71. doit_cli/services/requirement_parser.py +112 -0
  72. doit_cli/services/roadmap_summarizer.py +209 -0
  73. doit_cli/services/rule_engine.py +443 -0
  74. doit_cli/services/scaffolder.py +215 -0
  75. doit_cli/services/score_calculator.py +172 -0
  76. doit_cli/services/section_parser.py +204 -0
  77. doit_cli/services/spec_scanner.py +327 -0
  78. doit_cli/services/state_manager.py +355 -0
  79. doit_cli/services/status_reporter.py +143 -0
  80. doit_cli/services/task_parser.py +347 -0
  81. doit_cli/services/template_manager.py +710 -0
  82. doit_cli/services/template_reader.py +158 -0
  83. doit_cli/services/user_journey_generator.py +214 -0
  84. doit_cli/services/user_story_parser.py +232 -0
  85. doit_cli/services/validation_service.py +188 -0
  86. doit_cli/services/validator.py +232 -0
  87. doit_cli/services/velocity_tracker.py +173 -0
  88. doit_cli/services/workflow_engine.py +405 -0
  89. doit_cli/templates/agent-file-template.md +28 -0
  90. doit_cli/templates/checklist-template.md +39 -0
  91. doit_cli/templates/commands/doit.checkin.md +363 -0
  92. doit_cli/templates/commands/doit.constitution.md +187 -0
  93. doit_cli/templates/commands/doit.documentit.md +485 -0
  94. doit_cli/templates/commands/doit.fixit.md +181 -0
  95. doit_cli/templates/commands/doit.implementit.md +265 -0
  96. doit_cli/templates/commands/doit.planit.md +262 -0
  97. doit_cli/templates/commands/doit.reviewit.md +355 -0
  98. doit_cli/templates/commands/doit.roadmapit.md +389 -0
  99. doit_cli/templates/commands/doit.scaffoldit.md +458 -0
  100. doit_cli/templates/commands/doit.specit.md +521 -0
  101. doit_cli/templates/commands/doit.taskit.md +304 -0
  102. doit_cli/templates/commands/doit.testit.md +277 -0
  103. doit_cli/templates/config/context.yaml +134 -0
  104. doit_cli/templates/config/hooks.yaml +93 -0
  105. doit_cli/templates/config/validation-rules.yaml +64 -0
  106. doit_cli/templates/github-issue-templates/epic.yml +78 -0
  107. doit_cli/templates/github-issue-templates/feature.yml +116 -0
  108. doit_cli/templates/github-issue-templates/task.yml +129 -0
  109. doit_cli/templates/hooks/.gitkeep +0 -0
  110. doit_cli/templates/hooks/post-commit.sh +25 -0
  111. doit_cli/templates/hooks/post-merge.sh +75 -0
  112. doit_cli/templates/hooks/pre-commit.sh +17 -0
  113. doit_cli/templates/hooks/pre-push.sh +18 -0
  114. doit_cli/templates/memory/completed_roadmap.md +50 -0
  115. doit_cli/templates/memory/constitution.md +125 -0
  116. doit_cli/templates/memory/roadmap.md +61 -0
  117. doit_cli/templates/plan-template.md +146 -0
  118. doit_cli/templates/scripts/bash/check-prerequisites.sh +166 -0
  119. doit_cli/templates/scripts/bash/common.sh +156 -0
  120. doit_cli/templates/scripts/bash/create-new-feature.sh +297 -0
  121. doit_cli/templates/scripts/bash/setup-plan.sh +61 -0
  122. doit_cli/templates/scripts/bash/update-agent-context.sh +675 -0
  123. doit_cli/templates/scripts/powershell/check-prerequisites.ps1 +148 -0
  124. doit_cli/templates/scripts/powershell/common.ps1 +137 -0
  125. doit_cli/templates/scripts/powershell/create-new-feature.ps1 +283 -0
  126. doit_cli/templates/scripts/powershell/setup-plan.ps1 +61 -0
  127. doit_cli/templates/scripts/powershell/update-agent-context.ps1 +406 -0
  128. doit_cli/templates/spec-template.md +159 -0
  129. doit_cli/templates/tasks-template.md +313 -0
  130. doit_cli/templates/vscode-settings.json +14 -0
  131. doit_toolkit_cli-0.1.10.dist-info/METADATA +324 -0
  132. doit_toolkit_cli-0.1.10.dist-info/RECORD +135 -0
  133. doit_toolkit_cli-0.1.10.dist-info/WHEEL +4 -0
  134. doit_toolkit_cli-0.1.10.dist-info/entry_points.txt +2 -0
  135. doit_toolkit_cli-0.1.10.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,265 @@
1
+ ---
2
+ description: Execute the implementation plan by processing and executing all tasks defined in tasks.md
3
+ handoffs:
4
+ - label: Review Implementation
5
+ agent: doit.review
6
+ prompt: Review the implemented code for quality and completeness
7
+ send: true
8
+ - label: Run Tests
9
+ agent: doit.test
10
+ prompt: Execute automated tests and generate test report
11
+ send: true
12
+ ---
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ ## Load Project Context
23
+
24
+ Before proceeding, load the project context to inform your responses:
25
+
26
+ ```bash
27
+ doit context show
28
+ ```
29
+
30
+ **If the command fails or doit is not installed**: Continue without context, but note that alignment with project principles cannot be verified.
31
+
32
+ **Use loaded context to**:
33
+
34
+ - Reference constitution principles when making decisions
35
+ - Consider roadmap priorities
36
+ - Identify connections to related specifications
37
+
38
+ ## Outline
39
+
40
+ 1. Run `.doit/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
41
+
42
+ 2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
43
+ - Check for `--skip-checklist` in $ARGUMENTS - if present, skip checklist verification
44
+ - If not skipped, scan all checklist files in the checklists/ directory
45
+ - For each checklist, count:
46
+ - Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
47
+ - Completed items: Lines matching `- [X]` or `- [x]`
48
+ - Incomplete items: Lines matching `- [ ]`
49
+ - Create a status table:
50
+
51
+ ```text
52
+ | Checklist | Total | Completed | Incomplete | Status |
53
+ |-----------|-------|-----------|------------|--------|
54
+ | ux.md | 12 | 12 | 0 | ✓ PASS |
55
+ | test.md | 8 | 5 | 3 | ✗ FAIL |
56
+ | security.md | 6 | 6 | 0 | ✓ PASS |
57
+ ```
58
+
59
+ - Calculate overall status:
60
+ - **PASS**: All checklists have 0 incomplete items
61
+ - **FAIL**: One or more checklists have incomplete items
62
+
63
+ - **If any checklist is incomplete**:
64
+ - Display the table with incomplete item counts
65
+ - **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
66
+ - Wait for user response before continuing
67
+ - If user says "no" or "wait" or "stop", halt execution
68
+ - If user says "yes" or "proceed" or "continue", proceed to step 3
69
+
70
+ - **If all checklists are complete**:
71
+ - Display the table showing all checklists passed
72
+ - Automatically proceed to step 3
73
+
74
+ 3. Load and analyze the implementation context:
75
+ - **REQUIRED**: Read tasks.md for the complete task list and execution plan
76
+ - **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
77
+ - **IF EXISTS**: Read data-model.md for entities and relationships
78
+ - **IF EXISTS**: Read contracts/ for API specifications and test requirements
79
+ - **IF EXISTS**: Read research.md for technical decisions and constraints
80
+ - **IF EXISTS**: Read quickstart.md for integration scenarios
81
+
82
+ 4. **Project Setup Verification**:
83
+ - **REQUIRED**: Create/verify ignore files based on actual project setup:
84
+
85
+ **Detection & Creation Logic**:
86
+ - Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
87
+
88
+ ```sh
89
+ git rev-parse --git-dir 2>/dev/null
90
+ ```
91
+
92
+ - Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
93
+ - Check if .eslintrc* exists → create/verify .eslintignore
94
+ - Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
95
+ - Check if .prettierrc* exists → create/verify .prettierignore
96
+ - Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
97
+ - Check if terraform files (*.tf) exist → create/verify .terraformignore
98
+ - Check if .helmignore needed (helm charts present) → create/verify .helmignore
99
+
100
+ **If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
101
+ **If ignore file missing**: Create with full pattern set for detected technology
102
+
103
+ **Common Patterns by Technology** (from plan.md tech stack):
104
+ - **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
105
+ - **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
106
+ - **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
107
+ - **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
108
+ - **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
109
+ - **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
110
+ - **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
111
+ - **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
112
+ - **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
113
+ - **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
114
+ - **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `Makefile`, `config.log`, `.idea/`, `*.log`, `.env*`
115
+ - **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
116
+ - **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
117
+ - **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
118
+
119
+ **Tool-Specific Patterns**:
120
+ - **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
121
+ - **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
122
+ - **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
123
+ - **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
124
+ - **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
125
+
126
+ 5. Parse tasks.md structure and extract:
127
+ - **Task phases**: Setup, Tests, Core, Integration, Polish
128
+ - **Task dependencies**: Sequential vs parallel execution rules
129
+ - **Task details**: ID, description, file paths, parallel markers [P]
130
+ - **Execution flow**: Order and dependency requirements
131
+
132
+ 6. Execute implementation following the task plan:
133
+ - **Phase-by-phase execution**: Complete each phase before moving to the next
134
+ - **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
135
+ - **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
136
+ - **File-based coordination**: Tasks affecting the same files must run sequentially
137
+ - **Validation checkpoints**: Verify each phase completion before proceeding
138
+
139
+ 7. Implementation execution rules:
140
+ - **Setup first**: Initialize project structure, dependencies, configuration
141
+ - **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
142
+ - **Core development**: Implement models, services, CLI commands, endpoints
143
+ - **Integration work**: Database connections, middleware, logging, external services
144
+ - **Polish and validation**: Unit tests, performance optimization, documentation
145
+
146
+ 8. Progress tracking and error handling:
147
+ - Report progress after each completed task
148
+ - Halt execution if any non-parallel task fails
149
+ - For parallel tasks [P], continue with successful tasks, report failed ones
150
+ - Provide clear error messages with context for debugging
151
+ - Suggest next steps if implementation cannot proceed
152
+ - **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
153
+
154
+ 9. Completion validation:
155
+ - Verify all required tasks are completed
156
+ - Check that implemented features match the original specification
157
+ - Validate that tests pass and coverage meets requirements
158
+ - Confirm the implementation follows the technical plan
159
+ - Report final status with summary of completed work
160
+
161
+ 10. **Generate Completion Summary Report**:
162
+ - Create a summary showing:
163
+
164
+ ```text
165
+ ## Implementation Summary
166
+
167
+ **Feature**: [Feature name from spec.md]
168
+ **Branch**: [Current git branch]
169
+
170
+ ### Task Completion
171
+ | Phase | Total | Completed | Status |
172
+ |-------|-------|-----------|--------|
173
+ | Setup | X | X | ✓ |
174
+ | Core | X | X | ✓ |
175
+ | ... | ... | ... | ... |
176
+
177
+ ### Files Modified
178
+ - [List of files created/modified]
179
+
180
+ ### Tests Status
181
+ - Unit tests: X passed, Y failed
182
+ - Integration tests: X passed, Y failed
183
+
184
+ ### Next Steps
185
+ - Run `/doit.reviewit` for code review
186
+ - Run `/doit.testit` for full test execution
187
+ ```
188
+
189
+ - Output summary to console for immediate feedback
190
+
191
+ Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/doit.taskit` first to regenerate the task list.
192
+
193
+ ---
194
+
195
+ ## Next Steps
196
+
197
+ After completing this command, display a recommendation section based on the outcome:
198
+
199
+ ### On Success (all tasks complete)
200
+
201
+ Display the following at the end of your output:
202
+
203
+ ```markdown
204
+ ---
205
+
206
+ ## Next Steps
207
+
208
+ ┌─────────────────────────────────────────────────────────────┐
209
+ │ Workflow Progress │
210
+ │ ● specit → ● planit → ● taskit → ● implementit → ○ checkin │
211
+ └─────────────────────────────────────────────────────────────┘
212
+
213
+ **Recommended**: Run `/doit.testit` to verify your implementation with tests.
214
+
215
+ **Alternative**: Run `/doit.reviewit` to request a code review.
216
+ ```
217
+
218
+ ### On Partial Completion (tasks remaining)
219
+
220
+ If some tasks are still incomplete:
221
+
222
+ ```markdown
223
+ ---
224
+
225
+ ## Next Steps
226
+
227
+ ┌─────────────────────────────────────────────────────────────┐
228
+ │ Workflow Progress │
229
+ │ ● specit → ● planit → ● taskit → ◐ implementit → ○ checkin │
230
+ └─────────────────────────────────────────────────────────────┘
231
+
232
+ **Status**: N tasks remaining out of M total.
233
+
234
+ **Recommended**: Continue with `/doit.implementit` to complete remaining tasks.
235
+
236
+ **Alternative**: Run `/doit.testit` for partial verification of completed work.
237
+ ```
238
+
239
+ ### On Error (missing tasks.md)
240
+
241
+ If the command fails because tasks.md is not found:
242
+
243
+ ```markdown
244
+ ---
245
+
246
+ ## Next Steps
247
+
248
+ **Issue**: No task list found. The implementit command requires tasks.md to exist.
249
+
250
+ **Recommended**: Run `/doit.taskit` to generate implementation tasks from the plan.
251
+ ```
252
+
253
+ ### On Error (other issues)
254
+
255
+ If the command fails for another reason:
256
+
257
+ ```markdown
258
+ ---
259
+
260
+ ## Next Steps
261
+
262
+ **Issue**: [Brief description of what went wrong]
263
+
264
+ **Recommended**: [Specific recovery action based on the error]
265
+ ```
@@ -0,0 +1,262 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ handoffs:
4
+ - label: Create Tasks
5
+ agent: doit.tasks
6
+ prompt: Break the plan into tasks
7
+ send: true
8
+ - label: Create Checklist
9
+ agent: doit.checklist
10
+ prompt: Create a checklist for the following domain...
11
+ ---
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input before proceeding (if not empty).
20
+
21
+ ## Load Project Context
22
+
23
+ Before proceeding, load the project context to inform your responses:
24
+
25
+ ```bash
26
+ doit context show
27
+ ```
28
+
29
+ **If the command fails or doit is not installed**: Continue without context, but note that alignment with project principles cannot be verified.
30
+
31
+ **Use loaded context to**:
32
+
33
+ - Reference constitution principles when making decisions
34
+ - Consider roadmap priorities
35
+ - Identify connections to related specifications
36
+
37
+ **For this command specifically**:
38
+
39
+ - Use tech stack from constitution as baseline for architecture
40
+ - Flag any technology choices that deviate from constitution
41
+ - Reference related specifications for integration points
42
+
43
+ ## Outline
44
+
45
+ 1. **Setup**: Run `.doit/scripts/bash/setup-plan.sh --json` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
46
+
47
+ 2. **Load context**: Read FEATURE_SPEC and `.doit/memory/constitution.md`. Load IMPL_PLAN template (already copied).
48
+
49
+ 3. **Extract Constitution Tech Stack**:
50
+ - Read Tech Stack section from constitution.md
51
+ - Extract: PRIMARY_LANGUAGE, FRAMEWORKS, KEY_LIBRARIES
52
+ - Read Infrastructure section: HOSTING_PLATFORM, CLOUD_PROVIDER, DATABASE
53
+ - Read Deployment section: CICD_PIPELINE, DEPLOYMENT_STRATEGY
54
+ - Store these values for architecture alignment validation
55
+
56
+ 4. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
57
+ - Fill Technical Context using constitution tech stack as baseline
58
+ - Flag any tech choices that deviate from constitution (require justification)
59
+ - Fill Constitution Check section from constitution
60
+ - Evaluate gates (ERROR if violations unjustified or tech stack misalignment)
61
+ - Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
62
+ - Phase 1: Generate data-model.md, contracts/, quickstart.md
63
+ - Phase 1: Update agent context by running the agent script
64
+ - Re-evaluate Constitution Check post-design
65
+
66
+ 5. **Generate Mermaid Visualizations** (FR-004, FR-005, FR-006, FR-007):
67
+
68
+ After filling the plan content, generate visual diagrams:
69
+
70
+ a. **Architecture Overview**:
71
+ - Parse Technical Context for: Language, Dependencies, Storage, Target Platform
72
+ - Identify architectural layers from Project Type:
73
+ - **single**: Presentation → Service → Data
74
+ - **web**: Frontend → API → Services → Database
75
+ - **mobile**: Mobile App → API → Services → Database
76
+ - Generate flowchart with subgraphs for each layer
77
+ - Replace content in `<!-- BEGIN:AUTO-GENERATED section="architecture" -->` markers
78
+
79
+ ```mermaid
80
+ flowchart TD
81
+ subgraph "Presentation"
82
+ UI[UI/CLI Layer]
83
+ end
84
+ subgraph "Application"
85
+ API[API/Routes]
86
+ SVC[Services]
87
+ end
88
+ subgraph "Data"
89
+ DB[(Database)]
90
+ end
91
+ UI --> API --> SVC --> DB
92
+ ```
93
+
94
+ b. **Component Dependencies**:
95
+ - Check if multiple services/components are defined in Project Structure
96
+ - **IF multiple services defined**:
97
+ - Parse service names from structure
98
+ - Generate dependency flowchart showing relationships
99
+ - Replace content in `<!-- BEGIN:AUTO-GENERATED section="component-dependencies" -->` markers
100
+ - **IF single service only**:
101
+ - **REMOVE the entire Component Dependencies section**
102
+ - Do NOT leave empty placeholder
103
+
104
+ c. **Data Model ER Diagram**:
105
+ - When generating data-model.md, add ER diagram at the top
106
+ - Parse entity definitions from the file
107
+ - Generate erDiagram showing all entities and relationships
108
+ - Insert in `<!-- BEGIN:AUTO-GENERATED section="er-diagram" -->` markers
109
+
110
+ ```mermaid
111
+ erDiagram
112
+ ENTITY1 ||--o{ ENTITY2 : "relationship"
113
+ ENTITY1 {
114
+ uuid id PK
115
+ string name
116
+ }
117
+ ```
118
+
119
+ d. **State Machine Detection**:
120
+ - Scan entities for fields named: `status`, `state`, `stage`, `phase`
121
+ - For each entity with state field:
122
+ - Parse possible state values from field type or comments
123
+ - Generate stateDiagram-v2 showing transitions
124
+ - Add after entity definition in data-model.md
125
+
126
+ ```mermaid
127
+ stateDiagram-v2
128
+ [*] --> Initial
129
+ Initial --> Active : activate
130
+ Active --> Complete : finish
131
+ Complete --> [*]
132
+ ```
133
+
134
+ e. **Diagram Validation**:
135
+ - Verify mermaid syntax is valid
136
+ - Check node count does not exceed limits (20 for flowchart, 10 for ER)
137
+ - If exceeding limits, split into subgraphs by domain/layer
138
+
139
+ 6. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
140
+
141
+ ## Phases
142
+
143
+ ### Phase 0: Outline & Research
144
+
145
+ 1. **Extract unknowns from Technical Context** above:
146
+ - For each NEEDS CLARIFICATION → research task
147
+ - For each dependency → best practices task
148
+ - For each integration → patterns task
149
+
150
+ 2. **Generate and dispatch research agents**:
151
+
152
+ ```text
153
+ For each unknown in Technical Context:
154
+ Task: "Research {unknown} for {feature context}"
155
+ For each technology choice:
156
+ Task: "Find best practices for {tech} in {domain}"
157
+ ```
158
+
159
+ 3. **Consolidate findings** in `research.md` using format:
160
+ - Decision: [what was chosen]
161
+ - Rationale: [why chosen]
162
+ - Alternatives considered: [what else evaluated]
163
+
164
+ **Output**: research.md with all NEEDS CLARIFICATION resolved
165
+
166
+ ### Phase 1: Design & Contracts
167
+
168
+ **Prerequisites:** `research.md` complete
169
+
170
+ 1. **Extract entities from feature spec** → `data-model.md`:
171
+ - Entity name, fields, relationships
172
+ - Validation rules from requirements
173
+ - State transitions if applicable
174
+
175
+ 2. **Generate API contracts** from functional requirements:
176
+ - For each user action → endpoint
177
+ - Use standard REST/GraphQL patterns
178
+ - Output OpenAPI/GraphQL schema to `/contracts/`
179
+
180
+ 3. **Agent context update**:
181
+ - Run `.doit/scripts/bash/update-agent-context.sh claude`
182
+ - These scripts detect which AI agent is in use
183
+ - Update the appropriate agent-specific context file
184
+ - Add only new technology from current plan
185
+ - Preserve manual additions between markers
186
+
187
+ **Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file
188
+
189
+ ## Key rules
190
+
191
+ - Use absolute paths
192
+ - ERROR on gate failures or unresolved clarifications
193
+
194
+ ---
195
+
196
+ ## Next Steps
197
+
198
+ After completing this command, display a recommendation section based on the outcome:
199
+
200
+ ### On Success (plan and artifacts created)
201
+
202
+ Display the following at the end of your output:
203
+
204
+ ```markdown
205
+ ---
206
+
207
+ ## Next Steps
208
+
209
+ ┌─────────────────────────────────────────────────────────────┐
210
+ │ Workflow Progress │
211
+ │ ● specit → ● planit → ○ taskit → ○ implementit → ○ checkin │
212
+ └─────────────────────────────────────────────────────────────┘
213
+
214
+ **Recommended**: Run `/doit.taskit` to create implementation tasks from this plan.
215
+ ```
216
+
217
+ ### On Success with Existing Tasks
218
+
219
+ If `tasks.md` already exists in the specs directory:
220
+
221
+ ```markdown
222
+ ---
223
+
224
+ ## Next Steps
225
+
226
+ ┌─────────────────────────────────────────────────────────────┐
227
+ │ Workflow Progress │
228
+ │ ● specit → ● planit → ● taskit → ○ implementit → ○ checkin │
229
+ └─────────────────────────────────────────────────────────────┘
230
+
231
+ **Recommended**: Run `/doit.implementit` to begin executing the existing tasks.
232
+
233
+ **Alternative**: Run `/doit.taskit` to regenerate tasks based on the updated plan.
234
+ ```
235
+
236
+ ### On Error (missing spec.md)
237
+
238
+ If the command fails because spec.md is not found:
239
+
240
+ ```markdown
241
+ ---
242
+
243
+ ## Next Steps
244
+
245
+ **Issue**: No feature specification found. The planit command requires spec.md to exist.
246
+
247
+ **Recommended**: Run `/doit.specit [feature description]` to create a feature specification first.
248
+ ```
249
+
250
+ ### On Error (other issues)
251
+
252
+ If the command fails for another reason:
253
+
254
+ ```markdown
255
+ ---
256
+
257
+ ## Next Steps
258
+
259
+ **Issue**: [Brief description of what went wrong]
260
+
261
+ **Recommended**: [Specific recovery action based on the error]
262
+ ```