caroushell 0.1.8 → 0.1.11

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/keyboard.js CHANGED
@@ -23,12 +23,22 @@ const KEYMAP = {
23
23
  '\u001b[1;5D': { name: 'ctrl-left', ctrl: true },
24
24
  '\u001b[5C': { name: 'ctrl-right', ctrl: true },
25
25
  '\u001b[5D': { name: 'ctrl-left', ctrl: true },
26
+ // Option/Alt-based word jumps (macOS/iTerm send meta-modified arrows or ESC+b/f)
27
+ '\u001b[1;3C': { name: 'ctrl-right', meta: true },
28
+ '\u001b[1;3D': { name: 'ctrl-left', meta: true },
29
+ '\u001b[1;9C': { name: 'ctrl-right', meta: true },
30
+ '\u001b[1;9D': { name: 'ctrl-left', meta: true },
31
+ '\u001bf': { name: 'ctrl-right', meta: true },
32
+ '\u001bb': { name: 'ctrl-left', meta: true },
26
33
  // Home/End/Delete variants
27
34
  '\u001b[H': { name: 'home' },
28
35
  '\u001b[F': { name: 'end' },
29
36
  '\u001b[1~': { name: 'home' },
30
37
  '\u001b[4~': { name: 'end' },
31
38
  '\u001b[3~': { name: 'delete' },
39
+ // Focus in/out (sent by some terminals on focus change - swallow these)
40
+ '\u001b[I': { name: 'focus-in' },
41
+ '\u001b[O': { name: 'focus-out' },
32
42
  };
33
43
  // For efficient prefix checks
34
44
  const KEY_PREFIXES = new Set();
@@ -99,6 +109,11 @@ class Keyboard extends events_1.EventEmitter {
99
109
  if (evt === 'need-more')
100
110
  return; // wait for more bytes
101
111
  if (evt) {
112
+ // Swallow focus in/out sequences so they don't show up as visible chars
113
+ if (evt.name === 'focus-in' || evt.name === 'focus-out') {
114
+ this.buffer = this.buffer.slice(evt.sequence.length);
115
+ continue;
116
+ }
102
117
  this.emit('key', evt);
103
118
  this.buffer = this.buffer.slice(evt.sequence.length);
104
119
  continue;
package/dist/main.js CHANGED
@@ -1,11 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
4
6
  const app_1 = require("./app");
5
7
  const hello_new_user_1 = require("./hello-new-user");
6
8
  const logs_1 = require("./logs");
7
9
  const config_1 = require("./config");
10
+ function shouldPrintVersion() {
11
+ return process.argv.includes("--version");
12
+ }
13
+ function printVersion() {
14
+ const pkgJsonPath = (0, path_1.resolve)(__dirname, "..", "package.json");
15
+ const pkgJson = JSON.parse((0, fs_1.readFileSync)(pkgJsonPath, "utf8"));
16
+ console.log("caroushell version:", pkgJson.version);
17
+ }
8
18
  async function main() {
19
+ if (shouldPrintVersion()) {
20
+ printVersion();
21
+ return;
22
+ }
9
23
  await (0, logs_1.ensureLogFolderExists)();
10
24
  (0, logs_1.logLine)("Caroushell started");
11
25
  if (!(await (0, config_1.doesConfigExist)())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caroushell",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "description": "Terminal carousel that suggests commands from history, config, and AI.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/main.js",