revdeck 0.4.1 → 0.4.2
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 +26 -0
- package/CONTRIBUTING.md +11 -0
- package/README.md +12 -5
- package/README.ru.md +13 -6
- package/dist/cli.js +25 -15
- package/dist/cli.js.map +2 -2
- package/dist/daemon.js +51 -37
- package/dist/daemon.js.map +3 -3
- package/dist/mcp.js +14 -13
- package/dist/mcp.js.map +2 -2
- package/dist/ui/assets/index-CTegHeh4.css +1 -0
- package/dist/ui/assets/index-CWSxgxKx.js +10 -0
- package/dist/ui/index.html +2 -2
- package/docs/integrations.md +11 -6
- package/docs/protocol.md +1 -0
- package/docs/ru/integrations.md +11 -6
- package/docs/ru/protocol.md +1 -0
- package/package.json +1 -1
- package/skills/revdeck/en/SKILL.md +7 -0
- package/skills/revdeck/ru/SKILL.md +7 -0
- package/dist/ui/assets/index-B2o_eogg.js +0 -10
- package/dist/ui/assets/index-C4ko2Kho.css +0 -1
package/dist/daemon.js
CHANGED
|
@@ -299,11 +299,11 @@ function diffStats(files) {
|
|
|
299
299
|
function changedPaths(files) {
|
|
300
300
|
return files.map((file) => file.path);
|
|
301
301
|
}
|
|
302
|
-
function findFile(files,
|
|
303
|
-
return files.find((file) => file.path ===
|
|
302
|
+
function findFile(files, path11) {
|
|
303
|
+
return files.find((file) => file.path === path11) ?? files.find((file) => file.oldPath === path11);
|
|
304
304
|
}
|
|
305
|
-
function findNewLine(files,
|
|
306
|
-
const file = findFile(files,
|
|
305
|
+
function findNewLine(files, path11, line) {
|
|
306
|
+
const file = findFile(files, path11);
|
|
307
307
|
if (!file) return void 0;
|
|
308
308
|
for (const hunk of file.hunks) {
|
|
309
309
|
for (const item of hunk.lines) {
|
|
@@ -312,8 +312,8 @@ function findNewLine(files, path10, line) {
|
|
|
312
312
|
}
|
|
313
313
|
return void 0;
|
|
314
314
|
}
|
|
315
|
-
function snippetAround(files,
|
|
316
|
-
const file = findFile(files,
|
|
315
|
+
function snippetAround(files, path11, line, radius = 6) {
|
|
316
|
+
const file = findFile(files, path11);
|
|
317
317
|
if (!file || line == null) return null;
|
|
318
318
|
const flat = file.hunks.flatMap((hunk) => hunk.lines);
|
|
319
319
|
const target = flat.findIndex((item) => item.newLine === line);
|
|
@@ -326,9 +326,9 @@ function snippetAround(files, path10, line, radius = 6) {
|
|
|
326
326
|
target: item.newLine === line
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
function linePosition(files,
|
|
330
|
-
const file = findFile(files,
|
|
331
|
-
const found = findNewLine(files,
|
|
329
|
+
function linePosition(files, path11, line) {
|
|
330
|
+
const file = findFile(files, path11);
|
|
331
|
+
const found = findNewLine(files, path11, line);
|
|
332
332
|
if (!file || !found) return null;
|
|
333
333
|
return { newPath: file.path, newLine: line, oldPath: file.oldPath, oldLine: found.kind === " " ? found.oldLine : null };
|
|
334
334
|
}
|
|
@@ -494,8 +494,8 @@ async function withTempJson(data, fn) {
|
|
|
494
494
|
await rm(dir, { recursive: true, force: true });
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function query(
|
|
498
|
-
const url = new URL(
|
|
497
|
+
function query(path11, params) {
|
|
498
|
+
const url = new URL(path11.startsWith("/") ? path11 : `/${path11}`, "http://local");
|
|
499
499
|
for (const [key, value] of Object.entries(params)) {
|
|
500
500
|
if (value !== void 0 && value !== "") url.searchParams.set(key, String(value));
|
|
501
501
|
}
|
|
@@ -1150,7 +1150,7 @@ rename to ${newPath}
|
|
|
1150
1150
|
import { existsSync as existsSync4, readFileSync } from "node:fs";
|
|
1151
1151
|
import { appendFile, open as open2, readFile as readFile3, unlink as unlink4 } from "node:fs/promises";
|
|
1152
1152
|
import net2 from "node:net";
|
|
1153
|
-
import
|
|
1153
|
+
import path10 from "node:path";
|
|
1154
1154
|
import { fileURLToPath } from "node:url";
|
|
1155
1155
|
import { parseArgs } from "node:util";
|
|
1156
1156
|
|
|
@@ -1235,8 +1235,8 @@ async function readTextNoFollow(file, maxBytes = 4 * 1024 * 1024) {
|
|
|
1235
1235
|
await handle.close();
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
async function writeFileAtomic(file, data, mode = 384) {
|
|
1239
|
-
await ensureDir(path.dirname(file));
|
|
1238
|
+
async function writeFileAtomic(file, data, mode = 384, dirMode = 448) {
|
|
1239
|
+
await ensureDir(path.dirname(file), dirMode);
|
|
1240
1240
|
const tmp = path.join(path.dirname(file), `.${path.basename(file)}.${process.pid}.${Date.now().toString(36)}.tmp`);
|
|
1241
1241
|
let handle;
|
|
1242
1242
|
try {
|
|
@@ -1258,7 +1258,7 @@ async function writeFileAtomic(file, data, mode = 384) {
|
|
|
1258
1258
|
init_redact();
|
|
1259
1259
|
|
|
1260
1260
|
// src/version.ts
|
|
1261
|
-
var VERSION = "0.4.
|
|
1261
|
+
var VERSION = "0.4.2";
|
|
1262
1262
|
var PROTOCOL_VERSION = 1;
|
|
1263
1263
|
|
|
1264
1264
|
// src/daemon/main.ts
|
|
@@ -1887,8 +1887,8 @@ function globToRegExp(glob) {
|
|
|
1887
1887
|
function escapeRegExp(value) {
|
|
1888
1888
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1889
1889
|
}
|
|
1890
|
-
function classifyFile(
|
|
1891
|
-
const lower =
|
|
1890
|
+
function classifyFile(path11) {
|
|
1891
|
+
const lower = path11.toLowerCase();
|
|
1892
1892
|
if (/(^|\/)(node_modules|dist|build|coverage|vendor)\//.test(lower)) return "generated";
|
|
1893
1893
|
if (/\.(md|mdx|rst|txt|adoc)$/.test(lower) || /(^|\/)(docs?|adr)\//.test(lower)) return "docs";
|
|
1894
1894
|
if (/(^|\/)(__tests__|tests?|spec|e2e)\//.test(lower) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(lower) || /_test\.go$/.test(lower)) return "test";
|
|
@@ -2790,6 +2790,11 @@ var ReviewService = class {
|
|
|
2790
2790
|
listReviews() {
|
|
2791
2791
|
return this.store.listReviews();
|
|
2792
2792
|
}
|
|
2793
|
+
removeReview(id) {
|
|
2794
|
+
this.requireReview(id);
|
|
2795
|
+
this.store.removeReview(id);
|
|
2796
|
+
this.events.emit("review", { reviewId: id, at: this.now().toISOString() });
|
|
2797
|
+
}
|
|
2793
2798
|
async listRemote(rootInput, scope, limit = 50) {
|
|
2794
2799
|
const root = findRepoRoot(rootInput);
|
|
2795
2800
|
const loaded = await loadConfig(root);
|
|
@@ -2822,13 +2827,13 @@ var ReviewService = class {
|
|
|
2822
2827
|
setSummary(id, input) {
|
|
2823
2828
|
this.requireReview(id);
|
|
2824
2829
|
const value = input ?? {};
|
|
2825
|
-
const list = (item, limit) => (Array.isArray(item) ? item : []).map((entry) => String(entry ?? "").trim()).filter(Boolean).slice(0, limit).map((entry) => entry.slice(0,
|
|
2830
|
+
const list = (item, limit) => (Array.isArray(item) ? item : []).map((entry) => String(entry ?? "").trim()).filter(Boolean).slice(0, limit).map((entry) => entry.slice(0, 4e3));
|
|
2826
2831
|
const summary = {
|
|
2827
|
-
title: String(value.title ?? "").slice(0,
|
|
2828
|
-
scope: String(value.scope ?? "").slice(0,
|
|
2829
|
-
summary: String(value.summary ?? "").slice(0,
|
|
2830
|
-
changes: list(value.changes,
|
|
2831
|
-
focus: list(value.focus,
|
|
2832
|
+
title: String(value.title ?? "").slice(0, 1e3),
|
|
2833
|
+
scope: String(value.scope ?? "").slice(0, 2e3),
|
|
2834
|
+
summary: String(value.summary ?? "").slice(0, 2e4),
|
|
2835
|
+
changes: list(value.changes, 100),
|
|
2836
|
+
focus: list(value.focus, 100)
|
|
2832
2837
|
};
|
|
2833
2838
|
this.store.setSummary(id, summary);
|
|
2834
2839
|
this.emit(id);
|
|
@@ -3556,6 +3561,7 @@ async function dispatch(service, method, params) {
|
|
|
3556
3561
|
return { review: service.getView(id), reviews: service.listReviews() };
|
|
3557
3562
|
}
|
|
3558
3563
|
case "reviews.remove":
|
|
3564
|
+
service.removeReview(String(params.review ?? ""));
|
|
3559
3565
|
return { ok: true };
|
|
3560
3566
|
case "diff.get": {
|
|
3561
3567
|
const file = service.diffFile(String(params.review ?? ""), String(params.file ?? ""));
|
|
@@ -3643,8 +3649,8 @@ async function dispatch(service, method, params) {
|
|
|
3643
3649
|
throw new MrReviewError(`\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043C\u0435\u0442\u043E\u0434 RPC: ${method}`, "METHOD", "\u043E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 revdeck: \u0432\u0435\u0440\u0441\u0438\u044F \u0434\u0435\u043C\u043E\u043D\u0430 \u0438 \u043A\u043B\u0438\u0435\u043D\u0442\u0430 \u0434\u043E\u043B\u0436\u043D\u044B \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0442\u044C");
|
|
3644
3650
|
}
|
|
3645
3651
|
}
|
|
3646
|
-
async function startRpcServer(service, socketFile) {
|
|
3647
|
-
await ensureDir(pathDirname(socketFile), 448);
|
|
3652
|
+
async function startRpcServer(service, socketFile, options = {}) {
|
|
3653
|
+
await ensureDir(pathDirname(socketFile), options.dirMode ?? 448);
|
|
3648
3654
|
await unlink2(socketFile).catch(() => void 0);
|
|
3649
3655
|
const server = net.createServer((socket) => {
|
|
3650
3656
|
socket.setEncoding("utf8");
|
|
@@ -3678,7 +3684,7 @@ async function startRpcServer(service, socketFile) {
|
|
|
3678
3684
|
server.once("error", reject);
|
|
3679
3685
|
server.listen(socketFile, () => resolve());
|
|
3680
3686
|
});
|
|
3681
|
-
await chmod(socketFile, 384);
|
|
3687
|
+
await chmod(socketFile, options.mode ?? 384);
|
|
3682
3688
|
return {
|
|
3683
3689
|
path: socketFile,
|
|
3684
3690
|
close: () => new Promise((resolve) => {
|
|
@@ -3783,7 +3789,7 @@ async function startHttpServer(options) {
|
|
|
3783
3789
|
const port2 = server.address()?.port ?? 0;
|
|
3784
3790
|
const expectedHosts = /* @__PURE__ */ new Set([`127.0.0.1:${port2}`, `localhost:${port2}`, `[::1]:${port2}`]);
|
|
3785
3791
|
for (const name of options.allowedHosts ?? []) expectedHosts.add(`${name}:${port2}`);
|
|
3786
|
-
|
|
3792
|
+
expectedHosts.add(`host.docker.internal:${port2}`);
|
|
3787
3793
|
if (!expectedHosts.has(String(req.headers.host ?? ""))) {
|
|
3788
3794
|
reply(res, 403, { ok: false, error: "\u043D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 Host" });
|
|
3789
3795
|
return;
|
|
@@ -3940,6 +3946,11 @@ data: ${JSON.stringify(event)}
|
|
|
3940
3946
|
reply(res, 200, { ok: true, review: service.getView(opened.id), reviews: service.listReviews() });
|
|
3941
3947
|
return;
|
|
3942
3948
|
}
|
|
3949
|
+
case "/api/reviews/remove": {
|
|
3950
|
+
service.removeReview(review);
|
|
3951
|
+
reply(res, 200, { ok: true });
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3943
3954
|
case "/api/reviews/refresh": {
|
|
3944
3955
|
const updated = await service.refreshReview(review);
|
|
3945
3956
|
reply(res, 200, { ok: true, review: service.getView(updated.id), reviews: service.listReviews() });
|
|
@@ -4071,14 +4082,17 @@ data: ${JSON.stringify(event)}
|
|
|
4071
4082
|
|
|
4072
4083
|
// src/daemon/bridge.ts
|
|
4073
4084
|
import { unlink as unlink3 } from "node:fs/promises";
|
|
4085
|
+
import path9 from "node:path";
|
|
4074
4086
|
async function startDevcontainerBridge(service, info) {
|
|
4075
|
-
await ensureDir(
|
|
4076
|
-
await ensureDir(
|
|
4077
|
-
|
|
4087
|
+
await ensureDir(path9.dirname(devcontainerBridgeDir()), 448);
|
|
4088
|
+
await ensureDir(devcontainerBridgeDir(), 448);
|
|
4089
|
+
await ensureDir(devcontainerRunDir(), 493);
|
|
4090
|
+
await ensureDir(devcontainerStateDir(), 493);
|
|
4091
|
+
const rpc = await startRpcServer(service, devcontainerSocketPath(), { mode: 438, dirMode: 493 });
|
|
4078
4092
|
try {
|
|
4079
4093
|
const payload = { ...info, socket: devcontainerSocketPath() };
|
|
4080
4094
|
await writeFileAtomic(devcontainerInfoPath(), `${JSON.stringify(payload, null, 2)}
|
|
4081
|
-
`,
|
|
4095
|
+
`, 420, 493);
|
|
4082
4096
|
} catch (error) {
|
|
4083
4097
|
await rpc.close();
|
|
4084
4098
|
throw error;
|
|
@@ -4140,7 +4154,7 @@ async function main() {
|
|
|
4140
4154
|
});
|
|
4141
4155
|
const socket = socketPath();
|
|
4142
4156
|
const rpc = await startRpcServer(service, socket);
|
|
4143
|
-
const uiDir = values["ui-dir"] ?
|
|
4157
|
+
const uiDir = values["ui-dir"] ? path10.resolve(values["ui-dir"]) : path10.join(packageRoot(), "dist", "ui");
|
|
4144
4158
|
const http2 = await startHttpServer({
|
|
4145
4159
|
service,
|
|
4146
4160
|
token,
|
|
@@ -4192,7 +4206,7 @@ async function main() {
|
|
|
4192
4206
|
service.close();
|
|
4193
4207
|
await unlink4(daemonInfoPath()).catch(() => void 0);
|
|
4194
4208
|
await lock.close().catch(() => void 0);
|
|
4195
|
-
await unlink4(
|
|
4209
|
+
await unlink4(path10.join(stateDir(), "daemon.lock")).catch(() => void 0);
|
|
4196
4210
|
process.exit(0);
|
|
4197
4211
|
}
|
|
4198
4212
|
};
|
|
@@ -4204,9 +4218,9 @@ async function main() {
|
|
|
4204
4218
|
}
|
|
4205
4219
|
}
|
|
4206
4220
|
function packageRoot() {
|
|
4207
|
-
let dir =
|
|
4221
|
+
let dir = path10.dirname(fileURLToPath(import.meta.url));
|
|
4208
4222
|
for (; ; ) {
|
|
4209
|
-
const candidate =
|
|
4223
|
+
const candidate = path10.join(dir, "package.json");
|
|
4210
4224
|
if (existsSync4(candidate)) {
|
|
4211
4225
|
try {
|
|
4212
4226
|
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
@@ -4214,7 +4228,7 @@ function packageRoot() {
|
|
|
4214
4228
|
} catch {
|
|
4215
4229
|
}
|
|
4216
4230
|
}
|
|
4217
|
-
const parent =
|
|
4231
|
+
const parent = path10.dirname(dir);
|
|
4218
4232
|
if (parent === dir) return process.cwd();
|
|
4219
4233
|
dir = parent;
|
|
4220
4234
|
}
|
|
@@ -4253,7 +4267,7 @@ async function runningDaemon() {
|
|
|
4253
4267
|
return reachable ? info : null;
|
|
4254
4268
|
}
|
|
4255
4269
|
async function acquireLock() {
|
|
4256
|
-
const file =
|
|
4270
|
+
const file = path10.join(stateDir(), "daemon.lock");
|
|
4257
4271
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
4258
4272
|
try {
|
|
4259
4273
|
const handle = await open2(file, "wx", 384);
|