aidp 0.7.0 → 0.8.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.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +60 -214
  3. data/bin/aidp +1 -1
  4. data/lib/aidp/analysis/kb_inspector.rb +38 -23
  5. data/lib/aidp/analysis/seams.rb +2 -31
  6. data/lib/aidp/analysis/tree_sitter_grammar_loader.rb +0 -13
  7. data/lib/aidp/analysis/tree_sitter_scan.rb +3 -20
  8. data/lib/aidp/analyze/error_handler.rb +2 -75
  9. data/lib/aidp/analyze/json_file_storage.rb +292 -0
  10. data/lib/aidp/analyze/progress.rb +12 -0
  11. data/lib/aidp/analyze/progress_visualizer.rb +12 -17
  12. data/lib/aidp/analyze/ruby_maat_integration.rb +13 -31
  13. data/lib/aidp/analyze/runner.rb +256 -87
  14. data/lib/aidp/cli/jobs_command.rb +100 -432
  15. data/lib/aidp/cli.rb +309 -239
  16. data/lib/aidp/config.rb +298 -10
  17. data/lib/aidp/debug_logger.rb +195 -0
  18. data/lib/aidp/debug_mixin.rb +187 -0
  19. data/lib/aidp/execute/progress.rb +9 -0
  20. data/lib/aidp/execute/runner.rb +221 -40
  21. data/lib/aidp/execute/steps.rb +17 -7
  22. data/lib/aidp/execute/workflow_selector.rb +211 -0
  23. data/lib/aidp/harness/completion_checker.rb +268 -0
  24. data/lib/aidp/harness/condition_detector.rb +1526 -0
  25. data/lib/aidp/harness/config_loader.rb +373 -0
  26. data/lib/aidp/harness/config_manager.rb +382 -0
  27. data/lib/aidp/harness/config_schema.rb +1006 -0
  28. data/lib/aidp/harness/config_validator.rb +355 -0
  29. data/lib/aidp/harness/configuration.rb +477 -0
  30. data/lib/aidp/harness/enhanced_runner.rb +494 -0
  31. data/lib/aidp/harness/error_handler.rb +616 -0
  32. data/lib/aidp/harness/provider_config.rb +423 -0
  33. data/lib/aidp/harness/provider_factory.rb +306 -0
  34. data/lib/aidp/harness/provider_manager.rb +1269 -0
  35. data/lib/aidp/harness/provider_type_checker.rb +88 -0
  36. data/lib/aidp/harness/runner.rb +411 -0
  37. data/lib/aidp/harness/state/errors.rb +28 -0
  38. data/lib/aidp/harness/state/metrics.rb +219 -0
  39. data/lib/aidp/harness/state/persistence.rb +128 -0
  40. data/lib/aidp/harness/state/provider_state.rb +132 -0
  41. data/lib/aidp/harness/state/ui_state.rb +68 -0
  42. data/lib/aidp/harness/state/workflow_state.rb +123 -0
  43. data/lib/aidp/harness/state_manager.rb +586 -0
  44. data/lib/aidp/harness/status_display.rb +888 -0
  45. data/lib/aidp/harness/ui/base.rb +16 -0
  46. data/lib/aidp/harness/ui/enhanced_tui.rb +545 -0
  47. data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +252 -0
  48. data/lib/aidp/harness/ui/error_handler.rb +132 -0
  49. data/lib/aidp/harness/ui/frame_manager.rb +361 -0
  50. data/lib/aidp/harness/ui/job_monitor.rb +500 -0
  51. data/lib/aidp/harness/ui/navigation/main_menu.rb +311 -0
  52. data/lib/aidp/harness/ui/navigation/menu_formatter.rb +120 -0
  53. data/lib/aidp/harness/ui/navigation/menu_item.rb +142 -0
  54. data/lib/aidp/harness/ui/navigation/menu_state.rb +139 -0
  55. data/lib/aidp/harness/ui/navigation/submenu.rb +202 -0
  56. data/lib/aidp/harness/ui/navigation/workflow_selector.rb +176 -0
  57. data/lib/aidp/harness/ui/progress_display.rb +280 -0
  58. data/lib/aidp/harness/ui/question_collector.rb +141 -0
  59. data/lib/aidp/harness/ui/spinner_group.rb +184 -0
  60. data/lib/aidp/harness/ui/spinner_helper.rb +152 -0
  61. data/lib/aidp/harness/ui/status_manager.rb +312 -0
  62. data/lib/aidp/harness/ui/status_widget.rb +280 -0
  63. data/lib/aidp/harness/ui/workflow_controller.rb +312 -0
  64. data/lib/aidp/harness/user_interface.rb +2381 -0
  65. data/lib/aidp/provider_manager.rb +131 -7
  66. data/lib/aidp/providers/anthropic.rb +28 -103
  67. data/lib/aidp/providers/base.rb +170 -0
  68. data/lib/aidp/providers/cursor.rb +52 -181
  69. data/lib/aidp/providers/gemini.rb +24 -107
  70. data/lib/aidp/providers/macos_ui.rb +99 -5
  71. data/lib/aidp/providers/opencode.rb +194 -0
  72. data/lib/aidp/storage/csv_storage.rb +172 -0
  73. data/lib/aidp/storage/file_manager.rb +214 -0
  74. data/lib/aidp/storage/json_storage.rb +140 -0
  75. data/lib/aidp/version.rb +1 -1
  76. data/lib/aidp.rb +54 -39
  77. data/templates/COMMON/AGENT_BASE.md +11 -0
  78. data/templates/EXECUTE/00_PRD.md +4 -4
  79. data/templates/EXECUTE/02_ARCHITECTURE.md +5 -4
  80. data/templates/EXECUTE/07_TEST_PLAN.md +4 -1
  81. data/templates/EXECUTE/08_TASKS.md +4 -4
  82. data/templates/EXECUTE/10_IMPLEMENTATION_AGENT.md +4 -4
  83. data/templates/README.md +279 -0
  84. data/templates/aidp-development.yml.example +373 -0
  85. data/templates/aidp-minimal.yml.example +48 -0
  86. data/templates/aidp-production.yml.example +475 -0
  87. data/templates/aidp.yml.example +598 -0
  88. metadata +93 -69
  89. data/lib/aidp/analyze/agent_personas.rb +0 -71
  90. data/lib/aidp/analyze/agent_tool_executor.rb +0 -439
  91. data/lib/aidp/analyze/data_retention_manager.rb +0 -421
  92. data/lib/aidp/analyze/database.rb +0 -260
  93. data/lib/aidp/analyze/dependencies.rb +0 -335
  94. data/lib/aidp/analyze/export_manager.rb +0 -418
  95. data/lib/aidp/analyze/focus_guidance.rb +0 -517
  96. data/lib/aidp/analyze/incremental_analyzer.rb +0 -533
  97. data/lib/aidp/analyze/language_analysis_strategies.rb +0 -897
  98. data/lib/aidp/analyze/large_analysis_progress.rb +0 -499
  99. data/lib/aidp/analyze/memory_manager.rb +0 -339
  100. data/lib/aidp/analyze/metrics_storage.rb +0 -336
  101. data/lib/aidp/analyze/parallel_processor.rb +0 -454
  102. data/lib/aidp/analyze/performance_optimizer.rb +0 -691
  103. data/lib/aidp/analyze/repository_chunker.rb +0 -697
  104. data/lib/aidp/analyze/static_analysis_detector.rb +0 -577
  105. data/lib/aidp/analyze/storage.rb +0 -655
  106. data/lib/aidp/analyze/tool_configuration.rb +0 -441
  107. data/lib/aidp/analyze/tool_modernization.rb +0 -750
  108. data/lib/aidp/database/pg_adapter.rb +0 -148
  109. data/lib/aidp/database_config.rb +0 -69
  110. data/lib/aidp/database_connection.rb +0 -72
  111. data/lib/aidp/job_manager.rb +0 -41
  112. data/lib/aidp/jobs/base_job.rb +0 -45
  113. data/lib/aidp/jobs/provider_execution_job.rb +0 -83
  114. data/lib/aidp/project_detector.rb +0 -117
  115. data/lib/aidp/providers/agent_supervisor.rb +0 -348
  116. data/lib/aidp/providers/supervised_base.rb +0 -317
  117. data/lib/aidp/providers/supervised_cursor.rb +0 -22
  118. data/lib/aidp/sync.rb +0 -13
  119. data/lib/aidp/workspace.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e32a892070257857ac578c965a7aa1bb240a1a40a58f884bc6740a5aa6a57804
