@prowi/deskcheck 0.1.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.
- package/LICENSE +21 -0
- package/README.md +266 -0
- package/build/agents/executor-prompt.d.ts +10 -0
- package/build/agents/executor-prompt.d.ts.map +1 -0
- package/build/agents/executor-prompt.js +65 -0
- package/build/agents/executor-prompt.js.map +1 -0
- package/build/agents/orchestrator.d.ts +52 -0
- package/build/agents/orchestrator.d.ts.map +1 -0
- package/build/agents/orchestrator.js +343 -0
- package/build/agents/orchestrator.js.map +1 -0
- package/build/agents/planner.d.ts +28 -0
- package/build/agents/planner.d.ts.map +1 -0
- package/build/agents/planner.js +138 -0
- package/build/agents/planner.js.map +1 -0
- package/build/cli.d.ts +3 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +467 -0
- package/build/cli.js.map +1 -0
- package/build/core/config.d.ts +16 -0
- package/build/core/config.d.ts.map +1 -0
- package/build/core/config.js +81 -0
- package/build/core/config.js.map +1 -0
- package/build/core/context-extractor.d.ts +17 -0
- package/build/core/context-extractor.d.ts.map +1 -0
- package/build/core/context-extractor.js +69 -0
- package/build/core/context-extractor.js.map +1 -0
- package/build/core/glob-matcher.d.ts +32 -0
- package/build/core/glob-matcher.d.ts.map +1 -0
- package/build/core/glob-matcher.js +51 -0
- package/build/core/glob-matcher.js.map +1 -0
- package/build/core/module-parser.d.ts +26 -0
- package/build/core/module-parser.d.ts.map +1 -0
- package/build/core/module-parser.js +98 -0
- package/build/core/module-parser.js.map +1 -0
- package/build/core/plan-builder.d.ts +12 -0
- package/build/core/plan-builder.d.ts.map +1 -0
- package/build/core/plan-builder.js +66 -0
- package/build/core/plan-builder.js.map +1 -0
- package/build/core/storage.d.ts +118 -0
- package/build/core/storage.d.ts.map +1 -0
- package/build/core/storage.js +590 -0
- package/build/core/storage.js.map +1 -0
- package/build/core/types.d.ts +268 -0
- package/build/core/types.d.ts.map +1 -0
- package/build/core/types.js +5 -0
- package/build/core/types.js.map +1 -0
- package/build/mcp/tools.d.ts +10 -0
- package/build/mcp/tools.d.ts.map +1 -0
- package/build/mcp/tools.js +354 -0
- package/build/mcp/tools.js.map +1 -0
- package/build/mcp-server.d.ts +3 -0
- package/build/mcp-server.d.ts.map +1 -0
- package/build/mcp-server.js +15 -0
- package/build/mcp-server.js.map +1 -0
- package/build/renderers/json.d.ts +4 -0
- package/build/renderers/json.d.ts.map +1 -0
- package/build/renderers/json.js +5 -0
- package/build/renderers/json.js.map +1 -0
- package/build/renderers/markdown.d.ts +4 -0
- package/build/renderers/markdown.d.ts.map +1 -0
- package/build/renderers/markdown.js +36 -0
- package/build/renderers/markdown.js.map +1 -0
- package/build/renderers/shared.d.ts +23 -0
- package/build/renderers/shared.d.ts.map +1 -0
- package/build/renderers/shared.js +30 -0
- package/build/renderers/shared.js.map +1 -0
- package/build/renderers/terminal.d.ts +4 -0
- package/build/renderers/terminal.d.ts.map +1 -0
- package/build/renderers/terminal.js +88 -0
- package/build/renderers/terminal.js.map +1 -0
- package/build/renderers/watch.d.ts +4 -0
- package/build/renderers/watch.d.ts.map +1 -0
- package/build/renderers/watch.js +119 -0
- package/build/renderers/watch.js.map +1 -0
- package/build/serve.d.ts +9 -0
- package/build/serve.d.ts.map +1 -0
- package/build/serve.js +249 -0
- package/build/serve.js.map +1 -0
- package/package.json +41 -0
- package/ui/dist/index.html +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Prowi ApS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# deskcheck
|
|
2
|
+
|
|
3
|
+
Modular code review powered by Claude. Define what to check as markdown, deskcheck runs each check in a fresh AI agent, and aggregates the findings.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Why deskcheck?
|
|
8
|
+
|
|
9
|
+
Traditional code review tools leave a gap:
|
|
10
|
+
|
|
11
|
+
- **Tests** verify behavior — they can't tell you "this controller has business logic that belongs in a service"
|
|
12
|
+
- **Linters** verify syntax — they can't tell you "this endpoint is missing input validation"
|
|
13
|
+
- **A single LLM** reviewing a whole branch suffers **context rot** — as its context fills up, it starts missing the patterns it's supposed to catch
|
|
14
|
+
|
|
15
|
+
Deskcheck solves this by breaking every review into the smallest possible unit: **one file + one criterion + one fresh agent**. Each agent gets a clean context with only the code it needs and the specific rules to check. Results are aggregated mechanically.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Your code + Criteria → N executor agents → Aggregated findings
|
|
19
|
+
(fresh context each)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install
|
|
26
|
+
npm install -g @prowi/deskcheck
|
|
27
|
+
|
|
28
|
+
# Initialize in your project (creates criteria directory + config)
|
|
29
|
+
deskcheck init
|
|
30
|
+
|
|
31
|
+
# Review your branch changes against main
|
|
32
|
+
deskcheck diff main
|
|
33
|
+
|
|
34
|
+
# Review a specific file
|
|
35
|
+
deskcheck "src/services/PaymentService.ts"
|
|
36
|
+
|
|
37
|
+
# Open the web dashboard
|
|
38
|
+
deskcheck serve
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## How It Works
|
|
42
|
+
|
|
43
|
+
### 1. You define criteria as markdown
|
|
44
|
+
|
|
45
|
+
Each criterion is a markdown file with YAML frontmatter that says **what to check**, **which files to check**, and **how important it is**:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
---
|
|
49
|
+
description: "Checks for common security vulnerabilities"
|
|
50
|
+
severity: critical
|
|
51
|
+
globs:
|
|
52
|
+
- "src/**/*.ts"
|
|
53
|
+
- "!src/**/*.test.ts"
|
|
54
|
+
model: sonnet
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
You are a security reviewer. Check for:
|
|
58
|
+
|
|
59
|
+
1. **Hardcoded secrets** — API keys, passwords, tokens in source code
|
|
60
|
+
2. **SQL injection** — string concatenation in database queries
|
|
61
|
+
3. **Missing input validation** — user input used without sanitization
|
|
62
|
+
|
|
63
|
+
For each issue, report the severity, file, line number, and a fix suggestion.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Put criteria in `deskcheck/criteria/` — organize them however you like:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
deskcheck/criteria/
|
|
70
|
+
├── security/
|
|
71
|
+
│ └── input-validation.md
|
|
72
|
+
├── architecture/
|
|
73
|
+
│ └── separation-of-concerns.md
|
|
74
|
+
└── best-practices/
|
|
75
|
+
└── error-handling.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Deskcheck matches criteria to your files
|
|
79
|
+
|
|
80
|
+
Each criterion has `globs` that define which files it applies to. When you run `deskcheck diff main`, it gets the list of changed files and matches them against every criterion's globs. Each match becomes a **task**: one file + one criterion.
|
|
81
|
+
|
|
82
|
+
### 3. Each task runs in a fresh agent
|
|
83
|
+
|
|
84
|
+
Every task is executed by a new Claude agent with only:
|
|
85
|
+
- The file content (or diff)
|
|
86
|
+
- The criterion's instructions
|
|
87
|
+
- Access to read tools (Read, Glob, Grep) for additional context
|
|
88
|
+
|
|
89
|
+
No context leakage between tasks. A fresh agent reviewing one file against one set of rules catches issues with near-100% reliability.
|
|
90
|
+
|
|
91
|
+
### 4. Findings are aggregated
|
|
92
|
+
|
|
93
|
+
Results are grouped by file, criterion, and severity. You can browse them in the terminal, as markdown (for PR comments), as JSON (for tooling), or in the **web dashboard**:
|
|
94
|
+
|
|
95
|
+

