@levnikolaevich/hex-line-mcp 1.8.1 → 1.9.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/dist/server.mjs +24 -18
- package/package.json +1 -1
package/dist/server.mjs
CHANGED
|
@@ -281,8 +281,7 @@ function validateWritePath(filePath) {
|
|
|
281
281
|
import { existsSync as existsSync2 } from "node:fs";
|
|
282
282
|
import { join as join3, dirname as dirname2, relative } from "node:path";
|
|
283
283
|
import { createRequire } from "node:module";
|
|
284
|
-
var
|
|
285
|
-
var HEX_LINE_CONTRACT_VERSION_MAX = 2;
|
|
284
|
+
var HEX_LINE_CONTRACT_VERSION = 2;
|
|
286
285
|
var _dbs = /* @__PURE__ */ new Map();
|
|
287
286
|
var _driverUnavailable = false;
|
|
288
287
|
function getGraphDB(filePath) {
|
|
@@ -307,22 +306,10 @@ function getGraphDB(filePath) {
|
|
|
307
306
|
return null;
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
|
-
var _cloneViewAvailable = /* @__PURE__ */ new WeakMap();
|
|
311
|
-
function _hasCloneView(db) {
|
|
312
|
-
if (_cloneViewAvailable.has(db)) return _cloneViewAvailable.get(db);
|
|
313
|
-
try {
|
|
314
|
-
db.prepare("SELECT node_id, norm_hash, file, line_start, display_name FROM hex_line_clone_siblings LIMIT 0").run();
|
|
315
|
-
_cloneViewAvailable.set(db, true);
|
|
316
|
-
return true;
|
|
317
|
-
} catch {
|
|
318
|
-
_cloneViewAvailable.set(db, false);
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
309
|
function validateHexLineContract(db) {
|
|
323
310
|
try {
|
|
324
311
|
const contract = db.prepare("SELECT contract_version FROM hex_line_contract LIMIT 1").get();
|
|
325
|
-
if (!contract || contract.contract_version
|
|
312
|
+
if (!contract || contract.contract_version !== HEX_LINE_CONTRACT_VERSION) return false;
|
|
326
313
|
db.prepare("SELECT node_id, file, line_start, line_end, display_name, kind, callees, callers FROM hex_line_symbol_annotations LIMIT 1").all();
|
|
327
314
|
db.prepare("SELECT source_id, target_id, source_file, source_line, source_display_name, target_file, target_line, target_display_name, confidence FROM hex_line_call_edges LIMIT 1").all();
|
|
328
315
|
return true;
|
|
@@ -394,7 +381,6 @@ function callImpact(db, file, startLine, endLine) {
|
|
|
394
381
|
}
|
|
395
382
|
function cloneWarning(db, file, startLine, endLine) {
|
|
396
383
|
try {
|
|
397
|
-
if (!_hasCloneView(db)) return [];
|
|
398
384
|
const modified = db.prepare(
|
|
399
385
|
`SELECT node_id
|
|
400
386
|
FROM hex_line_symbol_annotations
|
|
@@ -1648,6 +1634,7 @@ try {
|
|
|
1648
1634
|
var DEFAULT_LIMIT2 = 100;
|
|
1649
1635
|
var MAX_OUTPUT = 10 * 1024 * 1024;
|
|
1650
1636
|
var TIMEOUT2 = 3e4;
|
|
1637
|
+
var MAX_SEARCH_OUTPUT_CHARS = 8e4;
|
|
1651
1638
|
function spawnRg(args) {
|
|
1652
1639
|
return new Promise((resolve_, reject) => {
|
|
1653
1640
|
let stdout = "";
|
|
@@ -1844,7 +1831,26 @@ async function contentMode(pattern, target, opts, plain, totalLimit) {
|
|
|
1844
1831
|
}
|
|
1845
1832
|
flushGroup();
|
|
1846
1833
|
if (db) blocks.sort((a, b) => (b.meta.graphScore || 0) - (a.meta.graphScore || 0));
|
|
1847
|
-
|
|
1834
|
+
const parts = [];
|
|
1835
|
+
let budget = MAX_SEARCH_OUTPUT_CHARS;
|
|
1836
|
+
let capped = false;
|
|
1837
|
+
for (const block of blocks) {
|
|
1838
|
+
const serialized = block.type === "edit_ready_block" ? serializeSearchBlock(block, { plain }) : serializeDiagnosticBlock(block);
|
|
1839
|
+
if (parts.length > 0 && budget - serialized.length < 0) {
|
|
1840
|
+
capped = true;
|
|
1841
|
+
break;
|
|
1842
|
+
}
|
|
1843
|
+
parts.push(serialized);
|
|
1844
|
+
budget -= serialized.length;
|
|
1845
|
+
}
|
|
1846
|
+
if (capped) {
|
|
1847
|
+
const remaining = blocks.length - parts.length;
|
|
1848
|
+
parts.push(serializeDiagnosticBlock(buildDiagnosticBlock({
|
|
1849
|
+
kind: "output_capped",
|
|
1850
|
+
message: `OUTPUT_CAPPED: ${remaining} more search block(s) omitted (${MAX_SEARCH_OUTPUT_CHARS} char limit). Narrow with path= or glob= filters.`
|
|
1851
|
+
})));
|
|
1852
|
+
}
|
|
1853
|
+
return parts.join("\n\n");
|
|
1848
1854
|
}
|
|
1849
1855
|
|
|
1850
1856
|
// lib/outline.mjs
|
|
@@ -2840,7 +2846,7 @@ OUTPUT_CAPPED: Output exceeded ${MAX_BULK_OUTPUT_CHARS} chars.`;
|
|
|
2840
2846
|
}
|
|
2841
2847
|
|
|
2842
2848
|
// server.mjs
|
|
2843
|
-
var version = true ? "1.
|
|
2849
|
+
var version = true ? "1.9.0" : (await null).createRequire(import.meta.url)("./package.json").version;
|
|
2844
2850
|
var { server, StdioServerTransport } = await createServerRuntime({
|
|
2845
2851
|
name: "hex-line-mcp",
|
|
2846
2852
|
version
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levnikolaevich/hex-line-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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. 10 tools: read, edit, write, grep, outline, verify, directory_tree, file_info, changes, bulk_replace.",
|