laminark 2.22.1 → 2.22.2

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": "laminark",
3
- "version": "2.22.1",
3
+ "version": "2.22.2",
4
4
  "description": "Persistent adaptive memory for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laminark",
3
3
  "description": "Persistent adaptive memory for Claude Code. Automatic observation capture, semantic search, topic detection, knowledge graph, and web visualization.",
4
- "version": "2.22.1",
4
+ "version": "2.22.2",
5
5
  "author": {
6
6
  "name": "NoobyNull"
7
7
  },
@@ -2,46 +2,63 @@
2
2
  # Auto-install production dependencies if missing (first run after plugin install)
3
3
  PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4
4
  REPAIR_LOG="$PLUGIN_ROOT/.repair-log"
5
+ # Sentinel tracks last verified version — avoids re-checking on every hook call
6
+ DEPS_OK_SENTINEL="$PLUGIN_ROOT/.deps-ok"
5
7
 
6
8
  log_repair() {
7
9
  echo "[$(date -Iseconds)] ensure-deps: $1" >> "$REPAIR_LOG"
8
10
  }
9
11
 
10
- verify_better_sqlite3() {
11
- node -e "require('better-sqlite3')" 2>/dev/null
12
+ # Verify the handler can actually import (catches broken zod, missing better-sqlite3, etc.)
13
+ verify_handler() {
14
+ cd "$PLUGIN_ROOT" && node -e "import('./dist/hooks/handler.js')" 2>/dev/null
12
15
  }
13
16
 
14
- if [ ! -d "$PLUGIN_ROOT/node_modules/better-sqlite3/build" ]; then
17
+ install_deps() {
15
18
  # Use local tmp dir to avoid EXDEV errors on btrfs subvolumes / cross-device setups
16
19
  NPM_TMP="$PLUGIN_ROOT/.npm-tmp"
17
20
  mkdir -p "$NPM_TMP"
18
21
 
19
- log_repair "Dependencies missing, running npm install"
20
-
21
22
  # Install deps without running install scripts (sharp build fails without node-addon-api)
22
23
  # then selectively rebuild better-sqlite3 which needs its native addon
23
24
  TMPDIR="$NPM_TMP" npm install --prefix "$PLUGIN_ROOT" --omit=dev --ignore-scripts --silent --cache "$NPM_TMP/cache" 2>>"$REPAIR_LOG"
24
25
  npm rebuild --prefix "$PLUGIN_ROOT" better-sqlite3 --silent 2>>"$REPAIR_LOG"
25
26
  rm -rf "$NPM_TMP"
27
+ }
28
+
29
+ # Check sentinel: skip verification if deps were already confirmed for this version
30
+ CURRENT_VERSION=$(node -e "try{console.log(require('$PLUGIN_ROOT/package.json').version)}catch{console.log('unknown')}" 2>/dev/null || echo "unknown")
31
+ SENTINEL_VERSION=""
32
+ if [ -f "$DEPS_OK_SENTINEL" ]; then
33
+ SENTINEL_VERSION=$(cat "$DEPS_OK_SENTINEL" 2>/dev/null)
34
+ fi
35
+
36
+ if [ "$SENTINEL_VERSION" = "$CURRENT_VERSION" ]; then
37
+ # Already verified for this version — skip
38
+ :
39
+ elif ! verify_handler; then
40
+ log_repair "Handler import failed (v$CURRENT_VERSION), installing dependencies"
41
+
42
+ install_deps
26
43
 
27
- # Verify that better-sqlite3 actually loads
28
- if ! verify_better_sqlite3; then
29
- log_repair "WARN: better-sqlite3 failed to load after install, retrying with clean node_modules"
44
+ if ! verify_handler; then
45
+ log_repair "WARN: still broken after install, retrying with clean node_modules"
30
46
  rm -rf "$PLUGIN_ROOT/node_modules"
31
- NPM_TMP="$PLUGIN_ROOT/.npm-tmp"
32
- mkdir -p "$NPM_TMP"
33
- TMPDIR="$NPM_TMP" npm install --prefix "$PLUGIN_ROOT" --omit=dev --ignore-scripts --silent --cache "$NPM_TMP/cache" 2>>"$REPAIR_LOG"
34
- npm rebuild --prefix "$PLUGIN_ROOT" better-sqlite3 --silent 2>>"$REPAIR_LOG"
35
- rm -rf "$NPM_TMP"
47
+ install_deps
36
48
 
37
- if verify_better_sqlite3; then
38
- log_repair "OK: better-sqlite3 loaded after clean reinstall"
49
+ if verify_handler; then
50
+ log_repair "OK: handler loads after clean reinstall"
51
+ echo "$CURRENT_VERSION" > "$DEPS_OK_SENTINEL"
39
52
  else
40
- log_repair "ERROR: better-sqlite3 still fails after clean reinstall"
53
+ log_repair "ERROR: handler still fails after clean reinstall"
41
54
  fi
42
55
  else
43
- log_repair "OK: better-sqlite3 verified successfully"
56
+ log_repair "OK: handler verified (v$CURRENT_VERSION)"
57
+ echo "$CURRENT_VERSION" > "$DEPS_OK_SENTINEL"
44
58
  fi
59
+ else
60
+ # First successful check for this version — write sentinel
61
+ echo "$CURRENT_VERSION" > "$DEPS_OK_SENTINEL"
45
62
  fi
46
63
 
47
64
  # Auto-provision and auto-update CLAUDE.md with Laminark instructions