c9559d9991
chokidar v4 holds one OS file descriptor per watched file on macOS (libuv's kqueue backend registers an fd per vnode; fsevents is installed but v4 no longer uses it). On a large project the `serve --mcp` daemon accumulated tens of thousands of open REG descriptors and exhausted kern.maxfiles — crashing unrelated processes system-wide with ENFILE. #276 only trimmed the count by ignoring directories; the source tree still cost one fd per file. Replace chokidar with a pure-JS native fs.watch hybrid, keeping codegraph's zero-native-addon "any OS builds any bundle" invariant: - macOS / Windows: a single recursive fs.watch (one FSEvents stream / ReadDirectoryChangesW handle) -> O(1) descriptors regardless of repo size. - Linux: one inotify watch per directory (O(dirs), dynamic add for new dirs, capped via CODEGRAPH_MAX_DIR_WATCHES) instead of per-file watches. Validated empirically: macOS 0 extra fds at 6k and 12k files; Linux 31 inotify watches at 6k files (per-file would be 6k); Windows recursive catches nested and new-directory edits. Full test suite green. Tests drive the watcher through an inertForTests seam (no OS watcher) for determinism under parallel vitest, with one real-fs end-to-end test exercising the genuine native path. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
1.9 KiB
JSON
57 lines
1.9 KiB
JSON
{
|
|
"name": "@colbymchenry/codegraph",
|
|
"version": "0.9.9",
|
|
"description": "Supercharge Claude Code with semantic code intelligence. 94% fewer tool calls • 77% faster exploration • 100% local.",
|
|
"main": "dist/index.js",
|
|
"types": "dist/index.d.ts",
|
|
"bin": {
|
|
"codegraph": "./dist/bin/codegraph.js"
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"scripts",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc && npm run copy-assets && node -e \"require('fs').chmodSync('dist/bin/codegraph.js', 0o755)\"",
|
|
"preuninstall": "node dist/bin/uninstall.js",
|
|
"copy-assets": "node -e \"const fs=require('fs');fs.mkdirSync('dist/db',{recursive:true});fs.copyFileSync('src/db/schema.sql','dist/db/schema.sql');fs.mkdirSync('dist/extraction/wasm',{recursive:true});fs.readdirSync('src/extraction/wasm').filter(f=>f.endsWith('.wasm')).forEach(f=>fs.copyFileSync('src/extraction/wasm/'+f,'dist/extraction/wasm/'+f))\"",
|
|
"dev": "tsc --watch",
|
|
"cli": "npm run build && node dist/bin/codegraph.js",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:eval": "vitest run __tests__/evaluation/",
|
|
"eval": "npm run build && npx tsx __tests__/evaluation/runner.ts",
|
|
"clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\""
|
|
},
|
|
"keywords": [
|
|
"code-intelligence",
|
|
"knowledge-graph",
|
|
"static-analysis"
|
|
],
|
|
"author": "",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"@clack/prompts": "^1.3.0",
|
|
"commander": "^14.0.2",
|
|
"fast-string-width": "^3.0.2",
|
|
"fast-wrap-ansi": "^0.2.0",
|
|
"ignore": "^7.0.5",
|
|
"jsonc-parser": "^3.3.1",
|
|
"picomatch": "^4.0.3",
|
|
"sisteransi": "^1.0.5",
|
|
"tree-sitter-wasms": "^0.1.11",
|
|
"web-tree-sitter": "^0.25.3"
|
|
},
|
|
"devDependencies": {
|
|
"@types/better-sqlite3": "^7.6.0",
|
|
"@types/node": "^20.19.30",
|
|
"@types/picomatch": "^4.0.2",
|
|
"typescript": "^5.0.0",
|
|
"vitest": "^2.1.9"
|
|
},
|
|
"engines": {
|
|
"node": ">=20.0.0 <25.0.0"
|
|
}
|
|
}
|