4
- data.tar.gz: cfca9c65bc0d3b5e784fbab8dcff12545982d5bb00057e575dfdfcd77007accf
3
+ metadata.gz: 381bf0e833041913a075cab54a3e5df2be98d6954afd3eee4b821b05e19cf65e
4
+ data.tar.gz: dc7290731fd9eec058a31596d0ecc3e6d4b655ac67160f418bd2747c5820ef64
5
5
  SHA512:
6
- metadata.gz: 99c4b48fce7af4bc8a043549fcb4ba0119dc84af870fdb8b0aae26045c4626e16cbd035df94e8b5d5c638d10a1a26f3a76b7c260647b701a55ef1f795a373ca0
7
- data.tar.gz: 818054559441866f659d77d5b0e10721822c3aa5abc74010e90f5cbbb13a3d1fe85355fb6e2f82a867e24ed4b24e71670a72370b23c69526bf0400f7a1bc2a6a
6
+ metadata.gz: 04e4b6dc94bc641f02a8a0e45debb464943f0f03d9518ee23c773513009d6cdbd321202919a7d4f0b3fddd1120f0e43d34ee29d0d7f26636d203d4bdd6184fda
7
+ data.tar.gz: 723a75d5c1bd1ec0b8d9902a897cfead64a070b023e3998cab7415564aaf360f1936b317b91683849a049653144e55450348488a5039722c230c00a45012e153
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AI Dev Pipeline (aidp) - Ruby Gem
2
2
 
