doit-toolkit-cli 0.1.9__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.
Files changed (134) 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/status_command.py +117 -0
  11. doit_cli/cli/sync_prompts_command.py +248 -0
  12. doit_cli/cli/validate_command.py +196 -0
  13. doit_cli/cli/verify_command.py +204 -0
  14. doit_cli/cli/workflow_mixin.py +224 -0
  15. doit_cli/cli/xref_command.py +555 -0
  16. doit_cli/formatters/__init__.py +8 -0
  17. doit_cli/formatters/base.py +38 -0
  18. doit_cli/formatters/json_formatter.py +126 -0
  19. doit_cli/formatters/markdown_formatter.py +97 -0
  20. doit_cli/formatters/rich_formatter.py +257 -0
  21. doit_cli/main.py +49 -0
  22. doit_cli/models/__init__.py +139 -0
  23. doit_cli/models/agent.py +74 -0
  24. doit_cli/models/analytics_models.py +384 -0
  25. doit_cli/models/context_config.py +464 -0
  26. doit_cli/models/crossref_models.py +182 -0
  27. doit_cli/models/diagram_models.py +363 -0
  28. doit_cli/models/fixit_models.py +355 -0
  29. doit_cli/models/hook_config.py +125 -0
  30. doit_cli/models/project.py +91 -0
  31. doit_cli/models/results.py +121 -0
  32. doit_cli/models/search_models.py +228 -0
  33. doit_cli/models/status_models.py +195 -0
  34. doit_cli/models/sync_models.py +146 -0
  35. doit_cli/models/template.py +77 -0
  36. doit_cli/models/validation_models.py +175 -0
  37. doit_cli/models/workflow_models.py +319 -0
  38. doit_cli/prompts/__init__.py +5 -0
  39. doit_cli/prompts/fixit_prompts.py +344 -0
  40. doit_cli/prompts/interactive.py +390 -0
  41. doit_cli/rules/__init__.py +5 -0
  42. doit_cli/rules/builtin_rules.py +160 -0
  43. doit_cli/services/__init__.py +79 -0
  44. doit_cli/services/agent_detector.py +168 -0
  45. doit_cli/services/analytics_service.py +218 -0
  46. doit_cli/services/architecture_generator.py +290 -0
  47. doit_cli/services/backup_service.py +204 -0
  48. doit_cli/services/config_loader.py +113 -0
  49. doit_cli/services/context_loader.py +1121 -0
  50. doit_cli/services/coverage_calculator.py +142 -0
  51. doit_cli/services/crossref_service.py +237 -0
  52. doit_cli/services/cycle_time_calculator.py +134 -0
  53. doit_cli/services/date_inferrer.py +349 -0
  54. doit_cli/services/diagram_service.py +337 -0
  55. doit_cli/services/drift_detector.py +109 -0
  56. doit_cli/services/entity_parser.py +301 -0
  57. doit_cli/services/er_diagram_generator.py +197 -0
  58. doit_cli/services/fixit_service.py +699 -0
  59. doit_cli/services/github_service.py +192 -0
  60. doit_cli/services/hook_manager.py +258 -0
  61. doit_cli/services/hook_validator.py +528 -0
  62. doit_cli/services/input_validator.py +322 -0
  63. doit_cli/services/memory_search.py +527 -0
  64. doit_cli/services/mermaid_validator.py +334 -0
  65. doit_cli/services/prompt_transformer.py +91 -0
  66. doit_cli/services/prompt_writer.py +133 -0
  67. doit_cli/services/query_interpreter.py +428 -0
  68. doit_cli/services/report_exporter.py +219 -0
  69. doit_cli/services/report_generator.py +256 -0
  70. doit_cli/services/requirement_parser.py +112 -0
  71. doit_cli/services/roadmap_summarizer.py +209 -0
  72. doit_cli/services/rule_engine.py +443 -0
  73. doit_cli/services/scaffolder.py +215 -0
  74. doit_cli/services/score_calculator.py +172 -0
  75. doit_cli/services/section_parser.py +204 -0
  76. doit_cli/services/spec_scanner.py +327 -0
  77. doit_cli/services/state_manager.py +355 -0
  78. doit_cli/services/status_reporter.py +143 -0
  79. doit_cli/services/task_parser.py +347 -0
  80. doit_cli/services/template_manager.py +710 -0
  81. doit_cli/services/template_reader.py +158 -0
  82. doit_cli/services/user_journey_generator.py +214 -0
  83. doit_cli/services/user_story_parser.py +232 -0
  84. doit_cli/services/validation_service.py +188 -0
  85. doit_cli/services/validator.py +232 -0
  86. doit_cli/services/velocity_tracker.py +173 -0
  87. doit_cli/services/workflow_engine.py +405 -0
  88. doit_cli/templates/agent-file-template.md +28 -0
  89. doit_cli/templates/checklist-template.md +39 -0
  90. doit_cli/templates/commands/doit.checkin.md +363 -0
  91. doit_cli/templates/commands/doit.constitution.md +187 -0
  92. doit_cli/templates/commands/doit.documentit.md +485 -0
  93. doit_cli/templates/commands/doit.fixit.md +181 -0
  94. doit_cli/templates/commands/doit.implementit.md +265 -0
  95. doit_cli/templates/commands/doit.planit.md +262 -0
  96. doit_cli/templates/commands/doit.reviewit.md +355 -0
  97. doit_cli/templates/commands/doit.roadmapit.md +368 -0
  98. doit_cli/templates/commands/doit.scaffoldit.md +458 -0
  99. doit_cli/templates/commands/doit.specit.md +521 -0
  100. doit_cli/templates/commands/doit.taskit.md +304 -0
  101. doit_cli/templates/commands/doit.testit.md +277 -0
  102. doit_cli/templates/config/context.yaml +134 -0
  103. doit_cli/templates/config/hooks.yaml +93 -0
  104. doit_cli/templates/config/validation-rules.yaml +64 -0
  105. doit_cli/templates/github-issue-templates/epic.yml +78 -0
  106. doit_cli/templates/github-issue-templates/feature.yml +116 -0
  107. doit_cli/templates/github-issue-templates/task.yml +129 -0
  108. doit_cli/templates/hooks/.gitkeep +0 -0
  109. doit_cli/templates/hooks/post-commit.sh +25 -0
  110. doit_cli/templates/hooks/post-merge.sh +75 -0
  111. doit_cli/templates/hooks/pre-commit.sh +17 -0
  112. doit_cli/templates/hooks/pre-push.sh +18 -0
  113. doit_cli/templates/memory/completed_roadmap.md +50 -0
  114. doit_cli/templates/memory/constitution.md +125 -0
  115. doit_cli/templates/memory/roadmap.md +61 -0
  116. doit_cli/templates/plan-template.md +146 -0
  117. doit_cli/templates/scripts/bash/check-prerequisites.sh +166 -0
  118. doit_cli/templates/scripts/bash/common.sh +156 -0
  119. doit_cli/templates/scripts/bash/create-new-feature.sh +297 -0
  120. doit_cli/templates/scripts/bash/setup-plan.sh +61 -0
  121. doit_cli/templates/scripts/bash/update-agent-context.sh +675 -0
  122. doit_cli/templates/scripts/powershell/check-prerequisites.ps1 +148 -0
  123. doit_cli/templates/scripts/powershell/common.ps1 +137 -0
  124. doit_cli/templates/scripts/powershell/create-new-feature.ps1 +283 -0
  125. doit_cli/templates/scripts/powershell/setup-plan.ps1 +61 -0
  126. doit_cli/templates/scripts/powershell/update-agent-context.ps1 +406 -0
  127. doit_cli/templates/spec-template.md +159 -0
  128. doit_cli/templates/tasks-template.md +313 -0
  129. doit_cli/templates/vscode-settings.json +14 -0
  130. doit_toolkit_cli-0.1.9.dist-info/METADATA +324 -0
  131. doit_toolkit_cli-0.1.9.dist-info/RECORD +134 -0
  132. doit_toolkit_cli-0.1.9.dist-info/WHEEL +4 -0
  133. doit_toolkit_cli-0.1.9.dist-info/entry_points.txt +2 -0
  134. doit_toolkit_cli-0.1.9.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,485 @@
