revdeck 0.2.2 → 0.2.3

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 CHANGED
@@ -6,6 +6,15 @@ All notable changes to this project are documented here. The format is based on
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.3] - 2026-11-12
10
+
11
+ ### Added
12
+
13
+ - Collapsible UI sidebar: the header button or `s` hides/shows it, and the choice is stored in
14
+ `localStorage`.
15
+ - `rules.maxDocumentBytes` and `rules.maxTotalBytes` in `.revdeck.yml`. `0` (the new default) means no
16
+ limit, so all rule documents are loaded; set a positive value to cap the context.
17
+
9
18
  ## [0.2.2] - 2026-11-12
10
19
 
11
20
  ### Added
package/README.md CHANGED
@@ -112,11 +112,14 @@ Russian READMEs live in this repository; translation fixes are welcome.
112
112
  | `revdeck checks <N> [--run --yes]` | project checks |
113
113
  | `revdeck export/import <N>` | legacy file exchange |
114
114
  | `revdeck ui [N]` | local web UI |
115
- | `revdeck daemon <start\|stop\|status\|logs\|install>` | daemon lifecycle |
115
+ | `revdeck daemon <start\|stop\|restart\|status\|logs\|install\|uninstall>` | daemon lifecycle |
116
116
  | `revdeck mcp` | MCP server over stdio |
117
117
 
118
118
  Common flags: `--json`, `--root`, `--review`, `--platform`, `--project`, `--host`, `--lang ru|en`.
119
119
 
120
+ UI shortcuts: `1`–`5` switch tabs, `r` refreshes, `s` hides/shows the sidebar, `p` opens
121
+ publishing, `?` opens the command palette. The sidebar choice is stored in `localStorage`.
122
+
120
123
  ## Attachments
121
124
 
122
125
  The UI has an **Attach** button next to reply, finding and line-comment editors; the CLI equivalent is
@@ -201,6 +204,8 @@ rules:
201
204
  - match: "src/state/**"
202
205
  docs: [docs/StateManagement.md]
203
206
  ignore: ["**/generated/**"]
207
+ maxDocumentBytes: 0 # 0 = no limit
208
+ maxTotalBytes: 0 # 0 = no limit
204
209
  checks:
205
210
  - id: lint
206
211
  argv: [npm, run, lint]
package/README.ru.md CHANGED
@@ -98,11 +98,15 @@ revdeck ui # ссылка на локальный интерфейс
98
98
  | `revdeck checks <N> [--run --yes]` | проверки проекта |
99
99
  | `revdeck export/import <N>` | обмен с файловым форматом |
100
100
  | `revdeck ui [N]` | локальный интерфейс |
101
- | `revdeck daemon <start│stop│status│logs│install>` | управление демоном |
101
+ | `revdeck daemon <start│stop│restart│status│logs│install│uninstall>` | управление демоном |
102
102
  | `revdeck mcp` | MCP-сервер (stdio) |
103
103
 
104
104
  Общие флаги: `--json`, `--root`, `--review`, `--platform`, `--project`, `--host`, `--lang ru|en`.
105
105
 
106
+ Горячие клавиши UI: `1`–`5` переключают вкладки, `r` обновляет, `s` скрывает/показывает
107
+ сайдбар, `p` открывает публикацию, `?` — палитру команд. Выбор сайдбара запоминается в
108
+ `localStorage`.
109
+
106
110
  ## Вложения
107
111
 
108
112
  В UI рядом с редакторами ответа, замечания и комментария к строке есть кнопка **Прикрепить**; в CLI —
@@ -189,6 +193,8 @@ rules:
189
193
  - match: "docs/**"
