revdeck 0.12.1 → 0.13.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 +37 -0
- package/README.md +16 -9
- package/README.ru.md +16 -7
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +2 -2
- package/dist/daemon.js +92 -2
- package/dist/daemon.js.map +3 -3
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +2 -2
- package/dist/ui/assets/index-CEaK8XQu.js +19 -0
- package/dist/ui/assets/index-DnR_boC5.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/architecture.md +3 -1
- package/docs/capabilities.md +12 -3
- package/docs/protocol.md +1 -0
- package/docs/ru/architecture.md +4 -2
- package/docs/ru/capabilities.md +12 -3
- package/docs/ru/protocol.md +1 -0
- package/package.json +1 -1
- package/dist/ui/assets/index-CPJbq_MG.css +0 -1
- package/dist/ui/assets/index-TWk-2BuT.js +0 -19
package/dist/daemon.js
CHANGED
|
@@ -698,6 +698,10 @@ rename to ${newPath}
|
|
|
698
698
|
}
|
|
699
699
|
return parseUnifiedDiff(chunks.join("\n"));
|
|
700
700
|
}
|
|
701
|
+
async fileContent(path12, ref) {
|
|
702
|
+
const endpoint = `projects/${this.projectRef}/repository/files/${encodeURIComponent(path12)}/raw`;
|
|
703
|
+
return this.call([query(endpoint, { ref })]);
|
|
704
|
+
}
|
|
701
705
|
async threads() {
|
|
702
706
|
const discussions = await this.paged(this.endpoint("/discussions"));
|
|
703
707
|
const threads = [];
|
|
@@ -1057,6 +1061,10 @@ rename to ${newPath}
|
|
|
1057
1061
|
}
|
|
1058
1062
|
return parseUnifiedDiff(chunks.join("\n"));
|
|
1059
1063
|
}
|
|
1064
|
+
async fileContent(path12, ref) {
|
|
1065
|
+
const encoded = path12.split("/").map(encodeURIComponent).join("/");
|
|
1066
|
+
return this.call(["-H", "Accept: application/vnd.github.raw", query(`repos/${this.repo}/contents/${encoded}`, { ref })]);
|
|
1067
|
+
}
|
|
1060
1068
|
async threads() {
|
|
1061
1069
|
const nodes = [];
|
|
1062
1070
|
let after = null;
|
|
@@ -1405,7 +1413,7 @@ async function writeFileAtomic(file, data, mode = 384, dirMode = 448) {
|
|
|
1405
1413
|
init_redact();
|
|
1406
1414
|
|
|
1407
1415
|
// src/version.ts
|
|
1408
|
-
var VERSION = "0.
|
|
1416
|
+
var VERSION = "0.13.0";
|
|
1409
1417
|
var PROTOCOL_VERSION = 2;
|
|
1410
1418
|
|
|
1411
1419
|
// src/daemon/main.ts
|
|
@@ -4304,6 +4312,8 @@ var ReviewService = class {
|
|
|
4304
4312
|
refreshing = /* @__PURE__ */ new Set();
|
|
4305
4313
|
/** Временные снимки для просмотра MR/PR без создания ревью. */
|
|
4306
4314
|
previews = /* @__PURE__ */ new Map();
|
|
4315
|
+
/** Полные файлы для раскрытия diff; ключ включает head/base, коммит и путь. */
|
|
4316
|
+
fileContentCache = /* @__PURE__ */ new Map();
|
|
4307
4317
|
constructor(options) {
|
|
4308
4318
|
this.store = options.store;
|
|
4309
4319
|
this.runImpl = options.runImpl ?? run;
|
|
@@ -4631,7 +4641,7 @@ var ReviewService = class {
|
|
|
4631
4641
|
readOnly: true
|
|
4632
4642
|
};
|
|
4633
4643
|
const view = toReviewView(review, this.now().getTime());
|
|
4634
|
-
this.previews.set(id, { ref, view, diff, at: this.now().getTime() });
|
|
4644
|
+
this.previews.set(id, { ref, view, diff, root, at: this.now().getTime() });
|
|
4635
4645
|
while (this.previews.size > 8) {
|
|
4636
4646
|
const oldest = [...this.previews.entries()].sort((left, right) => left[1].at - right[1].at)[0];
|
|
4637
4647
|
if (!oldest) break;
|
|
@@ -5098,6 +5108,79 @@ ${t("\u2026 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u0444\u0438\u0447\
|
|
|
5098
5108
|
if (!found) return null;
|
|
5099
5109
|
return { path: found.path, status: found.status, binary: found.binary, hunks: found.hunks };
|
|
5100
5110
|
}
|
|
5111
|
+
/**
|
|
5112
|
+
* Полный файл на head (или base для удалённого файла), чтобы UI раскрывал
|
|
5113
|
+
* скрытые между hunks строки. Локальный git дешевле API платформы, но
|
|
5114
|
+
* коммит может быть ещё не загружен в рабочую копию — тогда читаем raw у
|
|
5115
|
+
* провайдера. Путь берётся только из сохранённого diff.
|
|
5116
|
+
*/
|
|
5117
|
+
async fileContent(id, file) {
|
|
5118
|
+
const cachedPreview = this.previews.get(id);
|
|
5119
|
+
const preview = cachedPreview && this.now().getTime() - cachedPreview.at < 60 * 6e4 ? cachedPreview : null;
|
|
5120
|
+
const stored = preview ? null : this.store.getReview(id);
|
|
5121
|
+
if (!preview && !stored) {
|
|
5122
|
+
throw Object.assign(new Error(tr(`\u0440\u0435\u0432\u044C\u044E ${id} \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E`, `review ${id} not found`)), { status: 404 });
|
|
5123
|
+
}
|
|
5124
|
+
const diff = preview?.diff ?? stored.snapshot.diff;
|
|
5125
|
+
const info = preview?.view.info ?? this.store.info(id) ?? (stored ? fallbackInfo(stored.row) : null);
|
|
5126
|
+
const root = preview?.root ?? stored.row.root;
|
|
5127
|
+
const found = diff.find((item) => item.path === file || item.oldPath === file);
|
|
5128
|
+
if (!found || !info) {
|
|
5129
|
+
throw Object.assign(new Error(tr("\u0444\u0430\u0439\u043B\u0430 \u043D\u0435\u0442 \u0432 diff", "the file is not in the diff")), { status: 404 });
|
|
5130
|
+
}
|
|
5131
|
+
if (found.binary) {
|
|
5132
|
+
throw Object.assign(new Error(tr("\u0431\u0438\u043D\u0430\u0440\u043D\u044B\u0439 \u0444\u0430\u0439\u043B: \u0441\u043A\u0440\u044B\u0442\u044B\u0445 \u0441\u0442\u0440\u043E\u043A \u043D\u0435\u0442", "binary file: there are no hidden lines")), { status: 400 });
|
|
5133
|
+
}
|
|
5134
|
+
const side = found.status === "deleted" ? "base" : "head";
|
|
5135
|
+
const sha = side === "head" ? info.commit.head : info.commit.base;
|
|
5136
|
+
const path12 = side === "head" ? found.path : found.oldPath || found.path;
|
|
5137
|
+
if (!sha || !path12) {
|
|
5138
|
+
throw Object.assign(new Error(tr("\u043D\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043D \u043A\u043E\u043C\u043C\u0438\u0442 \u0444\u0430\u0439\u043B\u0430", "the file commit is unknown")), { status: 404 });
|
|
5139
|
+
}
|
|
5140
|
+
const key = `${id}|${side}|${sha}|${path12}`;
|
|
5141
|
+
const hit = this.fileContentCache.get(key);
|
|
5142
|
+
if (hit && this.now().getTime() - hit.at < 10 * 6e4) return hit.value;
|
|
5143
|
+
let text2;
|
|
5144
|
+
try {
|
|
5145
|
+
const provider = preview ? await this.providerFactory(preview.ref, preview.root) : await this.providerFor(id);
|
|
5146
|
+
try {
|
|
5147
|
+
const result = await this.runImpl("git", ["show", `${sha}:${path12}`], {
|
|
5148
|
+
cwd: root,
|
|
5149
|
+
timeoutMs: 3e4,
|
|
5150
|
+
maxBuffer: 16 * 1024 * 1024
|
|
5151
|
+
});
|
|
5152
|
+
text2 = result.stdout;
|
|
5153
|
+
} catch {
|
|
5154
|
+
text2 = await provider.fileContent(path12, sha);
|
|
5155
|
+
}
|
|
5156
|
+
} catch (error) {
|
|
5157
|
+
throw Object.assign(
|
|
5158
|
+
new Error(
|
|
5159
|
+
tr(
|
|
5160
|
+
`\u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B: ${redact(messageOf(error))}`,
|
|
5161
|
+
`could not read the file: ${redact(messageOf(error))}`
|
|
5162
|
+
)
|
|
5163
|
+
),
|
|
5164
|
+
{ status: 502 }
|
|
5165
|
+
);
|
|
5166
|
+
}
|
|
5167
|
+
const normalized = text2.replace(/\r\n/g, "\n");
|
|
5168
|
+
const all = normalized === "" ? [] : (normalized.endsWith("\n") ? normalized.slice(0, -1) : normalized).split("\n");
|
|
5169
|
+
const value = {
|
|
5170
|
+
path: path12,
|
|
5171
|
+
side,
|
|
5172
|
+
lines: all.slice(0, 2e4),
|
|
5173
|
+
totalLines: all.length,
|
|
5174
|
+
truncated: all.length > 2e4
|
|
5175
|
+
};
|
|
5176
|
+
this.fileContentCache.set(key, { value, at: this.now().getTime() });
|
|
5177
|
+
while (this.fileContentCache.size > 32) {
|
|
5178
|
+
const oldest = this.fileContentCache.keys().next().value;
|
|
5179
|
+
if (oldest === void 0) break;
|
|
5180
|
+
this.fileContentCache.delete(oldest);
|
|
5181
|
+
}
|
|
5182
|
+
return value;
|
|
5183
|
+
}
|
|
5101
5184
|
// ---------------------------------------------------------------- summary
|
|
5102
5185
|
setSummary(id, input, actor = "system") {
|
|
5103
5186
|
this.requireReview(id);
|
|
@@ -6566,6 +6649,13 @@ data: ${JSON.stringify(event)}
|
|
|
6566
6649
|
reply(res, 200, { ok: true, file: diff });
|
|
6567
6650
|
return;
|
|
6568
6651
|
}
|
|
6652
|
+
if (req.method === "GET" && url.pathname === "/api/file") {
|
|
6653
|
+
const review = url.searchParams.get("review") ?? "";
|
|
6654
|
+
const file = url.searchParams.get("file") ?? "";
|
|
6655
|
+
const content = await service.fileContent(review, file);
|
|
6656
|
+
reply(res, 200, { ok: true, file: content });
|
|
6657
|
+
return;
|
|
6658
|
+
}
|
|
6569
6659
|
if (req.method === "GET" && url.pathname === "/api/rules") {
|
|
6570
6660
|
const review = url.searchParams.get("review") ?? "";
|
|
6571
6661
|
reply(res, 200, { ok: true, rules: await service.rules(review) });
|