eagle-mem 4.10.6 → 4.10.8

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/CHANGELOG.md CHANGED
@@ -4,6 +4,25 @@ All notable changes to the **Eagle Mem** project are documented here.
4
4
 
5
5
  ---
6
6
 
7
+ ## v4.10.8 Graph Neighbors Hotfix
8
+
9
+ This hotfix tightens the final graph-memory verification path:
10
+
11
+ - **Exact Neighbor Matching**: `eagle-mem graph neighbors <node>` now prefers exact `node_name` matches before fuzzy matches, and prefers file nodes when names are otherwise ambiguous.
12
+ - **Regression Coverage**: The graph-memory regression suite now verifies that `graph neighbors "a.sh"` selects the exact file node rather than a declaration node whose scoped name merely contains the file path.
13
+
14
+ ---
15
+
16
+ ## v4.10.7 Graph Rebuild Hotfix
17
+
18
+ This hotfix closes an installed-runtime failure found after the v4.10.6 graph-memory release:
19
+
20
+ - **Import Parser Hardening**: Restricts quoted local import detection to `./` and `../` paths, and limits shell `source` parsing to shell-like files so SQL columns named `source` are not mistaken for shell commands.
21
+ - **SQL-Safe Import Lookup**: Escapes import lookup terms before querying graph file nodes, preventing single quotes in source files from breaking `eagle-mem graph rebuild`.
22
+ - **Regression Coverage**: Extends the graph-memory regression test with a SQL fixture containing `source TEXT NOT NULL DEFAULT 'manual'`, matching the installed-runtime failure mode.
23
+
24
+ ---
25
+
7
26
  ## v4.10.6 Graph Memory Rebuild Release
8
27
 
9
28
  This patch turns the local graph-memory workarounds into supported product behavior:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eagle-mem",
3
- "version": "4.10.6",
3
+ "version": "4.10.8",
4
4
  "description": "Shared memory, release guardrails, RTK token protection, and worker lanes for Claude Code, Codex, Grok, and Google Antigravity",
5
5
  "bin": {
6
6
  "eagle-mem": "bin/eagle-mem"
package/scripts/index.sh CHANGED
@@ -238,10 +238,14 @@ COMMIT;"
238
238
  fi
239
239
 
240
240
  # 2. Parse local relative imports/requires/sources
241
- # Matches paths starting with dot (./ or ../) or sourcing .sh files
242
- local_imports=$(grep -oE "['\"](\.[^'\"]+)['\"]" "$full_path" 2>/dev/null | tr -d "'\"" || true)
243
- # Also grab shell source files
244
- shell_sources=$(grep -E "^[[:space:]]*(\.|source) " "$full_path" 2>/dev/null | sed -E "s/^[[:space:]]*(\.|source)[[:space:]]+(.*)/\\2/" || true)
241
+ # Matches quoted paths starting with ./ or ../ and shell source lines.
242
+ local_imports=$(grep -oE "['\"](\./[^'\"]+|\.\./[^'\"]+)['\"]" "$full_path" 2>/dev/null | tr -d "'\"" || true)
243
+ shell_sources=""
244
+ case "$file" in
245
+ *.sh|*.bash|*.zsh|*.envrc|.envrc)
246
+ shell_sources=$(grep -E "^[[:space:]]*(source[[:space:]]+|\. [^[:space:]])" "$full_path" 2>/dev/null | sed -E "s/^[[:space:]]*(source[[:space:]]+|\. )([^#[:space:]]+).*/\\2/" || true)
247
+ ;;
248
+ esac
245
249
 
246
250
  all_refs=$(printf "%s\n%s\n" "$local_imports" "$shell_sources" | sort -u)
247
251
  if [ -n "$all_refs" ]; then
@@ -250,9 +254,10 @@ COMMIT;"
250
254
  # Clean up path variables in shell sources (e.g. $_eagle_db_dir/db-core.sh -> db-core.sh)
251
255
  ref_clean=$(echo "$ref" | sed -E 's/.*\///; s/\.sh$//; s/\.js$//; s/\.ts$//')
