Fix NODE_PATH MSYS2→Windows conversion in ctx-debug.sh

NODE_PATH was set to an MSYS2-style path (/d/Coding/...) that native
Node.js could not resolve, causing all better-sqlite3 and server
resolution checks to fail silently. Added PLUGIN_ROOT to the Windows
path bridge block so its cygpath -m conversion feeds NODE_PATH.

Rejected: hardcode PLUGIN_ROOT to Windows path | brittle, breaks
  portable runs
Rejected: remove NODE_PATH override entirely | would break non-local
  node_module resolution in adapters
Rejected: delay NODE_PATH export until after path bridge | same end
  result, less visible

Constraint: Git Bash's /d/ paths are invisible to native Windows Node.js
Constraint: Node.js on Windows silently treats unknown paths in
  NODE_PATH as no-ops — no error, just module not found
Confidence: high
Scope-risk: narrow
Directive: Any future MSYS2 path stored in a variable and passed to
  node must be cygpath -m converted first.
Directive: NODE_PATH export happens before the bridge block — the
  bridge re-exports it with the converted PLUGIN_ROOT value.
Tested: diagnostic now passes 27/30 (was 22/30), stderr clean
This commit is contained in:
Plamen Ivanov
2026-05-13 17:17:41 +03:00
parent c7a8ba7d15
commit a32bd378cc
2 changed files with 2182 additions and 0 deletions
+2180
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -190,6 +190,8 @@ if [ "$OS_TYPE" = "windows" ] && command -v cygpath &>/dev/null; then
JSONL_FILE="$(cygpath -m "$JSONL_FILE" 2>/dev/null || echo "$JSONL_FILE")"
EFFECTIVE_TMP="$(cygpath -m "$EFFECTIVE_TMP" 2>/dev/null || echo "$EFFECTIVE_TMP")"
JSON_FILE="$(cygpath -m "$JSON_FILE" 2>/dev/null || echo "$JSON_FILE")"
PLUGIN_ROOT="$(cygpath -m "$PLUGIN_ROOT" 2>/dev/null || echo "$PLUGIN_ROOT")"
export NODE_PATH="$PLUGIN_ROOT/node_modules:${NODE_PATH:-}"
fi
NOW="$(date -u '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null || date '+%Y-%m-%d %H:%M:%S')"