Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
fix(paths): preserve literal POSIX backslashes
Lum1104318917078493
diff --git a/tests/skill/understand/test_extract_import_map.test.mjs b/tests/skill/understand/test_extract_import_map.test.mjsindex c6d49cc3..30b17a3d 100644--- a/tests/skill/understand/test_extract_import_map.test.mjs+++ b/tests/skill/understand/test_extract_import_map.test.mjs@@ -111,7 +111,7 @@ describe('extract-import-map.mjs — TypeScript / JavaScript resolver', () => {{ path: 'src/stable.ts', language: 'typescript', fileCategory: 'code' },{ path: 'src/untouched.ts', language: 'typescript', fileCategory: 'code' },],- analysisPaths: ['src\\changed.ts'],+ analysisPaths: [process.platform === 'win32' ? 'src\\changed.ts' : 'src/changed.ts'],});expect(result.status, result.stderr).toBe(0);@@ -160,6 +160,26 @@ describe('extract-import-map.mjs — TypeScript / JavaScript resolver', () => {expect(result.output.stats.filesScanned).toBe(0);});+ it.skipIf(process.platform === 'win32')(+ 'preserves literal backslashes in POSIX filenames',+ () => {+ projectRoot = setupTree({+ 'src/foo\\bar.js': 'module.exports = 1;\n',+ });++ const result = runScript(projectRoot, {+ projectRoot,+ files: [+ { path: 'src/foo\\bar.js', language: 'javascript', fileCategory: 'code' },+ ],+ analysisPaths: ['src/foo\\bar.js'],+ });++ expect(result.status, result.stderr).toBe(0);+ expect(result.output.importMap).toEqual({ 'src/foo\\bar.js': [] });+ },+ );+it('orders Unicode import targets by locale-independent UTF-16 code units', () => {projectRoot = setupTree({'src/index.ts': `import './ä';\nimport './Z';\nimport './a';\n`,diff --git a/tests/skill/understand/test_prepare_incremental.test.mjs b/tests/skill/understand/test_prepare_incremental.test.mjsindex 9cbbcb30..916113e3 100644--- a/tests/skill/understand/test_prepare_incremental.test.mjs+++ b/tests/skill/understand/test_prepare_incremental.test.mjs@@ -576,6 +576,25 @@ describe('prepare-incremental.mjs', { timeout: 30_000 }, () => {expect(plan.filesToReanalyze).toEqual(['src/new name.ts']);});+ it.skipIf(process.platform === 'win32')(+ 'preserves literal backslashes in POSIX project paths',+ () => {+ const literalPath = 'src/foo\\bar.js';+ const { root, baseCommit } = setupRepository({+ [literalPath]: 'function before() { return 1; }\nmodule.exports = before;\n',+ 'src/a.js': 'module.exports = 1;\n',+ 'src/b.js': 'module.exports = 2;\n',+ 'src/c.js': 'module.exports = 3;\n',+ });+ writeProjectFile(root, literalPath, 'function after() { return 1; }\nmodule.exports = after;\n');+ commit(root, 'change literal backslash path');++ const { plan, scan } = prepare(root, baseCommit);+ expect(plan.filesToReanalyze).toEqual([literalPath]);+ expect(scan.files.map(file => file.path)).toContain(literalPath);+ },+ );+it('keeps the same new-directory decision when preparation is retried', () => {const { root, baseCommit } = setupRepository({'src/a.ts': 'export const a = 1;\n',diff --git a/understand-anything-plugin/packages/core/src/__tests__/change-classifier.test.ts b/understand-anything-plugin/packages/core/src/__tests__/change-classifier.test.tsindex 5e0eab5c..c3d69c35 100644--- a/understand-anything-plugin/packages/core/src/__tests__/change-classifier.test.ts+++ b/understand-anything-plugin/packages/core/src/__tests__/change-classifier.test.ts@@ -143,6 +143,22 @@ describe("classifyUpdate", () => {expect(decision.action).toBe("PARTIAL_UPDATE");});+ it.skipIf(process.platform === "win32")(+ "does not treat a literal POSIX backslash as a directory separator",+ () => {+ const analysis = makeAnalysis({ newFiles: ["foo\\bar.js"] });++ const decision = classifyUpdate(+ analysis,+ 20,+ ["index.js"],+ ["index.js", "foo\\bar.js"],+ );++ expect(decision.action).toBe("PARTIAL_UPDATE");+ },+ );+it("does NOT trigger ARCHITECTURE_UPDATE for new file in existing directory", () => {const analysis = makeAnalysis({newFiles: ["src/newfile.ts"],diff --git a/understand-anything-plugin/packages/core/src/change-classifier.ts b/understand-anything-plugin/packages/core/src/change-classifier.tsindex eb2773cb..0ab9a561 100644--- a/understand-anything-plugin/packages/core/src/change-classifier.ts+++ b/understand-anything-plugin/packages/core/src/change-classifier.ts@@ -128,7 +128,8 @@ function detectDirectoryChanges(function topDirectories(files: Iterable<string>): Set<string> {const dirs = new Set<string>();for (const file of files) {- const dir = topDirectory(file.replaceAll("\\", "/"));+ const platformPath = process.platform === "win32" ? file.replaceAll("\\", "/") : file;+ const dir = topDirectory(platformPath);if (dir) dirs.add(dir);}return dirs;diff --git a/understand-anything-plugin/skills/understand/extract-import-map.mjs b/understand-anything-plugin/skills/understand/extract-import-map.mjsindex 2c7aa9d2..ea2a9414 100644--- a/understand-anything-plugin/skills/understand/extract-import-map.mjs+++ b/understand-anything-plugin/skills/understand/extract-import-map.mjs@@ -99,7 +99,8 @@ const { TreeSitterPlugin, PluginRegistry, builtinLanguageConfigs, registerAllPar* cross-platform.*/function toPosix(p) {- return p.split(/[\\/]/).filter(Boolean).join('/');+ const separators = process.platform === 'win32' ? /[\\/]/ : /\//;+ return p.split(separators).filter(Boolean).join('/');}/**diff --git a/understand-anything-plugin/skills/understand/finalize-incremental.mjs b/understand-anything-plugin/skills/understand/finalize-incremental.mjsindex 1ef96489..de09ddb5 100644--- a/understand-anything-plugin/skills/understand/finalize-incremental.mjs+++ b/understand-anything-plugin/skills/understand/finalize-incremental.mjs@@ -71,7 +71,8 @@ function atomicWriteJson(path, value) {function normalizeRelativePath(value) {if (typeof value !== 'string' || !value || isAbsolute(value)) return null;- const path = value.replaceAll('\\', '/').replace(/^\.\//, '');+ const platformPath = process.platform === 'win32' ? value.replaceAll('\\', '/') : value;+ const path = platformPath.replace(/^\.\//, '');if (!path || path.split('/').some(part => part === '..')) return null;return path;}diff --git a/understand-anything-plugin/skills/understand/prepare-incremental.mjs b/understand-anything-plugin/skills/understand/prepare-incremental.mjsindex 3674248b..5eb70856 100644--- a/understand-anything-plugin/skills/understand/prepare-incremental.mjs+++ b/understand-anything-plugin/skills/understand/prepare-incremental.mjs@@ -82,7 +82,8 @@ function sorted(values) {function normalizeRelativePath(value) {if (typeof value !== 'string' || value.length === 0 || isAbsolute(value)) return null;- const posix = value.replaceAll('\\', '/').replace(/^\.\//, '');+ const platformPath = process.platform === 'win32' ? value.replaceAll('\\', '/') : value;+ const posix = platformPath.replace(/^\.\//, '');if (!posix || posix.split('/').some(part => part === '..')) return null;return posix;}