@optave/codegraph 2.2.3-dev.44e8146 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -373,7 +373,7 @@ Codegraph also extracts symbols from common callback patterns: Commander `.comma
373
373
 
374
374
  ## 📊 Performance
375
375
 
376
- Self-measured on every release via CI ([full history](generated/BENCHMARKS.md)):
376
+ Self-measured on every release via CI ([build benchmarks](generated/BUILD-BENCHMARKS.md) | [embedding benchmarks](generated/EMBEDDING-BENCHMARKS.md)):
377
377
 
378
378
  | Metric | Latest |
379
379
  |---|---|
@@ -384,6 +384,20 @@ Self-measured on every release via CI ([full history](generated/BENCHMARKS.md)):
384
384
 
385
385
  Metrics are normalized per file for cross-version comparability. Times above are for a full initial build — incremental rebuilds only re-parse changed files.
386
386
 
387
+ ### Lightweight Footprint
388
+
389
+ <a href="https://www.npmjs.com/package/@optave/codegraph"><img src="https://img.shields.io/npm/unpacked-size/@optave/codegraph?style=flat-square&label=unpacked%20size" alt="npm unpacked size" /></a>
390
+
391
+ Only **3 runtime dependencies** — everything else is optional or a devDependency:
392
+
393
+ | Dependency | What it does | | |
394
+ |---|---|---|---|
395
+ | [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) | Fast, synchronous SQLite driver | ![GitHub stars](https://img.shields.io/github/stars/WiseLibs/better-sqlite3?style=flat-square&label=%E2%AD%90) | ![npm downloads](https://img.shields.io/npm/dw/better-sqlite3?style=flat-square&label=%F0%9F%93%A5%2Fwk) |
396
+ | [commander](https://github.com/tj/commander.js) | CLI argument parsing | ![GitHub stars](https://img.shields.io/github/stars/tj/commander.js?style=flat-square&label=%E2%AD%90) | ![npm downloads](https://img.shields.io/npm/dw/commander?style=flat-square&label=%F0%9F%93%A5%2Fwk) |
397
+ | [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) | WASM tree-sitter bindings | ![GitHub stars](https://img.shields.io/github/stars/tree-sitter/tree-sitter?style=flat-square&label=%E2%AD%90) | ![npm downloads](https://img.shields.io/npm/dw/web-tree-sitter?style=flat-square&label=%F0%9F%93%A5%2Fwk) |
398
+
399
+ Optional: `@huggingface/transformers` (semantic search), `@modelcontextprotocol/sdk` (MCP server) — lazy-loaded only when needed.
400
+
387
401
  ## 🤖 AI Agent Integration
388
402
 
389
403
  ### MCP Server
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@optave/codegraph",
3
- "version": "2.2.3-dev.44e8146",
3
+ "version": "2.3.0",
4
4
  "description": "Local code graph CLI — parse codebases with tree-sitter, build dependency graphs, query them",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": "./src/index.js"
10
- }
10
+ },
11
+ "./package.json": "./package.json"
11
12
  },
12
13
  "bin": {
13
14
  "codegraph": "./src/cli.js"
@@ -61,10 +62,10 @@
61
62
  "optionalDependencies": {
62
63
  "@huggingface/transformers": "^3.8.1",
63
64
  "@modelcontextprotocol/sdk": "^1.0.0",
64
- "@optave/codegraph-darwin-arm64": "2.2.3-dev.44e8146",
65
- "@optave/codegraph-darwin-x64": "2.2.3-dev.44e8146",
66
- "@optave/codegraph-linux-x64-gnu": "2.2.3-dev.44e8146",
67
- "@optave/codegraph-win32-x64-msvc": "2.2.3-dev.44e8146"
65
+ "@optave/codegraph-darwin-arm64": "2.3.0",
66
+ "@optave/codegraph-darwin-x64": "2.3.0",
67
+ "@optave/codegraph-linux-x64-gnu": "2.3.0",
68
+ "@optave/codegraph-win32-x64-msvc": "2.3.0"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@biomejs/biome": "^2.4.4",
package/src/cli.js CHANGED
@@ -2,12 +2,11 @@
2
2
 
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
- import Database from 'better-sqlite3';
6
5
  import { Command } from 'commander';
7
6
  import { buildGraph } from './builder.js';
8
7
  import { loadConfig } from './config.js';
9
8
  import { findCycles, formatCycles } from './cycles.js';
10
- import { findDbPath } from './db.js';
9
+ import { openReadonlyOrFail } from './db.js';
11
10
  import { buildEmbeddings, EMBEDDING_STRATEGIES, MODELS, search } from './embedder.js';
12
11
  import { exportDOT, exportJSON, exportMermaid } from './export.js';
13
12
  import { setVerbose } from './logger.js';
@@ -275,7 +274,7 @@ program
275
274
  .option('--min-confidence <score>', 'Minimum edge confidence threshold (default: 0.5)', '0.5')
276
275
  .option('-o, --output <file>', 'Write to file instead of stdout')
277
276
  .action((opts) => {
278
- const db = new Database(findDbPath(opts.db), { readonly: true });
277
+ const db = openReadonlyOrFail(opts.db);
279
278
  const exportOpts = {
280
279
  fileLevel: !opts.functions,
281
280
  noTests: resolveNoTests(opts),
@@ -314,7 +313,7 @@ program
314
313
  .option('--include-tests', 'Include test/spec files (overrides excludeTests config)')
315
314
  .option('-j, --json', 'Output as JSON')
316
315
  .action((opts) => {
317
- const db = new Database(findDbPath(opts.db), { readonly: true });
316
+ const db = openReadonlyOrFail(opts.db);
318
317
  const cycles = findCycles(db, { fileLevel: !opts.functions, noTests: resolveNoTests(opts) });
319
318
  db.close();
320
319
 
package/src/embedder.js CHANGED
@@ -324,6 +324,14 @@ export async function buildEmbeddings(rootDir, modelKey, customDbPath, options =
324
324
  const strategy = options.strategy || 'structured';
325
325
  const dbPath = customDbPath || findDbPath(null);
326
326
 
327
+ if (!fs.existsSync(dbPath)) {
328
+ console.error(
329
+ `No codegraph database found at ${dbPath}.\n` +
330
+ `Run "codegraph build" first to analyze your codebase.`,
331
+ );
332
+ process.exit(1);
333
+ }
334
+
327
335
  const db = new Database(dbPath);
328
336
  initEmbeddingsSchema(db);
329
337