mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-26 06:43:15 +08:00
Closes #423, #20. A non-ASCII repo path passed to `codebase-memory-mcp cli index_repository "<json>"` was mangled on Windows, so the command failed with "repo_path is required" instead of indexing the real directory. POSIX is unaffected (argv is already UTF-8). Two boundaries had to be fixed: 1. argv read: main() took only the narrow `int main(int argc, char **argv)`, so the CRT handed it argv in the active ANSI code page. On Windows main() now rebuilds argv from the wide command line (GetCommandLineW + CommandLineToArgvW) and converts each element to UTF-8 (cbm_wide_to_utf8). 2. worker spawn: the index supervisor (and the UI index thread) spawned the worker via CreateProcessA, which re-interpreted the UTF-8 command line through the ANSI code page -- re-mangling the path at the parent->worker boundary even after (1). Both spawns now build a wide command line (cbm_utf8_to_wide) and use CreateProcessW. Without (2) the default (supervisor-enabled) path stayed broken while only the in-process path worked, so this is the complete end-to-end fix, not just argv. Promotes tests/windows/test_cli_non_ascii_arg.py from an opt-in known-red to a green Windows guard (scripts/test-windows.ps1 + the test-windows-guards CI job). The guard now exercises the DEFAULT supervised path (it drops the suite's CBM_INDEX_SUPERVISOR=0 so it actually crosses the worker-spawn boundary). Verified on native Windows: RED before the fix, GREEN after (a non-ASCII repo indexes, nodes>0). Also adds -lshell32 explicitly (main.c now uses CommandLineToArgvW) and refreshes RED_TEST_ANALYSIS.md. Signed-off-by: Flipper <jacobphilipp@ymail.com>