252
256
  [ -z "$ref_clean" ] && continue
257
+ ref_sql=$(eagle_sql_escape "$ref_clean")
253
258
 
254
259
  # Check if there is a known file node in our graph that matches this basename or path
255
- matched_file=$(eagle_db "SELECT node_name FROM graph_nodes WHERE project = '$project_sql' AND node_type = 'file' AND (node_name LIKE '%/$ref_clean%' OR node_name = '$ref_clean') LIMIT 1;")
260
+ matched_file=$(eagle_db "SELECT node_name FROM graph_nodes WHERE project = '$project_sql' AND node_type = 'file' AND (node_name LIKE '%/$ref_sql%' OR node_name = '$ref_sql') LIMIT 1;")
256
261
  if [ -n "$matched_file" ]; then
257
262
  target_file_id=$(eagle_graph_get_node_id "$PROJECT" "file" "$matched_file")
258
263
  if [ -n "$target_file_id" ]; then
@@ -906,7 +906,18 @@ memories_graph() {
906
906
 
907
907
  # Find node by name (fuzzy or exact)
908
908
  local matched
909
- matched=$(eagle_db "SELECT id, node_type, node_name FROM graph_nodes WHERE project = '$(eagle_sql_escape "$project")' AND (node_name = '$(eagle_sql_escape "$target_name")' OR node_name LIKE '%$(eagle_sql_escape "$target_name")%') LIMIT 1;")
909
+ local project_sql target_sql
910
+ project_sql=$(eagle_sql_escape "$project")
911
+ target_sql=$(eagle_sql_escape "$target_name")
912
+ matched=$(eagle_db "SELECT id, node_type, node_name
913
+ FROM graph_nodes
914
+ WHERE project = '$project_sql'
915
+ AND (node_name = '$target_sql' OR node_name LIKE '%$target_sql%')
916
+ ORDER BY
917
+ CASE WHEN node_name = '$target_sql' THEN 0 ELSE 1 END,
918
+ CASE WHEN node_type = 'file' THEN 0 ELSE 1 END,
919
+ id
920
+ LIMIT 1;")
910
921
  if [ -z "$matched" ]; then
911
922
  eagle_err "Node not found matching '$target_name'."
912
923
  exit 1
@@ -68,7 +68,16 @@ function CloudDictationPipeline() {
68
68
  }
69
69
  EOF
70
70
 
71
- git -C "$repo" add a.sh b.sh old.sh
71
+ mkdir -p "$repo/db"
72
+ cat > "$repo/db/source_column.sql" <<'EOF'
73
+ CREATE TABLE graph_fixture (
74
+ id TEXT PRIMARY KEY,
75
+ source TEXT NOT NULL DEFAULT 'manual',
76
+ note TEXT DEFAULT './not-a-real-import'
77
+ );
78
+ EOF
79
+
80
+ git -C "$repo" add a.sh b.sh old.sh db/source_column.sql
72
81
 
73
82
  "$EAGLE_BIN" scan --force "$repo" >/dev/null
74
83
  "$EAGLE_BIN" index --force "$repo" >/dev/null
@@ -98,6 +107,16 @@ case "$overview_value" in
98
107
  ;;
99
108
  esac
100
109
 
110
+ neighbors_output=$(cd "$repo" && "$EAGLE_BIN" graph neighbors "a.sh" | sed -E $'s/\x1b\\[[0-9;]*m//g')
111
+ case "$neighbors_output" in
112
+ *"Node: a.sh [file]"*) ;;
113
+ *)
114
+ echo "graph neighbors did not prefer exact file node match" >&2
115
+ echo "$neighbors_output" >&2
116
+ exit 1
117
+ ;;
118
+ esac
119
+
101
120
  eagle_db "INSERT INTO sessions (id, project, cwd, model, status)
102
121
  VALUES ('session-graph-test', 'project', '$repo', 'test-model', 'completed');" >/dev/null
103
122
  eagle_db "INSERT INTO observations (session_id, project, tool_name, files_read, files_modified)