aidp 0.27.0 → 0.29.0
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.
- checksums.yaml +4 -4
- data/README.md +89 -0
- data/lib/aidp/cli/models_command.rb +80 -123
- data/lib/aidp/cli/tools_command.rb +333 -0
- data/lib/aidp/cli.rb +18 -9
- data/lib/aidp/config.rb +63 -0
- data/lib/aidp/debug_mixin.rb +23 -1
- data/lib/aidp/execute/agent_signal_parser.rb +22 -0
- data/lib/aidp/execute/repl_macros.rb +2 -2
- data/lib/aidp/execute/steps.rb +94 -1
- data/lib/aidp/execute/work_loop_runner.rb +215 -20
- data/lib/aidp/execute/workflow_selector.rb +2 -25
- data/lib/aidp/firewall/provider_requirements_collector.rb +262 -0
- data/lib/aidp/harness/ai_decision_engine.rb +35 -2
- data/lib/aidp/harness/capability_registry.rb +4 -4
- data/lib/aidp/harness/config_manager.rb +0 -5
- data/lib/aidp/harness/config_schema.rb +8 -0
- data/lib/aidp/harness/configuration.rb +27 -19
- data/lib/aidp/harness/enhanced_runner.rb +1 -4
- data/lib/aidp/harness/error_handler.rb +1 -72
- data/lib/aidp/harness/provider_factory.rb +11 -2
- data/lib/aidp/harness/provider_manager.rb +5 -3
- data/lib/aidp/harness/ruby_llm_registry.rb +239 -0
- data/lib/aidp/harness/state_manager.rb +0 -7
- data/lib/aidp/harness/thinking_depth_manager.rb +47 -68
- data/lib/aidp/harness/ui/enhanced_tui.rb +8 -18
- data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +0 -18
- data/lib/aidp/harness/ui/progress_display.rb +6 -2
- data/lib/aidp/harness/user_interface.rb +0 -58
- data/lib/aidp/init/runner.rb +7 -2
- data/lib/aidp/metadata/cache.rb +201 -0
- data/lib/aidp/metadata/compiler.rb +229 -0
- data/lib/aidp/metadata/parser.rb +204 -0
- data/lib/aidp/metadata/query.rb +237 -0
- data/lib/aidp/metadata/scanner.rb +191 -0
- data/lib/aidp/metadata/tool_metadata.rb +245 -0
- data/lib/aidp/metadata/validator.rb +187 -0
- data/lib/aidp/planning/analyzers/feedback_analyzer.rb +365 -0
- data/lib/aidp/planning/builders/agile_plan_builder.rb +387 -0
- data/lib/aidp/planning/builders/project_plan_builder.rb +193 -0
- data/lib/aidp/planning/generators/gantt_generator.rb +190 -0
- data/lib/aidp/planning/generators/iteration_plan_generator.rb +392 -0
- data/lib/aidp/planning/generators/legacy_research_planner.rb +473 -0
- data/lib/aidp/planning/generators/marketing_report_generator.rb +348 -0
- data/lib/aidp/planning/generators/mvp_scope_generator.rb +310 -0
- data/lib/aidp/planning/generators/user_test_plan_generator.rb +373 -0
- data/lib/aidp/planning/generators/wbs_generator.rb +259 -0
- data/lib/aidp/planning/mappers/persona_mapper.rb +163 -0
- data/lib/aidp/planning/parsers/document_parser.rb +141 -0
- data/lib/aidp/planning/parsers/feedback_data_parser.rb +252 -0
- data/lib/aidp/provider_manager.rb +8 -32
- data/lib/aidp/providers/aider.rb +264 -0
- data/lib/aidp/providers/anthropic.rb +80 -6
- data/lib/aidp/providers/base.rb +129 -35
- data/lib/aidp/providers/codex.rb +27 -4
- data/lib/aidp/providers/cursor.rb +17 -1
- data/lib/aidp/providers/gemini.rb +14 -1
- data/lib/aidp/providers/github_copilot.rb +18 -1
- data/lib/aidp/providers/kilocode.rb +12 -1
- data/lib/aidp/providers/opencode.rb +12 -1
- data/lib/aidp/setup/wizard.rb +284 -146
- data/lib/aidp/version.rb +1 -1
- data/lib/aidp/watch/build_processor.rb +211 -30
- data/lib/aidp/watch/change_request_processor.rb +128 -14
- data/lib/aidp/watch/ci_fix_processor.rb +103 -37
- data/lib/aidp/watch/ci_log_extractor.rb +258 -0
- data/lib/aidp/watch/github_state_extractor.rb +177 -0
- data/lib/aidp/watch/implementation_verifier.rb +284 -0
- data/lib/aidp/watch/plan_generator.rb +7 -43
- data/lib/aidp/watch/plan_processor.rb +7 -6
- data/lib/aidp/watch/repository_client.rb +245 -17
- data/lib/aidp/watch/review_processor.rb +98 -17
- data/lib/aidp/watch/reviewers/base_reviewer.rb +1 -1
- data/lib/aidp/watch/runner.rb +181 -29
- data/lib/aidp/watch/state_store.rb +22 -1
- data/lib/aidp/workflows/definitions.rb +147 -0
- data/lib/aidp/workstream_cleanup.rb +245 -0
- data/lib/aidp/worktree.rb +19 -0
- data/lib/aidp.rb +11 -0
- data/templates/aidp.yml.example +57 -0
- data/templates/implementation/generate_tdd_specs.md +213 -0
- data/templates/implementation/implement_features.md +4 -1
- data/templates/implementation/iterative_implementation.md +122 -0
- data/templates/planning/agile/analyze_feedback.md +183 -0
- data/templates/planning/agile/generate_iteration_plan.md +179 -0
- data/templates/planning/agile/generate_legacy_research_plan.md +171 -0
- data/templates/planning/agile/generate_marketing_report.md +162 -0
- data/templates/planning/agile/generate_mvp_scope.md +127 -0
- data/templates/planning/agile/generate_user_test_plan.md +143 -0
- data/templates/planning/agile/ingest_feedback.md +174 -0
- data/templates/planning/assemble_project_plan.md +113 -0
- data/templates/planning/assign_personas.md +108 -0
- data/templates/planning/create_tasks.md +52 -6
- data/templates/planning/generate_gantt.md +86 -0
- data/templates/planning/generate_wbs.md +85 -0
- data/templates/planning/initialize_planning_mode.md +70 -0
- data/templates/skills/README.md +2 -2
- data/templates/skills/marketing_strategist/SKILL.md +279 -0
- data/templates/skills/product_manager/SKILL.md +177 -0
- data/templates/skills/ruby_aidp_planning/SKILL.md +497 -0
- data/templates/skills/ruby_rspec_tdd/SKILL.md +514 -0
- data/templates/skills/ux_researcher/SKILL.md +222 -0
- metadata +62 -2
- data/lib/aidp/harness/model_discovery_service.rb +0 -259
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ruby_aidp_planning
|
|
3
|
+
name: AIDP Ruby Planning API
|
|
4
|
+
description: Expert in using AIDP's Ruby planning utilities (parsers, generators, mappers, builders)
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
expertise:
|
|
7
|
+
- AIDP Planning module Ruby API
|
|
8
|
+
- DocumentParser for parsing existing docs
|
|
9
|
+
- WBSGenerator for work breakdown structures
|
|
10
|
+
- GanttGenerator for Mermaid charts
|
|
11
|
+
- PersonaMapper for ZFC-based task assignment
|
|
12
|
+
- ProjectPlanBuilder for plan orchestration
|
|
13
|
+
keywords:
|
|
14
|
+
- aidp
|
|
15
|
+
- ruby
|
|
16
|
+
- planning
|
|
17
|
+
- wbs
|
|
18
|
+
- gantt
|
|
19
|
+
- personas
|
|
20
|
+
when_to_use:
|
|
21
|
+
- Implementing AIDP planning workflows in Ruby
|
|
22
|
+
- Using AIDP's Planning module classes
|
|
23
|
+
- Generating WBS, Gantt charts, or persona assignments
|
|
24
|
+
- Parsing documentation with AIDP utilities
|
|
25
|
+
when_not_to_use:
|
|
26
|
+
- Non-Ruby implementations
|
|
27
|
+
- Non-AIDP projects
|
|
28
|
+
- Language-agnostic planning (use generic templates)
|
|
29
|
+
compatible_providers:
|
|
30
|
+
- anthropic
|
|
31
|
+
- openai
|
|
32
|
+
- cursor
|
|
33
|
+
- codex
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# AIDP Ruby Planning API
|
|
37
|
+
|
|
38
|
+
You are an expert in **AIDP's Ruby Planning API**. Your role is to implement planning workflows using AIDP's built-in Ruby utilities for parsing documents, generating work breakdowns, creating Gantt charts, and mapping tasks to personas.
|
|
39
|
+
|
|
40
|
+
## AIDP Planning Module Structure
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
lib/aidp/planning/
|
|
44
|
+
├── parsers/
|
|
45
|
+
│ └── document_parser.rb # Parse existing documentation
|
|
46
|
+
├── generators/
|
|
47
|
+
│ ├── wbs_generator.rb # Generate work breakdown structure
|
|
48
|
+
│ └── gantt_generator.rb # Generate Gantt charts
|
|
49
|
+
├── mappers/
|
|
50
|
+
│ └── persona_mapper.rb # Map tasks to personas (ZFC)
|
|
51
|
+
└── builders/
|
|
52
|
+
└── project_plan_builder.rb # Orchestrate plan generation
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Module Namespaces
|
|
56
|
+
|
|
57
|
+
All planning utilities are under the `Aidp::Planning` namespace:
|
|
58
|
+
|
|
59
|
+
- `Aidp::Planning::Parsers::DocumentParser`
|
|
60
|
+
- `Aidp::Planning::Generators::WBSGenerator`
|
|
61
|
+
- `Aidp::Planning::Generators::GanttGenerator`
|
|
62
|
+
- `Aidp::Planning::Mappers::PersonaMapper`
|
|
63
|
+
- `Aidp::Planning::Builders::ProjectPlanBuilder`
|
|
64
|
+
|
|
65
|
+
## 1. DocumentParser
|
|
66
|
+
|
|
67
|
+
### Purpose
|
|
68
|
+
|
|
69
|
+
Parse existing markdown documentation to extract structured information.
|
|
70
|
+
|
|
71
|
+
### Usage
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
require_relative 'lib/aidp/planning/parsers/document_parser'
|
|
75
|
+
|
|
76
|
+
# Create parser (optionally with AI decision engine for ZFC)
|
|
77
|
+
parser = Aidp::Planning::Parsers::DocumentParser.new
|
|
78
|
+
# OR with AI engine:
|
|
79
|
+
# parser = Aidp::Planning::Parsers::DocumentParser.new(ai_decision_engine: ai_engine)
|
|
80
|
+
|
|
81
|
+
# Parse a single file
|
|
82
|
+
parsed = parser.parse_file('.aidp/docs/PRD.md')
|
|
83
|
+
# Returns: {
|
|
84
|
+
# path: "...",
|
|
85
|
+
# type: :prd/:design/:adr/:task_list/:unknown,
|
|
86
|
+
# sections: { "section_name" => "content", ... },
|
|
87
|
+
# raw_content: "..."
|
|
88
|
+
# }
|
|
89
|
+
|
|
90
|
+
# Parse entire directory
|
|
91
|
+
docs = parser.parse_directory('.aidp/docs')
|
|
92
|
+
# Returns array of parsed documents
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Document Type Detection
|
|
96
|
+
|
|
97
|
+
Uses Zero Framework Cognition (ZFC) when AI engine is available, falls back to heuristics:
|
|
98
|
+
|
|
99
|
+
- `:prd` - Product requirements document
|
|
100
|
+
- `:design` - Technical design document
|
|
101
|
+
- `:adr` - Architecture decision record
|
|
102
|
+
- `:task_list` - Task list
|
|
103
|
+
- `:unknown` - Unrecognized type
|
|
104
|
+
|
|
105
|
+
### Section Extraction
|
|
106
|
+
|
|
107
|
+
Automatically extracts markdown sections based on `#` and `##` headers:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
parsed[:sections]
|
|
111
|
+
# => {
|
|
112
|
+
# "problem_statement" => "content...",
|
|
113
|
+
# "goals" => "content...",
|
|
114
|
+
# "success_criteria" => "content..."
|
|
115
|
+
# }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 2. WBSGenerator
|
|
119
|
+
|
|
120
|
+
### Purpose
|
|
121
|
+
|
|
122
|
+
Generate hierarchical Work Breakdown Structure with phases and tasks.
|
|
123
|
+
|
|
124
|
+
### Usage
|
|
125
|
+
|
|
126
|
+
```ruby
|
|
127
|
+
require_relative 'lib/aidp/planning/generators/wbs_generator'
|
|
128
|
+
|
|
129
|
+
# Create generator
|
|
130
|
+
generator = Aidp::Planning::Generators::WBSGenerator.new
|
|
131
|
+
|
|
132
|
+
# Optional: Custom phases
|
|
133
|
+
generator = Aidp::Planning::Generators::WBSGenerator.new(
|
|
134
|
+
phases: ["Planning", "Development", "Testing", "Launch"]
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# Generate WBS from PRD and design
|
|
138
|
+
wbs = generator.generate(prd: parsed_prd, tech_design: parsed_design)
|
|
139
|
+
# Returns: {
|
|
140
|
+
# phases: [
|
|
141
|
+
# { name: "Requirements", description: "...", tasks: [...] },
|
|
142
|
+
# { name: "Design", description: "...", tasks: [...] },
|
|
143
|
+
# ...
|
|
144
|
+
# ],
|
|
145
|
+
# metadata: {
|
|
146
|
+
# generated_at: "...",
|
|
147
|
+
# phase_count: 5,
|
|
148
|
+
# total_tasks: 23
|
|
149
|
+
# }
|
|
150
|
+
# }
|
|
151
|
+
|
|
152
|
+
# Format as markdown
|
|
153
|
+
markdown = generator.format_as_markdown(wbs)
|
|
154
|
+
File.write('.aidp/docs/WBS.md', markdown)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Default Phases
|
|
158
|
+
|
|
159
|
+
1. **Requirements** - Gather and document all requirements
|
|
160
|
+
2. **Design** - Design system architecture and components
|
|
161
|
+
3. **Implementation** - Implement features and functionality
|
|
162
|
+
4. **Testing** - Test all features and fix bugs
|
|
163
|
+
5. **Deployment** - Deploy to production and monitor
|
|
164
|
+
|
|
165
|
+
### Task Structure
|
|
166
|
+
|
|
167
|
+
Each task includes:
|
|
168
|
+
|
|
169
|
+
```ruby
|
|
170
|
+
{
|
|
171
|
+
name: "Design system architecture",
|
|
172
|
+
description: "Create high-level architecture diagram...",
|
|
173
|
+
effort: "5 story points",
|
|
174
|
+
dependencies: ["Document functional requirements"],
|
|
175
|
+
subtasks: [
|
|
176
|
+
{ name: "Subtask 1" },
|
|
177
|
+
{ name: "Subtask 2" }
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## 3. GanttGenerator
|
|
183
|
+
|
|
184
|
+
### Purpose
|
|
185
|
+
|
|
186
|
+
Generate Mermaid Gantt charts with critical path analysis.
|
|
187
|
+
|
|
188
|
+
### Usage
|
|
189
|
+
|
|
190
|
+
```ruby
|
|
191
|
+
require_relative 'lib/aidp/planning/generators/gantt_generator'
|
|
192
|
+
|
|
193
|
+
# Create generator
|
|
194
|
+
generator = Aidp::Planning::Generators::GanttGenerator.new
|
|
195
|
+
|
|
196
|
+
# Generate Gantt chart from WBS
|
|
197
|
+
gantt = generator.generate(wbs: wbs)
|
|
198
|
+
# Returns: {
|
|
199
|
+
# tasks: [
|
|
200
|
+
# { id: "task1", name: "...", phase: "...", duration: 3, dependencies: [] },
|
|
201
|
+
# ...
|
|
202
|
+
# ],
|
|
203
|
+
# critical_path: ["task1", "task3", "task7"],
|
|
204
|
+
# mermaid: "gantt\n title Project Timeline\n ...",
|
|
205
|
+
# metadata: {
|
|
206
|
+
# generated_at: "...",
|
|
207
|
+
# total_tasks: 23,
|
|
208
|
+
# critical_path_length: 8
|
|
209
|
+
# }
|
|
210
|
+
# }
|
|
211
|
+
|
|
212
|
+
# Format as Mermaid syntax
|
|
213
|
+
mermaid_chart = gantt[:mermaid]
|
|
214
|
+
# => "gantt
|
|
215
|
+
# title Project Timeline
|
|
216
|
+
# dateFormat YYYY-MM-DD
|
|
217
|
+
# section Requirements
|
|
218
|
+
# Task 1 :crit, task1, 2d
|
|
219
|
+
# Task 2 :task2, after task1, 1d
|
|
220
|
+
# ..."
|
|
221
|
+
|
|
222
|
+
# Write output with critical path
|
|
223
|
+
output = ["# Project Gantt Chart", ""]
|
|
224
|
+
output << "```mermaid"
|
|
225
|
+
output << gantt[:mermaid]
|
|
226
|
+
output << "```"
|
|
227
|
+
output << ""
|
|
228
|
+
output << "## Critical Path"
|
|
229
|
+
output << ""
|
|
230
|
+
gantt[:critical_path].each_with_index do |task_id, idx|
|
|
231
|
+
output << "#{idx + 1}. #{task_id}"
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
File.write('.aidp/docs/GANTT.md', output.join("\n"))
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Duration Calculation
|
|
238
|
+
|
|
239
|
+
Converts story points to days:
|
|
240
|
+
|
|
241
|
+
- 1 story point = 0.5 days
|
|
242
|
+
- Minimum duration = 1 day
|
|
243
|
+
|
|
244
|
+
### Critical Path
|
|
245
|
+
|
|
246
|
+
The critical path is the longest sequence of dependent tasks. Any delay in critical path tasks delays the entire project.
|
|
247
|
+
|
|
248
|
+
## 4. PersonaMapper
|
|
249
|
+
|
|
250
|
+
### Purpose
|
|
251
|
+
|
|
252
|
+
Map tasks to personas using Zero Framework Cognition (NO heuristics!).
|
|
253
|
+
|
|
254
|
+
### Usage
|
|
255
|
+
|
|
256
|
+
```ruby
|
|
257
|
+
require_relative 'lib/aidp/planning/mappers/persona_mapper'
|
|
258
|
+
|
|
259
|
+
# Create mapper with AI decision engine (REQUIRED for ZFC)
|
|
260
|
+
mapper = Aidp::Planning::Mappers::PersonaMapper.new(
|
|
261
|
+
ai_decision_engine: ai_engine
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
# Assign personas to tasks
|
|
265
|
+
assignments = mapper.assign_personas(
|
|
266
|
+
gantt[:tasks],
|
|
267
|
+
available_personas: [
|
|
268
|
+
"product_strategist",
|
|
269
|
+
"architect",
|
|
270
|
+
"senior_developer",
|
|
271
|
+
"qa_engineer",
|
|
272
|
+
"devops_engineer",
|
|
273
|
+
"tech_writer"
|
|
274
|
+
]
|
|
275
|
+
)
|
|
276
|
+
# Returns: {
|
|
277
|
+
# assignments: {
|
|
278
|
+
# "task1" => {
|
|
279
|
+
# persona: "architect",
|
|
280
|
+
# task: "Design system architecture",
|
|
281
|
+
# phase: "Design",
|
|
282
|
+
# rationale: "AI-determined based on task characteristics"
|
|
283
|
+
# },
|
|
284
|
+
# ...
|
|
285
|
+
# },
|
|
286
|
+
# metadata: {
|
|
287
|
+
# generated_at: "...",
|
|
288
|
+
# total_assignments: 23,
|
|
289
|
+
# personas_used: ["architect", "senior_developer", "qa_engineer"]
|
|
290
|
+
# }
|
|
291
|
+
# }
|
|
292
|
+
|
|
293
|
+
# Generate YAML configuration
|
|
294
|
+
yaml_config = mapper.generate_persona_map(assignments)
|
|
295
|
+
File.write('.aidp/docs/persona_map.yml', yaml_config)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Zero Framework Cognition (ZFC)
|
|
299
|
+
|
|
300
|
+
**CRITICAL**: PersonaMapper uses `AIDecisionEngine.decide()` for ALL assignments.
|
|
301
|
+
|
|
302
|
+
**NEVER use**:
|
|
303
|
+
|
|
304
|
+
- Regex pattern matching
|
|
305
|
+
- Keyword matching
|
|
306
|
+
- Heuristic rules
|
|
307
|
+
- Scoring formulas
|
|
308
|
+
|
|
309
|
+
The AI makes semantic decisions based on:
|
|
310
|
+
|
|
311
|
+
- Task type and complexity
|
|
312
|
+
- Required skills and expertise
|
|
313
|
+
- Project phase
|
|
314
|
+
- Technical vs. product focus
|
|
315
|
+
|
|
316
|
+
### Default Personas
|
|
317
|
+
|
|
318
|
+
- `product_strategist` - Product requirements, user research, stakeholder management
|
|
319
|
+
- `architect` - System design, architecture decisions, technology choices
|
|
320
|
+
- `senior_developer` - Implementation, code quality, technical problem solving
|
|
321
|
+
- `qa_engineer` - Testing strategy, test implementation, quality assurance
|
|
322
|
+
- `devops_engineer` - Infrastructure, CI/CD, deployment, monitoring
|
|
323
|
+
- `tech_writer` - Documentation, user guides, API documentation
|
|
324
|
+
|
|
325
|
+
## 5. ProjectPlanBuilder
|
|
326
|
+
|
|
327
|
+
### Purpose
|
|
328
|
+
|
|
329
|
+
Orchestrate all generators and assemble complete project plan.
|
|
330
|
+
|
|
331
|
+
### Usage
|
|
332
|
+
|
|
333
|
+
```ruby
|
|
334
|
+
require_relative 'lib/aidp/planning/builders/project_plan_builder'
|
|
335
|
+
|
|
336
|
+
# Create builder with AI engine and optional component injection
|
|
337
|
+
builder = Aidp::Planning::Builders::ProjectPlanBuilder.new(
|
|
338
|
+
ai_decision_engine: ai_engine
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
# Build from existing documentation (ingestion path)
|
|
342
|
+
plan_components = builder.build_from_ingestion('.aidp/docs')
|
|
343
|
+
# Parses directory, generates WBS, Gantt, personas, assembles plan
|
|
344
|
+
|
|
345
|
+
# Build from scratch (generation path)
|
|
346
|
+
plan_components = builder.build_from_scratch(
|
|
347
|
+
problem: "Problem to solve",
|
|
348
|
+
goals: "Project goals",
|
|
349
|
+
success_criteria: "Success metrics"
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
# Assemble complete project plan document
|
|
353
|
+
project_plan_md = builder.assemble_project_plan(plan_components)
|
|
354
|
+
File.write('.aidp/docs/PROJECT_PLAN.md', project_plan_md)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Plan Components
|
|
358
|
+
|
|
359
|
+
```ruby
|
|
360
|
+
{
|
|
361
|
+
prd: parsed_prd,
|
|
362
|
+
tech_design: parsed_design,
|
|
363
|
+
wbs: wbs_structure,
|
|
364
|
+
wbs_markdown: wbs_formatted,
|
|
365
|
+
gantt: gantt_data,
|
|
366
|
+
gantt_mermaid: mermaid_chart,
|
|
367
|
+
critical_path: ["task1", "task5", "task9"],
|
|
368
|
+
persona_assignments: assignments
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Assembled Plan Structure
|
|
373
|
+
|
|
374
|
+
The assembled PROJECT_PLAN.md includes:
|
|
375
|
+
|
|
376
|
+
1. **Executive Summary**
|
|
377
|
+
2. **Work Breakdown Structure** (full WBS)
|
|
378
|
+
3. **Timeline and Gantt Chart** (Mermaid visualization)
|
|
379
|
+
4. **Critical Path** (task list)
|
|
380
|
+
5. **Persona Assignments** (grouped by persona)
|
|
381
|
+
6. **Metadata** (phase count, task count, personas used)
|
|
382
|
+
|
|
383
|
+
## Complete Example Workflow
|
|
384
|
+
|
|
385
|
+
### Scenario: Generate Complete Project Plan
|
|
386
|
+
|
|
387
|
+
```ruby
|
|
388
|
+
require_relative 'lib/aidp/planning/parsers/document_parser'
|
|
389
|
+
require_relative 'lib/aidp/planning/generators/wbs_generator'
|
|
390
|
+
require_relative 'lib/aidp/planning/generators/gantt_generator'
|
|
391
|
+
require_relative 'lib/aidp/planning/mappers/persona_mapper'
|
|
392
|
+
require_relative 'lib/aidp/planning/builders/project_plan_builder'
|
|
393
|
+
|
|
394
|
+
# Get AI decision engine (from AIDP configuration)
|
|
395
|
+
ai_engine = get_ai_decision_engine # Implementation-specific
|
|
396
|
+
|
|
397
|
+
# 1. Parse existing documentation
|
|
398
|
+
parser = Aidp::Planning::Parsers::DocumentParser.new(ai_decision_engine: ai_engine)
|
|
399
|
+
prd = parser.parse_file('.aidp/docs/PRD.md')
|
|
400
|
+
tech_design = parser.parse_file('.aidp/docs/TECH_DESIGN.md')
|
|
401
|
+
|
|
402
|
+
# 2. Generate WBS
|
|
403
|
+
wbs_generator = Aidp::Planning::Generators::WBSGenerator.new
|
|
404
|
+
wbs = wbs_generator.generate(prd: prd, tech_design: tech_design)
|
|
405
|
+
wbs_markdown = wbs_generator.format_as_markdown(wbs)
|
|
406
|
+
File.write('.aidp/docs/WBS.md', wbs_markdown)
|
|
407
|
+
|
|
408
|
+
# 3. Generate Gantt chart
|
|
409
|
+
gantt_generator = Aidp::Planning::Generators::GanttGenerator.new
|
|
410
|
+
gantt = gantt_generator.generate(wbs: wbs)
|
|
411
|
+
File.write('.aidp/docs/GANTT.md', gantt[:mermaid])
|
|
412
|
+
|
|
413
|
+
# 4. Assign personas
|
|
414
|
+
persona_mapper = Aidp::Planning::Mappers::PersonaMapper.new(ai_decision_engine: ai_engine)
|
|
415
|
+
assignments = persona_mapper.assign_personas(gantt[:tasks])
|
|
416
|
+
persona_yaml = persona_mapper.generate_persona_map(assignments)
|
|
417
|
+
File.write('.aidp/docs/persona_map.yml', persona_yaml)
|
|
418
|
+
|
|
419
|
+
# 5. Assemble complete plan
|
|
420
|
+
builder = Aidp::Planning::Builders::ProjectPlanBuilder.new(ai_decision_engine: ai_engine)
|
|
421
|
+
components = {
|
|
422
|
+
prd: prd,
|
|
423
|
+
tech_design: tech_design,
|
|
424
|
+
wbs: wbs,
|
|
425
|
+
wbs_markdown: wbs_markdown,
|
|
426
|
+
gantt: gantt,
|
|
427
|
+
gantt_mermaid: gantt[:mermaid],
|
|
428
|
+
critical_path: gantt[:critical_path],
|
|
429
|
+
persona_assignments: assignments
|
|
430
|
+
}
|
|
431
|
+
project_plan = builder.assemble_project_plan(components)
|
|
432
|
+
File.write('.aidp/docs/PROJECT_PLAN.md', project_plan)
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
## Dependency Injection for Testing
|
|
436
|
+
|
|
437
|
+
All classes support dependency injection for testing:
|
|
438
|
+
|
|
439
|
+
```ruby
|
|
440
|
+
# Custom parser for testing
|
|
441
|
+
mock_parser = double("DocumentParser")
|
|
442
|
+
wbs_gen = WBSGenerator.new
|
|
443
|
+
gantt_gen = GanttGenerator.new
|
|
444
|
+
persona_mapper = PersonaMapper.new(ai_decision_engine: mock_ai)
|
|
445
|
+
|
|
446
|
+
builder = ProjectPlanBuilder.new(
|
|
447
|
+
ai_decision_engine: mock_ai,
|
|
448
|
+
document_parser: mock_parser,
|
|
449
|
+
wbs_generator: wbs_gen,
|
|
450
|
+
gantt_generator: gantt_gen,
|
|
451
|
+
persona_mapper: persona_mapper
|
|
452
|
+
)
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Error Handling
|
|
456
|
+
|
|
457
|
+
All classes follow AIDP error handling patterns:
|
|
458
|
+
|
|
459
|
+
```ruby
|
|
460
|
+
begin
|
|
461
|
+
parsed = parser.parse_file(file_path)
|
|
462
|
+
rescue ArgumentError => e
|
|
463
|
+
# File not found or invalid path
|
|
464
|
+
Aidp.log_error("document_parser", "parse_failed", error: e.message, path: file_path)
|
|
465
|
+
raise
|
|
466
|
+
end
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Logging
|
|
470
|
+
|
|
471
|
+
All classes use `Aidp.log_debug()` extensively:
|
|
472
|
+
|
|
473
|
+
```ruby
|
|
474
|
+
Aidp.log_debug("wbs_generator", "generate", has_prd: true, has_design: true)
|
|
475
|
+
Aidp.log_debug("gantt_generator", "critical_path_found", length: 8, duration: 42)
|
|
476
|
+
Aidp.log_debug("persona_mapper", "assigned", task: "Design API", persona: "architect")
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## Configuration
|
|
480
|
+
|
|
481
|
+
Access waterfall configuration:
|
|
482
|
+
|
|
483
|
+
```ruby
|
|
484
|
+
config = Aidp::Config.waterfall_config
|
|
485
|
+
# Returns configuration hash with effort estimation and persona settings
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
## Best Practices
|
|
489
|
+
|
|
490
|
+
1. **Always provide AI decision engine** to PersonaMapper for ZFC
|
|
491
|
+
2. **Use dependency injection** for testing
|
|
492
|
+
3. **Log extensively** with Aidp.log_debug()
|
|
493
|
+
4. **Handle errors gracefully** and let them bubble up
|
|
494
|
+
5. **Write output files** in `.aidp/docs/` directory
|
|
495
|
+
6. **Follow Ruby style** (snake_case, keyword args, etc.)
|
|
496
|
+
|
|
497
|
+
**Remember: These are generic planning utilities usable by ANY workflow, not just waterfall!**
|