grepmax 0.7.27 → 0.7.28
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/commands/mcp.js
CHANGED
|
@@ -66,6 +66,7 @@ const index_config_1 = require("../lib/index/index-config");
|
|
|
66
66
|
const syncer_1 = require("../lib/index/syncer");
|
|
67
67
|
const meta_cache_1 = require("../lib/store/meta-cache");
|
|
68
68
|
const searcher_1 = require("../lib/search/searcher");
|
|
69
|
+
const annotator_1 = require("../lib/skeleton/annotator");
|
|
69
70
|
const retriever_1 = require("../lib/skeleton/retriever");
|
|
70
71
|
const symbol_extractor_1 = require("../lib/skeleton/symbol-extractor");
|
|
71
72
|
const skeletonizer_1 = require("../lib/skeleton/skeletonizer");
|
|
@@ -757,31 +758,6 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
757
758
|
}
|
|
758
759
|
});
|
|
759
760
|
}
|
|
760
|
-
function annotateSkeletonLines(skeleton, sourceContent) {
|
|
761
|
-
const sourceLines = sourceContent.split("\n");
|
|
762
|
-
const skelLines = skeleton.split("\n");
|
|
763
|
-
const used = new Set();
|
|
764
|
-
return skelLines
|
|
765
|
-
.map((skelLine) => {
|
|
766
|
-
const trimmed = skelLine.trim();
|
|
767
|
-
if (!trimmed ||
|
|
768
|
-
trimmed.startsWith("//") ||
|
|
769
|
-
trimmed.startsWith("*") ||
|
|
770
|
-
trimmed.startsWith("/*")) {
|
|
771
|
-
return skelLine;
|
|
772
|
-
}
|
|
773
|
-
// Match against source lines using first 40 chars
|
|
774
|
-
const matchStr = trimmed.slice(0, 40);
|
|
775
|
-
for (let i = 0; i < sourceLines.length; i++) {
|
|
776
|
-
if (!used.has(i) && sourceLines[i].includes(matchStr)) {
|
|
777
|
-
used.add(i);
|
|
778
|
-
return `${String(i + 1).padStart(4)}│${skelLine}`;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return skelLine;
|
|
782
|
-
})
|
|
783
|
-
.join("\n");
|
|
784
|
-
}
|
|
785
761
|
function handleCodeSkeleton(args) {
|
|
786
762
|
return __awaiter(this, void 0, void 0, function* () {
|
|
787
763
|
const target = String(args.target || "");
|
|
@@ -870,7 +846,7 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
870
846
|
if (fmt === "json") {
|
|
871
847
|
// Extract structured symbols from annotated skeleton
|
|
872
848
|
const annotated = sourceContent
|
|
873
|
-
? annotateSkeletonLines(skeleton, sourceContent)
|
|
849
|
+
? (0, annotator_1.annotateSkeletonLines)(skeleton, sourceContent)
|
|
874
850
|
: skeleton;
|
|
875
851
|
const symbols = (0, symbol_extractor_1.extractSymbolsFromSkeleton)(annotated);
|
|
876
852
|
jsonFiles.push({
|
|
@@ -882,7 +858,7 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
882
858
|
}
|
|
883
859
|
else {
|
|
884
860
|
const annotated = sourceContent
|
|
885
|
-
? annotateSkeletonLines(skeleton, sourceContent)
|
|
861
|
+
? (0, annotator_1.annotateSkeletonLines)(skeleton, sourceContent)
|
|
886
862
|
: skeleton;
|
|
887
863
|
parts.push(`// ${t} (~${tokenEstimate} tokens)\n\n${annotated}`);
|
|
888
864
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.annotateSkeletonLines = annotateSkeletonLines;
|
|
4
|
+
function annotateSkeletonLines(skeleton, sourceContent) {
|
|
5
|
+
const sourceLines = sourceContent.split("\n");
|
|
6
|
+
const skelLines = skeleton.split("\n");
|
|
7
|
+
const used = new Set();
|
|
8
|
+
return skelLines
|
|
9
|
+
.map((skelLine) => {
|
|
10
|
+
const trimmed = skelLine.trim();
|
|
11
|
+
if (!trimmed ||
|
|
12
|
+
trimmed.startsWith("//") ||
|
|
13
|
+
trimmed.startsWith("*") ||
|
|
14
|
+
trimmed.startsWith("/*")) {
|
|
15
|
+
return skelLine;
|
|
16
|
+
}
|
|
17
|
+
const matchStr = trimmed.slice(0, 40);
|
|
18
|
+
for (let i = 0; i < sourceLines.length; i++) {
|
|
19
|
+
if (!used.has(i) && sourceLines[i].includes(matchStr)) {
|
|
20
|
+
used.add(i);
|
|
21
|
+
return `${String(i + 1).padStart(4)}│${skelLine}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return skelLine;
|
|
25
|
+
})
|
|
26
|
+
.join("\n");
|
|
27
|
+
}
|
package/package.json
CHANGED