diff --git a/bin/qmd b/bin/qmd new file mode 100755 index 0000000..32a8fd7 --- /dev/null +++ b/bin/qmd @@ -0,0 +1,12 @@ +#!/bin/sh +# Detect the runtime used to install this package and use the matching one +# to avoid native module ABI mismatches (e.g., better-sqlite3 compiled for bun vs node) + +DIR="$(cd "$(dirname "$0")/.." && pwd)" + +# Check if we were installed with bun (look for bun.lock or bun-lockb) +if [ -f "$DIR/bun.lock" ] || [ -f "$DIR/bun.lockb" ] || [ -n "$BUN_INSTALL" ]; then + exec bun "$DIR/dist/cli/qmd.js" "$@" +else + exec node "$DIR/dist/cli/qmd.js" "$@" +fi diff --git a/package.json b/package.json index faefbdd..38caac6 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,10 @@ } }, "bin": { - "qmd": "dist/cli/qmd.js" + "qmd": "bin/qmd" }, "files": [ + "bin/", "dist/", "LICENSE", "CHANGELOG.md" @@ -45,7 +46,7 @@ }, "dependencies": { "@modelcontextprotocol/sdk": "^1.25.1", - "better-sqlite3": "^11.0.0", + "better-sqlite3": "^12.4.5", "fast-glob": "^3.3.0", "node-llama-cpp": "^3.17.1", "picomatch": "^4.0.0",