claude-brain 0.14.0 → 0.14.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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.0
1
+ 0.14.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-brain",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Local development assistant bridging Obsidian vaults with Claude Code via MCP",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -3,7 +3,7 @@ import type { PartialConfig } from './schema'
3
3
  /** Default configuration values for Claude Brain */
4
4
  export const defaultConfig: PartialConfig = {
5
5
  serverName: 'claude-brain',
6
- serverVersion: '0.14.0',
6
+ serverVersion: '0.14.1',
7
7
  logLevel: 'info',
8
8
  logFilePath: './logs/claude-brain.log',
9
9
  dbPath: './data/memory.db',
@@ -284,7 +284,7 @@ export const ConfigSchema = z.object({
284
284
  serverName: z.string().default('claude-brain'),
285
285
 
286
286
  /** Server version in semver format */
287
- serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default('0.14.0'),
287
+ serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default('0.14.1'),
288
288
 
289
289
  /** Logging level */
290
290
  logLevel: LogLevelSchema.default('info'),
@@ -152,30 +152,40 @@ function isOurHookEntry(entry: any): boolean {
152
152
  )
153
153
  }
154
154
 
155
- /** Copy the hook script to the install location */
155
+ /** All files needed by brain-hook.ts at runtime */
156
+ const HOOK_FILES = [
157
+ 'brain-hook.ts',
158
+ 'capture.ts',
159
+ 'queue.ts',
160
+ 'types.ts',
161
+ 'passive-classifier.ts',
162
+ ]
163
+
164
+ /** Copy the hook script and all its dependencies to the install location */
156
165
  function copyHookScript(): void {
157
- const destPath = getHookScriptPath()
158
- const destDir = dirname(destPath)
166
+ const destDir = dirname(getHookScriptPath())
159
167
 
160
168
  if (!existsSync(destDir)) {
161
169
  mkdirSync(destDir, { recursive: true })
162
170
  }
163
171
 
164
- // Find source script relative to this file
165
- // In development: src/hooks/brain-hook.ts
166
- // In production: dist/hooks/brain-hook.js
167
- const srcPath = join(dirname(new URL(import.meta.url).pathname), 'brain-hook.ts')
168
-
169
- if (existsSync(srcPath)) {
170
- const content = readFileSync(srcPath, 'utf-8')
171
- writeFileSync(destPath, content, 'utf-8')
172
- } else {
173
- // Try .js extension for compiled version
174
- const jsSrcPath = srcPath.replace('.ts', '.js')
175
- if (existsSync(jsSrcPath)) {
176
- const content = readFileSync(jsSrcPath, 'utf-8')
172
+ const srcDir = dirname(new URL(import.meta.url).pathname)
173
+
174
+ for (const file of HOOK_FILES) {
175
+ const srcPath = join(srcDir, file)
176
+ const destPath = join(destDir, file)
177
+
178
+ if (existsSync(srcPath)) {
179
+ const content = readFileSync(srcPath, 'utf-8')
177
180
  writeFileSync(destPath, content, 'utf-8')
181
+ } else {
182
+ // Try .js extension for compiled version
183
+ const jsSrcPath = srcPath.replace('.ts', '.js')
184
+ const jsDestPath = destPath.replace('.ts', '.js')
185
+ if (existsSync(jsSrcPath)) {
186
+ const content = readFileSync(jsSrcPath, 'utf-8')
187
+ writeFileSync(jsDestPath, content, 'utf-8')
188
+ }
178
189
  }
179
- // If neither exists, the hook script will need to be installed separately
180
190
  }
181
191
  }
@@ -5,13 +5,20 @@
5
5
  */
6
6
 
7
7
  import { appendFileSync, readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs'
8
- import { dirname, join } from 'node:path'
9
- import { getHomePaths } from '@/config/home'
8
+ import { dirname, join, resolve } from 'node:path'
9
+ import { homedir } from 'node:os'
10
10
  import type { CapturedKnowledge } from './types'
11
11
 
12
+ /** Inline home path resolution — avoids @/config/home dependency for <200ms hook context */
13
+ function getHookDataDir(): string {
14
+ const envHome = process.env.CLAUDE_BRAIN_HOME
15
+ const root = envHome ? resolve(envHome) : join(homedir(), '.claude-brain')
16
+ return join(root, 'data')
17
+ }
18
+
12
19
  /** Get the queue file path */
13
20
  export function getQueuePath(): string {
14
- return join(getHomePaths().data, 'hook-queue.jsonl')
21
+ return join(getHookDataDir(), 'hook-queue.jsonl')
15
22
  }
16
23
 
17
24
  /**