neuronlayer 0.1.0 → 0.1.1

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
@@ -62,7 +62,7 @@ MemoryLayer gives AI assistants persistent, intelligent memory:
62
62
  ### Installation
63
63
 
64
64
  ```bash
65
- npm install -g memory-layer
65
+ npm install -g neuronlayer
66
66
  ```
67
67
 
68
68
  ### Usage with Claude Desktop
@@ -74,7 +74,7 @@ Add to your Claude Desktop config (`claude_desktop_config.json`):
74
74
  "mcpServers": {
75
75
  "memorylayer": {
76
76
  "command": "npx",
77
- "args": ["-y", "memory-layer", "--project", "/path/to/your/project"]
77
+ "args": ["-y", "neuronlayer", "--project", "/path/to/your/project"]
78
78
  }
79
79
  }
80
80
  }
package/dist/index.js CHANGED
@@ -37668,7 +37668,8 @@ function parseArgs(args) {
37668
37668
 
37669
37669
  // src/cli/commands.ts
37670
37670
  import { join as join16 } from "path";
37671
- import { existsSync as existsSync14 } from "fs";
37671
+ import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSync as writeFileSync5, mkdirSync as mkdirSync7 } from "fs";
37672
+ import { homedir as homedir2 } from "os";
37672
37673
  var projectManager = new ProjectManager();
37673
37674
  function listProjects() {
37674
37675
  const projects = projectManager.listProjects();
@@ -37840,6 +37841,67 @@ function showProject(projectId) {
37840
37841
  data: project
37841
37842
  };
37842
37843
  }
