neuronlayer 0.2.5 → 0.2.7

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
@@ -48,9 +48,9 @@ This registers your project and configures Claude Desktop, Claude Code, OpenCode
48
48
  | Tool | Setup |
49
49
  |------|-------|
50
50
  | Claude Desktop | `neuronlayer init` (auto) |
51
- | Claude Code (CLI) | `neuronlayer init` (auto) |
51
+ | Claude Code (CLI) | [`neuronlayer init` (auto)](./documentation/CLAUDE-CODE-SETUP.md) |
52
52
  | Cursor | `neuronlayer init` (auto) |
53
- | OpenCode | `neuronlayer init` (auto) |
53
+ | OpenCode | [`neuronlayer init` (auto)](./documentation/OPENCODE-SETUP.md) |
54
54
  | Any MCP Client | Manual config |
55
55
  | **Any tool (HTTP)** | `neuronlayer serve` |
56
56
 
package/dist/index.js CHANGED
@@ -30198,13 +30198,14 @@ var DuplicateDetector = class {
30198
30198
  tier2;
30199
30199
  embeddingGenerator;
30200
30200
  functionIndex = /* @__PURE__ */ new Map();
30201
+ indexBuilt = false;
30201
30202
  constructor(tier2, embeddingGenerator) {
30202
30203
  this.tier2 = tier2;
30203
30204
  this.embeddingGenerator = embeddingGenerator;
30204
- this.buildFunctionIndex();
30205
30205
  }
30206
30206
  // Build index of all functions in codebase
30207
30207
  buildFunctionIndex() {
30208
+ if (this.indexBuilt) return;
30208
30209
  const files = this.tier2.getAllFiles();
30209
30210
  for (const file2 of files) {
30210
30211
  const symbols = this.tier2.getSymbolsByFile(file2.id);
@@ -30226,9 +30227,17 @@ var DuplicateDetector = class {
30226
30227
  }
30227
30228
  }
30228
30229
  }
30230
+ this.indexBuilt = true;
30231
+ }
30232
+ // Ensure index is ready before searching
30233
+ ensureIndex() {
30234
+ if (!this.indexBuilt) {
30235
+ this.buildFunctionIndex();
30236
+ }
30229
30237
  }
30230
30238
  // Find duplicate or similar functions
