revdeck 0.6.0 → 0.7.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 +47 -1
- package/README.md +47 -16
- package/README.ru.md +49 -20
- package/SECURITY.md +1 -1
- package/dist/cli.js +417 -247
- package/dist/cli.js.map +4 -4
- package/dist/daemon.js +420 -121
- package/dist/daemon.js.map +4 -4
- package/dist/mcp.js +54 -26
- package/dist/mcp.js.map +4 -4
- package/dist/ui/assets/index-BIVPy49b.css +1 -0
- package/dist/ui/assets/index-BcvEWwhI.js +18 -0
- package/dist/ui/favicon.svg +8 -3
- package/dist/ui/icon-128.png +0 -0
- package/dist/ui/icon-32.png +0 -0
- package/dist/ui/index.html +4 -2
- package/docs/README.md +3 -0
- package/docs/architecture.md +10 -6
- package/docs/assets/brand/README.md +49 -0
- package/docs/assets/brand/icon-1024.png +0 -0
- package/docs/assets/brand/icon-128.png +0 -0
- package/docs/assets/brand/icon-256.png +0 -0
- package/docs/assets/brand/icon-32.png +0 -0
- package/docs/assets/brand/icon-512.png +0 -0
- package/docs/assets/brand/icon-64.png +0 -0
- package/docs/assets/brand/icon.svg +9 -0
- package/docs/assets/brand/logo-dark.png +0 -0
- package/docs/assets/brand/logo-dark.svg +13 -0
- package/docs/assets/brand/logo.png +0 -0
- package/docs/assets/brand/logo.svg +13 -0
- package/docs/capabilities.md +21 -10
- package/docs/configuration.md +24 -8
- package/docs/integrations.md +17 -14
- package/docs/protocol.md +34 -13
- package/docs/ru/README.md +3 -0
- package/docs/ru/architecture.md +10 -6
- package/docs/ru/capabilities.md +22 -9
- package/docs/ru/configuration.md +20 -6
- package/docs/ru/integrations.md +16 -14
- package/docs/ru/protocol.md +33 -12
- package/docs/ru/threat-model.md +6 -5
- package/docs/threat-model.md +10 -8
- package/package.json +1 -1
- package/skills/revdeck/en/Feedback.md +3 -2
- package/skills/revdeck/en/Review.md +3 -2
- package/skills/revdeck/ru/Feedback.md +3 -2
- package/skills/revdeck/ru/Review.md +2 -2
- package/dist/ui/assets/index-BH0dNFhd.css +0 -1
- package/dist/ui/assets/index-Wz1DYbiv.js +0 -14
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ var __esm = (fn, res, err) => function __init() {
|
|
|
11
11
|
|
|
12
12
|
// src/core/paths.ts
|
|
13
13
|
import { constants, existsSync } from "node:fs";
|
|
14
|
-
import { lstat, mkdir, open, realpath, rename, unlink } from "node:fs/promises";
|
|
14
|
+
import { lstat, mkdir, open, realpath, rename, stat, unlink } from "node:fs/promises";
|
|
15
15
|
import path from "node:path";
|
|
16
16
|
import os from "node:os";
|
|
17
17
|
import { fileURLToPath } from "node:url";
|
|
@@ -96,13 +96,41 @@ async function readTextNoFollow(file, maxBytes = 4 * 1024 * 1024) {
|
|
|
96
96
|
await handle.close();
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
async function
|
|
99
|
+
async function openInsideRoot(root, target) {
|
|
100
|
+
const resolvedTarget = path.resolve(target);
|
|
100
101
|
const realRoot = await realpath(path.resolve(root));
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
let handle;
|
|
103
|
+
try {
|
|
104
|
+
handle = await open(resolvedTarget, process.platform === "win32" ? "r" : constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (error.code === "ELOOP") {
|
|
107
|
+
throw new Error(`${path.basename(target)}: path escapes the repository`);
|
|
108
|
+
}
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const info = await handle.stat();
|
|
113
|
+
if (!info.isFile()) throw new Error(`${path.basename(target)}: not a regular file`);
|
|
114
|
+
if (process.platform === "linux") {
|
|
115
|
+
const actual = await realpath(`/proc/self/fd/${handle.fd}`);
|
|
116
|
+
if (!isInside(realRoot, actual)) {
|
|
117
|
+
throw new Error(`${path.basename(target)}: path escapes the repository`);
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
const actual = await realpath(resolvedTarget);
|
|
121
|
+
if (!isInside(realRoot, actual)) {
|
|
122
|
+
throw new Error(`${path.basename(target)}: path escapes the repository`);
|
|
123
|
+
}
|
|
124
|
+
const onDisk = await stat(actual);
|
|
125
|
+
if (onDisk.dev !== info.dev || onDisk.ino !== info.ino) {
|
|
126
|
+
throw new Error(`${path.basename(target)}: path changed during read`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return handle;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
await handle.close();
|
|
132
|
+
throw error;
|
|
104
133
|
}
|
|
105
|
-
return realTarget;
|
|
106
134
|
}
|
|
107
135
|
function packageRoot() {
|
|
108
136
|
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -197,8 +225,8 @@ function globToRegExp(glob) {
|
|
|
197
225
|
function escapeRegExp(value) {
|
|
198
226
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
199
227
|
}
|
|
200
|
-
function classifyFile(
|
|
201
|
-
const lower =
|
|
228
|
+
function classifyFile(path12) {
|
|
229
|
+
const lower = path12.toLowerCase();
|
|
202
230
|
if (/(^|\/)(node_modules|dist|build|coverage|vendor)\//.test(lower)) return "generated";
|
|
203
231
|
if (/\.(md|mdx|rst|txt|adoc)$/.test(lower) || /(^|\/)(docs?|adr)\//.test(lower)) return "docs";
|
|
204
232
|
if (/(^|\/)(__tests__|tests?|spec|e2e)\//.test(lower) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(lower) || /_test\.go$/.test(lower)) return "test";
|
|
@@ -382,11 +410,138 @@ var init_review_roles = __esm({
|
|
|
382
410
|
}
|
|
383
411
|
});
|
|
384
412
|
|
|
413
|
+
// src/core/exec.ts
|
|
414
|
+
import { execFile } from "node:child_process";
|
|
415
|
+
import { access, constants as constants2 } from "node:fs/promises";
|
|
416
|
+
import os2 from "node:os";
|
|
417
|
+
import path2 from "node:path";
|
|
418
|
+
function scrubEnv(extra) {
|
|
419
|
+
const env = {};
|
|
420
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
421
|
+
if (SECRET_ENV.includes(key)) continue;
|
|
422
|
+
env[key] = value;
|
|
423
|
+
}
|
|
424
|
+
env.PAGER = "cat";
|
|
425
|
+
env.GIT_PAGER = "cat";
|
|
426
|
+
env.GIT_TERMINAL_PROMPT = "0";
|
|
427
|
+
env.NO_COLOR = "1";
|
|
428
|
+
env.CLICOLOR = "0";
|
|
429
|
+
env.FORCE_COLOR = "0";
|
|
430
|
+
env.TERM = "dumb";
|
|
431
|
+
return { ...env, ...extra };
|
|
432
|
+
}
|
|
433
|
+
async function resolveExecutable(command) {
|
|
434
|
+
if (command.includes("/") || command.includes("\\")) {
|
|
435
|
+
try {
|
|
436
|
+
await access(command, constants2.X_OK);
|
|
437
|
+
return command;
|
|
438
|
+
} catch {
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const override = process.env[`REVDECK_${command.toUpperCase()}`];
|
|
443
|
+
if (override) return override;
|
|
444
|
+
const cached = RESOLVED.get(command);
|
|
445
|
+
if (cached) return cached;
|
|
446
|
+
const dirs = [
|
|
447
|
+
...(process.env.PATH ?? "").split(path2.delimiter),
|
|
448
|
+
path2.join(os2.homedir(), ".local", "bin"),
|
|
449
|
+
path2.join(os2.homedir(), ".local", "share", "mise", "shims"),
|
|
450
|
+
path2.join(os2.homedir(), ".asdf", "shims"),
|
|
451
|
+
path2.join(os2.homedir(), ".npm-global", "bin"),
|
|
452
|
+
"/opt/homebrew/bin",
|
|
453
|
+
"/usr/local/bin",
|
|
454
|
+
"/usr/bin",
|
|
455
|
+
"/bin"
|
|
456
|
+
].filter(Boolean);
|
|
457
|
+
const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
|
|
458
|
+
for (const dir of [...new Set(dirs)]) {
|
|
459
|
+
for (const extension of extensions) {
|
|
460
|
+
const candidate = path2.join(dir, `${command}${extension}`);
|
|
461
|
+
try {
|
|
462
|
+
await access(candidate, constants2.X_OK);
|
|
463
|
+
RESOLVED.set(command, candidate);
|
|
464
|
+
return candidate;
|
|
465
|
+
} catch {
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
var SECRET_ENV, RESOLVED, run;
|
|
472
|
+
var init_exec = __esm({
|
|
473
|
+
"src/core/exec.ts"() {
|
|
474
|
+
"use strict";
|
|
475
|
+
SECRET_ENV = [
|
|
476
|
+
"GITLAB_TOKEN",
|
|
477
|
+
"GITLAB_PRIVATE_TOKEN",
|
|
478
|
+
"GLAB_TOKEN",
|
|
479
|
+
"CI_JOB_TOKEN",
|
|
480
|
+
"GH_TOKEN",
|
|
481
|
+
"GITHUB_TOKEN",
|
|
482
|
+
"GITHUB_ENTERPRISE_TOKEN",
|
|
483
|
+
"GIT_ASKPASS",
|
|
484
|
+
"SSH_ASKPASS",
|
|
485
|
+
"REVDECK_TOKEN"
|
|
486
|
+
];
|
|
487
|
+
RESOLVED = /* @__PURE__ */ new Map();
|
|
488
|
+
run = async (command, args, options = {}) => {
|
|
489
|
+
const executable = await resolveExecutable(command) ?? command;
|
|
490
|
+
return new Promise((resolve, reject) => {
|
|
491
|
+
const child = execFile(
|
|
492
|
+
executable,
|
|
493
|
+
args,
|
|
494
|
+
{
|
|
495
|
+
cwd: options.cwd,
|
|
496
|
+
env: scrubEnv(options.env),
|
|
497
|
+
timeout: options.timeoutMs ?? 12e4,
|
|
498
|
+
maxBuffer: options.maxBuffer ?? 64 * 1024 * 1024,
|
|
499
|
+
encoding: "utf8",
|
|
500
|
+
windowsHide: true,
|
|
501
|
+
shell: false
|
|
502
|
+
},
|
|
503
|
+
(error, stdout, stderr) => {
|
|
504
|
+
const exitCode = error?.code;
|
|
505
|
+
const code = typeof exitCode === "number" ? exitCode : error ? 1 : 0;
|
|
506
|
+
if (error && !(options.allowExitCodes ?? []).includes(code)) {
|
|
507
|
+
const reason = (stderr || stdout || error.message).trim();
|
|
508
|
+
reject(Object.assign(new Error(reason.slice(0, 4e3)), { command, code, stderr, stdout }));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
resolve({ stdout, stderr, code });
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
if (options.input !== void 0) {
|
|
515
|
+
child.stdin?.end(options.input);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// src/core/git-files.ts
|
|
523
|
+
async function gitTrackState(root, relative) {
|
|
524
|
+
try {
|
|
525
|
+
const { stdout } = await run("git", ["-C", root, "ls-files", "--error-unmatch", "--", relative], {
|
|
526
|
+
timeoutMs: 1e4
|
|
527
|
+
});
|
|
528
|
+
return stdout.trim() ? "tracked" : "unknown";
|
|
529
|
+
} catch (error) {
|
|
530
|
+
return error.code === 1 ? "untracked" : "unknown";
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
var init_git_files = __esm({
|
|
534
|
+
"src/core/git-files.ts"() {
|
|
535
|
+
"use strict";
|
|
536
|
+
init_exec();
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
|
|
385
540
|
// src/core/config.ts
|
|
386
541
|
import { z } from "zod";
|
|
387
542
|
import { parse as parseYaml } from "yaml";
|
|
388
543
|
import { existsSync as existsSync2 } from "node:fs";
|
|
389
|
-
import
|
|
544
|
+
import path3 from "node:path";
|
|
390
545
|
function isRecord(value) {
|
|
391
546
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
392
547
|
}
|
|
@@ -409,9 +564,21 @@ function mergeConfigData(base, local) {
|
|
|
409
564
|
async function loadConfig(root = findRepoRoot()) {
|
|
410
565
|
const warnings = [];
|
|
411
566
|
const file = findConfigFile(root);
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
567
|
+
let localFile = findLocalConfigFile(root);
|
|
568
|
+
if (localFile && existsSync2(path3.join(root, ".git"))) {
|
|
569
|
+
const state = await gitTrackState(root, path3.relative(root, localFile));
|
|
570
|
+
if (state !== "untracked") {
|
|
571
|
+
warnings.push(
|
|
572
|
+
tr(
|
|
573
|
+
".revdeck.local.yml \u043E\u0442\u0441\u043B\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F git: \u0444\u0430\u0439\u043B \u0438\u0437 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F \u0438\u0433\u043D\u043E\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u043A\u0430\u043A \u043B\u0438\u0447\u043D\u044B\u0439",
|
|
574
|
+
".revdeck.local.yml is tracked by git: a repository file is ignored as personal overrides"
|
|
575
|
+
)
|
|
576
|
+
);
|
|
577
|
+
localFile = null;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const baseData = file ? parseYamlData(await readTextNoFollow(file), path3.relative(root, file) || file) : {};
|
|
581
|
+
const localData = localFile ? parseYamlData(await readTextNoFollow(localFile), path3.relative(root, localFile) || localFile) : {};
|
|
415
582
|
if (!file && !localFile) {
|
|
416
583
|
warnings.push(tr("\u0444\u0430\u0439\u043B .revdeck.yml \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: \u043F\u0440\u0430\u0432\u0438\u043B\u0430 \u0432\u0437\u044F\u0442\u044B \u0438\u0437 \u0430\u0432\u0442\u043E\u043E\u0431\u043D\u0430\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432", ".revdeck.yml not found: rules come from auto-discovered documents"));
|
|
417
584
|
}
|
|
@@ -421,7 +588,7 @@ async function loadConfig(root = findRepoRoot()) {
|
|
|
421
588
|
const localReadOnly = isRecord(localData) && isRecord(localData.review) && localData.review.readOnly === true;
|
|
422
589
|
config2.review.readOnly = baseReadOnly || localReadOnly;
|
|
423
590
|
if (!config2.rules.sources.length && !config2.rules.map.length) {
|
|
424
|
-
const found = DISCOVERED_SOURCES.filter((item) => existsSync2(
|
|
591
|
+
const found = DISCOVERED_SOURCES.filter((item) => existsSync2(path3.join(root, item)));
|
|
425
592
|
config2.rules.sources = found;
|
|
426
593
|
if (!found.length) {
|
|
427
594
|
warnings.push(tr("\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u044B \u0441 \u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043C\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B: \u0440\u0435\u0432\u044C\u044E \u0431\u0443\u0434\u0435\u0442 \u043E\u043F\u0438\u0440\u0430\u0442\u044C\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u043A\u043E\u0434 \u0438 \u0437\u0434\u0440\u0430\u0432\u044B\u0439 \u0441\u043C\u044B\u0441\u043B", "no rule documents found: the review will rely on the code only"));
|
|
@@ -436,17 +603,24 @@ async function loadConfig(root = findRepoRoot()) {
|
|
|
436
603
|
}
|
|
437
604
|
function assertConfigPath(root, relative) {
|
|
438
605
|
const cleaned = relative.split("#")[0];
|
|
439
|
-
const resolved =
|
|
440
|
-
const rel =
|
|
441
|
-
if (rel.startsWith("..") ||
|
|
606
|
+
const resolved = path3.resolve(root, cleaned);
|
|
607
|
+
const rel = path3.relative(root, resolved);
|
|
608
|
+
if (rel.startsWith("..") || path3.isAbsolute(rel)) {
|
|
442
609
|
throw new ConfigError(tr(`\u043F\u0443\u0442\u044C ${relative} \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u043F\u0440\u0435\u0434\u0435\u043B\u044B \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044F`, `path ${relative} escapes the repository`));
|
|
443
610
|
}
|
|
444
611
|
return resolved;
|
|
445
612
|
}
|
|
446
613
|
async function readConfigFile(root, relative, maxBytes = 4 * 1024 * 1024) {
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
614
|
+
const handle = await openInsideRoot(root, assertConfigPath(root, relative));
|
|
615
|
+
try {
|
|
616
|
+
const info = await handle.stat();
|
|
617
|
+
if (info.size > maxBytes) {
|
|
618
|
+
throw new Error(`${path3.basename(relative)}: file is larger than ${Math.round(maxBytes / 1024)} KB`);
|
|
619
|
+
}
|
|
620
|
+
return await handle.readFile({ encoding: "utf8" });
|
|
621
|
+
} finally {
|
|
622
|
+
await handle.close();
|
|
623
|
+
}
|
|
450
624
|
}
|
|
451
625
|
function checksForPaths(config2, paths) {
|
|
452
626
|
return config2.checks.map((check) => {
|
|
@@ -463,6 +637,7 @@ var init_config = __esm({
|
|
|
463
637
|
init_glob();
|
|
464
638
|
init_locale();
|
|
465
639
|
init_review_roles();
|
|
640
|
+
init_git_files();
|
|
466
641
|
matchSchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);
|
|
467
642
|
customRoleSchema = z.object({
|
|
468
643
|
title: z.string().min(1).max(120),
|
|
@@ -616,16 +791,16 @@ var VERSION;
|
|
|
616
791
|
var init_version = __esm({
|
|
617
792
|
"src/version.ts"() {
|
|
618
793
|
"use strict";
|
|
619
|
-
VERSION = "0.
|
|
794
|
+
VERSION = "0.7.0";
|
|
620
795
|
}
|
|
621
796
|
});
|
|
622
797
|
|
|
623
798
|
// src/client.ts
|
|
624
799
|
import net from "node:net";
|
|
625
800
|
import { spawn } from "node:child_process";
|
|
626
|
-
import { existsSync as
|
|
801
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
627
802
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
628
|
-
import
|
|
803
|
+
import path6 from "node:path";
|
|
629
804
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
630
805
|
async function connectSocket(file = socketPath(), timeoutMs = 1500) {
|
|
631
806
|
return new Promise((resolve, reject) => {
|
|
@@ -664,16 +839,17 @@ function devcontainerHint() {
|
|
|
664
839
|
return [
|
|
665
840
|
"\u0434\u0435\u043C\u043E\u043D revdeck \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u043D\u0430 \u0445\u043E\u0441\u0442\u0435",
|
|
666
841
|
"\u043D\u0430 \u0445\u043E\u0441\u0442\u0435: revdeck daemon start",
|
|
667
|
-
`\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435
|
|
842
|
+
`\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 mount \u0441\u043E\u043A\u0435\u0442\u0430 \u0438\u0437 revdeck devcontainer --write: ${runtime} (state: ${state})`,
|
|
843
|
+
"UI-\u0442\u043E\u043A\u0435\u043D \u0432 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440 \u043D\u0435 \u043F\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044F; \u043C\u043E\u0441\u0442 \u0434\u0430\u0451\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0433\u0435\u043D\u0442\u0441\u043A\u0438\u0435 \u043C\u0435\u0442\u043E\u0434\u044B",
|
|
668
844
|
"gh/glab \u0434\u043E\u043B\u0436\u043D\u044B \u043E\u0441\u0442\u0430\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 \u0445\u043E\u0441\u0442\u0435: \u0432\u043D\u0443\u0442\u0440\u0438 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430 \u0438\u0445 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0442\u044C \u043D\u0435 \u043D\u0443\u0436\u043D\u043E"
|
|
669
845
|
].join("; ");
|
|
670
846
|
}
|
|
671
847
|
async function devcontainerHttpClient() {
|
|
672
848
|
const { info, error } = await daemonInfoRead();
|
|
673
849
|
if (!info) return { client: null, error: `${daemonInfoPath()}: ${error}` };
|
|
674
|
-
if (!info.port || !info.
|
|
850
|
+
if (!info.port || !info.agentToken) return { client: null, error: `${daemonInfoPath()}: \u043D\u0435\u0442 port/agentToken` };
|
|
675
851
|
const host = process.env.REVDECK_UI_HOST ?? "host.docker.internal";
|
|
676
|
-
return { client: new HttpClient(`http://${host}:${info.port}`, info.
|
|
852
|
+
return { client: new HttpClient(`http://${host}:${info.port}`, info.agentToken), error: "" };
|
|
677
853
|
}
|
|
678
854
|
async function ensureDaemon(options = {}) {
|
|
679
855
|
const url = process.env.REVDECK_URL;
|
|
@@ -695,11 +871,11 @@ async function ensureDaemon(options = {}) {
|
|
|
695
871
|
throw new RpcError(
|
|
696
872
|
`devcontainer HTTP: ${httpError.message}`,
|
|
697
873
|
"DEVCONTAINER",
|
|
698
|
-
"\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E \u0434\u0435\u043C\u043E\u043D \u043D\u0430 \u0445\u043E\u0441\u0442\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D; \
|
|
874
|
+
"\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E \u0434\u0435\u043C\u043E\u043D \u043D\u0430 \u0445\u043E\u0441\u0442\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D; \u0434\u043B\u044F HTTP-\u043F\u0440\u043E\u0431\u0440\u043E\u0441\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 REVDECK_URL + REVDECK_TOKEN"
|
|
699
875
|
);
|
|
700
876
|
}
|
|
701
877
|
}
|
|
702
|
-
throw new RpcError(`devcontainer: ${http.error || devcontainerHint()}`, "DEVCONTAINER", "\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \
|
|
878
|
+
throw new RpcError(`devcontainer: ${http.error || devcontainerHint()}`, "DEVCONTAINER", "\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 mount \u0441\u043E\u043A\u0435\u0442\u0430 /run/revdeck");
|
|
703
879
|
}
|
|
704
880
|
if (options.autoStart === false) throw error;
|
|
705
881
|
}
|
|
@@ -732,15 +908,15 @@ async function spawnDaemon(extraArgs = []) {
|
|
|
732
908
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
733
909
|
}
|
|
734
910
|
function daemonEntry() {
|
|
735
|
-
const here =
|
|
736
|
-
const built =
|
|
737
|
-
if (
|
|
738
|
-
const source =
|
|
739
|
-
if (
|
|
911
|
+
const here = path6.dirname(fileURLToPath2(import.meta.url));
|
|
912
|
+
const built = path6.join(here, "daemon.js");
|
|
913
|
+
if (existsSync5(built)) return { command: process.execPath, args: [built] };
|
|
914
|
+
const source = path6.join(here, "daemon", "main.ts");
|
|
915
|
+
if (existsSync5(source)) {
|
|
740
916
|
return { command: process.execPath, args: ["--import", "tsx", source] };
|
|
741
917
|
}
|
|
742
|
-
const sibling =
|
|
743
|
-
if (
|
|
918
|
+
const sibling = path6.join(here, "..", "dist", "daemon.js");
|
|
919
|
+
if (existsSync5(sibling)) return { command: process.execPath, args: [sibling] };
|
|
744
920
|
throw new RpcError("\u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0432\u0445\u043E\u0434 \u0434\u0435\u043C\u043E\u043D\u0430 (dist/daemon.js)", "DAEMON");
|
|
745
921
|
}
|
|
746
922
|
function uiBaseUrl(info) {
|
|
@@ -866,115 +1042,6 @@ var init_client = __esm({
|
|
|
866
1042
|
}
|
|
867
1043
|
});
|
|
868
1044
|
|
|
869
|
-
// src/core/exec.ts
|
|
870
|
-
import { execFile } from "node:child_process";
|
|
871
|
-
import { access, constants as constants2 } from "node:fs/promises";
|
|
872
|
-
import os2 from "node:os";
|
|
873
|
-
import path5 from "node:path";
|
|
874
|
-
function scrubEnv(extra) {
|
|
875
|
-
const env = {};
|
|
876
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
877
|
-
if (SECRET_ENV.includes(key)) continue;
|
|
878
|
-
env[key] = value;
|
|
879
|
-
}
|
|
880
|
-
env.PAGER = "cat";
|
|
881
|
-
env.GIT_PAGER = "cat";
|
|
882
|
-
env.GIT_TERMINAL_PROMPT = "0";
|
|
883
|
-
env.NO_COLOR = "1";
|
|
884
|
-
env.CLICOLOR = "0";
|
|
885
|
-
env.FORCE_COLOR = "0";
|
|
886
|
-
env.TERM = "dumb";
|
|
887
|
-
return { ...env, ...extra };
|
|
888
|
-
}
|
|
889
|
-
async function resolveExecutable(command) {
|
|
890
|
-
if (command.includes("/") || command.includes("\\")) {
|
|
891
|
-
try {
|
|
892
|
-
await access(command, constants2.X_OK);
|
|
893
|
-
return command;
|
|
894
|
-
} catch {
|
|
895
|
-
return null;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
const override = process.env[`REVDECK_${command.toUpperCase()}`];
|
|
899
|
-
if (override) return override;
|
|
900
|
-
const cached = RESOLVED.get(command);
|
|
901
|
-
if (cached) return cached;
|
|
902
|
-
const dirs = [
|
|
903
|
-
...(process.env.PATH ?? "").split(path5.delimiter),
|
|
904
|
-
path5.join(os2.homedir(), ".local", "bin"),
|
|
905
|
-
path5.join(os2.homedir(), ".local", "share", "mise", "shims"),
|
|
906
|
-
path5.join(os2.homedir(), ".asdf", "shims"),
|
|
907
|
-
path5.join(os2.homedir(), ".npm-global", "bin"),
|
|
908
|
-
"/opt/homebrew/bin",
|
|
909
|
-
"/usr/local/bin",
|
|
910
|
-
"/usr/bin",
|
|
911
|
-
"/bin"
|
|
912
|
-
].filter(Boolean);
|
|
913
|
-
const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
|
|
914
|
-
for (const dir of [...new Set(dirs)]) {
|
|
915
|
-
for (const extension of extensions) {
|
|
916
|
-
const candidate = path5.join(dir, `${command}${extension}`);
|
|
917
|
-
try {
|
|
918
|
-
await access(candidate, constants2.X_OK);
|
|
919
|
-
RESOLVED.set(command, candidate);
|
|
920
|
-
return candidate;
|
|
921
|
-
} catch {
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
return null;
|
|
926
|
-
}
|
|
927
|
-
var SECRET_ENV, RESOLVED, run;
|
|
928
|
-
var init_exec = __esm({
|
|
929
|
-
"src/core/exec.ts"() {
|
|
930
|
-
"use strict";
|
|
931
|
-
SECRET_ENV = [
|
|
932
|
-
"GITLAB_TOKEN",
|
|
933
|
-
"GITLAB_PRIVATE_TOKEN",
|
|
934
|
-
"GLAB_TOKEN",
|
|
935
|
-
"CI_JOB_TOKEN",
|
|
936
|
-
"GH_TOKEN",
|
|
937
|
-
"GITHUB_TOKEN",
|
|
938
|
-
"GITHUB_ENTERPRISE_TOKEN",
|
|
939
|
-
"GIT_ASKPASS",
|
|
940
|
-
"SSH_ASKPASS",
|
|
941
|
-
"REVDECK_TOKEN"
|
|
942
|
-
];
|
|
943
|
-
RESOLVED = /* @__PURE__ */ new Map();
|
|
944
|
-
run = async (command, args, options = {}) => {
|
|
945
|
-
const executable = await resolveExecutable(command) ?? command;
|
|
946
|
-
return new Promise((resolve, reject) => {
|
|
947
|
-
const child = execFile(
|
|
948
|
-
executable,
|
|
949
|
-
args,
|
|
950
|
-
{
|
|
951
|
-
cwd: options.cwd,
|
|
952
|
-
env: scrubEnv(options.env),
|
|
953
|
-
timeout: options.timeoutMs ?? 12e4,
|
|
954
|
-
maxBuffer: options.maxBuffer ?? 64 * 1024 * 1024,
|
|
955
|
-
encoding: "utf8",
|
|
956
|
-
windowsHide: true,
|
|
957
|
-
shell: false
|
|
958
|
-
},
|
|
959
|
-
(error, stdout, stderr) => {
|
|
960
|
-
const exitCode = error?.code;
|
|
961
|
-
const code = typeof exitCode === "number" ? exitCode : error ? 1 : 0;
|
|
962
|
-
if (error && !(options.allowExitCodes ?? []).includes(code)) {
|
|
963
|
-
const reason = (stderr || stdout || error.message).trim();
|
|
964
|
-
reject(Object.assign(new Error(reason.slice(0, 4e3)), { command, code, stderr, stdout }));
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
resolve({ stdout, stderr, code });
|
|
968
|
-
}
|
|
969
|
-
);
|
|
970
|
-
if (options.input !== void 0) {
|
|
971
|
-
child.stdin?.end(options.input);
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
|
|
978
1045
|
// src/core/git.ts
|
|
979
1046
|
function parseRemote(url) {
|
|
980
1047
|
const value = url.trim();
|
|
@@ -2243,17 +2310,52 @@ ${failed.map((item) => `- ${item.id}: ${item.error}`).join("\n")}` : ""),
|
|
|
2243
2310
|
// src/cli/main.ts
|
|
2244
2311
|
init_paths();
|
|
2245
2312
|
init_config();
|
|
2246
|
-
import { readFile as readFile7, stat } from "node:fs/promises";
|
|
2313
|
+
import { readFile as readFile7, stat as stat2 } from "node:fs/promises";
|
|
2247
2314
|
import { readFileSync } from "node:fs";
|
|
2248
2315
|
import { parseArgs } from "node:util";
|
|
2249
|
-
import
|
|
2316
|
+
import path11 from "node:path";
|
|
2250
2317
|
|
|
2251
2318
|
// src/core/rules.ts
|
|
2252
2319
|
init_config();
|
|
2320
|
+
import path5 from "node:path";
|
|
2321
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
2322
|
+
|
|
2323
|
+
// src/core/doc-policy.ts
|
|
2324
|
+
init_config();
|
|
2325
|
+
init_errors();
|
|
2326
|
+
init_git_files();
|
|
2327
|
+
init_locale();
|
|
2328
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
2329
|
+
import path4 from "node:path";
|
|
2330
|
+
var DOC_EXTENSION = /\.(md|mdx|rst|txt|adoc)$/i;
|
|
2331
|
+
var PROFILE_EXTENSION = /\.(md|mdx|rst|txt|adoc|ya?ml|json)$/i;
|
|
2332
|
+
var SECRET_PATH = /(^|\/)(\.env(\..*)?|\.npmrc|\.git(\/.*)?|\.revdeck\.local\.(ya?ml)|id_(rsa|ed25519|ecdsa)(\.pub)?|.*\.(pem|key|p12|pfx|jks|keystore|tfvars|tfstate))$/i;
|
|
2333
|
+
async function assertSafeDocument(root, relative, kind = "rules") {
|
|
2334
|
+
const clean = relative.split("#")[0];
|
|
2335
|
+
const resolved = assertConfigPath(root, clean);
|
|
2336
|
+
if (SECRET_PATH.test(clean)) {
|
|
2337
|
+
throw new ConfigError(tr(`${relative}: \u0441\u0435\u043A\u0440\u0435\u0442\u043D\u044B\u0439 \u0444\u0430\u0439\u043B \u043D\u0435\u043B\u044C\u0437\u044F \u0447\u0438\u0442\u0430\u0442\u044C \u043A\u0430\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442`, `${relative}: secret files cannot be read as documents`));
|
|
2338
|
+
}
|
|
2339
|
+
if (!(kind === "profile" ? PROFILE_EXTENSION : DOC_EXTENSION).test(clean)) {
|
|
2340
|
+
throw new ConfigError(tr(`${relative}: \u043D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 \u0442\u0438\u043F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430`, `${relative}: unsupported document type`));
|
|
2341
|
+
}
|
|
2342
|
+
if (existsSync3(path4.join(root, ".git"))) {
|
|
2343
|
+
const state = await gitTrackState(root, clean);
|
|
2344
|
+
if (state !== "tracked") {
|
|
2345
|
+
throw new ConfigError(
|
|
2346
|
+
tr(
|
|
2347
|
+
`${relative}: \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u043D\u0435 \u043E\u0442\u0441\u043B\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F git (\u0438\u043B\u0438 git \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D)`,
|
|
2348
|
+
`${relative}: document is not tracked by git (or git is unavailable)`
|
|
2349
|
+
)
|
|
2350
|
+
);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
return resolved;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
// src/core/rules.ts
|
|
2253
2357
|
init_glob();
|
|
2254
2358
|
init_redact();
|
|
2255
|
-
import path3 from "node:path";
|
|
2256
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
2257
2359
|
var MAX_READ_BYTES = 16 * 1024 * 1024;
|
|
2258
2360
|
async function buildEffectiveRules(options) {
|
|
2259
2361
|
const { root, config: config2, configPath } = options;
|
|
@@ -2272,14 +2374,14 @@ async function buildEffectiveRules(options) {
|
|
|
2272
2374
|
const relative = rawPath;
|
|
2273
2375
|
let resolved;
|
|
2274
2376
|
try {
|
|
2275
|
-
resolved =
|
|
2377
|
+
resolved = await assertSafeDocument(root, relative, "rules");
|
|
2276
2378
|
} catch (error) {
|
|
2277
|
-
warnings.push(
|
|
2379
|
+
warnings.push(error.message);
|
|
2278
2380
|
return { path: relative, exists: false, sections: [], excerpt: "", truncated: false };
|
|
2279
2381
|
}
|
|
2280
2382
|
let cached = cache.get(resolved);
|
|
2281
2383
|
if (!cached) {
|
|
2282
|
-
if (!
|
|
2384
|
+
if (!existsSync4(resolved)) {
|
|
2283
2385
|
cached = { exists: false, text: "", truncated: false };
|
|
2284
2386
|
warnings.push(`${t("\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", "document")} ${relative} ${t("\u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D", "not found")}`);
|
|
2285
2387
|
} else {
|
|
@@ -2332,7 +2434,7 @@ async function buildEffectiveRules(options) {
|
|
|
2332
2434
|
scopes.push({ file: "", kind: "other", documents });
|
|
2333
2435
|
}
|
|
2334
2436
|
return {
|
|
2335
|
-
configPath: configPath ?
|
|
2437
|
+
configPath: configPath ? path5.relative(root, configPath) : null,
|
|
2336
2438
|
scopes,
|
|
2337
2439
|
checks: checksForPaths(config2, files),
|
|
2338
2440
|
warnings: [...new Set(warnings)]
|
|
@@ -2456,19 +2558,23 @@ init_redact();
|
|
|
2456
2558
|
init_locale();
|
|
2457
2559
|
init_exec();
|
|
2458
2560
|
init_format();
|
|
2459
|
-
import { existsSync as
|
|
2561
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
2460
2562
|
import { cp, lstat as lstat2, mkdir as mkdir2, readdir, readFile as readFile3, rm, symlink, writeFile } from "node:fs/promises";
|
|
2461
|
-
import
|
|
2563
|
+
import path7 from "node:path";
|
|
2462
2564
|
function mcpServer(locale2) {
|
|
2463
2565
|
return { command: "npx", args: ["-y", "revdeck", "mcp"], env: { REVDECK_LANG: locale2 } };
|
|
2464
2566
|
}
|
|
2567
|
+
function initProvider(remote, requested) {
|
|
2568
|
+
if (requested && requested !== "auto") return requested;
|
|
2569
|
+
return remote ?? "gitlab";
|
|
2570
|
+
}
|
|
2465
2571
|
async function runInit(rootInput, options) {
|
|
2466
2572
|
const root = findRepoRoot(rootInput);
|
|
2467
2573
|
writers.out(`${tr("\u043F\u0440\u043E\u0435\u043A\u0442", "project")}: ${root}`);
|
|
2468
2574
|
const remote = await gitRemote(root);
|
|
2469
|
-
const configFile =
|
|
2470
|
-
if (
|
|
2471
|
-
writers.out(`\u2714 ${tr("\u043A\u043E\u043D\u0444\u0438\u0433 \u0443\u0436\u0435 \u0435\u0441\u0442\u044C", "config already exists")}: ${
|
|
2575
|
+
const configFile = path7.join(root, ".revdeck.yml");
|
|
2576
|
+
if (existsSync6(configFile) && !options.force) {
|
|
2577
|
+
writers.out(`\u2714 ${tr("\u043A\u043E\u043D\u0444\u0438\u0433 \u0443\u0436\u0435 \u0435\u0441\u0442\u044C", "config already exists")}: ${path7.relative(root, configFile)}`);
|
|
2472
2578
|
} else {
|
|
2473
2579
|
let sources = [];
|
|
2474
2580
|
try {
|
|
@@ -2480,7 +2586,7 @@ async function runInit(rootInput, options) {
|
|
|
2480
2586
|
tr("# \u041A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044F revdeck. \u0421\u0445\u0435\u043C\u0430: docs/configuration.md", "# revdeck configuration. Schema: docs/configuration.md"),
|
|
2481
2587
|
"version: 1",
|
|
2482
2588
|
"provider:",
|
|
2483
|
-
` type: ${remote?.platform ??
|
|
2589
|
+
` type: ${initProvider(remote?.platform ?? null, options.provider)}`,
|
|
2484
2590
|
...remote ? [` host: ${remote.host}`, ` project: ${remote.project}`] : [" # host: gitlab.example.com", " # project: group/project"],
|
|
2485
2591
|
"output:",
|
|
2486
2592
|
tr(" # auto \u2014 \u044F\u0437\u044B\u043A \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u044F MR/\u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0439, \u043B\u0438\u0431\u043E \u044F\u0432\u043D\u043E ru/en", " # auto \u2014 MR/thread language, or explicit ru/en"),
|
|
@@ -2508,7 +2614,7 @@ async function runInit(rootInput, options) {
|
|
|
2508
2614
|
""
|
|
2509
2615
|
];
|
|
2510
2616
|
await writeFile(configFile, lines.join("\n"), { mode: 420 });
|
|
2511
|
-
writers.out(`\u2714 ${tr("\u0441\u043E\u0437\u0434\u0430\u043D", "created")} ${
|
|
2617
|
+
writers.out(`\u2714 ${tr("\u0441\u043E\u0437\u0434\u0430\u043D", "created")} ${path7.relative(root, configFile)}`);
|
|
2512
2618
|
}
|
|
2513
2619
|
await ensureGitignore(root);
|
|
2514
2620
|
const adapters = options.adapters.length ? options.adapters : detectAdapters(root);
|
|
@@ -2572,13 +2678,13 @@ var SPECS = {
|
|
|
2572
2678
|
};
|
|
2573
2679
|
function detectAdapters(root) {
|
|
2574
2680
|
const adapters = /* @__PURE__ */ new Set(["agents"]);
|
|
2575
|
-
if (
|
|
2576
|
-
if (
|
|
2577
|
-
if (
|
|
2578
|
-
if (
|
|
2579
|
-
if (
|
|
2580
|
-
if (
|
|
2581
|
-
if (
|
|
2681
|
+
if (existsSync6(path7.join(root, ".claude")) || existsSync6(path7.join(root, "CLAUDE.md"))) adapters.add("claude");
|
|
2682
|
+
if (existsSync6(path7.join(root, ".cursor"))) adapters.add("cursor");
|
|
2683
|
+
if (existsSync6(path7.join(root, ".codex")) || existsSync6(path7.join(root, "AGENTS.md"))) adapters.add("codex");
|
|
2684
|
+
if (existsSync6(path7.join(root, ".github"))) adapters.add("copilot");
|
|
2685
|
+
if (existsSync6(path7.join(root, ".dsh")) || existsSync6(path7.join(root, "dsh.yml"))) adapters.add("dsh");
|
|
2686
|
+
if (existsSync6(path7.join(root, ".gemini")) || existsSync6(path7.join(root, "GEMINI.md"))) adapters.add("gemini");
|
|
2687
|
+
if (existsSync6(path7.join(root, ".opencode"))) adapters.add("opencode");
|
|
2582
2688
|
return [...adapters];
|
|
2583
2689
|
}
|
|
2584
2690
|
async function installAdapter(root, adapter, mcp, locale2, canonicalSkill) {
|
|
@@ -2588,16 +2694,16 @@ async function installAdapter(root, adapter, mcp, locale2, canonicalSkill) {
|
|
|
2588
2694
|
return;
|
|
2589
2695
|
}
|
|
2590
2696
|
if (spec.linkSkill && canonicalSkill) await linkSkill(root, canonicalSkill, locale2);
|
|
2591
|
-
if (spec.mcp) await mergeMcpJson(
|
|
2697
|
+
if (spec.mcp) await mergeMcpJson(path7.join(root, spec.mcp), root, mcp);
|
|
2592
2698
|
for (const file of spec.files ?? []) {
|
|
2593
|
-
const target =
|
|
2594
|
-
if (
|
|
2595
|
-
writers.out(`! ${
|
|
2699
|
+
const target = path7.join(root, file.path);
|
|
2700
|
+
if (existsSync6(target)) {
|
|
2701
|
+
writers.out(`! ${path7.relative(root, target)} ${tr("\u0443\u0436\u0435 \u0435\u0441\u0442\u044C: \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u044B\u0432\u0430\u044E", "already exists: not overwriting")}`);
|
|
2596
2702
|
continue;
|
|
2597
2703
|
}
|
|
2598
|
-
await mkdir2(
|
|
2704
|
+
await mkdir2(path7.dirname(target), { recursive: true });
|
|
2599
2705
|
await writeFile(target, typeof file.content === "string" ? file.content : file.content(locale2));
|
|
2600
|
-
writers.out(`\u2714 ${
|
|
2706
|
+
writers.out(`\u2714 ${path7.relative(root, target)}`);
|
|
2601
2707
|
}
|
|
2602
2708
|
if (adapter === "dsh") {
|
|
2603
2709
|
writers.out(` ${tr("DSH: \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0435 MCP \u0432 \u043F\u0440\u043E\u0444\u0438\u043B\u0435 (Cordis YAML):", "DSH: add the MCP server to your profile (Cordis YAML):")}`);
|
|
@@ -2614,12 +2720,12 @@ async function installAdapter(root, adapter, mcp, locale2, canonicalSkill) {
|
|
|
2614
2720
|
}
|
|
2615
2721
|
}
|
|
2616
2722
|
async function installSkill(root, locale2) {
|
|
2617
|
-
const source =
|
|
2618
|
-
if (!
|
|
2723
|
+
const source = path7.join(packageRoot(), "skills", "revdeck", locale2);
|
|
2724
|
+
if (!existsSync6(source)) {
|
|
2619
2725
|
writers.err(`! ${tr("\u043A\u0430\u0442\u0430\u043B\u043E\u0433 skills/revdeck \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: \u043F\u0430\u043A\u0435\u0442 \u0441\u043E\u0431\u0440\u0430\u043D \u043D\u0435 \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E", "skills/revdeck not found: the package is incomplete")}`);
|
|
2620
2726
|
return null;
|
|
2621
2727
|
}
|
|
2622
|
-
const target =
|
|
2728
|
+
const target = path7.join(root, CANONICAL_SKILL);
|
|
2623
2729
|
await copySkill(source, target);
|
|
2624
2730
|
writers.out(`\u2714 ${tr("\u0441\u043A\u0438\u043B\u043B", "skill")}: ${CANONICAL_SKILL}`);
|
|
2625
2731
|
return target;
|
|
@@ -2627,16 +2733,16 @@ async function installSkill(root, locale2) {
|
|
|
2627
2733
|
async function copySkill(source, target) {
|
|
2628
2734
|
await mkdir2(target, { recursive: true });
|
|
2629
2735
|
for (const entry of await skillFiles(source)) {
|
|
2630
|
-
const file =
|
|
2631
|
-
await mkdir2(
|
|
2632
|
-
await cp(
|
|
2736
|
+
const file = path7.join(target, entry);
|
|
2737
|
+
await mkdir2(path7.dirname(file), { recursive: true });
|
|
2738
|
+
await cp(path7.join(source, entry), file, { force: true });
|
|
2633
2739
|
}
|
|
2634
2740
|
}
|
|
2635
2741
|
async function linkSkill(root, canonicalSkill, locale2) {
|
|
2636
|
-
const target =
|
|
2637
|
-
const source =
|
|
2638
|
-
const skillTarget =
|
|
2639
|
-
await mkdir2(
|
|
2742
|
+
const target = path7.join(root, ".claude", "skills", "revdeck");
|
|
2743
|
+
const source = path7.join(canonicalSkill, "SKILL.md");
|
|
2744
|
+
const skillTarget = path7.join(target, "SKILL.md");
|
|
2745
|
+
await mkdir2(path7.dirname(target), { recursive: true });
|
|
2640
2746
|
const existing = await lstat2(target).catch(() => null);
|
|
2641
2747
|
if (existing) {
|
|
2642
2748
|
if (existing.isSymbolicLink()) {
|
|
@@ -2665,18 +2771,18 @@ This file is a shim. The full procedure is \`.agents/skills/revdeck/SKILL.md\`;
|
|
|
2665
2771
|
`;
|
|
2666
2772
|
await writeFile(skillTarget, shim);
|
|
2667
2773
|
} else {
|
|
2668
|
-
await symlink(
|
|
2774
|
+
await symlink(path7.relative(target, source), skillTarget, "file");
|
|
2669
2775
|
}
|
|
2670
2776
|
writers.out(`\u2714 ${tr("\u0441\u043A\u0438\u043B\u043B", "skill")}: .claude/skills/revdeck/SKILL.md -> ${CANONICAL_SKILL}/SKILL.md`);
|
|
2671
2777
|
}
|
|
2672
2778
|
async function isManagedSkillDir(dir) {
|
|
2673
|
-
const skill =
|
|
2674
|
-
if (!
|
|
2779
|
+
const skill = path7.join(dir, "SKILL.md");
|
|
2780
|
+
if (!existsSync6(skill)) return false;
|
|
2675
2781
|
const text = await readFile3(skill, "utf8").catch(() => "");
|
|
2676
2782
|
return /^name:\s*revdeck\s*$/m.test(text);
|
|
2677
2783
|
}
|
|
2678
2784
|
async function skillFiles(dir, prefix = "") {
|
|
2679
|
-
const entries = await readdir(
|
|
2785
|
+
const entries = await readdir(path7.join(dir, prefix), { withFileTypes: true });
|
|
2680
2786
|
const files = [];
|
|
2681
2787
|
for (const entry of entries) {
|
|
2682
2788
|
const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
@@ -2687,11 +2793,11 @@ async function skillFiles(dir, prefix = "") {
|
|
|
2687
2793
|
}
|
|
2688
2794
|
async function mergeMcpJson(file, root, mcp) {
|
|
2689
2795
|
let data = {};
|
|
2690
|
-
if (
|
|
2796
|
+
if (existsSync6(file)) {
|
|
2691
2797
|
try {
|
|
2692
2798
|
data = JSON.parse(await readFile3(file, "utf8"));
|
|
2693
2799
|
} catch {
|
|
2694
|
-
writers.err(`! ${
|
|
2800
|
+
writers.err(`! ${path7.relative(root, file)} ${tr("\u043F\u043E\u0432\u0440\u0435\u0436\u0434\u0451\u043D: \u043D\u0435 \u0442\u0440\u043E\u0433\u0430\u044E", "is broken: leaving it untouched")}`);
|
|
2695
2801
|
return;
|
|
2696
2802
|
}
|
|
2697
2803
|
}
|
|
@@ -2702,11 +2808,11 @@ async function mergeMcpJson(file, root, mcp) {
|
|
|
2702
2808
|
data.mcpServers = servers;
|
|
2703
2809
|
await writeFile(file, `${JSON.stringify(data, null, 2)}
|
|
2704
2810
|
`);
|
|
2705
|
-
writers.out(`\u2714 MCP: ${
|
|
2811
|
+
writers.out(`\u2714 MCP: ${path7.relative(root, file)}`);
|
|
2706
2812
|
}
|
|
2707
2813
|
async function ensureGitignore(root) {
|
|
2708
|
-
const file =
|
|
2709
|
-
let current2 =
|
|
2814
|
+
const file = path7.join(root, ".gitignore");
|
|
2815
|
+
let current2 = existsSync6(file) ? await readFile3(file, "utf8") : "";
|
|
2710
2816
|
const entries = [".revdeck/", ".revdeck.local.yml", ".revdeck.local.yaml"];
|
|
2711
2817
|
const added = [];
|
|
2712
2818
|
for (const entry of entries) {
|
|
@@ -2728,17 +2834,17 @@ async function installService(host) {
|
|
|
2728
2834
|
...gh ? [`REVDECK_GH=${gh}`] : []
|
|
2729
2835
|
];
|
|
2730
2836
|
const root = packageRoot();
|
|
2731
|
-
const daemon2 =
|
|
2837
|
+
const daemon2 = path7.join(root, "dist", "daemon.js");
|
|
2732
2838
|
const hostArgs = host ? ` --host ${host}` : "";
|
|
2733
|
-
if (!
|
|
2734
|
-
if (daemon2.includes(`${
|
|
2839
|
+
if (!existsSync6(daemon2)) throw new Error(tr("\u043D\u0435\u0442 dist/daemon.js: \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 npm run build", "dist/daemon.js is missing: run npm run build first"));
|
|
2840
|
+
if (daemon2.includes(`${path7.sep}_npx${path7.sep}`)) {
|
|
2735
2841
|
writers.err(tr("! \u043F\u0430\u043A\u0435\u0442 \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0447\u0435\u0440\u0435\u0437 npx: \u043F\u0443\u0442\u044C \u043A \u0434\u0435\u043C\u043E\u043D\u0443 \u043C\u043E\u0436\u0435\u0442 \u0438\u0441\u0447\u0435\u0437\u043D\u0443\u0442\u044C \u043F\u0440\u0438 \u043E\u0447\u0438\u0441\u0442\u043A\u0435 \u043A\u0435\u0448\u0430.", "! running from an npx cache: the daemon path can be evicted."));
|
|
2736
2842
|
writers.err(tr(" \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0437\u0430\u043F\u0443\u0441\u043A\u0430 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u043E: npm install -g revdeck", " install globally for auto-start: npm install -g revdeck"));
|
|
2737
2843
|
}
|
|
2738
2844
|
if (process.platform === "linux") {
|
|
2739
|
-
const dir =
|
|
2845
|
+
const dir = path7.join(process.env.XDG_CONFIG_HOME || path7.join(process.env.HOME || "", ".config"), "systemd", "user");
|
|
2740
2846
|
await mkdir2(dir, { recursive: true });
|
|
2741
|
-
const unit =
|
|
2847
|
+
const unit = path7.join(dir, "revdeck.service");
|
|
2742
2848
|
await writeFile(
|
|
2743
2849
|
unit,
|
|
2744
2850
|
[
|
|
@@ -2762,9 +2868,9 @@ async function installService(host) {
|
|
|
2762
2868
|
return unit;
|
|
2763
2869
|
}
|
|
2764
2870
|
if (process.platform === "darwin") {
|
|
2765
|
-
const dir =
|
|
2871
|
+
const dir = path7.join(process.env.HOME || "", "Library", "LaunchAgents");
|
|
2766
2872
|
await mkdir2(dir, { recursive: true });
|
|
2767
|
-
const file =
|
|
2873
|
+
const file = path7.join(dir, "io.revdeck.daemon.plist");
|
|
2768
2874
|
await writeFile(
|
|
2769
2875
|
file,
|
|
2770
2876
|
`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -2796,9 +2902,9 @@ function xmlEscape(value) {
|
|
|
2796
2902
|
|
|
2797
2903
|
// src/cli/eject.ts
|
|
2798
2904
|
init_paths();
|
|
2799
|
-
import { existsSync as
|
|
2905
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
2800
2906
|
import { lstat as lstat3, readFile as readFile5, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
|
|
2801
|
-
import
|
|
2907
|
+
import path9 from "node:path";
|
|
2802
2908
|
|
|
2803
2909
|
// src/core/jsonc.ts
|
|
2804
2910
|
function parseJsonc(text) {
|
|
@@ -2886,9 +2992,9 @@ import { applyEdits as applyEdits2, modify as modify2 } from "jsonc-parser";
|
|
|
2886
2992
|
|
|
2887
2993
|
// src/cli/devcontainer.ts
|
|
2888
2994
|
init_paths();
|
|
2889
|
-
import { existsSync as
|
|
2995
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
2890
2996
|
import { mkdir as mkdir3, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
2891
|
-
import
|
|
2997
|
+
import path8 from "node:path";
|
|
2892
2998
|
import { applyEdits, modify, parse as parseJsonc2 } from "jsonc-parser";
|
|
2893
2999
|
init_locale();
|
|
2894
3000
|
init_format();
|
|
@@ -2945,8 +3051,8 @@ function applyDevcontainerPatch(text, patch) {
|
|
|
2945
3051
|
const mounts = Array.isArray(parsed.mounts) ? [...parsed.mounts] : [];
|
|
2946
3052
|
for (const mount of patch.mounts) {
|
|
2947
3053
|
const index = mounts.findIndex((item) => isRecord2(item) && item.target === mount.target);
|
|
2948
|
-
const
|
|
2949
|
-
current2 = applyEdits(current2, modify(current2,
|
|
3054
|
+
const path12 = ["mounts", index >= 0 ? index : mounts.length];
|
|
3055
|
+
current2 = applyEdits(current2, modify(current2, path12, mount, formatting));
|
|
2950
3056
|
if (index >= 0) mounts[index] = mount;
|
|
2951
3057
|
else mounts.push(mount);
|
|
2952
3058
|
}
|
|
@@ -2972,12 +3078,12 @@ async function runDevcontainer(rootInput, options) {
|
|
|
2972
3078
|
const patch = devcontainerPatch();
|
|
2973
3079
|
await ensureDir(devcontainerRunDir());
|
|
2974
3080
|
await ensureDir(devcontainerStateDir());
|
|
2975
|
-
const dir =
|
|
2976
|
-
const file =
|
|
3081
|
+
const dir = path8.join(root, ".devcontainer");
|
|
3082
|
+
const file = path8.join(dir, "devcontainer.json");
|
|
2977
3083
|
writers.out(tr("\u041C\u043E\u0441\u0442 revdeck \u0434\u043B\u044F \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430:", "revdeck bridge for the container:"));
|
|
2978
3084
|
writers.out(` ${tr("\u0441\u043E\u043A\u0435\u0442", "socket")}: ${devcontainerRunDir()} -> ${CONTAINER_RUNTIME_DIR}`);
|
|
2979
3085
|
writers.out(` ${tr("\u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435", "state")}: ${devcontainerStateDir()} -> ${CONTAINER_STATE_DIR} (${tr("\u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u0435\u043D\u0438\u0435", "read-only")})`);
|
|
2980
|
-
if (!
|
|
3086
|
+
if (!existsSync7(devcontainerSocketPath())) {
|
|
2981
3087
|
writers.err(
|
|
2982
3088
|
tr(
|
|
2983
3089
|
"! \u0441\u043E\u043A\u0435\u0442 \u043C\u043E\u0441\u0442\u0430 \u0435\u0449\u0451 \u043D\u0435 \u0441\u043E\u0437\u0434\u0430\u043D: \u043D\u0430 \u0445\u043E\u0441\u0442\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 revdeck daemon restart",
|
|
@@ -2995,7 +3101,7 @@ async function runDevcontainer(rootInput, options) {
|
|
|
2995
3101
|
return;
|
|
2996
3102
|
}
|
|
2997
3103
|
await mkdir3(dir, { recursive: true });
|
|
2998
|
-
const existed =
|
|
3104
|
+
const existed = existsSync7(file);
|
|
2999
3105
|
let output;
|
|
3000
3106
|
if (existed) {
|
|
3001
3107
|
const text = await readFile4(file, "utf8");
|
|
@@ -3004,8 +3110,8 @@ async function runDevcontainer(rootInput, options) {
|
|
|
3004
3110
|
} catch (error) {
|
|
3005
3111
|
throw new Error(
|
|
3006
3112
|
tr(
|
|
3007
|
-
`${
|
|
3008
|
-
`${
|
|
3113
|
+
`${path8.relative(root, file)}: \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u0442\u044C JSONC (${error.message}); \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 mounts \u0432\u0440\u0443\u0447\u043D\u0443\u044E`,
|
|
3114
|
+
`${path8.relative(root, file)}: could not parse JSONC (${error.message}); add the mounts manually`
|
|
3009
3115
|
)
|
|
3010
3116
|
);
|
|
3011
3117
|
}
|
|
@@ -3015,7 +3121,7 @@ async function runDevcontainer(rootInput, options) {
|
|
|
3015
3121
|
`;
|
|
3016
3122
|
}
|
|
3017
3123
|
await writeFile2(file, output);
|
|
3018
|
-
writers.out(`\u2714 ${
|
|
3124
|
+
writers.out(`\u2714 ${path8.relative(root, file)}`);
|
|
3019
3125
|
const mcpFiles = await mergeMcpEnv(root, patch.containerEnv);
|
|
3020
3126
|
if (!mcpFiles) {
|
|
3021
3127
|
writers.out(tr(" MCP-\u043A\u043E\u043D\u0444\u0438\u0433 \u0432 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0438 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: \u0434\u043B\u044F \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0433\u043E MCP \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 REVDECK_* \u0432\u0440\u0443\u0447\u043D\u0443\u044E.", " No MCP config in the repository: add the REVDECK_* variables to a user-level MCP manually."));
|
|
@@ -3031,8 +3137,8 @@ async function runDevcontainer(rootInput, options) {
|
|
|
3031
3137
|
async function mergeMcpEnv(root, env) {
|
|
3032
3138
|
let changed = 0;
|
|
3033
3139
|
for (const relative of [".mcp.json", ".cursor/mcp.json"]) {
|
|
3034
|
-
const file =
|
|
3035
|
-
if (!
|
|
3140
|
+
const file = path8.join(root, relative);
|
|
3141
|
+
if (!existsSync7(file)) continue;
|
|
3036
3142
|
try {
|
|
3037
3143
|
const data = JSON.parse(await readFile4(file, "utf8"));
|
|
3038
3144
|
const servers = isRecord2(data.mcpServers) ? data.mcpServers : null;
|
|
@@ -3070,13 +3176,13 @@ async function runEject(rootInput, options) {
|
|
|
3070
3176
|
const warnings = [];
|
|
3071
3177
|
if (!options.keepConfig) {
|
|
3072
3178
|
for (const name of CONFIG_FILES2) {
|
|
3073
|
-
const file =
|
|
3074
|
-
if (
|
|
3179
|
+
const file = path9.join(root, name);
|
|
3180
|
+
if (existsSync8(file)) changes.push({ path: name, action: tr("\u0443\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u043E\u043D\u0444\u0438\u0433", "remove config"), remove: () => rm2(file, { force: true }) });
|
|
3075
3181
|
}
|
|
3076
3182
|
}
|
|
3077
3183
|
for (const name of SKILL_DIRS) {
|
|
3078
|
-
const target =
|
|
3079
|
-
if (!
|
|
3184
|
+
const target = path9.join(root, name);
|
|
3185
|
+
if (!existsSync8(target)) continue;
|
|
3080
3186
|
const managed = await isManagedSkill(target);
|
|
3081
3187
|
if (!managed) {
|
|
3082
3188
|
warnings.push(`${name}: ${tr("\u0441\u043A\u0438\u043B\u043B \u043D\u0435 \u043F\u043E\u0445\u043E\u0436 \u043D\u0430 revdeck \u2014 \u043E\u0441\u0442\u0430\u0432\u043B\u044F\u044E", "does not look like the revdeck skill \u2014 leaving it")}`);
|
|
@@ -3085,8 +3191,8 @@ async function runEject(rootInput, options) {
|
|
|
3085
3191
|
changes.push({ path: name, action: tr("\u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u043A\u0438\u043B\u043B", "remove skill"), remove: () => rm2(target, { recursive: true, force: true }) });
|
|
3086
3192
|
}
|
|
3087
3193
|
for (const name of COMMAND_FILES) {
|
|
3088
|
-
const file =
|
|
3089
|
-
if (!
|
|
3194
|
+
const file = path9.join(root, name);
|
|
3195
|
+
if (!existsSync8(file)) continue;
|
|
3090
3196
|
const text = await readFile5(file, "utf8").catch(() => "");
|
|
3091
3197
|
if (!/revdeck/i.test(text)) {
|
|
3092
3198
|
warnings.push(`${name}: ${tr("\u0444\u0430\u0439\u043B \u043D\u0435 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442 revdeck \u2014 \u043E\u0441\u0442\u0430\u0432\u043B\u044F\u044E", "file does not mention revdeck \u2014 leaving it")}`);
|
|
@@ -3095,8 +3201,8 @@ async function runEject(rootInput, options) {
|
|
|
3095
3201
|
changes.push({ path: name, action: tr("\u0443\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u043E\u043C\u0430\u043D\u0434\u0443", "remove command"), remove: () => rm2(file, { force: true }) });
|
|
3096
3202
|
}
|
|
3097
3203
|
for (const name of MCP_FILES) {
|
|
3098
|
-
const file =
|
|
3099
|
-
if (!
|
|
3204
|
+
const file = path9.join(root, name);
|
|
3205
|
+
if (!existsSync8(file)) continue;
|
|
3100
3206
|
const text = await readFile5(file, "utf8").catch(() => "");
|
|
3101
3207
|
let data;
|
|
3102
3208
|
try {
|
|
@@ -3117,8 +3223,8 @@ async function runEject(rootInput, options) {
|
|
|
3117
3223
|
}
|
|
3118
3224
|
});
|
|
3119
3225
|
}
|
|
3120
|
-
const devcontainer =
|
|
3121
|
-
if (
|
|
3226
|
+
const devcontainer = path9.join(root, ".devcontainer", "devcontainer.json");
|
|
3227
|
+
if (existsSync8(devcontainer)) {
|
|
3122
3228
|
const text = await readFile5(devcontainer, "utf8");
|
|
3123
3229
|
try {
|
|
3124
3230
|
const parsed = parseJsonc(text);
|
|
@@ -3163,12 +3269,12 @@ async function runEject(rootInput, options) {
|
|
|
3163
3269
|
warnings.push(`.devcontainer/devcontainer.json: ${tr("\u043D\u0435 JSONC \u2014 \u043D\u0435 \u0442\u0440\u043E\u0433\u0430\u044E", "not JSONC \u2014 leaving it untouched")}`);
|
|
3164
3270
|
}
|
|
3165
3271
|
}
|
|
3166
|
-
const cache =
|
|
3167
|
-
if (
|
|
3272
|
+
const cache = path9.join(root, ".revdeck");
|
|
3273
|
+
if (existsSync8(cache)) {
|
|
3168
3274
|
changes.push({ path: ".revdeck/", action: tr("\u0443\u0434\u0430\u043B\u0438\u0442\u044C \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u0435\u0448", "remove local cache"), remove: () => rm2(cache, { recursive: true, force: true }) });
|
|
3169
3275
|
}
|
|
3170
|
-
const gitignore =
|
|
3171
|
-
if (
|
|
3276
|
+
const gitignore = path9.join(root, ".gitignore");
|
|
3277
|
+
if (existsSync8(gitignore)) {
|
|
3172
3278
|
const text = await readFile5(gitignore, "utf8");
|
|
3173
3279
|
if (/(^|\n)\.revdeck\/?\s*(\n|$)/.test(text)) {
|
|
3174
3280
|
changes.push({
|
|
@@ -3205,8 +3311,8 @@ async function isManagedSkill(target) {
|
|
|
3205
3311
|
const info = await lstat3(target);
|
|
3206
3312
|
if (info.isSymbolicLink()) return true;
|
|
3207
3313
|
if (!info.isDirectory()) return false;
|
|
3208
|
-
const skill =
|
|
3209
|
-
if (!
|
|
3314
|
+
const skill = path9.join(target, "SKILL.md");
|
|
3315
|
+
if (!existsSync8(skill)) return false;
|
|
3210
3316
|
const text = await readFile5(skill, "utf8");
|
|
3211
3317
|
return /^name:\s*revdeck\s*$/m.test(text) || /revdeck/i.test(text.slice(0, 2e3));
|
|
3212
3318
|
} catch {
|
|
@@ -3219,7 +3325,7 @@ init_client();
|
|
|
3219
3325
|
init_format();
|
|
3220
3326
|
init_locale();
|
|
3221
3327
|
import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile4 } from "node:fs/promises";
|
|
3222
|
-
import
|
|
3328
|
+
import path10 from "node:path";
|
|
3223
3329
|
async function reviewFor(client2, root, arg) {
|
|
3224
3330
|
if (arg && /^(gitlab|github):/.test(arg)) {
|
|
3225
3331
|
const { review } = await client2.request("reviews.get", { review: arg });
|
|
@@ -3275,12 +3381,12 @@ async function exportReview(root, arg, dir) {
|
|
|
3275
3381
|
const { client: client2 } = await ensureDaemon();
|
|
3276
3382
|
try {
|
|
3277
3383
|
const review = await reviewFor(client2, root, arg);
|
|
3278
|
-
const target =
|
|
3384
|
+
const target = path10.resolve(root, dir);
|
|
3279
3385
|
await mkdir4(target, { recursive: true });
|
|
3280
3386
|
const base = `mr-${review.info.ref.number}`;
|
|
3281
3387
|
const files = [];
|
|
3282
3388
|
const write = async (name, data) => {
|
|
3283
|
-
const file =
|
|
3389
|
+
const file = path10.join(target, name);
|
|
3284
3390
|
await writeFile4(file, `${JSON.stringify(data, null, 2)}
|
|
3285
3391
|
`, { mode: 420 });
|
|
3286
3392
|
files.push(name);
|
|
@@ -3346,9 +3452,9 @@ async function exportReview(root, arg, dir) {
|
|
|
3346
3452
|
}
|
|
3347
3453
|
}
|
|
3348
3454
|
await write(`${base}-published.json`, published);
|
|
3349
|
-
await writeFile4(
|
|
3455
|
+
await writeFile4(path10.join(target, `${base}.diff`), await serializeDiff(client2, review), { mode: 420 });
|
|
3350
3456
|
files.push(`${base}.diff`);
|
|
3351
|
-
writers.out(`${tr("\u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0432", "exported to")} ${
|
|
3457
|
+
writers.out(`${tr("\u044D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0432", "exported to")} ${path10.relative(root, target)}: ${files.join(", ")}`);
|
|
3352
3458
|
} finally {
|
|
3353
3459
|
client2.close();
|
|
3354
3460
|
}
|
|
@@ -3357,11 +3463,11 @@ async function importReview(root, arg, dir) {
|
|
|
3357
3463
|
const { client: client2 } = await ensureDaemon();
|
|
3358
3464
|
try {
|
|
3359
3465
|
const review = await reviewFor(client2, root, arg);
|
|
3360
|
-
const target =
|
|
3466
|
+
const target = path10.resolve(root, dir);
|
|
3361
3467
|
const base = `mr-${review.info.ref.number}`;
|
|
3362
3468
|
const read = async (name) => {
|
|
3363
3469
|
try {
|
|
3364
|
-
return JSON.parse(await readFile6(
|
|
3470
|
+
return JSON.parse(await readFile6(path10.join(target, name), "utf8"));
|
|
3365
3471
|
} catch {
|
|
3366
3472
|
return null;
|
|
3367
3473
|
}
|
|
@@ -3466,6 +3572,7 @@ var OPTIONS = {
|
|
|
3466
3572
|
review: { type: "string" },
|
|
3467
3573
|
root: { type: "string" },
|
|
3468
3574
|
platform: { type: "string" },
|
|
3575
|
+
provider: { type: "string" },
|
|
3469
3576
|
project: { type: "string" },
|
|
3470
3577
|
host: { type: "string" },
|
|
3471
3578
|
branch: { type: "string" },
|
|
@@ -3520,7 +3627,7 @@ function parse(argv) {
|
|
|
3520
3627
|
}
|
|
3521
3628
|
var HELP_RU = `revdeck ${VERSION} \u2014 \u0440\u0435\u0432\u044C\u044E GitLab/GitHub \u0434\u043B\u044F \u043B\u044E\u0434\u0435\u0439 \u0438 \u0430\u0433\u0435\u043D\u0442\u043E\u0432
|
|
3522
3629
|
|
|
3523
|
-
revdeck init \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442: .revdeck.yml, \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u044B, MCP
|
|
3630
|
+
revdeck init \u043D\u0430\u0441\u0442\u0440\u043E\u0438\u0442\u044C \u043F\u0440\u043E\u0435\u043A\u0442: .revdeck.yml, \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u044B, MCP [--provider gitlab|github|auto]
|
|
3524
3631
|
revdeck eject \u0443\u0434\u0430\u043B\u0438\u0442\u044C revdeck \u0438\u0437 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 (--yes; --keep-config)
|
|
3525
3632
|
revdeck devcontainer \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C devcontainer \u043A \u0434\u0435\u043C\u043E\u043D\u0443 \u0445\u043E\u0441\u0442\u0430 (--write)
|
|
3526
3633
|
revdeck doctor \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043E\u043A\u0440\u0443\u0436\u0435\u043D\u0438\u0435 \u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u044B
|
|
@@ -3544,17 +3651,18 @@ var HELP_RU = `revdeck ${VERSION} \u2014 \u0440\u0435\u0432\u044C\u044E GitLab/G
|
|
|
3544
3651
|
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
|
|
3545
3652
|
revdeck publish <N> [--kind reply|finding|note] [--ids a,b] [--yes]
|
|
3546
3653
|
revdeck rules [<N>] [--explain <\u043F\u0443\u0442\u044C>]
|
|
3547
|
-
revdeck checks <N> [--run --yes]
|
|
3654
|
+
revdeck checks <N> [--run --yes] \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438: \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043D\u0430 \u0445\u043E\u0441\u0442\u0435/\u0432 UI
|
|
3548
3655
|
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
|
|
3549
3656
|
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
|
|
3550
3657
|
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
|
|
3551
3658
|
revdeck mcp \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C MCP-\u0441\u0435\u0440\u0432\u0435\u0440 (stdio)
|
|
3552
3659
|
|
|
3553
3660
|
\u041E\u0431\u0449\u0438\u0435 \u0444\u043B\u0430\u0433\u0438: --json, --root <\u043F\u0443\u0442\u044C>, --review <id>, --lang ru|en, --help.
|
|
3554
|
-
\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F \
|
|
3661
|
+
\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F, checks \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
|
|
3662
|
+
\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.`;
|
|
3555
3663
|
var HELP_EN = `revdeck ${VERSION} \u2014 code review for GitLab/GitHub, for humans and agents
|
|
3556
3664
|
|
|
3557
|
-
revdeck init set up a project: .revdeck.yml, adapters, MCP
|
|
3665
|
+
revdeck init set up a project: .revdeck.yml, adapters, MCP [--provider gitlab|github|auto]
|
|
3558
3666
|
revdeck eject remove revdeck from the project (--yes; --keep-config)
|
|
3559
3667
|
revdeck devcontainer connect a devcontainer to the host daemon (--write)
|
|
3560
3668
|
revdeck doctor check the environment and access
|
|
@@ -3578,14 +3686,15 @@ var HELP_EN = `revdeck ${VERSION} \u2014 code review for GitLab/GitHub, for huma
|
|
|
3578
3686
|
revdeck attach <N> --file <path> upload an image/video to the platform
|
|
3579
3687
|
revdeck publish <N> [--kind reply|finding|note] [--ids a,b] [--yes]
|
|
3580
3688
|
revdeck rules [<N>] [--explain <path>]
|
|
3581
|
-
revdeck checks <N> [--run --yes]
|
|
3689
|
+
revdeck checks <N> [--run --yes] checks run by a human on the host/UI only
|
|
3582
3690
|
revdeck export <N> [--dir .revdeck] export to the legacy file format
|
|
3583
3691
|
revdeck import <N> [--dir .revdeck] import from the legacy format
|
|
3584
3692
|
revdeck config [--json] effective project config
|
|
3585
3693
|
revdeck mcp start the MCP server (stdio)
|
|
3586
3694
|
|
|
3587
3695
|
Common flags: --json, --root <path>, --review <id>, --lang ru|en, --help.
|
|
3588
|
-
Publishing
|
|
3696
|
+
Publishing, checks and administration are human-only: the agent bridge gets CAPABILITY and the
|
|
3697
|
+
container CLI refuses --run/--yes. Publishing never happens without --yes.`;
|
|
3589
3698
|
var helpText = () => tr(HELP_RU, HELP_EN);
|
|
3590
3699
|
async function main2() {
|
|
3591
3700
|
const argv = process.argv.slice(2);
|
|
@@ -3607,9 +3716,49 @@ async function main2() {
|
|
|
3607
3716
|
return;
|
|
3608
3717
|
}
|
|
3609
3718
|
const root = String(values.root ?? findRepoRoot());
|
|
3719
|
+
if (isDevContainer()) {
|
|
3720
|
+
const featureAction = command === "feature" ? positionals[0] ?? "list" : "";
|
|
3721
|
+
const projectAction = command === "projects" ? positionals[0] ?? "list" : "";
|
|
3722
|
+
if (command === "checks" && values.run === true) {
|
|
3723
|
+
fail(
|
|
3724
|
+
tr("checks \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442 \u0447\u0435\u043B\u043E\u0432\u0435\u043A \u043D\u0430 \u0445\u043E\u0441\u0442\u0435 \u0438\u043B\u0438 \u0432 UI: \u0430\u0433\u0435\u043D\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0437\u0430\u043F\u0443\u0441\u043A", "checks are run by a human on the host or in the UI: an agent cannot confirm execution"),
|
|
3725
|
+
tr("\u043F\u043E\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u043B\u0430\u043D \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0443; \u0437\u0430\u043F\u0443\u0441\u043A \u2014 \u0432 UI \u0438\u043B\u0438 `revdeck checks --run --yes` \u043D\u0430 \u0445\u043E\u0441\u0442\u0435", "show the checks plan to the human; run it in the UI or `revdeck checks --run --yes` on the host")
|
|
3726
|
+
);
|
|
3727
|
+
}
|
|
3728
|
+
if ((command === "publish" || command === "reply") && values.yes === true && values["dry-run"] !== true) {
|
|
3729
|
+
fail(
|
|
3730
|
+
tr("\u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0430: \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 UI \u043D\u0430 \u0445\u043E\u0441\u0442\u0435", "publishing is a human action: use the UI on the host"),
|
|
3731
|
+
tr("\u0438\u0437 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430 \u0430\u0433\u0435\u043D\u0442 \u043C\u043E\u0436\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u043B\u0430\u043D (--dry-run)", "from a container an agent can only show the plan (--dry-run)")
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
if (command === "feature" && ["create", "update", "archive", "delete", "add", "remove", "reorder", "note", "note-delete"].includes(featureAction)) {
|
|
3735
|
+
fail(
|
|
3736
|
+
tr("\u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0447 \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0430 \u043D\u0430 \u0445\u043E\u0441\u0442\u0435/\u0432 UI", "feature administration is a human action on the host/UI"),
|
|
3737
|
+
tr("\u0432 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u0435\u043D\u0438\u0435 \u0444\u0438\u0447 \u0438 feature-\u0437\u0430\u043C\u0435\u0442\u043A\u0438 \u0447\u0435\u0440\u0435\u0437 MCP", "in a container only feature reading and feature notes via MCP are available")
|
|
3738
|
+
);
|
|
3739
|
+
}
|
|
3740
|
+
if (command === "projects" && ["update", "remove", "delete"].includes(projectAction)) {
|
|
3741
|
+
fail(
|
|
3742
|
+
tr("\u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432 \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0435\u043B\u043E\u0432\u0435\u043A\u0430 \u043D\u0430 \u0445\u043E\u0441\u0442\u0435/\u0432 UI", "project administration is a human action on the host/UI"),
|
|
3743
|
+
tr("\u0432 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432", "in a container only the project list is available")
|
|
3744
|
+
);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3610
3747
|
switch (command) {
|
|
3611
|
-
case "init":
|
|
3612
|
-
|
|
3748
|
+
case "init": {
|
|
3749
|
+
const provider = values.provider === void 0 ? void 0 : String(values.provider);
|
|
3750
|
+
if (provider && provider !== "auto" && provider !== "gitlab" && provider !== "github") {
|
|
3751
|
+
fail(tr(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440: ${provider}`, `unknown provider: ${provider}`), tr("\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E: auto, gitlab, github", "allowed: auto, gitlab, github"));
|
|
3752
|
+
}
|
|
3753
|
+
return runInit(root, {
|
|
3754
|
+
force: values.force === true,
|
|
3755
|
+
adapters: parseList(values.adapters),
|
|
3756
|
+
noService: values["no-service"] === true,
|
|
3757
|
+
locale: values.lang === "ru" || values.lang === "en" ? values.lang : detectLocale(),
|
|
3758
|
+
outputLanguage: values.lang === "ru" || values.lang === "en" ? values.lang : "auto",
|
|
3759
|
+
...provider ? { provider } : {}
|
|
3760
|
+
});
|
|
3761
|
+
}
|
|
3613
3762
|
case "eject":
|
|
3614
3763
|
return runEject(root, { yes: values.yes === true && values["dry-run"] !== true, keepConfig: values["keep-config"] === true });
|
|
3615
3764
|
case "devcontainer":
|
|
@@ -3990,6 +4139,12 @@ async function ui(arg, values) {
|
|
|
3990
4139
|
});
|
|
3991
4140
|
const info = await daemonInfo();
|
|
3992
4141
|
if (!info) fail(tr("\u0434\u0435\u043C\u043E\u043D \u043D\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D", "the daemon is not running"), "revdeck daemon start");
|
|
4142
|
+
if (!info.token) {
|
|
4143
|
+
fail(
|
|
4144
|
+
tr("UI-\u0442\u043E\u043A\u0435\u043D \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u0445\u043E\u0441\u0442\u0435: \u0432 \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0435 \u043E\u043D \u043D\u0435 \u043F\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044F", "the UI token is available on the host only: it is not passed into the container"),
|
|
4145
|
+
tr("\u043E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 `revdeck ui` \u043D\u0430 \u0445\u043E\u0441\u0442\u0435", "run `revdeck ui` on the host")
|
|
4146
|
+
);
|
|
4147
|
+
}
|
|
3993
4148
|
const url = `${uiBaseUrl(info)}/?t=${info.token}`;
|
|
3994
4149
|
writers.out(url);
|
|
3995
4150
|
if (values.open) openBrowser(url);
|
|
@@ -3997,6 +4152,9 @@ async function ui(arg, values) {
|
|
|
3997
4152
|
function printUi(reviewId2, values) {
|
|
3998
4153
|
const info = daemonInfoSync();
|
|
3999
4154
|
if (!info) return writers.err(tr("\u0434\u0435\u043C\u043E\u043D \u043D\u0435 \u0437\u0430\u043F\u0443\u0449\u0435\u043D: revdeck daemon start", "the daemon is not running: revdeck daemon start"));
|
|
4155
|
+
if (!info.token) {
|
|
4156
|
+
return writers.err(tr("UI-\u0442\u043E\u043A\u0435\u043D \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u0445\u043E\u0441\u0442\u0435: \u043E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 `revdeck ui` \u043D\u0430 \u0445\u043E\u0441\u0442\u0435", "the UI token is available on the host only: run `revdeck ui` on the host"));
|
|
4157
|
+
}
|
|
4000
4158
|
const url = `${uiBaseUrl(info)}/?t=${info.token}${reviewId2 ? `&review=${encodeURIComponent(reviewId2)}` : ""}`;
|
|
4001
4159
|
writers.out(`UI: ${url}`);
|
|
4002
4160
|
if (values.open) openBrowser(url);
|
|
@@ -4328,11 +4486,11 @@ async function react(arg, values) {
|
|
|
4328
4486
|
}
|
|
4329
4487
|
async function attach(arg, values) {
|
|
4330
4488
|
if (!values.file) fail(tr("\u0443\u043A\u0430\u0436\u0438\u0442\u0435 --file \u0441 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u043E\u0439 \u0438\u043B\u0438 \u0432\u0438\u0434\u0435\u043E", "pass --file with an image or video"));
|
|
4331
|
-
const name =
|
|
4489
|
+
const name = path11.basename(String(values.file));
|
|
4332
4490
|
const spec = attachmentSpec(name);
|
|
4333
4491
|
if (!spec) fail(tr("\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u044B PNG, JPEG, GIF, WebP, AVIF, MP4, WebM, OGV \u0438 MOV", "PNG, JPEG, GIF, WebP, AVIF, MP4, WebM, OGV and MOV are allowed"));
|
|
4334
4492
|
const file = String(values.file);
|
|
4335
|
-
const info = await
|
|
4493
|
+
const info = await stat2(file).catch(() => null);
|
|
4336
4494
|
if (!info?.isFile()) fail(tr(`\u043D\u0435\u0442 \u0444\u0430\u0439\u043B\u0430 ${file}`, `file ${file} does not exist`));
|
|
4337
4495
|
if (info.size > MAX_ATTACHMENT_BYTES) {
|
|
4338
4496
|
fail(tr(`\u0444\u0430\u0439\u043B \u0431\u043E\u043B\u044C\u0448\u0435 ${Math.floor(MAX_ATTACHMENT_BYTES / (1024 * 1024))} \u041C\u0411`, `file is larger than ${Math.floor(MAX_ATTACHMENT_BYTES / (1024 * 1024))} MB`));
|
|
@@ -4433,6 +4591,18 @@ async function checks(root, arg, values) {
|
|
|
4433
4591
|
await withClient(async ({ client: client2 }) => {
|
|
4434
4592
|
const { review } = await resolveReview(client2, root, reviewArg(values, arg), values);
|
|
4435
4593
|
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"));
|
|
4594
|
+
if (!values.json) {
|
|
4595
|
+
const { rules: plan } = await client2.request("rules.get", {
|
|
4596
|
+
review: review.id
|
|
4597
|
+
});
|
|
4598
|
+
const ids = values.ids ? parseList(values.ids) : null;
|
|
4599
|
+
const selected = plan.checks.filter((check) => ids ? ids.includes(check.id) : check.matched);
|
|
4600
|
+
if (selected.length) {
|
|
4601
|
+
writers.out(tr("\u041A\u043E\u043C\u0430\u043D\u0434\u044B \u043F\u0440\u043E\u0432\u0435\u0440\u043E\u043A:", "Check commands:"));
|
|
4602
|
+
for (const check of selected) writers.out(` ${check.id}: ${check.argv.join(" ")}`);
|
|
4603
|
+
writers.out("");
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4436
4606
|
const { results } = await client2.request("checks.run", {
|
|
4437
4607
|
review: review.id,
|
|
4438
4608
|
allowRun: values.run === true && values.yes === true,
|
|
@@ -4548,8 +4718,8 @@ async function doctor(root) {
|
|
|
4548
4718
|
]);
|
|
4549
4719
|
}
|
|
4550
4720
|
}
|
|
4551
|
-
const { existsSync:
|
|
4552
|
-
const skill =
|
|
4721
|
+
const { existsSync: existsSync9 } = await import("node:fs");
|
|
4722
|
+
const skill = existsSync9(path11.join(root, ".agents", "skills", "revdeck", "SKILL.md")) || existsSync9(path11.join(root, ".claude", "skills", "revdeck", "SKILL.md")) || existsSync9(path11.join(root, ".cursor", "commands", "revdeck.md"));
|
|
4553
4723
|
rows.push(["adapter", skill ? "ok" : "warn", skill ? tr("\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D", "installed") : tr("\u043D\u0435\u0442: revdeck init", "missing: revdeck init")]);
|
|
4554
4724
|
for (const [name, status2, detail] of rows) {
|
|
4555
4725
|
writers.out(`${status2 === "ok" ? "\u2714" : status2 === "warn" ? "!" : "\u2716"} ${name.padEnd(10)} ${detail}`);
|