neuronlayer 0.1.0 → 0.1.2

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.

Potentially problematic release.


This version of neuronlayer might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neuronlayer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Persistent memory layer for AI coding assistants - MCP server that makes AI truly understand your codebase",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,26 +36,26 @@
36
36
  "license": "MIT",
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "git+https://github.com/abhisavakar/memorylayer.git"
39
+ "url": "git+https://github.com/abhisavakar/neuronlayer.git"
40
40
  },
41
41
  "bugs": {
42
- "url": "https://github.com/abhisavakar/memorylayer/issues"
42
+ "url": "https://github.com/abhisavakar/neuronlayer/issues"
43
43
  },
44
- "homepage": "https://github.com/abhisavakar/memorylayer#readme",
44
+ "homepage": "https://github.com/abhisavakar/neuronlayer#readme",
45
45
  "dependencies": {
46
- "@modelcontextprotocol/sdk": "^1.0.0",
46
+ "@modelcontextprotocol/sdk": "^1.27.0",
47
47
  "@xenova/transformers": "^2.17.0",
48
- "better-sqlite3": "^11.0.0",
49
- "chokidar": "^3.6.0",
50
- "glob": "^10.0.0",
51
- "web-tree-sitter": "^0.22.0"
48
+ "better-sqlite3": "^11.8.0",
49
+ "chokidar": "^4.0.0",
50
+ "glob": "^13.0.0",
51
+ "web-tree-sitter": "^0.24.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/better-sqlite3": "^7.6.0",
55
- "@types/node": "^20.0.0",
56
- "esbuild": "^0.20.0",
57
- "typescript": "^5.4.0",
58
- "vitest": "^1.3.0"
55
+ "@types/node": "^22.0.0",
56
+ "esbuild": "^0.25.0",
57
+ "typescript": "^5.7.0",
58
+ "vitest": "^3.0.0"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=18.0.0"
@@ -3,7 +3,8 @@ import { ADRExporter } from '../core/adr-exporter.js';
3
3
  import { initializeDatabase } from '../storage/database.js';
4
4
  import { Tier2Storage } from '../storage/tier2.js';
5
5
  import { join } from 'path';
6
- import { existsSync } from 'fs';
6
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
7
+ import { homedir } from 'os';
7
8
 
8
9
  const projectManager = new ProjectManager();
9
10
 
@@ -231,6 +232,122 @@ export function showProject(projectId?: string): CommandResult {
231
232
  };
232
233
  }
233
234
 
