@mrclrchtr/supi-tree-sitter 1.7.0 → 1.8.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mrclrchtr/supi-tree-sitter
2
2
 
3
- Adds a `tree_sitter` tool to the [pi coding agent](https://github.com/earendil-works/pi) for parser-based structural code analysis.
3
+ Adds focused structural code analysis tools to the [pi coding agent](https://github.com/earendil-works/pi) using Tree-sitter parsers.
4
4
 
5
5
  ## Install
6
6
 
@@ -18,27 +18,35 @@ After editing the source, run `/reload`.
18
18
 
19
19
  ## What you get
20
20
 
21
- After install, pi gets one tool:
21
+ After install, pi gets **6 focused tools** for parser-based structural analysis:
22
22
 
23
- - `tree_sitter` — inspect code structure through Tree-sitter parsers instead of plain text search
23
+ - `tree_sitter_outline` — shallow structural outline of declarations in JavaScript/TypeScript files
24
+ - `tree_sitter_imports` — list imports in JavaScript/TypeScript files
25
+ - `tree_sitter_exports` — list exports in JavaScript/TypeScript files
26
+ - `tree_sitter_node_at` — find the exact syntax node and ancestry at a position (any supported grammar)
27
+ - `tree_sitter_query` — run a custom Tree-sitter query against a file (any supported grammar)
28
+ - `tree_sitter_callees` — find outgoing calls from the enclosing function or method at a position (most grammars)
24
29
 
25
- ## `tree_sitter` actions
30
+ ### Outline, imports, exports
26
31
 
27
- | Action | What it is for | Current language coverage |
28
- | --- | --- | --- |
29
- | `outline` | List structural declarations such as functions, classes, interfaces, and methods | JavaScript / TypeScript only |
30
- | `imports` | List import statements | JavaScript / TypeScript only |
31
- | `exports` | List export declarations, re-exports, and export assignments | JavaScript / TypeScript only |
32
- | `node_at` | Show the syntax node at a position, including ancestry | Any supported grammar |
33
- | `query` | Run a custom Tree-sitter query against a file | Any supported grammar |
34
- | `callees` | Find outgoing calls from the enclosing function or method at a position | Supported for most grammars, but not all |
32
+ These three tools work on JavaScript, TypeScript, JSX, and TSX files. They provide parser-level structural information without needing a language server:
33
+
34
+ - `tree_sitter_outline` top-level declarations plus class/interface/enum members
35
+ - `tree_sitter_imports` module specifiers and source locations for each import
36
+ - `tree_sitter_exports` kind, name, and module specifier (for re-exports) of each export
37
+
38
+ ### Node-at, query, callees
39
+
40
+ These tools work across all or most supported grammars:
41
+
42
+ - `tree_sitter_node_at` — exact syntax node type and ancestry at a given file position
43
+ - `tree_sitter_query` — custom Tree-sitter query pattern matching on any supported grammar
44
+ - `tree_sitter_callees` — outgoing calls from the enclosing function or method at a given position
35
45
 
36
46
  Coordinates use **1-based** line and character columns. Character positions use UTF-16 code units. Relative paths resolve from the session cwd, and a leading `@` on file paths is stripped.
37
47
 
38
48
  ## Supported file families
39
49
 
40
- The current tool description covers:
41
-
42
50
  - JavaScript / TypeScript (`.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs`, `.mts`, `.cts`)
43
51
  - Python (`.py`, `.pyi`)
44
52
  - Rust (`.rs`)
@@ -84,7 +92,10 @@ if (state.kind === "ready") {
84
92
 
85
93
  ## Source
86
94
 
87
- - `src/tree-sitter.ts` — tool registration and action handling
95
+ - `src/tool/tool-specs.ts` — single source of truth for the public tool surface
96
+ - `src/tool/guidance.ts` — prompt surfaces derived from tool specs
97
+ - `src/tool/register-tools.ts` — focused tool registration driven by tool specs
98
+ - `src/tree-sitter.ts` — extension entrypoint (thin wire-up)
88
99
  - `src/session/runtime.ts` — parser and query runtime
89
100
  - `src/session/session.ts` — runtime-backed service helpers and owned session API
90
101
  - `src/session/service-registry.ts` — shared session-scoped structural service registry
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,8 +37,19 @@
37
37
  "main": "src/api.ts",
38
38
  "exports": {
39
39
  "./api": "./src/api.ts",
40
+ "./config": "./src/config.ts",
41
+ "./context": "./src/context.ts",
42
+ "./debug": "./src/debug-registry.ts",
40
43
  "./extension": "./src/extension.ts",
41
- "./package.json": "./package.json"
44
+ "./package.json": "./package.json",
45
+ "./path": "./src/path.ts",
46
+ "./project": "./src/project.ts",
47
+ "./session": "./src/session.ts",
48
+ "./settings": "./src/settings.ts",
49
+ "./settings-ui": "./src/settings-ui.ts",
50
+ "./terminal": "./src/terminal.ts",
51
+ "./tool-framework": "./src/tool-framework.ts",
52
+ "./types": "./src/types.ts"
42
53
  },
43
54
  "pi": {
44
55
  "extensions": [
@@ -1,96 +1,30 @@
1
1
  // supi-core — shared infrastructure for SuPi extensions.
2
2
  // Provides XML context tag wrapping, unified config system, context-message utilities,
3
3
  // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
+ //
5
+ // Convenience barrel — re-exports all domain entry points.
6
+ // For lighter imports, use one of the domain subpaths directly
7
+ // (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
4
8
 
5
- export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
6
- export {
7
- loadSupiConfig,
8
- loadSupiConfigForScope,
9
- readJsonFile,
10
- removeSupiConfigKey,
11
- writeSupiConfig,
12
- } from "./config/config.ts";
13
- export type { ConfigSettingsHelpers, ConfigSettingsOptions } from "./config/config-settings.ts";
14
- export { registerConfigSettings } from "./config/config-settings.ts";
15
- export type { ContextMessageLike } from "./context/context-messages.ts";
16
- export {
17
- findLastUserMessageIndex,
18
- getContextToken,
19
- getPromptContent,
20
- pruneAndReorderContextMessages,
21
- restorePromptContent,
22
- } from "./context/context-messages.ts";
23
- export type { ContextProvider } from "./context/context-provider-registry.ts";
24
- export {
25
- clearRegisteredContextProviders,
26
- getRegisteredContextProviders,
27
- registerContextProvider,
28
- } from "./context/context-provider-registry.ts";
29
- export { wrapExtensionContext } from "./context/context-tag.ts";
30
- export type {
31
- DebugAgentAccess,
32
- DebugEvent,
33
- DebugEventInput,
34
- DebugEventQuery,
35
- DebugEventQueryResult,
36
- DebugEventView,
37
- DebugLevel,
38
- DebugNotifyLevel,
39
- DebugRegistryConfig,
40
- DebugSummary,
41
- } from "./debug-registry.ts";
42
- export {
43
- clearDebugEvents,
44
- configureDebugRegistry,
45
- DEBUG_REGISTRY_DEFAULTS,
46
- getDebugEvents,
47
- getDebugRegistryConfig,
48
- getDebugSummary,
49
- recordDebugEvent,
50
- redactDebugData,
51
- resetDebugRegistry,
52
- } from "./debug-registry.ts";
53
- export { fileToUri, resolveToolPath, stripToolPathPrefix, uriToFile } from "./path-utils.ts";
54
- export type { KnownRootEntry } from "./project-roots.ts";
55
- export {
56
- buildKnownRootsMap,
57
- byPathDepth,
58
- dedupeTopmostRoots,
59
- findProjectRoot,
60
- isWithin,
61
- isWithinOrEqual,
62
- mergeKnownRoots,
63
- resolveKnownRoot,
64
- segmentCount,
65
- sortRootsBySpecificity,
66
- walkProject,
67
- } from "./project-roots.ts";
68
- export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
69
- export { getActiveBranchEntries } from "./session-utils.ts";
70
- export { registerSettingsCommand } from "./settings/settings-command.ts";
71
- export type { SettingsScope, SettingsSection } from "./settings/settings-registry.ts";
72
- export {
73
- clearRegisteredSettings,
74
- getRegisteredSettings,
75
- registerSettings,
76
- } from "./settings/settings-registry.ts";
77
- export { createInputSubmenu, openSettingsOverlay } from "./settings/settings-ui.ts";
78
- export type { TitleTarget } from "./terminal.ts";
79
- export {
80
- DONE_SYMBOL,
81
- formatTitle,
82
- signalBell,
83
- signalDone,
84
- signalWaiting,
85
- WAITING_SYMBOL,
86
- } from "./terminal.ts";
87
- export type { SuiPiToolPromptSurface, SuiPiToolSpec, ToolExecuteFn } from "./tool-framework.ts";
88
- export {
89
- CharacterParam,
90
- derivePromptSurface,
91
- FileParam,
92
- LineParam,
93
- MaxResultsParam,
94
- registerSuiPiTools,
95
- SymbolParam,
96
- } from "./tool-framework.ts";
9
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
+ export * from "./config.ts";
11
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
12
+ export * from "./context.ts";
13
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
14
+ export * from "./debug-registry.ts";
15
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
16
+ export * from "./path.ts";
17
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
+ export * from "./project.ts";
19
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
+ export * from "./session.ts";
21
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
+ export * from "./settings.ts";
23
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
24
+ export * from "./settings-ui.ts";
25
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
26
+ export * from "./terminal.ts";
27
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
28
+ export * from "./tool-framework.ts";
29
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
30
+ export * from "./types.ts";
@@ -0,0 +1,11 @@
1
+ // supi-core config domain — config loading and config-settings helpers.
2
+ export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
3
+ export {
4
+ loadSupiConfig,
5
+ loadSupiConfigForScope,
6
+ readJsonFile,
7
+ removeSupiConfigKey,
8
+ writeSupiConfig,
9
+ } from "./config/config.ts";
10
+ export type { ConfigSettingsHelpers, ConfigSettingsOptions } from "./config/config-settings.ts";
11
+ export { registerConfigSettings } from "./config/config-settings.ts";
@@ -0,0 +1,16 @@
1
+ // supi-core context domain — context messages, providers, and XML tags.
2
+ export type { ContextMessageLike } from "./context/context-messages.ts";
3
+ export {
4
+ findLastUserMessageIndex,
5
+ getContextToken,
6
+ getPromptContent,
7
+ pruneAndReorderContextMessages,
8
+ restorePromptContent,
9
+ } from "./context/context-messages.ts";
10
+ export type { ContextProvider } from "./context/context-provider-registry.ts";
11
+ export {
12
+ clearRegisteredContextProviders,
13
+ getRegisteredContextProviders,
14
+ registerContextProvider,
15
+ } from "./context/context-provider-registry.ts";
16
+ export { wrapExtensionContext } from "./context/context-tag.ts";
@@ -1,96 +1,30 @@
1
1
  // supi-core — shared infrastructure for SuPi extensions.
2
2
  // Provides XML context tag wrapping, unified config system, context-message utilities,
3
3
  // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
+ //
5
+ // Convenience barrel — re-exports all domain entry points.
6
+ // For lighter imports, use one of the domain subpaths directly
7
+ // (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
4
8
 
5
- export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
6
- export {
7
- loadSupiConfig,
8
- loadSupiConfigForScope,
9
- readJsonFile,
10
- removeSupiConfigKey,
11
- writeSupiConfig,
12
- } from "./config/config.ts";
13
- export type { ConfigSettingsHelpers, ConfigSettingsOptions } from "./config/config-settings.ts";
14
- export { registerConfigSettings } from "./config/config-settings.ts";
15
- export type { ContextMessageLike } from "./context/context-messages.ts";
16
- export {
17
- findLastUserMessageIndex,
18
- getContextToken,
19
- getPromptContent,
20
- pruneAndReorderContextMessages,
21
- restorePromptContent,
22
- } from "./context/context-messages.ts";
23
- export type { ContextProvider } from "./context/context-provider-registry.ts";
24
- export {
25
- clearRegisteredContextProviders,
26
- getRegisteredContextProviders,
27
- registerContextProvider,
28
- } from "./context/context-provider-registry.ts";
29
- export { wrapExtensionContext } from "./context/context-tag.ts";
30
- export type {
31
- DebugAgentAccess,
32
- DebugEvent,
33
- DebugEventInput,
34
- DebugEventQuery,
35
- DebugEventQueryResult,
36
- DebugEventView,
37
- DebugLevel,
38
- DebugNotifyLevel,
39
- DebugRegistryConfig,
40
- DebugSummary,
41
- } from "./debug-registry.ts";
42
- export {
43
- clearDebugEvents,
44
- configureDebugRegistry,
45
- DEBUG_REGISTRY_DEFAULTS,
46
- getDebugEvents,
47
- getDebugRegistryConfig,
48
- getDebugSummary,
49
- recordDebugEvent,
50
- redactDebugData,
51
- resetDebugRegistry,
52
- } from "./debug-registry.ts";
53
- export { fileToUri, resolveToolPath, stripToolPathPrefix, uriToFile } from "./path-utils.ts";
54
- export type { KnownRootEntry } from "./project-roots.ts";
55
- export {
56
- buildKnownRootsMap,
57
- byPathDepth,
58
- dedupeTopmostRoots,
59
- findProjectRoot,
60
- isWithin,
61
- isWithinOrEqual,
62
- mergeKnownRoots,
63
- resolveKnownRoot,
64
- segmentCount,
65
- sortRootsBySpecificity,
66
- walkProject,
67
- } from "./project-roots.ts";
68
- export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
69
- export { getActiveBranchEntries } from "./session-utils.ts";
70
- export { registerSettingsCommand } from "./settings/settings-command.ts";
71
- export type { SettingsScope, SettingsSection } from "./settings/settings-registry.ts";
72
- export {
73
- clearRegisteredSettings,
74
- getRegisteredSettings,
75
- registerSettings,
76
- } from "./settings/settings-registry.ts";
77
- export { createInputSubmenu, openSettingsOverlay } from "./settings/settings-ui.ts";
78
- export type { TitleTarget } from "./terminal.ts";
79
- export {
80
- DONE_SYMBOL,
81
- formatTitle,
82
- signalBell,
83
- signalDone,
84
- signalWaiting,
85
- WAITING_SYMBOL,
86
- } from "./terminal.ts";
87
- export type { SuiPiToolPromptSurface, SuiPiToolSpec, ToolExecuteFn } from "./tool-framework.ts";
88
- export {
89
- CharacterParam,
90
- derivePromptSurface,
91
- FileParam,
92
- LineParam,
93
- MaxResultsParam,
94
- registerSuiPiTools,
95
- SymbolParam,
96
- } from "./tool-framework.ts";
9
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
+ export * from "./config.ts";
11
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
12
+ export * from "./context.ts";
13
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
14
+ export * from "./debug-registry.ts";
15
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
16
+ export * from "./path.ts";
17
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
+ export * from "./project.ts";
19
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
+ export * from "./session.ts";
21
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
+ export * from "./settings.ts";
23
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
24
+ export * from "./settings-ui.ts";
25
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
26
+ export * from "./terminal.ts";
27
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
28
+ export * from "./tool-framework.ts";
29
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
30
+ export * from "./types.ts";
@@ -0,0 +1,2 @@
1
+ // supi-core path domain — file and URI path utilities.
2
+ export { fileToUri, resolveToolPath, stripToolPathPrefix, uriToFile } from "./path-utils.ts";
@@ -0,0 +1,15 @@
1
+ // supi-core project domain — project root discovery and traversal.
2
+ export type { KnownRootEntry } from "./project-roots.ts";
3
+ export {
4
+ buildKnownRootsMap,
5
+ byPathDepth,
6
+ dedupeTopmostRoots,
7
+ findProjectRoot,
8
+ isWithin,
9
+ isWithinOrEqual,
10
+ mergeKnownRoots,
11
+ resolveKnownRoot,
12
+ segmentCount,
13
+ sortRootsBySpecificity,
14
+ walkProject,
15
+ } from "./project-roots.ts";
@@ -0,0 +1,4 @@
1
+ // supi-core session domain — session utilities and registries.
2
+
3
+ export { createRegistry, createSessionStateRegistry } from "./registry-utils.ts";
4
+ export { getActiveBranchEntries } from "./session-utils.ts";
@@ -0,0 +1,2 @@
1
+ // supi-core settings-ui domain — settings TUI components (imports pi-tui at runtime, heavy).
2
+ export { createInputSubmenu, openSettingsOverlay } from "./settings/settings-ui.ts";
@@ -0,0 +1,9 @@
1
+ // supi-core settings domain — settings registry (lightweight, type-only pi-tui import).
2
+
3
+ export { registerSettingsCommand } from "./settings/settings-command.ts";
4
+ export type { SettingsScope, SettingsSection } from "./settings/settings-registry.ts";
5
+ export {
6
+ clearRegisteredSettings,
7
+ getRegisteredSettings,
8
+ registerSettings,
9
+ } from "./settings/settings-registry.ts";
@@ -0,0 +1,11 @@
1
+ /** 0-based position used by LSP and code-intelligence internally. */
2
+ export interface CodePosition {
3
+ line: number;
4
+ character: number;
5
+ }
6
+
7
+ /** Normalized location — flat replacement for LSP's nested Location/range shape. */
8
+ export interface CodeLocation {
9
+ uri: string;
10
+ range: { start: CodePosition; end: CodePosition };
11
+ }
@@ -0,0 +1,2 @@
1
+ // supi-core types domain — shared substrate types (zero dependencies, pure types).
2
+ export type { CodeLocation, CodePosition } from "./substrate-types.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-tree-sitter",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "SuPi Tree-sitter extension — structural AST analysis for pi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "web-tree-sitter": "^0.26.8",
27
- "@mrclrchtr/supi-core": "1.7.0"
27
+ "@mrclrchtr/supi-core": "1.8.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@earendil-works/pi-ai": "*",
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as fs from "node:fs";
4
4
  import * as path from "node:path";
5
- import { resolveToolPath } from "@mrclrchtr/supi-core/api";
5
+ import { resolveToolPath } from "@mrclrchtr/supi-core/path";
6
6
  import type { Language, Parser, Tree } from "web-tree-sitter";
7
7
  import { nodeToRange } from "../coordinates.ts";
8
8
  import { detectGrammar, resolveGrammarWasmPath } from "../language.ts";
@@ -2,7 +2,7 @@
2
2
  // Peer extensions can import `getSessionTreeSitterService` from the package API
3
3
  // to reuse the active structural runtime without creating duplicate sessions.
4
4
 
5
- import { createSessionStateRegistry } from "@mrclrchtr/supi-core/api";
5
+ import { createSessionStateRegistry } from "@mrclrchtr/supi-core/session";
6
6
  import type { SessionTreeSitterService, SessionTreeSitterServiceState } from "../types.ts";
7
7
 
8
8
  const registry = createSessionStateRegistry<SessionTreeSitterServiceState>(
@@ -1,31 +1,35 @@
1
- // Prompt guidance and tool description for the tree_sitter tool.
1
+ // Guidance surfaces for the focused tree_sitter_* tool set.
2
2
  //
3
- // Note: We intentionally do NOT include cross-tool routing (e.g., "use lsp for
4
- // type info") because this package can be installed standalone without supi-lsp.
3
+ // Derives from tool-specs.ts so prompt surfaces stay in sync with
4
+ // the public tool metadata.
5
5
 
6
- import {
7
- formatTreeSitterActionList,
8
- getTreeSitterActionNamesByGuidanceGroup,
9
- } from "./action-specs.ts";
6
+ import { TREE_SITTER_TOOL_SPECS, type TreeSitterToolName } from "./tool-specs.ts";
10
7
 
11
- const jsTsStructureActions = getTreeSitterActionNamesByGuidanceGroup("js-ts-structure")
12
- .map((action) => `tree_sitter.${action}(file)`)
13
- .join(", ");
8
+ export interface TreeSitterToolPromptSurface {
9
+ description: string;
10
+ promptSnippet: string;
11
+ promptGuidelines: string[];
12
+ }
14
13
 
15
- export const toolDescription = `Tree-sitter tool — parser-level structure and syntax queries for supported files.
14
+ export type TreeSitterToolPromptSurfaceMap = Record<
15
+ TreeSitterToolName,
16
+ TreeSitterToolPromptSurface
17
+ >;
16
18
 
17
- Actions: ${formatTreeSitterActionList()}.
19
+ const _DEFAULT_SURFACES = buildTreeSitterToolPromptSurfaces();
18
20
 
19
- Use tree_sitter for exact syntax nodes, shallow structure, parsed imports/exports, outgoing calls, or custom AST queries within one file. file is required for all actions. line and character are 1-based UTF-16 coordinates for node_at and callees. query is required for query. outline, imports, and exports are JavaScript/TypeScript-only; node_at and query work across supported grammars; callees works for many grammars. Relative paths resolve from the session working directory, and a leading @ on file paths is stripped.`;
20
-
21
- export const promptGuidelines = [
22
- `Use ${jsTsStructureActions} for shallow JavaScript or TypeScript structure without reading the whole file.`,
23
- "Use tree_sitter.node_at(file, line, character) for the exact syntax node and ancestry at a known position.",
24
- "Use tree_sitter.callees(file, line, character) for outgoing calls from the enclosing function or method at a known position.",
25
- "Use tree_sitter.query(file, query) for custom Tree-sitter patterns when the built-in actions are not specific enough.",
26
- "Use tree_sitter for syntax, node types, source ranges, and other parser-backed structure within one supported file.",
27
- "Do not use tree_sitter for type information, cross-file references, semantic renames, or codebase-wide orientation.",
28
- ];
29
-
30
- export const promptSnippet =
31
- "tree_sitter — parser-backed single-file structure, node lookup, callees, and AST queries";
21
+ /**
22
+ * Build the full prompt-surface map for all 6 tree_sitter_* tools.
23
+ */
24
+ export function buildTreeSitterToolPromptSurfaces(): TreeSitterToolPromptSurfaceMap {
25
+ return Object.fromEntries(
26
+ TREE_SITTER_TOOL_SPECS.map((spec) => [
27
+ spec.name,
28
+ {
29
+ description: spec.description,
30
+ promptSnippet: spec.promptSnippet,
31
+ promptGuidelines: [...spec.promptGuidelines],
32
+ } satisfies TreeSitterToolPromptSurface,
33
+ ]),
34
+ ) as TreeSitterToolPromptSurfaceMap;
35
+ }