3
- A portable CLI that automates a complete AI development workflow from idea to implementation using your existing IDE assistants.
3
+ A portable CLI that automates a complete AI development workflow from idea to implementation using your existing IDE assistants. Now with **Enhanced TUI** - a rich terminal interface that runs complete workflows with intelligent provider management and error recovery.
4
4
 
5
5
  ## Quick Start
6
6
 
@@ -11,91 +11,74 @@ gem install aidp
11
11
  # Navigate to your project
12
12
  cd /your/project
13
13
 
14
- # Start the workflow
15
- aidp execute next
14
+ # Start the interactive TUI (default)
15
+ aidp
16
16
  ```
17
17
 
18
- ## User Workflow
18
+ ## Enhanced TUI
19
19
 
20
- The gem automates a complete development pipeline with **human-in-the-loop gates** at key decision points. Here's the simplest workflow:
20
+ AIDP features a rich terminal interface that transforms it from a step-by-step tool into an intelligent development assistant. The enhanced TUI provides beautiful, interactive terminal components while running complete workflows automatically.
21
21
 
22
- ### 1. Start Your Project
22
+ ### Features
23
23
 
24
- ```bash
25
- cd /your/project
26
- aidp status # Check current progress
27
- aidp execute next # Run the next pending step
28
- ```
29
-
30
- ### 2. Handle Gate Steps
31
-
32
- When you reach a **gate step** (PRD, Architecture, Tasks, Implementation), the AI will:
33
-
34
- 1. **Generate questions** in a file (e.g., `PRD_QUESTIONS.md`) if it needs more information
35
- 2. **Create the main output** (e.g., `docs/PRD.md`)
36
- 3. **Wait for your approval** before proceeding
37
-
38
- **Your actions at gates:**
39
-
40
- ```bash
41
- # Review the generated files
42
- cat PRD_QUESTIONS.md # Check if AI needs more information
43
- cat docs/PRD.md # Review the output
44
-
45
- # If PRD_QUESTIONS.md exists, answer the questions:
46
- # Edit the questions file directly with your answers
47
- nano PRD_QUESTIONS.md # Add your answers below each question
48
-
49
- # Re-run the step to use your answers
50
- aidp execute prd # AI will read your answers and complete the step
51
-
52
- # Once satisfied with the output, approve and continue
53
- aidp approve current # Mark the step complete
54
- aidp execute next # Continue to next step
55
- ```
56
-
57
- ### 3. Continue the Pipeline
24
+ - **šŸŽØ Rich Terminal Interface**: Beautiful CLI UI components with progress bars, spinners, and frames
25
+ - **šŸ“‹ Interactive Navigation**: Hierarchical menu system with breadcrumb navigation
26
+ - **āŒØļø Keyboard Shortcuts**: Full keyboard navigation and control
27
+ - **šŸ“Š Real-time Progress**: Live monitoring of progress and system status
28
+ - **šŸ”„ Workflow Control**: Pause, resume, cancel, and stop workflows with visual feedback
29
+ - **šŸ’¬ Smart Question Collection**: Interactive prompts with validation and error handling
58
30
 
59
- For non-gate steps, the AI runs automatically:
31
+ ### Usage
60
32
 
61
33
  ```bash
