@coderule/mcp 1.6.3 → 1.7.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/cli.cjs +12 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-cli.cjs +74 -13
- package/dist/mcp-cli.cjs.map +1 -1
- package/dist/mcp-cli.js +74 -13
- package/dist/mcp-cli.js.map +1 -1
- package/package.json +9 -4
package/dist/mcp-cli.js
CHANGED
|
@@ -1046,6 +1046,11 @@ async function walkDirectory(current, opts, stats) {
|
|
|
1046
1046
|
stats.skipped += 1;
|
|
1047
1047
|
continue;
|
|
1048
1048
|
}
|
|
1049
|
+
if (stat.size === 0) {
|
|
1050
|
+
stats.skipped += 1;
|
|
1051
|
+
dirLogger.debug({ relPath }, "Skipping zero-length file");
|
|
1052
|
+
continue;
|
|
1053
|
+
}
|
|
1049
1054
|
const target = dirent.isSymbolicLink() ? await readSymlinkTarget(absPath, dirLogger) : null;
|
|
1050
1055
|
const state = opts.filesRepo.upsertFromStat({
|
|
1051
1056
|
relPath,
|
|
@@ -1564,6 +1569,13 @@ var ServiceRunner = class {
|
|
|
1564
1569
|
this.runtime.logger.debug({ relPath }, "Watcher event ignored by rules");
|
|
1565
1570
|
return;
|
|
1566
1571
|
}
|
|
1572
|
+
if (fileStats.size === 0) {
|
|
1573
|
+
this.runtime.logger.debug(
|
|
1574
|
+
{ relPath },
|
|
1575
|
+
"Watcher skipping zero-length file"
|
|
1576
|
+
);
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1567
1579
|
const isSymlink = fileStats.isSymbolicLink();
|
|
1568
1580
|
const target = isSymlink ? await readSymlinkTarget2(absPath) : null;
|
|
1569
1581
|
const state = this.runtime.filesRepo.upsertFromStat({
|
|
@@ -1916,9 +1928,21 @@ function createMcpServer({
|
|
|
1916
1928
|
server.registerTool(
|
|
1917
1929
|
"check",
|
|
1918
1930
|
{
|
|
1919
|
-
title: "
|
|
1920
|
-
description:
|
|
1921
|
-
|
|
1931
|
+
title: "Coderule Indexing Status",
|
|
1932
|
+
description: `Check the current state of the code indexer. Returns repository info, file states (clean/dirty/hashing/missing), queue metrics, latest snapshot details, and service health.
|
|
1933
|
+
|
|
1934
|
+
Use this tool to:
|
|
1935
|
+
- Debug why queries are failing or returning no results
|
|
1936
|
+
- Verify the indexer is ready before querying
|
|
1937
|
+
- Check which repository is currently indexed
|
|
1938
|
+
- Monitor indexing progress`,
|
|
1939
|
+
inputSchema: {},
|
|
1940
|
+
annotations: {
|
|
1941
|
+
readOnlyHint: true,
|
|
1942
|
+
destructiveHint: false,
|
|
1943
|
+
idempotentHint: true,
|
|
1944
|
+
openWorldHint: false
|
|
1945
|
+
}
|
|
1922
1946
|
},
|
|
1923
1947
|
async () => {
|
|
1924
1948
|
const status = await collectIndexingStatus(runtime, runner);
|
|
@@ -1928,16 +1952,51 @@ function createMcpServer({
|
|
|
1928
1952
|
};
|
|
1929
1953
|
}
|
|
1930
1954
|
);
|
|
1931
|
-
const queryInputSchema = {
|
|
1932
|
-
query: z.string().min(1, "Query text is required"),
|
|
1933
|
-
budgetTokens: z.number().int().positive().optional().describe("Token budget for retrieval (default 3000)")
|
|
1934
|
-
};
|
|
1935
1955
|
server.registerTool(
|
|
1936
1956
|
"query",
|
|
1937
1957
|
{
|
|
1938
|
-
title: "
|
|
1939
|
-
description:
|
|
1940
|
-
|
|
1958
|
+
title: "Semantic Code Retrieval",
|
|
1959
|
+
description: `Graph-based RAG for semantic code search across the indexed codebase.
|
|
1960
|
+
|
|
1961
|
+
\u{1F6A8} CRITICAL: Use this tool FIRST before any code modification, bug fix, feature addition, or architecture exploration.
|
|
1962
|
+
|
|
1963
|
+
QUERY STRATEGY:
|
|
1964
|
+
Use keyword-rich technical terms, NOT natural language questions.
|
|
1965
|
+
|
|
1966
|
+
\u2705 GOOD: "JWT authentication middleware token validation security handler FastAPI"
|
|
1967
|
+
\u2705 GOOD: "file indexing worker celery queue job AST parser embedding chunker"
|
|
1968
|
+
\u2705 GOOD: "database schema SQLAlchemy model migration table column relationship"
|
|
1969
|
+
|
|
1970
|
+
\u274C BAD: "How does authentication work?"
|
|
1971
|
+
\u274C BAD: "Show me the login code"
|
|
1972
|
+
|
|
1973
|
+
RETRIEVAL MECHANISM:
|
|
1974
|
+
- Seeds: Semantic similarity via embeddings (~6 initial matches)
|
|
1975
|
+
- Flood: Graph propagation through AST relationships (imports, calls, inheritance)
|
|
1976
|
+
- Neighbors: Adjacent code chunks for context
|
|
1977
|
+
- Calls: Function call relationships
|
|
1978
|
+
|
|
1979
|
+
Returns 30-50 code segments with file paths, line numbers, and relevance scores.
|
|
1980
|
+
|
|
1981
|
+
DEFAULT BUDGET: 10,000 tokens (sufficient for most tasks)
|
|
1982
|
+
|
|
1983
|
+
WHEN TO USE:
|
|
1984
|
+
- Before modifying ANY existing code
|
|
1985
|
+
- Understanding system architecture
|
|
1986
|
+
- Finding related implementations
|
|
1987
|
+
- Locating tests or examples
|
|
1988
|
+
- Bug investigation
|
|
1989
|
+
- Feature implementation planning`,
|
|
1990
|
+
inputSchema: {
|
|
1991
|
+
query: z.string().min(1, "Query text is required"),
|
|
1992
|
+
budgetTokens: z.number().int().positive().optional().describe("Token budget for retrieval (default 10000)")
|
|
1993
|
+
},
|
|
1994
|
+
annotations: {
|
|
1995
|
+
readOnlyHint: true,
|
|
1996
|
+
destructiveHint: false,
|
|
1997
|
+
idempotentHint: true,
|
|
1998
|
+
openWorldHint: false
|
|
1999
|
+
}
|
|
1941
2000
|
},
|
|
1942
2001
|
async ({
|
|
1943
2002
|
query,
|
|
@@ -1949,7 +2008,8 @@ function createMcpServer({
|
|
|
1949
2008
|
const statusText = formatStatus(
|
|
1950
2009
|
await collectIndexingStatus(runtime, runner)
|
|
1951
2010
|
);
|
|
1952
|
-
const text = `
|
|
2011
|
+
const text = `Indexer not ready. Current status:
|
|
2012
|
+
|
|
1953
2013
|
${statusText}`;
|
|
1954
2014
|
return { content: [{ type: "text", text }] };
|
|
1955
2015
|
}
|
|
@@ -1961,11 +2021,12 @@ ${statusText}`;
|
|
|
1961
2021
|
const statusText = formatStatus(
|
|
1962
2022
|
await collectIndexingStatus(runtime, runner)
|
|
1963
2023
|
);
|
|
1964
|
-
const text = `
|
|
2024
|
+
const text = `Snapshot not ready on server. Current status:
|
|
2025
|
+
|
|
1965
2026
|
${statusText}`;
|
|
1966
2027
|
return { content: [{ type: "text", text }] };
|
|
1967
2028
|
}
|
|
1968
|
-
const effectiveBudget = Math.max(100, budgetTokens ??
|
|
2029
|
+
const effectiveBudget = Math.max(100, budgetTokens ?? 1e4);
|
|
1969
2030
|
try {
|
|
1970
2031
|
const result = await runtime.clients.retrieval.query(
|
|
1971
2032
|
readyHash,
|