caroushell 0.1.8 → 0.1.10

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
@@ -29,6 +29,9 @@ const KEYMAP = {
29
29
  '\u001b[1~': { name: 'home' },
30
30
  '\u001b[4~': { name: 'end' },
31
31
  '\u001b[3~': { name: 'delete' },
32
+ // Focus in/out (sent by some terminals on focus change - swallow these)
33
+ '\u001b[I': { name: 'focus-in' },
34
+ '\u001b[O': { name: 'focus-out' },
32
35
  };
33
36
  // For efficient prefix checks
34
37
  const KEY_PREFIXES = new Set();
@@ -99,6 +102,11 @@ class Keyboard extends events_1.EventEmitter {
99
102
  if (evt === 'need-more')
100
103
  return; // wait for more bytes
101
104
  if (evt) {
105
+ // Swallow focus in/out sequences so they don't show up as visible chars
106
+ if (evt.name === 'focus-in' || evt.name === 'focus-out') {
107
+ this.buffer = this.buffer.slice(evt.sequence.length);
108
+ continue;
109
+ }
102
110
  this.emit('key', evt);
103
111
  this.buffer = this.buffer.slice(evt.sequence.length);
104
112
  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(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.10",
4
4
  "description": "Terminal carousel that suggests commands from history, config, and AI.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/main.js",