revdeck 0.6.0 → 0.8.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 +66 -1
- package/CONTRIBUTING.md +5 -1
- package/README.md +57 -17
- package/README.ru.md +59 -21
- package/SECURITY.md +1 -1
- package/dist/cli.js +485 -263
- package/dist/cli.js.map +4 -4
- package/dist/daemon.js +428 -121
- package/dist/daemon.js.map +4 -4
- package/dist/mcp.js +76 -28
- 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 +23 -11
- package/docs/configuration.md +25 -8
- package/docs/integrations.md +30 -16
- 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 +24 -10
- package/docs/ru/configuration.md +21 -6
- package/docs/ru/integrations.md +29 -16
- 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 +5 -2
- 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/mcp.js
CHANGED
|
@@ -89,18 +89,11 @@ var init_errors = __esm({
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// src/core/types.ts
|
|
93
|
-
var init_types = __esm({
|
|
94
|
-
"src/core/types.ts"() {
|
|
95
|
-
"use strict";
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
92
|
// src/core/exec.ts
|
|
100
93
|
import { execFile } from "node:child_process";
|
|
101
94
|
import { access, constants as constants2 } from "node:fs/promises";
|
|
102
95
|
import os2 from "node:os";
|
|
103
|
-
import
|
|
96
|
+
import path3 from "node:path";
|
|
104
97
|
function scrubEnv(extra) {
|
|
105
98
|
const env = {};
|
|
106
99
|
for (const [key, value] of Object.entries(process.env)) {
|
|
@@ -130,11 +123,11 @@ async function resolveExecutable(command) {
|
|
|
130
123
|
const cached = RESOLVED.get(command);
|
|
131
124
|
if (cached) return cached;
|
|
132
125
|
const dirs = [
|
|
133
|
-
...(process.env.PATH ?? "").split(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
...(process.env.PATH ?? "").split(path3.delimiter),
|
|
127
|
+
path3.join(os2.homedir(), ".local", "bin"),
|
|
128
|
+
path3.join(os2.homedir(), ".local", "share", "mise", "shims"),
|
|
129
|
+
path3.join(os2.homedir(), ".asdf", "shims"),
|
|
130
|
+
path3.join(os2.homedir(), ".npm-global", "bin"),
|
|
138
131
|
"/opt/homebrew/bin",
|
|
139
132
|
"/usr/local/bin",
|
|
140
133
|
"/usr/bin",
|
|
@@ -143,7 +136,7 @@ async function resolveExecutable(command) {
|
|
|
143
136
|
const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
|
|
144
137
|
for (const dir of [...new Set(dirs)]) {
|
|
145
138
|
for (const extension of extensions) {
|
|
146
|
-
const candidate =
|
|
139
|
+
const candidate = path3.join(dir, `${command}${extension}`);
|
|
147
140
|
try {
|
|
148
141
|
await access(candidate, constants2.X_OK);
|
|
149
142
|
RESOLVED.set(command, candidate);
|
|
@@ -205,6 +198,13 @@ var init_exec = __esm({
|
|
|
205
198
|
}
|
|
206
199
|
});
|
|
207
200
|
|
|
201
|
+
// src/core/types.ts
|
|
202
|
+
var init_types = __esm({
|
|
203
|
+
"src/core/types.ts"() {
|
|
204
|
+
"use strict";
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
208
|
// src/mcp/main.ts
|
|
209
209
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
210
210
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -220,7 +220,7 @@ import { fileURLToPath } from "node:url";
|
|
|
220
220
|
|
|
221
221
|
// src/core/paths.ts
|
|
222
222
|
import { constants, existsSync } from "node:fs";
|
|
223
|
-
import { lstat, mkdir, open, realpath, rename, unlink } from "node:fs/promises";
|
|
223
|
+
import { lstat, mkdir, open, realpath, rename, stat, unlink } from "node:fs/promises";
|
|
224
224
|
import path from "node:path";
|
|
225
225
|
import os from "node:os";
|
|
226
226
|
function findRepoRoot(start = process.cwd()) {
|
|
@@ -232,6 +232,15 @@ function findRepoRoot(start = process.cwd()) {
|
|
|
232
232
|
dir = parent;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
function toHostRoot(root, hostRoot = process.env.REVDECK_HOST_ROOT, containerRoot = findRepoRoot()) {
|
|
236
|
+
const resolved = path.resolve(root);
|
|
237
|
+
const target = hostRoot?.trim();
|
|
238
|
+
if (!target) return resolved;
|
|
239
|
+
const relative = path.relative(path.resolve(containerRoot), resolved);
|
|
240
|
+
if (relative === "") return path.resolve(target);
|
|
241
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) return resolved;
|
|
242
|
+
return path.join(path.resolve(target), relative);
|
|
243
|
+
}
|
|
235
244
|
var CONFIG_FILES = [".revdeck.yml", ".revdeck.yaml"];
|
|
236
245
|
var LOCAL_CONFIG_FILES = [".revdeck.local.yml", ".revdeck.local.yaml"];
|
|
237
246
|
function findConfigFile(root) {
|
|
@@ -279,7 +288,7 @@ async function readTextNoFollow(file, maxBytes = 4 * 1024 * 1024) {
|
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
// src/version.ts
|
|
282
|
-
var VERSION = "0.
|
|
291
|
+
var VERSION = "0.8.0";
|
|
283
292
|
|
|
284
293
|
// src/client.ts
|
|
285
294
|
var RpcError = class extends Error {
|
|
@@ -405,16 +414,17 @@ function devcontainerHint() {
|
|
|
405
414
|
return [
|
|
406
415
|
"\u0434\u0435\u043C\u043E\u043D revdeck \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u043D\u0430 \u0445\u043E\u0441\u0442\u0435",
|
|
407
416
|
"\u043D\u0430 \u0445\u043E\u0441\u0442\u0435: revdeck daemon start",
|
|
408
|
-
`\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435
|
|
417
|
+
`\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 mount \u0441\u043E\u043A\u0435\u0442\u0430 \u0438\u0437 revdeck devcontainer --write: ${runtime} (state: ${state})`,
|
|
418
|
+
"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",
|
|
409
419
|
"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"
|
|
410
420
|
].join("; ");
|
|
411
421
|
}
|
|
412
422
|
async function devcontainerHttpClient() {
|
|
413
423
|
const { info, error } = await daemonInfoRead();
|
|
414
424
|
if (!info) return { client: null, error: `${daemonInfoPath()}: ${error}` };
|
|
415
|
-
if (!info.port || !info.
|
|
425
|
+
if (!info.port || !info.agentToken) return { client: null, error: `${daemonInfoPath()}: \u043D\u0435\u0442 port/agentToken` };
|
|
416
426
|
const host = process.env.REVDECK_UI_HOST ?? "host.docker.internal";
|
|
417
|
-
return { client: new HttpClient(`http://${host}:${info.port}`, info.
|
|
427
|
+
return { client: new HttpClient(`http://${host}:${info.port}`, info.agentToken), error: "" };
|
|
418
428
|
}
|
|
419
429
|
async function ensureDaemon(options = {}) {
|
|
420
430
|
const url = process.env.REVDECK_URL;
|
|
@@ -436,11 +446,11 @@ async function ensureDaemon(options = {}) {
|
|
|
436
446
|
throw new RpcError(
|
|
437
447
|
`devcontainer HTTP: ${httpError.message}`,
|
|
438
448
|
"DEVCONTAINER",
|
|
439
|
-
"\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; \
|
|
449
|
+
"\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"
|
|
440
450
|
);
|
|
441
451
|
}
|
|
442
452
|
}
|
|
443
|
-
throw new RpcError(`devcontainer: ${http.error || devcontainerHint()}`, "DEVCONTAINER", "\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \
|
|
453
|
+
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");
|
|
444
454
|
}
|
|
445
455
|
if (options.autoStart === false) throw error;
|
|
446
456
|
}
|
|
@@ -844,8 +854,23 @@ import { z } from "zod";
|
|
|
844
854
|
init_errors();
|
|
845
855
|
import { parse as parseYaml } from "yaml";
|
|
846
856
|
import { existsSync as existsSync3 } from "node:fs";
|
|
847
|
-
import
|
|
857
|
+
import path4 from "node:path";
|
|
848
858
|
init_locale();
|
|
859
|
+
|
|
860
|
+
// src/core/git-files.ts
|
|
861
|
+
init_exec();
|
|
862
|
+
async function gitTrackState(root, relative) {
|
|
863
|
+
try {
|
|
864
|
+
const { stdout } = await run("git", ["-C", root, "ls-files", "--error-unmatch", "--", relative], {
|
|
865
|
+
timeoutMs: 1e4
|
|
866
|
+
});
|
|
867
|
+
return stdout.trim() ? "tracked" : "unknown";
|
|
868
|
+
} catch (error) {
|
|
869
|
+
return error.code === 1 ? "untracked" : "unknown";
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// src/core/config.ts
|
|
849
874
|
var matchSchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);
|
|
850
875
|
var customRoleSchema = z.object({
|
|
851
876
|
title: z.string().min(1).max(120),
|
|
@@ -982,10 +1007,30 @@ function mergeConfigData(base, local) {
|
|
|
982
1007
|
}
|
|
983
1008
|
async function loadConfig(root = findRepoRoot()) {
|
|
984
1009
|
const warnings = [];
|
|
1010
|
+
if (!existsSync3(root)) {
|
|
1011
|
+
warnings.push(
|
|
1012
|
+
tr(
|
|
1013
|
+
`\u043A\u0430\u0442\u0430\u043B\u043E\u0433 ${root} \u043D\u0435 \u0432\u0438\u0434\u0435\u043D \u0442\u043E\u043C\u0443, \u043A\u0442\u043E \u0447\u0438\u0442\u0430\u0435\u0442 \u043A\u043E\u043D\u0444\u0438\u0433: \u0432 devcontainer \u0434\u0435\u043C\u043E\u043D \u043D\u0430 \u0445\u043E\u0441\u0442\u0435 \u043D\u0435 \u0432\u0438\u0434\u0438\u0442 \u043F\u0443\u0442\u044C \u043A\u043E\u043D\u0442\u0435\u0439\u043D\u0435\u0440\u0430 \u2014 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 revdeck devcontainer --write \u0438\u043B\u0438 \u0437\u0430\u0434\u0430\u0439\u0442\u0435 REVDECK_HOST_ROOT`,
|
|
1014
|
+
`the directory ${root} is not visible to the config reader: in a devcontainer the host daemon cannot see the container path \u2014 run revdeck devcontainer --write or set REVDECK_HOST_ROOT`
|
|
1015
|
+
)
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
985
1018
|
const file = findConfigFile(root);
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1019
|
+
let localFile = findLocalConfigFile(root);
|
|
1020
|
+
if (localFile && existsSync3(path4.join(root, ".git"))) {
|
|
1021
|
+
const state = await gitTrackState(root, path4.relative(root, localFile));
|
|
1022
|
+
if (state !== "untracked") {
|
|
1023
|
+
warnings.push(
|
|
1024
|
+
tr(
|
|
1025
|
+
".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",
|
|
1026
|
+
".revdeck.local.yml is tracked by git: a repository file is ignored as personal overrides"
|
|
1027
|
+
)
|
|
1028
|
+
);
|
|
1029
|
+
localFile = null;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
const baseData = file ? parseYamlData(await readTextNoFollow(file), path4.relative(root, file) || file) : {};
|
|
1033
|
+
const localData = localFile ? parseYamlData(await readTextNoFollow(localFile), path4.relative(root, localFile) || localFile) : {};
|
|
989
1034
|
if (!file && !localFile) {
|
|
990
1035
|
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"));
|
|
991
1036
|
}
|
|
@@ -995,7 +1040,7 @@ async function loadConfig(root = findRepoRoot()) {
|
|
|
995
1040
|
const localReadOnly = isRecord(localData) && isRecord(localData.review) && localData.review.readOnly === true;
|
|
996
1041
|
config.review.readOnly = baseReadOnly || localReadOnly;
|
|
997
1042
|
if (!config.rules.sources.length && !config.rules.map.length) {
|
|
998
|
-
const found = DISCOVERED_SOURCES.filter((item) => existsSync3(
|
|
1043
|
+
const found = DISCOVERED_SOURCES.filter((item) => existsSync3(path4.join(root, item)));
|
|
999
1044
|
config.rules.sources = found;
|
|
1000
1045
|
if (!found.length) {
|
|
1001
1046
|
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"));
|
|
@@ -1211,6 +1256,9 @@ setLocale(detectLocale());
|
|
|
1211
1256
|
var server = new McpServer({ name: "revdeck", version: VERSION });
|
|
1212
1257
|
var defaultRoot = findRepoRoot(process.env.REVDECK_ROOT ?? process.cwd());
|
|
1213
1258
|
var featureId = process.env.REVDECK_FEATURE?.trim() || null;
|
|
1259
|
+
function daemonRoot(root) {
|
|
1260
|
+
return toHostRoot(root, process.env.REVDECK_HOST_ROOT, defaultRoot);
|
|
1261
|
+
}
|
|
1214
1262
|
var clientPromise = null;
|
|
1215
1263
|
var scopePromise = null;
|
|
1216
1264
|
async function client() {
|
|
@@ -1369,7 +1417,7 @@ server.registerTool(
|
|
|
1369
1417
|
}
|
|
1370
1418
|
const result = await call(
|
|
1371
1419
|
"reviews.remoteList",
|
|
1372
|
-
{ root: current2.root, scope: listScope, limit: limit ?? 50 }
|
|
1420
|
+
{ root: daemonRoot(current2.root), scope: listScope, limit: limit ?? 50 }
|
|
1373
1421
|
);
|
|
1374
1422
|
const text = result.items.map((item) => `#${item.ref.number} ${item.title} \xB7 ${item.author} \xB7 ${item.updatedAt}`).join("\n") || "Empty.";
|
|
1375
1423
|
return ok(`${result.platform}:${result.project}
|
|
@@ -1406,7 +1454,7 @@ server.registerTool(
|
|
|
1406
1454
|
continue;
|
|
1407
1455
|
}
|
|
1408
1456
|
const result = await call("reviews.open", {
|
|
1409
|
-
root: current2.root,
|
|
1457
|
+
root: daemonRoot(current2.root),
|
|
1410
1458
|
input: value
|
|
1411
1459
|
});
|
|
1412
1460
|
reviews.push(result.review);
|