@austinthesing/magic-shell 1.0.0 → 1.0.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/dist/cli.js CHANGED
@@ -33050,7 +33050,7 @@ var TabSelectRenderableEvents;
33050
33050
  })(TabSelectRenderableEvents ||= {});
33051
33051
 
33052
33052
  // src/cli.ts
33053
- import { spawn } from "child_process";
33053
+ import { spawn as spawn2 } from "child_process";
33054
33054
  import { cwd as getCwd } from "process";
33055
33055
 
33056
33056
  // src/lib/models.ts
@@ -33762,6 +33762,8 @@ var DEFAULT_CONFIG = {
33762
33762
  ],
33763
33763
  confirmedDangerousPatterns: [],
33764
33764
  repoContext: false,
33765
+ checkForUpdates: true,
33766
+ autoUpdate: false,
33765
33767
  customModels: []
33766
33768
  };
33767
33769
  function ensureConfigDir() {
@@ -76782,6 +76784,215 @@ function loadTheme() {
76782
76784
  }
76783
76785
  loadTheme();
76784
76786
 
76787
+ // src/lib/update-checker.ts
76788
+ import { spawn } from "child_process";
76789
+ import { homedir as homedir3 } from "os";
76790
+ import { join as join4 } from "path";
76791
+ import { existsSync as existsSync8, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "fs";
76792
+ var __dirname = "/Users/austin/code/dxd/magic-shell/src/lib";
76793
+ var PACKAGE_NAME = "@austinthesing/magic-shell";
76794
+ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
76795
+ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
76796
+ var CONFIG_DIR2 = join4(homedir3(), ".magic-shell");
76797
+ var UPDATE_CHECK_FILE = join4(CONFIG_DIR2, ".update-check");
76798
+ function ensureConfigDir2() {
76799
+ if (!existsSync8(CONFIG_DIR2)) {
76800
+ mkdirSync2(CONFIG_DIR2, { recursive: true });
76801
+ }
76802
+ }
76803
+ function loadUpdateState() {
76804
+ ensureConfigDir2();
76805
+ try {
76806
+ if (existsSync8(UPDATE_CHECK_FILE)) {
76807
+ return JSON.parse(readFileSync3(UPDATE_CHECK_FILE, "utf-8"));
76808
+ }
76809
+ } catch {}
76810
+ return { lastCheck: 0, latestVersion: null, dismissed: null };
76811
+ }
76812
+ function saveUpdateState(state) {
76813
+ ensureConfigDir2();
76814
+ try {
76815
+ writeFileSync3(UPDATE_CHECK_FILE, JSON.stringify(state));
76816
+ } catch {}
76817
+ }
76818
+ function getCurrentVersion() {
76819
+ try {
76820
+ const packagePaths = [
76821
+ join4(__dirname, "../../package.json"),
76822
+ join4(__dirname, "../../../package.json"),
76823
+ join4(process.cwd(), "package.json")
76824
+ ];
76825
+ for (const path3 of packagePaths) {
76826
+ if (existsSync8(path3)) {
76827
+ const pkg = JSON.parse(readFileSync3(path3, "utf-8"));
76828
+ if (pkg.name === PACKAGE_NAME || pkg.name === "magic-shell") {
76829
+ return pkg.version;
76830
+ }
76831
+ }
76832
+ }
76833
+ } catch {}
76834
+ return "0.0.0";
76835
+ }
76836
+ function compareVersions(a, b2) {
76837
+ const partsA = a.split(".").map(Number);
76838
+ const partsB = b2.split(".").map(Number);
76839
+ for (let i = 0;i < Math.max(partsA.length, partsB.length); i++) {
76840
+ const numA = partsA[i] || 0;
76841
+ const numB = partsB[i] || 0;
76842
+ if (numA > numB)
76843
+ return 1;
76844
+ if (numA < numB)
76845
+ return -1;
76846
+ }
76847
+ return 0;
76848
+ }
76849
+ async function fetchLatestVersion() {
76850
+ try {
76851
+ const controller = new AbortController;
76852
+ const timeout = setTimeout(() => controller.abort(), 3000);
76853
+ const response = await fetch(NPM_REGISTRY_URL, {
76854
+ signal: controller.signal,
76855
+ headers: { Accept: "application/json" }
76856
+ });
76857
+ clearTimeout(timeout);
76858
+ if (!response.ok)
76859
+ return null;
76860
+ const data = await response.json();
76861
+ return data.version || null;
76862
+ } catch {
76863
+ return null;
76864
+ }
76865
+ }
76866
+ function commandExists(command) {
76867
+ return new Promise((resolve4) => {
76868
+ const checker = process.platform === "win32" ? spawn("where", [command], { stdio: "ignore" }) : spawn("command", ["-v", command], { stdio: "ignore", shell: true });
76869
+ checker.on("close", (code) => resolve4(code === 0));
76870
+ checker.on("error", () => resolve4(false));
76871
+ });
76872
+ }
76873
+ async function resolveUpdateCommand() {
76874
+ if (await commandExists("bun")) {
76875
+ return `bun update -g ${PACKAGE_NAME}`;
76876
+ }
76877
+ if (await commandExists("npm")) {
76878
+ return `npm install -g ${PACKAGE_NAME}@latest`;
76879
+ }
76880
+ return `bun update -g ${PACKAGE_NAME}`;
76881
+ }
76882
+ async function buildUpdateInfo(latestVersion) {
76883
+ return {
76884
+ hasUpdate: true,
76885
+ currentVersion: getCurrentVersion(),
76886
+ latestVersion,
76887
+ updateCommand: await resolveUpdateCommand()
76888
+ };
76889
+ }
76890
+ async function checkForUpdates() {
76891
+ const state = loadUpdateState();
76892
+ const currentVersion = getCurrentVersion();
76893
+ const now2 = Date.now();
76894
+ if (now2 - state.lastCheck < CHECK_INTERVAL_MS) {
76895
+ if (state.latestVersion && compareVersions(state.latestVersion, currentVersion) > 0) {
76896
+ if (state.dismissed === state.latestVersion) {
76897
+ return null;
76898
+ }
76899
+ return await buildUpdateInfo(state.latestVersion);
76900
+ }
76901
+ return null;
76902
+ }
76903
+ const latestVersion = await fetchLatestVersion();
76904
+ state.lastCheck = now2;
76905
+ if (latestVersion) {
76906
+ state.latestVersion = latestVersion;
76907
+ }
76908
+ saveUpdateState(state);
76909
+ if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
76910
+ if (state.dismissed === latestVersion) {
76911
+ return null;
76912
+ }
76913
+ return await buildUpdateInfo(latestVersion);
76914
+ }
76915
+ return null;
76916
+ }
76917
+ function dismissUpdate(version2) {
76918
+ const state = loadUpdateState();
76919
+ state.dismissed = version2;
76920
+ saveUpdateState(state);
76921
+ }
76922
+ async function forceCheckForUpdates() {
76923
+ const state = loadUpdateState();
76924
+ state.lastCheck = 0;
76925
+ saveUpdateState(state);
76926
+ return checkForUpdates();
76927
+ }
76928
+ async function performUpdate() {
76929
+ const updateCommand = await resolveUpdateCommand();
76930
+ return new Promise((resolve4) => {
76931
+ const child = spawn(updateCommand, {
76932
+ shell: true,
76933
+ stdio: ["ignore", "pipe", "pipe"],
76934
+ env: process.env
76935
+ });
76936
+ let stdout = "";
76937
+ let stderr = "";
76938
+ child.stdout?.on("data", (data) => {
76939
+ stdout += data.toString();
76940
+ });
76941
+ child.stderr?.on("data", (data) => {
76942
+ stderr += data.toString();
76943
+ });
76944
+ child.on("error", (error40) => {
76945
+ resolve4({
76946
+ success: false,
76947
+ output: error40 instanceof Error ? error40.message : String(error40)
76948
+ });
76949
+ });
76950
+ child.on("close", (code) => {
76951
+ const output = (stdout + stderr).trim() || updateCommand;
76952
+ resolve4({
76953
+ success: code === 0,
76954
+ output
76955
+ });
76956
+ });
76957
+ });
76958
+ }
76959
+ function formatUpdateMessageForTui(update, autoUpdate) {
76960
+ if (autoUpdate) {
76961
+ return `Update available (${update.currentVersion} → ${update.latestVersion}). Installing...`;
76962
+ }
76963
+ return [
76964
+ `Update available: ${update.currentVersion} → ${update.latestVersion}`,
76965
+ `Run /update to install, or /auto-update to enable automatic updates.`
76966
+ ].join(`
76967
+ `);
76968
+ }
76969
+ async function processUpdateCheck(options) {
76970
+ const { checkForUpdates: updatesEnabled, autoUpdate, force = false, install = false } = options;
76971
+ if (!updatesEnabled && !force && !install) {
76972
+ return { action: "none" };
76973
+ }
76974
+ const update = force || install ? await forceCheckForUpdates() : await checkForUpdates();
76975
+ if (!update?.hasUpdate || !update.latestVersion) {
76976
+ if (force || install) {
76977
+ return { action: "up-to-date", currentVersion: getCurrentVersion() };
76978
+ }
76979
+ return { action: "none" };
76980
+ }
76981
+ if (install || autoUpdate) {
76982
+ const result = await performUpdate();
76983
+ if (result.success) {
76984
+ dismissUpdate(update.latestVersion);
76985
+ }
76986
+ return {
76987
+ action: "updated",
76988
+ update,
76989
+ success: result.success,
76990
+ output: result.output
76991
+ };
76992
+ }
76993
+ return { action: "notified", update };
76994
+ }
76995
+
76785
76996
  // src/cli.ts
76786
76997
  var renderer;
76787
76998
  var currentModel = OPENCODE_ZEN_MODELS[0];
@@ -77034,6 +77245,7 @@ function createMainUI() {
77034
77245
  });
