revdeck 0.4.5 → 0.5.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/CHANGELOG.md +38 -0
- package/README.md +42 -3
- package/README.ru.md +42 -3
- package/dist/cli.js +477 -81
- package/dist/cli.js.map +4 -4
- package/dist/daemon.js +525 -19
- package/dist/daemon.js.map +4 -4
- package/dist/mcp.js +208 -25
- package/dist/mcp.js.map +4 -4
- package/dist/ui/assets/{index-DZ9XSSBl.css → index-CcmcJhhu.css} +1 -1
- package/dist/ui/assets/index-CuvK5owY.js +10 -0
- package/dist/ui/index.html +2 -2
- package/docs/configuration.md +135 -2
- package/docs/ru/configuration.md +138 -2
- package/package.json +1 -1
- package/skills/revdeck/en/SKILL.md +20 -0
- package/skills/revdeck/ru/SKILL.md +20 -0
- package/dist/ui/assets/index-pR3id2Nv.js +0 -10
package/dist/mcp.js
CHANGED
|
@@ -34,7 +34,7 @@ function daemonInfoPath() {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// src/version.ts
|
|
37
|
-
var VERSION = "0.
|
|
37
|
+
var VERSION = "0.5.0";
|
|
38
38
|
|
|
39
39
|
// src/client.ts
|
|
40
40
|
var RpcError = class extends Error {
|
|
@@ -297,12 +297,136 @@ function when(iso, language = locale()) {
|
|
|
297
297
|
return date.toLocaleString(en ? "en-US" : "ru-RU", { dateStyle: "short", timeStyle: "short" });
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
// src/core/review-roles.ts
|
|
301
|
+
var DEFAULT_REVIEW_ROLES = ["correctness", "architecture", "tests"];
|
|
302
|
+
var REVIEW_ROLES = {
|
|
303
|
+
correctness: {
|
|
304
|
+
criteria: ["6", "10"],
|
|
305
|
+
title: { ru: "\u041A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0441\u0442\u044C", en: "Correctness" },
|
|
306
|
+
focus: { ru: "\u043B\u043E\u0433\u0438\u043A\u0430, \u0433\u0440\u0430\u043D\u0438\u0447\u043D\u044B\u0435 \u0441\u043B\u0443\u0447\u0430\u0438, \u043E\u0448\u0438\u0431\u043A\u0438, null/undefined, async \u0438 \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435", en: "logic, edge cases, errors, null/undefined, async and state" }
|
|
307
|
+
},
|
|
308
|
+
architecture: {
|
|
309
|
+
criteria: ["3", "4", "5", "7"],
|
|
310
|
+
title: { ru: "\u0410\u0440\u0445\u0438\u0442\u0435\u043A\u0442\u0443\u0440\u0430", en: "Architecture" },
|
|
311
|
+
focus: { ru: "\u0441\u043B\u043E\u0438 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438, \u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u044C, \u0441\u0432\u044F\u0437\u043D\u043E\u0441\u0442\u044C, \u043F\u0440\u0435\u0446\u0435\u0434\u0435\u043D\u0442\u044B \u0438 ADR", en: "layers and dependencies, responsibility, coupling, precedents and ADRs" }
|
|
312
|
+
},
|
|
313
|
+
tests: {
|
|
314
|
+
criteria: ["8"],
|
|
315
|
+
title: { ru: "\u0422\u0435\u0441\u0442\u044B", en: "Tests" },
|
|
316
|
+
focus: { ru: "\u043F\u043E\u043A\u0440\u044B\u0442\u0438\u0435, assertions, \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0438 \u0438 \u043D\u0435\u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0435 \u0442\u0435\u0441\u0442\u044B", en: "coverage, assertions, missing scenarios and flaky tests" }
|
|
317
|
+
},
|
|
318
|
+
security: {
|
|
319
|
+
criteria: ["10"],
|
|
320
|
+
title: { ru: "\u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u044C", en: "Security" },
|
|
321
|
+
focus: { ru: "\u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044F, \u0432\u0430\u043B\u0438\u0434\u0430\u0446\u0438\u044F \u0432\u0432\u043E\u0434\u0430, \u0441\u0435\u043A\u0440\u0435\u0442\u044B, \u0438\u043D\u044A\u0435\u043A\u0446\u0438\u0438, shell \u0438 \u043E\u043F\u0430\u0441\u043D\u044B\u0435 \u043F\u0440\u0430\u0432\u0430", en: "authorization, input validation, secrets, injections, shell and dangerous permissions" }
|
|
322
|
+
},
|
|
323
|
+
performance: {
|
|
324
|
+
criteria: ["10"],
|
|
325
|
+
title: { ru: "\u041F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C", en: "Performance" },
|
|
326
|
+
focus: { ru: "\u0441\u043B\u043E\u0436\u043D\u043E\u0441\u0442\u044C, N+1, \u043B\u0438\u0448\u043D\u0438\u0435 \u0430\u043B\u043B\u043E\u043A\u0430\u0446\u0438\u0438, \u043A\u0435\u0448\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0438 \u0431\u043B\u043E\u043A\u0438\u0440\u0443\u044E\u0449\u0438\u0435 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438", en: "complexity, N+1, extra allocations, caching and blocking operations" }
|
|
327
|
+
},
|
|
328
|
+
compatibility: {
|
|
329
|
+
criteria: ["6", "7"],
|
|
330
|
+
title: { ru: "\u0421\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C", en: "Compatibility" },
|
|
331
|
+
focus: { ru: "\u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 API, \u043E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C, \u043C\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043A\u043E\u043D\u0444\u0438\u0433\u043E\u0432", en: "public API, backward compatibility, migrations and config changes" }
|
|
332
|
+
},
|
|
333
|
+
docs: {
|
|
334
|
+
criteria: ["9"],
|
|
335
|
+
title: { ru: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F", en: "Documentation" },
|
|
336
|
+
focus: { ru: "\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0446\u0438\u044F, \u043A\u043E\u043D\u0444\u0438\u0433\u0438, CHANGELOG \u0438 \u0441\u043E\u0433\u043B\u0430\u0441\u043E\u0432\u0430\u043D\u043D\u043E\u0441\u0442\u044C AI-\u0438\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0439", en: "documentation, configs, CHANGELOG and consistency of AI instructions" }
|
|
337
|
+
},
|
|
338
|
+
concurrency: {
|
|
339
|
+
criteria: ["10"],
|
|
340
|
+
title: { ru: "\u041A\u043E\u043D\u043A\u0443\u0440\u0435\u043D\u0442\u043D\u043E\u0441\u0442\u044C", en: "Concurrency" },
|
|
341
|
+
focus: { ru: "\u0433\u043E\u043D\u043A\u0438, \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438, \u0438\u0434\u0435\u043C\u043F\u043E\u0442\u0435\u043D\u0442\u043D\u043E\u0441\u0442\u044C, retries \u0438 \u043E\u0442\u043C\u0435\u043D\u0430 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0439", en: "races, locks, idempotency, retries and cancellation" }
|
|
342
|
+
},
|
|
343
|
+
ux: {
|
|
344
|
+
criteria: ["9", "10"],
|
|
345
|
+
title: { ru: "UX \u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C", en: "UX and accessibility" },
|
|
346
|
+
focus: { ru: "\u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u044F UI, \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C, \u043E\u0448\u0438\u0431\u043A\u0438 \u0438 \u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435 \u043D\u0430 \u0443\u0437\u043A\u0438\u0445 \u044D\u043A\u0440\u0430\u043D\u0430\u0445", en: "UI states, accessibility, errors and narrow-screen behavior" }
|
|
347
|
+
},
|
|
348
|
+
data: {
|
|
349
|
+
criteria: ["3", "10"],
|
|
350
|
+
title: { ru: "\u0414\u0430\u043D\u043D\u044B\u0435 \u0438 \u043C\u0438\u0433\u0440\u0430\u0446\u0438\u0438", en: "Data and migrations" },
|
|
351
|
+
focus: { ru: "\u0441\u0445\u0435\u043C\u044B, \u043C\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435, \u043E\u0431\u0440\u0430\u0442\u043D\u0430\u044F \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0445", en: "schemas, migrations, storage and data backward compatibility" }
|
|
352
|
+
},
|
|
353
|
+
api: {
|
|
354
|
+
criteria: ["6", "7"],
|
|
355
|
+
title: { ru: "\u041F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 API", en: "Public API" },
|
|
356
|
+
focus: { ru: "\u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u044B, \u0432\u0435\u0440\u0441\u0438\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 API, \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043E\u0448\u0438\u0431\u043E\u043A \u0438 \u0441\u043E\u0432\u043C\u0435\u0441\u0442\u0438\u043C\u043E\u0441\u0442\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u0432", en: "contracts, API versioning, error handling and client compatibility" }
|
|
357
|
+
},
|
|
358
|
+
dependencies: {
|
|
359
|
+
criteria: ["3", "10"],
|
|
360
|
+
title: { ru: "\u0417\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438", en: "Dependencies" },
|
|
361
|
+
focus: { ru: "\u0432\u0435\u0440\u0441\u0438\u0438, \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438, supply chain \u0438 \u043B\u0438\u0448\u043D\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0441\u0442\u0438", en: "versions, licenses, supply chain and unnecessary dependencies" }
|
|
362
|
+
},
|
|
363
|
+
observability: {
|
|
364
|
+
criteria: ["9", "10"],
|
|
365
|
+
title: { ru: "\u041D\u0430\u0431\u043B\u044E\u0434\u0430\u0435\u043C\u043E\u0441\u0442\u044C", en: "Observability" },
|
|
366
|
+
focus: { ru: "\u043B\u043E\u0433\u0438, \u043C\u0435\u0442\u0440\u0438\u043A\u0438, \u0442\u0440\u0435\u0439\u0441\u044B, \u043E\u0448\u0438\u0431\u043A\u0438 \u0438 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0434\u0438\u0430\u0433\u043D\u043E\u0441\u0442\u0438\u043A\u0438", en: "logs, metrics, traces, errors and missing diagnostics" }
|
|
367
|
+
},
|
|
368
|
+
build: {
|
|
369
|
+
criteria: ["8", "9"],
|
|
370
|
+
title: { ru: "\u0421\u0431\u043E\u0440\u043A\u0430 \u0438 CI", en: "Build and CI" },
|
|
371
|
+
focus: { ru: "CI, \u0441\u0431\u043E\u0440\u043A\u0430, \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0430, \u043A\u0435\u0448\u0438 \u0438 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u043C\u043E\u0441\u0442\u044C", en: "CI, builds, packaging, caches and reproducibility" }
|
|
372
|
+
},
|
|
373
|
+
privacy: {
|
|
374
|
+
criteria: ["9", "10"],
|
|
375
|
+
title: { ru: "\u041F\u0440\u0438\u0432\u0430\u0442\u043D\u043E\u0441\u0442\u044C", en: "Privacy" },
|
|
376
|
+
focus: { ru: "PII, \u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445, \u043B\u043E\u0433\u0438 \u0438 \u0443\u0442\u0435\u0447\u043A\u0438", en: "PII, personal data storage, logs and leaks" }
|
|
377
|
+
},
|
|
378
|
+
general: {
|
|
379
|
+
criteria: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
|
380
|
+
title: { ru: "\u041E\u0431\u0449\u0435\u0435 \u0440\u0435\u0432\u044C\u044E", en: "General review" },
|
|
381
|
+
focus: { ru: "\u043F\u043E\u043B\u043D\u043E\u0435 \u0440\u0435\u0432\u044C\u044E \u043F\u043E \u0432\u0441\u0435\u043C \u0440\u0430\u0437\u0434\u0435\u043B\u0430\u043C Criteria.md", en: "full review across all Criteria.md sections" }
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
function effectiveRoleIds(agents, roles) {
|
|
385
|
+
const base = roles.length ? roles : DEFAULT_REVIEW_ROLES;
|
|
386
|
+
return Array.from({ length: agents }, (_, index) => base[index % base.length]);
|
|
387
|
+
}
|
|
388
|
+
function resolveReviewRole(id, language, custom = {}) {
|
|
389
|
+
if (id in REVIEW_ROLES) {
|
|
390
|
+
const role2 = REVIEW_ROLES[id];
|
|
391
|
+
return {
|
|
392
|
+
id,
|
|
393
|
+
title: role2.title[language],
|
|
394
|
+
description: role2.focus[language],
|
|
395
|
+
criteria: role2.criteria,
|
|
396
|
+
instructions: ""
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
const role = custom[id];
|
|
400
|
+
if (!role) return null;
|
|
401
|
+
return {
|
|
402
|
+
id,
|
|
403
|
+
title: role.title,
|
|
404
|
+
description: role.description,
|
|
405
|
+
criteria: role.criteria,
|
|
406
|
+
instructions: role.instructions ?? ""
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function roleCriteriaText(role) {
|
|
410
|
+
return role.criteria.length ? `\xA7${role.criteria.join(", \xA7")}` : "";
|
|
411
|
+
}
|
|
412
|
+
|
|
300
413
|
// src/context.ts
|
|
301
414
|
function renderContext(review, rules, options = {}) {
|
|
302
415
|
const maxBytes = options.maxBytes ?? 2e5;
|
|
303
416
|
const limit = maxBytes > 0 ? maxBytes : Number.POSITIVE_INFINITY;
|
|
304
417
|
const language = options.language ?? rules.language ?? "en";
|
|
305
418
|
const t = (ru, en) => language === "ru" ? ru : en;
|
|
419
|
+
const agents = Math.max(1, options.agents ?? rules.agents ?? 1);
|
|
420
|
+
const planRoles = options.roles ?? rules.roles ?? effectiveRoleIds(agents, DEFAULT_REVIEW_ROLES);
|
|
421
|
+
const roles = Array.isArray(planRoles) && planRoles.length && typeof planRoles[0] === "object" ? planRoles : effectiveRoleIds(agents, planRoles).map((id) => resolveReviewRole(id, language)).filter((role) => Boolean(role));
|
|
422
|
+
const selectedRole = options.role ? roles.find((role) => role.id === options.role) : void 0;
|
|
423
|
+
if (options.role && !selectedRole) throw new Error(`unknown review role: ${options.role}`);
|
|
424
|
+
const shardCount = options.shard?.count ?? 1;
|
|
425
|
+
const shardIndex = options.shard?.index ?? 1;
|
|
426
|
+
const visibleFiles = shardCount > 1 ? review.files.filter((_, index) => index % shardCount === shardIndex - 1) : review.files;
|
|
427
|
+
const visiblePaths = new Set(visibleFiles.map((file) => file.path));
|
|
428
|
+
const visibleThreads = shardCount > 1 ? review.threads.filter((thread) => !thread.path || visiblePaths.has(thread.path)) : review.threads;
|
|
429
|
+
const visibleNotes = shardCount > 1 ? review.notes.filter((note) => visiblePaths.has(note.file)) : review.notes;
|
|
306
430
|
const lines = [];
|
|
307
431
|
const push = (line = "") => {
|
|
308
432
|
lines.push(line);
|
|
@@ -326,6 +450,34 @@ function renderContext(review, rules, options = {}) {
|
|
|
326
450
|
push("**\u042F\u0437\u044B\u043A \u0432\u044B\u0432\u043E\u0434\u0430:** \u043F\u0438\u0448\u0438 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F, \u043E\u0442\u0432\u0435\u0442\u044B \u0438 \u0432\u044B\u0436\u0438\u043C\u043A\u0443 \u043F\u043E-\u0440\u0443\u0441\u0441\u043A\u0438. \u041F\u0440\u0430\u0432\u0438\u043B\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u043D\u0430 \u0434\u0440\u0443\u0433\u043E\u043C \u044F\u0437\u044B\u043A\u0435 \u2014 \u0446\u0438\u0442\u0438\u0440\u0443\u0439 \u0438\u0445 \u043A\u0430\u043A \u0435\u0441\u0442\u044C.");
|
|
327
451
|
}
|
|
328
452
|
push("");
|
|
453
|
+
if (agents > 1 || options.role || shardCount > 1) {
|
|
454
|
+
push(`## ${t("\u041C\u043D\u043E\u0433\u043E\u0430\u0433\u0435\u043D\u0442\u043D\u043E\u0435 \u0440\u0435\u0432\u044C\u044E", "Multi-agent review")}`);
|
|
455
|
+
push(`${t("\u0410\u0433\u0435\u043D\u0442\u043E\u0432", "Agents")}: ${agents}`);
|
|
456
|
+
push(`${t("\u0420\u043E\u043B\u0438", "Roles")}: ${roles.map((role) => role.title).join(", ")}`);
|
|
457
|
+
if (selectedRole) {
|
|
458
|
+
push(`### ${t("\u0420\u043E\u043B\u044C", "Role")}: ${selectedRole.title}`);
|
|
459
|
+
if (selectedRole.criteria.length) push(`${t("\u041A\u0440\u0438\u0442\u0435\u0440\u0438\u0438", "Criteria")}: Criteria.md ${roleCriteriaText(selectedRole)}`);
|
|
460
|
+
push(`${t("\u0424\u043E\u043A\u0443\u0441", "Focus")}: ${selectedRole.description}`);
|
|
461
|
+
if (selectedRole.instructions) push(`${t("\u0418\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u0438", "Instructions")}: ${selectedRole.instructions}`);
|
|
462
|
+
}
|
|
463
|
+
if (shardCount > 1) {
|
|
464
|
+
push(`### ${t("\u0428\u0430\u0440\u0434", "Shard")}: ${shardIndex}/${shardCount}`);
|
|
465
|
+
push(t("\u0424\u0430\u0439\u043B\u044B \u044D\u0442\u043E\u0433\u043E \u0448\u0430\u0440\u0434\u0430:", "Files in this shard:"));
|
|
466
|
+
for (const file of visibleFiles) push(`- ${file.path}`);
|
|
467
|
+
}
|
|
468
|
+
if (options.role || shardCount > 1) {
|
|
469
|
+
push(t(
|
|
470
|
+
"\u042D\u0442\u043E \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u044B\u0439 \u0448\u0430\u0440\u0434-\u0440\u0435\u0432\u044C\u044E\u0435\u0440. \u041D\u0435 \u0432\u044B\u0437\u044B\u0432\u0430\u0439 revdeck_draft_findings, revdeck_set_summary, revdeck_draft_reply: \u0432\u0435\u0440\u043D\u0438 \u043B\u0438\u0434-\u0430\u0433\u0435\u043D\u0442\u0443 JSON \u0441 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F\u043C\u0438 \u0438 \u043A\u043E\u0440\u043E\u0442\u043A\u043E\u0439 \u0432\u044B\u0436\u0438\u043C\u043A\u043E\u0439.",
|
|
471
|
+
"This is an independent shard reviewer. Do not call revdeck_draft_findings, revdeck_set_summary or revdeck_draft_reply: return JSON with findings and a short summary to the lead agent."
|
|
472
|
+
));
|
|
473
|
+
} else {
|
|
474
|
+
push(t(
|
|
475
|
+
"\u0422\u044B \u043B\u0438\u0434-\u0430\u0433\u0435\u043D\u0442: \u0437\u0430\u043F\u0443\u0441\u0442\u0438 \u043F\u043E \u043E\u0434\u043D\u043E\u043C\u0443 \u0441\u0443\u0431\u0430\u0433\u0435\u043D\u0442\u0443 \u043D\u0430 \u0440\u043E\u043B\u044C \u0438 \u0448\u0430\u0440\u0434, \u043F\u0435\u0440\u0435\u0434\u0430\u0439 \u043A\u0430\u0436\u0434\u043E\u043C\u0443 `revdeck_context --role <role> --shard i/N`, \u0441\u043E\u0431\u0435\u0440\u0438 JSON, \u0443\u0431\u0435\u0440\u0438 \u0434\u0443\u0431\u043B\u0438 \u043F\u043E file:line:title \u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E\u0442\u043E\u043C \u0437\u0430\u043F\u0438\u0448\u0438 \u0438\u0442\u043E\u0433\u043E\u0432\u044B\u0435 findings \u0438 summary.",
|
|
476
|
+
"You are the lead agent: spawn one subagent per role and shard, give each `revdeck_context --role <role> --shard i/N`, collect JSON, deduplicate by file:line:title, and only then write the final findings and summary."
|
|
477
|
+
));
|
|
478
|
+
}
|
|
479
|
+
push("");
|
|
480
|
+
}
|
|
329
481
|
if (review.summary) {
|
|
330
482
|
push(`## ${t("\u0412\u044B\u0436\u0438\u043C\u043A\u0430", "Summary")}`);
|
|
331
483
|
if (review.summary.title) push(`**${review.summary.title}**`);
|
|
@@ -341,16 +493,23 @@ function renderContext(review, rules, options = {}) {
|
|
|
341
493
|
}
|
|
342
494
|
push("");
|
|
343
495
|
}
|
|
344
|
-
push(`## ${t("\u0424\u0430\u0439\u043B\u044B", "Files")} (${review.files.length})`);
|
|
345
|
-
for (const file of
|
|
496
|
+
push(`## ${t("\u0424\u0430\u0439\u043B\u044B", "Files")} (${visibleFiles.length}${shardCount > 1 ? ` / ${review.files.length}` : ""})`);
|
|
497
|
+
for (const file of visibleFiles) {
|
|
346
498
|
push(`- ${file.path} (${file.status}, +${file.additions} \u2212${file.deletions})${file.binary ? " [binary]" : ""}`);
|
|
347
499
|
}
|
|
348
500
|
push("");
|
|
501
|
+
if (review.groups?.length) {
|
|
502
|
+
push(`## ${t("\u0413\u0440\u0443\u043F\u043F\u044B \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439", "Change groups")}`);
|
|
503
|
+
for (const group of review.groups) {
|
|
504
|
+
push(`- ${group.title}: ${group.files.length} ${t("\u0444\u0430\u0439\u043B(\u043E\u0432)", "file(s)")}, +${group.additions} \u2212${group.deletions}`);
|
|
505
|
+
}
|
|
506
|
+
push("");
|
|
507
|
+
}
|
|
349
508
|
push(rules.markdown.trim());
|
|
350
509
|
push("");
|
|
351
|
-
const openThreads =
|
|
352
|
-
push(`## ${t("\u041E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u044F", "Discussions")} (${review.threads.length}, ${t("\u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0445", "open")} ${openThreads.length})`);
|
|
353
|
-
for (const thread of
|
|
510
|
+
const openThreads = visibleThreads.filter((thread) => !thread.resolved);
|
|
511
|
+
push(`## ${t("\u041E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u044F", "Discussions")} (${visibleThreads.length}${shardCount > 1 ? ` / ${review.threads.length}` : ""}, ${t("\u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0445", "open")} ${openThreads.length})`);
|
|
512
|
+
for (const thread of visibleThreads) {
|
|
354
513
|
const place = thread.path ? `${thread.path}:${thread.line ?? "?"}` : t("\u043E\u0431\u0449\u0438\u0439", "general");
|
|
355
514
|
push(`### ${place} \xB7 ${thread.resolved ? t("\u0437\u0430\u043A\u0440\u044B\u0442", "resolved") : t("\u043E\u0442\u043A\u0440\u044B\u0442", "open")} \xB7 \`${thread.id}\``);
|
|
356
515
|
if (thread.snippet) {
|
|
@@ -378,9 +537,9 @@ function renderContext(review, rules, options = {}) {
|
|
|
378
537
|
if (finding.agentNote) push(` \u2192 ${t("\u0430\u0433\u0435\u043D\u0442\u0443", "to agent")}: ${truncate(finding.agentNote, 500)}`);
|
|
379
538
|
}
|
|
380
539
|
push("");
|
|
381
|
-
if (
|
|
382
|
-
push(`## ${t("\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u043A \u0441\u0442\u0440\u043E\u043A\u0430\u043C", "Line comments from the human")} (${
|
|
383
|
-
for (const note of
|
|
540
|
+
if (visibleNotes.length) {
|
|
541
|
+
push(`## ${t("\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u043A \u0441\u0442\u0440\u043E\u043A\u0430\u043C", "Line comments from the human")} (${visibleNotes.length})`);
|
|
542
|
+
for (const note of visibleNotes) {
|
|
384
543
|
push(`- \`${note.id}\` \xB7 ${note.file}:${note.line} \xB7 ${note.toAgent ? t("\u0430\u0433\u0435\u043D\u0442\u0443", "to agent") : t("\u0441\u0435\u0431\u0435", "private")}${note.agentAction ? ` \xB7 ${note.agentAction}` : ""}`);
|
|
385
544
|
push(` ${truncate(note.text, 500)}`);
|
|
386
545
|
if (note.agentReply) push(` \u2192 ${truncate(note.agentReply, 500)}`);
|
|
@@ -441,7 +600,11 @@ function contextPayload(review, rules) {
|
|
|
441
600
|
syncedAt: review.syncedAt
|
|
442
601
|
},
|
|
443
602
|
rules,
|
|
444
|
-
language: rules.language
|
|
603
|
+
language: rules.language,
|
|
604
|
+
multiAgent: {
|
|
605
|
+
agents: rules.agents ?? 1,
|
|
606
|
+
roles: rules.roles ?? DEFAULT_REVIEW_ROLES.map((id) => resolveReviewRole(id, rules.language)).filter(Boolean)
|
|
607
|
+
}
|
|
445
608
|
};
|
|
446
609
|
}
|
|
447
610
|
|
|
@@ -537,9 +700,9 @@ server.registerTool(
|
|
|
537
700
|
"revdeck_open",
|
|
538
701
|
{
|
|
539
702
|
title: "Open review",
|
|
540
|
-
description: "Load
|
|
703
|
+
description: "Load one or more MR/PR by number or URL: description, diff, threads. Returns the id used by other tools.",
|
|
541
704
|
inputSchema: {
|
|
542
|
-
input: z.string().min(1).describe("Number, URL, project!N
|
|
705
|
+
input: z.union([z.string().min(1), z.array(z.string().min(1)).min(1).max(8)]).describe("Number, URL, project!N, owner/repo#N, or an array of them"),
|
|
543
706
|
root: rootSchema,
|
|
544
707
|
platform: z.enum(["gitlab", "github"]).optional(),
|
|
545
708
|
project: z.string().optional(),
|
|
@@ -549,17 +712,23 @@ server.registerTool(
|
|
|
549
712
|
},
|
|
550
713
|
async ({ input, root, platform, project, host, branch }) => {
|
|
551
714
|
try {
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
715
|
+
const inputs = Array.isArray(input) ? input : [input];
|
|
716
|
+
const reviews = [];
|
|
717
|
+
for (const value of inputs) {
|
|
718
|
+
const result = await call("reviews.open", {
|
|
719
|
+
root: root ?? defaultRoot,
|
|
720
|
+
input: value,
|
|
721
|
+
...platform ? { platform } : {},
|
|
722
|
+
...project ? { project } : {},
|
|
723
|
+
...host ? { host } : {},
|
|
724
|
+
...branch ? { branch } : {}
|
|
725
|
+
});
|
|
726
|
+
reviews.push(result.review);
|
|
727
|
+
}
|
|
728
|
+
const text = reviews.map((review) => `${summarize(review)}
|
|
729
|
+
Next: revdeck_context(review="${review.id}").`).join("\n\n");
|
|
730
|
+
if (reviews.length === 1) return ok(text, { reviewId: reviews[0].id });
|
|
731
|
+
return ok(text, { reviewIds: reviews.map((review) => review.id) });
|
|
563
732
|
} catch (error) {
|
|
564
733
|
return failure(error);
|
|
565
734
|
}
|
|
@@ -575,14 +744,28 @@ server.registerTool(
|
|
|
575
744
|
refresh: z.boolean().optional().describe("Fetch fresh diff and threads from the platform"),
|
|
576
745
|
file: z.string().optional().describe("Append the diff of one file"),
|
|
577
746
|
max_bytes: z.number().int().positive().max(5e5).optional(),
|
|
747
|
+
role: z.string().max(64).optional().describe("Role for an independent shard reviewer"),
|
|
748
|
+
shard: z.string().regex(/^\d+\/\d+$/).optional().describe("Shard as i/N, for example 1/3"),
|
|
578
749
|
root: rootSchema
|
|
579
750
|
}
|
|
580
751
|
},
|
|
581
|
-
async ({ review, refresh, file, max_bytes }) => {
|
|
752
|
+
async ({ review, refresh, file, max_bytes, role, shard }) => {
|
|
582
753
|
try {
|
|
583
754
|
const { review: view } = await call("reviews.get", { review, refresh: refresh === true });
|
|
584
755
|
const { rules } = await call("rules.get", { review });
|
|
585
|
-
|
|
756
|
+
const parsedShard = shard ? (() => {
|
|
757
|
+
const [index, count] = shard.split("/").map(Number);
|
|
758
|
+
if (!Number.isInteger(index) || !Number.isInteger(count) || index < 1 || count < 1 || index > count) {
|
|
759
|
+
throw new Error("shard must be i/N with 1 <= i <= N");
|
|
760
|
+
}
|
|
761
|
+
return { index, count };
|
|
762
|
+
})() : void 0;
|
|
763
|
+
let text = renderContext(view, rules, {
|
|
764
|
+
maxBytes: max_bytes ?? rules.maxBytes ?? 2e5,
|
|
765
|
+
language: rules.language,
|
|
766
|
+
...role ? { role } : {},
|
|
767
|
+
...parsedShard ? { shard: parsedShard } : {}
|
|
768
|
+
});
|
|
586
769
|
if (file) {
|
|
587
770
|
const { file: diff } = await call("diff.get", {
|
|
588
771
|
review,
|