1
+ ---
2
+ description: Organize, index, audit, and enhance project documentation aligned with scaffoldit conventions.
3
+ handoffs:
4
+ - label: Run Scaffoldit
5
+ agent: doit.scaffoldit
6
+ prompt: Scaffold project structure and generate tech-stack.md...
7
+ - label: Create Specification
8
+ agent: doit.specit
9
+ prompt: Create a feature specification...
10
+ ---
11
+
12
+ ## User Input
13
+
14
+ ```text
15
+ $ARGUMENTS
16
+ ```
17
+
18
+ You **MUST** consider the user input before proceeding (if not empty).
19
+
20
+ ## Load Project Context
21
+
22
+ Before proceeding, load the project context to inform your responses:
23
+
24
+ ```bash
25
+ doit context show
26
+ ```
27
+
28
+ **If the command fails or doit is not installed**: Continue without context, but note that alignment with project principles cannot be verified.
29
+
30
+ **Use loaded context to**:
31
+
32
+ - Reference constitution principles when making decisions
33
+ - Consider roadmap priorities
34
+ - Identify connections to related specifications
35
+
36
+ ## Outline
37
+
38
+ You are managing project documentation. This command supports multiple operations:
39
+
40
+ - `organize` - Reorganize documentation into standard structure
41
+ - `index` - Generate or update docs/index.md
42
+ - `audit` - Check documentation health (links, headers, coverage)
43
+ - `cleanup` - Identify duplicates and orphaned files
44
+ - `enhance-templates` - Suggest improvements to command templates
45
+
46
+ If no subcommand is provided, show an interactive menu.
47
+
48
+ ## Subcommand Detection
49
+
50
+ Parse $ARGUMENTS to detect the operation:
51
+
52
+ 1. **If empty**: Show interactive menu (step 1)
53
+ 2. **If starts with "organize"**: Execute organize workflow (step 2)
54
+ 3. **If starts with "index"**: Execute index workflow (step 3)
55
+ 4. **If starts with "audit"**: Execute audit workflow (step 4)
56
+ 5. **If starts with "cleanup"**: Execute cleanup workflow (step 5)
57
+ 6. **If starts with "enhance-templates"**: Execute enhance workflow (step 6)
58
+
59
+ ---
60
+
61
+ ## Step 1: Interactive Menu (Default)
62
+
63
+ If no subcommand provided, present this menu:
64
+
65
+ ```text
66
+ Documentation Management
67
+
68
+ Choose an operation:
69
+
70
+ 1. organize - Reorganize documentation into standard structure
71
+ 2. index - Generate or update docs/index.md
72
+ 3. audit - Check documentation health
73
+ 4. cleanup - Find duplicates and orphaned files
74
+ 5. enhance-templates - Suggest template improvements
75
+
76
+ Enter choice (1-5) or operation name:
77
+ ```
78
+
79
+ Wait for user selection, then execute the corresponding workflow.
80
+
81
+ ---
82
+
83
+ ## Step 2: Organize Documentation (FR-005 to FR-009)
84
+
85
+ ### 2.1 Scan for Documentation Files
86
+
87
+ Search for markdown files in non-standard locations:
88
+
89
+ ```text
90
+ Scanning locations:
91
+ - Root directory (*.md except README.md, CHANGELOG.md, LICENSE.md)
92
+ - Any folder not in docs/, specs/, .doit/, .claude/, node_modules/
93
+ - Look for: *.md, *.mdx files
94
+ ```
95
+
96
+ ### 2.2 Categorize Files
97
+
98
+ Assign each file to a category based on content analysis:
99
+
100
+ | Pattern | Category | Target Directory |
101
+ | ------- | -------- | ---------------- |
102
+ | Contains "# Feature:" or feature-like content | Features | docs/features/ |
103
+ | Contains "## Steps", "How to", tutorial content | Guides | docs/guides/ |
104
+ | Contains API endpoints, method signatures | API | docs/api/ |
105
+ | Contains template placeholders, scaffolding | Templates | docs/templates/ |
106
+ | Binary files (images, PDFs) | Assets | docs/assets/ |
107
+ | Other markdown | Other | docs/ |
108
+
109
+ ### 2.3 Generate Migration Report
110
+
111
+ Create a report showing proposed changes:
112
+
113
+ ```markdown
114
+ # Documentation Migration Plan
115
+
116
+ **Generated**: [DATE]
117
+
118
+ ## Proposed Changes
119
+
120
+ | Current Location | New Location | Reason |
121
+ | ---------------- | ------------ | ------ |
122
+ | path/to/file.md | docs/guides/file.md | Tutorial content detected |
123
+
124
+ ## Directories to Create
125
+
126
+ - docs/features/
127
+ - docs/guides/
128
+ - docs/api/
129
+ - docs/templates/
130
+ - docs/assets/
131
+
132
+ ## Confirmation Required
133
+
134
+ Proceed with migration? (y/n)
135
+ ```
136
+
137
+ ### 2.4 Execute Migration
138
+
139
+ **IMPORTANT**: Only proceed after user confirmation.
140
+
141
+ For each file to move:
142
+ 1. Check if git is available: `git rev-parse --git-dir 2>/dev/null`
143
+ 2. If git available: Use `git mv [source] [destination]` to preserve history
144
+ 3. If git not available: Use standard file move
145
+ 4. Create target directories if they don't exist
146
+ 5. Report each move as it completes
147
+
148
+ ### 2.5 Report Results
149
+
150
+ ```text
151
+ Migration Complete:
152
+ - Files moved: X
153
+ - Directories created: Y
154
+ - Files unchanged: Z
155
+
156
+ Next steps:
157
+ - Run `/doit.documentit index` to update documentation index
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Step 3: Generate Documentation Index (FR-010 to FR-014)
163
+
164
+ ### 3.1 Read Template
165
+
166
+ Load `.doit/templates/docs-index-template.md` for structure reference.
167
+
168
+ ### 3.2 Scan Documentation
169
+
170
+ Scan `docs/` directory and subdirectories:
171
+
172
+ ```text
173
+ For each .md file found:
174
+ 1. Extract title from first # heading (or use filename)
175
+ 2. Extract description from first non-heading paragraph (max 80 chars)
176
+ 3. Get file modification date
177
+ 4. Assign to category based on directory:
178
+ - docs/features/ → Features
179
+ - docs/guides/ → Guides
180
+ - docs/api/ → API Reference
181
+ - docs/templates/ → Templates
182
+ - docs/ (root) → Other
183
+ ```
184
+
185
+ ### 3.3 Generate Index Content
186
+
187
+ Create categorized tables:
188
+
189
+ ```markdown
190
+ <!-- BEGIN:AUTO-GENERATED section="documentation-index" -->
191
+
192
+ ## Features
193
+
194
+ | Document | Description | Last Modified |
195
+ | -------- | ----------- | ------------- |
196
+ | [Feature Name](./features/feature.md) | First paragraph summary... | 2026-01-10 |
197
+
198
+ ## Guides
199
+
200
+ | Document | Description | Last Modified |
201
+ | -------- | ----------- | ------------- |
202
+ | [Guide Name](./guides/guide.md) | First paragraph summary... | 2026-01-10 |
203
+
204
+ [... other categories ...]
205
+
206
+ <!-- END:AUTO-GENERATED -->
207
+ ```
208
+
209
+ ### 3.4 Update or Create Index
210
+
211
+ 1. If `docs/index.md` exists:
212
+ - Read existing file
213
+ - Find content between `<!-- BEGIN:AUTO-GENERATED -->` and `<!-- END:AUTO-GENERATED -->`
214
+ - Replace only that section, preserving all other content
215
+ 2. If `docs/index.md` doesn't exist:
216
+ - Create new file using template structure
217
+ - Fill in auto-generated sections
218
+
219
+ ### 3.5 Report Results
220
+
221
+ ```text
222
+ Index Updated:
223
+ - Total files indexed: X
224
+ - Categories: Features (X), Guides (X), API (X), Templates (X), Other (X)
225
+ - Location: docs/index.md
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Step 4: Audit Documentation Health (FR-020 to FR-024)
231
+
232
+ ### 4.1 Check for Broken Links
233
+
234
+ Parse all markdown files in docs/ for internal links:
235
+
236
+ ```text
237
+ Link patterns to check:
238
+ - [text](relative/path.md)
239
+ - [text](./relative/path.md)
240
+ - [text](/absolute/path.md)
241
+ - ![alt](path/to/image.png)
242
+ ```
243
+
244
+ For each link, verify the target file exists.
245
+
246
+ ### 4.2 Check for Missing Headers
247
+
248
+ For each markdown file:
249
+ - Check if file starts with `# ` heading
250
+ - Flag files without proper title headers
251
+
252
+ ### 4.3 Check Documentation Coverage
253
+
254
+ Cross-reference completed features with documentation:
255
+
256
+ ```text
257
+ 1. Scan specs/ for completed features (check for tasks.md with all [x])
258
+ 2. For each completed feature, check if docs/features/[feature-name].md exists
259
+ 3. Report features missing user documentation
260
+ ```
261
+
262
+ ### 4.4 Generate Audit Report (FR-023, FR-024)
263
+
264
+ ```markdown
265
+ # Documentation Audit Report
266
+
267
+ **Generated**: [DATE]
268
+
269
+ ## Summary
270
+
271
+ | Metric | Count |
272
+ | ------ | ----- |
273
+ | Total Documentation Files | X |
274
+ | Files with Issues | X |
275
+ | Broken Links | X |
276
+ | Missing Headers | X |
277
+ | Coverage Score | X% |
278
+
279
+ ## Issues by Severity
280
+
281
+ ### Errors (Must Fix)
282
+
283
+ | File | Issue | Suggestion |
284
+ | ---- | ----- | ---------- |
285
+ | docs/guide.md | Broken link to ./missing.md | Update or remove link |
286
+
287
+ ### Warnings (Should Fix)
288
+
289
+ | File | Issue | Suggestion |
290
+ | ---- | ----- | ---------- |
291
+ | docs/api/endpoint.md | Missing # header | Add title heading |
292
+
293
+ ### Info (Consider)
294
+
295
+ | File | Issue | Suggestion |
296
+ | ---- | ----- | ---------- |
297
+ | docs/old-doc.md | No internal links | Consider linking to related docs |
298
+
299
+ ## Coverage Analysis
300
+
301
+ | Feature | Spec Status | User Docs | Status |
302
+ | ------- | ----------- | --------- | ------ |
303
+ | 008-roadmapit | Complete | Exists | ✅ |
304
+ | 007-cli-rename | Complete | Missing | ⚠️ |
305
+ ```
306
+
307
+ ---
308
+
309
+ ## Step 5: Cleanup Redundant Documentation (FR-025 to FR-028)
310
+
311
+ ### 5.1 Find Potential Duplicates
312
+
313
+ Compare files for similarity:
314
+
315
+ ```text
316
+ Duplicate detection methods:
317
+ 1. Exact title match (# heading)
318
+ 2. Near-identical titles (fuzzy match)
319
+ 3. First 500 characters identical
320
+ 4. Same filename in different directories
321
+ ```
322
+
323
+ ### 5.2 Find Orphaned Files
324
+
325
+ Track all internal links across documentation:
326
+
327
+ ```text
328
+ 1. Build link graph: file → [files it links to]
329
+ 2. Find files not linked from any other file
330
+ 3. Exclude index.md and README.md from orphan check
331
+ 4. Flag truly orphaned files
332
+ ```
333
+
334
+ ### 5.3 Generate Cleanup Suggestions (FR-027, FR-028)
335
+
336
+ ```markdown
337
+ # Documentation Cleanup Suggestions
338
+
339
+ ## Potential Duplicates
340
+
341
+ | File 1 | File 2 | Similarity | Suggestion |
342
+ | ------ | ------ | ---------- | ---------- |
343
+ | docs/setup.md | docs/guides/setup.md | 95% | Consolidate into guides/ |
344
+
345
+ ## Orphaned Files
346
+
347
+ | File | Last Modified | Action |
348
+ | ---- | ------------- | ------ |
349
+ | docs/old-notes.md | 2025-06-01 | Review for deletion |
350
+
351
+ ## Actions
352
+
353
+ For each suggestion, choose:
354
+ - [A]ccept - Apply the suggestion
355
+ - [R]eject - Keep files as-is
356
+ - [S]kip - Decide later
357
+
358
+ Enter choices (e.g., "A1 R2 S3"):
359
+ ```
360
+
361
+ ### 5.4 Apply Accepted Changes
362
+
363
+ Only make changes for accepted suggestions:
364
+ - For duplicates: Merge content, remove duplicate
365
+ - For orphans: Delete or move to archive based on user choice
366
+
367
+ ---
368
+
369
+ ## Step 6: Enhance Command Templates (FR-029 to FR-032)
370
+
371
+ ### 6.1 Scan Command Templates
372
+
373
+ Read all files in `.claude/commands/`:
374
+
375
+ ```text
376
+ For each command file, check:
377
+ 1. YAML frontmatter present and valid
378
+ 2. Description field exists
379
+ 3. ## Examples section exists
380
+ 4. ## User Input section exists
381
+ 5. ## Outline section exists
382
+ 6. Consistent heading structure
383
+ ```
384
+
385
+ ### 6.2 Identify Missing Elements (FR-029, FR-030)
386
+
387
+ ```markdown
388
+ # Template Enhancement Report
389
+
390
+ ## Files Analyzed
391
+
392
+ | File | Frontmatter | Examples | User Input | Outline | Score |
393
+ | ---- | ----------- | -------- | ---------- | ------- | ----- |
394
+ | doit.specit.md | ✅ | ✅ | ✅ | ✅ | 100% |
395
+ | doit.planit.md | ✅ | ❌ | ✅ | ✅ | 75% |
396
+ ```
397
+
398
+ ### 6.3 Generate Improvement Suggestions
399
+
400
+ For each file with missing elements:
401
+
402
+ ```markdown
403
+ ## Suggested Improvements
404
+
405
+ ### doit.planit.md
406
+
407
+ **Missing: ## Examples section**
408
+
409
+ Suggested addition:
410
+
411
+ ## Examples
412
+
413
+ ```text
414
+ # Create implementation plan with tech stack
415
+ /doit.planit Use React with TypeScript for frontend, FastAPI for backend
416
+
417
+ # Plan with specific architecture
418
+ /doit.planit Microservices architecture with message queue
419
+ ```
420
+
421
+ **Accept this suggestion? (y/n)**
422
+ ```
423
+
424
+ ### 6.4 Apply Enhancements
425
+
426
+ For accepted suggestions:
427
+ 1. Read current file content
428
+ 2. Insert suggested section at appropriate location
429
+ 3. Preserve all existing content and functionality
430
+ 4. Write updated file
431
+
432
+ ---
433
+
434
+ ## Validation Rules
435
+
436
+ Before any file modification:
437
+ 1. **Always confirm** with user before moving, deleting, or modifying files
438
+ 2. **Backup first** when modifying existing files
439
+ 3. **Preserve markers** - never modify content outside auto-generated markers
440
+ 4. **Check git status** before bulk operations
441
+
442
+ ## Notes
443
+
444
+ - This command never modifies files in specs/ or .doit/templates/
445
+ - Binary files (images, PDFs) are cataloged but content is not analyzed
446
+ - Symlinks are followed for reading but flagged in audit
447
+ - Large files (>1MB markdown) are skipped with warning
448
+
449
+ ---
450
+
451
+ ## Next Steps
452
+
453
+ After completing this command, display a recommendation section based on the outcome:
454
+
455
+ ### On Success (documentation organized or indexed)
456
+
457
+ Display the following at the end of your output:
458
+
459
+ ```markdown
460
+ ---
461
+
462
+ ## Next Steps
463
+
464
+ **Documentation operation complete!**
465
+
466
+ **Recommended**: Continue with your development workflow:
467
+ - Run `/doit.specit [feature]` to create a new feature specification
468
+ - Run `/doit.implementit` to continue implementation work
469
+
470
+ **Alternative**: Run `/doit.documentit` again with a different operation (organize, index, audit, cleanup, enhance-templates).
471
+ ```
472
+
473
+ ### On Audit Issues Found
474
+
475
+ If the audit found documentation issues:
476
+
477
+ ```markdown
478
+ ---
479
+
480
+ ## Next Steps
481
+
482
+ **Documentation audit found issues.**
483
+
484
+ **Recommended**: Address the issues listed above, then run `/doit.documentit audit` again to verify.
485
+ ```
@@ -0,0 +1,181 @@
1
+ ---
2
+ description: Start and manage bug-fix workflows for GitHub issues
3
+ handoffs:
4
+ - label: Create Plan
5
+ agent: doit.planit
6
+ prompt: Create fix plan from investigation findings
7
+ send: true
8
+ - label: Implement Fix
9
+ agent: doit.implementit
10
+ prompt: Execute the fix plan tasks
11
+ send: true
12
+ - label: Check In
13
+ agent: doit.checkin
14
+ prompt: Finalize fix and create pull request
15
+ send: true
16
+ ---
17
+
18
+ ## User Input
19
+
20
+ ```text
21
+ $ARGUMENTS
22
+ ```
23
+
24
+ You **MUST** consider the user input before proceeding (if not empty).
25
+
26
+ ## Load Project Context
27
+
28
+ Before proceeding, load the project context to inform your responses:
29
+
30
+ ```bash
31
+ doit context show
32
+ ```
33
+
34
+ **If the command fails or doit is not installed**: Continue without context, but note that alignment with project principles cannot be verified.
35
+
36
+ **Use loaded context to**:
37
+
38
+ - Reference constitution principles when making decisions
39
+ - Consider roadmap priorities
40
+ - Identify connections to related specifications
41
+
42
+ ## Outline
43
+
44
+ This command manages the bug-fix workflow lifecycle for GitHub issues.
45
+
46
+ ### 1. Parse Command Arguments
47
+
48
+ Extract the operation from `$ARGUMENTS`:
49
+
50
+ | Pattern | Operation | Example |
51
+ |---------|-----------|---------|
52
+ | `start <issue_id>` | Start workflow for issue | `/doit.fixit start 123` |
53
+ | `start` | Interactive issue selection | `/doit.fixit start` |
54
+ | `list` | List open bugs | `/doit.fixit list` |
55
+ | `status [issue_id]` | Show workflow status | `/doit.fixit status` |
56
+ | `investigate [issue_id]` | Start/manage investigation | `/doit.fixit investigate` |
57
+ | `plan [issue_id]` | Generate fix plan | `/doit.fixit plan` |
58
+ | `review [issue_id]` | Review and approve plan | `/doit.fixit review` |
59
+ | `cancel [issue_id]` | Cancel workflow | `/doit.fixit cancel` |
60
+ | `workflows` | List all workflows | `/doit.fixit workflows` |
61
+
62
+ ### 2. Workflow Phases
63
+
64
+ The fixit workflow progresses through these phases:
65
+
66
+ ```
67
+ initialized → investigating → planning → reviewing → approved → implementing → completed
68
+ ↓ ↓ ↓
69
+ cancelled cancelled cancelled
70
+ ```
71
+
72
+ ### 3. Start Workflow
73
+
74
+ When starting a new workflow (`doit fixit start <issue_id>`):
75
+
76
+ 1. Verify the GitHub issue exists and is open
77
+ 2. Check no existing workflow for this issue
78
+ 3. Create fix branch: `fix/{issue_id}-{slug}`
79
+ 4. Initialize workflow state in `.doit/state/fixit-{issue_id}.json`
80
+ 5. Display next steps for investigation
81
+
82
+ ### 4. Investigation Phase
83
+
84
+ Run `doit fixit investigate` to:
85
+
86
+ 1. Extract keywords from issue title/body
87
+ 2. Create checkpoints for investigation:
88
+ - Review error logs and stack traces
89
+ - Identify affected code paths
90
+ - Search for related issues or commits
91
+ - Formulate root cause hypothesis
92
+ 3. Add findings with types:
93
+ - `hypothesis` - Initial theories
94
+ - `confirmed_cause` - Verified root cause
95
+ - `affected_file` - Files that need changes
96
+ - `reproduction_step` - Steps to reproduce
97
+
98
+ Example:
99
+ ```bash
100
+ doit fixit investigate -a "Null pointer in click handler" -t confirmed_cause
101
+ doit fixit investigate -c cp-1 # Complete checkpoint
102
+ doit fixit investigate --done # Finish investigation
103
+ ```
104
+
105
+ ### 5. Planning Phase
106
+
107
+ Run `doit fixit plan --generate` to:
108
+
109
+ 1. Extract confirmed root cause from investigation
110
+ 2. Identify affected files from findings
111
+ 3. Generate fix plan with:
112
+ - Root cause summary
113
+ - Proposed solution
114
+ - Files to modify
115
+ - Risk assessment (low/medium/high)
116
+ 4. Save plan to workflow state
117
+
118
+ ### 6. Review and Approval
119
+
120
+ Run `doit fixit review` to:
121
+
122
+ 1. Display the fix plan for review
123
+ 2. Use `--approve` to approve the plan
124
+ 3. On approval, advance to implementing phase
125
+
126
+ ### 7. Implementation
127
+
128
+ After plan approval:
129
+
130
+ 1. Run `/doit.implementit` to execute the fix
131
+ 2. The fix plan guides the implementation
132
+ 3. Workflow tracks implementation progress
133
+
134
+ ### 8. Completion
135
+
136
+ Run `/doit.checkin` to:
137
+
138
+ 1. Create pull request
139
+ 2. Link PR to GitHub issue
140
+ 3. Mark workflow as completed
141
+ 4. Optionally close the GitHub issue
142
+
143
+ ---
144
+
145
+ ## Key Rules
146
+
147
+ - Always verify GitHub issue exists before starting
148
+ - Require confirmed_cause finding before planning
149
+ - Require plan approval before implementation
150
+ - Branch naming: `fix/{issue_id}-{slug}`
151
+ - State persistence: `.doit/state/fixit-{issue_id}.json`
152
+
153
+ ---
154
+
155
+ ## Next Steps
156
+
157
+ After completing this command, display recommendations:
158
+
159
+ ### On Workflow Started
160
+
161
+ ```markdown
162
+ **Workflow started for issue #123!**
163
+
164
+ **Recommended**: Run `/doit.fixit investigate` to start the investigation phase.
165
+ ```
166
+
167
+ ### On Investigation Complete
168
+
169
+ ```markdown
170
+ **Investigation complete!**
171
+
172
+ **Recommended**: Run `/doit.fixit plan --generate` to create a fix plan.
173
+ ```
174
+
175
+ ### On Plan Approved
176
+
177
+ ```markdown
178
+ **Plan approved!**
179
+
180
+ **Recommended**: Run `/doit.implementit` to implement the fix.
181
+ ```