neuronlayer 0.2.10 → 0.2.11

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
@@ -5,7 +5,9 @@
5
5
  NeuronLayer is an MCP server that indexes your codebase and gives AI assistants like Claude the ability to understand your project's structure, dependencies, and history across sessions.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
8
- [![npm downloads](https://img.shields.io/npm/dw/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
8
+ [![total downloads](https://img.shields.io/npm/dt/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
9
+ [![weekly downloads](https://img.shields.io/npm/dw/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
10
+ [![daily downloads](https://img.shields.io/npm/dd/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
9
11
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
10
12
  [![Node.js](https://img.shields.io/badge/Node.js-18+-339933.svg)](https://nodejs.org/)
11
13
  [![MCP](https://img.shields.io/badge/MCP-Compatible-blue.svg)](https://modelcontextprotocol.io/)
package/dist/index.js CHANGED
@@ -21198,11 +21198,29 @@ var Tier1Storage = class {
21198
21198
  };
21199
21199
 
21200
21200
  // src/storage/tier2.ts
21201
+ var EXCLUDED_PATH_PATTERNS = [
21202
+ "node_modules",
21203
+ ".git",
21204
+ "dist/",
21205
+ "build/",
21206
+ ".next/",
21207
+ "coverage/",
21208
+ "__pycache__",
21209
+ ".pytest_cache",
21210
+ "vendor/",
21211
+ ".venv/",
21212
+ "venv/"
21213
+ ];
21201
21214
  var Tier2Storage = class {
21202
21215
  db;
21203
21216
  constructor(db) {
21204
21217
  this.db = db;
21205
21218
  }
21219
+ // Check if a path should be excluded from results
21220
+ shouldExcludePath(path) {
21221
+ const normalizedPath = path.replace(/\\/g, "/");
21222
+ return EXCLUDED_PATH_PATTERNS.some((pattern) => normalizedPath.includes(pattern));
21223
+ }
21206
21224
  // File operations
21207
21225
  upsertFile(path, contentHash, preview, language, sizeBytes, lineCount, lastModified) {
21208
21226
  const stmt = this.db.prepare(`
@@ -21245,22 +21263,47 @@ var Tier2Storage = class {
21245
21263
  const stmt = this.db.prepare(`
21246
21264
  SELECT id, path, content_hash as contentHash, preview, language,
21247
21265
  size_bytes as sizeBytes, last_modified as lastModified, indexed_at as indexedAt
21248
- FROM files ORDER BY path
21266
+ FROM files
21267
+ WHERE path NOT LIKE '%node_modules%'
21268
+ AND path NOT LIKE '%.git%'
21269
+ AND path NOT LIKE '%/dist/%'
21270
+ AND path NOT LIKE '%/build/%'
21271
+ ORDER BY path
21249
21272
  `);
21250
21273
  return stmt.all();
21251
21274
  }
21252
21275
  getFileCount() {
21253
- const stmt = this.db.prepare("SELECT COUNT(*) as count FROM files");
21276
+ const stmt = this.db.prepare(`
21277
+ SELECT COUNT(*) as count FROM files
21278
+ WHERE path NOT LIKE '%node_modules%'
21279
+ AND path NOT LIKE '%.git%'
21280
+ AND path NOT LIKE '%/dist/%'
21281
+ AND path NOT LIKE '%/build/%'
21282
+ `);
21254
21283
  const result = stmt.get();
21255
21284
  return result.count;
21256
21285
  }
21257
21286
  getTotalLines() {
21258
- const stmt = this.db.prepare("SELECT COALESCE(SUM(line_count), 0) as total FROM files");
21287
+ const stmt = this.db.prepare(`
21288
+ SELECT COALESCE(SUM(line_count), 0) as total FROM files
21289
+ WHERE path NOT LIKE '%node_modules%'
21290
+ AND path NOT LIKE '%.git%'
21291
+ AND path NOT LIKE '%/dist/%'
21292
+ AND path NOT LIKE '%/build/%'
21293
+ `);
21259
21294
  const result = stmt.get();
21260
21295
  return result.total;
21261
21296
  }
21262
21297
  getLanguages() {
21263
- const stmt = this.db.prepare("SELECT DISTINCT language FROM files WHERE language IS NOT NULL ORDER BY language");
21298
+ const stmt = this.db.prepare(`
21299
+ SELECT DISTINCT language FROM files
21300
+ WHERE language IS NOT NULL
21301
+ AND path NOT LIKE '%node_modules%'
21302
+ AND path NOT LIKE '%.git%'
21303
+ AND path NOT LIKE '%/dist/%'
21304
+ AND path NOT LIKE '%/build/%'
21305
+ ORDER BY language
21306
+ `);
21264
21307
  const results = stmt.all();
21265
21308
  return results.map((r) => r.language);
21266
21309
  }
@@ -21299,11 +21342,11 @@ var Tier2Storage = class {
21299
21342
  results.push({ fileId, similarity });
21300
21343
  }
21301
21344
  results.sort((a, b) => b.similarity - a.similarity);
21302
- const topResults = results.slice(0, limit);
21303
21345
  const searchResults = [];
21304
- for (const { fileId, similarity } of topResults) {
21346
+ for (const { fileId, similarity } of results) {
21347
+ if (searchResults.length >= limit) break;
21305
21348
  const file2 = this.getFileById(fileId);
21306
- if (file2) {
21349
+ if (file2 && !this.shouldExcludePath(file2.path)) {
21307
21350
  searchResults.push({
21308
21351
  file: file2.path,
21309
21352
  preview: file2.preview,
@@ -21571,6 +21614,10 @@ var Tier2Storage = class {
21571
21614
  FROM symbols s
21572
21615
  JOIN files f ON s.file_id = f.id
21573
21616
  WHERE s.name LIKE ?
21617
+ AND f.path NOT LIKE '%node_modules%'
21618
+ AND f.path NOT LIKE '%.git%'
21619
+ AND f.path NOT LIKE '%/dist/%'
21620
+ AND f.path NOT LIKE '%/build/%'
21574
21621
  `;
21575
21622
  const params = [`%${name}%`];
21576
21623
  if (kind) {
@@ -21601,6 +21648,10 @@ var Tier2Storage = class {
21601
21648
  FROM symbols s
21602
21649
  JOIN files f ON s.file_id = f.id
21603
21650
  WHERE s.name = ?
21651
+ AND f.path NOT LIKE '%node_modules%'
21652
+ AND f.path NOT LIKE '%.git%'
21653
+ AND f.path NOT LIKE '%/dist/%'
21654
+ AND f.path NOT LIKE '%/build/%'
21604
21655
  `;
21605
21656
  const params = [name];
21606
21657
  if (kind) {
@@ -21625,7 +21676,14 @@ var Tier2Storage = class {
21625
21676
  };
21626
21677
  }
21627
21678
  getSymbolCount() {
21628
- const stmt = this.db.prepare("SELECT COUNT(*) as count FROM symbols");
21679
+ const stmt = this.db.prepare(`
21680
+ SELECT COUNT(*) as count FROM symbols s
21681
+ JOIN files f ON s.file_id = f.id
21682
+ WHERE f.path NOT LIKE '%node_modules%'
21683
+ AND f.path NOT LIKE '%.git%'
21684
+ AND f.path NOT LIKE '%/dist/%'
21685
+ AND f.path NOT LIKE '%/build/%'
21686
+ `);
21629
21687
  const result = stmt.get();
21630
21688
  return result.count;
21631
21689
  }