revdeck 0.18.0 → 0.19.1
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 +52 -0
- package/README.md +25 -6
- package/README.ru.md +27 -5
- package/dist/cli.js +488 -39
- package/dist/cli.js.map +4 -4
- package/dist/daemon.js +581 -101
- package/dist/daemon.js.map +4 -4
- package/dist/mcp.js +277 -19
- package/dist/mcp.js.map +4 -4
- package/dist/ui/assets/index-BPQZSbvp.js +21 -0
- package/dist/ui/index.html +1 -1
- package/docs/architecture.md +8 -0
- package/docs/capabilities.md +13 -6
- package/docs/configuration.md +26 -1
- package/docs/integrations.md +1 -0
- package/docs/protocol.md +7 -4
- package/docs/ru/architecture.md +9 -0
- package/docs/ru/capabilities.md +13 -4
- package/docs/ru/configuration.md +25 -1
- package/docs/ru/integrations.md +1 -0
- package/docs/ru/protocol.md +7 -4
- package/docs/ru/threat-model.md +3 -0
- package/docs/threat-model.md +3 -0
- package/package.json +1 -1
- package/skills/revdeck/en/Feedback.md +3 -1
- package/skills/revdeck/en/Review.md +6 -1
- package/skills/revdeck/en/SKILL.md +12 -1
- package/skills/revdeck/ru/Feedback.md +3 -1
- package/skills/revdeck/ru/Review.md +5 -1
- package/skills/revdeck/ru/SKILL.md +11 -1
- package/dist/ui/assets/index-D3hJTLAL.js +0 -21
package/dist/cli.js
CHANGED
|
@@ -298,7 +298,7 @@ function resolveReviewRole(id, language, custom = {}) {
|
|
|
298
298
|
title: role2.title[language],
|
|
299
299
|
description: role2.focus[language],
|
|
300
300
|
criteria: role2.criteria,
|
|
301
|
-
instructions: ""
|
|
301
|
+
instructions: role2.instructions?.[language] ?? ""
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
304
|
const role = custom[id];
|
|
@@ -334,7 +334,8 @@ var init_review_roles = __esm({
|
|
|
334
334
|
"observability",
|
|
335
335
|
"build",
|
|
336
336
|
"privacy",
|
|
337
|
-
"general"
|
|
337
|
+
"general",
|
|
338
|
+
"verifier"
|
|
338
339
|
];
|
|
339
340
|
DEFAULT_REVIEW_ROLES = ["correctness", "architecture", "tests"];
|
|
340
341
|
REVIEW_ROLES = {
|
|
@@ -413,6 +414,18 @@ var init_review_roles = __esm({
|
|
|
413
414
|
title: { ru: "\u041F\u0440\u0438\u0432\u0430\u0442\u043D\u043E\u0441\u0442\u044C", en: "Privacy" },
|
|
414
415
|
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" }
|
|
415
416
|
},
|
|
417
|
+
verifier: {
|
|
418
|
+
criteria: ["7", "12"],
|
|
419
|
+
title: { ru: "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440", en: "Verifier" },
|
|
420
|
+
focus: {
|
|
421
|
+
ru: "\u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0438\u043B\u0438 \u043E\u043F\u0440\u043E\u0432\u0435\u0440\u0433\u043D\u0443\u0442\u044C \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u043A\u0430\u043D\u0434\u0438\u0434\u0430\u0442\u0430 \u043F\u043E \u0441\u0442\u0440\u043E\u043A\u0435 \u0438 \u043F\u0440\u0430\u0432\u0438\u043B\u0443",
|
|
422
|
+
en: "confirm or refute every candidate against the line and the rule"
|
|
423
|
+
},
|
|
424
|
+
instructions: {
|
|
425
|
+
ru: "\u0422\u044B \u043D\u0435 \u0438\u0449\u0435\u0448\u044C \u043D\u043E\u0432\u044B\u0435 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F. \u041D\u0430 \u0432\u0445\u043E\u0434 \u0442\u0435\u0431\u0435 \u0434\u0430\u044E\u0442 JSON \u043A\u0430\u043D\u0434\u0438\u0434\u0430\u0442\u043E\u0432 \u043E\u0442 \u043B\u0438\u0434-\u0430\u0433\u0435\u043D\u0442\u0430. \u0414\u043B\u044F \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u0432\u0435\u0440\u043D\u0438 verdict: confirmed | refuted | needs-evidence, \u043E\u0434\u043D\u0443 \u0441\u0442\u0440\u043E\u043A\u0443 \u043F\u0440\u0438\u0447\u0438\u043D\u044B \u0438 \u0446\u0438\u0442\u0430\u0442\u0443 \u2014 \u0441\u0442\u0440\u043E\u043A\u0443 \u0438\u0437 \u0444\u0430\u0439\u043B\u0430 \u0438\u043B\u0438 \u0440\u0430\u0437\u0434\u0435\u043B \u043F\u0440\u0430\u0432\u0438\u043B\u0430. refuted \u0441\u0442\u0430\u0432\u044C, \u0435\u0441\u043B\u0438 \u0441\u0442\u0440\u043E\u043A\u0438 \u043D\u0435\u0442, \u0441\u0446\u0435\u043D\u0430\u0440\u0438\u0439 \u043D\u0435 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0441\u044F, \u043F\u0440\u0430\u0432\u0438\u043B\u043E \u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u043E \u0438\u043B\u0438 \u0443\u0440\u043E\u0432\u0435\u043D\u044C \u0437\u0430\u0432\u044B\u0448\u0435\u043D. \u041D\u043E\u0432\u044B\u0435 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0439; \u0441\u043E\u043C\u043D\u0435\u043D\u0438\u0435 \u043E\u0444\u043E\u0440\u043C\u043B\u044F\u0439 \u043A\u0430\u043A needs-evidence.",
|
|
426
|
+
en: "You do not search for new findings. The lead agent gives you a JSON array of candidates. For each one return a verdict: confirmed | refuted | needs-evidence, a one-line reason, and a citation \u2014 the file line or the rule section. Use refuted when the line does not exist, the scenario does not reproduce, the rule does not apply, or the level is inflated. Do not add new findings; record doubt as needs-evidence."
|
|
427
|
+
}
|
|
428
|
+
},
|
|
416
429
|
general: {
|
|
417
430
|
criteria: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
|
418
431
|
title: { ru: "\u041E\u0431\u0449\u0435\u0435 \u0440\u0435\u0432\u044C\u044E", en: "General review" },
|
|
@@ -513,11 +526,23 @@ var init_exec = __esm({
|
|
|
513
526
|
shell: false
|
|
514
527
|
},
|
|
515
528
|
(error, stdout, stderr) => {
|
|
516
|
-
const
|
|
517
|
-
const
|
|
529
|
+
const rawCode = error?.code;
|
|
530
|
+
const signal = error?.signal;
|
|
531
|
+
const spawnFailure = Boolean(error) && typeof rawCode !== "number";
|
|
532
|
+
const code = typeof rawCode === "number" ? rawCode : error ? 1 : 0;
|
|
518
533
|
if (error && !(options.allowExitCodes ?? []).includes(code)) {
|
|
519
534
|
const reason = (stderr || stdout || error.message).trim();
|
|
520
|
-
reject(
|
|
535
|
+
reject(
|
|
536
|
+
Object.assign(new Error(reason.slice(0, 4e3)), {
|
|
537
|
+
command,
|
|
538
|
+
code,
|
|
539
|
+
rawCode,
|
|
540
|
+
signal,
|
|
541
|
+
spawnFailure,
|
|
542
|
+
stderr,
|
|
543
|
+
stdout
|
|
544
|
+
})
|
|
545
|
+
);
|
|
521
546
|
return;
|
|
522
547
|
}
|
|
523
548
|
resolve({ stdout, stderr, code });
|
|
@@ -777,12 +802,15 @@ var init_config = __esm({
|
|
|
777
802
|
});
|
|
778
803
|
|
|
779
804
|
// src/core/redact.ts
|
|
780
|
-
function
|
|
805
|
+
function sanitize(value) {
|
|
781
806
|
let text = String(value ?? "").replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/g, " ");
|
|
782
807
|
for (const [pattern, replacement] of TOKEN_PATTERNS) {
|
|
783
808
|
text = text.replace(pattern, replacement);
|
|
784
809
|
}
|
|
785
|
-
return text
|
|
810
|
+
return text;
|
|
811
|
+
}
|
|
812
|
+
function redact(value) {
|
|
813
|
+
return sanitize(value).slice(0, 4e3);
|
|
786
814
|
}
|
|
787
815
|
function redactLine(value, max = 300) {
|
|
788
816
|
return redact(value).replace(/\s+/g, " ").trim().slice(0, max);
|
|
@@ -806,12 +834,26 @@ var init_redact = __esm({
|
|
|
806
834
|
}
|
|
807
835
|
});
|
|
808
836
|
|
|
837
|
+
// src/core/clip.ts
|
|
838
|
+
function headTailLines(text, limit = 12) {
|
|
839
|
+
const lines = String(text ?? "").split("\n");
|
|
840
|
+
if (lines.length <= limit) return lines;
|
|
841
|
+
const head = Math.max(1, Math.ceil(limit / 3));
|
|
842
|
+
const tail = Math.max(1, limit - head - 1);
|
|
843
|
+
return [...lines.slice(0, head), "\u2026", ...lines.slice(-tail)];
|
|
844
|
+
}
|
|
845
|
+
var init_clip = __esm({
|
|
846
|
+
"src/core/clip.ts"() {
|
|
847
|
+
"use strict";
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
|
|
809
851
|
// src/version.ts
|
|
810
852
|
var VERSION;
|
|
811
853
|
var init_version = __esm({
|
|
812
854
|
"src/version.ts"() {
|
|
813
855
|
"use strict";
|
|
814
|
-
VERSION = "0.
|
|
856
|
+
VERSION = "0.19.1";
|
|
815
857
|
}
|
|
816
858
|
});
|
|
817
859
|
|
|
@@ -1392,6 +1434,126 @@ var init_format = __esm({
|
|
|
1392
1434
|
}
|
|
1393
1435
|
});
|
|
1394
1436
|
|
|
1437
|
+
// src/core/risk.ts
|
|
1438
|
+
function isSensitivePath(path12) {
|
|
1439
|
+
return SENSITIVE_PATHS.some((item) => item.pattern.test(path12));
|
|
1440
|
+
}
|
|
1441
|
+
var SENSITIVE_PATHS;
|
|
1442
|
+
var init_risk = __esm({
|
|
1443
|
+
"src/core/risk.ts"() {
|
|
1444
|
+
"use strict";
|
|
1445
|
+
SENSITIVE_PATHS = [
|
|
1446
|
+
{ pattern: /(^|\/)(migrations?|database|db|schema)(\/|\.|$)/i, reason: "database-or-migration" },
|
|
1447
|
+
{ pattern: /(^|\/)(auth|security|crypto|permissions?|payments?|billing)(\/|\.|$)/i, reason: "security-sensitive" },
|
|
1448
|
+
{ pattern: /(^|\/)\.github\/workflows\//i, reason: "ci-workflow" },
|
|
1449
|
+
{ pattern: /(^|\/)\.(gitlab-ci|circleci|buildkite)(\/|\.|$)/i, reason: "ci-workflow" },
|
|
1450
|
+
{ pattern: /(^|\/)(Jenkinsfile|azure-pipelines[^/]*|bitbucket-pipelines[^/]*)$/i, reason: "ci-workflow" },
|
|
1451
|
+
{ pattern: /(^|\/)(Dockerfile|docker-compose[^/]*)$/i, reason: "container" },
|
|
1452
|
+
{ pattern: /(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|go\.sum|composer\.lock|Gemfile\.lock|poetry\.lock|uv\.lock)$/i, reason: "dependency-lock" },
|
|
1453
|
+
{ pattern: /(^|\/)(openapi|swagger|proto)(\/|\.|$)/i, reason: "public-contract" }
|
|
1454
|
+
];
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
// src/core/shard.ts
|
|
1459
|
+
function compareKeys(left, right) {
|
|
1460
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
1461
|
+
}
|
|
1462
|
+
function stem(path12) {
|
|
1463
|
+
const base = path12.slice(path12.lastIndexOf("/") + 1);
|
|
1464
|
+
return base.replace(TEST_NAME, "").replace(/\.[^.]*$/, "");
|
|
1465
|
+
}
|
|
1466
|
+
function isTestPath(path12) {
|
|
1467
|
+
return TEST_NAME.test(path12) || TEST_DIR.test(path12.slice(0, path12.lastIndexOf("/") + 1));
|
|
1468
|
+
}
|
|
1469
|
+
function directoryOf(path12) {
|
|
1470
|
+
const index = path12.lastIndexOf("/");
|
|
1471
|
+
return index <= 0 ? "." : path12.slice(0, index);
|
|
1472
|
+
}
|
|
1473
|
+
function cohesionGroups(files) {
|
|
1474
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1475
|
+
const add = (key, file) => {
|
|
1476
|
+
const group = groups.get(key) ?? { key, files: [], size: 0, sensitive: false };
|
|
1477
|
+
group.files.push(file);
|
|
1478
|
+
group.size += file.additions + file.deletions;
|
|
1479
|
+
group.sensitive = group.sensitive || isSensitivePath(file.path);
|
|
1480
|
+
groups.set(key, group);
|
|
1481
|
+
};
|
|
1482
|
+
const sources = files.filter((file) => !isTestPath(file.path));
|
|
1483
|
+
const byStem = /* @__PURE__ */ new Map();
|
|
1484
|
+
for (const file of sources) {
|
|
1485
|
+
const key = directoryOf(file.path);
|
|
1486
|
+
const set = byStem.get(stem(file.path)) ?? /* @__PURE__ */ new Set();
|
|
1487
|
+
set.add(key);
|
|
1488
|
+
byStem.set(stem(file.path), set);
|
|
1489
|
+
}
|
|
1490
|
+
for (const file of files) {
|
|
1491
|
+
if (isTestPath(file.path)) {
|
|
1492
|
+
const candidates = byStem.get(stem(file.path));
|
|
1493
|
+
if (candidates?.size === 1) {
|
|
1494
|
+
add([...candidates][0], file);
|
|
1495
|
+
continue;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
add(directoryOf(file.path), file);
|
|
1499
|
+
}
|
|
1500
|
+
return [...groups.values()];
|
|
1501
|
+
}
|
|
1502
|
+
function splitLargeGroups(groups, target) {
|
|
1503
|
+
const result = [...groups];
|
|
1504
|
+
while (result.length < target) {
|
|
1505
|
+
const candidates = result.filter((group2) => group2.files.length > 1);
|
|
1506
|
+
candidates.sort((left, right) => right.files.length - left.files.length || right.size - left.size || compareKeys(left.key, right.key));
|
|
1507
|
+
const group = candidates[0];
|
|
1508
|
+
if (!group) break;
|
|
1509
|
+
const pieces = group.files.map((file) => ({
|
|
1510
|
+
key: `${group.key}#${file.path}`,
|
|
1511
|
+
files: [file],
|
|
1512
|
+
size: file.additions + file.deletions,
|
|
1513
|
+
sensitive: isSensitivePath(file.path)
|
|
1514
|
+
}));
|
|
1515
|
+
result.splice(result.indexOf(group), 1, ...pieces);
|
|
1516
|
+
}
|
|
1517
|
+
return result;
|
|
1518
|
+
}
|
|
1519
|
+
function partitionShards(files, count) {
|
|
1520
|
+
const requested = Number.isFinite(count) ? Math.trunc(count) : 1;
|
|
1521
|
+
const size = Math.max(1, Math.min(requested, MAX_SHARDS, Math.max(1, files.length)));
|
|
1522
|
+
const buckets = Array.from({ length: size }, () => []);
|
|
1523
|
+
if (buckets.length === 1) return [files];
|
|
1524
|
+
let groups = cohesionGroups(files);
|
|
1525
|
+
if (groups.length < buckets.length) groups = splitLargeGroups(groups, buckets.length);
|
|
1526
|
+
groups.sort(
|
|
1527
|
+
(left, right) => Number(right.sensitive) - Number(left.sensitive) || right.size - left.size || compareKeys(left.key, right.key)
|
|
1528
|
+
);
|
|
1529
|
+
const loads = buckets.map(() => 0);
|
|
1530
|
+
for (const group of groups) {
|
|
1531
|
+
let target = 0;
|
|
1532
|
+
for (let index = 1; index < buckets.length; index++) {
|
|
1533
|
+
if (loads[index] < loads[target]) target = index;
|
|
1534
|
+
}
|
|
1535
|
+
buckets[target].push(...group.files);
|
|
1536
|
+
loads[target] += group.size;
|
|
1537
|
+
}
|
|
1538
|
+
const order = new Map(files.map((file, index) => [file.path, index]));
|
|
1539
|
+
for (const bucket of buckets) bucket.sort((left, right) => order.get(left.path) - order.get(right.path));
|
|
1540
|
+
return buckets;
|
|
1541
|
+
}
|
|
1542
|
+
function shardPaths(files, index, count) {
|
|
1543
|
+
const bucket = partitionShards(files, count)[Math.max(0, Math.trunc(index) - 1)] ?? [];
|
|
1544
|
+
return new Set(bucket.map((file) => file.path));
|
|
1545
|
+
}
|
|
1546
|
+
var MAX_SHARDS, TEST_DIR, TEST_NAME;
|
|
1547
|
+
var init_shard = __esm({
|
|
1548
|
+
"src/core/shard.ts"() {
|
|
1549
|
+
"use strict";
|
|
1550
|
+
init_risk();
|
|
1551
|
+
MAX_SHARDS = 32;
|
|
1552
|
+
TEST_DIR = /(^|\/)(tests?|__tests__|specs?)(\/|$)/i;
|
|
1553
|
+
TEST_NAME = /(\.(test|spec)\.[^./]+|_test\.[^./]+)$/i;
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1395
1557
|
// src/core/scenario.ts
|
|
1396
1558
|
function isReviewScenario(value) {
|
|
1397
1559
|
return typeof value === "string" && REVIEW_SCENARIOS.includes(value);
|
|
@@ -1428,11 +1590,13 @@ function renderContext(review, rules2, options = {}) {
|
|
|
1428
1590
|
const agents = Math.max(1, options.agents ?? rules2.agents ?? 1);
|
|
1429
1591
|
const planRoles = options.roles ?? rules2.roles ?? effectiveRoleIds(agents, DEFAULT_REVIEW_ROLES);
|
|
1430
1592
|
const roles = Array.isArray(planRoles) && planRoles.length && typeof planRoles[0] === "object" ? planRoles : effectiveRoleIds(agents, planRoles).map((id) => resolveReviewRole(id, language)).filter((role) => Boolean(role));
|
|
1431
|
-
const selectedRole = options.role ? roles.find((role) => role.id === options.role) : void 0;
|
|
1593
|
+
const selectedRole = options.role ? roles.find((role) => role.id === options.role) ?? resolveReviewRole(options.role, language) ?? void 0 : void 0;
|
|
1432
1594
|
if (options.role && !selectedRole) throw new Error(`unknown review role: ${options.role}`);
|
|
1433
1595
|
const shardCount = options.shard?.count ?? 1;
|
|
1434
1596
|
const shardIndex = options.shard?.index ?? 1;
|
|
1435
|
-
const
|
|
1597
|
+
const shardSet = shardCount > 1 ? shardPaths(review.files, shardIndex, shardCount) : null;
|
|
1598
|
+
const visibleFiles = shardSet ? review.files.filter((file) => shardSet.has(file.path)) : review.files;
|
|
1599
|
+
const otherFiles = shardSet ? review.files.filter((file) => !shardSet.has(file.path)) : [];
|
|
1436
1600
|
const visiblePaths = new Set(visibleFiles.map((file) => file.path));
|
|
1437
1601
|
const visibleThreads = shardCount > 1 ? review.threads.filter((thread) => !thread.path || visiblePaths.has(thread.path)) : review.threads;
|
|
1438
1602
|
const visibleNotes = shardCount > 1 ? review.notes.filter((note) => visiblePaths.has(note.file)) : review.notes;
|
|
@@ -1570,14 +1734,24 @@ function renderContext(review, rules2, options = {}) {
|
|
|
1570
1734
|
}
|
|
1571
1735
|
if (options.role || shardCount > 1) {
|
|
1572
1736
|
push(t(
|
|
1573
|
-
"\u042D\u0442\u043E \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u044B\u0439 \
|
|
1574
|
-
"This is an independent
|
|
1737
|
+
"\u042D\u0442\u043E \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u044B\u0439 \u0440\u0435\u0432\u044C\u044E\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 diff. \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.",
|
|
1738
|
+
"This is an independent reviewer of one diff part. 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."
|
|
1575
1739
|
));
|
|
1740
|
+
if (shardCount > 1) {
|
|
1741
|
+
push(t(
|
|
1742
|
+
"\u0422\u044B \u0432\u0438\u0434\u0438\u0448\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0444\u0430\u0439\u043B\u044B \u0441\u0432\u043E\u0435\u0433\u043E \u0448\u0430\u0440\u0434\u0430. \u0421\u043F\u0438\u0441\u043E\u043A \u043E\u0441\u0442\u0430\u043B\u044C\u043D\u044B\u0445 \u0444\u0430\u0439\u043B\u043E\u0432 \u043D\u0438\u0436\u0435 \u2014 \u0434\u043B\u044F \u043E\u0440\u0438\u0435\u043D\u0442\u0430\u0446\u0438\u0438: \u0435\u0441\u043B\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u0434\u0435\u0432\u0430\u0435\u0442 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442 \u0432\u043D\u0435 \u0448\u0430\u0440\u0434\u0430 (\u043E\u0431\u0449\u0438\u0439 \u0442\u0438\u043F, \u0432\u044B\u0437\u044B\u0432\u0430\u044E\u0449\u0438\u0439 \u043A\u043E\u0434, \u043A\u043E\u043D\u0444\u0438\u0433), \u0432\u044B\u043D\u0435\u0441\u0438 \u044D\u0442\u043E \u043E\u0442\u0434\u0435\u043B\u044C\u043D\u044B\u043C \u043F\u0443\u043D\u043A\u0442\u043E\u043C \u0432 \u0432\u044B\u0436\u0438\u043C\u043A\u0443 \u0434\u043B\u044F \u043B\u0438\u0434\u0430, \u0430 \u043D\u0435 \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u0435\u043C.",
|
|
1743
|
+
"You only see the files of your shard. The list of other files below is for orientation: if the change touches a contract outside your shard (shared type, caller, config), report it as a separate item for the lead, not as a finding."
|
|
1744
|
+
));
|
|
1745
|
+
}
|
|
1576
1746
|
} else {
|
|
1577
1747
|
push(t(
|
|
1578
1748
|
"\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.",
|
|
1579
1749
|
"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."
|
|
1580
1750
|
));
|
|
1751
|
+
push(t(
|
|
1752
|
+
"\u0415\u0441\u043B\u0438 \u0432\u044B \u0434\u0435\u043B\u0438\u043B\u0438 diff \u043D\u0430 \u0448\u0430\u0440\u0434\u044B: \u043F\u043E\u0441\u043B\u0435 \u0441\u0431\u043E\u0440\u0430 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u043E\u0432 \u0441\u0434\u0435\u043B\u0430\u0439 cross-cut \u043F\u0440\u043E\u0445\u043E\u0434 \u043F\u043E \u043F\u043E\u043B\u043D\u043E\u043C\u0443 \u0441\u043F\u0438\u0441\u043A\u0443 \u0444\u0430\u0439\u043B\u043E\u0432 \u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D\u043D\u044B\u043C \u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u043C \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430\u043C (\u043E\u0431\u0449\u0438\u0439 \u0442\u0438\u043F, \u0432\u044B\u0437\u044B\u0432\u0430\u044E\u0449\u0438\u0439 \u043A\u043E\u0434, \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0444\u0430\u0439\u043B\u044B \u0432 \u0440\u0430\u0437\u043D\u044B\u0445 \u0448\u0430\u0440\u0434\u0430\u0445) \u2014 \u0448\u0432\u043E\u0432 \u043D\u0435 \u0432\u0438\u0434\u0438\u0442 \u043D\u0438 \u043E\u0434\u0438\u043D \u0432\u043E\u0440\u043A\u0435\u0440. \u0412 `coverage` \u0443\u043A\u0430\u0436\u0438 \u043E\u0441\u0438 \u043F\u0440\u043E\u0433\u043E\u043D\u0430: \u0440\u043E\u043B\u0438, \u0447\u0438\u0441\u043B\u043E \u0448\u0430\u0440\u0434\u043E\u0432, \u0435\u0441\u043B\u0438 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u0438\u0441\u044C, \u0438 \u0447\u0442\u043E \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u043E \u043D\u0430 \u0448\u0432\u0430\u0445.",
|
|
1753
|
+
"If you split the diff into shards: after collecting results, do a cross-cut pass over the full file list and the changed public contracts (shared types, callers, related files in different shards) \u2014 no worker sees those seams. Record the run axes in `coverage`: roles, shard count if any, and what the seam check covered."
|
|
1754
|
+
));
|
|
1581
1755
|
}
|
|
1582
1756
|
push("");
|
|
1583
1757
|
}
|
|
@@ -1622,6 +1796,20 @@ function renderContext(review, rules2, options = {}) {
|
|
|
1622
1796
|
for (const file of visibleFiles) {
|
|
1623
1797
|
push(`- ${file.path} (${file.status}, +${file.additions} \u2212${file.deletions})${file.binary ? " [binary]" : ""}`);
|
|
1624
1798
|
}
|
|
1799
|
+
if (shardCount > 1) {
|
|
1800
|
+
if (!visibleFiles.length) {
|
|
1801
|
+
push(t(
|
|
1802
|
+
`> \u0412 \u0448\u0430\u0440\u0434\u0435 ${shardIndex}/${shardCount} \u043D\u0435\u0442 \u0444\u0430\u0439\u043B\u043E\u0432: \u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u0435 \u0447\u0438\u0441\u043B\u043E \u0448\u0430\u0440\u0434\u043E\u0432 \u0438\u043B\u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0448\u0432\u044B \u043A\u0430\u043A \u043B\u0438\u0434.`,
|
|
1803
|
+
`> Shard ${shardIndex}/${shardCount} has no files: reduce the shard count or check the seams as the lead.`
|
|
1804
|
+
));
|
|
1805
|
+
}
|
|
1806
|
+
if (otherFiles.length) {
|
|
1807
|
+
const shown = otherFiles.slice(0, 40).map((file) => `\`${file.path}\``);
|
|
1808
|
+
const rest = otherFiles.length > shown.length ? ` ${t(`\u0438 \u0435\u0449\u0451 ${otherFiles.length - shown.length}`, `and ${otherFiles.length - shown.length} more`)}` : "";
|
|
1809
|
+
push("");
|
|
1810
|
+
push(`${t("\u0412\u043D\u0435 \u044D\u0442\u043E\u0433\u043E \u0448\u0430\u0440\u0434\u0430 (\u0431\u0435\u0437 diff)", "Outside this shard (no diff)")}: ${shown.join(", ")}${rest}`);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1625
1813
|
push("");
|
|
1626
1814
|
if (review.groups?.length) {
|
|
1627
1815
|
push(`## ${t("\u0413\u0440\u0443\u043F\u043F\u044B \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439", "Change groups")}`);
|
|
@@ -1672,11 +1860,47 @@ function renderContext(review, rules2, options = {}) {
|
|
|
1672
1860
|
}
|
|
1673
1861
|
push("");
|
|
1674
1862
|
}
|
|
1675
|
-
|
|
1863
|
+
const checkRuns = rules2.runs ?? [];
|
|
1864
|
+
if (rules2.checks.length || checkRuns.length) {
|
|
1676
1865
|
push(`## ${t("\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438", "Checks")}`);
|
|
1677
1866
|
for (const check of rules2.checks) {
|
|
1678
1867
|
push(`- ${check.id}: \`${check.argv.join(" ")}\`${check.matched ? "" : ` (${t("\u043D\u0435 \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u043A diff", "does not match the diff")})`}${check.consent ? ` \xB7 ${t("\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F", "requires confirmation")}` : ""}`);
|
|
1679
1868
|
}
|
|
1869
|
+
const matchedChecks = rules2.checks.filter((check) => check.matched);
|
|
1870
|
+
if (rules2.checks.length && !matchedChecks.length) {
|
|
1871
|
+
push(t("> \u041D\u0438 \u043E\u0434\u043D\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u043C\u0430 \u043A \u044D\u0442\u043E\u043C\u0443 diff.", "> No check applies to this diff."));
|
|
1872
|
+
}
|
|
1873
|
+
if (!checkRuns.length) {
|
|
1874
|
+
if (matchedChecks.length) {
|
|
1875
|
+
push(t(
|
|
1876
|
+
"> \u0424\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043F\u0440\u043E\u0433\u043E\u043D\u043E\u0432 \u043D\u0435\u0442: \u0442\u0438\u043F\u044B \u0438 \u0442\u0435\u0441\u0442\u044B \u043D\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u044B. `coverage` \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u043E\u043F\u0438\u0440\u0430\u0442\u044C\u0441\u044F \u043D\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438, \u043F\u043E\u043A\u0430 \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442 \u0438\u0445 \u0432 UI \u0438\u043B\u0438 \u0447\u0435\u0440\u0435\u0437 `revdeck checks --run --yes`.",
|
|
1877
|
+
"> No check runs yet: types and tests are not verified. `coverage` cannot rely on checks until a human runs them in the UI or via `revdeck checks --run --yes`."
|
|
1878
|
+
));
|
|
1879
|
+
}
|
|
1880
|
+
} else {
|
|
1881
|
+
const head = review.info.commit.head;
|
|
1882
|
+
push(t("\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u043F\u0440\u043E\u0433\u043E\u043D\u044B:", "Last check runs:"));
|
|
1883
|
+
let hasStale = false;
|
|
1884
|
+
for (const run2 of checkRuns) {
|
|
1885
|
+
const known = head !== "" && run2.commitSha !== "";
|
|
1886
|
+
const current2 = known && run2.commitSha === head;
|
|
1887
|
+
if (known && !current2) hasStale = true;
|
|
1888
|
+
const stamp = !known ? t("\u043A\u043E\u043C\u043C\u0438\u0442 \u043D\u0435 \u0437\u0430\u043F\u0438\u0441\u0430\u043D", "commit not recorded") : current2 ? t("\u0430\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u043C\u043C\u0438\u0442", "current commit") : `${t("\u043A\u043E\u043C\u043C\u0438\u0442", "commit")} ${run2.commitSha.slice(0, 12)} (${t("\u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439", "stale")})`;
|
|
1889
|
+
const exit = run2.exitCode === null || run2.exitCode === void 0 ? "" : ` (exit ${run2.exitCode})`;
|
|
1890
|
+
push(`- ${run2.checkId}: ${run2.status}${exit} \xB7 ${when(run2.startedAt, language)} \xB7 ${stamp} \xB7 ${Math.round(run2.durationMs)}ms`);
|
|
1891
|
+
if (run2.status !== "passed" && run2.output) {
|
|
1892
|
+
push("```");
|
|
1893
|
+
push(headTailLines(run2.output, 12).join("\n"));
|
|
1894
|
+
push("```");
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
if (hasStale) {
|
|
1898
|
+
push(t(
|
|
1899
|
+
"> \u041F\u0440\u043E\u0433\u043E\u043D \u043D\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u043C \u043A\u043E\u043C\u043C\u0438\u0442\u0435 \u043D\u0435 \u0434\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442, \u0447\u0442\u043E \u0442\u0435\u043A\u0443\u0449\u0438\u0439 diff \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D: \u0435\u0433\u043E \u043D\u0443\u0436\u043D\u043E \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C.",
|
|
1900
|
+
"> A run on an older commit does not prove the current diff was checked: repeat it."
|
|
1901
|
+
));
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1680
1904
|
push("");
|
|
1681
1905
|
}
|
|
1682
1906
|
push(`## ${t("\u041A\u0430\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C", "What to do next")}`);
|
|
@@ -1709,18 +1933,24 @@ function renderContext(review, rules2, options = {}) {
|
|
|
1709
1933
|
|
|
1710
1934
|
[${t("\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043E\u0431\u0440\u0435\u0437\u0430\u043D", "context truncated")}: ${text.length} > ${limit} ${t("\u0431\u0430\u0439\u0442", "bytes")}]` : text;
|
|
1711
1935
|
}
|
|
1712
|
-
function contextPayload(review, rules2, scenario) {
|
|
1936
|
+
function contextPayload(review, rules2, scenario, options = {}) {
|
|
1937
|
+
const shard = options.shard && options.shard.count > 1 ? options.shard : null;
|
|
1938
|
+
const shardSet = shard ? shardPaths(review.files, shard.index, shard.count) : null;
|
|
1939
|
+
const files = shardSet ? review.files.filter((file) => shardSet.has(file.path)) : review.files;
|
|
1940
|
+
const visiblePaths = new Set(files.map((file) => file.path));
|
|
1941
|
+
const threads2 = shardSet ? review.threads.filter((thread) => !thread.path || visiblePaths.has(thread.path)) : review.threads;
|
|
1942
|
+
const notes2 = shardSet ? review.notes.filter((note) => visiblePaths.has(note.file)) : review.notes;
|
|
1713
1943
|
return {
|
|
1714
1944
|
review: {
|
|
1715
1945
|
id: review.id,
|
|
1716
1946
|
info: review.info,
|
|
1717
1947
|
stats: review.stats,
|
|
1718
|
-
files
|
|
1948
|
+
files,
|
|
1719
1949
|
summary: review.summary,
|
|
1720
|
-
threads:
|
|
1950
|
+
threads: threads2,
|
|
1721
1951
|
findings: review.findings,
|
|
1722
1952
|
drafts: review.drafts,
|
|
1723
|
-
notes:
|
|
1953
|
+
notes: notes2,
|
|
1724
1954
|
agentMessages: review.agentMessages ?? [],
|
|
1725
1955
|
errors: review.errors,
|
|
1726
1956
|
stale: review.stale,
|
|
@@ -1745,6 +1975,8 @@ var init_context = __esm({
|
|
|
1745
1975
|
"use strict";
|
|
1746
1976
|
init_format();
|
|
1747
1977
|
init_review_roles();
|
|
1978
|
+
init_shard();
|
|
1979
|
+
init_clip();
|
|
1748
1980
|
init_scenario();
|
|
1749
1981
|
}
|
|
1750
1982
|
});
|
|
@@ -2002,6 +2234,7 @@ var init_main = __esm({
|
|
|
2002
2234
|
init_version();
|
|
2003
2235
|
init_locale();
|
|
2004
2236
|
init_scenario();
|
|
2237
|
+
init_clip();
|
|
2005
2238
|
init_scope();
|
|
2006
2239
|
init_refs();
|
|
2007
2240
|
setLocale(detectLocale());
|
|
@@ -2263,7 +2496,6 @@ Next: ${next}.`;
|
|
|
2263
2496
|
try {
|
|
2264
2497
|
await scopedReview(review);
|
|
2265
2498
|
const { review: view } = await call("reviews.get", { review, refresh: refresh === true });
|
|
2266
|
-
const { rules: rules2 } = await call("rules.get", { review });
|
|
2267
2499
|
const parsedShard = shard ? (() => {
|
|
2268
2500
|
const [index, count] = shard.split("/").map(Number);
|
|
2269
2501
|
if (!Number.isInteger(index) || !Number.isInteger(count) || index < 1 || count < 1 || index > count) {
|
|
@@ -2271,6 +2503,10 @@ Next: ${next}.`;
|
|
|
2271
2503
|
}
|
|
2272
2504
|
return { index, count };
|
|
2273
2505
|
})() : void 0;
|
|
2506
|
+
const { rules: rules2 } = await call("rules.get", {
|
|
2507
|
+
review,
|
|
2508
|
+
...parsedShard ? { shard: parsedShard } : {}
|
|
2509
|
+
});
|
|
2274
2510
|
let text = renderContext(view, rules2, {
|
|
2275
2511
|
maxBytes: max_bytes ?? rules2.maxBytes ?? 2e5,
|
|
2276
2512
|
language: rules2.language,
|
|
@@ -2299,7 +2535,7 @@ Next: ${next}.`;
|
|
|
2299
2535
|
text += "```";
|
|
2300
2536
|
}
|
|
2301
2537
|
}
|
|
2302
|
-
return ok(text, contextPayload(view, rules2, scenario));
|
|
2538
|
+
return ok(text, contextPayload(view, rules2, scenario, parsedShard ? { shard: parsedShard } : {}));
|
|
2303
2539
|
} catch (error) {
|
|
2304
2540
|
return failure(error);
|
|
2305
2541
|
}
|
|
@@ -2533,6 +2769,49 @@ Next: ${next}.`;
|
|
|
2533
2769
|
}
|
|
2534
2770
|
}
|
|
2535
2771
|
);
|
|
2772
|
+
server.registerTool(
|
|
2773
|
+
"revdeck_checks",
|
|
2774
|
+
{
|
|
2775
|
+
title: "Checks and last runs",
|
|
2776
|
+
description: "Configured project checks and the last recorded run of each: status, exit code, commit and output tail. Read-only evidence for `coverage`. Running checks stays human-only (`revdeck checks --run --yes` or the UI); this tool cannot run them.",
|
|
2777
|
+
inputSchema: { review: reviewSchema }
|
|
2778
|
+
},
|
|
2779
|
+
async ({ review }) => {
|
|
2780
|
+
try {
|
|
2781
|
+
await scopedReview(review);
|
|
2782
|
+
const { rules: rules2 } = await call("rules.get", { review });
|
|
2783
|
+
const { review: view } = await call("reviews.get", { review });
|
|
2784
|
+
const runs = rules2.runs ?? [];
|
|
2785
|
+
const head = view.info.commit.head;
|
|
2786
|
+
const lines = [];
|
|
2787
|
+
if (rules2.checks.length) {
|
|
2788
|
+
lines.push("Configured checks:");
|
|
2789
|
+
for (const check of rules2.checks) {
|
|
2790
|
+
lines.push(`- ${check.id}: \`${check.argv.join(" ")}\`${check.matched ? "" : " (does not match the diff)"}${check.consent ? " \xB7 requires confirmation" : ""}`);
|
|
2791
|
+
}
|
|
2792
|
+
} else {
|
|
2793
|
+
lines.push("No checks are configured in .revdeck.yml.");
|
|
2794
|
+
}
|
|
2795
|
+
lines.push("");
|
|
2796
|
+
if (!runs.length) {
|
|
2797
|
+
lines.push("No runs recorded: types and tests are not verified. A human must run the checks; then repeat revdeck_context.");
|
|
2798
|
+
} else {
|
|
2799
|
+
lines.push("Last runs:");
|
|
2800
|
+
for (const run2 of runs) {
|
|
2801
|
+
const current2 = head !== "" && run2.commitSha === head;
|
|
2802
|
+
const exit = run2.exitCode === null ? "" : ` (exit ${run2.exitCode})`;
|
|
2803
|
+
lines.push(`- ${run2.checkId}: ${run2.status}${exit} \xB7 ${run2.startedAt} \xB7 ${current2 ? "current commit" : `commit ${run2.commitSha.slice(0, 12) || "?"}`} \xB7 ${Math.round(run2.durationMs)}ms`);
|
|
2804
|
+
if (run2.status !== "passed" && run2.output) {
|
|
2805
|
+
lines.push(...headTailLines(run2.output, 15).map((line) => ` ${line}`));
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
return ok(lines.join("\n"), { checks: rules2.checks, runs });
|
|
2810
|
+
} catch (error) {
|
|
2811
|
+
return failure(error);
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2536
2815
|
server.registerTool(
|
|
2537
2816
|
"revdeck_publish_preview",
|
|
2538
2817
|
{
|
|
@@ -2713,7 +2992,7 @@ ${failed.map((item) => `- ${item.id}: ${item.error}`).join("\n")}` : ""),
|
|
|
2713
2992
|
// src/cli/main.ts
|
|
2714
2993
|
init_paths();
|
|
2715
2994
|
init_config();
|
|
2716
|
-
import { open as open2, readFile as readFile8, stat as stat2 } from "node:fs/promises";
|
|
2995
|
+
import { open as open2, readFile as readFile8, stat as stat2, writeFile as writeFile5 } from "node:fs/promises";
|
|
2717
2996
|
import { readFileSync } from "node:fs";
|
|
2718
2997
|
import { parseArgs } from "node:util";
|
|
2719
2998
|
import path11 from "node:path";
|
|
@@ -2943,6 +3222,121 @@ ${doc.excerpt}${doc.truncated ? `
|
|
|
2943
3222
|
return out.join("\n");
|
|
2944
3223
|
}
|
|
2945
3224
|
|
|
3225
|
+
// src/cli/main.ts
|
|
3226
|
+
init_review_roles();
|
|
3227
|
+
init_clip();
|
|
3228
|
+
|
|
3229
|
+
// src/core/evidence.ts
|
|
3230
|
+
init_locale();
|
|
3231
|
+
var YES = () => tr("\u0434\u0430", "yes");
|
|
3232
|
+
var NO = () => tr("\u043D\u0435\u0442", "no");
|
|
3233
|
+
function list(items) {
|
|
3234
|
+
return items?.length ? items.map((item) => `- ${item}`).join("\n") : "\u2014";
|
|
3235
|
+
}
|
|
3236
|
+
function cell(value) {
|
|
3237
|
+
return value.replace(/\|/g, "\\|");
|
|
3238
|
+
}
|
|
3239
|
+
function renderEvidenceMarkdown(payload) {
|
|
3240
|
+
const { review, summary: summary2, rules: rules2, checks: checks2, findings: findings2, decisions, publish: publish2, timeline } = payload;
|
|
3241
|
+
const lines = [];
|
|
3242
|
+
lines.push(`# ${tr("\u041F\u0430\u0441\u043F\u043E\u0440\u0442 \u0440\u0435\u0432\u044C\u044E", "Review evidence")} ${review.project}#${review.number}: ${review.title}`);
|
|
3243
|
+
lines.push("");
|
|
3244
|
+
lines.push(review.webUrl);
|
|
3245
|
+
lines.push("");
|
|
3246
|
+
lines.push(`- ${tr("\u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0430", "platform")}: \`${review.platform}:${review.host}/${review.project}\``);
|
|
3247
|
+
lines.push(`- ${tr("\u0430\u0432\u0442\u043E\u0440", "author")}: ${review.author} \xB7 ${tr("\u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435", "state")}: ${review.state}`);
|
|
3248
|
+
lines.push(`- ${tr("\u0432\u0435\u0442\u043A\u0438", "branches")}: \`${review.sourceBranch}\` \u2192 \`${review.targetBranch || "?"}\` \xB7 ${tr("\u043C\u0435\u0440\u0436", "merge")}: ${review.mergeState || "?"}`);
|
|
3249
|
+
lines.push(`- ${tr("\u0441\u043D\u0438\u043C\u043E\u043A", "snapshot")}: \`${review.baseSha.slice(0, 12) || "?"}\` \u2192 \`${review.headSha.slice(0, 12) || "?"}\` \xB7 ${review.syncedAt}`);
|
|
3250
|
+
lines.push(`- ${tr("\u0441\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u043D", "generated")}: ${payload.generatedAt} \xB7 revdeck evidence v${payload.version}`);
|
|
3251
|
+
lines.push("");
|
|
3252
|
+
lines.push(`## ${tr("\u0427\u0442\u043E \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u043E", "What was checked")}`);
|
|
3253
|
+
if (!summary2) {
|
|
3254
|
+
lines.push(tr("> \u0412\u044B\u0436\u0438\u043C\u043A\u0430 \u043D\u0435 \u0437\u0430\u043F\u0438\u0441\u0430\u043D\u0430: \u043F\u043E\u043A\u0440\u044B\u0442\u0438\u0435 \u0438 \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442.", "> No summary recorded: coverage and unknowns are missing."));
|
|
3255
|
+
} else {
|
|
3256
|
+
if (summary2.scope) lines.push(`${tr("\u041E\u0431\u043B\u0430\u0441\u0442\u044C", "Scope")}: ${summary2.scope}`);
|
|
3257
|
+
if (summary2.summary) lines.push("", summary2.summary);
|
|
3258
|
+
lines.push("", `${tr("\u041F\u043E\u043A\u0440\u044B\u0442\u0438\u0435", "Coverage")}:`);
|
|
3259
|
+
lines.push(summary2.coverage?.length ? list(summary2.coverage) : tr("\u043D\u0435 \u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E", "not recorded"));
|
|
3260
|
+
lines.push("", `${tr("\u041D\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u043E", "Not checked")}:`);
|
|
3261
|
+
lines.push(summary2.unknowns?.length ? list(summary2.unknowns) : "\u2014");
|
|
3262
|
+
if (summary2.duplicates?.length) {
|
|
3263
|
+
lines.push("", `${tr("\u041F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043D\u044B\u0435 \u0434\u0443\u0431\u043B\u0438", "Skipped duplicates")}:`);
|
|
3264
|
+
lines.push(list(summary2.duplicates));
|
|
3265
|
+
}
|
|
3266
|
+
if (summary2.ruleCandidates?.length) {
|
|
3267
|
+
lines.push("", `${tr("\u041A\u0430\u043D\u0434\u0438\u0434\u0430\u0442\u044B \u0432 \u043F\u0440\u0430\u0432\u0438\u043B\u0430", "Rule candidates")}:`);
|
|
3268
|
+
lines.push(list(summary2.ruleCandidates));
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
lines.push("");
|
|
3272
|
+
lines.push(`## ${tr("\u041F\u0440\u0430\u0432\u0438\u043B\u0430", "Rules")}`);
|
|
3273
|
+
lines.push(`${tr("\u043A\u043E\u043D\u0444\u0438\u0433", "config")}: \`${rules2.configPath ?? "\u2014"}\``);
|
|
3274
|
+
if (!rules2.documents.length) {
|
|
3275
|
+
lines.push(tr("> \u041D\u0438 \u043E\u0434\u0438\u043D \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u043F\u0440\u0430\u0432\u0438\u043B \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D: \u043E\u0446\u0435\u043D\u043A\u0430 \u043D\u0435 \u043E\u043F\u0438\u0440\u0430\u043B\u0430\u0441\u044C \u043D\u0430 \u043F\u0440\u0430\u0432\u0438\u043B\u0430 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F.", "> No rule document was selected: the review did not rely on repository rules."));
|
|
3276
|
+
} else {
|
|
3277
|
+
lines.push("");
|
|
3278
|
+
lines.push(`| ${tr("\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", "document")} | ${tr("\u0441\u0435\u043A\u0446\u0438\u0438", "sections")} | ${tr("\u0431\u0430\u0439\u0442", "bytes")} | sha256 |`);
|
|
3279
|
+
lines.push("|---|---|---|---|");
|
|
3280
|
+
for (const doc of rules2.documents) {
|
|
3281
|
+
lines.push(
|
|
3282
|
+
`| \`${cell(doc.path)}\`${doc.truncated ? ` (${tr("\u043E\u0431\u0440\u0435\u0437\u0430\u043D", "truncated")})` : ""} | ${cell(doc.sections.join(", ")) || "\u2014"} | ${doc.bytes} | \`${doc.hash}\` |`
|
|
3283
|
+
);
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
if (rules2.warnings.length) {
|
|
3287
|
+
lines.push("", `${tr("\u041F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u044F", "Warnings")}:`);
|
|
3288
|
+
lines.push(list(rules2.warnings));
|
|
3289
|
+
}
|
|
3290
|
+
lines.push("");
|
|
3291
|
+
lines.push(`## ${tr("\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438", "Checks")}`);
|
|
3292
|
+
if (!checks2.planned.length) {
|
|
3293
|
+
lines.push(tr("\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0432 \u043A\u043E\u043D\u0444\u0438\u0433\u0435 \u043D\u0435 \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u044B.", "No checks are configured."));
|
|
3294
|
+
} else {
|
|
3295
|
+
for (const check of checks2.planned) {
|
|
3296
|
+
lines.push(`- \`${check.id}\`: \`${check.argv.join(" ")}\` \xB7 ${tr("\u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0441\u044F \u043A diff", "matched by diff")}: ${check.matched ? YES() : NO()}`);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
lines.push("");
|
|
3300
|
+
if (!checks2.runs.length) {
|
|
3301
|
+
lines.push(tr("> \u0424\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043F\u0440\u043E\u0433\u043E\u043D\u043E\u0432 \u043D\u0435\u0442: \u0442\u0438\u043F\u044B \u0438 \u0442\u0435\u0441\u0442\u044B \u043D\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u0435\u043D\u044B.", "> No check runs recorded: types and tests are not verified."));
|
|
3302
|
+
} else {
|
|
3303
|
+
for (const run2 of checks2.runs) {
|
|
3304
|
+
const current2 = payload.review.headSha !== "" && run2.commitSha === payload.review.headSha;
|
|
3305
|
+
const exit = run2.exitCode === null ? "" : ` (exit ${run2.exitCode})`;
|
|
3306
|
+
lines.push(
|
|
3307
|
+
`- \`${run2.checkId}\`: ${run2.status}${exit} \xB7 ${run2.startedAt} \xB7 ${current2 ? tr("\u0430\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u043C\u043C\u0438\u0442", "current commit") : `${tr("\u043A\u043E\u043C\u043C\u0438\u0442", "commit")} ${run2.commitSha.slice(0, 12) || "?"}`} \xB7 ${Math.round(run2.durationMs)}ms`
|
|
3308
|
+
);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
lines.push("");
|
|
3312
|
+
lines.push(`## ${tr("\u0417\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F", "Findings")} (${findings2.length})`);
|
|
3313
|
+
if (!findings2.length) lines.push("\u2014");
|
|
3314
|
+
for (const finding of findings2) {
|
|
3315
|
+
const decision = finding.decision ? ` \xB7 ${finding.decision}` : "";
|
|
3316
|
+
const rule = finding.rule ? ` \xB7 ${tr("\u043F\u0440\u0430\u0432\u0438\u043B\u043E", "rule")}: ${finding.rule}` : "";
|
|
3317
|
+
lines.push(`- **${finding.level}** ${finding.file}:${finding.line ?? "\u2014"} \u2014 ${finding.title} \xB7 ${finding.status}${decision}${rule}`);
|
|
3318
|
+
}
|
|
3319
|
+
lines.push("");
|
|
3320
|
+
lines.push(`## ${tr("\u0420\u0435\u0448\u0435\u043D\u0438\u044F \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0430", "Human decisions")}`);
|
|
3321
|
+
lines.push(
|
|
3322
|
+
`${tr("\u043F\u0440\u0438\u043D\u044F\u0442\u043E", "accepted")}: ${decisions.accepted} \xB7 ${tr("\u043E\u0442\u043A\u043B\u043E\u043D\u0435\u043D\u043E", "rejected")}: ${decisions.rejected} \xB7 ${tr("\u043D\u0430 \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0438", "discussed")}: ${decisions.discussed} \xB7 ${tr("\u043E\u0436\u0438\u0434\u0430\u0435\u0442", "pending")}: ${decisions.pending}`
|
|
3323
|
+
);
|
|
3324
|
+
lines.push("");
|
|
3325
|
+
lines.push(`## ${tr("\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F", "Publication")}`);
|
|
3326
|
+
lines.push(
|
|
3327
|
+
`${tr("\u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u0439", "findings")}: ${publish2.findings} \xB7 ${tr("\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432", "notes")}: ${publish2.notes} \xB7 ${tr("\u043E\u0442\u0432\u0435\u0442\u043E\u0432", "replies")}: ${publish2.replies}`
|
|
3328
|
+
);
|
|
3329
|
+
lines.push("");
|
|
3330
|
+
lines.push(`## ${tr("\u0422\u0430\u0439\u043C\u043B\u0430\u0439\u043D", "Timeline")}`);
|
|
3331
|
+
if (!timeline.length) lines.push("\u2014");
|
|
3332
|
+
for (const event of timeline) lines.push(`- ${event.at} \xB7 ${event.actor} \xB7 ${event.type}`);
|
|
3333
|
+
lines.push("");
|
|
3334
|
+
lines.push(`## ${tr("\u041E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F \u0430\u0440\u0442\u0435\u0444\u0430\u043A\u0442\u0430", "Artifact limits")}`);
|
|
3335
|
+
for (const item of payload.limitations) lines.push(`- ${item}`);
|
|
3336
|
+
return `${lines.join("\n").replace(/\n+$/, "")}
|
|
3337
|
+
`;
|
|
3338
|
+
}
|
|
3339
|
+
|
|
2946
3340
|
// src/cli/main.ts
|
|
2947
3341
|
init_client();
|
|
2948
3342
|
init_exec();
|
|
@@ -4232,9 +4626,9 @@ async function importReview(root, arg, dir) {
|
|
|
4232
4626
|
}
|
|
4233
4627
|
const findings2 = await read(`${base}-findings.json`);
|
|
4234
4628
|
if (findings2) {
|
|
4235
|
-
const
|
|
4236
|
-
await client2.request("findings.put", { review: review.id, findings:
|
|
4237
|
-
writers.out(`\u2714 ${tr("\u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F", "findings")}: ${
|
|
4629
|
+
const list3 = Array.isArray(findings2) ? findings2 : findings2.findings ?? [];
|
|
4630
|
+
await client2.request("findings.put", { review: review.id, findings: list3 });
|
|
4631
|
+
writers.out(`\u2714 ${tr("\u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u044F", "findings")}: ${list3.length}`);
|
|
4238
4632
|
}
|
|
4239
4633
|
const replies = await read(`${base}-replies.json`);
|
|
4240
4634
|
if (replies?.replies) {
|
|
@@ -4359,6 +4753,8 @@ var OPTIONS = {
|
|
|
4359
4753
|
"keep-config": { type: "boolean", default: false },
|
|
4360
4754
|
write: { type: "boolean", default: false },
|
|
4361
4755
|
explain: { type: "string" },
|
|
4756
|
+
format: { type: "string" },
|
|
4757
|
+
out: { type: "string" },
|
|
4362
4758
|
limit: { type: "string" },
|
|
4363
4759
|
decision: { type: "string" },
|
|
4364
4760
|
note: { type: "string" },
|
|
@@ -4375,6 +4771,7 @@ var OPTIONS = {
|
|
|
4375
4771
|
to: { type: "string" },
|
|
4376
4772
|
role: { type: "string" },
|
|
4377
4773
|
shard: { type: "string" },
|
|
4774
|
+
last: { type: "boolean", default: false },
|
|
4378
4775
|
title: { type: "string" },
|
|
4379
4776
|
brief: { type: "string" },
|
|
4380
4777
|
contract: { type: "string" },
|
|
@@ -4423,15 +4820,17 @@ var HELP_RU = `revdeck ${VERSION} \u2014 \u0440\u0435\u0432\u044C\u044E GitLab/G
|
|
|
4423
4820
|
revdeck attach <N> --file <\u043F\u0443\u0442\u044C> \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0443/\u0432\u0438\u0434\u0435\u043E \u0432 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u0443
|
|
4424
4821
|
revdeck publish <N> [--kind reply|finding|note] [--ids a,b] [--yes]
|
|
4425
4822
|
revdeck rules [<N>] [--explain <\u043F\u0443\u0442\u044C>]
|
|
4426
|
-
revdeck checks <N> [--run --yes]
|
|
4823
|
+
revdeck checks <N> [--last] [--run --yes] \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438: \u043F\u043B\u0430\u043D, \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u043F\u0440\u043E\u0433\u043E\u043D\u044B, \u0437\u0430\u043F\u0443\u0441\u043A \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u043E\u043C
|
|
4824
|
+
revdeck evidence <N> [--format md|json] [--out <\u0444\u0430\u0439\u043B>] \u043F\u0430\u0441\u043F\u043E\u0440\u0442 \u0440\u0435\u0432\u044C\u044E: \u043F\u0440\u0430\u0432\u0438\u043B\u0430, \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438, \u0440\u0435\u0448\u0435\u043D\u0438\u044F
|
|
4427
4825
|
revdeck export <N> [--dir .revdeck] \u0432\u044B\u0433\u0440\u0443\u0437\u043A\u0430 \u0432 \u0441\u0442\u0430\u0440\u044B\u0439 \u0444\u0430\u0439\u043B\u043E\u0432\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442
|
|
4428
4826
|
revdeck import <N> [--dir .revdeck] \u0438\u043C\u043F\u043E\u0440\u0442 \u0438\u0437 \u0441\u0442\u0430\u0440\u043E\u0433\u043E \u0444\u043E\u0440\u043C\u0430\u0442\u0430
|
|
4429
4827
|
revdeck config [--json] \u044D\u0444\u0444\u0435\u043A\u0442\u0438\u0432\u043D\u044B\u0439 \u043A\u043E\u043D\u0444\u0438\u0433 \u043F\u0440\u043E\u0435\u043A\u0442\u0430
|
|
4430
4828
|
revdeck mcp \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C MCP-\u0441\u0435\u0440\u0432\u0435\u0440 (stdio)
|
|
4431
4829
|
|
|
4432
4830
|
\u041E\u0431\u0449\u0438\u0435 \u0444\u043B\u0430\u0433\u0438: --json, --root <\u043F\u0443\u0442\u044C>, --review <id>, --lang ru|en, --help.
|
|
4433
|
-
\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F,
|
|
4434
|
-
\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u043E\u0442\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 --run/--yes. \u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F \u0431\u0435\u0437 --yes \u043D\u0438\u043A\u043E\u0433\u0434\u0430 \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F
|
|
4831
|
+
\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F, \u0437\u0430\u043F\u0443\u0441\u043A \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u0438 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u2014 human-only: \u043C\u043E\u0441\u0442 \u0430\u0433\u0435\u043D\u0442\u0430 \u043F\u043E\u043B\u0443\u0447\u0430\u0435\u0442 CAPABILITY, CLI \u0432
|
|
4832
|
+
\u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u043E\u0442\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 --run/--yes. \u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F \u0431\u0435\u0437 --yes \u043D\u0438\u043A\u043E\u0433\u0434\u0430 \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F. \u041F\u043B\u0430\u043D \u0438 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435
|
|
4833
|
+
\u043F\u0440\u043E\u0433\u043E\u043D\u044B \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u0430\u0433\u0435\u043D\u0442 \u0447\u0438\u0442\u0430\u0435\u0442, \u043D\u043E \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442; \u043F\u0430\u0441\u043F\u043E\u0440\u0442 \u0440\u0435\u0432\u044C\u044E \u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0435\u0442 \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043D\u0430 \u0445\u043E\u0441\u0442\u0435.`;
|
|
4435
4834
|
var HELP_EN = `revdeck ${VERSION} \u2014 code review for GitLab/GitHub, for humans and agents
|
|
4436
4835
|
|
|
4437
4836
|
revdeck init set up a project: .revdeck.yml, adapters, MCP [--provider gitlab|github|auto]
|
|
@@ -4464,15 +4863,17 @@ var HELP_EN = `revdeck ${VERSION} \u2014 code review for GitLab/GitHub, for huma
|
|
|
4464
4863
|
revdeck attach <N> --file <path> upload an image/video to the platform
|
|
4465
4864
|
revdeck publish <N> [--kind reply|finding|note] [--ids a,b] [--yes]
|
|
4466
4865
|
revdeck rules [<N>] [--explain <path>]
|
|
4467
|
-
revdeck checks <N> [--run --yes]
|
|
4866
|
+
revdeck checks <N> [--last] [--run --yes] checks: plan, last runs, run by a human only
|
|
4867
|
+
revdeck evidence <N> [--format md|json] [--out <file>] review evidence: rules, checks, decisions
|
|
4468
4868
|
revdeck export <N> [--dir .revdeck] export to the legacy file format
|
|
4469
4869
|
revdeck import <N> [--dir .revdeck] import from the legacy format
|
|
4470
4870
|
revdeck config [--json] effective project config
|
|
4471
4871
|
revdeck mcp start the MCP server (stdio)
|
|
4472
4872
|
|
|
4473
4873
|
Common flags: --json, --root <path>, --review <id>, --lang ru|en, --help.
|
|
4474
|
-
Publishing, checks and administration are human-only: the agent bridge gets CAPABILITY and the
|
|
4475
|
-
container CLI refuses --run/--yes. Publishing never happens without --yes
|
|
4874
|
+
Publishing, running checks and administration are human-only: the agent bridge gets CAPABILITY and the
|
|
4875
|
+
container CLI refuses --run/--yes. Publishing never happens without --yes. The agent may read the plan
|
|
4876
|
+
and the last runs, but never runs them; the review evidence is generated by a human on the host.`;
|
|
4476
4877
|
var helpText = () => tr(HELP_RU, HELP_EN);
|
|
4477
4878
|
async function main2() {
|
|
4478
4879
|
const argv = process.argv.slice(2);
|
|
@@ -4552,7 +4953,7 @@ async function main2() {
|
|
|
4552
4953
|
case "feature":
|
|
4553
4954
|
return feature(root, positionals, values);
|
|
4554
4955
|
case "list":
|
|
4555
|
-
return
|
|
4956
|
+
return list2(root, values);
|
|
4556
4957
|
case "open":
|
|
4557
4958
|
return openReview(root, positionals, values);
|
|
4558
4959
|
case "ui":
|
|
@@ -4599,6 +5000,8 @@ async function main2() {
|
|
|
4599
5000
|
return rules(root, positionals[0], values);
|
|
4600
5001
|
case "checks":
|
|
4601
5002
|
return checks(root, positionals[0], values);
|
|
5003
|
+
case "evidence":
|
|
5004
|
+
return evidence(root, positionals[0], values);
|
|
4602
5005
|
case "export":
|
|
4603
5006
|
return exportReview(root, positionals[0], String(values.dir ?? ".revdeck"));
|
|
4604
5007
|
case "import":
|
|
@@ -4660,7 +5063,7 @@ function formatInfo(review) {
|
|
|
4660
5063
|
`${review.stats.files} ${plural(review.stats.files, "\u0444\u0430\u0439\u043B", "\u0444\u0430\u0439\u043B\u0430", "\u0444\u0430\u0439\u043B\u043E\u0432", "file", "files")}, +${review.stats.additions} \u2212${review.stats.deletions} \xB7 ${tr("\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E", "updated")} ${when(review.syncedAt)}${review.stale ? tr(" (\u0443\u0441\u0442\u0430\u0440\u0435\u043B\u043E)", " (stale)") : ""}`
|
|
4661
5064
|
];
|
|
4662
5065
|
}
|
|
4663
|
-
async function
|
|
5066
|
+
async function list2(root, values) {
|
|
4664
5067
|
if (values.remote) {
|
|
4665
5068
|
await withClient(async ({ client: client2 }) => {
|
|
4666
5069
|
const result = await client2.request("reviews.remoteList", {
|
|
@@ -5300,15 +5703,17 @@ async function context(root, arg, values) {
|
|
|
5300
5703
|
const scenario = parseScenario(values.scenario);
|
|
5301
5704
|
await withClient(async ({ client: client2 }) => {
|
|
5302
5705
|
const { review } = await resolveReview(client2, root, reviewArg(values, arg), values);
|
|
5706
|
+
const shard = parseShard(values.shard);
|
|
5303
5707
|
const { rules: rules2 } = await client2.request("rules.get", {
|
|
5304
|
-
review: review.id
|
|
5708
|
+
review: review.id,
|
|
5709
|
+
...shard ? { shard } : {}
|
|
5305
5710
|
});
|
|
5306
|
-
if (values.json) return printJson(contextPayload(review, rules2, scenario));
|
|
5711
|
+
if (values.json) return printJson(contextPayload(review, rules2, scenario, shard ? { shard } : {}));
|
|
5307
5712
|
const role = parseRole(values.role);
|
|
5308
|
-
|
|
5309
|
-
|
|
5713
|
+
const knownRoles = [.../* @__PURE__ */ new Set([...rules2.roles.map((item) => item.id), ...REVIEW_ROLE_IDS])];
|
|
5714
|
+
if (role && !knownRoles.includes(role)) {
|
|
5715
|
+
fail(tr(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0440\u043E\u043B\u044C ${role}`, `unknown role ${role}`), `--role <${knownRoles.join("|")}>`);
|
|
5310
5716
|
}
|
|
5311
|
-
const shard = parseShard(values.shard);
|
|
5312
5717
|
writers.out(renderContext(review, rules2, {
|
|
5313
5718
|
language: rules2.language,
|
|
5314
5719
|
...rules2.maxBytes !== void 0 ? { maxBytes: rules2.maxBytes } : {},
|
|
@@ -5399,9 +5804,9 @@ async function findings(arg, action, values) {
|
|
|
5399
5804
|
if (action === "set") {
|
|
5400
5805
|
if (!values.file) fail(tr("\u0443\u043A\u0430\u0436\u0438\u0442\u0435 --file \u0441 JSON \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u0439", "pass --file with findings JSON"));
|
|
5401
5806
|
const raw = JSON.parse(await readFile8(String(values.file), "utf8"));
|
|
5402
|
-
const
|
|
5403
|
-
if (!Array.isArray(
|
|
5404
|
-
const { findings: saved } = await client2.request("findings.put", { review: review.id, findings:
|
|
5807
|
+
const list3 = Array.isArray(raw) ? raw : raw.findings;
|
|
5808
|
+
if (!Array.isArray(list3)) fail(tr("\u043E\u0436\u0438\u0434\u0430\u043B\u0441\u044F \u043C\u0430\u0441\u0441\u0438\u0432 \u0438\u043B\u0438 {findings: [...]}", "expected an array or {findings: [...]}"));
|
|
5809
|
+
const { findings: saved } = await client2.request("findings.put", { review: review.id, findings: list3 });
|
|
5405
5810
|
if (values.json) return printJson({ findings: saved });
|
|
5406
5811
|
writers.out(`${tr("\u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E \u0437\u0430\u043C\u0435\u0447\u0430\u043D\u0438\u0439", "findings saved")}: ${saved.length}`);
|
|
5407
5812
|
return;
|
|
@@ -5661,6 +6066,15 @@ async function rules(root, arg, values) {
|
|
|
5661
6066
|
async function checks(root, arg, values) {
|
|
5662
6067
|
await withClient(async ({ client: client2 }) => {
|
|
5663
6068
|
const { review } = await resolveReview(client2, root, reviewArg(values, arg), values);
|
|
6069
|
+
const { runs } = await client2.request("checks.list", { review: review.id });
|
|
6070
|
+
if (values.last && values.run) fail(tr("--last \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0438\u0442\u0430\u0435\u0442 \u043F\u0440\u043E\u0433\u043E\u043D\u044B, --run \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442: \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0434\u043D\u043E", "--last only reads runs, --run executes: choose one"));
|
|
6071
|
+
if (values.last) {
|
|
6072
|
+
if (values.json) return printJson({ runs });
|
|
6073
|
+
if (!runs.length) return writers.out(tr("\u043F\u0440\u043E\u0433\u043E\u043D\u043E\u0432 \u0435\u0449\u0451 \u043D\u0435 \u0431\u044B\u043B\u043E", "no check runs yet"));
|
|
6074
|
+
writers.out(tr("\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u043F\u0440\u043E\u0433\u043E\u043D\u044B:", "Last check runs:"));
|
|
6075
|
+
for (const line of checkRunLines(runs, review.info.commit.head)) writers.out(line);
|
|
6076
|
+
return;
|
|
6077
|
+
}
|
|
5664
6078
|
if (values.run && !values.yes) fail(tr("\u0437\u0430\u043F\u0443\u0441\u043A \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u043C\u0435\u043D\u044F\u0435\u0442 \u043E\u043A\u0440\u0443\u0436\u0435\u043D\u0438\u0435: \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 --yes, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C", "running checks changes the environment: add --yes to confirm"));
|
|
5665
6079
|
if (!values.json) {
|
|
5666
6080
|
const { rules: plan } = await client2.request("rules.get", {
|
|
@@ -5673,6 +6087,11 @@ async function checks(root, arg, values) {
|
|
|
5673
6087
|
for (const check of selected) writers.out(` ${check.id}: ${check.argv.join(" ")}`);
|
|
5674
6088
|
writers.out("");
|
|
5675
6089
|
}
|
|
6090
|
+
if (runs.length) {
|
|
6091
|
+
writers.out(tr("\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u043F\u0440\u043E\u0433\u043E\u043D\u044B:", "Last check runs:"));
|
|
6092
|
+
for (const line of checkRunLines(runs, review.info.commit.head)) writers.out(line);
|
|
6093
|
+
writers.out("");
|
|
6094
|
+
}
|
|
5676
6095
|
}
|
|
5677
6096
|
const { results } = await client2.request("checks.run", {
|
|
5678
6097
|
review: review.id,
|
|
@@ -5686,6 +6105,36 @@ async function checks(root, arg, values) {
|
|
|
5686
6105
|
}
|
|
5687
6106
|
});
|
|
5688
6107
|
}
|
|
6108
|
+
async function evidence(root, arg, values) {
|
|
6109
|
+
await withClient(async ({ client: client2 }) => {
|
|
6110
|
+
const { review } = await resolveReview(client2, root, reviewArg(values, arg), values);
|
|
6111
|
+
const { evidence: payload } = await client2.request("evidence.get", { review: review.id });
|
|
6112
|
+
const asJson = values.json === true || values.format === "json";
|
|
6113
|
+
const text = asJson ? `${JSON.stringify(payload, null, 2)}
|
|
6114
|
+
` : renderEvidenceMarkdown(payload);
|
|
6115
|
+
if (values.out) {
|
|
6116
|
+
const target = path11.resolve(String(values.out));
|
|
6117
|
+
await writeFile5(target, text, { mode: 420 });
|
|
6118
|
+
writers.out(tr(`\u043F\u0430\u0441\u043F\u043E\u0440\u0442 \u0440\u0435\u0432\u044C\u044E: ${target}`, `review evidence: ${target}`));
|
|
6119
|
+
return;
|
|
6120
|
+
}
|
|
6121
|
+
writers.out(text.replace(/\n$/, ""));
|
|
6122
|
+
});
|
|
6123
|
+
}
|
|
6124
|
+
function checkRunLines(runs, head) {
|
|
6125
|
+
const lines = [];
|
|
6126
|
+
for (const run2 of runs) {
|
|
6127
|
+
const known = head !== "" && run2.commitSha !== "";
|
|
6128
|
+
const current2 = known && run2.commitSha === head;
|
|
6129
|
+
const icon = run2.status === "passed" ? "\u2714" : run2.status === "failed" ? "\u2716" : "\u26A0";
|
|
6130
|
+
const commit = !known ? tr("\u043A\u043E\u043C\u043C\u0438\u0442 \u043D\u0435 \u0437\u0430\u043F\u0438\u0441\u0430\u043D", "commit not recorded") : current2 ? tr("\u0430\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u043E\u043C\u043C\u0438\u0442", "current commit") : `${tr("\u043A\u043E\u043C\u043C\u0438\u0442", "commit")} ${run2.commitSha.slice(0, 12)} (${tr("\u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439", "stale")})`;
|
|
6131
|
+
lines.push(`${icon} ${run2.checkId}: ${run2.status} \xB7 ${when(run2.startedAt)} \xB7 ${commit} \xB7 ${Math.round(run2.durationMs)}ms`);
|
|
6132
|
+
if (run2.status !== "passed" && run2.output) {
|
|
6133
|
+
lines.push(...headTailLines(run2.output, 12).map((line) => ` ${line}`));
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
6136
|
+
return lines;
|
|
6137
|
+
}
|
|
5689
6138
|
async function config(root, values) {
|
|
5690
6139
|
const loaded = await loadConfig(root);
|
|
5691
6140
|
if (values.json) return printJson({ path: loaded.path, localPath: loaded.localPath, config: loaded.config, warnings: loaded.warnings });
|