@dvquys/qrec 0.2.2 → 0.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvquys/qrec",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Purpose-built session recall engine — persistent daemon with BM25 + vector hybrid search",
5
5
  "bin": {
6
6
  "qrec": "plugin/scripts/qrec-cli.js"
@@ -4,27 +4,8 @@
4
4
  "use strict";
5
5
 
6
6
  const { spawnSync, spawn } = require("child_process");
7
- const { existsSync } = require("fs");
8
- const { homedir } = require("os");
9
7
  const path = require("path");
10
-
11
- const BUN_CANDIDATES = [
12
- path.join(homedir(), ".bun", "bin", "bun"),
13
- "/usr/local/bin/bun",
14
- "/opt/homebrew/bin/bun",
15
- "/home/linuxbrew/.linuxbrew/bin/bun",
16
- ];
17
-
18
- function findBun() {
19
- for (const candidate of BUN_CANDIDATES) {
20
- if (existsSync(candidate)) return candidate;
21
- }
22
- try {
23
- const r = spawnSync("which", ["bun"], { encoding: "utf-8", timeout: 3000 });
24
- if (r.status === 0 && r.stdout.trim()) return r.stdout.trim();
25
- } catch {}
26
- return null;
27
- }
8
+ const { findBun } = require("./bun-finder.js");
28
9
 
29
10
  const bunPath = findBun();
30
11
  if (!bunPath) {
@@ -48,7 +29,16 @@ if (userArgs.includes("serve") && userArgs.includes("--daemon")) {
48
29
  process.exit(0);
49
30
  }
50
31
 
51
- // Buffer stdin before passing to bun (avoids libuv pipe crash on Linux).
32
+ // TTY: pass stdin directly so interactive prompts (e.g. teardown Y/N) work.
33
+ if (process.stdin.isTTY) {
34
+ const result = spawnSync(bunPath, bunArgs, {
35
+ stdio: "inherit",
36
+ env: process.env,
37
+ });
38
+ process.exit(result.status ?? 1);
39
+ }
40
+
41
+ // Non-TTY (hook/pipe): buffer stdin before passing to bun (avoids libuv pipe crash on Linux).
52
42
  const stdinChunks = [];
53
43
  process.stdin.on("data", chunk => stdinChunks.push(chunk));
54
44
  process.stdin.on("end", () => {
@@ -60,12 +50,3 @@ process.stdin.on("end", () => {
60
50
  });
61
51
  process.exit(result.status ?? 1);
62
52
  });
63
-
64
- if (process.stdin.isTTY) {
65
- process.stdin.destroy();
66
- const result = spawnSync(bunPath, bunArgs, {
67
- stdio: ["ignore", "inherit", "inherit"],
68
- env: process.env,
69
- });
70
- process.exit(result.status ?? 1);
71
- }