@jigyasudham/veto 0.8.2 → 1.0.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 (111) hide show
  1. package/README.md +209 -52
  2. package/dist/agents/executor.js +36 -3
  3. package/dist/cli.js +350 -51
  4. package/dist/context/reader.js +113 -0
  5. package/dist/council/index.js +3 -1
  6. package/dist/plugins/loader.js +49 -0
  7. package/dist/router/index.js +2 -2
  8. package/dist/router/learning-updater.js +45 -1
  9. package/dist/server.js +478 -14
  10. package/dist/watcher/index.js +77 -0
  11. package/dist/workflow/pipeline.js +64 -0
  12. package/package.json +12 -3
  13. package/.claude/settings.local.json +0 -9
  14. package/src/adapters/claude.ts +0 -70
  15. package/src/adapters/codex.ts +0 -71
  16. package/src/adapters/gemini.ts +0 -71
  17. package/src/adapters/index.ts +0 -217
  18. package/src/agents/development/api.ts +0 -120
  19. package/src/agents/development/backend.ts +0 -85
  20. package/src/agents/development/coder.ts +0 -213
  21. package/src/agents/development/database.ts +0 -83
  22. package/src/agents/development/debugger.ts +0 -238
  23. package/src/agents/development/devops.ts +0 -86
  24. package/src/agents/development/frontend.ts +0 -85
  25. package/src/agents/development/migration.ts +0 -144
  26. package/src/agents/development/performance.ts +0 -144
  27. package/src/agents/development/refactor.ts +0 -86
  28. package/src/agents/development/reviewer.ts +0 -268
  29. package/src/agents/development/tester.ts +0 -151
  30. package/src/agents/executor.ts +0 -158
  31. package/src/agents/memory/context-manager.ts +0 -171
  32. package/src/agents/memory/decision-logger.ts +0 -160
  33. package/src/agents/memory/knowledge-base.ts +0 -124
  34. package/src/agents/memory/pattern-learner.ts +0 -143
  35. package/src/agents/memory/project-mapper.ts +0 -118
  36. package/src/agents/quality/accessibility.ts +0 -99
  37. package/src/agents/quality/code-quality.ts +0 -115
  38. package/src/agents/quality/compatibility.ts +0 -58
  39. package/src/agents/quality/documentation.ts +0 -105
  40. package/src/agents/quality/error-handling.ts +0 -96
  41. package/src/agents/research/competitor-analyzer.ts +0 -45
  42. package/src/agents/research/cost-analyzer.ts +0 -54
  43. package/src/agents/research/estimator.ts +0 -60
  44. package/src/agents/research/ethics-bias.ts +0 -113
  45. package/src/agents/research/researcher.ts +0 -114
  46. package/src/agents/research/risk-assessor.ts +0 -63
  47. package/src/agents/research/tech-advisor.ts +0 -55
  48. package/src/agents/security/auth.ts +0 -287
  49. package/src/agents/security/dependency-audit.ts +0 -337
  50. package/src/agents/security/penetration.ts +0 -262
  51. package/src/agents/security/privacy.ts +0 -285
  52. package/src/agents/security/scanner.ts +0 -322
  53. package/src/agents/security/secrets.ts +0 -249
  54. package/src/agents/types.ts +0 -66
  55. package/src/agents/workflow/automation.ts +0 -59
  56. package/src/agents/workflow/file-manager.ts +0 -52
  57. package/src/agents/workflow/git-agent.ts +0 -55
  58. package/src/agents/workflow/reporter.ts +0 -51
  59. package/src/agents/workflow/search-agent.ts +0 -40
  60. package/src/agents/workflow/task-coordinator.ts +0 -41
  61. package/src/agents/workflow/task-planner.ts +0 -47
  62. package/src/cli.ts +0 -135
  63. package/src/council/decision-engine.ts +0 -171
  64. package/src/council/devil-advocate.ts +0 -116
  65. package/src/council/index.ts +0 -44
  66. package/src/council/lead-developer.ts +0 -118
  67. package/src/council/legal-compliance.ts +0 -152
  68. package/src/council/product-manager.ts +0 -102
  69. package/src/council/security.ts +0 -172
  70. package/src/council/system-architect.ts +0 -132
  71. package/src/council/types.ts +0 -33
  72. package/src/council/ux-designer.ts +0 -121
  73. package/src/memory/local.ts +0 -305
  74. package/src/memory/schema.ts +0 -174
  75. package/src/memory/sync.ts +0 -274
  76. package/src/router/complexity-scorer.ts +0 -96
  77. package/src/router/context-compressor.ts +0 -74
  78. package/src/router/index.ts +0 -60
  79. package/src/router/learning-updater.ts +0 -271
  80. package/src/router/model-selector.ts +0 -83
  81. package/src/router/rate-monitor.ts +0 -103
  82. package/src/server.ts +0 -1038
  83. package/src/skills/development/skill-api-design.ts +0 -329
  84. package/src/skills/development/skill-auth.ts +0 -271
  85. package/src/skills/development/skill-ci-cd.ts +0 -0
  86. package/src/skills/development/skill-crud.ts +0 -209
  87. package/src/skills/development/skill-db-schema.ts +0 -0
  88. package/src/skills/development/skill-docker.ts +0 -0
  89. package/src/skills/development/skill-env-setup.ts +0 -0
  90. package/src/skills/development/skill-scaffold.ts +0 -323
  91. package/src/skills/intelligence/skill-complexity-score.ts +0 -69
  92. package/src/skills/intelligence/skill-cost-track.ts +0 -39
  93. package/src/skills/intelligence/skill-learning-loop.ts +0 -69
  94. package/src/skills/intelligence/skill-pattern-detect.ts +0 -38
  95. package/src/skills/intelligence/skill-rate-watch.ts +0 -61
  96. package/src/skills/memory/skill-context-compress.ts +0 -98
  97. package/src/skills/memory/skill-cross-sync.ts +0 -104
  98. package/src/skills/memory/skill-decision-log.ts +0 -119
  99. package/src/skills/memory/skill-session-restore.ts +0 -59
  100. package/src/skills/memory/skill-session-save.ts +0 -94
  101. package/src/skills/quality/skill-accessibility.ts +0 -0
  102. package/src/skills/quality/skill-code-review.ts +0 -84
  103. package/src/skills/quality/skill-docs-gen.ts +0 -0
  104. package/src/skills/quality/skill-perf-audit.ts +0 -0
  105. package/src/skills/quality/skill-security-scan.ts +0 -91
  106. package/src/skills/quality/skill-test-suite.ts +0 -290
  107. package/src/skills/workflow/skill-deploy.ts +0 -0
  108. package/src/skills/workflow/skill-git-workflow.ts +0 -0
  109. package/src/skills/workflow/skill-rollback.ts +0 -0
  110. package/src/skills/workflow/skill-task-breakdown.ts +0 -0
  111. package/tsconfig.json +0 -20
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # veto
2
2
 