62
- aidp execute next # Run next step automatically
63
- aidp status # Check progress
64
- ```
65
-
66
- ### 4. Complete the Workflow
34
+ # Start the interactive TUI (default)
35
+ aidp
67
36
 
68
- The pipeline includes 15 steps total:
37
+ # Show version information
38
+ aidp --version
69
39
 
70
- - **Gates**: PRD, Architecture, Tasks, Implementation (require approval)
71
- - **Auto**: NFRs, ADRs, Domains, Contracts, Threat Model, Test Plan, Scaffolding, Static Analysis, Observability, Delivery, Docs Portal, Post-Release
72
-
73
- ## Key Commands
74
-
75
- ```bash
76
- aidp status # Show progress of all steps
77
- aidp execute next # Run next pending step
78
- aidp approve current # Approve current gate step
79
- aidp jobs # Monitor background jobs (real-time)
80
- aidp detect # See which AI provider will be used
81
- aidp execute <step> # Run specific step (e.g., prd, arch, tasks)
82
- aidp approve <step> # Approve specific step
83
- aidp reset # Reset all progress (start over)
40
+ # Show help information
41
+ aidp --help
84
42
  ```
85
43
 
86
44
  ## AI Providers
87
45
 
88
- The gem automatically detects and uses the best available AI provider:
89
-
90
- - **Cursor CLI** (`cursor-agent`) - Preferred
91
- - **Claude CLI** (`claude`/`claude-code`) - Fallback
92
- - **Gemini CLI** (`gemini`/`gemini-cli`) - Fallback
46
+ AIDP intelligently manages multiple providers with automatic switching:
47
+
48
+ - **Claude API** - Primary provider for complex analysis and code generation
49
+ - **Gemini API** - Cost-effective fallback for general tasks
50
+ - **Cursor CLI** - IDE-integrated provider for code-specific tasks
51
+
52
+ The TUI automatically switches providers when:
53
+
54
+ - Rate limits are hit
55
+ - Providers fail or timeout
56
+ - Cost limits are reached
57
+ - Performance optimization is needed
58
+
59
+ ### Provider Configuration
60
+
61
+ ```yaml
62
+ # aidp.yml
63
+ providers:
64
+ claude:
65
+ type: "api"
66
+ api_key: "${AIDP_CLAUDE_API_KEY}"
67
+ max_tokens: 100000
68
+ gemini:
69
+ type: "api"
70
+ api_key: "${AIDP_GEMINI_API_KEY}"
71
+ max_tokens: 50000
72
+ cursor:
73
+ type: "package"
74
+ ```
93
75
 
94
- ### Override Provider
76
+ ### Environment Variables
95
77
 
96
78
  ```bash
97
- AIDP_PROVIDER=anthropic aidp execute next
98
- AIDP_LLM_CMD=/usr/local/bin/claude aidp execute next
79
+ # Set API keys
80
+ export AIDP_CLAUDE_API_KEY="your-claude-api-key"
81
+ export AIDP_GEMINI_API_KEY="your-gemini-api-key"
99
82
  ```
100
83
 
101
84
  ## Tree-sitter Static Analysis
@@ -152,37 +135,6 @@ echo 'export TREE_SITTER_PARSERS="$(pwd)/.aidp/parsers"' >> ~/.zshrc
152
135
  source ~/.zshrc
153
136
  ```
154
137
 
