claude-bridge-cli 1.2.4 → 1.2.6

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.
Files changed (2) hide show
  1. package/lib/bridge.js +19 -3
  2. package/package.json +1 -1
package/lib/bridge.js CHANGED
@@ -357,9 +357,25 @@ function askClaude(config, { prompt, session_id, images, cwd, plan_mode, allow_t
357
357
  });
358
358
  const args = ["-p", `@${tmpFile}`, "--output-format", "json",
359
359
  "--settings", settings, "--permission-mode", "acceptEdits"];
360
+ let resumeCwd = null;
360
361
  if (session_id) {
361
- const sessionExists = scanSessionFiles().some(s => s.id === session_id);
362
- args.push(sessionExists ? "--resume" : "--session-id", session_id);
362
+ const existing = scanSessionFiles().find(s => s.id === session_id);
363
+ if (existing) {
364
+ args.push("--resume", session_id);
365
+ // Scan JSONL for the first event with a cwd field
366
+ try {
367
+ const lines = fs.readFileSync(existing.filePath, "utf8").split("\n");
368
+ for (const line of lines) {
369
+ if (!line) continue;
370
+ try {
371
+ const parsed = JSON.parse(line);
372
+ if (parsed.cwd) { resumeCwd = parsed.cwd; break; }
373
+ } catch {}
374
+ }
375
+ } catch {}
376
+ } else {
377
+ args.push("--session-id", session_id);
378
+ }
363
379
  }
364
380
  if (plan_mode) args.push("--plan");
365
381
 
@@ -367,7 +383,7 @@ function askClaude(config, { prompt, session_id, images, cwd, plan_mode, allow_t
367
383
  const fullArgs = isCmdShim ? ["/c", config.claudeBin, ...args] : args;
368
384
 
369
385
  const proc = spawn(bin, fullArgs, {
370
- cwd: cwd || config.cwd,
386
+ cwd: cwd || resumeCwd || config.cwd,
371
387
  timeout: config.timeout,
372
388
  env: { ...process.env },
373
389
  stdio: ["ignore", "pipe", "pipe"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-bridge-cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Use Claude Code from your browser. Runs a local server that connects your browser tools to the Claude CLI.",
5
5
  "main": "lib/bridge.js",
6
6
  "bin": {