claude-db 0.8.1 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Fixed
6
+
7
+ - **Hooks failed on Windows with MODULE_NOT_FOUND.** Hook commands were written
8
+ with backslash paths, but Claude Code runs them through bash whenever Git Bash
9
+ is present, and there a backslash is an escape character: an unquoted
10
+ `C:\Users\...\hooks\session-end.js` collapses to
11
+ `C:UsersAppData...hookssession-end.js`, which Node then resolves against the
12
+ project directory. Every hook failed. Paths are now written with forward
13
+ slashes, which Node accepts on Windows and bash leaves alone. The MCP server
14
+ was never affected, because its path is passed as an argument rather than
15
+ inside a command string. Reported and fixed by @bspangler21 (#10, #12).
16
+
17
+ - **`status` claimed claude-db was not installed on Windows**, and session start
18
+ never found the MCP server there. Both compared a path built with the
19
+ platform separator against a file that stores it differently — with forward
20
+ slashes now, and JSON-escaped backslashes before that — so the comparison
21
+ could not match. Path comparisons are now separator-insensitive.
22
+
23
+ - **The temporary-install guard did not work on Windows.** It split the install
24
+ path on forward slashes to look for `_npx`, so on a backslash path it found
25
+ nothing and let an install proceed from a directory that npx would delete.
26
+
3
27
  ## 0.8.1
4
28
 
5
29
  ### Fixed
@@ -8,6 +8,7 @@ import { createContext } from '../../context.js';
8
8
  import { join, resolve } from 'node:path';
9
9
  import { readFileSync, statSync } from 'node:fs';
10
10
  import { resolveProject } from '../../util/project.js';
11
+ import { mentionsPath } from '../../util/paths.js';
11
12
  import { transcriptsFor } from '../../capture/index.js';
12
13
  export async function cmdInstall(scope) {
13
14
  const project = resolveProject(undefined);
@@ -158,7 +159,7 @@ function isInstalled(settingsPath) {
158
159
  }
159
160
  function fileMentions(path, needle) {
160
161
  try {
161
- return readFileSync(path, 'utf8').includes(needle);
162
+ return mentionsPath(readFileSync(path, 'utf8'), needle);
162
163
  }
163
164
  catch {
164
165
  return false;
@@ -4,6 +4,7 @@ import { execFileSync } from 'node:child_process';
4
4
  import { readJson, readText, writeAtomic, writeJson } from './files.js';
5
5
  import { removeInstructions, writeInstructions } from './instructions.js';
6
6
  import { rmSync } from 'node:fs';
7
+ import { toPosix } from '../util/paths.js';
7
8
  function writeSkill(distDir, scope, project) {
8
9
  const source = resolve(distDir, '..', 'skills', 'cdb-scan', 'SKILL.md');
9
10
  const body = readText(source);
@@ -22,7 +23,7 @@ const HOOKS = [
22
23
  ];
23
24
  export function assertStableLocation(distDir) {
24
25
  const ephemeral = ['_npx', '_cacache'];
25
- const segments = distDir.split('/');
26
+ const segments = toPosix(distDir).split('/');
26
27
  if (!ephemeral.some((name) => segments.includes(name)))
27
28
  return;
28
29
  throw new Error(`Refusing to install from a temporary location:\n ${distDir}\n\n` +
@@ -125,9 +126,9 @@ export function uninstall(distDir, scope, project) {
125
126
  return path;
126
127
  }
127
128
  function hookCommand(distDir, file) {
128
- return `node ${resolve(distDir, 'hooks', file)}`;
129
+ return `node ${toPosix(resolve(distDir, 'hooks', file))}`;
129
130
  }
130
131
  function isOurHook(command) {
131
- const path = command.replace(/\\/g, '/');
132
+ const path = toPosix(command);
132
133
  return HOOKS.some(([, file]) => path.endsWith(`/hooks/${file}`));
133
134
  }
@@ -7,6 +7,7 @@ import { createContext } from '../context.js';
7
7
  import { openWork } from '../capture/index.js';
8
8
  import { emitContext, readPayload, runHook } from './payload.js';
9
9
  import { resolveProject } from '../util/project.js';
10
+ import { mentionsPath } from '../util/paths.js';
10
11
  import { toShortId } from '../util/shortid.js';
11
12
  import { refreshInstalled } from '../cli/refresh.js';
12
13
  import { updateNotice } from '../update.js';
@@ -36,7 +37,7 @@ function refreshInstalledQuietly(project) {
36
37
  function mcpRegistered(project) {
37
38
  return [join(project, '.mcp.json'), join(homedir(), '.claude.json')].some((path) => {
38
39
  try {
39
- return readFileSync(path, 'utf8').includes(SERVER);
40
+ return mentionsPath(readFileSync(path, 'utf8'), SERVER);
40
41
  }
41
42
  catch {
42
43
  return false;
@@ -0,0 +1,2 @@
1
+ export declare function toPosix(path: string): string;
2
+ export declare function mentionsPath(text: string, needle: string): boolean;
@@ -0,0 +1,7 @@
1
+ export function toPosix(path) {
2
+ return path.replace(/\\/g, '/');
3
+ }
4
+ export function mentionsPath(text, needle) {
5
+ const flatten = (value) => toPosix(value).replace(/\/+/g, '/');
6
+ return flatten(text).includes(flatten(needle));
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-db",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Persistent memory for Claude Code. Captures why decisions were made, not just which files changed. Bring your own database: SQLite, MongoDB or Postgres. No cloud, no subscription.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",