cc-brain 0.1.7 → 0.1.9

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/bin/cc-brain.js CHANGED
@@ -68,8 +68,9 @@ if (!command || command === '--help' || command === '-h') {
68
68
  }
69
69
 
70
70
  if (command === '--version' || command === '-v') {
71
- const pkg = await import('../package.json', { assert: { type: 'json' } });
72
- console.log(pkg.default.version);
71
+ const { readFileSync } = await import('fs');
72
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
73
+ console.log(pkg.version);
73
74
  process.exit(0);
74
75
  }
75
76
 
package/hooks/hooks.json CHANGED
@@ -6,7 +6,7 @@
6
6
  {
7
7
  "type": "command",
8
8
  "command": "npx cc-brain load",
9
- "timeout": 5,
9
+ "timeout": 10,
10
10
  "statusMessage": "Loading brain..."
11
11
  }
12
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-brain",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Persistent memory system for Claude Code - remembers context across sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@
5
5
  * Sets up brain directory and hooks
6
6
  */
7
7
 
8
- import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync } from 'fs';
8
+ import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, unlinkSync, realpathSync } from 'fs';
9
9
  import { join, dirname } from 'path';
10
10
  import { homedir } from 'os';
11
11
  import { fileURLToPath } from 'url';
@@ -66,14 +66,22 @@ if (existsSync(settingsPath)) {
66
66
  // Read our hooks config
67
67
  const hooks = JSON.parse(readFileSync(join(PROJECT_ROOT, 'hooks', 'hooks.json'), 'utf-8'));
68
68
 
69
- // Use npx to resolve package at runtime (works regardless of install location)
70
- hooks.SessionStart[0].hooks[0].command = 'npx cc-brain load';
69
+ // Resolve absolute paths avoids PATH issues on macOS with nvm/fnm/volta
70
+ // Hook subprocesses don't source shell profiles, so npx/node may not be on PATH
71
+ let nodePath;
72
+ try {
73
+ nodePath = realpathSync(process.execPath);
74
+ } catch {
75
+ nodePath = process.execPath;
76
+ }
77
+ const loaderScript = join(PROJECT_ROOT, 'src', 'loader.js');
78
+ hooks.SessionStart[0].hooks[0].command = `"${nodePath}" "${loaderScript}"`;
71
79
 
72
80
  // Merge hooks — preserve user's other hooks, replace/append ours
73
81
  function isCcBrainHook(entry) {
74
82
  if (!entry || !entry.hooks) return false;
75
83
  return entry.hooks.some(h =>
76
- (h.command && h.command.includes('loader.js')) ||
84
+ (h.command && (h.command.includes('cc-brain') || h.command.includes('loader.js'))) ||
77
85
  (h.prompt && h.prompt.includes('structured saver'))
78
86
  );
79
87
  }
@@ -23,7 +23,7 @@ console.log('Uninstalling cc-brain...\n');
23
23
  function isCcBrainHook(entry) {
24
24
  if (!entry || !entry.hooks) return false;
25
25
  return entry.hooks.some(h =>
26
- (h.command && h.command.includes('loader.js')) ||
26
+ (h.command && (h.command.includes('cc-brain') || h.command.includes('loader.js'))) ||
27
27
  (h.prompt && h.prompt.includes('structured saver'))
28
28
  );
29
29
  }