@kage-core/kage-graph-mcp 1.1.28 → 1.1.29
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/README.md +1 -2
- package/dist/kernel.js +77 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,8 +37,7 @@ Restart your agent once after setup so MCP tools reload.
|
|
|
37
37
|
- repo-local memory for decisions, runbooks, bug fixes, gotchas, conventions,
|
|
38
38
|
and code explanations
|
|
39
39
|
- a code graph for files, symbols, imports, calls, routes, tests, and packages,
|
|
40
|
-
including generic call/test signals and
|
|
41
|
-
non-TypeScript repos
|
|
40
|
+
including generic call/test signals and mixed-language framework routes
|
|
42
41
|
- memory-code links so project knowledge points at the code it affects
|
|
43
42
|
- decision intelligence for why-memory coverage, stale/weak packets, and
|
|
44
43
|
important files that still lack linked repo knowledge
|
package/dist/kernel.js
CHANGED
|
@@ -2862,6 +2862,25 @@ function parsePythonMethodList(value) {
|
|
|
2862
2862
|
const methods = [...value.matchAll(/["']([A-Za-z]+)["']/g)].map((match) => match[1].toUpperCase());
|
|
2863
2863
|
return methods.length ? unique(methods) : ["GET"];
|
|
2864
2864
|
}
|
|
2865
|
+
const SPRING_ROUTE_METHODS = {
|
|
2866
|
+
GetMapping: "GET",
|
|
2867
|
+
PostMapping: "POST",
|
|
2868
|
+
PutMapping: "PUT",
|
|
2869
|
+
PatchMapping: "PATCH",
|
|
2870
|
+
DeleteMapping: "DELETE",
|
|
2871
|
+
RequestMapping: "ANY",
|
|
2872
|
+
};
|
|
2873
|
+
const ASPNET_ROUTE_METHODS = {
|
|
2874
|
+
Get: "GET",
|
|
2875
|
+
Post: "POST",
|
|
2876
|
+
Put: "PUT",
|
|
2877
|
+
Patch: "PATCH",
|
|
2878
|
+
Delete: "DELETE",
|
|
2879
|
+
};
|
|
2880
|
+
function routeHandlerNearLine(lines, startIndex, pattern) {
|
|
2881
|
+
const handlerLine = lines.slice(startIndex + 1, Math.min(lines.length, startIndex + 8)).find((candidate) => pattern.test(candidate));
|
|
2882
|
+
return handlerLine?.match(pattern)?.[1] ?? null;
|
|
2883
|
+
}
|
|
2865
2884
|
function extractRoutes(path, text, symbols) {
|
|
2866
2885
|
const routes = [];
|
|
2867
2886
|
const addRoute = (method, routePath, offset, framework, handler = null) => {
|
|
@@ -2916,6 +2935,64 @@ function extractRoutes(path, text, symbols) {
|
|
|
2916
2935
|
}
|
|
2917
2936
|
}
|
|
2918
2937
|
}
|
|
2938
|
+
if (extensionOf(path) === ".rb") {
|
|
2939
|
+
for (const match of text.matchAll(/\b(get|post|put|patch|delete)\s+["']([^"']+)["']/gi)) {
|
|
2940
|
+
addRoute(match[1].toUpperCase(), match[2], match.index ?? 0, "rails");
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
if (extensionOf(path) === ".php") {
|
|
2944
|
+
for (const match of text.matchAll(/\bRoute::(get|post|put|patch|delete|options|any)\s*\(\s*["']([^"']+)["']/gi)) {
|
|
2945
|
+
addRoute(match[1].toUpperCase(), match[2], match.index ?? 0, "laravel");
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
if ([".java", ".kt"].includes(extensionOf(path))) {
|
|
2949
|
+
const lines = text.split(/\r?\n/);
|
|
2950
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2951
|
+
const line = lines[index];
|
|
2952
|
+
const mapping = line.match(/@(GetMapping|PostMapping|PutMapping|PatchMapping|DeleteMapping|RequestMapping)\s*(?:\(\s*(?:value\s*=\s*)?["']([^"']+)["'])?/);
|
|
2953
|
+
if (!mapping || !mapping[2])
|
|
2954
|
+
continue;
|
|
2955
|
+
let method = SPRING_ROUTE_METHODS[mapping[1]] ?? "ANY";
|
|
2956
|
+
if (mapping[1] === "RequestMapping") {
|
|
2957
|
+
const explicit = line.match(/RequestMethod\.(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD)/);
|
|
2958
|
+
if (explicit)
|
|
2959
|
+
method = explicit[1];
|
|
2960
|
+
}
|
|
2961
|
+
const handler = routeHandlerNearLine(lines, index, /^\s*(?:public|private|protected)?\s*[\w<>\[\], ?]+\s+([A-Za-z_][\w]*)\s*\(/);
|
|
2962
|
+
addRoute(method, mapping[2], offsetForLine(text, index + 1), "spring", handler);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
if (extensionOf(path) === ".go") {
|
|
2966
|
+
for (const match of text.matchAll(/\b[A-Za-z_][\w]*\.(GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD)\s*\(\s*["`]([^"`]+)["`]\s*,\s*([A-Za-z_][\w.]*)?/g)) {
|
|
2967
|
+
addRoute(match[1], match[2], match.index ?? 0, "go-router", match[3]?.split(".").pop() ?? null);
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
if (extensionOf(path) === ".rs") {
|
|
2971
|
+
for (const match of text.matchAll(/\.route\s*\(\s*["']([^"']+)["']\s*,\s*(get|post|put|patch|delete|options|head)\s*\(\s*([A-Za-z_][\w:]*)?/gi)) {
|
|
2972
|
+
addRoute(match[2].toUpperCase(), match[1], match.index ?? 0, "rust-router", match[3]?.split("::").pop() ?? null);
|
|
2973
|
+
}
|
|
2974
|
+
const lines = text.split(/\r?\n/);
|
|
2975
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2976
|
+
const attr = lines[index].match(/#\[(get|post|put|patch|delete|options|head)\(\s*["']([^"']+)["']\s*\)\]/i);
|
|
2977
|
+
if (!attr)
|
|
2978
|
+
continue;
|
|
2979
|
+
const handler = routeHandlerNearLine(lines, index, /^\s*(?:pub\s+)?(?:async\s+)?fn\s+([A-Za-z_][\w]*)\s*\(/);
|
|
2980
|
+
addRoute(attr[1].toUpperCase(), attr[2], offsetForLine(text, index + 1), "rust-router", handler);
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
if (extensionOf(path) === ".cs") {
|
|
2984
|
+
for (const match of text.matchAll(/\bMap(Get|Post|Put|Patch|Delete)\s*\(\s*["']([^"']+)["']\s*,\s*([A-Za-z_][\w.]*)?/g)) {
|
|
2985
|
+
addRoute(ASPNET_ROUTE_METHODS[match[1]] ?? match[1].toUpperCase(), match[2], match.index ?? 0, "aspnet", match[3]?.split(".").pop() ?? null);
|
|
2986
|
+
}
|
|
2987
|
+
const lines = text.split(/\r?\n/);
|
|
2988
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2989
|
+
const attr = lines[index].match(/\[\s*Http(Get|Post|Put|Patch|Delete)?\s*\(\s*["']([^"']+)["']\s*\)\s*\]/);
|
|
2990
|
+
if (!attr)
|
|
2991
|
+
continue;
|
|
2992
|
+
const handler = routeHandlerNearLine(lines, index, /^\s*(?:public|private|protected|internal)?\s*(?:async\s+)?[\w<>\[\], ?]+\s+([A-Za-z_][\w]*)\s*\(/);
|
|
2993
|
+
addRoute(attr[1] ? ASPNET_ROUTE_METHODS[attr[1]] ?? attr[1].toUpperCase() : "ANY", attr[2], offsetForLine(text, index + 1), "aspnet", handler);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2919
2996
|
if (/app\/api\//.test(path)) {
|
|
2920
2997
|
for (const symbol of symbols.filter((symbol) => symbol.path === path && symbol.export && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(symbol.name))) {
|
|
2921
2998
|
const apiPath = `/${path.replace(/^.*app\/api\//, "").replace(/\/route\.[cm]?[jt]sx?$/, "").replace(/\[([^\]]+)\]/g, ":$1")}`;
|