155
- ### Tree-sitter Analysis Commands
156
-
157
- ```bash
158
- # Run Tree-sitter static analysis
159
- aidp analyze code
160
-
161
- # Analyze specific languages
162
- aidp analyze code --langs ruby,javascript,typescript
163
-
164
- # Use multiple threads for faster analysis
165
- aidp analyze code --threads 8
166
-
167
- # Rebuild knowledge base from scratch
168
- aidp analyze code --rebuild
169
-
170
- # Specify custom KB directory
171
- aidp analyze code --kb-dir .aidp/custom-kb
172
-
173
- # Inspect generated knowledge base
174
- aidp kb show
175
-
176
- # Show specific KB data
177
- aidp kb show symbols
178
- aidp kb show imports
179
- aidp kb show seams
180
-
181
- # Generate dependency graphs
182
- aidp kb graph imports
183
- aidp kb graph calls
184
- ```
185
-
186
138
  ### Knowledge Base Structure
187
139
 
188
140
  The Tree-sitter analysis generates structured JSON files in `.aidp/kb/`:
@@ -206,56 +158,6 @@ The Tree-sitter analysis specifically supports:
206
158
  - **Test Coverage**: Identifies untested public APIs
207
159
  - **Refactoring Opportunities**: Suggests dependency injection points and seam locations
208
160
 
209
- ## Background Jobs
210
-
211
- AIDP uses background jobs to handle all AI provider executions, providing better reliability and real-time monitoring capabilities.
212
-
213
- ### Job Monitoring
214
-
215
- Monitor running and completed jobs in real-time:
216
-
217
- ```bash
218
- aidp jobs # Show job status with real-time updates
219
- ```
220
-
221
- The jobs view displays:
222
-
223
- - **Running jobs** with live progress updates
224
- - **Queued jobs** waiting to be processed
225
- - **Completed jobs** with execution results
226
- - **Failed jobs** with error details
227
-
228
- ### Job Controls
229
-
230
- From the jobs view, you can:
231
-
232
- - **Retry failed jobs** by pressing `r` on a failed job
233
- - **View job details** by pressing `d` on any job
234
- - **Exit monitoring** by pressing `q`
235
-
236
- ### Job Persistence
237
-
238
- - Jobs persist across CLI restarts
239
- - Job history is preserved for analysis
240
- - Failed jobs can be retried at any time
241
- - All job metadata and logs are stored
242
-
243
- ### Database Setup
244
-
245
- AIDP uses PostgreSQL for job management. Ensure PostgreSQL is installed and running:
246
-
247
- ```bash
248
- # macOS (using Homebrew)
249
- brew install postgresql
250
- brew services start postgresql
251
-
252
- # Ubuntu/Debian
253
- sudo apt-get install postgresql postgresql-contrib
254
- sudo systemctl start postgresql
255
-
256
- # The database will be created automatically on first use
257
- ```
258
-
259
161
  ## File-Based Interaction
260
162
 
261
163
  At gate steps, the AI creates files for interaction instead of requiring real-time chat:
@@ -278,45 +180,13 @@ The questions file is only created when the AI needs additional information beyo
278
180
 
279
181
  ```bash
280
182
  # Enable debug output to see AI provider communication
281
- AIDP_DEBUG=1 aidp execute next
183
+ AIDP_DEBUG=1 aidp
282
184
 
283
185
  # Log to a file for debugging
284
- AIDP_LOG_FILE=aidp.log aidp execute next
186
+ AIDP_LOG_FILE=aidp.log aidp
285
187
 
286
188
  # Combine both for full debugging
287
- AIDP_DEBUG=1 AIDP_LOG_FILE=aidp.log aidp execute next
288
- ```
289
-
290
- ## Workflow Example
291
-
292
- Here's a typical session:
293
-
294
- ```bash
295
- # 1. Start the workflow
296
- aidp execute next
297
- # → Creates docs/PRD.md and PRD_QUESTIONS.md
298
-
299
- # 2. Monitor job progress (optional)
300
- aidp jobs
301
- # → Shows real-time job status and progress
302
-
303
- # 3. Review the questions (if any)
304
- cat PRD_QUESTIONS.md
305
- # → If questions exist, edit the file with your answers, then re-run
306
-
307
- # 4. Review the PRD
308
- cat docs/PRD.md
309
- # → Edit if needed
310
-
311
- # 5. Approve and continue
312
- aidp approve current
313
- aidp execute next
314
- # → Creates docs/NFRs.md automatically
315
-
316
- # 6. Continue through gates
317
- aidp execute next
318
- # → Creates docs/Architecture.md and ARCH_QUESTIONS.md
319
- # → Repeat review/approve cycle
189
+ AIDP_DEBUG=1 AIDP_LOG_FILE=aidp.log aidp
320
190
  ```
