aidp 0.10.0 → 0.11.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 +194 -25
- data/lib/aidp/analyze/kb_inspector.rb +2 -15
- data/lib/aidp/analyze/progress.rb +2 -1
- data/lib/aidp/analyze/ruby_maat_integration.rb +2 -15
- data/lib/aidp/analyze/runner.rb +64 -20
- data/lib/aidp/analyze/steps.rb +10 -8
- data/lib/aidp/analyze/tree_sitter_grammar_loader.rb +2 -13
- data/lib/aidp/analyze/tree_sitter_scan.rb +2 -13
- data/lib/aidp/cli/checkpoint_command.rb +98 -0
- data/lib/aidp/cli/first_run_wizard.rb +65 -94
- data/lib/aidp/cli/jobs_command.rb +249 -34
- data/lib/aidp/cli.rb +312 -38
- data/lib/aidp/config.rb +5 -8
- data/lib/aidp/debug_logger.rb +4 -4
- data/lib/aidp/debug_mixin.rb +11 -4
- data/lib/aidp/execute/checkpoint.rb +282 -0
- data/lib/aidp/execute/checkpoint_display.rb +221 -0
- data/lib/aidp/execute/progress.rb +2 -1
- data/lib/aidp/execute/prompt_manager.rb +62 -0
- data/lib/aidp/execute/runner.rb +53 -24
- data/lib/aidp/execute/steps.rb +36 -27
- data/lib/aidp/execute/work_loop_runner.rb +308 -0
- data/lib/aidp/execute/workflow_selector.rb +26 -17
- data/lib/aidp/harness/condition_detector.rb +4 -4
- data/lib/aidp/harness/config_schema.rb +40 -0
- data/lib/aidp/harness/config_validator.rb +3 -6
- data/lib/aidp/harness/configuration.rb +35 -1
- data/lib/aidp/harness/enhanced_runner.rb +22 -1
- data/lib/aidp/harness/error_handler.rb +103 -28
- data/lib/aidp/harness/provider_factory.rb +4 -1
- data/lib/aidp/harness/provider_manager.rb +250 -15
- data/lib/aidp/harness/runner.rb +3 -14
- data/lib/aidp/harness/simple_user_interface.rb +2 -15
- data/lib/aidp/harness/status_display.rb +12 -17
- data/lib/aidp/harness/test_runner.rb +83 -0
- data/lib/aidp/harness/ui/enhanced_tui.rb +2 -0
- data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +22 -4
- data/lib/aidp/harness/ui/error_handler.rb +4 -0
- data/lib/aidp/harness/ui/frame_manager.rb +10 -8
- data/lib/aidp/harness/ui/job_monitor.rb +2 -0
- data/lib/aidp/harness/ui/navigation/main_menu.rb +4 -2
- data/lib/aidp/harness/ui/navigation/menu_item.rb +1 -0
- data/lib/aidp/harness/ui/navigation/menu_state.rb +1 -0
- data/lib/aidp/harness/ui/navigation/submenu.rb +1 -0
- data/lib/aidp/harness/ui/navigation/workflow_selector.rb +2 -0
- data/lib/aidp/harness/ui/progress_display.rb +8 -12
- data/lib/aidp/harness/ui/question_collector.rb +2 -0
- data/lib/aidp/harness/ui/spinner_group.rb +2 -0
- data/lib/aidp/harness/ui/spinner_helper.rb +1 -1
- data/lib/aidp/harness/ui/status_manager.rb +4 -2
- data/lib/aidp/harness/ui/status_widget.rb +3 -1
- data/lib/aidp/harness/ui/workflow_controller.rb +2 -0
- data/lib/aidp/harness/user_interface.rb +12 -17
- data/lib/aidp/jobs/background_runner.rb +278 -0
- data/lib/aidp/message_display.rb +48 -0
- data/lib/aidp/provider_manager.rb +3 -1
- data/lib/aidp/providers/anthropic.rb +100 -17
- data/lib/aidp/providers/base.rb +42 -11
- data/lib/aidp/providers/codex.rb +248 -0
- data/lib/aidp/providers/cursor.rb +35 -42
- data/lib/aidp/providers/gemini.rb +25 -15
- data/lib/aidp/providers/github_copilot.rb +41 -42
- data/lib/aidp/providers/opencode.rb +34 -41
- data/lib/aidp/version.rb +1 -1
- data/lib/aidp/workflows/definitions.rb +357 -0
- data/lib/aidp/workflows/selector.rb +171 -0
- data/lib/aidp.rb +12 -0
- data/templates/planning/generate_llm_style_guide.md +119 -0
- metadata +38 -26
- /data/templates/{ANALYZE/02_ARCHITECTURE_ANALYSIS.md → analysis/analyze_architecture.md} +0 -0
- /data/templates/{ANALYZE/05_DOCUMENTATION_ANALYSIS.md → analysis/analyze_documentation.md} +0 -0
- /data/templates/{ANALYZE/04_FUNCTIONALITY_ANALYSIS.md → analysis/analyze_functionality.md} +0 -0
- /data/templates/{ANALYZE/01_REPOSITORY_ANALYSIS.md → analysis/analyze_repository.md} +0 -0
- /data/templates/{ANALYZE/06_STATIC_ANALYSIS.md → analysis/analyze_static_code.md} +0 -0
- /data/templates/{ANALYZE/03_TEST_ANALYSIS.md → analysis/analyze_tests.md} +0 -0
- /data/templates/{ANALYZE/07_REFACTORING_RECOMMENDATIONS.md → analysis/recommend_refactoring.md} +0 -0
- /data/templates/{ANALYZE/06a_tree_sitter_scan.md → analysis/scan_with_tree_sitter.md} +0 -0
- /data/templates/{EXECUTE/11_STATIC_ANALYSIS.md → implementation/configure_static_analysis.md} +0 -0
- /data/templates/{EXECUTE/14_DOCS_PORTAL.md → implementation/create_documentation_portal.md} +0 -0
- /data/templates/{EXECUTE/10_IMPLEMENTATION_AGENT.md → implementation/implement_features.md} +0 -0
- /data/templates/{EXECUTE/13_DELIVERY_ROLLOUT.md → implementation/plan_delivery.md} +0 -0
- /data/templates/{EXECUTE/15_POST_RELEASE.md → implementation/review_post_release.md} +0 -0
- /data/templates/{EXECUTE/09_SCAFFOLDING_DEVEX.md → implementation/setup_scaffolding.md} +0 -0
- /data/templates/{EXECUTE/02A_ARCH_GATE_QUESTIONS.md → planning/ask_architecture_questions.md} +0 -0
- /data/templates/{EXECUTE/00_PRD.md → planning/create_prd.md} +0 -0
- /data/templates/{EXECUTE/08_TASKS.md → planning/create_tasks.md} +0 -0
- /data/templates/{EXECUTE/04_DOMAIN_DECOMPOSITION.md → planning/decompose_domain.md} +0 -0
- /data/templates/{EXECUTE/01_NFRS.md → planning/define_nfrs.md} +0 -0
- /data/templates/{EXECUTE/05_CONTRACTS.md → planning/design_apis.md} +0 -0
- /data/templates/{EXECUTE/02_ARCHITECTURE.md → planning/design_architecture.md} +0 -0
- /data/templates/{EXECUTE/06_THREAT_MODEL.md → planning/design_data_model.md} +0 -0
- /data/templates/{EXECUTE/03_ADR_FACTORY.md → planning/generate_adrs.md} +0 -0
- /data/templates/{EXECUTE/12_OBSERVABILITY_SLOS.md → planning/plan_observability.md} +0 -0
- /data/templates/{EXECUTE/07_TEST_PLAN.md → planning/plan_testing.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffba477d4ca2e297b4fe81d7ecb32ccf37d161df6bcd2dceaa91e94ccbc8ea8f
|
4
|
+
data.tar.gz: 851fdc47c7a12bd8f6f8304badf60ffdb6855787d0982645d80a309d9caee40b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef68650e5a8c55d8b219a00a42ba7fbff2c87bdd5cacf5f450c8bf406c481d6d1e4c00cd7edabbf41b07928bb28c2b5246c54392e67f52ee8381bac1668d9463
|
7
|
+
data.tar.gz: d2ae0a1bc041b0f8c0cdf1ccb3c328fc7bb1c4ba3cbb0599c983f4937056a8ad1f47e0bcb475a96dd8d4d936cfc6d7452a0333121ed36e29a14708b8e4bd15ec
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# AI Dev Pipeline (aidp) - Ruby Gem
|
2
2
|
|
3
|
-
A portable CLI that automates
|
3
|
+
A portable CLI that automates AI development workflows from idea to implementation using your existing IDE assistants. Features autonomous work loops, background execution, and comprehensive progress tracking.
|
4
4
|
|
5
5
|
## Quick Start
|
6
6
|
|
@@ -11,13 +11,16 @@ gem install aidp
|
|
11
11
|
# Navigate to your project
|
12
12
|
cd /your/project
|
13
13
|
|
14
|
-
# Start
|
15
|
-
aidp
|
14
|
+
# Start an interactive workflow
|
15
|
+
aidp execute
|
16
|
+
|
17
|
+
# Or run in background
|
18
|
+
aidp execute --background
|
16
19
|
```
|
17
20
|
|
18
21
|
### First-Time Setup
|
19
22
|
|
20
|
-
On the first run in a project without an `aidp.yml`, AIDP
|
23
|
+
On the first run in a project without an `aidp.yml`, AIDP launches a **First-Time Setup Wizard**. You'll be prompted to choose one of:
|
21
24
|
|
22
25
|
1. Minimal (single provider: cursor)
|
23
26
|
2. Development template (multiple providers, safe defaults)
|
@@ -27,43 +30,156 @@ On the first run in a project without an `aidp.yml`, AIDP now launches a **First
|
|
27
30
|
|
28
31
|
Non-interactive environments (CI, scripts, pipes) automatically receive a minimal `aidp.yml` so workflows can proceed without manual intervention.
|
29
32
|
|
30
|
-
You can re-run the wizard manually
|
33
|
+
You can re-run the wizard manually:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
aidp --setup-config
|
37
|
+
```
|
38
|
+
|
39
|
+
## Core Features
|
40
|
+
|
41
|
+
### Work Loops
|
42
|
+
|
43
|
+
AIDP implements **work loops** - an iterative execution pattern where AI agents autonomously work on tasks until completion, with automatic testing and linting feedback.
|
44
|
+
|
45
|
+
- **Iterative refinement**: Agent works in loops until task is 100% complete
|
46
|
+
- **Self-management**: Agent edits PROMPT.md to track its own progress
|
47
|
+
- **Automatic validation**: Tests and linters run after each iteration
|
48
|
+
- **Self-correction**: Only failures are fed back for the next iteration
|
49
|
+
|
50
|
+
See [Work Loops Guide](docs/WORK_LOOPS_GUIDE.md) for details.
|
51
|
+
|
52
|
+
### Background Execution
|
53
|
+
|
54
|
+
Run workflows in the background while monitoring progress from separate terminals:
|
55
|
+
|
56
|
+
```bash
|
57
|
+
# Start in background
|
58
|
+
aidp execute --background
|
59
|
+
✓ Started background job: 20251005_235912_a1b2c3d4
|
60
|
+
|
61
|
+
# Monitor progress
|
62
|
+
aidp jobs list # List all jobs
|
63
|
+
aidp jobs status <job_id> # Show job status
|
64
|
+
aidp jobs logs <job_id> --tail # View recent logs
|
65
|
+
aidp checkpoint summary --watch # Watch metrics in real-time
|
66
|
+
|
67
|
+
# Control jobs
|
68
|
+
aidp jobs stop <job_id> # Stop a running job
|
69
|
+
```
|
70
|
+
|
71
|
+
### Progress Checkpoints
|
31
72
|
|
32
|
-
|
73
|
+
Track code quality metrics and task progress throughout execution:
|
33
74
|
|
34
|
-
|
75
|
+
```bash
|
76
|
+
# View current progress
|
77
|
+
aidp checkpoint summary
|
78
|
+
|
79
|
+
# Watch with auto-refresh
|
80
|
+
aidp checkpoint summary --watch
|
81
|
+
|
82
|
+
# View historical data
|
83
|
+
aidp checkpoint history 20
|
84
|
+
```
|
35
85
|
|
36
|
-
|
86
|
+
**Tracked Metrics:**
|
37
87
|
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
-
|
43
|
-
- **💬 Smart Question Collection**: Interactive prompts with validation and error handling
|
88
|
+
- Lines of code
|
89
|
+
- Test coverage
|
90
|
+
- Code quality scores
|
91
|
+
- PRD task completion percentage
|
92
|
+
- File count and growth trends
|
44
93
|
|
45
|
-
|
94
|
+
## Command Reference
|
95
|
+
|
96
|
+
### Execution Modes
|
46
97
|
|
47
98
|
```bash
|
48
|
-
#
|
49
|
-
aidp
|
99
|
+
# Execute mode - Build new features
|
100
|
+
aidp execute # Interactive workflow selection
|
101
|
+
aidp execute --background # Run in background
|
102
|
+
aidp execute --background --follow # Start and follow logs
|
103
|
+
|
104
|
+
# Analyze mode - Analyze codebase
|
105
|
+
aidp analyze # Interactive analysis
|
106
|
+
aidp analyze --background # Background analysis
|
107
|
+
```
|
50
108
|
|
51
|
-
|
52
|
-
|
109
|
+
### Job Management
|
110
|
+
|
111
|
+
```bash
|
112
|
+
# List all background jobs
|
113
|
+
aidp jobs list
|
53
114
|
|
54
|
-
# Show
|
55
|
-
aidp
|
115
|
+
# Show job status
|
116
|
+
aidp jobs status <job_id>
|
117
|
+
aidp jobs status <job_id> --follow # Follow with auto-refresh
|
118
|
+
|
119
|
+
# View job logs
|
120
|
+
aidp jobs logs <job_id>
|
121
|
+
aidp jobs logs <job_id> --tail # Last 50 lines
|
122
|
+
aidp jobs logs <job_id> --follow # Stream in real-time
|
123
|
+
|
124
|
+
# Stop a running job
|
125
|
+
aidp jobs stop <job_id>
|
126
|
+
```
|
127
|
+
|
128
|
+
### Checkpoint Monitoring
|
129
|
+
|
130
|
+
```bash
|
131
|
+
# View latest checkpoint
|
132
|
+
aidp checkpoint show
|
133
|
+
|
134
|
+
# Progress summary with trends
|
135
|
+
aidp checkpoint summary
|
136
|
+
aidp checkpoint summary --watch # Auto-refresh every 5s
|
137
|
+
aidp checkpoint summary --watch --interval 10 # Custom interval
|
138
|
+
|
139
|
+
# View checkpoint history
|
140
|
+
aidp checkpoint history # Last 10 checkpoints
|
141
|
+
aidp checkpoint history 50 # Last 50 checkpoints
|
142
|
+
|
143
|
+
# Detailed metrics
|
144
|
+
aidp checkpoint metrics
|
145
|
+
|
146
|
+
# Clear checkpoint data
|
147
|
+
aidp checkpoint clear
|
148
|
+
aidp checkpoint clear --force # Skip confirmation
|
149
|
+
```
|
150
|
+
|
151
|
+
### System Commands
|
152
|
+
|
153
|
+
```bash
|
154
|
+
# Show system status
|
155
|
+
aidp status
|
156
|
+
|
157
|
+
# Provider health dashboard
|
158
|
+
aidp providers
|
159
|
+
|
160
|
+
# Harness state management
|
161
|
+
aidp harness status
|
162
|
+
aidp harness reset
|
163
|
+
|
164
|
+
# Configuration
|
165
|
+
aidp --setup-config # Re-run setup wizard
|
166
|
+
aidp --help # Show all commands
|
167
|
+
aidp --version # Show version
|
56
168
|
```
|
57
169
|
|
58
170
|
## AI Providers
|
59
171
|
|
60
172
|
AIDP intelligently manages multiple providers with automatic switching:
|
61
173
|
|
62
|
-
- **Claude
|
63
|
-
- **
|
174
|
+
- **Anthropic Claude CLI** - Primary provider for complex analysis and code generation
|
175
|
+
- **Codex CLI** - OpenAI's Codex command-line interface for code generation
|
64
176
|
- **Cursor CLI** - IDE-integrated provider for code-specific tasks
|
177
|
+
- **Gemini CLI** - Google's Gemini command-line interface for general tasks
|
178
|
+
- **GitHub Copilot CLI** - GitHub's AI pair programmer command-line interface
|
179
|
+
- **macOS UI** - macOS-specific UI automation provider
|
180
|
+
- **OpenCode** - Alternative open-source code generation provider
|
65
181
|
|
66
|
-
The
|
182
|
+
The system automatically switches providers when:
|
67
183
|
|
68
184
|
- Rate limits are hit
|
69
185
|
- Providers fail or timeout
|
@@ -74,6 +190,15 @@ The TUI automatically switches providers when:
|
|
74
190
|
|
75
191
|
```yaml
|
76
192
|
# aidp.yml
|
193
|
+
harness:
|
194
|
+
work_loop:
|
195
|
+
enabled: true
|
196
|
+
max_iterations: 50
|
197
|
+
test_commands:
|
198
|
+
- "bundle exec rspec"
|
199
|
+
lint_commands:
|
200
|
+
- "bundle exec standardrb"
|
201
|
+
|
77
202
|
providers:
|
78
203
|
claude:
|
79
204
|
type: "usage_based"
|
@@ -190,6 +315,49 @@ When the AI creates a questions file, follow these steps:
|
|
190
315
|
|
191
316
|
The questions file is only created when the AI needs additional information beyond what it can infer from your project structure and existing files. Your answers are preserved for future reference.
|
192
317
|
|
318
|
+
## Workflow Examples
|
319
|
+
|
320
|
+
### Standard Interactive Workflow
|
321
|
+
|
322
|
+
```bash
|
323
|
+
# Start execute mode
|
324
|
+
aidp execute
|
325
|
+
|
326
|
+
# Select workflow type (e.g., "Full PRD to Implementation")
|
327
|
+
# Answer any questions interactively
|
328
|
+
# Review generated files (PRD, architecture, etc.)
|
329
|
+
# Workflow runs automatically with harness managing retries
|
330
|
+
```
|
331
|
+
|
332
|
+
### Background Workflow with Monitoring
|
333
|
+
|
334
|
+
```bash
|
335
|
+
# Terminal 1: Start background execution
|
336
|
+
aidp execute --background
|
337
|
+
✓ Started background job: 20251005_235912_a1b2c3d4
|
338
|
+
|
339
|
+
# Terminal 2: Watch progress in real-time
|
340
|
+
aidp checkpoint summary --watch
|
341
|
+
|
342
|
+
# Terminal 3: Monitor job status
|
343
|
+
aidp jobs status 20251005_235912_a1b2c3d4 --follow
|
344
|
+
|
345
|
+
# Later: Check final results
|
346
|
+
aidp checkpoint summary
|
347
|
+
aidp jobs logs 20251005_235912_a1b2c3d4 --tail
|
348
|
+
```
|
349
|
+
|
350
|
+
### Quick Analysis
|
351
|
+
|
352
|
+
```bash
|
353
|
+
# Run analysis in background
|
354
|
+
aidp analyze --background
|
355
|
+
|
356
|
+
# Check progress
|
357
|
+
aidp jobs list
|
358
|
+
aidp checkpoint summary
|
359
|
+
```
|
360
|
+
|
193
361
|
## Debug and Logging
|
194
362
|
|
195
363
|
```bash
|
@@ -247,7 +415,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and conventional co
|
|
247
415
|
|
248
416
|
For detailed information:
|
249
417
|
|
250
|
-
- **[
|
418
|
+
- **[CLI User Guide](docs/CLI_USER_GUIDE.md)** - Complete guide to using AIDP commands
|
419
|
+
- **[Work Loops Guide](docs/WORK_LOOPS_GUIDE.md)** - Iterative workflows with automatic validation
|
251
420
|
- **[Configuration Guide](docs/harness-configuration.md)** - Detailed configuration options and examples
|
252
421
|
- **[Troubleshooting Guide](docs/harness-troubleshooting.md)** - Common issues and solutions
|
253
422
|
|
@@ -7,27 +7,14 @@ require "tty-prompt"
|
|
7
7
|
module Aidp
|
8
8
|
module Analyze
|
9
9
|
class KBInspector
|
10
|
+
include Aidp::MessageDisplay
|
11
|
+
|
10
12
|
def initialize(kb_dir = ".aidp/kb", prompt: TTY::Prompt.new)
|
11
13
|
@kb_dir = File.expand_path(kb_dir)
|
12
14
|
@prompt = prompt
|
13
15
|
@data = load_kb_data
|
14
16
|
end
|
15
17
|
|
16
|
-
# Helper method for consistent message display using TTY::Prompt
|
17
|
-
def display_message(message, type: :info)
|
18
|
-
color = case type
|
19
|
-
when :error then :red
|
20
|
-
when :success then :green
|
21
|
-
when :warning then :yellow
|
22
|
-
when :info then :blue
|
23
|
-
when :highlight then :cyan
|
24
|
-
when :muted then :bright_black
|
25
|
-
else :white
|
26
|
-
end
|
27
|
-
|
28
|
-
@prompt.say(message, color: color)
|
29
|
-
end
|
30
|
-
|
31
18
|
def show(type, format: "summary")
|
32
19
|
case type
|
33
20
|
when "seams"
|
@@ -11,7 +11,7 @@ module Aidp
|
|
11
11
|
|
12
12
|
def initialize(project_dir)
|
13
13
|
@project_dir = project_dir
|
14
|
-
@progress_file = File.join(project_dir, ".aidp
|
14
|
+
@progress_file = File.join(project_dir, ".aidp", "progress", "analyze.yml")
|
15
15
|
load_progress
|
16
16
|
end
|
17
17
|
|
@@ -80,6 +80,7 @@ module Aidp
|
|
80
80
|
# In test mode, skip file operations to avoid hanging
|
81
81
|
return if ENV["RACK_ENV"] == "test" || defined?(RSpec)
|
82
82
|
|
83
|
+
FileUtils.mkdir_p(File.dirname(@progress_file))
|
83
84
|
File.write(@progress_file, @progress.to_yaml)
|
84
85
|
end
|
85
86
|
end
|
@@ -8,6 +8,8 @@ require "fileutils"
|
|
8
8
|
module Aidp
|
9
9
|
module Analyze
|
10
10
|
class RubyMaatIntegration
|
11
|
+
include Aidp::MessageDisplay
|
12
|
+
|
11
13
|
def initialize(project_dir = Dir.pwd, prompt: TTY::Prompt.new)
|
12
14
|
@project_dir = project_dir
|
13
15
|
@prompt = prompt
|
@@ -455,21 +457,6 @@ module Aidp
|
|
455
457
|
|
456
458
|
result.success? && !result.out.strip.empty?
|
457
459
|
end
|
458
|
-
|
459
|
-
private
|
460
|
-
|
461
|
-
# Helper method for consistent message display using TTY::Prompt
|
462
|
-
def display_message(message, type: :info)
|
463
|
-
color = case type
|
464
|
-
when :error then :red
|
465
|
-
when :warn then :yellow
|
466
|
-
when :success then :green
|
467
|
-
when :highlight then :cyan
|
468
|
-
else :white
|
469
|
-
end
|
470
|
-
|
471
|
-
@prompt.say(message, color: color)
|
472
|
-
end
|
473
460
|
end
|
474
461
|
end
|
475
462
|
end
|
data/lib/aidp/analyze/runner.rb
CHANGED
@@ -10,6 +10,7 @@ module Aidp
|
|
10
10
|
module Analyze
|
11
11
|
class Runner
|
12
12
|
include Aidp::DebugMixin
|
13
|
+
include Aidp::MessageDisplay
|
13
14
|
|
14
15
|
def initialize(project_dir, harness_runner = nil, prompt: TTY::Prompt.new)
|
15
16
|
@project_dir = project_dir
|
@@ -25,18 +26,6 @@ module Aidp
|
|
25
26
|
|
26
27
|
private
|
27
28
|
|
28
|
-
def display_message(message, type: :info)
|
29
|
-
color = case type
|
30
|
-
when :error then :red
|
31
|
-
when :success then :green
|
32
|
-
when :warning then :yellow
|
33
|
-
when :info then :blue
|
34
|
-
when :highlight then :cyan
|
35
|
-
else :white
|
36
|
-
end
|
37
|
-
@prompt.say(message, color: color)
|
38
|
-
end
|
39
|
-
|
40
29
|
public
|
41
30
|
|
42
31
|
def run_step(step_name, options = {})
|
@@ -60,7 +49,7 @@ module Aidp
|
|
60
49
|
# Harness-aware step execution
|
61
50
|
def run_step_with_harness(step_name, options = {})
|
62
51
|
# Get current provider from harness
|
63
|
-
current_provider =
|
52
|
+
current_provider = get_harness_provider_safely
|
64
53
|
provider_type = current_provider || "cursor"
|
65
54
|
|
66
55
|
debug_step(step_name, "Harness execution", {
|
@@ -198,7 +187,10 @@ module Aidp
|
|
198
187
|
|
199
188
|
def template_search_paths
|
200
189
|
[
|
201
|
-
File.join(@project_dir, "templates",
|
190
|
+
File.join(@project_dir, "templates"), # Root templates folder
|
191
|
+
File.join(@project_dir, "templates", "analysis"),
|
192
|
+
File.join(@project_dir, "templates", "planning"),
|
193
|
+
File.join(@project_dir, "templates", "implementation"),
|
202
194
|
File.join(@project_dir, "templates", "COMMON")
|
203
195
|
]
|
204
196
|
end
|
@@ -241,11 +233,11 @@ module Aidp
|
|
241
233
|
# Add current execution context
|
242
234
|
context_parts << "## Analysis Context"
|
243
235
|
context_parts << "Project Directory: #{@project_dir}"
|
244
|
-
context_parts << "Current Step: #{
|
245
|
-
context_parts << "Current Provider: #{
|
236
|
+
context_parts << "Current Step: #{get_harness_current_step_safely}"
|
237
|
+
context_parts << "Current Provider: #{get_harness_provider_safely}"
|
246
238
|
|
247
239
|
# Add user input context
|
248
|
-
user_input =
|
240
|
+
user_input = get_harness_user_input_safely
|
249
241
|
if user_input && !user_input.empty?
|
250
242
|
context_parts << "\n## Previous User Input"
|
251
243
|
user_input.each do |key, value|
|
@@ -254,7 +246,7 @@ module Aidp
|
|
254
246
|
end
|
255
247
|
|
256
248
|
# Add execution history context
|
257
|
-
execution_log =
|
249
|
+
execution_log = get_harness_execution_log_safely
|
258
250
|
if execution_log && !execution_log.empty?
|
259
251
|
context_parts << "\n## Analysis History"
|
260
252
|
recent_logs = execution_log.last(5) # Last 5 entries
|
@@ -268,8 +260,9 @@ module Aidp
|
|
268
260
|
|
269
261
|
# Execute step with harness provider management
|
270
262
|
def execute_with_harness_provider(provider_type, prompt, step_name, _options)
|
271
|
-
# Get provider manager from harness
|
272
|
-
provider_manager =
|
263
|
+
# Get provider manager from harness safely
|
264
|
+
provider_manager = get_harness_provider_manager_safely
|
265
|
+
return {status: "failed", error: "No provider manager available"} unless provider_manager
|
273
266
|
|
274
267
|
# Execute with provider
|
275
268
|
provider_manager.execute_with_provider(provider_type, prompt, {
|
@@ -343,6 +336,57 @@ module Aidp
|
|
343
336
|
})
|
344
337
|
end
|
345
338
|
end
|
339
|
+
|
340
|
+
# Safely get current provider from harness runner
|
341
|
+
def get_harness_provider_safely
|
342
|
+
return "cursor" unless @harness_runner
|
343
|
+
return "cursor" unless @harness_runner.respond_to?(:current_provider)
|
344
|
+
|
345
|
+
@harness_runner.current_provider || "cursor"
|
346
|
+
rescue => e
|
347
|
+
debug_log("⚠️ Failed to get current provider from harness", level: :warn, data: {error: e.message})
|
348
|
+
"cursor"
|
349
|
+
end
|
350
|
+
|
351
|
+
def get_harness_current_step_safely
|
352
|
+
return "unknown" unless @harness_runner
|
353
|
+
return "unknown" unless @harness_runner.respond_to?(:current_step)
|
354
|
+
|
355
|
+
@harness_runner.current_step || "unknown"
|
356
|
+
rescue => e
|
357
|
+
debug_log("⚠️ Failed to get current step from harness", level: :warn, data: {error: e.message})
|
358
|
+
"unknown"
|
359
|
+
end
|
360
|
+
|
361
|
+
def get_harness_user_input_safely
|
362
|
+
return {} unless @harness_runner
|
363
|
+
return {} unless @harness_runner.respond_to?(:user_input)
|
364
|
+
|
365
|
+
@harness_runner.user_input || {}
|
366
|
+
rescue => e
|
367
|
+
debug_log("⚠️ Failed to get user input from harness", level: :warn, data: {error: e.message})
|
368
|
+
{}
|
369
|
+
end
|
370
|
+
|
371
|
+
def get_harness_execution_log_safely
|
372
|
+
return [] unless @harness_runner
|
373
|
+
return [] unless @harness_runner.respond_to?(:execution_log)
|
374
|
+
|
375
|
+
@harness_runner.execution_log || []
|
376
|
+
rescue => e
|
377
|
+
debug_log("⚠️ Failed to get execution log from harness", level: :warn, data: {error: e.message})
|
378
|
+
[]
|
379
|
+
end
|
380
|
+
|
381
|
+
def get_harness_provider_manager_safely
|
382
|
+
return nil unless @harness_runner
|
383
|
+
return nil unless @harness_runner.respond_to?(:provider_manager)
|
384
|
+
|
385
|
+
@harness_runner.provider_manager
|
386
|
+
rescue => e
|
387
|
+
debug_log("⚠️ Failed to get provider manager from harness", level: :warn, data: {error: e.message})
|
388
|
+
nil
|
389
|
+
end
|
346
390
|
end
|
347
391
|
end
|
348
392
|
end
|
data/lib/aidp/analyze/steps.rb
CHANGED
@@ -3,51 +3,53 @@
|
|
3
3
|
module Aidp
|
4
4
|
module Analyze
|
5
5
|
module Steps
|
6
|
+
# Analysis step specifications
|
7
|
+
# Templates are organized by purpose and named with action verbs
|
6
8
|
SPEC = {
|
7
9
|
"01_REPOSITORY_ANALYSIS" => {
|
8
|
-
"templates" => ["
|
10
|
+
"templates" => ["analysis/analyze_repository.md"],
|
9
11
|
"description" => "Initial code-maat based repository mining",
|
10
12
|
"outs" => ["docs/analysis/repository_analysis.md"],
|
11
13
|
"gate" => false
|
12
14
|
},
|
13
15
|
"02_ARCHITECTURE_ANALYSIS" => {
|
14
|
-
"templates" => ["
|
16
|
+
"templates" => ["analysis/analyze_architecture.md"],
|
15
17
|
"description" => "Identify architectural patterns, dependencies, and violations",
|
16
18
|
"outs" => ["docs/analysis/architecture_analysis.md"],
|
17
19
|
"gate" => true
|
18
20
|
},
|
19
21
|
"03_TEST_ANALYSIS" => {
|
20
|
-
"templates" => ["
|
22
|
+
"templates" => ["analysis/analyze_tests.md"],
|
21
23
|
"description" => "Analyze existing test coverage and identify gaps",
|
22
24
|
"outs" => ["docs/analysis/test_analysis.md"],
|
23
25
|
"gate" => false
|
24
26
|
},
|
25
27
|
"04_FUNCTIONALITY_ANALYSIS" => {
|
26
|
-
"templates" => ["
|
28
|
+
"templates" => ["analysis/analyze_functionality.md"],
|
27
29
|
"description" => "Map features, identify dead code, analyze complexity",
|
28
30
|
"outs" => ["docs/analysis/functionality_analysis.md"],
|
29
31
|
"gate" => false
|
30
32
|
},
|
31
33
|
"05_DOCUMENTATION_ANALYSIS" => {
|
32
|
-
"templates" => ["
|
34
|
+
"templates" => ["analysis/analyze_documentation.md"],
|
33
35
|
"description" => "Identify missing documentation and generate what's needed",
|
34
36
|
"outs" => ["docs/analysis/documentation_analysis.md"],
|
35
37
|
"gate" => false
|
36
38
|
},
|
37
39
|
"06_STATIC_ANALYSIS" => {
|
38
|
-
"templates" => ["
|
40
|
+
"templates" => ["analysis/analyze_static_code.md"],
|
39
41
|
"description" => "Check for existing tools and recommend improvements",
|
40
42
|
"outs" => ["docs/analysis/static_analysis.md"],
|
41
43
|
"gate" => false
|
42
44
|
},
|
43
45
|
"06A_TREE_SITTER_SCAN" => {
|
44
|
-
"templates" => ["
|
46
|
+
"templates" => ["analysis/scan_with_tree_sitter.md"],
|
45
47
|
"description" => "Tree-sitter powered static analysis to build knowledge base",
|
46
48
|
"outs" => [".aidp/kb/symbols.json", ".aidp/kb/seams.json", ".aidp/kb/hotspots.json"],
|
47
49
|
"gate" => false
|
48
50
|
},
|
49
51
|
"07_REFACTORING_RECOMMENDATIONS" => {
|
50
|
-
"templates" => ["
|
52
|
+
"templates" => ["analysis/recommend_refactoring.md"],
|
51
53
|
"description" => "Provide actionable refactoring guidance",
|
52
54
|
"outs" => ["docs/analysis/refactoring_recommendations.md"],
|
53
55
|
"gate" => true
|
@@ -8,6 +8,8 @@ require "fileutils"
|
|
8
8
|
module Aidp
|
9
9
|
module Analyze
|
10
10
|
class TreeSitterGrammarLoader
|
11
|
+
include Aidp::MessageDisplay
|
12
|
+
|
11
13
|
# Default grammar configurations
|
12
14
|
GRAMMAR_CONFIGS = {
|
13
15
|
"ruby" => {
|
@@ -480,19 +482,6 @@ module Aidp
|
|
480
482
|
end
|
481
483
|
|
482
484
|
private
|
483
|
-
|
484
|
-
# Helper method for consistent message display using TTY::Prompt
|
485
|
-
def display_message(message, type: :info)
|
486
|
-
color = case type
|
487
|
-
when :error then :red
|
488
|
-
when :warn then :yellow
|
489
|
-
when :success then :green
|
490
|
-
when :highlight then :cyan
|
491
|
-
else :white
|
492
|
-
end
|
493
|
-
|
494
|
-
@prompt.say(message, color: color)
|
495
|
-
end
|
496
485
|
end
|
497
486
|
end
|
498
487
|
end
|
@@ -12,6 +12,8 @@ require_relative "seams"
|
|
12
12
|
module Aidp
|
13
13
|
module Analyze
|
14
14
|
class TreeSitterScan
|
15
|
+
include Aidp::MessageDisplay
|
16
|
+
|
15
17
|
def initialize(root: Dir.pwd, kb_dir: ".aidp/kb", langs: %w[ruby], threads: Etc.nprocessors, prompt: TTY::Prompt.new)
|
16
18
|
@root = File.expand_path(root)
|
17
19
|
@kb_dir = File.expand_path(kb_dir, @root)
|
@@ -685,19 +687,6 @@ module Aidp
|
|
685
687
|
end
|
686
688
|
|
687
689
|
private
|
688
|
-
|
689
|
-
# Helper method for consistent message display using TTY::Prompt
|
690
|
-
def display_message(message, type: :info)
|
691
|
-
color = case type
|
692
|
-
when :error then :red
|
693
|
-
when :warn then :yellow
|
694
|
-
when :success then :green
|
695
|
-
when :highlight then :cyan
|
696
|
-
else :white
|
697
|
-
end
|
698
|
-
|
699
|
-
@prompt.say(message, color: color)
|
700
|
-
end
|
701
690
|
end
|
702
691
|
end
|
703
692
|
end
|