Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Julia language support to the tree-sitter extraction pipeline and updates Node/Vitest/CI configuration to work around Node/V8 WASM issues while expanding supported Node versions.
Changes:
- Add Julia grammar + extractor + extension mapping and display name.
- Introduce extractor hooks (
getName,resolveBody) and Julia-specific extraction logic/tests. - Update Node version guards/config (engines, CLI Node-25 block, Vitest fork execArgv) and add CI matrix for Node 24/26.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Adds conditional --liftoff-only for Vitest fork pool based on Node major version. |
| src/types.ts | Adds julia to supported Language union list. |
| src/extraction/tree-sitter.ts | Adds getName + resolveBody hooks usage and a Julia-specific const extraction branch. |
| src/extraction/tree-sitter-types.ts | Extends LanguageExtractor with optional getName hook. |
| src/extraction/languages/julia.ts | New Julia extractor implementing name/signature/body handling and custom visitation. |
| src/extraction/languages/index.ts | Registers the new Julia extractor. |
| src/extraction/grammars.ts | Adds Julia wasm grammar mapping, .jl extension detection, and display name. |
| src/bin/codegraph.ts | Narrows the Node safety guard to Node 25 only. |
| package.json | Updates Node engine range to exclude 25 but allow 26+. |
| tests/mcp-roots.test.ts | Updates MCP server spawn flags/env and adds helper for deterministic child teardown. |
| tests/mcp-initialize.test.ts | Same MCP spawn/env changes and teardown helper as above. |
| tests/extraction.test.ts | Adds Julia extraction test coverage. |
| .github/workflows/CI.yml | Adds CI workflow running tests on Node 24/26 on macOS/Ubuntu. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CODEGRAPH_NO_RELAUNCH: '1', | ||
| }, | ||
| stdio: ['pipe', 'pipe', 'pipe'], | ||
| env: { ...process.env, CODEGRAPH_NO_RELAUNCH: '1' }, |
| CODEGRAPH_NO_RELAUNCH: '1', | ||
| }, | ||
| stdio: ['pipe', 'pipe', 'pipe'], | ||
| env: { ...process.env, CODEGRAPH_NO_RELAUNCH: '1' }, |
| function spawnServer(cwd: string): ChildProcessWithoutNullStreams { | ||
| // --no-watch keeps the test deterministic and avoids watcher startup noise. | ||
| return spawn(process.execPath, [BIN, 'serve', '--mcp', '--no-watch'], { | ||
| return spawn(process.execPath, ['--liftoff-only', BIN, 'serve', '--mcp', '--no-watch'], { |
|
|
||
| function spawnServer(cwd: string): ChildProcessWithoutNullStreams { | ||
| return spawn(process.execPath, [BIN, 'serve', '--mcp'], { | ||
| return spawn(process.execPath, ['--liftoff-only', BIN, 'serve', '--mcp'], { |
| async function stopChild(child: ChildProcessWithoutNullStreams | null): Promise<void> { | ||
| if (!child) return; | ||
| const pid = child.pid; | ||
| if (pid === undefined) return; | ||
|
|
||
| if (process.platform === 'win32') { | ||
| // On Windows, ChildProcess.kill('SIGKILL') is not a real SIGKILL and may | ||
| // leave descendants alive. Kill the full process tree deterministically. | ||
| try { spawnSync('taskkill', ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore' }); } catch { /* ignore */ } | ||
| } else if (!child.killed) { | ||
| try { child.kill('SIGKILL'); } catch { /* ignore */ } | ||
| } | ||
|
|
||
| await new Promise<void>((resolve) => { | ||
| if (child.exitCode !== null) return resolve(); | ||
| const timer = setTimeout(resolve, 2000); | ||
| child.once('exit', () => { | ||
| clearTimeout(timer); | ||
| resolve(); | ||
| }); | ||
| }); | ||
| } |
| if (!child.killed) child.kill('SIGKILL'); | ||
| if (child.exitCode === null) { | ||
| await new Promise<void>(resolve => child!.once('close', resolve)); | ||
| } |
| async function stopChild(child: ChildProcessWithoutNullStreams | null): Promise<void> { | ||
| if (!child) return; | ||
| const pid = child.pid; | ||
| if (pid === undefined) return; | ||
|
|
||
| if (process.platform === 'win32') { | ||
| // On Windows, ChildProcess.kill('SIGKILL') is not a real SIGKILL and may | ||
| // leave descendants alive. Kill the full process tree deterministically. | ||
| try { spawnSync('taskkill', ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore' }); } catch { /* ignore */ } | ||
| } else if (!child.killed) { | ||
| try { child.kill('SIGKILL'); } catch { /* ignore */ } | ||
| } | ||
|
|
||
| await new Promise<void>((resolve) => { | ||
| if (child.exitCode !== null) return resolve(); | ||
| const timer = setTimeout(resolve, 2000); | ||
| child.once('exit', () => { | ||
| clearTimeout(timer); | ||
| resolve(); | ||
| }); | ||
| }); | ||
| } |
| if (child) { | ||
| if (!child.killed) child.kill('SIGKILL'); | ||
| if (child.exitCode === null) { | ||
| await new Promise<void>(resolve => child!.once('close', resolve)); | ||
| } | ||
| child = null; | ||
| } |
| include: ['__tests__/**/*.test.ts'], | ||
| poolOptions: { | ||
| forks: { | ||
| execArgv: NEEDS_LIFTOFF_ONLY ? ['--liftoff-only'] : [], |
| } else if (this.language === 'julia') { | ||
| // Julia: const_statement → assignment → identifier (name) [op] value | ||
| const assignment = node.namedChild(0); | ||
| if (assignment) { | ||
| const nameNode = assignment.namedChild(0); | ||
| if (nameNode?.type === 'identifier') { | ||
| const name = getNodeText(nameNode, this.source); | ||
| const valueNode = assignment.namedChildCount > 1 | ||
| ? assignment.namedChild(assignment.namedChildCount - 1) | ||
| : null; | ||
| const initValue = valueNode && valueNode !== nameNode | ||
| ? getNodeText(valueNode, this.source).slice(0, 100) | ||
| : undefined; | ||
| const initSignature = initValue ? `= ${initValue}` : undefined; | ||
| this.createNode('constant', name, nameNode, { docstring, signature: initSignature, isExported }); | ||
| } | ||
| } |
预过滤器(src/extraction/index.ts:1354),用于在读取/哈希文件之前跳过未改变的文件。在网络驱动器(SMB/CIFS,比如你的 Z: 盘)上,Windows SMB客户端可能缓存文件的旧 mtime,导致预过滤器错误地跳过了已修改的文件,最终报告"Already up to date"。
Julia (and any language without a literal 'body' field, relying on resolveBody) was short-circuited out of extractStruct before resolveBody ever ran, so struct fields extracted empty. Restore the original main behavior of trying resolveBody first, matching every other body-resolution call site in this file. Also relax package.json engines to >=20.0.0 (drop the <25.0.0 upper bound) since this build runs on Node 25.
Closes the gaps from add-lang/SKILL.md left after the initial rebase of colbymchenry#373: README Supported Languages entry, CHANGELOG [Unreleased] bullet, and a Julia corpus.json block (UnicodePlots.jl/Distributions.jl/ Oceananigans.jl) for future /agent-eval benchmarking. Grammar ABI health-checked (ABI 15, 20/20 clean) and re-verified via verify-extraction.mjs (456 files, 1359 symbols, 5529 edges on a real DrWatson-style Julia monorepo). Paid A/B benchmark intentionally skipped.
|
Thanks for adding Julia, @kongdd! Alongside the language, this turns off SQLite locking and safe writes on anything it treats as a network drive, including every macOS |
This pull request introduces comprehensive support for the Julia programming language to the code extraction and analysis pipeline, including grammar integration, language detection, and extensive test coverage. Additionally, it improves Node.js compatibility for test environments and enhances test reliability on Windows by refining child process management. The most significant changes are grouped below.
Julia Language Support:
tree-sitter-julia.wasm) to the extraction pipeline and updated the grammar loader to handle Julia as a special case, similar to other vendored grammars. (src/extraction/grammars.ts: [1] [2].jlas a recognized Julia file extension and included Julia in language display names and the supported languages list. (src/extraction/grammars.ts: [1] [2];src/types.ts: [3]src/extraction/languages/index.ts: [1] [2]src/extraction/tree-sitter-types.ts: [1];src/extraction/tree-sitter.ts: [2] [3] [4]__tests__/extraction.test.ts: tests/extraction.test.tsR3903-R4060)Node.js and CI Compatibility:
package.json: package.jsonL54-R54).github/workflows/CI.yml: .github/workflows/CI.ymlR1-R33)Test Suite Robustness and Windows Support:
stopChildfunction to ensure deterministic cleanup, especially on Windows, and refactoredafterEachhooks to use this logic. (__tests__/mcp-initialize.test.ts: [1] [2] [3] [4];__tests__/mcp-roots.test.ts: [5] [6] [7] [8]These changes collectively enable Julia language analysis, ensure compatibility with the latest Node.js versions, and make the test suite more reliable across platforms.