pi-codegraph-extension 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dustin Midyett
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # pi-codegraph
2
+
3
+ CodeGraph MCP tools for the original Pi Coding Agent.
4
+
5
+ This package targets:
6
+
7
+ ```ts
8
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
9
+ ```
10
+
11
+ It does **not** target the Oh My Pi package import:
12
+
13
+ ```ts
14
+ import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
15
+ ```
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pi install npm:pi-codegraph-extension
21
+ ```
22
+
23
+ Or copy the extension file manually into your Pi extension directory.
24
+
25
+ ## Requirements
26
+
27
+ Install CodeGraph globally:
28
+
29
+ ```bash
30
+ npm install -g @colbymchenry/codegraph
31
+ ```
32
+
33
+ Or install it in the project you want to inspect:
34
+
35
+ ```bash
36
+ npm install -D @colbymchenry/codegraph
37
+ ```
38
+
39
+ Initialize the project index:
40
+
41
+ ```bash
42
+ cd /path/to/project
43
+ codegraph init -i
44
+ codegraph status
45
+ ```
46
+
47
+ Then launch Pi from the same shell so it inherits your PATH.
48
+
49
+ ## Optional environment overrides
50
+
51
+ ```bash
52
+ export CODEGRAPH_COMMAND=codegraph
53
+ export CODEGRAPH_ARGS="serve --mcp"
54
+ export CODEGRAPH_TIMEOUT_MS=30000
55
+ ```
56
+
57
+ ## Tools
58
+
59
+ - `codegraph_status`
60
+ - `codegraph_files`
61
+ - `codegraph_search`
62
+ - `codegraph_context`
63
+ - `codegraph_callers`
64
+ - `codegraph_callees`
65
+ - `codegraph_impact`
66
+ - `codegraph_node`
67
+ - `codegraph_explore`
68
+
69
+ ## Notes
70
+
71
+ For `codegraph_files`, pass a repo-relative `path` filter such as:
72
+
73
+ ```text
74
+ src
75
+ src/components
76
+ app
77
+ ```
78
+
79
+ Do not pass the full project root as `path`. Use `projectPath` for the root project directory.
@@ -0,0 +1,3 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ export default function codegraphExtension(pi: ExtensionAPI): void;
3
+ //# sourceMappingURL=codegraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../extensions/codegraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAoapE,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,EAAE,YAAY,QA+Y1D"}
@@ -0,0 +1,679 @@
1
+ import { Type } from "typebox";
2
+ import { spawn } from "node:child_process";
3
+ import * as readline from "node:readline";
4
+ import { pathToFileURL } from "node:url";
5
+ import * as path from "node:path";
6
+ /**
7
+ * CodeGraph Extension for Pi Coding Agent — MCP Edition
8
+ *
9
+ * This version targets the original Pi package:
10
+ *
11
+ * @earendil-works/pi-coding-agent
12
+ *
13
+ * It intentionally does NOT use the Oh My Pi package:
14
+ *
15
+ * @oh-my-pi/pi-coding-agent
16
+ *
17
+ * Linux/WSL fixes:
18
+ * - No hardcoded Windows node.exe or pnpm.mjs path.
19
+ * - Runs `codegraph serve --mcp` from PATH.
20
+ * - Adds the project-local `node_modules/.bin` to PATH before spawning.
21
+ * - Supports CODEGRAPH_COMMAND and CODEGRAPH_ARGS overrides.
22
+ * - Normalizes absolute file paths passed to codegraph_files into repo-relative filters.
23
+ *
24
+ * Expected CodeGraph install:
25
+ *
26
+ * npm install -g @colbymchenry/codegraph
27
+ *
28
+ * Or project-local:
29
+ *
30
+ * npm install -D @colbymchenry/codegraph
31
+ * pnpm add -D @colbymchenry/codegraph
32
+ * bun add -d @colbymchenry/codegraph
33
+ */
34
+ const REQUEST_TIMEOUT_MS = Number(process.env.CODEGRAPH_TIMEOUT_MS ?? 30000);
35
+ function splitArgs(input) {
36
+ const args = [];
37
+ let current = "";
38
+ let quote = null;
39
+ let escaping = false;
40
+ for (const char of input) {
41
+ if (escaping) {
42
+ current += char;
43
+ escaping = false;
44
+ continue;
45
+ }
46
+ if (char === "\\") {
47
+ escaping = true;
48
+ continue;
49
+ }
50
+ if (quote) {
51
+ if (char === quote) {
52
+ quote = null;
53
+ }
54
+ else {
55
+ current += char;
56
+ }
57
+ continue;
58
+ }
59
+ if (char === "'" || char === '"') {
60
+ quote = char;
61
+ continue;
62
+ }
63
+ if (/\s/.test(char)) {
64
+ if (current.length > 0) {
65
+ args.push(current);
66
+ current = "";
67
+ }
68
+ continue;
69
+ }
70
+ current += char;
71
+ }
72
+ if (current.length > 0)
73
+ args.push(current);
74
+ return args;
75
+ }
76
+ function getCodeGraphSpawn(cwd) {
77
+ const localBin = path.join(cwd, "node_modules", ".bin");
78
+ const pathKey = process.platform === "win32" ? "Path" : "PATH";
79
+ const existingPath = process.env[pathKey] ?? process.env.PATH ?? "";
80
+ const env = {
81
+ ...process.env,
82
+ [pathKey]: `${localBin}${path.delimiter}${existingPath}`,
83
+ };
84
+ const command = process.env.CODEGRAPH_COMMAND ??
85
+ (process.platform === "win32" ? "codegraph.cmd" : "codegraph");
86
+ const args = process.env.CODEGRAPH_ARGS
87
+ ? splitArgs(process.env.CODEGRAPH_ARGS)
88
+ : ["serve", "--mcp"];
89
+ return { command, args, env };
90
+ }
91
+ function expandHome(input) {
92
+ if (input === "~") {
93
+ return process.env.HOME ?? input;
94
+ }
95
+ if (input.startsWith("~/")) {
96
+ return path.join(process.env.HOME ?? "", input.slice(2));
97
+ }
98
+ return input;
99
+ }
100
+ function resolveProjectRoot(cwd, maybeProjectPath) {
101
+ if (typeof maybeProjectPath !== "string" || maybeProjectPath.trim() === "") {
102
+ return cwd;
103
+ }
104
+ return path.resolve(cwd, expandHome(maybeProjectPath.trim()));
105
+ }
106
+ function normalizeFilesPath(value, projectRoot) {
107
+ if (typeof value !== "string" || value.trim() === "") {
108
+ return undefined;
109
+ }
110
+ const raw = expandHome(value.trim());
111
+ const resolved = path.resolve(projectRoot, raw);
112
+ // CodeGraph's `path` parameter is a filter under the indexed project.
113
+ // If Pi passes the full project root as `path`, omit the filter.
114
+ if (resolved === projectRoot) {
115
+ return undefined;
116
+ }
117
+ // If Pi passes an absolute path inside the project, convert it to a
118
+ // repo-relative path so CodeGraph can match indexed files.
119
+ const relative = path.relative(projectRoot, resolved);
120
+ if (path.isAbsolute(raw) &&
121
+ relative &&
122
+ !relative.startsWith("..") &&
123
+ !path.isAbsolute(relative)) {
124
+ return relative.split(path.sep).join("/");
125
+ }
126
+ // Otherwise assume the user already supplied a repo-relative path.
127
+ return raw.replaceAll("\\", "/").replace(/^\.?\//, "");
128
+ }
129
+ class MCPClient {
130
+ proc;
131
+ rl;
132
+ pending = new Map();
133
+ timers = new Map();
134
+ idCounter = 0;
135
+ closed = false;
136
+ constructor(cwd) {
137
+ const { command, args, env } = getCodeGraphSpawn(cwd);
138
+ this.proc = spawn(command, args, {
139
+ cwd,
140
+ env,
141
+ stdio: ["pipe", "pipe", "pipe"],
142
+ shell: false,
143
+ });
144
+ const stdout = this.proc.stdout;
145
+ if (!stdout)
146
+ throw new Error("No stdout from MCP process");
147
+ this.rl = readline.createInterface({
148
+ input: stdout,
149
+ terminal: false,
150
+ });
151
+ this.rl.on("line", (line) => this.onLine(line));
152
+ const stderr = this.proc.stderr;
153
+ if (stderr) {
154
+ stderr.on("data", (data) => {
155
+ const text = data.toString().trim();
156
+ if (text)
157
+ console.error("[CodeGraph MCP]", text);
158
+ });
159
+ }
160
+ const stdin = this.proc.stdin;
161
+ if (!stdin)
162
+ throw new Error("No stdin from MCP process");
163
+ this.proc.on("error", (err) => {
164
+ this.closed = true;
165
+ for (const [id, handler] of this.pending) {
166
+ clearTimeout(this.timers.get(id));
167
+ handler({ error: { message: `Failed to start CodeGraph MCP server: ${err.message}` } });
168
+ }
169
+ this.pending.clear();
170
+ this.timers.clear();
171
+ });
172
+ this.proc.on("exit", (code, signal) => {
173
+ this.closed = true;
174
+ const reason = signal ? `signal ${signal}` : `code ${code}`;
175
+ for (const [id, handler] of this.pending) {
176
+ clearTimeout(this.timers.get(id));
177
+ handler({ error: { message: `MCP server exited with ${reason}` } });
178
+ }
179
+ this.pending.clear();
180
+ this.timers.clear();
181
+ });
182
+ }
183
+ onLine(line) {
184
+ try {
185
+ const msg = JSON.parse(line);
186
+ if (msg.id != null && this.pending.has(String(msg.id))) {
187
+ const id = String(msg.id);
188
+ clearTimeout(this.timers.get(id));
189
+ this.timers.delete(id);
190
+ const handler = this.pending.get(id);
191
+ this.pending.delete(id);
192
+ handler(msg);
193
+ }
194
+ }
195
+ catch {
196
+ // Ignore non-JSON log lines from the MCP process.
197
+ }
198
+ }
199
+ async initialize(rootUri, signal) {
200
+ const result = await this.request("initialize", {
201
+ protocolVersion: "2024-11-05",
202
+ capabilities: {},
203
+ clientInfo: {
204
+ name: "pi-codegraph-extension",
205
+ version: "1.0.0",
206
+ },
207
+ rootUri,
208
+ }, signal);
209
+ this.notify("notifications/initialized", {});
210
+ return result;
211
+ }
212
+ async callTool(name, args, signal) {
213
+ return this.request("tools/call", { name, arguments: args }, signal);
214
+ }
215
+ request(method, params, signal) {
216
+ return new Promise((resolve, reject) => {
217
+ if (this.closed) {
218
+ reject(new Error("MCP server connection is closed"));
219
+ return;
220
+ }
221
+ const id = ++this.idCounter;
222
+ const msg = JSON.stringify({ jsonrpc: "2.0", id, method, params });
223
+ const cleanup = () => {
224
+ this.pending.delete(String(id));
225
+ this.timers.delete(String(id));
226
+ clearTimeout(timer);
227
+ signal?.removeEventListener("abort", onAbort);
228
+ };
229
+ const timer = setTimeout(() => {
230
+ cleanup();
231
+ reject(new Error(`MCP request timeout (${REQUEST_TIMEOUT_MS}ms): ${method}`));
232
+ }, REQUEST_TIMEOUT_MS);
233
+ const onAbort = () => {
234
+ cleanup();
235
+ this.close();
236
+ reject(new Error("MCP request cancelled by user"));
237
+ };
238
+ signal?.addEventListener("abort", onAbort);
239
+ this.timers.set(String(id), timer);
240
+ const stdin = this.proc.stdin;
241
+ if (!stdin) {
242
+ cleanup();
243
+ reject(new Error("No stdin from MCP process"));
244
+ return;
245
+ }
246
+ this.pending.set(String(id), (msg) => {
247
+ cleanup();
248
+ if (msg.error) {
249
+ reject(new Error(msg.error.message || JSON.stringify(msg.error)));
250
+ }
251
+ else {
252
+ resolve(msg.result);
253
+ }
254
+ });
255
+ stdin.write(msg + "\n");
256
+ });
257
+ }
258
+ notify(method, params) {
259
+ if (this.closed)
260
+ return;
261
+ const stdin = this.proc.stdin;
262
+ if (!stdin)
263
+ return;
264
+ const msg = JSON.stringify({ jsonrpc: "2.0", method, params });
265
+ stdin.write(msg + "\n");
266
+ }
267
+ close() {
268
+ if (this.closed)
269
+ return;
270
+ this.closed = true;
271
+ for (const [id, handler] of this.pending) {
272
+ clearTimeout(this.timers.get(id));
273
+ handler({ error: { message: "MCP client closed" } });
274
+ }
275
+ this.pending.clear();
276
+ this.timers.clear();
277
+ this.rl.close();
278
+ const stdin = this.proc.stdin;
279
+ if (stdin && !stdin.destroyed) {
280
+ stdin.end();
281
+ }
282
+ if (!this.proc.killed) {
283
+ this.proc.kill();
284
+ }
285
+ }
286
+ }
287
+ async function runMCPTool(cwd, toolName, args, signal) {
288
+ const projectRoot = resolveProjectRoot(cwd, args.projectPath);
289
+ const client = new MCPClient(projectRoot);
290
+ try {
291
+ const rootUri = pathToFileURL(projectRoot).href;
292
+ await client.initialize(rootUri, signal);
293
+ const finalArgs = {
294
+ ...args,
295
+ projectPath: projectRoot,
296
+ };
297
+ const result = await client.callTool(toolName, finalArgs, signal);
298
+ return result;
299
+ }
300
+ finally {
301
+ client.close();
302
+ }
303
+ }
304
+ function handleError(err, toolName) {
305
+ let message = err instanceof Error ? err.message : String(err);
306
+ if (message.includes("ENOENT") ||
307
+ message.includes("spawn") ||
308
+ message.includes("Failed to start CodeGraph")) {
309
+ message =
310
+ "CodeGraph CLI not found or could not be started.\n\n" +
311
+ "Install globally:\n" +
312
+ " npm install -g @colbymchenry/codegraph\n\n" +
313
+ "Or install in the project:\n" +
314
+ " npm install -D @colbymchenry/codegraph\n" +
315
+ " pnpm add -D @colbymchenry/codegraph\n" +
316
+ " bun add -d @colbymchenry/codegraph\n\n" +
317
+ "Then verify from the same shell that launches Pi:\n" +
318
+ " codegraph --version\n" +
319
+ " codegraph serve --mcp\n\n" +
320
+ "Optional override:\n" +
321
+ " CODEGRAPH_COMMAND=codegraph\n" +
322
+ " CODEGRAPH_ARGS=\"serve --mcp\"";
323
+ }
324
+ else if (message.includes("not initialized") || message.includes(".codegraph")) {
325
+ message =
326
+ `${message}\n\nInitialize and index the project first:\n` +
327
+ " codegraph init -i\n" +
328
+ " codegraph status";
329
+ }
330
+ return {
331
+ content: [{ type: "text", text: `CodeGraph ${toolName} failed: ${message}` }],
332
+ isError: true,
333
+ details: { error: message, tool: toolName },
334
+ };
335
+ }
336
+ const projectPathProperty = Type.Optional(Type.String({
337
+ description: "Path to a different project with .codegraph/ initialized. If omitted, uses current project.",
338
+ }));
339
+ export default function codegraphExtension(pi) {
340
+ pi.registerTool({
341
+ name: "codegraph_search",
342
+ label: "CodeGraph Search",
343
+ description: "Search for symbols across the codebase using CodeGraph's semantic index",
344
+ promptSnippet: "Search codebase symbols via CodeGraph",
345
+ promptGuidelines: [
346
+ "Use codegraph_search when you need to find symbols by name across the codebase",
347
+ "Use for: finding function definitions, class implementations, types, routes",
348
+ "Prefer codegraph_context for exploration tasks — it composes multiple searches in one call",
349
+ ],
350
+ parameters: Type.Object({
351
+ query: Type.String({ description: "Symbol name or partial name, e.g. auth or UserService" }),
352
+ kind: Type.Optional(Type.Union([
353
+ Type.Literal("function"),
354
+ Type.Literal("method"),
355
+ Type.Literal("class"),
356
+ Type.Literal("interface"),
357
+ Type.Literal("type"),
358
+ Type.Literal("variable"),
359
+ Type.Literal("route"),
360
+ Type.Literal("component"),
361
+ ], { description: "Filter by node kind" })),
362
+ limit: Type.Optional(Type.Number({ description: "Maximum results. Default: 20", default: 20 })),
363
+ projectPath: projectPathProperty,
364
+ }),
365
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
366
+ try {
367
+ const result = await runMCPTool(ctx.cwd, "codegraph_search", {
368
+ query: params.query,
369
+ kind: params.kind,
370
+ limit: params.limit ?? 20,
371
+ projectPath: params.projectPath,
372
+ }, signal);
373
+ return {
374
+ content: result.content,
375
+ isError: result.isError,
376
+ details: { tool: "search", query: params.query },
377
+ };
378
+ }
379
+ catch (err) {
380
+ return handleError(err, "search");
381
+ }
382
+ },
383
+ });
384
+ pi.registerTool({
385
+ name: "codegraph_context",
386
+ label: "CodeGraph Context",
387
+ description: "Build comprehensive code context for a task. PRIMARY tool — composes search, node, callers, and callees in one call.",
388
+ promptSnippet: "Build code context via CodeGraph",
389
+ promptGuidelines: [
390
+ "Use codegraph_context as the PRIMARY tool for understanding code areas",
391
+ "Returns large context — often enough without additional tool calls",
392
+ "Use for: onboarding, feature exploration, bug investigation",
393
+ ],
394
+ parameters: Type.Object({
395
+ task: Type.String({ description: "Task description, bug, or feature to build context for" }),
396
+ maxNodes: Type.Optional(Type.Number({ description: "Maximum symbols to include. Default: 20", default: 20 })),
397
+ includeCode: Type.Optional(Type.Boolean({ description: "Include code snippets. Default: true", default: true })),
398
+ projectPath: projectPathProperty,
399
+ }),
400
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
401
+ try {
402
+ const result = await runMCPTool(ctx.cwd, "codegraph_context", {
403
+ task: params.task,
404
+ maxNodes: params.maxNodes ?? 20,
405
+ includeCode: params.includeCode ?? true,
406
+ projectPath: params.projectPath,
407
+ }, signal);
408
+ return {
409
+ content: result.content,
410
+ isError: result.isError,
411
+ details: { tool: "context", task: params.task },
412
+ };
413
+ }
414
+ catch (err) {
415
+ return handleError(err, "context");
416
+ }
417
+ },
418
+ });
419
+ pi.registerTool({
420
+ name: "codegraph_callers",
421
+ label: "CodeGraph Callers",
422
+ description: "Find all functions/methods that call a specific symbol",
423
+ promptSnippet: "Find callers of a symbol",
424
+ promptGuidelines: [
425
+ "Use codegraph_callers before modifying a function to see call sites",
426
+ "Use for: understanding usage patterns, impact analysis",
427
+ ],
428
+ parameters: Type.Object({
429
+ symbol: Type.String({ description: "Function, method, or class name to find callers for" }),
430
+ limit: Type.Optional(Type.Number({ description: "Maximum callers. Default: 20", default: 20 })),
431
+ projectPath: projectPathProperty,
432
+ }),
433
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
434
+ try {
435
+ const result = await runMCPTool(ctx.cwd, "codegraph_callers", {
436
+ symbol: params.symbol,
437
+ limit: params.limit ?? 20,
438
+ projectPath: params.projectPath,
439
+ }, signal);
440
+ return {
441
+ content: result.content,
442
+ isError: result.isError,
443
+ details: { tool: "callers", symbol: params.symbol },
444
+ };
445
+ }
446
+ catch (err) {
447
+ return handleError(err, "callers");
448
+ }
449
+ },
450
+ });
451
+ pi.registerTool({
452
+ name: "codegraph_callees",
453
+ label: "CodeGraph Callees",
454
+ description: "Find all functions/methods that a specific symbol calls",
455
+ promptSnippet: "Find callees of a symbol",
456
+ promptGuidelines: [
457
+ "Use codegraph_callees to understand dependencies and code flow",
458
+ "Use for: tracing execution paths, understanding what a function depends on",
459
+ ],
460
+ parameters: Type.Object({
461
+ symbol: Type.String({ description: "Function, method, or class name to find callees for" }),
462
+ limit: Type.Optional(Type.Number({ description: "Maximum callees. Default: 20", default: 20 })),
463
+ projectPath: projectPathProperty,
464
+ }),
465
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
466
+ try {
467
+ const result = await runMCPTool(ctx.cwd, "codegraph_callees", {
468
+ symbol: params.symbol,
469
+ limit: params.limit ?? 20,
470
+ projectPath: params.projectPath,
471
+ }, signal);
472
+ return {
473
+ content: result.content,
474
+ isError: result.isError,
475
+ details: { tool: "callees", symbol: params.symbol },
476
+ };
477
+ }
478
+ catch (err) {
479
+ return handleError(err, "callees");
480
+ }
481
+ },
482
+ });
483
+ pi.registerTool({
484
+ name: "codegraph_impact",
485
+ label: "CodeGraph Impact",
486
+ description: "Analyze the impact radius of changing a symbol",
487
+ promptSnippet: "Analyze impact of changes",
488
+ promptGuidelines: [
489
+ "Use codegraph_impact before making changes to see affected code",
490
+ "Use for: refactor planning, assessing blast radius of modifications",
491
+ ],
492
+ parameters: Type.Object({
493
+ symbol: Type.String({ description: "Symbol to analyze impact for" }),
494
+ depth: Type.Optional(Type.Number({ description: "Dependency traversal depth. Default: 2", default: 2 })),
495
+ projectPath: projectPathProperty,
496
+ }),
497
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
498
+ try {
499
+ const result = await runMCPTool(ctx.cwd, "codegraph_impact", {
500
+ symbol: params.symbol,
501
+ depth: params.depth ?? 2,
502
+ projectPath: params.projectPath,
503
+ }, signal);
504
+ return {
505
+ content: result.content,
506
+ isError: result.isError,
507
+ details: { tool: "impact", symbol: params.symbol },
508
+ };
509
+ }
510
+ catch (err) {
511
+ return handleError(err, "impact");
512
+ }
513
+ },
514
+ });
515
+ pi.registerTool({
516
+ name: "codegraph_node",
517
+ label: "CodeGraph Node",
518
+ description: "Get detailed information about a specific code symbol",
519
+ promptSnippet: "Get symbol details via CodeGraph",
520
+ promptGuidelines: [
521
+ "Use codegraph_node when you need full source code of a symbol",
522
+ "Set includeCode=true only when needed — it increases token usage",
523
+ "Use codegraph_search first to find the exact symbol name",
524
+ ],
525
+ parameters: Type.Object({
526
+ symbol: Type.String({ description: "Symbol name to get details for" }),
527
+ includeCode: Type.Optional(Type.Boolean({ description: "Include full source code. Default: false", default: false })),
528
+ projectPath: projectPathProperty,
529
+ }),
530
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
531
+ try {
532
+ const result = await runMCPTool(ctx.cwd, "codegraph_node", {
533
+ symbol: params.symbol,
534
+ includeCode: params.includeCode ?? false,
535
+ projectPath: params.projectPath,
536
+ }, signal);
537
+ return {
538
+ content: result.content,
539
+ isError: result.isError,
540
+ details: { tool: "node", symbol: params.symbol },
541
+ };
542
+ }
543
+ catch (err) {
544
+ return handleError(err, "node");
545
+ }
546
+ },
547
+ });
548
+ pi.registerTool({
549
+ name: "codegraph_explore",
550
+ label: "CodeGraph Explore",
551
+ description: "Deep exploration tool — returns comprehensive context for a topic in a single call. Groups source code by file with relationship maps.",
552
+ promptSnippet: "Deep exploration via CodeGraph",
553
+ promptGuidelines: [
554
+ "Use codegraph_explore for thorough understanding of unfamiliar topics",
555
+ "Use specific symbol names, file names, or short code terms — NOT natural language sentences",
556
+ "Use codegraph_search first to discover relevant symbol names",
557
+ "Respect the explore budget — do not make more calls than recommended",
558
+ ],
559
+ parameters: Type.Object({
560
+ query: Type.String({
561
+ description: "Symbol names, file names, or short code terms to explore. Bad: how are prompts loaded. Good: readAgentsFromDirectory createClaudeSession",
562
+ }),
563
+ maxFiles: Type.Optional(Type.Number({ description: "Maximum files to include source from. Default: 12", default: 12 })),
564
+ projectPath: projectPathProperty,
565
+ }),
566
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
567
+ try {
568
+ const result = await runMCPTool(ctx.cwd, "codegraph_explore", {
569
+ query: params.query,
570
+ maxFiles: params.maxFiles ?? 12,
571
+ projectPath: params.projectPath,
572
+ }, signal);
573
+ return {
574
+ content: result.content,
575
+ isError: result.isError,
576
+ details: { tool: "explore", query: params.query },
577
+ };
578
+ }
579
+ catch (err) {
580
+ return handleError(err, "explore");
581
+ }
582
+ },
583
+ });
584
+ pi.registerTool({
585
+ name: "codegraph_status",
586
+ label: "CodeGraph Status",
587
+ description: "Get the status of the CodeGraph index — files, nodes, edges, backend type",
588
+ promptSnippet: "Check CodeGraph index status",
589
+ promptGuidelines: [
590
+ "Use codegraph_status to verify the index is ready before other operations",
591
+ "Check backend type — wasm fallback is slower than native",
592
+ ],
593
+ parameters: Type.Object({
594
+ projectPath: projectPathProperty,
595
+ }),
596
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
597
+ try {
598
+ const result = await runMCPTool(ctx.cwd, "codegraph_status", {
599
+ projectPath: params.projectPath,
600
+ }, signal);
601
+ return {
602
+ content: result.content,
603
+ isError: result.isError,
604
+ details: { tool: "status" },
605
+ };
606
+ }
607
+ catch (err) {
608
+ return handleError(err, "status");
609
+ }
610
+ },
611
+ });
612
+ pi.registerTool({
613
+ name: "codegraph_files",
614
+ label: "CodeGraph Files",
615
+ description: "Get project file structure from the CodeGraph index. Faster than filesystem scanning. Use first when exploring project structure.",
616
+ promptSnippet: "List project files via CodeGraph",
617
+ promptGuidelines: [
618
+ "Use codegraph_files first when exploring project structure or finding files",
619
+ "Much faster than Glob/filesystem scanning",
620
+ "Use tree format for overview, grouped for language breakdown",
621
+ "For path, pass a repo-relative directory like src/components; do not pass the full project root",
622
+ ],
623
+ parameters: Type.Object({
624
+ path: Type.Optional(Type.String({
625
+ description: "Repo-relative filter under the project, e.g. src/components. Absolute paths are normalized when possible.",
626
+ })),
627
+ pattern: Type.Optional(Type.String({ description: "Glob pattern filter, e.g. *.tsx or **/*.test.ts" })),
628
+ format: Type.Optional(Type.Union([Type.Literal("tree"), Type.Literal("flat"), Type.Literal("grouped")], {
629
+ description: "Output format. Default: tree",
630
+ })),
631
+ includeMetadata: Type.Optional(Type.Boolean({ description: "Include language and symbol count. Default: true", default: true })),
632
+ maxDepth: Type.Optional(Type.Number({ description: "Maximum directory depth" })),
633
+ projectPath: projectPathProperty,
634
+ }),
635
+ async execute(_toolCallId, params, signal, _onUpdate, ctx) {
636
+ try {
637
+ const projectRoot = resolveProjectRoot(ctx.cwd, params.projectPath);
638
+ const normalizedPath = normalizeFilesPath(params.path, projectRoot);
639
+ const args = {
640
+ projectPath: projectRoot,
641
+ };
642
+ if (normalizedPath != null)
643
+ args.path = normalizedPath;
644
+ if (params.pattern != null)
645
+ args.pattern = params.pattern;
646
+ if (params.format != null)
647
+ args.format = params.format;
648
+ if (params.includeMetadata != null)
649
+ args.includeMetadata = params.includeMetadata;
650
+ if (params.maxDepth != null)
651
+ args.maxDepth = params.maxDepth;
652
+ const result = await runMCPTool(ctx.cwd, "codegraph_files", args, signal);
653
+ return {
654
+ content: result.content,
655
+ isError: result.isError,
656
+ details: { tool: "files", args },
657
+ };
658
+ }
659
+ catch (err) {
660
+ return handleError(err, "files");
661
+ }
662
+ },
663
+ });
664
+ pi.registerCommand("codegraph-status", {
665
+ description: "Check CodeGraph MCP server connectivity",
666
+ handler: async (_args, ctx) => {
667
+ try {
668
+ const result = await runMCPTool(ctx.cwd, "codegraph_status", {});
669
+ const text = result.content.map((c) => c.text).join("\n");
670
+ ctx.ui.notify(`CodeGraph MCP connected.\n${text}`, "info");
671
+ }
672
+ catch (err) {
673
+ const handled = handleError(err, "status");
674
+ ctx.ui.notify(handled.content[0]?.text ?? "CodeGraph MCP connection failed", "error");
675
+ }
676
+ },
677
+ });
678
+ }
679
+ //# sourceMappingURL=codegraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegraph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C;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,CAAC,kBAAkB,EAAE;QACrC,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;gBACjE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC1D,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,6BAA6B,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAC3C,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,iCAAiC,EAAE,OAAO,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "pi-codegraph-extension",
3
+ "version": "0.1.1",
4
+ "description": "CodeGraph MCP tools for the Pi Coding Agent — semantic code search, impact analysis, call graphs, and deep exploration.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "pi-package",
9
+ "pi",
10
+ "pi-extension",
11
+ "pi-coding-agent",
12
+ "codegraph",
13
+ "mcp",
14
+ "@earendil-works/pi-coding-agent"
15
+ ],
16
+ "homepage": "https://github.com/gripebomb/pi-codegraph-extension#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/gripebomb/pi-codegraph-extension.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/gripebomb/pi-codegraph-extension/issues"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "import": "./dist/codegraph.js",
27
+ "types": "./dist/codegraph.d.ts"
28
+ }
29
+ },
30
+ "main": "./dist/codegraph.js",
31
+ "types": "./dist/codegraph.d.ts",
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "LICENSE"
36
+ ],
37
+ "pi": {
38
+ "extensions": [
39
+ "./dist/codegraph.js"
40
+ ]
41
+ },
42
+ "peerDependencies": {
43
+ "@earendil-works/pi-coding-agent": "*"
44
+ },
45
+ "dependencies": {
46
+ "typebox": "^1.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@earendil-works/pi-coding-agent": "latest",
50
+ "typescript": "latest"
51
+ },
52
+ "scripts": {
53
+ "build": "tsc",
54
+ "pack:check": "npm pack --dry-run",
55
+ "prepublishOnly": "tsc"
56
+ }
57
+ }