|
|
96
|
+
|
|
97
|
+
## CLI Commands
|
|
98
|
+
|
|
99
|
+
### `deskcheck diff [git-args...]`
|
|
100
|
+
|
|
101
|
+
Deterministic review of git changes. No LLM planner — passes args directly to `git diff`.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
deskcheck diff main # Changes vs main
|
|
105
|
+
deskcheck diff --staged # Staged changes only
|
|
106
|
+
deskcheck diff HEAD~3 # Last 3 commits
|
|
107
|
+
deskcheck diff main -- src/services/ # Scoped to a directory
|
|
108
|
+
deskcheck diff main --dry-run # Preview plan without executing
|
|
109
|
+
deskcheck diff main --fail-on=critical # Exit 1 if critical findings (for CI)
|
|
110
|
+
deskcheck diff main --format=markdown # Markdown output (for PR comments)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `deskcheck "<prompt>"`
|
|
114
|
+
|
|
115
|
+
Natural language review — an LLM agent interprets what you want to check.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
deskcheck "src/services/OrderService.ts"
|
|
119
|
+
deskcheck "check the auth module"
|
|
120
|
+
deskcheck "the calculate method in Commission.ts"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `deskcheck serve`
|
|
124
|
+
|
|
125
|
+
Web dashboard with live updates. Shows all runs, task progress, usage/cost tracking, and findings with filtering.
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
deskcheck serve # Start on default port (3000)
|
|
129
|
+
deskcheck serve --port 8080 # Custom port
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `deskcheck show [plan-id]`
|
|
133
|
+
|
|
134
|
+
Display results in the terminal.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
deskcheck show # Latest run
|
|
138
|
+
deskcheck show --format=markdown # As markdown
|
|
139
|
+
deskcheck show --format=json # As JSON
|
|
140
|
+
deskcheck show --fail-on=warning # Exit 1 if warnings or worse
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `deskcheck watch [plan-id]`
|
|
144
|
+
|
|
145
|
+
Live terminal tree view of a run in progress.
|
|
146
|
+
|
|
147
|
+
### `deskcheck list`
|
|
148
|
+
|
|
149
|
+
List all runs with status and finding counts.
|
|
150
|
+
|
|
151
|
+
### `deskcheck init`
|
|
152
|
+
|
|
153
|
+
Scaffold config and criteria directory for a new project.
|
|
154
|
+
|
|
155
|
+
## Web Dashboard
|
|
156
|
+
|
|
157
|
+
Start with `deskcheck serve` and open `http://localhost:3000`.
|
|
158
|
+
|
|
159
|
+
**Run overview** — progress bar, usage/cost tracking, sortable task table with severity filters, and file coverage:
|
|
160
|
+
|
|
161
|
+