321
191
 
322
192
  ## Development
@@ -353,43 +223,19 @@ bundle exec rake build
353
223
  The following system dependencies are required for development:
354
224
 
355
225
  - **Tree-sitter** - System library for parsing (install via `brew install tree-sitter` or package manager)
356
- - **PostgreSQL** - Database for job management
357
226
  - **Ruby gems** - All required gems are specified in `aidp.gemspec` and installed via `bundle install`
358
227
 
359
- Optional gems with fallbacks:
360
-
361
- - **`concurrent-ruby`** - Parallel processing (fallback to basic threading if not available)
362
- - **`tty-table`** - Table rendering (fallback to basic ASCII tables if not available)
363
-
364
228
  ## Contributing
365
229
 
366
230
  See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and conventional commit guidelines.
367
231
 
368
- ## Pipeline Steps
369
-
370
- The gem automates a complete 15-step development pipeline:
371
-
372
- ### Gate Steps (Require Approval)
373
-
374
- - **PRD** → Product Requirements Document (`docs/PRD.md`)
375
- - **Architecture** → System architecture and ADRs (`docs/Architecture.md`)
376
- - **Tasks** → Implementation tasks and backlog (`tasks/backlog.yaml`)
377
- - **Implementation** → Implementation strategy and guidance (`docs/ImplementationGuide.md`)
232
+ ## Documentation
378
233
 
379
- ### Automatic Steps
234
+ For detailed information:
380
235
 
381
- - **NFRs** → Non-Functional Requirements (`docs/NFRs.md`)
382
- - **ADRs** → Architecture Decision Records (`docs/adr/`)
383
- - **Domains** → Domain decomposition (`docs/DomainCharters/`)
384
- - **Contracts** → API/Event contracts (`contracts/`)
385
- - **Threat Model** → Security analysis (`docs/ThreatModel.md`)
386
- - **Test Plan** → Testing strategy (`docs/TestPlan.md`)
387
- - **Scaffolding** → Project structure guidance (`docs/ScaffoldingGuide.md`)
388
- - **Static Analysis** → Code quality tools and Tree-sitter analysis (`docs/StaticAnalysis.md`, `.aidp/kb/`)
389
- - **Observability** → Monitoring and SLOs (`docs/Observability.md`)
390
- - **Delivery** → Deployment strategy (`docs/DeliveryPlan.md`)
391
- - **Docs Portal** → Documentation portal (`docs/DocsPortalPlan.md`)
392
- - **Post-Release** → Post-release analysis (`docs/PostReleaseReport.md`)
236
+ - **[TUI User Guide](docs/TUI_USER_GUIDE.md)** - Complete guide to using the enhanced TUI
237
+ - **[Configuration Guide](docs/harness-configuration.md)** - Detailed configuration options and examples
238
+ - **[Troubleshooting Guide](docs/harness-troubleshooting.md)** - Common issues and solutions
393
239
 
394
240
  ## Manual Workflow (Alternative)
395
241
 
data/bin/aidp CHANGED
@@ -2,4 +2,4 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "aidp"
5
- Aidp::CLI.start(ARGV)
5
+ exit Aidp::CLI.run(ARGV)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "json"
4
- require "tty-table"
4
+ require "tty-box"
5
5
 
6
6
  module Aidp
7
7
  module Analysis
@@ -57,7 +57,23 @@ module Aidp
57
57
  end
58
58
 
59
59
  def create_table(header, rows)
60
- TTY::Table.new(header: header, rows: rows)
60
+ # Use TTY::Box for table display
61
+ content = []
62
+ rows.each_with_index do |row, index|
63
+ row_content = []
64
+ header.each_with_index do |col_header, col_index|
65
+ row_content << "#{col_header}: #{row[col_index]}"
66
+ end
67
+ content << "Row #{index + 1}:\n#{row_content.join("\n")}"
68
+ end
69
+
70
+ box = TTY::Box.frame(
71
+ content.join("\n\n"),
72
+ title: {top_left: "Knowledge Base Data"},
73
+ border: :thick,
74
+ padding: [1, 2]
75
+ )
76
+ puts box
61
77
  end
