@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.
@@ -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 { semanticSearch } = await import("../search/semantic.js");
552
- const dir = filePath.replace(/\/[^/]+$/, "") || ".";
553
- const file = filePath.split("/").pop() ?? filePath;
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(fileSymbols) }],
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/terminal",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Smart terminal wrapper for AI agents and humans — structured output, token compression, MCP server, natural language",
5
5
  "type": "module",
6
6
  "files": [
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 { semanticSearch } = await import("../search/semantic.js");
771
- const dir = filePath.replace(/\/[^/]+$/, "") || ".";
772
- const file = filePath.split("/").pop() ?? filePath;
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(fileSymbols) }],
774
+ content: [{ type: "text" as const, text: JSON.stringify(symbols) }],
780
775
  };
781
776
  }
782
777
  );