77035
77246
  mainContainer.add(chatScrollBox);
77036
77247
  addSystemMessage(getWelcomeMessage());
77248
+ handleStartupUpdateCheck();
77037
77249
  inputContainer = new BoxRenderable(renderer, {
77038
77250
  id: "input-container",
77039
77251
  flexDirection: "column",
@@ -77118,6 +77330,67 @@ function getWelcomeMessage() {
77118
77330
  return `Ready. Using ${providerName}.
77119
77331
  Type what you want to do, or press Ctrl+P for Commands.`;
77120
77332
  }
77333
+ async function handleStartupUpdateCheck() {
77334
+ try {
77335
+ const result = await processUpdateCheck({
77336
+ checkForUpdates: config2.checkForUpdates !== false,
77337
+ autoUpdate: config2.autoUpdate === true
77338
+ });
77339
+ switch (result.action) {
77340
+ case "notified":
77341
+ addSystemMessage(formatUpdateMessageForTui(result.update, false));
77342
+ break;
77343
+ case "updated":
77344
+ if (result.success) {
77345
+ addSystemMessage(`Updated to v${result.update.latestVersion}. Restart mshell to use the new version.`);
77346
+ } else {
77347
+ addSystemMessage(`Auto-update failed:
77348
+ ${result.output}
77349
+ Try manually: ${result.update.updateCommand}`);
77350
+ }
77351
+ break;
77352
+ }
77353
+ } catch {}
77354
+ }
77355
+ async function runManualUpdate() {
77356
+ addSystemMessage("Checking for updates...");
77357
+ try {
77358
+ const result = await processUpdateCheck({
77359
+ checkForUpdates: true,
77360
+ autoUpdate: false,
77361
+ force: true,
77362
+ install: true
77363
+ });
77364
+ switch (result.action) {
77365
+ case "up-to-date":
77366
+ addSystemMessage(`Already on the latest version (${result.currentVersion}).`);
77367
+ break;
77368
+ case "updated":
77369
+ if (result.success) {
77370
+ addSystemMessage(`Updated to v${result.update.latestVersion}. Restart mshell to use the new version.`);
77371
+ } else {
77372
+ addSystemMessage(`Update failed:
77373
+ ${result.output}
77374
+ Try manually: ${result.update.updateCommand}`);
77375
+ }
77376
+ break;
77377
+ case "none":
77378
+ addSystemMessage("Could not check for updates.");
77379
+ break;
77380
+ }
77381
+ } catch (error40) {
77382
+ const message = error40 instanceof Error ? error40.message : String(error40);
77383
+ addSystemMessage(`Update check failed: ${message}`);
77384
+ }
77385
+ }
77386
+ function toggleAutoUpdate() {
77387
+ config2.autoUpdate = !config2.autoUpdate;
77388
+ if (config2.autoUpdate) {
77389
+ config2.checkForUpdates = true;
77390
+ }
77391
+ saveConfig(config2);
77392
+ addSystemMessage(`Auto-update: ${config2.autoUpdate ? "ON" : "OFF"}`);
77393
+ }
77121
77394
  function addSystemMessage(content) {
77122
77395
  const msg = {
77123
77396
  id: generateMessageId(),
@@ -77552,7 +77825,7 @@ function getExecutionKind(assistantMsgId, isDryRun) {
77552
77825
  }
77553
77826
  function executeCommandWithCode(command) {
77554
77827
  return new Promise((resolve4, reject) => {
77555
- const child = spawn(command, {
77828
+ const child = spawn2(command, {
77556
77829
  shell: true,
77557
77830
  cwd: currentCwd,
77558
77831
  env: process.env
@@ -77616,6 +77889,12 @@ async function handleSpecialCommand(input) {
77616
77889
  case "history":
77617
77890
  showHistory();
77618
77891
  break;
77892
+ case "update":
77893
+ await runManualUpdate();
77894
+ break;
77895
+ case "auto-update":
77896
+ toggleAutoUpdate();
77897
+ break;
77619
77898
  case "clear":
77620
77899
  clearChat();
77621
77900
  break;
@@ -77659,6 +77938,7 @@ provider Switch provider themes Change theme
77659
77938
  dry Toggle dry-run safety Select safety
77660
77939
  thinking Select thinking
77661
77940
  config Show config history Show history
77941
+ update Check for updates auto-update Toggle auto-update
77662
77942
  clear Clear chat exit Exit
77663
77943
 
77664
77944
  Safety Levels:
@@ -77701,6 +77981,9 @@ Safety: ${config2.safetyLevel}
77701
77981
  Thinking: ${config2.thinkingLevel}
77702
77982
  Dry-run: ${dryRunMode ? "ON" : "OFF"}
77703
77983
  Repo context: ${config2.repoContext ? "ON" : "OFF"}
77984
+ Version: ${getCurrentVersion()}
77985
+ Updates: ${config2.checkForUpdates !== false ? "checking enabled" : "checking disabled"}
77986
+ Auto-update: ${config2.autoUpdate ? "ON" : "OFF"}
77704
77987
  API Key: ${apiKeyStatus}
77705
77988
  History: ${history.length} commands`;
77706
77989
  addSystemMessage(configText);
@@ -77954,6 +78237,18 @@ function getAppCommands() {
77954
78237
  addSystemMessage(`Project context: ${config2.repoContext ? "ON - AI can see your package.json scripts, Makefile targets, etc." : "OFF"}`);
77955
78238
  }
77956
78239
  },
78240
+ {
78241
+ name: "Check for Updates",
78242
+ description: `Current: v${getCurrentVersion()}`,
78243
+ slash: "update",
78244
+ action: () => runManualUpdate()
78245
+ },
78246
+ {
78247
+ name: "Toggle Auto-Update",
78248
+ description: config2.autoUpdate ? "Currently ON" : "Currently OFF",
78249
+ slash: "auto-update",
78250
+ action: () => toggleAutoUpdate()
78251
+ },
77957
78252
  {
77958
78253
  name: "Show Config",
77959
78254
  description: "View current configuration",
@@ -78510,7 +78805,7 @@ function handleKeypress(key) {
78510
78805
  const msg = chatMessages.find((m2) => m2.id === pendingMessageId);
78511
78806
  if (msg && msg.command) {
78512
78807
  const copyCmd = process.platform === "darwin" ? "pbcopy" : "xclip -selection clipboard";
78513
- const child = spawn(copyCmd, { shell: true });
78808
+ const child = spawn2(copyCmd, { shell: true });
78514
78809
  child.stdin?.write(msg.command);
78515
78810
  child.stdin?.end();
78516
78811
  addSystemMessage(`Copied to clipboard: ${msg.command}`);
package/dist/index.js CHANGED
@@ -2111,7 +2111,7 @@ var require_src = __commonJS((exports) => {
2111
2111
  });
2112
2112
 
2113
2113
  // src/index.ts
2114
- import { spawn } from "child_process";
2114
+ import { spawn as spawn2 } from "child_process";
2115
2115
  import { cwd as getCwd } from "process";
2116
2116
 
2117
2117
  // src/lib/models.ts
@@ -2817,6 +2817,8 @@ var DEFAULT_CONFIG = {
2817
2817
  ],
2818
2818
  confirmedDangerousPatterns: [],
2819
2819
  repoContext: false,
2820
+ checkForUpdates: true,
2821
+ autoUpdate: false,
2820
2822
  customModels: []
2821
2823
  };
2822
2824
  function ensureConfigDir() {
@@ -44994,6 +44996,8 @@ var DEFAULT_CONFIG2 = {
44994
44996
  ],
44995
44997
  confirmedDangerousPatterns: [],
44996
44998
  repoContext: false,
44999
+ checkForUpdates: true,
45000
+ autoUpdate: false,
44997
45001
  customModels: []
44998
45002
  };
44999
45003
  function ensureConfigDir2() {
@@ -46125,6 +46129,7 @@ function getAnsiColors() {
46125
46129
  loadTheme();
46126
46130
 
46127
46131
  // src/lib/update-checker.ts
46132
+ import { spawn } from "child_process";
46128
46133
  import { homedir as homedir4 } from "os";
46129
46134
  import { join as join4 } from "path";
46130
46135
  import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
@@ -46202,6 +46207,30 @@ async function fetchLatestVersion() {
46202
46207
  return null;
46203
46208
  }
46204
46209
  }
46210
+ function commandExists(command) {
46211
+ return new Promise((resolve2) => {
46212
+ const checker = process.platform === "win32" ? spawn("where", [command], { stdio: "ignore" }) : spawn("command", ["-v", command], { stdio: "ignore", shell: true });
46213
+ checker.on("close", (code) => resolve2(code === 0));
46214
+ checker.on("error", () => resolve2(false));
46215
+ });
46216
+ }
46217
+ async function resolveUpdateCommand() {
46218
+ if (await commandExists("bun")) {
46219
+ return `bun update -g ${PACKAGE_NAME}`;
46220
+ }
46221
+ if (await commandExists("npm")) {
46222
+ return `npm install -g ${PACKAGE_NAME}@latest`;
46223
+ }
46224
+ return `bun update -g ${PACKAGE_NAME}`;
46225
+ }
46226
+ async function buildUpdateInfo(latestVersion) {
46227
+ return {
46228
+ hasUpdate: true,
46229
+ currentVersion: getCurrentVersion(),
46230
+ latestVersion,
46231
+ updateCommand: await resolveUpdateCommand()
46232
+ };
46233
+ }
46205
46234
  async function checkForUpdates() {
46206
46235
  const state = loadUpdateState();
46207
46236
  const currentVersion = getCurrentVersion();
@@ -46211,12 +46240,7 @@ async function checkForUpdates() {
46211
46240
  if (state.dismissed === state.latestVersion) {
46212
46241
  return null;
46213
46242
  }
46214
- return {
46215
- hasUpdate: true,
46216
- currentVersion,
46217
- latestVersion: state.latestVersion,
46218
- updateCommand: `bun update -g ${PACKAGE_NAME}`
46219
- };
46243
+ return await buildUpdateInfo(state.latestVersion);
46220
46244
  }
46221
46245
  return null;
46222
46246
  }
@@ -46230,21 +46254,98 @@ async function checkForUpdates() {
46230
46254
  if (state.dismissed === latestVersion) {
46231
46255
  return null;
46232
46256
  }
46233
- return {
46234
- hasUpdate: true,
46235
- currentVersion,
46236
- latestVersion,
46237
- updateCommand: `bun update -g ${PACKAGE_NAME}`
46238
- };
46257
+ return await buildUpdateInfo(latestVersion);
46239
46258
  }
46240
46259
  return null;
46241
46260
  }
46261
+ function dismissUpdate(version2) {
46262
+ const state = loadUpdateState();
46263
+ state.dismissed = version2;
46264
+ saveUpdateState(state);
46265
+ }
46242
46266
  async function forceCheckForUpdates() {
46243
46267
  const state = loadUpdateState();
46244
46268
  state.lastCheck = 0;
46245
46269
  saveUpdateState(state);
46246
46270
  return checkForUpdates();
46247
46271
  }
46272
+ async function performUpdate() {
46273
+ const updateCommand = await resolveUpdateCommand();
46274
+ return new Promise((resolve2) => {
46275
+ const child = spawn(updateCommand, {
46276
+ shell: true,
46277
+ stdio: ["ignore", "pipe", "pipe"],
46278
+ env: process.env
46279
+ });
46280
+ let stdout = "";
46281
+ let stderr = "";
46282
+ child.stdout?.on("data", (data) => {
46283
+ stdout += data.toString();
46284
+ });
46285
+ child.stderr?.on("data", (data) => {
46286
+ stderr += data.toString();
46287
+ });
46288
+ child.on("error", (error40) => {
46289
+ resolve2({
46290
+ success: false,
46291
+ output: error40 instanceof Error ? error40.message : String(error40)
46292
+ });
46293
+ });
46294
+ child.on("close", (code) => {
46295
+ const output = (stdout + stderr).trim() || updateCommand;
46296
+ resolve2({
46297
+ success: code === 0,
46298
+ output
46299
+ });
46300
+ });
46301
+ });
46302
+ }
46303
+ function formatUpdateBannerLines(update) {
46304
+ return [
46305
+ `Update available! ${update.currentVersion} → ${update.latestVersion}`,
46306
+ `Run: ${update.updateCommand}`
46307
+ ];
46308
+ }
46309
+ async function processUpdateCheck(options) {
46310
+ const { checkForUpdates: updatesEnabled, autoUpdate, force = false, install = false } = options;
46311
+ if (!updatesEnabled && !force && !install) {
46312
+ return { action: "none" };
46313
+ }
46314
+ const update = force || install ? await forceCheckForUpdates() : await checkForUpdates();
46315
+ if (!update?.hasUpdate || !update.latestVersion) {
46316
+ if (force || install) {
46317
+ return { action: "up-to-date", currentVersion: getCurrentVersion() };
46318
+ }
46319
+ return { action: "none" };
46320
+ }
46321
+ if (install || autoUpdate) {
46322
+ const result = await performUpdate();
46323
+ if (result.success) {
46324
+ dismissUpdate(update.latestVersion);
46325
+ }
46326
+ return {
46327
+ action: "updated",
46328
+ update,
46329
+ success: result.success,
46330
+ output: result.output
46331
+ };
46332
+ }
46333
+ return { action: "notified", update };
46334
+ }
46335
+ function shouldRunStartupUpdateCheck(args) {
46336
+ if (args.length === 0)
46337
+ return false;
46338
+ const skipFlags = new Set([
46339
+ "--version",
46340
+ "-v",
46341
+ "--check-update",
46342
+ "--auto-update",
46343
+ "--no-auto-update",
46344
+ "--no-update-check",
46345
+ "--enable-update-check"
46346
+ ]);
46347
+ return !skipFlags.has(args[0]);
46348
+ }
46248
46349
 
46249
46350
  // src/lib/format.ts
46250
46351
  function formatExecutedCommand(command, colors) {
@@ -46290,6 +46391,10 @@ ${colors.bold}USAGE${colors.reset}
46290
46391
  msh --safety <level> Set safety level (strict, moderate, relaxed)
46291
46392
  msh --version Show version
46292
46393
  msh --check-update Check for updates
46394
+ msh --auto-update Enable automatic updates
46395
+ msh --no-auto-update Disable automatic updates
46396
+ msh --no-update-check Disable update checking
46397
+ msh --enable-update-check Enable update checking
46293
46398
  msh --help Show this help
46294
46399
 
46295
46400
  ${colors.bold}TUI MODE${colors.reset}
@@ -46532,7 +46637,7 @@ Try: ${colors.cyan}msh "list all files"${colors.reset}
46532
46637
  }
46533
46638
  function executeCommand(command) {
46534
46639
  return new Promise((resolve2) => {
46535
- const child = spawn(command, {
46640
+ const child = spawn2(command, {
46536
46641
  shell: true,
46537
46642
  cwd: getCwd(),
46538
46643
  env: process.env,
@@ -46720,21 +46825,46 @@ async function translate(query, options) {
46720
46825
  process.exit(1);
46721
46826
  }
46722
46827
  }
46723
- async function showUpdateNotification() {
46828
+ async function handleStartupUpdateCheck() {
46724
46829
  try {
46725
- const update = await checkForUpdates();
46726
- if (update?.hasUpdate) {
46727
- console.error(`${colors.cyan}\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510${colors.reset}`);
46728
- console.error(`${colors.cyan}\u2502${colors.reset} ${colors.bold}Update available!${colors.reset} ${colors.dim}${update.currentVersion}${colors.reset} \u2192 ${colors.green}${update.latestVersion}${colors.reset} ${colors.cyan}\u2502${colors.reset}`);
46729
- console.error(`${colors.cyan}\u2502${colors.reset} Run: ${colors.yellow}${update.updateCommand}${colors.reset} ${colors.cyan}\u2502${colors.reset}`);
46730
- console.error(`${colors.cyan}\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518${colors.reset}`);
46731
- console.error();
46830
+ const config2 = loadConfig();
46831
+ const result = await processUpdateCheck({
46832
+ checkForUpdates: config2.checkForUpdates !== false,
46833
+ autoUpdate: config2.autoUpdate === true
46834
+ });
46835
+ switch (result.action) {
46836
+ case "notified":
46837
+ printUpdateBanner(result.update);
46838
+ break;
46839
+ case "updated":
46840
+ if (result.success) {
46841
+ console.error(`${colors.green}\u2713 Updated to v${result.update.latestVersion}${colors.reset} Restart your shell or run msh again.`);
46842
+ console.error();
46843
+ } else {
46844
+ console.error(`${colors.yellow}Auto-update failed:${colors.reset} ${result.output}`);
46845
+ printUpdateBanner(result.update);
46846
+ }
46847
+ break;
46732
46848
  }
46733
46849
  } catch {}
46734
46850
  }
46851
+ function printUpdateBanner(update) {
46852
+ const lines = formatUpdateBannerLines({
46853
+ hasUpdate: true,
46854
+ currentVersion: update.currentVersion,
46855
+ latestVersion: update.latestVersion,
46856
+ updateCommand: update.updateCommand
46857
+ });
46858
+ console.error(`${colors.cyan}\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510${colors.reset}`);
46859
+ for (const line of lines) {
46860
+ console.error(`${colors.cyan}\u2502${colors.reset} ${line.padEnd(47)} ${colors.cyan}\u2502${colors.reset}`);
46861
+ }
46862
+ console.error(`${colors.cyan}\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518${colors.reset}`);
46863
+ console.error();
46864
+ }
46735
46865
  async function main() {
46736
46866
  const args = process.argv.slice(2);
46737
- const updatePromise = args.length > 0 && !args[0].startsWith("-i") ? showUpdateNotification() : Promise.resolve();
46867
+ const updatePromise = shouldRunStartupUpdateCheck(args) ? handleStartupUpdateCheck() : Promise.resolve();
46738
46868
  if (args.length === 0) {
46739
46869
  console.log(`${colors.bold}${colors.primary}magic-shell${colors.reset} - Natural language to terminal commands
46740
46870
  `);
@@ -46760,13 +46890,62 @@ async function main() {
46760
46890
  return;
46761
46891
  }
46762
46892
  if (args[0] === "--check-update") {
46763
- const update = await forceCheckForUpdates();
46764
- if (update?.hasUpdate) {
46765
- console.log(`${colors.green}Update available!${colors.reset} ${update.currentVersion} \u2192 ${update.latestVersion}`);
46766
- console.log(`Run: ${colors.cyan}${update.updateCommand}${colors.reset}`);
46767
- } else {
46768
- console.log(`${colors.green}\u2713 You're running the latest version (${getCurrentVersion()})${colors.reset}`);
46893
+ const config2 = loadConfig();
46894
+ const result = await processUpdateCheck({
46895
+ checkForUpdates: true,
46896
+ autoUpdate: config2.autoUpdate === true,
46897
+ force: true
46898
+ });
46899
+ if (result.action === "up-to-date") {
46900
+ console.log(`${colors.green}\u2713 You're running the latest version (${result.currentVersion})${colors.reset}`);
46901
+ return;
46769
46902
  }
46903
+ if (result.action === "updated") {
46904
+ if (result.success) {
46905
+ console.log(`${colors.green}\u2713 Updated to v${result.update.latestVersion}${colors.reset}`);
46906
+ } else {
46907
+ console.log(`${colors.yellow}Update failed:${colors.reset} ${result.output}`);
46908
+ console.log(`Try manually: ${colors.cyan}${result.update.updateCommand}${colors.reset}`);
46909
+ process.exit(1);
46910
+ }
46911
+ return;
46912
+ }
46913
+ if (result.action === "notified") {
46914
+ console.log(`${colors.green}Update available!${colors.reset} ${result.update.currentVersion} \u2192 ${result.update.latestVersion}`);
46915
+ console.log(`Run: ${colors.cyan}${result.update.updateCommand}${colors.reset}`);
46916
+ console.log(`Or enable auto-update: ${colors.cyan}msh --auto-update${colors.reset}`);
46917
+ return;
46918
+ }
46919
+ console.log(`${colors.yellow}Could not check for updates.${colors.reset}`);
46920
+ return;
46921
+ }
46922
+ if (args[0] === "--auto-update") {
46923
+ const config2 = loadConfig();
46924
+ config2.autoUpdate = true;
46925
+ config2.checkForUpdates = true;
46926
+ saveConfig(config2);
46927
+ console.log(`${colors.success}\u2713 Auto-update enabled${colors.reset}`);
46928
+ return;
46929
+ }
46930
+ if (args[0] === "--no-auto-update") {
46931
+ const config2 = loadConfig();
46932
+ config2.autoUpdate = false;
46933
+ saveConfig(config2);
46934
+ console.log(`${colors.success}\u2713 Auto-update disabled${colors.reset}`);
46935
+ return;
46936
+ }
46937
+ if (args[0] === "--no-update-check") {
46938
+ const config2 = loadConfig();
46939
+ config2.checkForUpdates = false;
46940
+ saveConfig(config2);
46941
+ console.log(`${colors.success}\u2713 Update checking disabled${colors.reset}`);
46942
+ return;
46943
+ }
46944
+ if (args[0] === "--enable-update-check") {
46945
+ const config2 = loadConfig();
46946
+ config2.checkForUpdates = true;
46947
+ saveConfig(config2);
46948
+ console.log(`${colors.success}\u2713 Update checking enabled${colors.reset}`);
46770
46949
  return;
46771
46950
  }
46772
46951
  if (args[0] === "--setup") {
package/dist/tui.js CHANGED
@@ -33050,7 +33050,7 @@ var TabSelectRenderableEvents;
33050
33050
  })(TabSelectRenderableEvents ||= {});
33051
33051
 
33052
33052
  // src/cli.ts
33053
- import { spawn } from "child_process";
33053
+ import { spawn as spawn2 } from "child_process";
33054
33054
  import { cwd as getCwd } from "process";
33055
33055
 
33056
33056
  // src/lib/models.ts
@@ -33762,6 +33762,8 @@ var DEFAULT_CONFIG = {
33762
33762
  ],
33763
33763
  confirmedDangerousPatterns: [],
33764
33764
  repoContext: false,
33765
+ checkForUpdates: true,
33766
+ autoUpdate: false,
33765
33767
  customModels: []
33766
33768
  };
33767
33769
  function ensureConfigDir() {
@@ -76782,6 +76784,215 @@ function loadTheme() {
76782
76784
  }
76783
76785
  loadTheme();
76784
76786
 
76787
+ // src/lib/update-checker.ts
76788
+ import { spawn } from "child_process";
76789
+ import { homedir as homedir3 } from "os";
76790
+ import { join as join4 } from "path";
76791
+ import { existsSync as existsSync8, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "fs";
76792
+ var __dirname = "/Users/austin/code/dxd/magic-shell/src/lib";
76793
+ var PACKAGE_NAME = "@austinthesing/magic-shell";
76794
+ var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
76795
+ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
76796
+ var CONFIG_DIR2 = join4(homedir3(), ".magic-shell");
76797
+ var UPDATE_CHECK_FILE = join4(CONFIG_DIR2, ".update-check");
76798
+ function ensureConfigDir2() {
76799
+ if (!existsSync8(CONFIG_DIR2)) {
76800
+ mkdirSync2(CONFIG_DIR2, { recursive: true });
76801
+ }
76802
+ }
76803
+ function loadUpdateState() {
76804
+ ensureConfigDir2();
76805
+ try {
76806
+ if (existsSync8(UPDATE_CHECK_FILE)) {
76807
+ return JSON.parse(readFileSync3(UPDATE_CHECK_FILE, "utf-8"));
76808
+ }
76809
+ } catch {}
76810
+ return { lastCheck: 0, latestVersion: null, dismissed: null };
76811
+ }
76812
+ function saveUpdateState(state) {
76813
+ ensureConfigDir2();
76814
+ try {
76815
+ writeFileSync3(UPDATE_CHECK_FILE, JSON.stringify(state));
76816
+ } catch {}
76817
+ }
76818
+ function getCurrentVersion() {
76819
+ try {
76820
+ const packagePaths = [
76821
+ join4(__dirname, "../../package.json"),
76822
+ join4(__dirname, "../../../package.json"),
76823
+ join4(process.cwd(), "package.json")
76824
+ ];
76825
+ for (const path3 of packagePaths) {
76826
+ if (existsSync8(path3)) {
76827
+ const pkg = JSON.parse(readFileSync3(path3, "utf-8"));
76828
+ if (pkg.name === PACKAGE_NAME || pkg.name === "magic-shell") {
76829
+ return pkg.version;
76830
+ }
76831
+ }
76832
+ }
76833
+ } catch {}
76834
+ return "0.0.0";
76835
+ }
76836
+ function compareVersions(a, b2) {
76837
+ const partsA = a.split(".").map(Number);
76838
+ const partsB = b2.split(".").map(Number);
76839
+ for (let i = 0;i < Math.max(partsA.length, partsB.length); i++) {
76840
+ const numA = partsA[i] || 0;
76841
+ const numB = partsB[i] || 0;
76842
+ if (numA > numB)
76843
+ return 1;
76844
+ if (numA < numB)
76845
+ return -1;
76846
+ }
76847
+ return 0;
76848
+ }
76849
+ async function fetchLatestVersion() {
76850
+ try {
76851
+ const controller = new AbortController;
76852
+ const timeout = setTimeout(() => controller.abort(), 3000);
76853
+ const response = await fetch(NPM_REGISTRY_URL, {
76854
+ signal: controller.signal,
76855
+ headers: { Accept: "application/json" }
76856
+ });
76857
+ clearTimeout(timeout);
76858
+ if (!response.ok)
76859
+ return null;
76860
+ const data = await response.json();
76861
+ return data.version || null;
76862
+ } catch {
76863
+ return null;
76864
+ }
76865
+ }
76866
+ function commandExists(command) {
76867
+ return new Promise((resolve4) => {
76868
+ const checker = process.platform === "win32" ? spawn("where", [command], { stdio: "ignore" }) : spawn("command", ["-v", command], { stdio: "ignore", shell: true });
76869
+ checker.on("close", (code) => resolve4(code === 0));
76870
+ checker.on("error", () => resolve4(false));
76871
+ });
76872
+ }
76873
+ async function resolveUpdateCommand() {
76874
+ if (await commandExists("bun")) {
76875
+ return `bun update -g ${PACKAGE_NAME}`;
76876
+ }
76877
+ if (await commandExists("npm")) {
76878
+ return `npm install -g ${PACKAGE_NAME}@latest`;
76879
+ }
76880
+ return `bun update -g ${PACKAGE_NAME}`;
76881
+ }
76882
+ async function buildUpdateInfo(latestVersion) {
76883
+ return {
76884
+ hasUpdate: true,
76885
+ currentVersion: getCurrentVersion(),
76886
+ latestVersion,
76887
+ updateCommand: await resolveUpdateCommand()
76888
+ };
76889
+ }
76890
+ async function checkForUpdates() {
76891
+ const state = loadUpdateState();
76892
+ const currentVersion = getCurrentVersion();
76893
+ const now2 = Date.now();
76894
+ if (now2 - state.lastCheck < CHECK_INTERVAL_MS) {
76895
+ if (state.latestVersion && compareVersions(state.latestVersion, currentVersion) > 0) {
76896
+ if (state.dismissed === state.latestVersion) {
76897
+ return null;
76898
+ }
76899
+ return await buildUpdateInfo(state.latestVersion);
76900
+ }
76901
+ return null;
76902
+ }
76903
+ const latestVersion = await fetchLatestVersion();
76904
+ state.lastCheck = now2;
76905
+ if (latestVersion) {
76906
+ state.latestVersion = latestVersion;
76907
+ }
76908
+ saveUpdateState(state);
76909
+ if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
76910
+ if (state.dismissed === latestVersion) {
76911
+ return null;
76912
+ }
76913
+ return await buildUpdateInfo(latestVersion);
76914
+ }
76915
+ return null;
76916
+ }
76917
+ function dismissUpdate(version2) {
76918
+ const state = loadUpdateState();
76919
+ state.dismissed = version2;
76920
+ saveUpdateState(state);
76921
+ }
76922
+ async function forceCheckForUpdates() {
76923
+ const state = loadUpdateState();
76924
+ state.lastCheck = 0;
76925
+ saveUpdateState(state);
76926
+ return checkForUpdates();
76927
+ }
76928
+ async function performUpdate() {
76929
+ const updateCommand = await resolveUpdateCommand();
76930
+ return new Promise((resolve4) => {
76931
+ const child = spawn(updateCommand, {
76932
+ shell: true,
76933
+ stdio: ["ignore", "pipe", "pipe"],
76934
+ env: process.env
76935
+ });
76936
+ let stdout = "";
76937
+ let stderr = "";
76938
+ child.stdout?.on("data", (data) => {
76939
+ stdout += data.toString();
76940
+ });
76941
+ child.stderr?.on("data", (data) => {
76942
+ stderr += data.toString();
76943
+ });
76944
+ child.on("error", (error40) => {
76945
+ resolve4({
76946
+ success: false,
76947
+ output: error40 instanceof Error ? error40.message : String(error40)
76948
+ });
76949
+ });
76950
+ child.on("close", (code) => {
76951
+ const output = (stdout + stderr).trim() || updateCommand;
76952
+ resolve4({
76953
+ success: code === 0,
76954
+ output
76955
+ });
76956
+ });
76957
+ });
76958
+ }
76959
+ function formatUpdateMessageForTui(update, autoUpdate) {
76960
+ if (autoUpdate) {
76961
+ return `Update available (${update.currentVersion} → ${update.latestVersion}). Installing...`;
76962
+ }
76963
+ return [
76964
+ `Update available: ${update.currentVersion} → ${update.latestVersion}`,
76965
+ `Run /update to install, or /auto-update to enable automatic updates.`
76966
+ ].join(`
76967
+ `);
76968
+ }
76969
+ async function processUpdateCheck(options) {
76970
+ const { checkForUpdates: updatesEnabled, autoUpdate, force = false, install = false } = options;
76971
+ if (!updatesEnabled && !force && !install) {
76972
+ return { action: "none" };
76973
+ }
76974
+ const update = force || install ? await forceCheckForUpdates() : await checkForUpdates();
76975
+ if (!update?.hasUpdate || !update.latestVersion) {
76976
+ if (force || install) {
76977
+ return { action: "up-to-date", currentVersion: getCurrentVersion() };
76978
+ }
76979
+ return { action: "none" };
76980
+ }
76981
+ if (install || autoUpdate) {
76982
+ const result = await performUpdate();
76983
+ if (result.success) {
76984
+ dismissUpdate(update.latestVersion);
76985
+ }
76986
+ return {
76987
+ action: "updated",
76988
+ update,
76989
+ success: result.success,
76990
+ output: result.output
76991
+ };
76992
+ }
76993
+ return { action: "notified", update };
76994
+ }
76995
+
76785
76996
  // src/cli.ts
76786
76997
  var renderer;
76787
76998
  var currentModel = OPENCODE_ZEN_MODELS[0];
@@ -77034,6 +77245,7 @@ function createMainUI() {
77034
77245
  });
77035
77246
  mainContainer.add(chatScrollBox);
77036
77247
  addSystemMessage(getWelcomeMessage());
77248
+ handleStartupUpdateCheck();
77037
77249
  inputContainer = new BoxRenderable(renderer, {
77038
77250
  id: "input-container",
77039
77251
  flexDirection: "column",
@@ -77118,6 +77330,67 @@ function getWelcomeMessage() {
77118
77330
  return `Ready. Using ${providerName}.
77119
77331
  Type what you want to do, or press Ctrl+P for Commands.`;
77120
77332
  }
77333
+ async function handleStartupUpdateCheck() {
77334
+ try {
77335
+ const result = await processUpdateCheck({
77336
+ checkForUpdates: config2.checkForUpdates !== false,
77337
+ autoUpdate: config2.autoUpdate === true
77338
+ });
77339
+ switch (result.action) {
77340
+ case "notified":
77341
+ addSystemMessage(formatUpdateMessageForTui(result.update, false));
77342
+ break;
77343
+ case "updated":
77344
+ if (result.success) {
77345
+ addSystemMessage(`Updated to v${result.update.latestVersion}. Restart mshell to use the new version.`);
77346
+ } else {
77347
+ addSystemMessage(`Auto-update failed:
77348
+ ${result.output}
77349
+ Try manually: ${result.update.updateCommand}`);
77350
+ }
77351
+ break;
77352
+ }
77353
+ } catch {}
77354
+ }
77355
+ async function runManualUpdate() {
77356
+ addSystemMessage("Checking for updates...");
77357
+ try {
77358
+ const result = await processUpdateCheck({
77359
+ checkForUpdates: true,
77360
+ autoUpdate: false,
77361
+ force: true,
77362
+ install: true
77363
+ });
77364
+ switch (result.action) {
77365
+ case "up-to-date":
77366
+ addSystemMessage(`Already on the latest version (${result.currentVersion}).`);
77367
+ break;
77368
+ case "updated":
77369
+ if (result.success) {
77370
+ addSystemMessage(`Updated to v${result.update.latestVersion}. Restart mshell to use the new version.`);
77371
+ } else {
77372
+ addSystemMessage(`Update failed:
77373
+ ${result.output}
77374
+ Try manually: ${result.update.updateCommand}`);
77375
+ }
77376
+ break;
77377
+ case "none":
77378
+ addSystemMessage("Could not check for updates.");
77379
+ break;
77380
+ }
77381
+ } catch (error40) {
77382
+ const message = error40 instanceof Error ? error40.message : String(error40);
77383
+ addSystemMessage(`Update check failed: ${message}`);
77384
+ }
77385
+ }
77386
+ function toggleAutoUpdate() {
77387
+ config2.autoUpdate = !config2.autoUpdate;
77388
+ if (config2.autoUpdate) {
77389
+ config2.checkForUpdates = true;
77390
+ }
77391
+ saveConfig(config2);
77392
+ addSystemMessage(`Auto-update: ${config2.autoUpdate ? "ON" : "OFF"}`);
77393
+ }
77121
77394
  function addSystemMessage(content) {
77122
77395
  const msg = {
77123
77396
  id: generateMessageId(),
@@ -77552,7 +77825,7 @@ function getExecutionKind(assistantMsgId, isDryRun) {
77552
77825
  }
77553
77826
  function executeCommandWithCode(command) {
77554
77827
  return new Promise((resolve4, reject) => {
77555
- const child = spawn(command, {
77828
+ const child = spawn2(command, {
77556
77829
  shell: true,
77557
77830
  cwd: currentCwd,
77558
77831
  env: process.env
@@ -77616,6 +77889,12 @@ async function handleSpecialCommand(input) {
77616
77889
  case "history":
77617
77890
  showHistory();
77618
77891
  break;
77892
+ case "update":
77893
+ await runManualUpdate();
77894
+ break;
77895
+ case "auto-update":
77896
+ toggleAutoUpdate();
77897
+ break;
77619
77898
  case "clear":
77620
77899
  clearChat();
77621
77900
  break;
@@ -77659,6 +77938,7 @@ provider Switch provider themes Change theme
77659
77938
  dry Toggle dry-run safety Select safety
77660
77939
  thinking Select thinking
77661
77940
  config Show config history Show history
77941
+ update Check for updates auto-update Toggle auto-update
77662
77942
  clear Clear chat exit Exit
77663
77943
 
77664
77944
  Safety Levels:
@@ -77701,6 +77981,9 @@ Safety: ${config2.safetyLevel}
77701
77981
  Thinking: ${config2.thinkingLevel}
77702
77982
  Dry-run: ${dryRunMode ? "ON" : "OFF"}
77703
77983
  Repo context: ${config2.repoContext ? "ON" : "OFF"}
77984
+ Version: ${getCurrentVersion()}
77985
+ Updates: ${config2.checkForUpdates !== false ? "checking enabled" : "checking disabled"}
77986
+ Auto-update: ${config2.autoUpdate ? "ON" : "OFF"}
77704
77987
  API Key: ${apiKeyStatus}
77705
77988
  History: ${history.length} commands`;
77706
77989
  addSystemMessage(configText);
@@ -77954,6 +78237,18 @@ function getAppCommands() {
77954
78237
  addSystemMessage(`Project context: ${config2.repoContext ? "ON - AI can see your package.json scripts, Makefile targets, etc." : "OFF"}`);
77955
78238
  }
77956
78239
  },
78240
+ {
78241
+ name: "Check for Updates",
78242
+ description: `Current: v${getCurrentVersion()}`,
78243
+ slash: "update",
78244
+ action: () => runManualUpdate()
78245
+ },
78246
+ {
78247
+ name: "Toggle Auto-Update",
78248
+ description: config2.autoUpdate ? "Currently ON" : "Currently OFF",
78249
+ slash: "auto-update",
78250
+ action: () => toggleAutoUpdate()
78251
+ },
77957
78252
  {
77958
78253
  name: "Show Config",
77959
78254
  description: "View current configuration",
@@ -78510,7 +78805,7 @@ function handleKeypress(key) {
78510
78805
  const msg = chatMessages.find((m2) => m2.id === pendingMessageId);
78511
78806
  if (msg && msg.command) {
78512
78807
  const copyCmd = process.platform === "darwin" ? "pbcopy" : "xclip -selection clipboard";
78513
- const child = spawn(copyCmd, { shell: true });
78808
+ const child = spawn2(copyCmd, { shell: true });
78514
78809
  child.stdin?.write(msg.command);
78515
78810
  child.stdin?.end();
78516
78811
  addSystemMessage(`Copied to clipboard: ${msg.command}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@austinthesing/magic-shell",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Natural language to terminal commands with safety features. Supports OpenCode Zen, OpenRouter, AI gateways, Workers AI, and custom models.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",