37844
+ function initProject(projectPath) {
37845
+ const targetPath = projectPath || process.cwd();
37846
+ const addResult = addProject(targetPath);
37847
+ if (!addResult.success) {
37848
+ return addResult;
37849
+ }
37850
+ const projectInfo = addResult.data;
37851
+ const platform = process.platform;
37852
+ let configPath;
37853
+ if (platform === "win32") {
37854
+ configPath = join16(homedir2(), "AppData", "Roaming", "Claude", "claude_desktop_config.json");
37855
+ } else if (platform === "darwin") {
37856
+ configPath = join16(homedir2(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
37857
+ } else {
37858
+ configPath = join16(homedir2(), ".config", "claude", "claude_desktop_config.json");
37859
+ }
37860
+ let config2 = { mcpServers: {} };
37861
+ try {
37862
+ if (existsSync14(configPath)) {
37863
+ const content = readFileSync11(configPath, "utf-8");
37864
+ config2 = JSON.parse(content);
37865
+ } else {
37866
+ const configDir = configPath.substring(0, configPath.lastIndexOf(platform === "win32" ? "\\" : "/"));
37867
+ mkdirSync7(configDir, { recursive: true });
37868
+ }
37869
+ } catch {
37870
+ }
37871
+ if (!config2.mcpServers) {
37872
+ config2.mcpServers = {};
37873
+ }
37874
+ const serverName = `neuronlayer-${projectInfo.name.toLowerCase().replace(/[^a-z0-9]/g, "-")}`;
37875
+ config2.mcpServers[serverName] = {
37876
+ command: "npx",
37877
+ args: ["-y", "neuronlayer", "--project", targetPath]
37878
+ };
37879
+ try {
37880
+ writeFileSync5(configPath, JSON.stringify(config2, null, 2));
37881
+ } catch (err) {
37882
+ return {
37883
+ success: false,
37884
+ message: `Failed to write Claude Desktop config: ${err instanceof Error ? err.message : String(err)}`
37885
+ };
37886
+ }
37887
+ return {
37888
+ success: true,
37889
+ message: `
37890
+ NeuronLayer initialized!
37891
+
37892
+ Project: ${projectInfo.name}
37893
+ Path: ${targetPath}
37894
+ Data: ${projectInfo.dataDir}
37895
+
37896
+ Claude Desktop configured:
37897
+ Config: ${configPath}
37898
+ Server: ${serverName}
37899
+
37900
+ Restart Claude Desktop to activate.
37901
+ `.trim(),
37902
+ data: { projectInfo, configPath, serverName }
37903
+ };
37904
+ }
37843
37905
  function printHelp() {
37844
37906
  console.log(`
37845
37907
  MemoryLayer CLI - Persistent Memory for AI Coding Assistants
@@ -37848,6 +37910,7 @@ USAGE:
37848
37910
  memorylayer [command] [options]
37849
37911
 
37850
37912
  COMMANDS:
37913
+ init [path] Initialize project + auto-configure Claude Desktop
37851
37914
  (no command) Start MCP server for Claude Desktop
37852
37915
  projects list List all registered projects
37853
37916
  projects add <path> Add a project to the registry
@@ -37864,8 +37927,12 @@ OPTIONS:
37864
37927
  --format <type> ADR format: madr, nygard, simple
37865
37928
 
37866
37929
  EXAMPLES:
37930
+ # Quick setup (auto-configures Claude Desktop)
37931
+ cd /path/to/project
37932
+ neuronlayer init
37933
+
37867
37934
  # Start MCP server
37868
- memorylayer --project /path/to/project
37935
+ neuronlayer --project /path/to/project
37869
37936
 
37870
37937
  # List all projects
37871
37938
  memorylayer projects list
@@ -37894,6 +37961,14 @@ function executeCLI(args) {
37894
37961
  case "-h":
37895
37962
  printHelp();
37896
37963
  break;
37964
+ case "init": {
37965
+ const path = args[1];
37966
+ const result = initProject(path);
37967
+ console.log(result.message);
37968
+ if (!result.success)
37969
+ process.exit(1);
37970
+ break;
37971
+ }
37897
37972
  case "projects": {
37898
37973
  switch (subcommand) {
37899
37974
  case "list":
@@ -37986,7 +38061,7 @@ function executeCLI(args) {
37986
38061
  async function main() {
37987
38062
  const args = process.argv.slice(2);
37988
38063
  const firstArg = args[0];
37989
- const cliCommands = ["projects", "export", "help", "--help", "-h"];
38064
+ const cliCommands = ["init", "projects", "export", "help", "--help", "-h"];
37990
38065
  if (firstArg && cliCommands.includes(firstArg)) {
37991
38066
  executeCLI(args);
37992
38067
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neuronlayer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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",
@@ -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,87 @@ export function showProject(projectId?: string): CommandResult {
231
232
  };
232
233
  }
233
234
 
235
+ // Initialize neuronlayer for current project + auto-configure Claude Desktop
236
+ export function initProject(projectPath?: string): CommandResult {
237
+ const targetPath = projectPath || process.cwd();
238
+
239
+ // 1. Register the project
240
+ const addResult = addProject(targetPath);
241
+ if (!addResult.success) {
242
+ return addResult;
243
+ }
244
+
245
+ const projectInfo = addResult.data as ProjectInfo;
246
+
247
+ // 2. Find Claude Desktop config
248
+ const platform = process.platform;
249
+ let configPath: string;
250
+
251
+ if (platform === 'win32') {
252
+ configPath = join(homedir(), 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
253
+ } else if (platform === 'darwin') {
254
+ configPath = join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
255
+ } else {
256
+ configPath = join(homedir(), '.config', 'claude', 'claude_desktop_config.json');
257
+ }
258
+
259
+ // 3. Read or create config
260
+ let config: { mcpServers?: Record<string, unknown> } = { mcpServers: {} };
261
+
262
+ try {
263
+ if (existsSync(configPath)) {
264
+ const content = readFileSync(configPath, 'utf-8');
265
+ config = JSON.parse(content);
266
+ } else {
267
+ // Create directory if needed
268
+ const configDir = configPath.substring(0, configPath.lastIndexOf(platform === 'win32' ? '\\' : '/'));
269
+ mkdirSync(configDir, { recursive: true });
270
+ }
271
+ } catch {
272
+ // Config doesn't exist or is invalid, start fresh
273
+ }
274
+
275
+ if (!config.mcpServers) {
276
+ config.mcpServers = {};
277
+ }
278
+
279
+ // 4. Add neuronlayer server for this project
280
+ const serverName = `neuronlayer-${projectInfo.name.toLowerCase().replace(/[^a-z0-9]/g, '-')}`;
281
+
282
+ config.mcpServers[serverName] = {
283
+ command: 'npx',
284
+ args: ['-y', 'neuronlayer', '--project', targetPath]
285
+ };
286
+
287
+ // 5. Write config
288
+ try {
289
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
290
+ } catch (err) {
291
+ return {
292
+ success: false,
293
+ message: `Failed to write Claude Desktop config: ${err instanceof Error ? err.message : String(err)}`
294
+ };
295
+ }
296
+
297
+ return {
298
+ success: true,
299
+ message: `
300
+ NeuronLayer initialized!
301
+
302
+ Project: ${projectInfo.name}
303
+ Path: ${targetPath}
304
+ Data: ${projectInfo.dataDir}
305
+
306
+ Claude Desktop configured:
307
+ Config: ${configPath}
308
+ Server: ${serverName}
309
+
310
+ Restart Claude Desktop to activate.
311
+ `.trim(),
312
+ data: { projectInfo, configPath, serverName }
313
+ };
314
+ }
315
+
234
316
  // Print help
235
317
  export function printHelp(): void {
236
318
  console.log(`
@@ -240,6 +322,7 @@ USAGE:
240
322
  memorylayer [command] [options]
241
323
 
242
324
  COMMANDS:
325
+ init [path] Initialize project + auto-configure Claude Desktop
243
326
  (no command) Start MCP server for Claude Desktop
244
327
  projects list List all registered projects
245
328
  projects add <path> Add a project to the registry
@@ -256,8 +339,12 @@ OPTIONS:
256
339
  --format <type> ADR format: madr, nygard, simple
257
340
 
258
341
  EXAMPLES:
342
+ # Quick setup (auto-configures Claude Desktop)
343
+ cd /path/to/project
344
+ neuronlayer init
345
+
259
346
  # Start MCP server
260
- memorylayer --project /path/to/project
347
+ neuronlayer --project /path/to/project
261
348
 
262
349
  # List all projects
263
350
  memorylayer projects list
@@ -290,6 +377,14 @@ export function executeCLI(args: string[]): void {
290
377
  printHelp();
291
378
  break;
292
379
 
380
+ case 'init': {
381
+ const path = args[1];
382
+ const result = initProject(path);
383
+ console.log(result.message);
384
+ if (!result.success) process.exit(1);
385
+ break;
386
+ }
387
+
293
388
  case 'projects': {
294
389
  switch (subcommand) {
295
390
  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