30231
30239
  findDuplicates(code, threshold = 60) {
30240
+ this.ensureIndex();
30232
30241
  const duplicates = [];
30233
30242
  const funcNameMatch = code.match(/(?:function|const|let|var)\s+(\w+)/);
30234
30243
  const funcName = funcNameMatch ? funcNameMatch[1] : null;
@@ -30257,6 +30266,7 @@ var DuplicateDetector = class {
30257
30266
  }
30258
30267
  // Suggest existing functions based on intent
30259
30268
  suggestExisting(intent, limit = 5) {
30269
+ this.ensureIndex();
30260
30270
  const suggestions = [];
30261
30271
  const intentLower = intent.toLowerCase();
30262
30272
  const intentWords = intentLower.split(/\s+/);
@@ -30365,10 +30375,11 @@ var DuplicateDetector = class {
30365
30375
  // Refresh the function index
30366
30376
  refresh() {
30367
30377
  this.functionIndex.clear();
30368
- this.buildFunctionIndex();
30378
+ this.indexBuilt = false;
30369
30379
  }
30370
30380
  // Get index statistics
30371
30381
  getStats() {
30382
+ this.ensureIndex();
30372
30383
  let exportedFunctions = 0;
30373
30384
  const byPurpose = {};
30374
30385
  for (const [_key, func] of this.functionIndex) {
@@ -39248,7 +39259,19 @@ function configureMCPClient(clientName, configPath, serverName, projectPath) {
39248
39259
  config2.mcpServers = {};
39249
39260
  }
39250
39261
  const isWindows = process.platform === "win32";
39251
- config2.mcpServers[serverName] = isWindows ? { command: "cmd", args: ["/c", "npx", "-y", "neuronlayer", "--project", projectPath] } : { command: "npx", args: ["-y", "neuronlayer", "--project", projectPath] };
39262
+ const __dirname = new URL(".", import.meta.url).pathname;
39263
+ const resolvedPath = resolve3(isWindows ? __dirname.substring(1) : __dirname, "index.js");
39264
+ if (isWindows) {
39265
+ config2.mcpServers[serverName] = {
39266
+ command: "cmd",
39267
+ args: ["/c", "node", resolvedPath, "--project", projectPath]
39268
+ };
39269
+ } else {
39270
+ config2.mcpServers[serverName] = {
39271
+ command: "node",
39272
+ args: [resolvedPath, "--project", projectPath]
39273
+ };
39274
+ }
39252
39275
  try {
39253
39276
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39254
39277
  return { success: true, message: `${clientName}: ${configPath}` };
@@ -39271,7 +39294,19 @@ function configureProjectMCP(configPath, projectPath) {
39271
39294
  delete config2.mcpServers["memorylayer"];
39272
39295
  const absoluteProjectPath = resolve3(projectPath);
39273
39296
  const isWindows = process.platform === "win32";
39274
- config2.mcpServers["neuronlayer"] = isWindows ? { command: "cmd", args: ["/c", "npx", "-y", "neuronlayer", "--project", absoluteProjectPath] } : { command: "npx", args: ["-y", "neuronlayer", "--project", absoluteProjectPath] };
39297
+ const __dirname = new URL(".", import.meta.url).pathname;
39298
+ const resolvedPath = resolve3(isWindows ? __dirname.substring(1) : __dirname, "index.js");
39299
+ if (isWindows) {
39300
+ config2.mcpServers["neuronlayer"] = {
39301
+ command: "cmd",
39302
+ args: ["/c", "node", resolvedPath, "--project", absoluteProjectPath]
39303
+ };
39304
+ } else {
39305
+ config2.mcpServers["neuronlayer"] = {
39306
+ command: "node",
39307
+ args: [resolvedPath, "--project", absoluteProjectPath]
39308
+ };
39309
+ }
39275
39310
  try {
39276
39311
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39277
39312
  return { success: true, message: `Claude Code / OpenCode: ${configPath} (project-local)` };
@@ -39294,11 +39329,22 @@ function configureOpenCode(projectPath) {
39294
39329
  }
39295
39330
  delete config2.mcp["memorylayer"];
39296
39331
  const absoluteProjectPath = resolve3(projectPath);
39297
- config2.mcp["neuronlayer"] = {
39298
- type: "local",
39299
- command: ["npx", "-y", "neuronlayer", "--project", absoluteProjectPath],
39300
- enabled: true
39301
- };
39332
+ const isWindows = process.platform === "win32";
39333
+ const __dirname = new URL(".", import.meta.url).pathname;
39334
+ const resolvedPath = resolve3(isWindows ? __dirname.substring(1) : __dirname, "index.js");
39335
+ if (isWindows) {
39336
+ config2.mcp["neuronlayer"] = {
39337
+ type: "local",
39338
+ command: ["cmd", "/c", "node", resolvedPath, "--project", absoluteProjectPath],
39339
+ enabled: true
39340
+ };
39341
+ } else {
39342
+ config2.mcp["neuronlayer"] = {
39343
+ type: "local",
39344
+ command: ["node", resolvedPath, "--project", absoluteProjectPath],
39345
+ enabled: true
39346
+ };
39347
+ }
39302
39348
  try {
39303
39349
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39304
39350
  return { success: true, message: `OpenCode: ${configPath}` };
@@ -39585,6 +39631,10 @@ async function main() {
39585
39631
  console.error("NeuronLayer starting...");
39586
39632
  console.error(`Project: ${config2.projectPath}`);
39587
39633
  console.error(`Data directory: ${config2.dataDir}`);
39634
+ const originalConsoleLog = console.log;
39635
+ console.log = function() {
39636
+ console.error.apply(console, arguments);
39637
+ };
39588
39638
  const server = new MCPServer(config2);
39589
39639
  try {
39590
39640
  await server.start();