3
- > **50 agents. 28 skills. 3 AIs. Self-learning. Zero extra cost.**
3
+ > **50 agents. 34 tools. 3 AIs. Self-learning. Zero extra cost.**
4
4
 
5
- An MCP server that runs locally on your machine, plugs into Claude Code, Codex CLI, and Gemini CLI using your existing subscriptions — giving every AI a council of specialist agents, persistent cross-platform memory, a self-learning router, and the ability to say no to bad decisions.
5
+ An MCP server that runs locally on your machine, plugs into Claude Code, Codex CLI, and Gemini CLI using your existing subscriptions — giving every AI a council of specialist agents, persistent cross-platform memory, a self-learning router, reactive file watching, sequential agent pipelines, and the ability to say no to bad decisions.
6
6
 
7
7
  ---
8
8
 
@@ -11,25 +11,12 @@ An MCP server that runs locally on your machine, plugs into Claude Code, Codex C
11
11
  | Requirement | Version | Notes |
12
12
  |---|---|---|
13
13
  | **Node.js** | 22.5.0 or higher | Required — uses the built-in `node:sqlite` module (no native compilation). Download at [nodejs.org](https://nodejs.org). |
14
- | **At least one AI CLI** | Latest | Claude Code, Gemini CLI, or Codex CLI — whichever you use. Veto works with all three. See below. |
14
+ | **At least one AI CLI** | Latest | Claude Code, Gemini CLI, or Codex CLI — whichever you use. Veto works with all three. |
15
15
 
16
- **Check your Node version:**
17
16
  ```bash
18
17
  node --version # must be v22.5.0 or higher
19
18
  ```
20
19
 
21
- If you're on an older version, update Node before continuing — Veto will fail silently on Node 18 or 20 because `node:sqlite` does not exist in those versions.
22
-
23
- **Install whichever AI CLI(s) you use — Veto works with all of them:**
24
-
25
- | Platform | Install | Auth |
26
- |---|---|---|
27
- | **Claude Code** | [claude.ai/code](https://claude.ai/code) | Sign in via browser |
28
- | **Gemini CLI** | `npm install -g @google/gemini-cli` | `gemini auth` |
29
- | **Codex CLI** | `npm install -g @openai/codex` | `export OPENAI_API_KEY=your-key` |
30
-
31
- You only need one to get started. Install more to enable cross-platform handoff.
32
-
33
20
  ---
34
21
 
35
22
  ## Quick Start
@@ -38,7 +25,7 @@ You only need one to get started. Install more to enable cross-platform handoff.
38
25
  npx @jigyasudham/veto@latest init
39
26
  ```
40
27
 
41
- The `init` command prints the exact config snippet for your platform. Paste it into your MCP config file:
28
+ `init` auto-detects every AI tool installed on your machine, configures them all, and builds a project map from your current directory — no manual steps.
42
29
 
43
30
  | Platform | Config file |
44
31
  |---|---|
@@ -49,8 +36,6 @@ The `init` command prints the exact config snippet for your platform. Paste it i
49
36
  | **Windsurf** | `~/.codeium/windsurf/mcp_config.json` |
50
37
  | **VS Code** | `.vscode/mcp.json` |
51
38
 
52
- Claude Code, Gemini, Codex, Cursor, and Windsurf all use `"mcpServers"`:
53
-
54
39
  ```json
55
40
  {
56
41
  "mcpServers": {
@@ -80,13 +65,29 @@ VS Code uses `"servers"` with `"type": "stdio"`:
80
65
 
81
66
  **Council** — Before any significant task, 7 specialist agents debate it in parallel and return a GREEN / YELLOW / RED / DEADLOCK verdict. Bad decisions get blocked before any code is written.
82
67
 
83
- **Router** — Every task is scored locally (zero tokens) and sent to the right model tier. Rate limits are tracked across all 3 platforms. The router self-adjusts over time from recorded outcomes.
68
+ **Codebase-aware agents** — Pass `project_dir` to any tool and Veto auto-reads `package.json`, detects your tech stack, and injects recent `git diff` context. Every agent responds to your actual project, not generic templates.
84
69
 
85
- **50 Agents** — Domain experts for every task type. Each agent knows when it is the right tool and when to defer to another.
70
+ **Structured output** — Every agent result carries `confidence`, `severity`, `recommendation`, `affected_files`, and `line_refs` composable and actionable.
71
+
72
+ **Router** — Every task is scored locally (zero tokens) and sent to the right model tier. Rate limits are tracked across all 3 platforms. The router self-adjusts from recorded outcomes and learns which agents perform best per file type.
73
+
74
+ **50 Agents** — Domain experts for every task type. Each agent knows when it is the right tool and when to defer.
86
75
 
87
76
  **Memory** — Sessions, decisions, knowledge, and coding patterns persist across every conversation and every platform.
88
77
 
89
- **Cross-platform handoff** — Claude hitting its rate limit? Call `veto_handoff`, open Gemini or Codex, call `veto_continue`. Full context restored in seconds. Nothing re-explained.
78
+ **Diff review** — `veto_diff_review` runs code review, security scan, and secrets scan in parallel across a git diff. Returns a pass/warn/fail verdict with per-file findings — ready for CI and pre-commit hooks.
79
+
80
+ **File watching** — `veto_watch` monitors your project and tells you which agent to call when files change.
81
+
82
+ **Sequential pipelines** — `veto_workflow` runs a chain of agents with pass/fail gates end to end.
83
+
84
+ **File explanation** — `veto_explain` reads any file and routes it to the best-fit expert agent automatically.
85
+
86
+ **Plugin system** — Drop a `.js` file in `~/.veto/agents/` and it registers as a custom agent available in every tool.
87
+
88
+ **MCP Resources + Prompts** — Read Veto's memory as MCP Resources. Use built-in Prompts as reusable task templates.
89
+
90
+ **Cross-platform handoff** — Claude hitting its rate limit? `veto_handoff` → open Gemini → `veto_continue`. Full context restored in seconds.
90
91
 
91
92
  ---
92
93
 
@@ -115,23 +116,189 @@ VS Code uses `"servers"` with `"type": "stdio"`:
115
116
 
116
117
  ---
117
118
 
118
- ## MCP Tools (29)
119
+ ## MCP Tools (34)
119
120
 
120
121
  | Category | Tools |
121
122
  |---|---|
122
- | Session | `veto_status` · `veto_session_save` · `veto_session_restore` · `veto_sessions_list` |
123
- | Router | `veto_route_task` · `veto_rate_status` |
124
- | Council | `veto_council_debate` |
125
- | Agents | `veto_agent_plan` · `veto_code_review` · `veto_security_scan` · `veto_secrets_scan` · `veto_execute_parallel` |
126
- | Memory | `veto_memory_store` · `veto_memory_search` · `veto_memory_delete` · `veto_project_map_update` · `veto_project_map_get` · `veto_pattern_store` · `veto_patterns_list` · `veto_memory_export` · `veto_memory_import` |
127
- | Learning | `veto_record_outcome` · `veto_learning_stats` · `veto_learning_apply` |
128
- | Handoff | `veto_handoff` · `veto_continue` · `veto_platform_setup` |
123
+ | **Session** | `veto_status` · `veto_session_save` · `veto_session_restore` · `veto_sessions_list` |
124
+ | **Router** | `veto_route_task` · `veto_rate_status` |
125
+ | **Council** | `veto_council_debate` |
126
+ | **Agents** | `veto_agent_plan` · `veto_execute_parallel` · `veto_explain` |
127
+ | **Review** | `veto_code_review` · `veto_security_scan` · `veto_secrets_scan` · `veto_diff_review` |
128
+ | **Pipelines** | `veto_workflow` |
129
+ | **Watching** | `veto_watch` · `veto_watch_poll` · `veto_watch_stop` |
130
+ | **Memory** | `veto_memory_store` · `veto_memory_search` · `veto_memory_delete` · `veto_project_map_update` · `veto_project_map_get` · `veto_pattern_store` · `veto_patterns_list` · `veto_memory_export` · `veto_memory_import` |
131
+ | **Learning** | `veto_record_outcome` · `veto_learning_stats` · `veto_learning_apply` |
132
+ | **Handoff** | `veto_handoff` · `veto_continue` · `veto_platform_setup` |
133
+ | **Plugins** | `veto_plugins` |
134
+
135
+ ## MCP Resources
136
+
137
+ | URI | What it returns |
138
+ |---|---|
139
+ | `veto://sessions` | All saved sessions across platforms |
140
+ | `veto://project-map?dir=<path>` | Stored project structure map |
141
+ | `veto://memory?q=<query>` | Knowledge base search results |
142
+ | `veto://patterns` | Learned coding patterns |
143
+
144
+ ## MCP Prompts
145
+
146
+ | Prompt | What it does |
147
+ |---|---|
148
+ | `code-review` | Full code review — paste code, get scored findings |
149
+ | `security-audit` | OWASP Top 10 scan with CWE references |
150
+ | `deploy-checklist` | Council reviews your deployment plan before you ship |
151
+ | `explain-file` | Expert explanation of any file, auto-routed by type |
129
152
 
130
153
  ---
131
154
 
132
- ## Cross-Platform Handoff
155
+ ## CLI Commands
156
+
157
+ Use these from any terminal to inspect Veto's brain without opening an AI session.
133
158
 
134
- No accounts. No cloud services. Works on the same machine or across machines.
159
+ After installing globally (`npm i -g @jigyasudham/veto`) or via npx:
160
+
161
+ ```bash
162
+ veto init # Configure all AI tools + scan project
163
+ veto status # Version, DB path, session/memory/outcome counts
164
+ veto sessions # List last 20 saved sessions
165
+ veto memory [query] # Search knowledge base (blank = all entries)
166
+ veto patterns [prefix] # List learned agent/routing patterns
167
+ veto help # Full command + MCP tools reference
168
+
169
+ # Without installing:
170
+ npx @jigyasudham/veto help # Same help output, no install needed
171
+ npx @jigyasudham/veto status # Check status from any machine
172
+ ```
173
+
174
+ `veto help` shows all CLI commands, all 34 MCP tool names, MCP Resources, and MCP Prompts — the full reference in one place.
175
+
176
+ ---
177
+
178
+ ## Codebase-Aware Agents
179
+
180
+ Pass `project_dir` to any agent tool — Veto auto-injects:
181
+ - Project name, version, dependency list
182
+ - Detected tech stack (React, Next.js, Prisma, Express, MCP, etc.)
183
+ - Recent `git diff --stat` and last 5 commits
184
+ - Config files present (tsconfig, vite.config, tailwind, etc.)
185
+
186
+ ```
187
+ veto_council_debate {
188
+ task: "migrate auth from sessions to JWTs",
189
+ project_dir: "/your/project" ← agents now know your actual stack
190
+ }
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Diff Review
196
+
197
+ Auto-reads `git diff HEAD` from `project_dir`, or pass a diff string directly:
198
+
199
+ ```
200
+ veto_diff_review { project_dir: "/your/project" }
201
+ → {
202
+ verdict: "warn",
203
+ files_changed: 4,
204
+ code_review: { score: 78, critical: 0, high: 2, findings: [...] },
205
+ security: { score: 91, critical: 0, high: 0, findings: [...] },
206
+ secrets: { findings: [] },
207
+ summary: "⚠️ WARN — 4 file(s) changed\nCode: approved_with_warnings (78/100)\n..."
208
+ }
209
+ ```
210
+
211
+ Works as a pre-commit hook or CI step. The `summary` field is a single string ready to post as a PR comment.
212
+
213
+ ---
214
+
215
+ ## Sequential Pipelines
216
+
217
+ ```
218
+ veto_workflow {
219
+ steps: [
220
+ { id: "code", agent: "coder", task: "implement auth middleware", gate: 70 },
221
+ { id: "review", agent: "reviewer", task: "review the implementation", gate: 75 },
222
+ { id: "security", agent: "security-scanner", task: "scan for vulnerabilities", gate: 80 },
223
+ { id: "test", agent: "tester", task: "write test cases" }
224
+ ],
225
+ project_dir: "/your/project"
226
+ }
227
+ → { verdict: "passed", steps_passed: 4, steps_failed: 0, results: [...] }
228
+ ```
229
+
230
+ If any step's confidence falls below its gate, the pipeline halts and returns `partial` with the exact failure point.
231
+
232
+ ---
233
+
234
+ ## Reactive File Watching
235
+
236
+ ```bash
237
+ veto_watch { project_dir: "/your/project" }
238
+ → { watch_id: "a3f2b1c0" }
239
+
240
+ # make some changes, then:
241
+ veto_watch_poll { watch_id: "a3f2b1c0" }
242
+ → [
243
+ { file: "src/auth.ts", recommended_agent: "code-quality", suggested_tool: "veto_code_review" },
244
+ { file: "package.json", recommended_agent: "dependency-audit", suggested_tool: "veto_agent_plan" },
245
+ { file: ".env", recommended_agent: "secrets", suggested_tool: "veto_secrets_scan" }
246
+ ]
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Self-Learning Router
252
+
253
+ The router gets smarter as you use it:
254
+
255
+ ```bash
256
+ # After completing a task:
257
+ veto_record_outcome {
258
+ task_type: "fix-auth-bug",
259
+ complexity: 45,
260
+ model_tier: 2,
261
+ output_quality: 88,
262
+ agent: "debugger",
263
+ file_ext: ".ts" # ← teaches the router which agent works best for .ts files
264
+ }
265
+
266
+ # After 20+ outcomes:
267
+ veto_learning_apply # adjusts tier thresholds from your actual data
268
+
269
+ # Next route_task call:
270
+ veto_route_task { task: "debug auth issue", file_ext: ".ts" }
271
+ → { ..., recommended_agent: "debugger" } # ← predicted from history
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Plugin System
277
+
278
+ Register custom agents without forking:
279
+
280
+ ```js
281
+ // ~/.veto/agents/my-agent.js
282
+ export function plan(task, context) {
283
+ return {
284
+ agent: 'my-agent',
285
+ task,
286
+ tier: 2,
287
+ approach: 'Your custom approach...',
288
+ steps: ['Step 1', 'Step 2'],
289
+ checklist: ['[ ] Check 1'],
290
+ pitfalls: ['Pitfall 1'],
291
+ patterns: ['Pattern 1'],
292
+ duration_estimate: '1-2 hours',
293
+ };
294
+ }
295
+ ```
296
+
297
+ Veto loads it on start. Use it in `veto_agent_plan { agent: "my-agent" }` or `veto_execute_parallel`.
298
+
299
+ ---
300
+
301
+ ## Cross-Platform Handoff
135
302
 
136
303
  **Rate limit mid-task:**
137
304
  ```
@@ -143,14 +310,10 @@ Full context restored. Continue exactly where you stopped.
143
310
  **Switch machines:**
144
311
  ```
145
312
  Machine A → veto_memory_export → veto-export.json
146
- copy file any way (Dropbox, USB, scp)
147
- Machine B → veto_memory_import
148
- veto_session_restore → resume instantly
313
+ Machine B → veto_memory_import → veto_session_restore
149
314
  ```
150
315
 
151
- **Platform support:**
152
-
153
- | Platform | Works with Veto |
316
+ | Platform | Support |
154
317
  |---|---|
155
318
  | Claude Code | ✅ Native MCP |
156
319
  | Gemini CLI | ✅ MCP support |
@@ -161,16 +324,6 @@ Machine B → veto_memory_import
161
324
 
162
325
  ---
163
326
 
164
- ## Self-Learning Router
165
-
166
- The router gets smarter as you use it:
167
-
168
- 1. Complete a task → `veto_record_outcome` with quality score (0–100)
169
- 2. After 20+ outcomes → `veto_learning_apply`
170
- 3. Tier thresholds adjust — over-routed tasks self-correct over time
171
-
172
- ---
173
-
174
327
  ## Roadmap
175
328
 
176
329
  | Phase | Status | Version |
@@ -183,16 +336,20 @@ The router gets smarter as you use it:
183
336
  | 6 — Self-Learning | ✅ Complete | v0.6.0 |
184
337
  | 7 — Cross-Platform | ✅ Complete | v0.7.0 |
185
338
  | 8 — All 50 Agents | ✅ Complete | v0.8.0 |
339
+ | 9 — Codebase Context + Structured Output + MCP Resources/Prompts | ✅ Complete | v0.9.0 |
340
+ | 10 — Watch, Workflow, Explain, Plugins | ✅ Complete | v0.10.0 |
341
+ | 11 — Smarter Council + Predictive Routing + Auto Project Map | ✅ Complete | v0.11.0 |
342
+ | 12 — CLI Subcommands + Diff Review | ✅ Complete | v1.0.0 |
186
343
 
187
344
  ---
188
345
 
189
346
  ## Tech Stack
190
347
 
191
348
  - **Language:** TypeScript (strict mode)
192
- - **Runtime:** Node.js 22.5+ (required — uses built-in `node:sqlite`)
193
- - **Dependencies:** `@modelcontextprotocol/sdk` only — one package, no native addons
194
- - **Memory:** SQLite via `node:sqlite` — zero native compilation, zero configuration, works offline
195
- - **Cross-machine:** File-based JSON export/import no external services, no accounts
349
+ - **Runtime:** Node.js 22.5+ (built-in `node:sqlite` — no native compilation)
350
+ - **Dependencies:** `@modelcontextprotocol/sdk` only — one package, zero native addons
351
+ - **Memory:** Local SQLite — zero config, works offline, portable via JSON export
352
+ - **Platforms:** Claude Code · Gemini CLI · Codex CLI · Cursor · Windsurf · VS Code
196
353
 
197
354
  ---
198
355
 
@@ -1,3 +1,5 @@
1
+ import { buildContextString } from '../context/reader.js';
2
+ import { getPlugin } from '../plugins/loader.js';
1
3
  // Development agents
2
4
  import * as coder from './development/coder.js';
3
5
  import * as reviewer from './development/reviewer.js';
@@ -101,30 +103,60 @@ function resolveAgent(agentType) {
101
103
  case 'search-agent': return searchAgent;
102
104
  case 'reporter': return reporter;
103
105
  case 'automation': return automation;
104
- default:
106
+ default: {
107
+ const plugin = getPlugin(agentType);
108
+ if (plugin)
109
+ return plugin;
105
110
  throw new Error(`Unknown agent type: ${agentType}`);
111
+ }
112
+ }
113
+ }
114
+ function deriveOutput(plan, analysis) {
115
+ if (analysis) {
116
+ return {
117
+ confidence: Math.min(1, Math.max(0, analysis.score / 100)),
118
+ severity: analysis.critical_count > 0 ? 'critical' : analysis.high_count > 0 ? 'high' : 'medium',
119
+ recommendation: analysis.summary,
120
+ affected_files: [],
121
+ line_refs: analysis.findings
122
+ .filter(f => f.location)
123
+ .map(f => ({ file: f.location, line: 0, description: f.description })),
124
+ };
125
+ }
126
+ if (plan) {
127
+ return {
128
+ confidence: 0.8,
129
+ severity: 'info',
130
+ recommendation: plan.approach,
131
+ affected_files: [],
132
+ line_refs: [],
133
+ };
106
134
  }
135
+ return { confidence: 0, severity: 'info', recommendation: '', affected_files: [], line_refs: [] };
107
136
  }
108
137
  export async function executeOne(task) {
109
138
  const start = Date.now();
110
139
  try {
111
140
  const agent = resolveAgent(task.agent);
112
141
  const useAnalyze = task.code !== undefined && ANALYZE_CAPABLE.has(task.agent);
142
+ const enrichedContext = buildContextString(task.project_dir, task.context);
113
143
  if (useAnalyze && agent.analyze) {
114
- const analysis = agent.analyze(task.code, task.context);
144
+ const analysis = agent.analyze(task.code, enrichedContext || task.context);
115
145
  return {
116
146
  id: task.id,
117
147
  agent: task.agent,
118
148
  analysis,
149
+ output: deriveOutput(undefined, analysis),
119
150
  duration_ms: Date.now() - start,
120
151
  };
121
152
  }
122
153
  else {
123
- const plan = agent.plan(task.task, task.context);
154
+ const plan = agent.plan(task.task, enrichedContext || task.context);
124
155
  return {
125
156
  id: task.id,
126
157
  agent: task.agent,
127
158
  plan,
159
+ output: deriveOutput(plan, undefined),
128
160
  duration_ms: Date.now() - start,
129
161
  };
130
162
  }
@@ -133,6 +165,7 @@ export async function executeOne(task) {
133
165
  return {
134
166
  id: task.id,
135
167
  agent: task.agent,
168
+ output: { confidence: 0, severity: 'info', recommendation: '', affected_files: [], line_refs: [] },
136
169
  duration_ms: Date.now() - start,
137
170
  error: err instanceof Error ? err.message : String(err),
138
171
  };