@voria/cli 0.0.2

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 (67) hide show
  1. package/README.md +439 -0
  2. package/bin/voria +730 -0
  3. package/docs/ARCHITECTURE.md +419 -0
  4. package/docs/CHANGELOG.md +189 -0
  5. package/docs/CONTRIBUTING.md +447 -0
  6. package/docs/DESIGN_DECISIONS.md +380 -0
  7. package/docs/DEVELOPMENT.md +535 -0
  8. package/docs/EXAMPLES.md +434 -0
  9. package/docs/INSTALL.md +335 -0
  10. package/docs/IPC_PROTOCOL.md +310 -0
  11. package/docs/LLM_INTEGRATION.md +416 -0
  12. package/docs/MODULES.md +470 -0
  13. package/docs/PERFORMANCE.md +346 -0
  14. package/docs/PLUGINS.md +432 -0
  15. package/docs/QUICKSTART.md +184 -0
  16. package/docs/README.md +133 -0
  17. package/docs/ROADMAP.md +346 -0
  18. package/docs/SECURITY.md +334 -0
  19. package/docs/TROUBLESHOOTING.md +565 -0
  20. package/docs/USER_GUIDE.md +700 -0
  21. package/package.json +63 -0
  22. package/python/voria/__init__.py +8 -0
  23. package/python/voria/__pycache__/__init__.cpython-312.pyc +0 -0
  24. package/python/voria/__pycache__/engine.cpython-312.pyc +0 -0
  25. package/python/voria/core/__init__.py +1 -0
  26. package/python/voria/core/__pycache__/__init__.cpython-312.pyc +0 -0
  27. package/python/voria/core/__pycache__/setup.cpython-312.pyc +0 -0
  28. package/python/voria/core/agent/__init__.py +9 -0
  29. package/python/voria/core/agent/__pycache__/__init__.cpython-312.pyc +0 -0
  30. package/python/voria/core/agent/__pycache__/loop.cpython-312.pyc +0 -0
  31. package/python/voria/core/agent/loop.py +343 -0
  32. package/python/voria/core/executor/__init__.py +19 -0
  33. package/python/voria/core/executor/__pycache__/__init__.cpython-312.pyc +0 -0
  34. package/python/voria/core/executor/__pycache__/executor.cpython-312.pyc +0 -0
  35. package/python/voria/core/executor/executor.py +431 -0
  36. package/python/voria/core/github/__init__.py +33 -0
  37. package/python/voria/core/github/__pycache__/__init__.cpython-312.pyc +0 -0
  38. package/python/voria/core/github/__pycache__/client.cpython-312.pyc +0 -0
  39. package/python/voria/core/github/client.py +438 -0
  40. package/python/voria/core/llm/__init__.py +55 -0
  41. package/python/voria/core/llm/__pycache__/__init__.cpython-312.pyc +0 -0
  42. package/python/voria/core/llm/__pycache__/base.cpython-312.pyc +0 -0
  43. package/python/voria/core/llm/__pycache__/claude_provider.cpython-312.pyc +0 -0
  44. package/python/voria/core/llm/__pycache__/gemini_provider.cpython-312.pyc +0 -0
  45. package/python/voria/core/llm/__pycache__/modal_provider.cpython-312.pyc +0 -0
  46. package/python/voria/core/llm/__pycache__/model_discovery.cpython-312.pyc +0 -0
  47. package/python/voria/core/llm/__pycache__/openai_provider.cpython-312.pyc +0 -0
  48. package/python/voria/core/llm/base.py +152 -0
  49. package/python/voria/core/llm/claude_provider.py +188 -0
  50. package/python/voria/core/llm/gemini_provider.py +148 -0
  51. package/python/voria/core/llm/modal_provider.py +228 -0
  52. package/python/voria/core/llm/model_discovery.py +289 -0
  53. package/python/voria/core/llm/openai_provider.py +146 -0
  54. package/python/voria/core/patcher/__init__.py +9 -0
  55. package/python/voria/core/patcher/__pycache__/__init__.cpython-312.pyc +0 -0
  56. package/python/voria/core/patcher/__pycache__/patcher.cpython-312.pyc +0 -0
  57. package/python/voria/core/patcher/patcher.py +375 -0
  58. package/python/voria/core/planner/__init__.py +1 -0
  59. package/python/voria/core/setup.py +201 -0
  60. package/python/voria/core/token_manager/__init__.py +29 -0
  61. package/python/voria/core/token_manager/__pycache__/__init__.cpython-312.pyc +0 -0
  62. package/python/voria/core/token_manager/__pycache__/manager.cpython-312.pyc +0 -0
  63. package/python/voria/core/token_manager/manager.py +241 -0
  64. package/python/voria/engine.py +1185 -0
  65. package/python/voria/plugins/__init__.py +1 -0
  66. package/python/voria/plugins/python/__init__.py +1 -0
  67. package/python/voria/plugins/typescript/__init__.py +1 -0
