claude-brain 0.28.2 → 0.28.3

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.28.2
1
+ 0.28.3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-brain",
3
- "version": "0.28.2",
3
+ "version": "0.28.3",
4
4
  "description": "Local development assistant bridging Obsidian vaults with Claude Code via MCP",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -27,6 +27,13 @@ export async function runServe() {
27
27
  // - otherwise → secondary if primary is already running (Claude Code MCP session)
28
28
  const pidManager = new ServerPidManager()
29
29
  const existingPid = pidManager.getRunningPid()
30
+
31
+ // Prevent duplicate --http-only processes
32
+ if (httpOnly && existingPid) {
33
+ console.error(`[claude-brain] Primary instance already running (PID ${existingPid}). Exiting.`)
34
+ process.exit(0)
35
+ }
36
+
30
37
  const isSecondaryInstance = !httpOnly && !!existingPid
31
38
 
32
39
  if (!isSecondaryInstance) {
@@ -148,7 +148,7 @@ export async function loadConfig(basePath: string = process.cwd()): Promise<Conf
148
148
  const fileConfig = loadFromFile(basePath)
149
149
  const envConfig = loadFromEnv()
150
150
 
151
- const merged = mergeConfigs(defaultConfig as Partial<Config>, fileConfig, envConfig)
151
+ const merged = mergeConfigs(defaultConfig as Partial<Config>, envConfig, fileConfig)
152
152
 
153
153
  const result = ConfigSchema.safeParse(merged)
154
154
 
@@ -163,9 +163,14 @@ export async function loadConfig(basePath: string = process.cwd()): Promise<Conf
163
163
  const data = result.data
164
164
  data.logFilePath = resolveHomePath(data.logFilePath)
165
165
  data.dbPath = resolveHomePath(data.dbPath)
166
- if (data.knowledge?.graph?.persistPath) {
167
- data.knowledge.graph.persistPath = resolveHomePath(data.knowledge.graph.persistPath)
168
- }
166
+
167
+ // Always resolve knowledge graph path to absolute
168
+ // Zod .default({}) on nested objects means graph/persistPath may not exist
169
+ if (!data.knowledge) data.knowledge = {} as any
170
+ if (!data.knowledge.graph) data.knowledge.graph = {} as any
171
+ data.knowledge.graph.persistPath = resolveHomePath(
172
+ data.knowledge.graph.persistPath || './data/knowledge-graph.json'
173
+ )
169
174
 
170
175
  // Phase 30: Auto-detect vaultPath if not configured
171
176
  if (!data.vaultPath) {
@@ -290,7 +290,7 @@ export const ConfigSchema = z.object({
290
290
  serverVersion: z.string().regex(/^\d+\.\d+\.\d+$/, 'Version must be semver format').default(pkg.version),
291
291
 
292
292
  /** Logging level */
293
- logLevel: LogLevelSchema.default('info'),
293
+ logLevel: LogLevelSchema.default('warn'),
294
294
 
295
295
  /** Path to log file */
296
296
  logFilePath: z.string().default('./logs/claude-brain.log'),
@@ -178,7 +178,9 @@ export async function initializeServices(config: Config, logger: Logger): Promis
178
178
  if (config.knowledge?.graph?.enabled !== false) {
179
179
  try {
180
180
  const graph = new InMemoryKnowledgeGraph(logger)
181
- const graphPersistPath = config.knowledge?.graph?.persistPath || './data/knowledge-graph.json'
181
+ // Use absolute path from getHomePaths() if persistPath not configured
182
+ const { getHomePaths: getHomePathsKG } = await import('@/config/home')
183
+ const graphPersistPath = config.knowledge?.graph?.persistPath || getHomePathsKG().knowledgeGraph
182
184
 
183
185
  // Load existing graph from disk
184
186
  await graph.load(graphPersistPath)
@@ -656,7 +658,9 @@ export async function shutdownServices(): Promise<void> {
656
658
  // Save and stop knowledge graph
657
659
  if (services.knowledgeGraph) {
658
660
  services.knowledgeGraph.graph.stopAutoSave()
659
- const persistPath = services.config.knowledge?.graph?.persistPath || './data/knowledge-graph.json'
661
+ // Use absolute path from getHomePaths() if persistPath not configured
662
+ const { getHomePaths } = await import('@/config/home')
663
+ const persistPath = services.config.knowledge?.graph?.persistPath || getHomePaths().knowledgeGraph
660
664
  try {
661
665
  await services.knowledgeGraph.graph.save(persistPath)
662
666
  serviceLogger.info('Knowledge graph saved on shutdown')