190
194
  docs: [AGENTS.md#Размещение-технических-знаний]
191
195
  ignore: ["**/generated/**"]
196
+ maxDocumentBytes: 0 # 0 = без лимита
197
+ maxTotalBytes: 0 # 0 = без лимита
192
198
  checks:
193
199
  - id: lint
194
200
  argv: [npm, run, lint]
package/dist/cli.js CHANGED
@@ -168,7 +168,7 @@ var VERSION;
168
168
  var init_version = __esm({
169
169
  "src/version.ts"() {
170
170
  "use strict";
171
- VERSION = "0.2.2";
171
+ VERSION = "0.2.3";
172
172
  }
173
173
  });
174
174
 
@@ -442,7 +442,8 @@ var init_format = __esm({
442
442
 
443
443
  // src/context.ts
444
444
  function renderContext(review, rules2, options = {}) {
445
- const limit = options.maxBytes ?? 2e5;
445
+ const maxBytes = options.maxBytes ?? 2e5;
446
+ const limit = maxBytes > 0 ? maxBytes : Number.POSITIVE_INFINITY;
446
447
  const language = options.language ?? rules2.language ?? "en";
447
448
  const t = (ru, en) => language === "ru" ? ru : en;
448
449
  const lines = [];
@@ -561,7 +562,7 @@ function renderContext(review, rules2, options = {}) {
561
562
  )
562
563
  );
563
564
  const text = lines.join("\n");
564
- return text.length > limit ? `${text.slice(0, limit)}
565
+ return Number.isFinite(limit) && text.length > limit ? `${text.slice(0, limit)}
565
566
 
566
567
  [${t("\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043E\u0431\u0440\u0435\u0437\u0430\u043D", "context truncated")}: ${text.length} > ${limit} ${t("\u0431\u0430\u0439\u0442", "bytes")}]` : text;
567
568
  }
@@ -757,7 +758,7 @@ Next: revdeck_context(review="${result.review.id}").`, { reviewId: result.review
757
758
  try {
758
759
  const { review: view } = await call("reviews.get", { review, refresh: refresh === true });
759
760
  const { rules: rules2 } = await call("rules.get", { review });
760
- let text = renderContext(view, rules2, { maxBytes: max_bytes ?? 2e5, language: rules2.language });
761
+ let text = renderContext(view, rules2, { maxBytes: max_bytes ?? rules2.maxBytes ?? 2e5, language: rules2.language });
761
762
  if (file) {
762
763
  const { file: diff2 } = await call("diff.get", {
763
764
  review,
@@ -1218,7 +1219,11 @@ var reviewConfigSchema = z.object({
1218
1219
  })
1219
1220
  ).default([]),
1220
1221
  /** Пути, которые не ревьюятся (сгенерированный код и т.п.). */
1221
- ignore: z.array(z.string().min(1)).default([])
1222
+ ignore: z.array(z.string().min(1)).default([]),
1223
+ /** 0 — без ограничения; иначе документ обрезается до этого размера. */
1224
+ maxDocumentBytes: z.number().int().nonnegative().default(0),
1225
+ /** 0 — без ограничения; иначе общий контекст правил обрезается. */
1226
+ maxTotalBytes: z.number().int().nonnegative().default(0)
1222
1227
  }).prefault({}),
1223
1228
  checks: z.array(
1224
1229
  z.object({
@@ -1302,8 +1307,7 @@ import path3 from "node:path";
1302
1307
  import { existsSync as existsSync3 } from "node:fs";
1303
1308
  init_paths();
1304
1309
  init_redact();
1305
- var MAX_DOC_BYTES = 96 * 1024;
1306
- var MAX_TOTAL_BYTES = 320 * 1024;
1310
+ var MAX_READ_BYTES = 16 * 1024 * 1024;
1307
1311
  async function buildEffectiveRules(options) {
1308
1312
  const { root, config: config2, configPath } = options;
1309
1313
  const language = options.language ?? "ru";
@@ -1312,6 +1316,8 @@ async function buildEffectiveRules(options) {
1312
1316
  const files = options.files.filter((file) => !config2.rules.ignore.some((pattern) => globToRegExp(pattern).test(file)));
1313
1317
  const ignored = options.files.length - files.length;
1314
1318
  if (ignored > 0) warnings.push(`${ignored} ${t("\u0444\u0430\u0439\u043B(\u043E\u0432) \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u044B \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u043E\u0439 rules.ignore", "file(s) excluded by rules.ignore")}`);
1319
+ const documentLimit = config2.rules.maxDocumentBytes > 0 ? config2.rules.maxDocumentBytes : Number.POSITIVE_INFINITY;
1320
+ const totalLimit = config2.rules.maxTotalBytes > 0 ? config2.rules.maxTotalBytes : Number.POSITIVE_INFINITY;
1315
1321
  const cache = /* @__PURE__ */ new Map();
1316
1322
  let totalBytes = 0;
1317
1323
  const readDoc = async (selector) => {
@@ -1331,9 +1337,10 @@ async function buildEffectiveRules(options) {
1331
1337
  warnings.push(`${t("\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", "document")} ${relative} ${t("\u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D", "not found")}`);
1332
1338
  } else {
1333
1339
  try {
1334
- const raw = await readTextNoFollow(resolved, MAX_DOC_BYTES * 2);
1335
- const truncated = raw.length > MAX_DOC_BYTES;
1336
- cached = { exists: true, text: truncated ? raw.slice(0, MAX_DOC_BYTES) : raw, truncated };
1340
+ const readLimit = Number.isFinite(documentLimit) ? Math.max(documentLimit * 2, 4096) : MAX_READ_BYTES;
1341
+ const raw = await readTextNoFollow(resolved, readLimit);
1342
+ const truncated = Number.isFinite(documentLimit) && raw.length > documentLimit;
1343
+ cached = { exists: true, text: truncated ? raw.slice(0, documentLimit) : raw, truncated };
1337
1344
  } catch (error) {
1338
1345
  cached = { exists: false, text: "", truncated: false };
1339
1346
  warnings.push(`${relative}: ${redactLine(error)}`);
@@ -1363,7 +1370,7 @@ async function buildEffectiveRules(options) {
1363
1370
  }
1364
1371
  const documents = [];
1365
1372
  for (const doc of docs) {
1366
- if (totalBytes > MAX_TOTAL_BYTES) {
1373
+ if (Number.isFinite(totalLimit) && totalBytes > totalLimit) {
1367
1374
  warnings.push(t("\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043F\u0440\u0430\u0432\u0438\u043B \u043E\u0431\u0440\u0435\u0437\u0430\u043D: \u043F\u0440\u0435\u0432\u044B\u0448\u0435\u043D \u043B\u0438\u043C\u0438\u0442 \u0440\u0430\u0437\u043C\u0435\u0440\u0430", "rules context truncated: size limit exceeded"));
1368
1375
  break;
1369
1376
  }
@@ -1442,6 +1449,7 @@ function normalizeHeading(value) {
1442
1449
  }
1443
1450
  function renderRules(rules2, options = {}) {
1444
1451
  const maxBytes = options.maxBytes ?? 2e5;
1452
+ const limit = maxBytes > 0 ? maxBytes : Number.POSITIVE_INFINITY;
1445
1453
  const withExcerpts = options.withExcerpts ?? true;
1446
1454
  const language = options.language ?? "ru";
1447
1455
  const t = (ru, en) => language === "ru" ? ru : en;
@@ -1466,7 +1474,7 @@ ${rules2.warnings.map((item) => `- ${item}`).join("\n")}`);
1466
1474
  ${doc.excerpt}${doc.truncated ? `
1467
1475
 
1468
1476
  [${t("\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u043E\u0431\u0440\u0435\u0437\u0430\u043D", "document truncated")}]` : ""}`);
1469
- if (out.join("\n").length > maxBytes) {
1477
+ if (Number.isFinite(limit) && out.join("\n").length > limit) {
1470
1478
  out.push(`
1471
1479
  [${t("\u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442 \u043F\u0440\u0430\u0432\u0438\u043B \u043E\u0431\u0440\u0435\u0437\u0430\u043D \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0443", "rules context truncated by size")}]`);
1472
1480
  return out.join("\n");
@@ -2588,7 +2596,7 @@ var HELP_RU = `revdeck ${VERSION} \u2014 \u0440\u0435\u0432\u044C\u044E GitLab/G
2588
2596
  revdeck eject \u0443\u0434\u0430\u043B\u0438\u0442\u044C revdeck \u0438\u0437 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 (--yes; --keep-config)
2589
2597
  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)
2590
2598
  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
2591
- revdeck daemon <start|stop|status|logs|restart>
2599
+ revdeck daemon <start|stop|restart|status|logs|install|uninstall>
2592
2600
  revdeck list \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0440\u0435\u0432\u044C\u044E (\u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u0435\u0448), --remote \u2014 \u0441 \u043F\u043B\u0430\u0442\u0444\u043E\u0440\u043C\u044B
2593
2601
  revdeck open <url|N> \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0440\u0435\u0432\u044C\u044E \u0438 \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442
2594
2602
  revdeck ui [N] \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u043B\u043E\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441
@@ -2617,7 +2625,7 @@ var HELP_EN = `revdeck ${VERSION} \u2014 code review for GitLab/GitHub, for huma
2617
2625
  revdeck eject remove revdeck from the project (--yes; --keep-config)
2618
2626
  revdeck devcontainer connect a devcontainer to the host daemon (--write)
2619
2627
  revdeck doctor check the environment and access
2620
- revdeck daemon <start|stop|status|logs|restart>
2628
+ revdeck daemon <start|stop|restart|status|logs|install|uninstall>
2621
2629
  revdeck list open reviews (local cache), --remote \u2014 from the platform
2622
2630
  revdeck open <url|N> open a review and get the context
2623
2631
  revdeck ui [N] link to the local UI
@@ -2924,7 +2932,7 @@ async function context(root, arg, values) {
2924
2932
  review: review.id
2925
2933
  });
2926
2934
  if (values.json) return printJson(contextPayload(review, rules2));
2927
- writers.out(renderContext(review, rules2, { language: rules2.language }));
2935
+ writers.out(renderContext(review, rules2, { language: rules2.language, ...rules2.maxBytes !== void 0 ? { maxBytes: rules2.maxBytes } : {} }));
2928
2936
  });
2929
2937
  }
2930
2938
  async function threads(arg, values) {
@@ -3170,7 +3178,7 @@ async function rules(root, arg, values) {
3170
3178
  language
3171
3179
  });
3172
3180
  if (values.json) return printJson(effective);
3173
- return writers.out(renderRules(effective, { language }));
3181
+ return writers.out(renderRules(effective, { language, maxBytes: loaded.config.rules.maxTotalBytes }));
3174
3182
  }
3175
3183
  await withClient(async ({ client: client2 }) => {
3176
3184
  const { review } = await resolveReview(client2, root, reviewArg(values, arg), values);