Explorar o código

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 hai 1 semana
pai
achega
01717854f5
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  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
       // (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> = {};
       if (options.file) {
         args.file = options.file;
         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 {
         args.symbol = name;
         args.includeCode = true;