فهرست منبع

fix(cli): codegraph node accepts Windows backslash paths in file mode (#822)

The file-vs-symbol heuristic only matched '/' — `codegraph node
src\auth\session.ts` on Windows fell through to symbol mode and found
nothing. Both separators now route to file mode, normalized to forward
slashes (the form the index stores). Symbols never contain either
separator in any indexed language.

Validated: macOS smoke (explore/node symbol/node file/unindexed
refusal) + Linux Docker (same smoke + full suite, 1428 passed).
Windows VM validation queued — the Parallels guest is currently
unreachable (control commands are Pro-gated; needs a manual start).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Colby Mchenry 1 هفته پیش
والد
کامیت
01717854f5
1فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 5 2
      src/bin/codegraph.ts

+ 5 - 2
src/bin/codegraph.ts

@@ -968,12 +968,15 @@ program
 
 
       // A name with a path separator is a file read; otherwise a symbol
       // A name with a path separator is a file read; otherwise a symbol
       // (use --file for basename-only file reads or to pin an overload).
       // (use --file for basename-only file reads or to pin an overload).
+      // Both separators: Windows users type src\auth\session.ts. Symbols
+      // never contain either ('/' isn't an identifier char anywhere we
+      // index; C++ scope is '::', JS members '.').
       const args: Record<string, unknown> = {};
       const args: Record<string, unknown> = {};
       if (options.file) {
       if (options.file) {
         args.file = options.file;
         args.file = options.file;
         if (name && name !== options.file) args.symbol = name;
         if (name && name !== options.file) args.symbol = name;
-      } else if (name.includes('/')) {
-        args.file = name;
+      } else if (name.includes('/') || name.includes('\\')) {
+        args.file = name.replace(/\\/g, '/');
       } else {
       } else {
         args.symbol = name;
         args.symbol = name;
         args.includeCode = true;
         args.includeCode = true;