235
+ // Helper to configure an MCP client
236
+ function configureMCPClient(
237
+ clientName: string,
238
+ configPath: string,
239
+ serverName: string,
240
+ projectPath: string
241
+ ): { success: boolean; message: string } {
242
+ let config: { mcpServers?: Record<string, unknown> } = { mcpServers: {} };
243
+
244
+ try {
245
+ if (existsSync(configPath)) {
246
+ const content = readFileSync(configPath, 'utf-8');
247
+ config = JSON.parse(content);
248
+ } else {
249
+ // Create directory if needed
250
+ const sep = process.platform === 'win32' ? '\\' : '/';
251
+ const configDir = configPath.substring(0, configPath.lastIndexOf(sep));
252
+ mkdirSync(configDir, { recursive: true });
253
+ }
254
+ } catch {
255
+ // Config doesn't exist or is invalid, start fresh
256
+ }
257
+
258
+ if (!config.mcpServers) {
259
+ config.mcpServers = {};
260
+ }
261
+
262
+ config.mcpServers[serverName] = {
263
+ command: 'npx',
264
+ args: ['-y', 'neuronlayer', '--project', projectPath]
265
+ };
266
+
267
+ try {
268
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
269
+ return { success: true, message: `${clientName}: ${configPath}` };
270
+ } catch (err) {
271
+ return { success: false, message: `${clientName}: Failed - ${err instanceof Error ? err.message : String(err)}` };
272
+ }
273
+ }
274
+
275
+ // Initialize neuronlayer for current project + auto-configure Claude Desktop & OpenCode
276
+ export function initProject(projectPath?: string): CommandResult {
277
+ const targetPath = projectPath || process.cwd();
278
+
279
+ // 1. Register the project
280
+ const addResult = addProject(targetPath);
281
+ if (!addResult.success) {
282
+ return addResult;
283
+ }
284
+
285
+ const projectInfo = addResult.data as ProjectInfo;
286
+ const serverName = `neuronlayer-${projectInfo.name.toLowerCase().replace(/[^a-z0-9]/g, '-')}`;
287
+ const platform = process.platform;
288
+
289
+ const configuredClients: string[] = [];
290
+ const failedClients: string[] = [];
291
+
292
+ // 2. Configure Claude Desktop
293
+ let claudeConfigPath: string;
294
+ if (platform === 'win32') {
295
+ claudeConfigPath = join(homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
296
+ } else if (platform === 'darwin') {
297
+ claudeConfigPath = join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
298
+ } else {
299
+ claudeConfigPath = join(homedir(), '.config', 'claude', 'claude_desktop_config.json');
300
+ }
301
+
302
+ const claudeResult = configureMCPClient('Claude Desktop', claudeConfigPath, serverName, targetPath);
303
+ if (claudeResult.success) {
304
+ configuredClients.push(claudeResult.message);
305
+ } else {
306
+ failedClients.push(claudeResult.message);
307
+ }
308
+
309
+ // 3. Configure OpenCode
310
+ const openCodeConfigPath = join(homedir(), '.opencode', 'config.json');
311
+ const openCodeResult = configureMCPClient('OpenCode', openCodeConfigPath, serverName, targetPath);
312
+ if (openCodeResult.success) {
313
+ configuredClients.push(openCodeResult.message);
314
+ } else {
315
+ failedClients.push(openCodeResult.message);
316
+ }
317
+
318
+ // 4. Configure Claude Code (CLI) - uses same config location as Claude Desktop on some systems
319
+ // Also check for .claude.json in home directory
320
+ const claudeCodeConfigPath = join(homedir(), '.claude.json');
321
+ const claudeCodeResult = configureMCPClient('Claude Code', claudeCodeConfigPath, serverName, targetPath);
322
+ if (claudeCodeResult.success) {
323
+ configuredClients.push(claudeCodeResult.message);
324
+ }
325
+
326
+ // Build result message
327
+ let message = `
328
+ NeuronLayer initialized!
329
+
330
+ Project: ${projectInfo.name}
331
+ Path: ${targetPath}
332
+ Data: ${projectInfo.dataDir}
333
+
334
+ Configured MCP Clients:
335
+ ${configuredClients.map(c => ' ✓ ' + c).join('\n')}
336
+ `;
337
+
338
+ if (failedClients.length > 0) {
339
+ message += `\nFailed:\n${failedClients.map(c => ' ✗ ' + c).join('\n')}`;
340
+ }
341
+
342
+ message += `\n\nRestart your AI tools to activate.`;
343
+
344
+ return {
345
+ success: true,
346
+ message: message.trim(),
347
+ data: { projectInfo, serverName, configuredClients }
348
+ };
349
+ }
350
+
234
351
  // Print help
235
352
  export function printHelp(): void {
236
353
  console.log(`
@@ -240,6 +357,7 @@ USAGE:
240
357
  memorylayer [command] [options]
241
358
 
242
359
  COMMANDS:
360
+ init [path] Initialize project + auto-configure Claude Desktop
243
361
  (no command) Start MCP server for Claude Desktop
244
362
  projects list List all registered projects
245
363
  projects add <path> Add a project to the registry
@@ -256,8 +374,12 @@ OPTIONS:
256
374
  --format <type> ADR format: madr, nygard, simple
257
375
 
258
376
  EXAMPLES:
377
+ # Quick setup (auto-configures Claude Desktop)
378
+ cd /path/to/project
379
+ neuronlayer init
380
+
259
381
  # Start MCP server
260
- memorylayer --project /path/to/project
382
+ neuronlayer --project /path/to/project
261
383
 
262
384
  # List all projects
263
385
  memorylayer projects list
@@ -274,7 +396,7 @@ EXAMPLES:
274
396
  # Discover projects
275
397
  memorylayer projects discover
276
398
 
277
- For more information, visit: https://github.com/your-org/memorylayer
399
+ For more information, visit: https://github.com/abhisavakar/neuronlayer
278
400
  `);
279
401
  }
280
402
 
@@ -290,6 +412,14 @@ export function executeCLI(args: string[]): void {
290
412
  printHelp();
291
413
  break;
292
414
 
415
+ case 'init': {
416
+ const path = args[1];
417
+ const result = initProject(path);
418
+ console.log(result.message);
419
+ if (!result.success) process.exit(1);
420
+ break;
421
+ }
422
+
293
423
  case 'projects': {
294
424
  switch (subcommand) {
295
425
  case 'list':
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ async function main(): Promise<void> {
7
7
 
8
8
  // Check for CLI commands first
9
9
  const firstArg = args[0];
10
- const cliCommands = ['projects', 'export', 'help', '--help', '-h'];
10
+ const cliCommands = ['init', 'projects', 'export', 'help', '--help', '-h'];
11
11
 
12
12
  if (firstArg && cliCommands.includes(firstArg)) {
13
13
  // Handle CLI commands