@levnikolaevich/hex-line-mcp 1.18.1 → 1.18.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.
Files changed (2) hide show
  1. package/dist/server.mjs +13 -7
  2. package/package.json +1 -1
package/dist/server.mjs CHANGED
@@ -858,6 +858,9 @@ function fnv1a(str) {
858
858
  function lineTag(hash32) {
859
859
  return TAG_CHARS[hash32 & 31] + TAG_CHARS[hash32 >>> 8 & 31];
860
860
  }
861
+ function hashLine(content) {
862
+ return lineTag(fnv1a(content));
863
+ }
861
864
  function rangeChecksum(lineHashes, startLine, endLine) {
862
865
  let acc = FNV_OFFSET;
863
866
  for (const h of lineHashes) {
@@ -1282,7 +1285,7 @@ var DEFAULT_LIMIT = 2e3;
1282
1285
  function resolveReadMode(opts = {}) {
1283
1286
  const verbosity = opts.verbosity || "full";
1284
1287
  const editReady = opts.editReady ?? (verbosity === "full" && opts.plain !== true);
1285
- const plain = opts.plain ?? (!editReady || verbosity !== "full");
1288
+ const plain = opts.plain ?? false;
1286
1289
  return { verbosity, editReady, plain };
1287
1290
  }
1288
1291
  function parseRangeEntry(entry, total) {
@@ -1368,12 +1371,13 @@ function buildReadBlock(snapshot, range, plain, remainingChars) {
1368
1371
  cappedAtLine
1369
1372
  };
1370
1373
  }
1371
- function buildPlainRange(snapshot, range, remainingChars) {
1374
+ function buildPlainRange(snapshot, range, remainingChars, plain = true) {
1372
1375
  const lines = [];
1373
1376
  let nextBudget = remainingChars;
1374
1377
  let cappedAtLine = 0;
1375
1378
  for (let lineNumber = range.startLine; lineNumber <= range.endLine; lineNumber++) {
1376
- const rendered = `${lineNumber}|${snapshot.lines[lineNumber - 1] ?? ""}`;
1379
+ const content = snapshot.lines[lineNumber - 1] ?? "";
1380
+ const rendered = plain ? `${lineNumber}|${content}` : `${hashLine(content)}.${lineNumber} ${content}`;
1377
1381
  const nextCost = rendered.length + 1;
1378
1382
  if (lines.length > 0 && nextBudget - nextCost < 0) {
1379
1383
  cappedAtLine = lineNumber;
@@ -1383,8 +1387,10 @@ function buildPlainRange(snapshot, range, remainingChars) {
1383
1387
  nextBudget -= nextCost;
1384
1388
  }
1385
1389
  if (lines.length === 0) {
1386
- lines.push(`${range.startLine}|${snapshot.lines[range.startLine - 1] ?? ""}`);
1387
- nextBudget -= lines[0].length + 1;
1390
+ const content = snapshot.lines[range.startLine - 1] ?? "";
1391
+ const rendered = plain ? `${range.startLine}|${content}` : `${hashLine(content)}.${range.startLine} ${content}`;
1392
+ lines.push(rendered);
1393
+ nextBudget -= rendered.length + 1;
1388
1394
  if (range.endLine > range.startLine) cappedAtLine = range.startLine + 1;
1389
1395
  }
1390
1396
  return { text: lines.join("\n"), remainingChars: nextBudget, cappedAtLine };
@@ -1463,7 +1469,7 @@ Graph: ${items.join(" | ")}`;
1463
1469
  let remainingChars2 = MAX_OUTPUT_CHARS;
1464
1470
  let cappedAtLine2 = 0;
1465
1471
  for (const range of normalizedRanges) {
1466
- const built = buildPlainRange(snapshot, range, remainingChars2);
1472
+ const built = buildPlainRange(snapshot, range, remainingChars2, plain);
1467
1473
  sections.push(built.text);
1468
1474
  remainingChars2 = built.remainingChars;
1469
1475
  if (built.cappedAtLine) {
@@ -4753,7 +4759,7 @@ function errorResult(code, message, recovery, { large = false, extra = null } =
4753
4759
  }
4754
4760
 
4755
4761
  // server.mjs
4756
- var version = true ? "1.18.1" : (await null).createRequire(import.meta.url)("./package.json").version;
4762
+ var version = true ? "1.18.2" : (await null).createRequire(import.meta.url)("./package.json").version;
4757
4763
  var STATUS_ENUM = z2.enum(["OK", "ERROR", "AUTO_REBASED", "CONFLICT", "STALE", "INVALID", "NO_CHANGES", "CHANGED", "UNSUPPORTED"]);
4758
4764
  var ERROR_SHAPE = z2.object({ code: z2.string(), message: z2.string(), recovery: z2.string() }).optional();
4759
4765
  var { server, StdioServerTransport } = await createServerRuntime({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levnikolaevich/hex-line-mcp",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
4
4
  "mcpName": "io.github.levnikolaevich/hex-line-mcp",
5
5
  "type": "module",
6
6
  "description": "Hash-verified file editing MCP + token efficiency hook for AI coding agents. 9 tools: inspect_path, read, edit, write, grep, outline, verify, changes, bulk_replace.",