62
78
 
63
79
  def load_kb_data
@@ -69,7 +85,10 @@ module Aidp
69
85
  begin
70
86
  data[type.to_sym] = JSON.parse(File.read(file_path), symbolize_names: true)
71
87
  rescue JSON::ParserError => e
72
- puts "Warning: Could not parse #{file_path}: #{e.message}"
88
+ # Suppress warnings in test mode to avoid CI failures
89
+ unless ENV["RACK_ENV"] == "test" || defined?(RSpec)
90
+ puts "Warning: Could not parse #{file_path}: #{e.message}"
91
+ end
73
92
  data[type.to_sym] = []
74
93
  end
75
94
  else
@@ -125,7 +144,10 @@ module Aidp
125
144
  end
126
145
 
127
146
  def show_seams_table
128
- table = create_table(
147
+ puts "\nšŸ”§ Seams Analysis"
148
+ puts "=" * 80
149
+
150
+ create_table(
129
151
  ["Type", "File", "Line", "Symbol", "Suggestion"],
130
152
  @data[:seams].map do |seam|
131
153
  [
@@ -137,10 +159,6 @@ module Aidp
137
159
  ]
138
160
  end
139
161
  )
140
-
141
- puts "\nšŸ”§ Seams Analysis"
142
- puts "=" * 80
143
- puts table.render
144
162
  end
145
163
 
146
164
  def show_seams_summary
@@ -180,7 +198,10 @@ module Aidp
180
198
  end
181
199
 
182
200
  def show_hotspots_table
183
- table = create_table(
201
+ puts "\nšŸ”„ Code Hotspots"
202
+ puts "=" * 80
203
+
204
+ create_table(
184
205
  ["Rank", "File", "Method", "Score", "Complexity", "Touches"],
185
206
  @data[:hotspots].map.with_index do |hotspot, i|
186
207
  [
@@ -193,10 +214,6 @@ module Aidp
193
214
  ]
194
215
  end
195
216
  )
196
-
197
- puts "\nšŸ”„ Code Hotspots"
198
- puts "=" * 80
199
- puts table.render
200
217
  end
201
218
 
202
219
  def show_hotspots_summary
@@ -283,7 +300,10 @@ module Aidp
283
300
  end
284
301
 
285
302
  def show_symbols_table
286
- table = create_table(
303
+ puts "\nšŸ—ļø Symbols"
304
+ puts "=" * 80
305
+
306
+ create_table(
287
307
  ["Type", "Name", "File", "Line", "Visibility"],
288
308
  @data[:symbols].map do |symbol|
289
309
  [
@@ -295,10 +315,6 @@ module Aidp
295
315
  ]
296
316
  end
297
317
  )
298
-
299
- puts "\nšŸ—ļø Symbols"
300
- puts "=" * 80
301
- puts table.render
302
318
  end
303
319
 
304
320
  def show_symbols_summary
@@ -326,7 +342,10 @@ module Aidp
326
342
  end
327
343
 
328
344
  def show_imports_table
329
- table = create_table(
345
+ puts "\nšŸ“¦ Imports"
346
+ puts "=" * 80
347
+
348
+ create_table(
330
349
  ["Type", "Target", "File", "Line"],
331
350
  @data[:imports].map do |import|
332
351
  [
@@ -337,10 +356,6 @@ module Aidp
337
356
  ]
338
357
  end
339
358
  )
340
-
341
- puts "\nšŸ“¦ Imports"
342
- puts "=" * 80
343
- puts table.render
344
359
  end
345
360
 
346
361
  def show_imports_summary
@@ -23,35 +23,6 @@ module Aidp
23
23
  /include Singleton/, /extend Singleton/, /@singleton/
24
24
  ].freeze
25
25
 
26
- # Constructor with work indicators
27
- CONSTRUCTOR_WORK_INDICATORS = [
28
- /File\./, /IO\./, /Net::/, /HTTP/, /Database/, /Redis/,
29
- /system\(/, /exec\(/, /spawn\(/, /fork\(/
30
- ].freeze
31
-
32
- def self.io_call?(receiver, method)
33
- fq = [receiver, method].compact.join(".")
34
- IO_PATTERNS.any? { |pattern| fq.match?(pattern) }
35
- end
36
-
37
- def self.external_service_call?(receiver, method)
38
- fq = [receiver, method].compact.join(".")
39
- EXTERNAL_SERVICE_PATTERNS.any? { |pattern| fq.match?(pattern) }
40
- end
41
-
42
- def self.global_or_singleton?(ast_node_texts)
43
- ast_node_texts.any? { |text| GLOBAL_PATTERNS.any? { |pattern| text.match?(pattern) } }
44
- end
45
-
46
- def self.constructor_with_work?(node, metrics)
47
- return false unless node[:type] == "method" && node[:name] == "initialize"
48
-
49
- # Check if constructor has significant work based on metrics
50
- metrics[:branch_count].to_i > 2 ||
51
- metrics[:fan_out].to_i > 3 ||
52
- metrics[:lines].to_i > 10
53
- end
54
-
55
26
  def self.detect_seams_in_ast(ast_nodes, file_path)
56
27
  seams = []
57
28
 
@@ -164,8 +135,8 @@ module Aidp
164
135
  end
165
136
 
166
137
  private_class_method def self.extract_io_calls(_method_node)
167
- # This would extract I/O calls from the method's AST
168
- # For now, return mock data
138
+ # Extract I/O calls from the method's AST
139
+ # TODO: Implement actual AST analysis
169
140
  []
170
141
  end
171
142
 
@@ -77,11 +77,6 @@ module Aidp
77
77
  @loaded_grammars[language] = create_parser(language, config)
78
78
  end
79
79
 
80
- # Get supported languages
81
- def supported_languages
82
- GRAMMAR_CONFIGS.keys
83
- end
84
-
85
80
  # Get file patterns for a language
86
81
  def file_patterns_for_language(language)
87
82
  config = GRAMMAR_CONFIGS[language]
@@ -90,14 +85,6 @@ module Aidp
90
85
  config[:file_patterns]
91
86
  end
92
87
 
93
- # Get node types for a language
94
- def node_types_for_language(language)
95
- config = GRAMMAR_CONFIGS[language]
96
- return {} unless config
97
-
98
- config[:node_types]
99
- end
100
-
101
88
  private
102
89
 
103
90
  def ensure_grammar_available(language, config)
@@ -3,7 +3,6 @@
3
3
  require "json"
4
4
  require "fileutils"
5
5
  require "digest"
6
- require "concurrent"
7
6
  require "etc"
8
7
 
9
8
  require_relative "tree_sitter_grammar_loader"
@@ -157,21 +156,10 @@ module Aidp
157
156
  # Load grammar for this language
158
157
  grammar = @grammar_loader.load_grammar(lang)
159
158
 
160
- # Process files in parallel using Concurrent gem
161
- pool = Concurrent::FixedThreadPool.new(@threads)
162
- futures = []
163
-
159
+ # Process files synchronously (simplified)
164
160
  lang_files.each do |file|
165
- future = Concurrent::Promise.execute(executor: pool) do
166
- parse_file(file, grammar)
167
- end
168
- futures << future
161
+ parse_file(file, grammar)
169
162
  end
170
-
171
- # Wait for all futures to complete
172
- futures.each(&:value!)
173
- pool.shutdown
174
- pool.wait_for_termination
175
163
  end
176
164
 
177
165
  save_cache
@@ -468,11 +456,6 @@ module Aidp
468
456
  end
469
457
  end
470
458
 
471
- def extract_string_content(string_content_node, _line_number)
472
- # Extract the actual string content from the source code using node position
473
- extract_node_text_from_source(string_content_node)
474
- end
475
-
476
459
  def extract_identifier_name(identifier_node, file_path)
477
460
  # Extract the actual identifier name from the source code using node position
478
461
  extract_node_text_from_source(identifier_node, file_path)
@@ -659,7 +642,7 @@ module Aidp
659
642
 
660
643
  def generate_hotspots
661
644
  # Merge structural metrics with git churn data
662
- # For now, create mock hotspots based on complexity
645
+ # Generate hotspots based on complexity and change frequency
663
646
  @hotspots = @metrics.select { |m| m[:symbol_id] }
664
647
  .map do |metric|
665
648
  {