@hasna/terminal 3.4.0 → 3.4.1
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/mcp/server.js +4 -7
- package/package.json +1 -1
- package/src/mcp/server.ts +4 -9
package/dist/mcp/server.js
CHANGED
|
@@ -548,14 +548,11 @@ export function createServer() {
|
|
|
548
548
|
server.tool("symbols", "Get a structured outline of a source file — functions, classes, interfaces, exports with line numbers. Replaces the common grep pattern: grep -n '^export|class|function' file.", {
|
|
549
549
|
path: z.string().describe("File path to extract symbols from"),
|
|
550
550
|
}, async ({ path: filePath }) => {
|
|
551
|
-
const {
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
const result = await semanticSearch(file.replace(/\.\w+$/, ""), dir, { maxResults: 50 });
|
|
555
|
-
// Filter to only symbols from the requested file
|
|
556
|
-
const fileSymbols = result.symbols.filter(s => s.file.endsWith(filePath) || s.file.endsWith("/" + filePath));
|
|
551
|
+
const { extractSymbolsFromFile } = await import("../search/semantic.js");
|
|
552
|
+
const symbols = extractSymbolsFromFile(filePath).filter(s => s.kind !== "import");
|
|
553
|
+
logCall("symbols", { command: filePath, outputTokens: symbols.length * 5, durationMs: 0 });
|
|
557
554
|
return {
|
|
558
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
555
|
+
content: [{ type: "text", text: JSON.stringify(symbols) }],
|
|
559
556
|
};
|
|
560
557
|
});
|
|
561
558
|
// ── read_symbol: read a function/class by name ─────────────────────────────
|
package/package.json
CHANGED
package/src/mcp/server.ts
CHANGED
|
@@ -767,16 +767,11 @@ export function createServer(): McpServer {
|
|
|
767
767
|
path: z.string().describe("File path to extract symbols from"),
|
|
768
768
|
},
|
|
769
769
|
async ({ path: filePath }) => {
|
|
770
|
-
const {
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
const result = await semanticSearch(file.replace(/\.\w+$/, ""), dir, { maxResults: 50 });
|
|
774
|
-
// Filter to only symbols from the requested file
|
|
775
|
-
const fileSymbols = result.symbols.filter(s =>
|
|
776
|
-
s.file.endsWith(filePath) || s.file.endsWith("/" + filePath)
|
|
777
|
-
);
|
|
770
|
+
const { extractSymbolsFromFile } = await import("../search/semantic.js");
|
|
771
|
+
const symbols = extractSymbolsFromFile(filePath).filter(s => s.kind !== "import");
|
|
772
|
+
logCall("symbols", { command: filePath, outputTokens: symbols.length * 5, durationMs: 0 });
|
|
778
773
|
return {
|
|
779
|
-
content: [{ type: "text" as const, text: JSON.stringify(
|
|
774
|
+
content: [{ type: "text" as const, text: JSON.stringify(symbols) }],
|
|
780
775
|
};
|
|
781
776
|
}
|
|
782
777
|
);
|