pi-repoprompt-mcp 0.5.2 → 0.5.4

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
@@ -196,6 +196,8 @@ Options:
196
196
  | `diffViewMode` | `"auto"` | Diff layout for RepoPrompt `git` / `apply_edits` fenced diff output (`auto`, `split`, `unified`) |
197
197
  | `diffSplitMinWidth` | `120` | Minimum render width before `diffViewMode: "auto"` uses split diff layout |
198
198
  | `suppressHostDisconnectedLog` | `true` | Filter noisy stderr from macOS `repoprompt-mcp` (disconnect/retry bootstrap logs) |
199
+ | `autoLaunchApp` | `false` | Auto-launch the RepoPrompt app when the MCP server is unreachable at startup |
200
+ | `appPath` | inferred | Explicit path to `Repo Prompt.app`; if omitted, inferred from the `.app` ancestor of `command` |
199
201
 
200
202
  Automatic tab restoration and provisioning is driven by `autoBindOnStart` and `persistBinding`; there is no separate tab-only configuration surface. Adaptive diff layout applies only to RepoPrompt `git` and `apply_edits` outputs that arrive as fenced `diff` blocks; other rendered output stays on the existing text-based path.
201
203
 
@@ -221,6 +223,8 @@ If the RepoPrompt MCP server stops responding (for example, if the RepoPrompt ap
221
223
 
222
224
  If RepoPrompt is not running when Pi starts, the extension auto-pauses itself after a quick connection timeout. While paused, the `rp` tool returns a short error directing the agent to use native tools. Run `/rp reconnect` once RepoPrompt is open to resume, and the agent will be notified that `rp` is available again.
223
225
 
226
+ If `autoLaunchApp` is enabled, the extension will try to open the RepoPrompt app automatically before pausing. The app path is inferred from the `command` config (e.g. `/Applications/Repo Prompt.app/Contents/MacOS/repoprompt-mcp` → `/Applications/Repo Prompt.app`), or you can set `appPath` explicitly. After launching, the extension waits a few seconds and retries the connection once; if that also fails, it auto-pauses as usual.
227
+
224
228
  ### "No matching window found"
225
229
  - Your `cwd` may not match any RepoPrompt workspace root
226
230
  - Use `/rp windows` to list windows
@@ -250,6 +250,21 @@ function maybeWrapServerCommand(
250
250
  };
251
251
  }
252
252
 
253
+ /**
254
+ * Infer the .app bundle path from an MCP server command that lives inside a .app bundle.
255
+ * e.g. "/Applications/Repo Prompt.app/Contents/MacOS/repoprompt-mcp" → "/Applications/Repo Prompt.app"
256
+ */
257
+ export function inferAppPath(config: RpConfig): string | null {
258
+ if (config.appPath) {
259
+ return config.appPath;
260
+ }
261
+ if (!config.command) {
262
+ return null;
263
+ }
264
+ const appMatch = config.command.match(/^(.+\.app)\//i);
265
+ return appMatch ? appMatch[1] : null;
266
+ }
267
+
253
268
  /**
254
269
  * Get the server command and args, or return null if not found
255
270
  *
@@ -9,6 +9,7 @@
9
9
 
10
10
  import * as fs from "node:fs";
11
11
  import * as path from "node:path";
12
+ import { execFile } from "node:child_process";
12
13
 
13
14
  import type {
14
15
  ExtensionAPI,
@@ -32,7 +33,7 @@ import type {
32
33
  AutoSelectionEntryRangeData,
33
34
  } from "./types.js";
34
35
  import { AUTO_SELECTION_ENTRY_TYPE } from "./types.js";
35
- import { loadConfig, getServerCommand } from "./config.js";
36
+ import { loadConfig, getServerCommand, inferAppPath } from "./config.js";
36
37
  import { getRpClient, resetRpClient } from "./client.js";
37
38
  import {
38
39
  getBinding,
@@ -1260,13 +1261,31 @@ export default function repopromptMcp(pi: ExtensionAPI) {
1260
1261
  return;
1261
1262
  }
1262
1263
  await syncAutoSelectionToCurrentBranch(ctx);
1263
- }).catch((err) => {
1264
+ }).catch(async (err) => {
1264
1265
  if (initPromise === pendingInit) {
1265
1266
  initPromise = null;
1266
1267
  }
1267
1268
  if (shutdownRequested) {
1268
1269
  return;
1269
1270
  }
1271
+ // If autoLaunchApp is enabled, try opening the app and retrying once
1272
+ if (config.autoLaunchApp) {
1273
+ const appPath = inferAppPath(config);
1274
+ if (appPath) {
1275
+ const launched = await tryLaunchApp(appPath);
1276
+ if (launched && !shutdownRequested) {
1277
+ try {
1278
+ await resetRpClient();
1279
+ await initializeExtension(pi, ctx, config);
1280
+ await syncAutoSelectionToCurrentBranch(ctx);
1281
+ return;
1282
+ } catch {
1283
+ // Fall through to pause
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+
1270
1289
  extensionPaused = true;
1271
1290
  if (ctx.hasUI) {
1272
1291
  ctx.ui.notify("RepoPrompt unavailable — extension paused. Use /rp reconnect when ready.", "warning");
@@ -2956,6 +2975,26 @@ async function promptForWindowSelection(
2956
2975
  );
2957
2976
  }
2958
2977
 
2978
+ /**
2979
+ * Try to launch the RepoPrompt app via `open`. Returns true if the app was launched
2980
+ * and appears to have started (the MCP server binary exists inside the bundle).
2981
+ */
2982
+ async function tryLaunchApp(appPath: string): Promise<boolean> {
2983
+ if (process.platform !== "darwin") {
2984
+ return false;
2985
+ }
2986
+ try {
2987
+ await new Promise<void>((resolve, reject) => {
2988
+ execFile("open", ["-a", appPath], (err) => (err ? reject(err) : resolve()));
2989
+ });
2990
+ // Give the app time to start its MCP server
2991
+ await new Promise((resolve) => setTimeout(resolve, 4000));
2992
+ return true;
2993
+ } catch {
2994
+ return false;
2995
+ }
2996
+ }
2997
+
2959
2998
  async function initializeExtension(
2960
2999
  pi: ExtensionAPI,
2961
3000
  ctx: ExtensionContext,
@@ -124,8 +124,12 @@ export interface RpConfig {
124
124
  // (tracks read slices/full files so chat_send/"Oracle" has context without manual selection)
125
125
  autoSelectReadSlices?: boolean; // When true, read_file calls add slices/full selection (default: true)
126
126
 
127
- // /rp oracle behavior
128
- oracleDefaultMode?: "chat" | "plan" | "edit" | "review"; // Default mode when /rp oracle omits --mode (default: "chat")
127
+ // App launch
128
+ autoLaunchApp?: boolean; // Auto-launch RepoPrompt.app on connection failure (default: false)
129
+ appPath?: string; // Explicit path to RepoPrompt.app (inferred from command if omitted)
130
+
131
+ // /rp oracle behavior
132
+ oracleDefaultMode?: "chat" | "plan" | "edit" | "review"; // Default mode when /rp oracle omits --mode (default: "chat")
129
133
  }
130
134
 
131
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-repoprompt-mcp",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "A token-efficient RepoPrompt integration for Pi with automated and branch-safe workspace management",
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": ">=0.51.0",
25
+ "@mariozechner/pi-coding-agent": "0.64.0",
26
26
  "@mariozechner/pi-tui": "*",
27
27
  "@sinclair/typebox": "*"
28
28
  },