@klitchevo/code-council 0.0.16 → 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/README.md +153 -4
- package/dist/chunk-JAGOVGRD.js +393 -0
- package/dist/{chunk-W4MFXWTT.js → chunk-RIJGRVVH.js} +6 -1
- package/dist/chunk-W4FYPS5Z.js +19 -0
- package/dist/chunk-YLBGX3Y3.js +110 -0
- package/dist/config/index.d.ts +351 -0
- package/dist/config/index.js +38 -0
- package/dist/formatter-ZWJ44CI5.js +10 -0
- package/dist/index.js +875 -71
- package/dist/loader-4YLGXTWJ.js +14 -0
- package/dist/{tps-audit-TXNM5HYS.js → tps-audit-UJ26A6KT.js} +3 -2
- package/package.json +12 -1
package/README.md
CHANGED
|
@@ -183,6 +183,7 @@ Review code for quality, bugs, performance, and security issues.
|
|
|
183
183
|
- `code` (required): The code to review
|
|
184
184
|
- `language` (optional): Programming language
|
|
185
185
|
- `context` (optional): Additional context about the code
|
|
186
|
+
- `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
|
|
186
187
|
|
|
187
188
|
**Example usage in Claude:**
|
|
188
189
|
```
|
|
@@ -199,6 +200,7 @@ Review frontend code with focus on accessibility, performance, and UX.
|
|
|
199
200
|
- `framework` (optional): Framework name (e.g., react, vue, svelte)
|
|
200
201
|
- `review_type` (optional): `accessibility`, `performance`, `ux`, or `full` (default)
|
|
201
202
|
- `context` (optional): Additional context
|
|
203
|
+
- `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
|
|
202
204
|
|
|
203
205
|
**Example usage in Claude:**
|
|
204
206
|
```
|
|
@@ -215,6 +217,7 @@ Review backend code for security, performance, and architecture.
|
|
|
215
217
|
- `language` (optional): Language/framework (e.g., node, python, go, rust)
|
|
216
218
|
- `review_type` (optional): `security`, `performance`, `architecture`, or `full` (default)
|
|
217
219
|
- `context` (optional): Additional context
|
|
220
|
+
- `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
|
|
218
221
|
|
|
219
222
|
**Example usage in Claude:**
|
|
220
223
|
```
|
|
@@ -230,6 +233,7 @@ Review implementation plans BEFORE coding to catch issues early.
|
|
|
230
233
|
- `plan` (required): The implementation plan to review
|
|
231
234
|
- `review_type` (optional): `feasibility`, `completeness`, `risks`, `timeline`, or `full` (default)
|
|
232
235
|
- `context` (optional): Project constraints or context
|
|
236
|
+
- `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
|
|
233
237
|
|
|
234
238
|
**Example usage in Claude:**
|
|
235
239
|
```
|
|
@@ -249,6 +253,7 @@ Review git changes directly from your repository.
|
|
|
249
253
|
- `commit` - Review a specific commit (requires `commit_hash`)
|
|
250
254
|
- `commit_hash` (optional): Commit hash to review (required when `review_type` is `commit`)
|
|
251
255
|
- `context` (optional): Additional context about the changes
|
|
256
|
+
- `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
|
|
252
257
|
|
|
253
258
|
**Example usage in Claude:**
|
|
254
259
|
```
|
|
@@ -329,11 +334,146 @@ Reports are saved to `.code-council/` directory:
|
|
|
329
334
|
|
|
330
335
|
Show which AI models are currently configured for each review type.
|
|
331
336
|
|
|
337
|
+
### `init_config`
|
|
338
|
+
|
|
339
|
+
Generate a Code Council configuration file with default values.
|
|
340
|
+
|
|
341
|
+
**Parameters:**
|
|
342
|
+
- `location` (optional): Where to create the config file
|
|
343
|
+
- `directory` (default) - Creates `.code-council/config.ts`
|
|
344
|
+
- `root` - Creates `code-council.config.ts` in project root
|
|
345
|
+
- `format` (optional): Config file format
|
|
346
|
+
- `typescript` (default) - TypeScript with full type support
|
|
347
|
+
- `javascript` - Plain JavaScript
|
|
348
|
+
- `include_comments` (optional): Include explanatory comments (default: `true`)
|
|
349
|
+
- `force` (optional): Overwrite existing config file (default: `false`)
|
|
350
|
+
|
|
351
|
+
**Example usage in Claude:**
|
|
352
|
+
```
|
|
353
|
+
Use init_config to generate a configuration file
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
Use init_config with location=root and format=javascript
|
|
358
|
+
```
|
|
359
|
+
|
|
332
360
|
## Configuration
|
|
333
361
|
|
|
334
|
-
|
|
362
|
+
Code Council supports two configuration methods:
|
|
363
|
+
1. **Config file** (recommended) - TypeScript/JavaScript config file with full type support
|
|
364
|
+
2. **Environment variables** - Quick setup via MCP client config
|
|
335
365
|
|
|
336
|
-
|
|
366
|
+
### Config File (Recommended)
|
|
367
|
+
|
|
368
|
+
Create a config file in your project for full type support and autocompletion:
|
|
369
|
+
|
|
370
|
+
**Option 1: `.code-council/config.ts`** (recommended)
|
|
371
|
+
```typescript
|
|
372
|
+
import { defineConfig } from "@klitchevo/code-council/config";
|
|
373
|
+
|
|
374
|
+
export default defineConfig({
|
|
375
|
+
models: {
|
|
376
|
+
codeReview: ["anthropic/claude-sonnet-4", "openai/gpt-4o"],
|
|
377
|
+
frontendReview: ["anthropic/claude-sonnet-4"],
|
|
378
|
+
backendReview: ["openai/gpt-4o", "google/gemini-2.0-flash-exp"],
|
|
379
|
+
},
|
|
380
|
+
llm: {
|
|
381
|
+
temperature: 0.3,
|
|
382
|
+
maxTokens: 16384,
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Option 2: `code-council.config.ts`** (project root)
|
|
388
|
+
```typescript
|
|
389
|
+
import { defineConfig } from "@klitchevo/code-council/config";
|
|
390
|
+
|
|
391
|
+
export default defineConfig({
|
|
392
|
+
// Same options as above
|
|
393
|
+
});
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Generate a config file via CLI:**
|
|
397
|
+
```bash
|
|
398
|
+
npx @klitchevo/code-council init
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**CLI Options:**
|
|
402
|
+
```bash
|
|
403
|
+
npx @klitchevo/code-council init [options]
|
|
404
|
+
|
|
405
|
+
Options:
|
|
406
|
+
--ts, --typescript Generate TypeScript config (default)
|
|
407
|
+
--js, --javascript Generate JavaScript config
|
|
408
|
+
--root Create config in project root (code-council.config.ts)
|
|
409
|
+
--dir, --directory Create config in .code-council/ directory (default)
|
|
410
|
+
--no-comments Generate config without explanatory comments
|
|
411
|
+
--force, -f Overwrite existing config file
|
|
412
|
+
|
|
413
|
+
Examples:
|
|
414
|
+
npx @klitchevo/code-council init # Creates .code-council/config.ts
|
|
415
|
+
npx @klitchevo/code-council init --js --root # Creates code-council.config.js
|
|
416
|
+
npx @klitchevo/code-council init --force # Overwrite existing config
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Or use the MCP tool:**
|
|
420
|
+
```
|
|
421
|
+
Use init_config to generate a configuration file
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
#### Complete Config Options
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
import { defineConfig } from "@klitchevo/code-council/config";
|
|
428
|
+
|
|
429
|
+
export default defineConfig({
|
|
430
|
+
// Models for each review type
|
|
431
|
+
models: {
|
|
432
|
+
defaultModels: ["model1", "model2"], // Fallback for all types
|
|
433
|
+
codeReview: ["model1", "model2"], // General code reviews
|
|
434
|
+
frontendReview: ["model1"], // Frontend reviews
|
|
435
|
+
backendReview: ["model1", "model2"], // Backend reviews
|
|
436
|
+
planReview: ["model1"], // Plan reviews
|
|
437
|
+
discussion: ["model1", "model2"], // Council discussions
|
|
438
|
+
tpsAudit: ["model1", "model2"], // TPS audits
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
// Consensus analysis settings (all reviews use consensus by default)
|
|
442
|
+
consensus: {
|
|
443
|
+
modelWeights: { // Weight models differently
|
|
444
|
+
"anthropic/claude-sonnet-4": 1.2, // Higher = more influence
|
|
445
|
+
"openai/gpt-4o": 1.0,
|
|
446
|
+
},
|
|
447
|
+
highConfidenceThreshold: 0.8, // Threshold for high confidence
|
|
448
|
+
moderateConfidenceThreshold: 0.5, // Threshold for moderate confidence
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
// LLM behavior
|
|
452
|
+
llm: {
|
|
453
|
+
temperature: 0.3, // 0.0-2.0, lower = more focused
|
|
454
|
+
maxTokens: 16384, // Max response length
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
// Session settings for council discussions
|
|
458
|
+
session: {
|
|
459
|
+
maxSessions: 100, // Max concurrent sessions
|
|
460
|
+
maxMessagesPerModel: 20, // Messages before context windowing
|
|
461
|
+
ttlMs: 1800000, // Session timeout (30 min default)
|
|
462
|
+
rateLimitPerMinute: 10, // Rate limit per session
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
// Input limits
|
|
466
|
+
inputLimits: {
|
|
467
|
+
maxCodeLength: 100000, // Max code input length
|
|
468
|
+
maxContextLength: 50000, // Max context length
|
|
469
|
+
maxModels: 10, // Max models per review
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Environment Variables
|
|
475
|
+
|
|
476
|
+
For quick setup without a config file, use environment variables in your MCP client configuration.
|
|
337
477
|
|
|
338
478
|
**Available Environment Variables:**
|
|
339
479
|
- `CODE_REVIEW_MODELS` - Models for general code reviews
|
|
@@ -367,14 +507,23 @@ You can customize which AI models are used for reviews by setting environment va
|
|
|
367
507
|
}
|
|
368
508
|
```
|
|
369
509
|
|
|
370
|
-
|
|
510
|
+
### Configuration Priority
|
|
511
|
+
|
|
512
|
+
Config file settings take priority over environment variables:
|
|
513
|
+
1. Config file value (if set)
|
|
514
|
+
2. Environment variable (if set)
|
|
515
|
+
3. Default value
|
|
516
|
+
|
|
517
|
+
### Default Models
|
|
518
|
+
|
|
371
519
|
If you don't specify models, the server uses these defaults:
|
|
372
520
|
- `minimax/minimax-m2.1` - Fast, cost-effective reasoning
|
|
373
521
|
- `z-ai/glm-4.7` - Strong multilingual capabilities
|
|
374
522
|
- `moonshotai/kimi-k2-thinking` - Advanced reasoning with thinking
|
|
375
523
|
- `deepseek/deepseek-v3.2` - State-of-the-art open model
|
|
376
524
|
|
|
377
|
-
|
|
525
|
+
### Finding Models
|
|
526
|
+
|
|
378
527
|
Browse all available models at [OpenRouter Models](https://openrouter.ai/models). Popular choices include:
|
|
379
528
|
- `anthropic/claude-sonnet-4.5` - Latest Sonnet, excellent for code review
|
|
380
529
|
- `anthropic/claude-opus-4.5` - Frontier reasoning model for complex tasks
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm,
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-W4FYPS5Z.js";
|
|
5
|
+
|
|
6
|
+
// src/consensus/formatter.ts
|
|
7
|
+
function formatReport(report, format = "markdown") {
|
|
8
|
+
switch (format) {
|
|
9
|
+
case "json":
|
|
10
|
+
return formatJson(report);
|
|
11
|
+
case "html":
|
|
12
|
+
return formatHtml(report);
|
|
13
|
+
case "markdown":
|
|
14
|
+
default:
|
|
15
|
+
return formatMarkdown(report);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function formatJson(report) {
|
|
19
|
+
return JSON.stringify(report, null, 2);
|
|
20
|
+
}
|
|
21
|
+
function severityEmoji(severity) {
|
|
22
|
+
switch (severity) {
|
|
23
|
+
case "critical":
|
|
24
|
+
return "\u{1F534}";
|
|
25
|
+
case "high":
|
|
26
|
+
return "\u{1F7E0}";
|
|
27
|
+
case "medium":
|
|
28
|
+
return "\u{1F7E1}";
|
|
29
|
+
case "low":
|
|
30
|
+
return "\u{1F535}";
|
|
31
|
+
case "info":
|
|
32
|
+
return "\u26AA";
|
|
33
|
+
default:
|
|
34
|
+
return "\u26AA";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function consensusBadge(consensusType) {
|
|
38
|
+
switch (consensusType) {
|
|
39
|
+
case "unanimous":
|
|
40
|
+
return "\u2705 Unanimous";
|
|
41
|
+
case "majority":
|
|
42
|
+
return "\u{1F465} Majority";
|
|
43
|
+
case "minority":
|
|
44
|
+
return "\u26A0\uFE0F Minority";
|
|
45
|
+
case "single":
|
|
46
|
+
return "\u{1F464} Single";
|
|
47
|
+
default:
|
|
48
|
+
return consensusType;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function formatClusterMarkdown(cluster, index) {
|
|
52
|
+
const lines = [];
|
|
53
|
+
lines.push(
|
|
54
|
+
`### ${index + 1}. ${severityEmoji(cluster.severity)} ${cluster.title}`
|
|
55
|
+
);
|
|
56
|
+
lines.push("");
|
|
57
|
+
lines.push(`**Category:** ${cluster.category}`);
|
|
58
|
+
lines.push(`**Severity:** ${cluster.severity}`);
|
|
59
|
+
lines.push(`**Confidence:** ${(cluster.confidence * 100).toFixed(0)}%`);
|
|
60
|
+
lines.push(`**Consensus:** ${consensusBadge(cluster.consensusType)}`);
|
|
61
|
+
if (cluster.canonicalLocation) {
|
|
62
|
+
const loc = cluster.canonicalLocation;
|
|
63
|
+
const lineInfo = loc.line ? loc.endLine ? `:${loc.line}-${loc.endLine}` : `:${loc.line}` : "";
|
|
64
|
+
lines.push(`**Location:** \`${loc.file}${lineInfo}\``);
|
|
65
|
+
}
|
|
66
|
+
lines.push("");
|
|
67
|
+
if (cluster.agreeingModels.length > 0) {
|
|
68
|
+
lines.push(
|
|
69
|
+
`**Reported by:** ${cluster.agreeingModels.map((m) => `\`${m}\``).join(", ")}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (cluster.silentModels.length > 0) {
|
|
73
|
+
lines.push(
|
|
74
|
+
`**Not mentioned by:** ${cluster.silentModels.map((m) => `\`${m}\``).join(", ")}`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
lines.push("");
|
|
78
|
+
if (cluster.findings.length > 0) {
|
|
79
|
+
lines.push("**Details from each model:**");
|
|
80
|
+
lines.push("");
|
|
81
|
+
for (const finding of cluster.findings) {
|
|
82
|
+
lines.push(`- **${finding.sourceModel}**: ${finding.description}`);
|
|
83
|
+
if (finding.suggestion) {
|
|
84
|
+
lines.push(` - *Suggestion:* ${finding.suggestion}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
lines.push("");
|
|
89
|
+
lines.push("---");
|
|
90
|
+
lines.push("");
|
|
91
|
+
return lines.join("\n");
|
|
92
|
+
}
|
|
93
|
+
function formatDisagreementMarkdown(disagreement, index) {
|
|
94
|
+
const lines = [];
|
|
95
|
+
lines.push(`### \u2694\uFE0F Disagreement ${index + 1}: ${disagreement.topic}`);
|
|
96
|
+
lines.push("");
|
|
97
|
+
lines.push(`**Category:** ${disagreement.category}`);
|
|
98
|
+
if (disagreement.location) {
|
|
99
|
+
const loc = disagreement.location;
|
|
100
|
+
const lineInfo = loc.line ? `:${loc.line}` : "";
|
|
101
|
+
lines.push(`**Location:** \`${loc.file}${lineInfo}\``);
|
|
102
|
+
}
|
|
103
|
+
lines.push("");
|
|
104
|
+
lines.push("**Positions:**");
|
|
105
|
+
lines.push("");
|
|
106
|
+
for (const pos of disagreement.positions) {
|
|
107
|
+
lines.push(`- **${pos.model}**: ${pos.stance}`);
|
|
108
|
+
if (pos.reasoning) {
|
|
109
|
+
lines.push(` - *Reasoning:* ${pos.reasoning.substring(0, 200)}...`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
lines.push("");
|
|
113
|
+
lines.push(`**Action Required:** ${disagreement.humanActionRequired}`);
|
|
114
|
+
lines.push("");
|
|
115
|
+
lines.push("---");
|
|
116
|
+
lines.push("");
|
|
117
|
+
return lines.join("\n");
|
|
118
|
+
}
|
|
119
|
+
function formatMarkdown(report) {
|
|
120
|
+
const lines = [];
|
|
121
|
+
lines.push("# Consensus Code Review Report");
|
|
122
|
+
lines.push("");
|
|
123
|
+
lines.push(`*Generated: ${report.generatedAt}*`);
|
|
124
|
+
lines.push(`*Execution time: ${report.executionTimeMs}ms*`);
|
|
125
|
+
lines.push("");
|
|
126
|
+
lines.push("## Summary");
|
|
127
|
+
lines.push("");
|
|
128
|
+
lines.push(
|
|
129
|
+
`- **Participating Models:** ${report.participatingModels.length}`
|
|
130
|
+
);
|
|
131
|
+
lines.push(`- **Total Findings:** ${report.totalFindings}`);
|
|
132
|
+
lines.push(`- **High Confidence Issues:** ${report.highConfidence.length}`);
|
|
133
|
+
lines.push(
|
|
134
|
+
`- **Moderate Confidence Issues:** ${report.moderateConfidence.length}`
|
|
135
|
+
);
|
|
136
|
+
lines.push(`- **Low Confidence Issues:** ${report.lowConfidence.length}`);
|
|
137
|
+
lines.push(
|
|
138
|
+
`- **Disagreements Requiring Review:** ${report.disagreements.length}`
|
|
139
|
+
);
|
|
140
|
+
lines.push("");
|
|
141
|
+
lines.push("### Consensus Distribution");
|
|
142
|
+
lines.push("");
|
|
143
|
+
lines.push(`| Type | Count |`);
|
|
144
|
+
lines.push(`|------|-------|`);
|
|
145
|
+
lines.push(`| \u2705 Unanimous | ${report.stats.unanimous} |`);
|
|
146
|
+
lines.push(`| \u{1F465} Majority | ${report.stats.majority} |`);
|
|
147
|
+
lines.push(`| \u26A0\uFE0F Minority | ${report.stats.minority} |`);
|
|
148
|
+
lines.push(`| \u{1F464} Single | ${report.stats.single} |`);
|
|
149
|
+
lines.push(`| \u2694\uFE0F Disagreements | ${report.stats.disagreements} |`);
|
|
150
|
+
lines.push("");
|
|
151
|
+
lines.push("### Participating Models");
|
|
152
|
+
lines.push("");
|
|
153
|
+
for (const model of report.participatingModels) {
|
|
154
|
+
const weight = report.modelWeights[model] ?? 1;
|
|
155
|
+
lines.push(`- \`${model}\` (weight: ${weight})`);
|
|
156
|
+
}
|
|
157
|
+
lines.push("");
|
|
158
|
+
if (report.highConfidence.length > 0) {
|
|
159
|
+
lines.push("## \u{1F525} High Confidence Findings");
|
|
160
|
+
lines.push("");
|
|
161
|
+
lines.push(
|
|
162
|
+
`*These findings have ${report.thresholds.high * 100}%+ model agreement*`
|
|
163
|
+
);
|
|
164
|
+
lines.push("");
|
|
165
|
+
report.highConfidence.forEach((cluster, i) => {
|
|
166
|
+
lines.push(formatClusterMarkdown(cluster, i));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (report.moderateConfidence.length > 0) {
|
|
170
|
+
lines.push("## \u26A1 Moderate Confidence Findings");
|
|
171
|
+
lines.push("");
|
|
172
|
+
lines.push(
|
|
173
|
+
`*These findings have ${report.thresholds.moderate * 100}%-${report.thresholds.high * 100}% model agreement*`
|
|
174
|
+
);
|
|
175
|
+
lines.push("");
|
|
176
|
+
report.moderateConfidence.forEach((cluster, i) => {
|
|
177
|
+
lines.push(formatClusterMarkdown(cluster, i));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (report.lowConfidence.length > 0) {
|
|
181
|
+
lines.push("## \u{1F4AD} Low Confidence Findings");
|
|
182
|
+
lines.push("");
|
|
183
|
+
lines.push(
|
|
184
|
+
`*These findings have less than ${report.thresholds.moderate * 100}% model agreement*`
|
|
185
|
+
);
|
|
186
|
+
lines.push("");
|
|
187
|
+
report.lowConfidence.forEach((cluster, i) => {
|
|
188
|
+
lines.push(formatClusterMarkdown(cluster, i));
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (report.disagreements.length > 0) {
|
|
192
|
+
lines.push("## \u2694\uFE0F Disagreements Requiring Human Review");
|
|
193
|
+
lines.push("");
|
|
194
|
+
lines.push(
|
|
195
|
+
"*These issues have conflicting opinions from different models and need human decision*"
|
|
196
|
+
);
|
|
197
|
+
lines.push("");
|
|
198
|
+
report.disagreements.forEach((disagreement, i) => {
|
|
199
|
+
lines.push(formatDisagreementMarkdown(disagreement, i));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (report.metadata) {
|
|
203
|
+
lines.push("## Metadata");
|
|
204
|
+
lines.push("");
|
|
205
|
+
lines.push(
|
|
206
|
+
`- **Extraction Model:** \`${report.metadata.extractionModel}\``
|
|
207
|
+
);
|
|
208
|
+
lines.push(`- **Extraction Errors:** ${report.metadata.extractionErrors}`);
|
|
209
|
+
lines.push("");
|
|
210
|
+
}
|
|
211
|
+
lines.push("---");
|
|
212
|
+
lines.push("*Report generated by code-council consensus analysis*");
|
|
213
|
+
return lines.join("\n");
|
|
214
|
+
}
|
|
215
|
+
function escapeHtml(text) {
|
|
216
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
217
|
+
}
|
|
218
|
+
function formatClusterHtml(cluster) {
|
|
219
|
+
const severityClass = `severity-${cluster.severity}`;
|
|
220
|
+
const location = cluster.canonicalLocation ? `<code>${escapeHtml(cluster.canonicalLocation.file)}${cluster.canonicalLocation.line ? `:${cluster.canonicalLocation.line}` : ""}</code>` : "N/A";
|
|
221
|
+
return `
|
|
222
|
+
<div class="finding-cluster ${severityClass}">
|
|
223
|
+
<h3>${severityEmoji(cluster.severity)} ${escapeHtml(cluster.title)}</h3>
|
|
224
|
+
<div class="metadata">
|
|
225
|
+
<span class="badge category">${escapeHtml(cluster.category)}</span>
|
|
226
|
+
<span class="badge severity">${escapeHtml(cluster.severity)}</span>
|
|
227
|
+
<span class="badge confidence">${(cluster.confidence * 100).toFixed(0)}%</span>
|
|
228
|
+
<span class="badge consensus">${consensusBadge(cluster.consensusType)}</span>
|
|
229
|
+
</div>
|
|
230
|
+
<p><strong>Location:</strong> ${location}</p>
|
|
231
|
+
<p><strong>Reported by:</strong> ${cluster.agreeingModels.map((m) => `<code>${escapeHtml(m)}</code>`).join(", ")}</p>
|
|
232
|
+
${cluster.silentModels.length > 0 ? `<p><strong>Not mentioned by:</strong> ${cluster.silentModels.map((m) => `<code>${escapeHtml(m)}</code>`).join(", ")}</p>` : ""}
|
|
233
|
+
<div class="findings">
|
|
234
|
+
${cluster.findings.map(
|
|
235
|
+
(f) => `
|
|
236
|
+
<div class="finding">
|
|
237
|
+
<strong>${escapeHtml(f.sourceModel)}:</strong> ${escapeHtml(f.description)}
|
|
238
|
+
${f.suggestion ? `<br><em>Suggestion: ${escapeHtml(f.suggestion)}</em>` : ""}
|
|
239
|
+
</div>
|
|
240
|
+
`
|
|
241
|
+
).join("")}
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
function formatDisagreementHtml(disagreement) {
|
|
247
|
+
return `
|
|
248
|
+
<div class="disagreement">
|
|
249
|
+
<h3>\u2694\uFE0F ${escapeHtml(disagreement.topic)}</h3>
|
|
250
|
+
<p><strong>Category:</strong> ${escapeHtml(disagreement.category)}</p>
|
|
251
|
+
${disagreement.location ? `<p><strong>Location:</strong> <code>${escapeHtml(disagreement.location.file)}${disagreement.location.line ? `:${disagreement.location.line}` : ""}</code></p>` : ""}
|
|
252
|
+
<div class="positions">
|
|
253
|
+
<h4>Positions:</h4>
|
|
254
|
+
<ul>
|
|
255
|
+
${disagreement.positions.map(
|
|
256
|
+
(p) => `
|
|
257
|
+
<li>
|
|
258
|
+
<strong>${escapeHtml(p.model)}:</strong> ${escapeHtml(p.stance)}
|
|
259
|
+
${p.reasoning ? `<br><em>${escapeHtml(p.reasoning.substring(0, 200))}...</em>` : ""}
|
|
260
|
+
</li>
|
|
261
|
+
`
|
|
262
|
+
).join("")}
|
|
263
|
+
</ul>
|
|
264
|
+
</div>
|
|
265
|
+
<p class="action-required"><strong>Action Required:</strong> ${escapeHtml(disagreement.humanActionRequired)}</p>
|
|
266
|
+
</div>
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
function formatHtml(report) {
|
|
270
|
+
return `<!DOCTYPE html>
|
|
271
|
+
<html lang="en">
|
|
272
|
+
<head>
|
|
273
|
+
<meta charset="UTF-8">
|
|
274
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
275
|
+
<title>Consensus Code Review Report</title>
|
|
276
|
+
<style>
|
|
277
|
+
:root {
|
|
278
|
+
--critical: #dc2626;
|
|
279
|
+
--high: #f97316;
|
|
280
|
+
--medium: #eab308;
|
|
281
|
+
--low: #3b82f6;
|
|
282
|
+
--info: #6b7280;
|
|
283
|
+
}
|
|
284
|
+
body {
|
|
285
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
286
|
+
max-width: 1200px;
|
|
287
|
+
margin: 0 auto;
|
|
288
|
+
padding: 2rem;
|
|
289
|
+
background: #f9fafb;
|
|
290
|
+
color: #1f2937;
|
|
291
|
+
}
|
|
292
|
+
h1 { color: #111827; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.5rem; }
|
|
293
|
+
h2 { color: #374151; margin-top: 2rem; }
|
|
294
|
+
.summary { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
|
295
|
+
.stats-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
|
|
296
|
+
.stats-table th, .stats-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e5e7eb; }
|
|
297
|
+
.stats-table th { background: #f3f4f6; }
|
|
298
|
+
.finding-cluster, .disagreement {
|
|
299
|
+
background: white;
|
|
300
|
+
padding: 1.5rem;
|
|
301
|
+
border-radius: 8px;
|
|
302
|
+
margin: 1rem 0;
|
|
303
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
304
|
+
border-left: 4px solid var(--info);
|
|
305
|
+
}
|
|
306
|
+
.severity-critical { border-left-color: var(--critical); }
|
|
307
|
+
.severity-high { border-left-color: var(--high); }
|
|
308
|
+
.severity-medium { border-left-color: var(--medium); }
|
|
309
|
+
.severity-low { border-left-color: var(--low); }
|
|
310
|
+
.badge {
|
|
311
|
+
display: inline-block;
|
|
312
|
+
padding: 0.25rem 0.5rem;
|
|
313
|
+
border-radius: 4px;
|
|
314
|
+
font-size: 0.875rem;
|
|
315
|
+
margin-right: 0.5rem;
|
|
316
|
+
background: #e5e7eb;
|
|
317
|
+
}
|
|
318
|
+
.badge.category { background: #dbeafe; color: #1e40af; }
|
|
319
|
+
.badge.severity { background: #fef3c7; color: #92400e; }
|
|
320
|
+
.badge.confidence { background: #d1fae5; color: #065f46; }
|
|
321
|
+
.badge.consensus { background: #f3e8ff; color: #6b21a8; }
|
|
322
|
+
code { background: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 4px; font-size: 0.875rem; }
|
|
323
|
+
.findings { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
|
|
324
|
+
.finding { margin: 0.5rem 0; }
|
|
325
|
+
.disagreement { border-left-color: #ef4444; }
|
|
326
|
+
.action-required { background: #fef2f2; padding: 1rem; border-radius: 4px; margin-top: 1rem; }
|
|
327
|
+
.metadata { margin: 0.5rem 0; }
|
|
328
|
+
footer { margin-top: 2rem; color: #6b7280; font-size: 0.875rem; text-align: center; }
|
|
329
|
+
</style>
|
|
330
|
+
</head>
|
|
331
|
+
<body>
|
|
332
|
+
<h1>\u{1F3AF} Consensus Code Review Report</h1>
|
|
333
|
+
|
|
334
|
+
<div class="summary">
|
|
335
|
+
<h2>Summary</h2>
|
|
336
|
+
<p><strong>Generated:</strong> ${escapeHtml(report.generatedAt)}</p>
|
|
337
|
+
<p><strong>Execution Time:</strong> ${report.executionTimeMs}ms</p>
|
|
338
|
+
<p><strong>Participating Models:</strong> ${report.participatingModels.map((m) => `<code>${escapeHtml(m)}</code>`).join(", ")}</p>
|
|
339
|
+
<p><strong>Total Findings:</strong> ${report.totalFindings}</p>
|
|
340
|
+
|
|
341
|
+
<table class="stats-table">
|
|
342
|
+
<tr><th>Consensus Type</th><th>Count</th></tr>
|
|
343
|
+
<tr><td>\u2705 Unanimous</td><td>${report.stats.unanimous}</td></tr>
|
|
344
|
+
<tr><td>\u{1F465} Majority</td><td>${report.stats.majority}</td></tr>
|
|
345
|
+
<tr><td>\u26A0\uFE0F Minority</td><td>${report.stats.minority}</td></tr>
|
|
346
|
+
<tr><td>\u{1F464} Single</td><td>${report.stats.single}</td></tr>
|
|
347
|
+
<tr><td>\u2694\uFE0F Disagreements</td><td>${report.stats.disagreements}</td></tr>
|
|
348
|
+
</table>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
${report.highConfidence.length > 0 ? `
|
|
352
|
+
<h2>\u{1F525} High Confidence Findings (${report.thresholds.high * 100}%+ agreement)</h2>
|
|
353
|
+
${report.highConfidence.map(formatClusterHtml).join("")}
|
|
354
|
+
` : ""}
|
|
355
|
+
|
|
356
|
+
${report.moderateConfidence.length > 0 ? `
|
|
357
|
+
<h2>\u26A1 Moderate Confidence Findings (${report.thresholds.moderate * 100}%-${report.thresholds.high * 100}% agreement)</h2>
|
|
358
|
+
${report.moderateConfidence.map(formatClusterHtml).join("")}
|
|
359
|
+
` : ""}
|
|
360
|
+
|
|
361
|
+
${report.lowConfidence.length > 0 ? `
|
|
362
|
+
<h2>\u{1F4AD} Low Confidence Findings (<${report.thresholds.moderate * 100}% agreement)</h2>
|
|
363
|
+
${report.lowConfidence.map(formatClusterHtml).join("")}
|
|
364
|
+
` : ""}
|
|
365
|
+
|
|
366
|
+
${report.disagreements.length > 0 ? `
|
|
367
|
+
<h2>\u2694\uFE0F Disagreements Requiring Human Review</h2>
|
|
368
|
+
${report.disagreements.map(formatDisagreementHtml).join("")}
|
|
369
|
+
` : ""}
|
|
370
|
+
|
|
371
|
+
${report.metadata ? `
|
|
372
|
+
<h2>Metadata</h2>
|
|
373
|
+
<p><strong>Extraction Model:</strong> <code>${escapeHtml(report.metadata.extractionModel)}</code></p>
|
|
374
|
+
<p><strong>Extraction Errors:</strong> ${report.metadata.extractionErrors}</p>
|
|
375
|
+
` : ""}
|
|
376
|
+
|
|
377
|
+
<footer>
|
|
378
|
+
Report generated by code-council consensus analysis
|
|
379
|
+
</footer>
|
|
380
|
+
</body>
|
|
381
|
+
</html>`;
|
|
382
|
+
}
|
|
383
|
+
var init_formatter = __esm({
|
|
384
|
+
"src/consensus/formatter.ts"() {
|
|
385
|
+
init_esm_shims();
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
export {
|
|
390
|
+
formatReport,
|
|
391
|
+
init_formatter
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=chunk-JAGOVGRD.js.map
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_esm_shims
|
|
3
|
+
} from "./chunk-W4FYPS5Z.js";
|
|
4
|
+
|
|
1
5
|
// src/prompts/tps-audit.ts
|
|
6
|
+
init_esm_shims();
|
|
2
7
|
var SYSTEM_PROMPT = `You are an expert Toyota Production System (TPS) consultant analyzing software codebases. Your role is to "walk the production line" - examining how code flows from input to output, identifying waste (muda), spotting bottlenecks, and suggesting continuous improvement (kaizen).
|
|
3
8
|
|
|
4
9
|
## TPS Principles for Software
|
|
@@ -307,4 +312,4 @@ export {
|
|
|
307
312
|
buildSynthesisUserMessage,
|
|
308
313
|
parseTpsAnalysis
|
|
309
314
|
};
|
|
310
|
-
//# sourceMappingURL=chunk-
|
|
315
|
+
//# sourceMappingURL=chunk-RIJGRVVH.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// node_modules/tsup/assets/esm_shims.js
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
var init_esm_shims = __esm({
|
|
10
|
+
"node_modules/tsup/assets/esm_shims.js"() {
|
|
11
|
+
"use strict";
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__esm,
|
|
17
|
+
init_esm_shims
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-W4FYPS5Z.js.map
|