@seflless/ghosttown 1.3.3 → 1.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +44 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seflless/ghosttown",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "Web-based terminal emulator using Ghostty's VT100 parser via WebAssembly",
5
5
  "type": "module",
6
6
  "main": "./dist/ghostty-web.umd.cjs",
package/src/cli.js CHANGED
@@ -406,6 +406,41 @@ function attachToSession(sessionName) {
406
406
  process.exit(result.status || 0);
407
407
  }
408
408
 
409
+ /**
410
+ * Update ghosttown to the latest version
411
+ */
412
+ function updateGhosttown() {
413
+ const RESET = '\x1b[0m';
414
+ const CYAN = '\x1b[36m';
415
+ const BEIGE = '\x1b[38;2;255;220;150m';
416
+ const BOLD_YELLOW = '\x1b[1;93m';
417
+ const DIM = '\x1b[2m';
418
+
419
+ console.log('');
420
+ console.log(` ${BOLD_YELLOW}Updating ghosttown...${RESET}`);
421
+ console.log('');
422
+
423
+ try {
424
+ execSync('npm install -g @seflless/ghosttown', {
425
+ stdio: 'inherit',
426
+ });
427
+
428
+ console.log('');
429
+ console.log(` ${BOLD_YELLOW}ghosttown has been updated!${RESET}`);
430
+ console.log('');
431
+ console.log(` ${CYAN}To check your version:${RESET} ${BEIGE}ghosttown --version${RESET}`);
432
+ console.log('');
433
+ } catch (err) {
434
+ console.log('');
435
+ console.log(` ${RESET}Failed to update ghosttown.${RESET}`);
436
+ console.log(` ${DIM}Try running with sudo: sudo npm install -g @seflless/ghosttown${RESET}`);
437
+ console.log('');
438
+ process.exit(1);
439
+ }
440
+
441
+ process.exit(0);
442
+ }
443
+
409
444
  /**
410
445
  * Kill a ghosttown session
411
446
  * If sessionName is null, kills the current session (if inside one)
@@ -527,6 +562,7 @@ Commands:
527
562
  list List all ghosttown tmux sessions
528
563
  attach <session> Attach to a ghosttown session
529
564
  detach Detach from current ghosttown session
565
+ update Update ghosttown to the latest version
530
566
  <command> Run command in a new tmux session (ghosttown-<id>)
531
567
 
532
568
  Examples:
@@ -535,6 +571,7 @@ Examples:
535
571
  ghosttown list List all ghosttown sessions
536
572
  ghosttown attach ghosttown-1 Attach to session ghosttown-1
537
573
  ghosttown detach Detach from current session
574
+ ghosttown update Update to the latest version
538
575
  ghosttown -k Kill current session (when inside one)
539
576
  ghosttown -k ghosttown-1 Kill a specific session
540
577
  ghosttown vim Run vim in a new tmux session
@@ -561,6 +598,13 @@ Aliases:
561
598
  // detachFromTmux exits, so this won't be reached
562
599
  }
563
600
 
601
+ // Handle update command
602
+ else if (arg === 'update') {
603
+ handled = true;
604
+ updateGhosttown();
605
+ // updateGhosttown exits, so this won't be reached
606
+ }
607
+
564
608
  // Handle attach command
565
609
  else if (arg === 'attach') {
566
610
  const sessionArg = args[i + 1];