@@ -0,0 +1,380 @@
1
+ # Design Decisions
2
+
3
+ Rationale behind voria's key architectural and technical choices.
4
+
5
+ ## Core Decisions
6
+
7
+ ### 1. Hybrid Rust + Python Architecture
8
+
9
+ **Decision**: Use Rust for CLI and Python for engine.
10
+
11
+ **Rationale**:
12
+ - **Rust**: High performance, compiled binary, async I/O, type-safe system operations
13
+ - **Python**: Rich LLM ecosystem, fast development, extensive libraries
14
+
15
+ **Alternatives Considered**:
16
+ - ❌ Pure Rust: Missing LLM ecosystem, slower iteration
17
+ - ❌ Pure Python: No binary distribution, slow startup
18
+ - ✅ Hybrid: Best of both worlds
19
+
20
+ **Trade-offs**:
21
+ - ✅ Docker/pipeline distribution easier with binary
22
+ - ❌ Requires two build toolchains
23
+ - ✅ Clear separation simplifies testing
24
+
25
+ ### 2. NDJSON Inter-Process Communication
26
+
27
+ **Decision**: Use newline-delimited JSON over stdin/stdout.
28
+
29
+ **Rationale**:
30
+ - Human-readable (debuggable with echo/cat)
31
+ - Language-agnostic
32
+ - Natural streaming behavior
33
+ - No special serialization library needed
34
+
35
+ **Alternatives Considered**:
36
+ - ❌ Protocol Buffers: Fast but binary (hard to debug)
37
+ - ❌ gRPC: Overkill for single-machine communication
38
+ - ❌ Unix sockets: Platform-specific
39
+ - ✅ NDJSON: Simplicity + debuggability
40
+
41
+ **Trade-offs**:
42
+ - ✅ Easy to debug (just inspect messages)
43
+ - ❌ Slightly larger message size
44
+ - ✅ Minimal parsing overhead
45
+
46
+ ### 3. Persistent Python Process
47
+
48
+ **Decision**: Keep Python engine alive between commands.
49
+
50
+ **Rationale**:
51
+ - Instant response times
52
+ - Shared state (caches, connections)
53
+ - Better for interactive workflows
54
+
55
+ **Alternatives Considered**:
56
+ - ❌ Fresh process per command: Simpler but 2-3sec overhead
57
+ - ✓ Persistent process: Better UX
58
+
59
+ **Trade-offs**:
60
+ - ✅ Fast response
61
+ - ❌ More memory usage
62
+ - ✅ Better for scripting
63
+
64
+ ### 4. Iterative Agent Loop (5 iterations max)
65
+
66
+ **Decision**: Retry fix up to 5 times if tests fail.
67
+
68
+ **Rationale**:
69
+ - Handles complex fixes that need refinement
70
+ - Learns from test failures
71
+ - Bounded (prevents infinite loops)
72
+
73
+ **Why 5?**:
74
+ - 1-2 iterations: 80% issues fixed
75
+ - 3-5 iterations: Handle complex cases
76
+ - 6+: Diminishing returns, too costly
77
+
78
+ **Trade-offs**:
79
+ - ✅ Better fix success rate
80
+ - ❌ Higher LLM token usage
81
+ - ✅ Bounded costs (5 iterations max)
82
+
83
+ ### 5. Automatic Backup and Rollback
84
+
85
+ **Decision**: Create backups before modifying files, rollback on failure.
86
+
87
+ **Rationale**:
88
+ - Safety: Recover from bad patches
89
+ - Debugging: Compare before/after
90
+ - Confidence: Users can experiment
91
+
92
+ **Trade-offs**:
93
+ - ✅ Very safe
94
+ - ❌ Disk space for backups
95
+ - ✅ File recovery support
96
+
97
+ ### 6. Token Budget Enforcement
98
+
99
+ **Decision**: Track & enforce spending limits per provider.
100
+
101
+ **Rationale**:
102
+ - Prevent runaway costs (important with LLMs!)
103
+ - Per-provider budgets (different pricing models)
104
+ - User control over spending
105
+
106
+ **Implementation**:
107
+ ```
108
+ Modal: $0.00/hr (free until Apr 30)
109
+ OpenAI: $5.00/hr
110
+ Gemini: $1.00/hr
111
+ Claude: $3.00/hr
112
+ ```
113
+
114
+ **Trade-offs**:
115
+ - ✅ Prevents bill shock
116
+ - ❌ May stop mid-operation
117
+ - ✅ User can increase budget
118
+
119
+ ## LLM Integration Decisions
120
+
121
+ ### 1. Multi-Provider Support (4 maximum)
122
+
123
+ **Decision**: Support Modal, OpenAI, Google Gemini, and Anthropic Claude.
124
+
125
+ **Rationale**:
126
+ - **Modal**: Free until Apr 30, great for testing
127
+ - **OpenAI**: Industry standard, reliable
128
+ - **Gemini**: Fast and cost-effective
129
+ - **Claude**: Highest quality (when budget allows)
130
+
131
+ **Why exactly 4?**:
132
+ - Too few: Limited options
133
+ - Too many: Maintenance burden
134
+ - 4 is sweet spot
135
+
136
+ **Trade-offs**:
137
+ - ✅ Good coverage
138
+ - ✅ User choice
139
+ - ❌ More integration code
140
+
141
+ ### 2. Dynamic Model Discovery
142
+
143
+ **Decision**: Fetch available models from provider APIs at runtime.
144
+
145
+ **Rationale**:
146
+ - NO hardcoding (breaks when providers add new models)
147
+ - Users can choose from latest models
148
+ - Automatic fallback if API unavailable
149
+
150
+ **Trade-offs**:
151
+ - ✅ Always up-to-date
152
+ - ❌ Extra API calls on setup
153
+ - ✅ User empowerment
154
+
155
+ ### 3. Interactive Setup over CLI Flags
156
+
157
+ **Decision**: `python3 -m voria.core.setup` for configuration.
158
+
159
+ **Rationale**:
160
+ - Better UX (guided steps)
161
+ - Less memorization needed
162
+ - Validation at setup time
163
+
164
+ **Trade-offs**:
165
+ - ✅ User-friendly
166
+ - ❌ Doesn't work in scripts
167
+ - ✓ Env vars available for scripting
168
+
169
+ ## Code Organization Decisions
170
+
171
+ ### 1. Module Structure
172
+
173
+ **Decision**: Organize by functionality (llm/, agent/, patcher/) not by feature.
174
+
175
+ **Rationale**:
176
+ - Clear separation of concerns
177
+ - Easy to test modules independently
178
+ - Simple to extend (add new providers)
179
+
180
+ **Alternative** (rejected):
181
+ ```
182
+ # ❌ Feature-based
183
+ voria/
184
+ ├── github_automation/
185
+ │ ├── llm.py
186
+ │ ├── patcher.py
187
+ │ └── tests.py
188
+ ├── code_analysis/
189
+ │ ├── llm.py
190
+ │ └── patcher.py
191
+ ```
192
+
193
+ **Our Structure** (accepted):
194
+ ```
195
+ # ✅ Responsibility-based
196
+ voria/
197
+ ├── core/
198
+ │ ├── llm/ (all LLM logic)
199
+ │ ├── patcher/ (all patching)
200
+ │ ├── agent/ (orchestration)
201
+ │ └── github/ (GitHub API)
202
+ ```
203
+
204
+ ### 2. Async/Await Everywhere
205
+
206
+ **Decision**: Use async I/O throughout (no blocking operations).
207
+
208
+ **Rationale**:
209
+ - Better resource utilization
210
+ - Handle multiple operations simultan eously
211
+ - Responsive CLI
212
+
213
+ **Trade-offs**:
214
+ - ✅ Efficient I/O
215
+ - ❌ More complex code
216
+ - ✅ Future-proof for concurrency
217
+
218
+ ### 3. Configuration over Hardcoding
219
+
220
+ **Decision**: All settings configurable (CLI flags, env vars, config files).
221
+
222
+ **Rationale**:
223
+ - Users customize behavior
224
+ - Easy A/B testing
225
+ - No recompilation needed
226
+
227
+ **Hierarchy** (highest to lowest priority):
228
+ 1. CLI flags: `--llm openai`
229
+ 2. Environment: `voria_LLM=openai`
230
+ 3. Config file: `~/.voria/config.yaml`
231
+ 4. Defaults: Built-in sensible defaults
232
+
233
+ ## Security Decisions
234
+
235
+ ### 1. Config File Permissions
236
+
237
+ **Decision**: Store configs at `~/.voria/` with `0600` (user-only).
238
+
239
+ **Rationale**:
240
+ - API keys stored locally (not on server)
241
+ - Restricted permissions prevent accidental sharing
242
+ - Follows Unix best practices
243
+
244
+ ### 2. Code Execution Sandboxing
245
+
246
+ **Decision**: Rust executes system commands, Python never does.
247
+
248
+ **Rationale**:
249
+ - Controlled execution environment
250
+ - Audit trail (which commands ran)
251
+ - Prevents Python malcode injection
252
+
253
+ **Trade-offs**:
254
+ - ✅ More secure
255
+ - ❌ Extra RPC calls
256
+ - ✅ Better failure handling
257
+
258
+ ### 3. No Credentials in Logs
259
+
260
+ **Decision**: Never log API keys, tokens, or credentials.
261
+
262
+ **Rationale**:
263
+ - Prevent accidental exposure
264
+ - Safe to share logs for debugging
265
+ - Follows security best practices
266
+
267
+ ## UX Decisions
268
+
269
+ ### 1. Colored Output with Unicode
270
+
271
+ **Decision**: Use colored terminal output + Unicode symbols.
272
+
273
+ **Rationale**:
274
+ - Easy to scan output
275
+ - Visual feedback (success/error)
276
+ - Modern CLI UX
277
+
278
+ **Symbols**:
279
+ - ✅ Success
280
+ - ❌ Error
281
+ - 🔄 In progress
282
+ - ℹ️ Info
283
+
284
+ ### 2. Verbose Flag for Debugging
285
+
286
+ **Decision**: `-v/--verbose` enables detailed logging.
287
+
288
+ **Rationale**:
289
+ - Clean default output for users
290
+ - Detailed trace for debugging
291
+ - Toggleable without config changes
292
+
293
+ ### 3. Dry-Run Testing
294
+
295
+ **Decision**: `--dry-run` flag simulates without modifications.
296
+
297
+ **Rationale**:
298
+ - Users can review changes before applying
299
+ - Testing without risk
300
+ - Confidence building
301
+
302
+ ## Performance Decisions
303
+
304
+ ### 1. Timeout Detection (30 seconds)
305
+
306
+ **Decision**: Kill Python if no response for 30 seconds.
307
+
308
+ **Rationale**:
309
+ - Long enough for LLM calls
310
+ - Short enough for user feedback
311
+ - Prevents hangs
312
+
313
+ ### 2. Auto-Retry on Failure
314
+
315
+ **Decision**: Retry once on timeout, then fail.
316
+
317
+ **Rationale**:
318
+ - Handles transient errors
319
+ - Don't retry forever (stuck)
320
+ - One retry is sweet spot
321
+
322
+ ### 3. Lazy Loading
323
+
324
+ **Decision**: Load modules/data only when needed.
325
+
326
+ **Rationale**:
327
+ - Faster startup times
328
+ - Lower memory base
329
+ - Only pay for what you use
330
+
331
+ ## Testing Decisions
332
+
333
+ ### 1. TArray of Test Frameworks Supported
334
+
335
+ **Decision**: Detect pytest, jest, go test (+ custom).
336
+
337
+ **Rationale**:
338
+ - Cover 90% of projects
339
+ - Custom command fallback
340
+ - Framework agnostic
341
+
342
+ **Why these 3?**:
343
+ - pytest: Python (most common)
344
+ - jest: JavaScript/TypeScript
345
+ - go test: Go (built-in)
346
+
347
+ ### 2. Result Parsing
348
+
349
+ **Decision**: Parse framework output (not JSON APIs).
350
+
351
+ **Rationale**:
352
+ - No framework API dependency
353
+ - Works offline
354
+ - Resilient to version changes
355
+
356
+ ## Deployment Decisions
357
+
358
+ ### 1. Single Binary Distribution
359
+
360
+ **Decision**: Distribute Rust binary only (Python downloaded automatically).
361
+
362
+ **Rationale**:
363
+ - Small binary (just Rust CLI)
364
+ - Python installed when first run
365
+ - Automatic dependency management
366
+
367
+ ### 2. Docker Support Optional
368
+
369
+ **Decision**: Provide Dockerfile (not required for usage).
370
+
371
+ **Rationale**:
372
+ - Works on any system
373
+ - Dev/prod parity
374
+ - Advanced users can containerize
375
+
376
+ ---
377
+
378
+ **See Also:**
379
+ - [ARCHITECTURE.md](ARCHITECTURE.md) - System design
380
+ - [MODULES.md](MODULES.md) - Component details