|
|
162
|
+
|
|
163
|
+
**File detail** — click any file to see all findings across criteria, with severity filtering and grouping options:
|
|
164
|
+
|
|
165
|
+

|
|
166
|
+
|
|
167
|
+
The dashboard uses SSE for live updates — watch tasks complete in real time during execution.
|
|
168
|
+
|
|
169
|
+
## Criterion Reference
|
|
170
|
+
|
|
171
|
+
### Frontmatter Fields
|
|
172
|
+
|
|
173
|
+
| Field | Required | Default | Description |
|
|
174
|
+
|-------|----------|---------|-------------|
|
|
175
|
+
| `description` | Yes | — | Human-readable description shown in reports |
|
|
176
|
+
| `severity` | Yes | — | Importance: `critical`, `high`, `medium`, `low` |
|
|
177
|
+
| `globs` | Yes | — | File patterns to match. Prefix with `!` to exclude |
|
|
178
|
+
| `mode` | No | `"One task per file"` | How to split files into tasks (natural language) |
|
|
179
|
+
| `model` | No | `"haiku"` | Claude model: `haiku`, `sonnet`, `opus` |
|
|
180
|
+
|
|
181
|
+
### Choosing the Right Model
|
|
182
|
+
|
|
183
|
+
| Use Case | Model | Why |
|
|
184
|
+
|----------|-------|-----|
|
|
185
|
+
| Simple patterns (naming, imports, console.log) | `haiku` | Fast and cheap |
|
|
186
|
+
| Architectural judgment (separation of concerns, DTOs) | `sonnet` | Good reasoning at moderate cost |
|
|
187
|
+
| Security analysis, complex data flow | `opus` | Deep analysis for high-stakes checks |
|
|
188
|
+
|
|
189
|
+
### The Detective Prompt
|
|
190
|
+
|
|
191
|
+
The markdown body below the frontmatter is the **detective prompt** — instructions given to each executor agent. Include:
|
|
192
|
+
|
|
193
|
+
- **What to check** — specific patterns and violations
|
|
194
|
+
- **What NOT to check** — exclusions to reduce false positives
|
|
195
|
+
- **Severity guidance** — when to report critical vs warning vs info
|
|
196
|
+
|
|
197
|
+
The agent has read access to the project, so your prompt can reference other files:
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+
Read `.eslintrc.js` to understand the project's linting config.
|
|
201
|
+
Then check for architectural patterns that ESLint can't catch.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Configuration
|
|
205
|
+
|
|
206
|
+
Configuration lives in `.deskcheck/config.json` (created by `deskcheck init`):
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"modules_dir": "deskcheck/criteria",
|
|
211
|
+
"storage_dir": ".deskcheck/runs",
|
|
212
|
+
"shared": {
|
|
213
|
+
"allowed_tools": ["Read", "Glob", "Grep"],
|
|
214
|
+
"mcp_servers": {}
|
|
215
|
+
},
|
|
216
|
+
"agents": {
|
|
217
|
+
"planner": { "model": "haiku" },
|
|
218
|
+
"executor": {},
|
|
219
|
+
"evaluator": { "model": "haiku" }
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The executor **model** comes from each criterion's `model` field, not from config. This lets cheap checks use `haiku` and important checks use `sonnet`.
|
|
225
|
+
|
|
226
|
+
## CI Integration
|
|
227
|
+
|
|
228
|
+
Use `--fail-on` to gate your pipeline:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Fail if any critical findings
|
|
232
|
+
deskcheck diff $BASE_BRANCH --fail-on=critical
|
|
233
|
+
|
|
234
|
+
# Output as markdown for PR comments
|
|
235
|
+
deskcheck diff $BASE_BRANCH --format=markdown > review.md
|
|
236
|
+
gh pr comment $PR_NUMBER --body "$(cat review.md)"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Exit codes: `0` = no findings matching threshold, `1` = findings exceed threshold.
|
|
240
|
+
|
|
241
|
+
## MCP Server
|
|
242
|
+
|
|
243
|
+
Deskcheck can run as an MCP server for Claude Code integration:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"mcpServers": {
|
|
248
|
+
"deskcheck": {
|
|
249
|
+
"command": "npx",
|
|
250
|
+
"args": ["deskcheck-mcp"]
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Usage Tracking
|
|
257
|
+
|
|
258
|
+
Every run tracks token usage and cost per task. The web dashboard shows totals (cost, input/output tokens) and per-task breakdowns, so you can see exactly how much each review costs and which criteria are most expensive.
|
|
259
|
+
|
|
260
|
+
## Disclaimer
|
|
261
|
+
|
|
262
|
+
This tool was vibe-coded in a single day using [Claude Code](https://claude.ai/claude-code). The architecture, implementation, web UI, and even this README were built through conversation with Claude Opus 4.6. It works, we use it, but it hasn't been battle-tested at scale. Expect rough edges. Contributions welcome.
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReviewTask } from "../core/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build the system prompt for an executor agent.
|
|
4
|
+
*
|
|
5
|
+
* The executor receives a single deskcheck task containing the detective prompt
|
|
6
|
+
* (from the criterion), the files to check, and the extracted context
|
|
7
|
+
* (diff, file content, or symbol). It outputs a JSON array of findings to stdout.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildExecutorPrompt(task: ReviewTask): string;
|
|
10
|
+
//# sourceMappingURL=executor-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-prompt.d.ts","sourceRoot":"","sources":["../../src/agents/executor-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CA4B5D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the system prompt for an executor agent.
|
|
3
|
+
*
|
|
4
|
+
* The executor receives a single deskcheck task containing the detective prompt
|
|
5
|
+
* (from the criterion), the files to check, and the extracted context
|
|
6
|
+
* (diff, file content, or symbol). It outputs a JSON array of findings to stdout.
|
|
7
|
+
*/
|
|
8
|
+
export function buildExecutorPrompt(task) {
|
|
9
|
+
const sections = [];
|
|
10
|
+
sections.push("You are a code review executor. Your job is to review code and report findings.");
|
|
11
|
+
// Criterion instructions (the detective prompt from the criterion)
|
|
12
|
+
sections.push(`## Review Instructions\n${task.prompt ?? "No instructions provided."}`);
|
|
13
|
+
// Files under review
|
|
14
|
+
const fileList = task.files.map((f) => `- ${f}`).join("\n");
|
|
15
|
+
sections.push(`## Files Under Review\n${fileList}`);
|
|
16
|
+
// Scope hint
|
|
17
|
+
sections.push(`## Scope Hint\n${task.hint ?? "No specific hint."}`);
|
|
18
|
+
// Review context
|
|
19
|
+
const contextHeader = `## Review Context\n**Context Type:** ${task.context_type}`;
|
|
20
|
+
const symbolLine = task.symbol ? `\n**Symbol:** ${task.symbol}` : "";
|
|
21
|
+
const contextBody = task.context ?? "No context provided.";
|
|
22
|
+
sections.push(`${contextHeader}${symbolLine}\n\n${contextBody}`);
|
|
23
|
+
// Instructions based on context type
|
|
24
|
+
sections.push(buildContextTypeGuidance(task.context_type));
|
|
25
|
+
// Output format instructions
|
|
26
|
+
sections.push(buildOutputInstructions());
|
|
27
|
+
return sections.join("\n\n");
|
|
28
|
+
}
|
|
29
|
+
/** Guidance on how to review based on the context type. */
|
|
30
|
+
function buildContextTypeGuidance(contextType) {
|
|
31
|
+
const header = "## How to Review Based on Context Type";
|
|
32
|
+
switch (contextType) {
|
|
33
|
+
case "diff":
|
|
34
|
+
return `${header}\nYou are reviewing a **diff**. Focus on the changes — look at what was added, removed, or modified. Evaluate whether the changes are correct, follow best practices, and don't introduce regressions.`;
|
|
35
|
+
case "file":
|
|
36
|
+
return `${header}\nYou are reviewing **full file contents**. Review the code holistically — check structure, patterns, naming, potential bugs, and adherence to best practices.`;
|
|
37
|
+
case "symbol":
|
|
38
|
+
return `${header}\nYou are reviewing a **specific symbol** (function, class, or method). Focus on the named symbol — its implementation, correctness, error handling, and adherence to conventions.`;
|
|
39
|
+
default:
|
|
40
|
+
return `${header}\nReview the provided context for correctness and best practices.`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Instructions for the executor's output format. */
|
|
44
|
+
function buildOutputInstructions() {
|
|
45
|
+
return `## Your Task
|
|
46
|
+
1. Read the review instructions carefully
|
|
47
|
+
2. Analyze the code provided in the context
|
|
48
|
+
3. Report findings as a JSON array to stdout
|
|
49
|
+
|
|
50
|
+
Output ONLY a JSON array of findings. Each finding:
|
|
51
|
+
\`\`\`json
|
|
52
|
+
{"severity": "critical|warning|info", "file": "path", "line": null, "description": "...", "suggestion": null}
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
- \`severity\`: "critical" for bugs/security issues, "warning" for code quality problems, "info" for suggestions
|
|
56
|
+
- \`file\`: the file path where the issue was found
|
|
57
|
+
- \`line\`: line number if applicable, or null
|
|
58
|
+
- \`description\`: clear description of the issue
|
|
59
|
+
- \`suggestion\`: suggested fix or improvement, or null
|
|
60
|
+
|
|
61
|
+
If no issues found, output an empty array: []
|
|
62
|
+
|
|
63
|
+
Do NOT output any text outside the JSON array. No explanations, no markdown, no commentary — just the JSON array.`;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=executor-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-prompt.js","sourceRoot":"","sources":["../../src/agents/executor-prompt.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,QAAQ,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAEjG,mEAAmE;IACnE,QAAQ,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,MAAM,IAAI,2BAA2B,EAAE,CAAC,CAAC;IAEvF,qBAAqB;IACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5D,QAAQ,CAAC,IAAI,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;IAEpD,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,IAAI,mBAAmB,EAAE,CAAC,CAAC;IAEpE,iBAAiB;IACjB,MAAM,aAAa,GAAG,wCAAwC,IAAI,CAAC,YAAY,EAAE,CAAC;IAClF,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,IAAI,sBAAsB,CAAC;IAC3D,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,GAAG,UAAU,OAAO,WAAW,EAAE,CAAC,CAAC;IAEjE,qCAAqC;IACrC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAE3D,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAEzC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,2DAA2D;AAC3D,SAAS,wBAAwB,CAAC,WAAmB;IACnD,MAAM,MAAM,GAAG,wCAAwC,CAAC;IAExD,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,GAAG,MAAM,wMAAwM,CAAC;QAC3N,KAAK,MAAM;YACT,OAAO,GAAG,MAAM,gKAAgK,CAAC;QACnL,KAAK,QAAQ;YACX,OAAO,GAAG,MAAM,oLAAoL,CAAC;QACvM;YACE,OAAO,GAAG,MAAM,mEAAmE,CAAC;IACxF,CAAC;AACH,CAAC;AAED,qDAAqD;AACrD,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;kHAkByG,CAAC;AACnH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReviewConfig, TaskUsage } from "../core/types.js";
|
|
2
|
+
/** Events yielded by the orchestrator's execute() async generator. */
|
|
3
|
+
export type OrchestratorEvent = {
|
|
4
|
+
type: "task_started";
|
|
5
|
+
taskId: string;
|
|
6
|
+
reviewId: string;
|
|
7
|
+
model: string;
|
|
8
|
+
files: string[];
|
|
9
|
+
} | {
|
|
10
|
+
type: "task_completed";
|
|
11
|
+
taskId: string;
|
|
12
|
+
reviewId: string;
|
|
13
|
+
files: string[];
|
|
14
|
+
findingCount: number;
|
|
15
|
+
usage: TaskUsage | null;
|
|
16
|
+
} | {
|
|
17
|
+
type: "task_error";
|
|
18
|
+
taskId: string;
|
|
19
|
+
reviewId: string;
|
|
20
|
+
files: string[];
|
|
21
|
+
error: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "batch_progress";
|
|
24
|
+
completed: number;
|
|
25
|
+
total: number;
|
|
26
|
+
} | {
|
|
27
|
+
type: "complete";
|
|
28
|
+
totalFindings: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Executes a review plan by dispatching tasks to executor agents via the
|
|
32
|
+
* Claude Agent SDK and collecting their findings.
|
|
33
|
+
*
|
|
34
|
+
* Uses an async generator to yield progress events, allowing callers to
|
|
35
|
+
* react to task starts, completions, errors, and overall progress in real time.
|
|
36
|
+
*/
|
|
37
|
+
export declare class ReviewOrchestrator {
|
|
38
|
+
private readonly config;
|
|
39
|
+
private readonly projectRoot;
|
|
40
|
+
constructor(config: ReviewConfig, projectRoot: string);
|
|
41
|
+
/**
|
|
42
|
+
* Execute all pending tasks in a plan.
|
|
43
|
+
*
|
|
44
|
+
* Runs up to `maxConcurrent` executor agents at a time using a concurrency
|
|
45
|
+
* pool. Each executor receives a system prompt built from the task, uses
|
|
46
|
+
* the Claude Agent SDK to analyze the code, and outputs findings as JSON.
|
|
47
|
+
*/
|
|
48
|
+
execute(planId: string, options?: {
|
|
49
|
+
maxConcurrent?: number;
|
|
50
|
+
}): AsyncGenerator<OrchestratorEvent>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,YAAY,EAEZ,SAAS,EACV,MAAM,kBAAkB,CAAC;AAM1B,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAC1F;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,GAC5H;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxF;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AA2IhD;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM;IAKrD;;;;;;OAMG;IACI,OAAO,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GACnC,cAAc,CAAC,iBAAiB,CAAC;CAqOrC"}
|