neuronlayer 0.2.6 → 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,11 +39259,19 @@ function configureMCPClient(clientName, configPath, serverName, projectPath) {
39248
39259
  config2.mcpServers = {};
39249
39260
  }
39250
39261
  const isWindows = process.platform === "win32";
39251
- const binName = isWindows ? "neuronlayer.cmd" : "neuronlayer";
39252
- config2.mcpServers[serverName] = {
39253
- command: binName,
39254
- args: ["--project", projectPath]
39255
- };
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
+ }
39256
39275
  try {
39257
39276
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39258
39277
  return { success: true, message: `${clientName}: ${configPath}` };
@@ -39275,11 +39294,19 @@ function configureProjectMCP(configPath, projectPath) {
39275
39294
  delete config2.mcpServers["memorylayer"];
39276
39295
  const absoluteProjectPath = resolve3(projectPath);
39277
39296
  const isWindows = process.platform === "win32";
39278
- const binName = isWindows ? "neuronlayer.cmd" : "neuronlayer";
39279
- config2.mcpServers["neuronlayer"] = {
39280
- command: binName,
39281
- args: ["--project", absoluteProjectPath]
39282
- };
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
+ }
39283
39310
  try {
39284
39311
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39285
39312
  return { success: true, message: `Claude Code / OpenCode: ${configPath} (project-local)` };
@@ -39303,12 +39330,21 @@ function configureOpenCode(projectPath) {
39303
39330
  delete config2.mcp["memorylayer"];
39304
39331
  const absoluteProjectPath = resolve3(projectPath);
39305
39332
  const isWindows = process.platform === "win32";
39306
- const binName = isWindows ? "neuronlayer.cmd" : "neuronlayer";
39307
- config2.mcp["neuronlayer"] = {
39308
- type: "local",
39309
- command: [binName, "--project", absoluteProjectPath],
39310
- enabled: true
39311
- };
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
+ }
39312
39348
  try {
39313
39349
  writeFileSync6(configPath, JSON.stringify(config2, null, 2));
39314
39350
  return { success: true, message: `OpenCode: ${configPath}` };