fix(embeddings): resolve server-mapping path for parity with clone/upload roots

MAPPING_FILE now wraps path.resolve() like CLONE_ROOT (git-clone.ts) and
UPLOAD_ROOT (upload-paths.ts), so a relative GITNEXUS_HOME yields an absolute
path. No-op for the supported absolute-GITNEXUS_HOME config (Docker) and for
readServerMapping's only caller (run-analyze.ts).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergo Magyar 2026-06-18 15:54:21 +00:00
parent 5c68d96d66
commit d07c63fdf9

View file

@ -10,8 +10,10 @@ import path from 'path';
import { getGlobalDir } from '../../storage/repo-manager.js';
// Sourced from getGlobalDir() so it honors GITNEXUS_HOME (the Docker image sets
// GITNEXUS_HOME=/data/gitnexus); falls back to ~/.gitnexus when unset.
const MAPPING_FILE = path.join(getGlobalDir(), 'server-mapping.json');
// GITNEXUS_HOME=/data/gitnexus); falls back to ~/.gitnexus when unset. Wrapped in
// path.resolve() for parity with the clone/upload roots (git-clone.ts CLONE_ROOT,
// upload-paths.ts UPLOAD_ROOT) so a relative GITNEXUS_HOME still yields an absolute path.
const MAPPING_FILE = path.resolve(path.join(getGlobalDir(), 'server-mapping.json'));
let cachedMapping: Record<string, string> | null = null;