@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,334 @@
1
+ # Security Best Practices
2
+
3
+ Essential security guidelines for using voria safely.
4
+
5
+ ## Protecting Your Credentials
6
+
7
+ ### API Keys
8
+
9
+ **Never commit API keys:**
10
+ ```bash
11
+ # ❌ DO NOT
12
+ echo "OPENAI_API_KEY=sk-xxx" >> .env
13
+ git add .env # BAD!
14
+
15
+ # ✅ DO
16
+ echo ".env" >> .gitignore
17
+ export OPENAI_API_KEY="sk-xxx" # Set in shell
18
+ ```
19
+
20
+ **Use environment variables:**
21
+ ```bash
22
+ # Set in ~/.bashrc or ~/.zshrc
23
+ export OPENAI_API_KEY="sk-..."
24
+ export MODAL_API_KEY="token-..."
25
+ export GOOGLE_API_KEY="..."
26
+ export ANTHROPIC_API_KEY="..."
27
+ export GITHUB_TOKEN="ghp_..."
28
+ ```
29
+
30
+ **Rotate credentials regularly:**
31
+ ```bash
32
+ # Monthly reminder to rotate keys
33
+ # 1. Generate new key in provider console
34
+ # 2. Export new key: export OPENAI_API_KEY="sk-new-..."
35
+ # 3. Delete old key in provider console
36
+ ```
37
+
38
+ ### Configuration Files
39
+
40
+ **Restrict permissions:**
41
+ ```bash
42
+ # voria automatically sets 0600
43
+ ls -la ~/.voria/providers.json
44
+ # Output: -rw------- (readable only by user)
45
+
46
+ # Never relax permissions
47
+ chmod 600 ~/.voria/providers.json # Only this
48
+ chmod 644 ~/.voria/providers.json # ❌ Never this
49
+ ```
50
+
51
+ **Control file access:**
52
+ ```bash
53
+ # Only your user can read config
54
+ stat ~/.voria/providers.json
55
+
56
+ # On shared systems
57
+ sudo chmod 700 ~/.voria # Directory is private
58
+ ```
59
+
60
+ ## Code Execution Safety
61
+
62
+ ### voria Never Executes Arbitrary Code
63
+
64
+ voria's safety model:
65
+
66
+ ```
67
+ Rust CLI (Trusted)
68
+
69
+ └─→ Executes system commands (git, pytest, npm, etc.)
70
+ ← Controlled & logged
71
+
72
+ Python Engine (Untrusted LLM output)
73
+
74
+ └─→ ONLY generates text (patches, plans)
75
+ ← Never executes anything
76
+ ```
77
+
78
+ **Safe Operations:**
79
+ - ✅ Reading files
80
+ - ✅ Generating diffs
81
+ - ✅ Parsing test output
82
+ - ✅ LLM API calls
83
+
84
+ **Prevented Operations:**
85
+ - ❌ `eval()` or `exec()`
86
+ - ❌ System command execution from Python
87
+ - ❌ Installing packages
88
+ - ❌ File deletion
89
+
90
+ ### Patch Validation
91
+
92
+ voria validates patches before applying:
93
+
94
+ ```python
95
+ # What voria checks
96
+ - Does patch format match unified diff?
97
+ - Do line numbers make sense?
98
+ - Are file paths reasonable?
99
+ - No suspicious shell commands?
100
+ - No write to sensitive locations (/etc, /sys, etc)?
101
+ ```
102
+
103
+ ## File System Safety
104
+
105
+ ### Automatic Backups
106
+
107
+ Before EVERY file modification:
108
+ ```bash
109
+ ~/.voria/backups/
110
+ ├── file_1_2026-04-10T09-35-42.bak
111
+ ├── file_2_2026-04-10T09-35-42.bak
112
+ └── file_3_2026-04-10T09-35-42.bak
113
+ ```
114
+
115
+ **Recovery:**
116
+ ```bash
117
+ # Roll back if needed
118
+ cp ~/.voria/backups/file_1_* original_file
119
+ ```
120
+
121
+ ### Restricted Access
122
+
123
+ voria only modifies:
124
+ - ✅ Repository files (your project)
125
+ - ❌ System files (/etc, /usr, /sys)
126
+ - ❌ Hidden files (. prefix)
127
+ - ❌ Outside repository directory
128
+
129
+ ## Network Security
130
+
131
+ ### TLS/HTTPS Only
132
+
133
+ voria uses HTTPS for all API calls:
134
+ ```python
135
+ # All connections are encrypted
136
+ - https://api.openai.com/
137
+ - https://generativelanguage.googleapis.com/
138
+ - https://api.anthropic.com/
139
+ - https://api.github.com/
140
+ ```
141
+
142
+ **Verify certificates:**
143
+ ```bash
144
+ # voria uses system CA certificates
145
+ # Update trust store if needed:
146
+ # macOS: /etc/ssl/certs/
147
+ # Linux: /etc/ssl/certs/ca-certificates.crt
148
+ # Windows: Certificate Manager
149
+ ```
150
+
151
+ ### No Direct Proxy Settings
152
+
153
+ voria respects system HTTP proxy:
154
+ ```bash
155
+ # Set system proxy (voria uses it automatically)
156
+ export HTTP_PROXY="http://proxy.example.com:8080"
157
+ export HTTPS_PROXY="https://proxy.example.com:8443"
158
+ export NO_PROXY="localhost,127.0.0.1"
159
+
160
+ voria plan 1 # Uses proxy automatically
161
+ ```
162
+
163
+ ## Authentication & Authorization
164
+
165
+ ### GitHub Token Scopes
166
+
167
+ Minimal required scopes:
168
+ ```
169
+ repo # Read repository
170
+ repo:status # Read commit status
171
+ public_repo # If public repository only
172
+ ```
173
+
174
+ **Never use `admin:repo_hook` or `admin:org_hook`**
175
+
176
+ **Create token:**
177
+ 1. GitHub → Settings → Developer settings → Personal access tokens
178
+ 2. Click "Generate new token"
179
+ 3. Select ONLY needed scopes
180
+ 4. Set expiration (90 days recommended)
181
+ 5. Save to `~/.voria/config.json`
182
+
183
+ ### LLM API Key Security
184
+
185
+ **Least privilege:**
186
+ - ✅ Create API key specifically for voria
187
+ - ❌ Use main account key
188
+ - ✅ Set rate limits in provider console
189
+ - ❌ Unlimited spending
190
+
191
+ **Monitor usage:**
192
+ ```bash
193
+ # Check spending
194
+ python3 -c "from voria.core.token_manager import TokenManager; m = TokenManager(); print(m.get_stats())"
195
+
196
+ # Set alerts in provider console
197
+ # - OpenAI: Cost alerts
198
+ # - Gmail: Billing notifications
199
+ ```
200
+
201
+ ## Audit & Logging
202
+
203
+ ### Operations Log
204
+
205
+ voria logs all operations:
206
+ ```bash
207
+ # View logs
208
+ voria logs --follow
209
+
210
+ # Logs include:
211
+ # - Command executed
212
+ # - Files modified
213
+ # - LLM prompts (when verbose)
214
+ # - Test results
215
+ ```
216
+
217
+ ### Never Logged
218
+
219
+ For security, these are NEVER logged:
220
+ - ❌ API keys
221
+ - ❌ Credentials
222
+ - ❌ OAuth tokens
223
+ - ❌ Personal data from issues
224
+
225
+ ## Preventing Common Attacks
226
+
227
+ ### 1. Prompt Injection
228
+
229
+ **Risk**: LLM generating malicious code
230
+
231
+ **Protection**:
232
+ - voria validates all generated patches
233
+ - Patches must be valid unified diffs
234
+ - Suspicious commands rejected
235
+
236
+ ### 2. Man-in-the-Middle
237
+
238
+ **Risk**: API credentials intercepted
239
+
240
+ **Protection**:
241
+ - HTTPS/TLS for all network traffic
242
+ - Certificate pinning (recommended for production)
243
+ - Use VPN for shared networks
244
+
245
+ ### 3. Supply Chain
246
+
247
+ **Risk**: Malicious package in dependencies
248
+
249
+ **Protection**:
250
+ - Pin dependency versions
251
+ - Audit dependency contents
252
+ - Use `pip-audit` to check for CVEs
253
+
254
+ ```bash
255
+ pip install pip-audit
256
+ pip-audit --desc # Check for vulnerabilities
257
+ ```
258
+
259
+ ### 4. Accidental Secret Exposure
260
+
261
+ **Risk**: Committing API keys
262
+
263
+ **Protection**:
264
+ - Always use environment variables
265
+ - Add to .gitignore
266
+ - Use secret management tools (e.g., 1Password, Vault)
267
+
268
+ ```bash
269
+ # 1Password integration
270
+ op run -- voria plan 1 # Injects env vars securely
271
+ ```
272
+
273
+ ## Security Checklist
274
+
275
+ - [ ] API keys in environment variables (not files)
276
+ - [ ] Config file permissions set to 0600
277
+ - [ ] GitHub token has minimal scopes
278
+ - [ ] Budget limits set in provider console
279
+ - [ ] No credentials in git history
280
+ - [ ] HTTPS used for all network calls
281
+ - [ ] Backups enabled (auto-backup before changes)
282
+ - [ ] Logs reviewed for suspicious activity
283
+ - [ ] Dependencies audited for CVEs
284
+ - [ ] Only access from trusted networks
285
+
286
+ ## Advanced Security
287
+
288
+ ### Air-Gapped Setup (No Internet)
289
+
290
+ ```bash
291
+ # For highly sensitive repos
292
+ # 1. Create patch locally: voria plan 1 --dry-run
293
+ # 2. Review patch manually
294
+ # 3. Apply patch manually: patch < voria.patch
295
+ # 4. Run tests locally: pytest
296
+ ```
297
+
298
+ ### Sandboxed Execution (Docker)
299
+
300
+ ```dockerfile
301
+ FROM python:3.11
302
+ WORKDIR /app
303
+ COPY . .
304
+ RUN pip install -e .
305
+ USER nobody # Non-root user
306
+ ENTRYPOINT ["python", "-m", "voria.engine"]
307
+ ```
308
+
309
+ ### Hardware Security Module (HSM)
310
+
311
+ For enterprise:
312
+ ```bash
313
+ # Configure HSM for API key storage
314
+ # Work with security team for setup
315
+ ```
316
+
317
+ ## 📞 Security Issues
318
+
319
+ **Found a security vulnerability?**
320
+
321
+ 1. **DO NOT** create a GitHub issue
322
+ 2. Email: security@voria.dev (use a responsible disclosure process)
323
+ 3. Include:
324
+ - Description of vulnerability
325
+ - Steps to reproduce
326
+ - Potential impact
327
+ - Suggested fix (if any)
328
+
329
+ ---
330
+
331
+ **See Also:**
332
+ - [DESIGN_DECISIONS.md](DESIGN_DECISIONS.md) - Security decisions
333
+ - [TROUBLESHOOTING.md](TROUBLESHOOTING.md) - Common issues
334
+ - [PERFORMANCE.md](PERFORMANCE.md) - Performance tuning