@spenceriam/impulse 1.14.0 → 1.15.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.
Files changed (2) hide show
  1. package/bin/impulse +16 -6
  2. package/package.json +7 -7
package/bin/impulse CHANGED
@@ -178,18 +178,28 @@ function formatUpdateSuccessLines(latestVersion, installedVersion, relaunch) {
178
178
  return lines;
179
179
  }
180
180
 
181
- function relaunchImpulse() {
181
+ function relaunchImpulse(sessionId) {
182
182
  const env = { ...process.env };
183
183
  delete env[INTERNAL_AUTO_UPDATE_ENV];
184
- const child = spawn(process.platform === "win32" ? "impulse.cmd" : "impulse", [], {
185
- detached: true,
186
- stdio: "ignore",
184
+ // In-place restart (#141): not detached (new console on Windows), inherit
185
+ // the terminal, and hand the session off explicitly.
186
+ const resumeArgs = sessionId ? ["--resume", sessionId] : [];
187
+ const child = spawn(process.platform === "win32" ? "impulse.cmd" : "impulse", resumeArgs, {
188
+ stdio: "inherit",
187
189
  shell: useShellForCommandShims(),
188
190
  env,
189
191
  });
190
192
  child.unref();
191
193
  }
192
194
 
195
+ function resumeSessionIdFromArgv() {
196
+ const argv = process.argv.slice(2);
197
+ const idx = argv.findIndex((a) => a === "--resume" || a === "-r");
198
+ if (idx < 0) return undefined;
199
+ const next = argv[idx + 1];
200
+ return next && !next.startsWith("-") ? next : undefined;
201
+ }
202
+
193
203
  function runUpdate({ relaunch }) {
194
204
  const current = currentInstalledVersion();
195
205
  const latest = latestNpmVersion();
@@ -197,7 +207,7 @@ function runUpdate({ relaunch }) {
197
207
  console.log(`Already on latest (v${current}).`);
198
208
  if (relaunch) {
199
209
  console.log(" Relaunching impulse...");
200
- relaunchImpulse();
210
+ relaunchImpulse(resumeSessionIdFromArgv());
201
211
  }
202
212
  return 0;
203
213
  }
@@ -226,7 +236,7 @@ function runUpdate({ relaunch }) {
226
236
  console.log("--------------------------------------------------------\n");
227
237
 
228
238
  if (relaunch) {
229
- relaunchImpulse();
239
+ relaunchImpulse(resumeSessionIdFromArgv());
230
240
  }
231
241
  return 0;
232
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spenceriam/impulse",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
4
4
  "description": "Provider-flexible terminal AI coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -21,11 +21,11 @@
21
21
  "access": "public"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@spenceriam/impulse-linux-x64": "1.14.0",
25
- "@spenceriam/impulse-linux-arm64": "1.14.0",
26
- "@spenceriam/impulse-darwin-x64": "1.14.0",
27
- "@spenceriam/impulse-darwin-arm64": "1.14.0",
28
- "@spenceriam/impulse-windows-x64": "1.14.0",
29
- "@spenceriam/impulse-win32-arm64": "1.14.0"
24
+ "@spenceriam/impulse-linux-x64": "1.15.1",
25
+ "@spenceriam/impulse-linux-arm64": "1.15.1",
26
+ "@spenceriam/impulse-darwin-x64": "1.15.1",
27
+ "@spenceriam/impulse-darwin-arm64": "1.15.1",
28
+ "@spenceriam/impulse-windows-x64": "1.15.1",
29
+ "@spenceriam/impulse-win32-arm64": "1.15.1"
30
30
  }
31
31
  }