pi-repoprompt-mcp 0.1.0 → 0.2.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
@@ -37,6 +37,7 @@ Add to `~/.pi/agent/settings.json` (or replace an existing unfiltered `git:githu
37
37
 
38
38
  - RepoPrompt installed
39
39
  - RepoPrompt MCP server reachable (stdio transport)
40
+ - If the server is not configured/auto-detected, the package will still load, but `rp(...)` will error until you configure it
40
41
  - `rp-cli` on `PATH` is recommended (used as a fallback for window discovery)
41
42
 
42
43
  ## Usage
@@ -67,4 +68,15 @@ Create `~/.pi/agent/extensions/repoprompt-mcp.json`:
67
68
  }
68
69
  ```
69
70
 
71
+ If the MCP server is not auto-detected, set `command` explicitly:
72
+
73
+ ```json
74
+ {
75
+ "command": "/Applications/Repo Prompt.app/Contents/MacOS/repoprompt-mcp",
76
+ "args": []
77
+ }
78
+ ```
79
+
80
+ (Alternatively, configure RepoPrompt in `~/.pi/agent/mcp.json`)
81
+
70
82
  For more detail, see: `extensions/repoprompt-mcp/README.md` in the dot314 repo.
@@ -222,9 +222,13 @@ function maybeWrapServerCommand(
222
222
  }
223
223
 
224
224
  /**
225
- * Get the server command and args, or throw if not found
225
+ * Get the server command and args, or return null if not found
226
+ *
227
+ * We avoid throwing on startup because a missing server is a common first-run condition
228
+ * (users may not have installed RepoPrompt / rp-mcp-server yet). Instead we surface this
229
+ * as a non-fatal warning and only error when a user actually tries to use rp features
226
230
  */
227
- export function getServerCommand(config: RpConfig): { command: string; args: string[] } {
231
+ export function getServerCommand(config: RpConfig): { command: string; args: string[] } | null {
228
232
  if (config.command) {
229
233
  return maybeWrapServerCommand(config, {
230
234
  command: config.command,
@@ -232,8 +236,5 @@ export function getServerCommand(config: RpConfig): { command: string; args: str
232
236
  });
233
237
  }
234
238
 
235
- throw new Error(
236
- "RepoPrompt MCP server not found. Please ensure rp-mcp-server is installed, " +
237
- "or add RepoPrompt to your ~/.pi/agent/mcp.json"
238
- );
239
+ return null;
239
240
  }
@@ -250,13 +250,13 @@ Mode priority: call > describe > search > windows > bind > status`,
250
250
 
251
251
  parameters: RpToolSchema,
252
252
 
253
- async execute(_toolCallId, params: RpToolParams, onUpdate, _ctx, _signal) {
253
+ async execute(_toolCallId, params: RpToolParams, _signal, onUpdate, _ctx) {
254
254
  // Provide a no-op if onUpdate is undefined
255
255
  const safeOnUpdate = onUpdate ?? (() => {});
256
256
 
257
257
  // Only modes that need MCP require a connection
258
258
  if (params.call || params.describe || params.search || params.windows || params.bind) {
259
- await ensureConnected();
259
+ await ensureConnected(_ctx as ExtensionContext | undefined);
260
260
  }
261
261
 
262
262
  // Mode resolution: call > describe > search > windows > bind > status
@@ -374,15 +374,28 @@ Mode priority: call > describe > search > windows > bind > status`,
374
374
  // Helper Functions
375
375
  // ───────────────────────────────────────────────────────────────────────────
376
376
 
377
- async function ensureConnected(): Promise<void> {
377
+ async function ensureConnected(ctx?: ExtensionContext): Promise<void> {
378
378
  if (initPromise) {
379
379
  await initPromise;
380
380
  }
381
-
381
+
382
382
  const client = getRpClient();
383
- if (!client.isConnected) {
384
- throw new Error("Not connected to RepoPrompt. Run /rp reconnect");
383
+ if (client.isConnected) {
384
+ return;
385
385
  }
386
+
387
+ // Lazy reconnect: allow the user to install/configure RepoPrompt after Pi starts
388
+ // and have `rp(...)` work without requiring a restart.
389
+ config = loadConfig();
390
+
391
+ const server = getServerCommand(config);
392
+ if (!server) {
393
+ throw new Error(
394
+ "RepoPrompt MCP server not found. Install RepoPrompt / rp-mcp-server, or configure ~/.pi/agent/extensions/repoprompt-mcp.json (or ~/.pi/agent/mcp.json)"
395
+ );
396
+ }
397
+
398
+ await client.connect(server.command, server.args, config.env);
386
399
  }
387
400
 
388
401
  function parseNumber(value: unknown): number | undefined {
@@ -545,11 +558,17 @@ Mode priority: call > describe > search > windows > bind > status`,
545
558
  const client = getRpClient();
546
559
  const binding = getBinding();
547
560
 
561
+ const server = getServerCommand(config);
562
+
548
563
  let text = `RepoPrompt: ${client.status}\n`;
549
564
  if (client.error) {
550
565
  text += `Error: ${client.error}\n`;
551
566
  }
552
567
  text += `Tools: ${client.tools.length}\n`;
568
+ if (!server) {
569
+ text += `Server: (not configured / not auto-detected)\n`;
570
+ text += `Hint: configure ~/.pi/agent/extensions/repoprompt-mcp.json or ~/.pi/agent/mcp.json\n`;
571
+ }
553
572
 
554
573
  if (binding) {
555
574
  text += `\nBound to window ${binding.windowId}`;
@@ -872,11 +891,20 @@ async function initializeExtension(
872
891
 
873
892
  // Get server command
874
893
  const server = getServerCommand(config);
875
-
894
+ if (!server) {
895
+ if (ctx.hasUI) {
896
+ ctx.ui.notify(
897
+ "RepoPrompt MCP server not found. Install RepoPrompt / rp-mcp-server, or configure ~/.pi/agent/extensions/repoprompt-mcp.json (or ~/.pi/agent/mcp.json)",
898
+ "warning"
899
+ );
900
+ }
901
+ return;
902
+ }
903
+
876
904
  // Connect to RepoPrompt
877
905
  const client = getRpClient();
878
906
  await client.connect(server.command, server.args, config.env);
879
-
907
+
880
908
  // Notify connection
881
909
  if (ctx.hasUI) {
882
910
  ctx.ui.notify(`RepoPrompt: connected (${client.tools.length} tools)`, "info");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-repoprompt-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A token-efficient RepoPrompt MCP integration for Pi",
5
5
  "keywords": ["pi-package", "pi", "pi-coding-agent", "repoprompt", "mcp"],
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "diff": "^7.0.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@mariozechner/pi-coding-agent": "*",
25
+ "@mariozechner/pi-coding-agent": ">=0.51.0",
26
26
  "@mariozechner/pi-tui": "*",
27
27
  "@sinclair/typebox": "*"
28
28
  },