claude-spotter 1.2.2 → 1.2.4

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,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.4
4
+
5
+ **v1.2.3 で `normalizeProjectPath` の挙動を変えた際に、対になる test の expectation 更新を漏らしたため macOS CI で fail していた hot-fix**。`normalizeProjectPath: separator / trailing slash / Windows case` ([test/tool-db.test.mjs:678](test/tool-db.test.mjs#L678)) は「backslash は常に forward slash になる」という旧仕様の expectation を残したまま v1.2.3 commit に取り込まれており、POSIX 上で `'C:\\Users\\u\\proj'` の入力に対して `'C:\\Users\\u\\proj'` (literal 保持) が返るのを `'C:/Users/u/proj'` で assert していた。Linux CI は v1.2.3 で緑化したが、v1.2.3 push 後の matrix 実行で macOS が同じ test で fail。
6
+
7
+ ### 変更点
8
+
9
+ - **編集 [test/tool-db.test.mjs](test/tool-db.test.mjs)**: `normalizeProjectPath: separator / trailing slash / Windows case` の POSIX 側 expectation を v1.2.3 で確定した「POSIX では backslash を literal に保つ」ルールに合わせ、`'C:\\Users\\u\\proj'` / `'C:/Users\\u/proj'` を変換せず返す挙動を assert。コメントで両 test (`normalizeProjectPath` 単体と `findLocalScopeServers: separator variant matches on Windows only`) の整合理由を明記
10
+
11
+ ソースは v1.2.3 から無変更、test 期待値だけの追従。
12
+
13
+ ## 1.2.3
14
+
15
+ **v1.2.1 で追加した `normalizeProjectPath` が Linux CI で Windows path key と POSIX path をマッチさせて test を落としていた回帰を修正**。`replace(/\\/g, '/')` をプラットフォーム条件なしで実行していたため、Linux 上で `'C:\Users\u\proj'` (Windows 表記の literal key) と `'C:/Users/u/proj'` (forward-slash 入力) が `C:/Users/u/proj` 同士に正規化されてマッチしてしまい、`findLocalScopeServers` が POSIX で意図しない命中を返していた。CI のみ赤、実運用 (Windows) は元から正しく動いていたので機能影響は無し。
16
+
17
+ ### 変更点
18
+
19
+ - **編集 [src/tool-db/mcp-config.mjs](src/tool-db/mcp-config.mjs)**: `normalizeProjectPath` の separator 変換 + lower-case 化を `process.platform === 'win32'` ブランチに閉じ込め、POSIX では trailing slash 除去のみ。コメントを「POSIX で `\` は legal filename 文字なので separator として畳むと別パスを衝突させる」と書き直し
20
+
21
+ ### 背景
22
+
23
+ `~/.claude.json` の `projects[]` キーには絶対パスが verbatim で書かれる。Windows なら `C:\Users\u\proj` 形式、Linux なら `/home/u/proj` 形式。Spotter の `findLocalScopeServers` は exact 一致が外れたとき正規化フォールバックで再照合する設計だが、その正規化が「全プラットフォームで `\` → `/` + 末尾 `/` 除去 + Windows でだけ lowercase」だったため、Linux で実行された場合でも Windows 表記が forward-slash 表記に化けて当たってしまう。test (`findLocalScopeServers: separator variant matches on Windows only` @ test/tool-db.test.mjs:716) は POSIX で `{}` が返ることを assert していたので、Linux CI で fail。
24
+
25
+ 修正は POSIX ブランチでは何もしないこと。POSIX 上に Windows path key が混入する状況自体ほぼ無いので機能影響は皆無、test 期待値との整合だけが効果。
26
+
27
+ ### Release backfill
28
+
29
+ このリリースに合わせて、これまで tag / GitHub Release が未作成だった v1.2.1 / v1.2.2 を CHANGELOG から流用して backfill。Latest は v1.2.3。
30
+
3
31
  ## 1.2.2
4
32
 
5
33
  **Windows で npm-global の `.cmd` 配布 MCP サーバ (例: `claude-mermaid`) が investigate 時に ENOENT で落ちる回帰を修正**。`spotter db refresh` の MCP investigate 経路で `spawn error: spawn claude-mermaid ENOENT` が出て、当該 MCP のツールがカタログに投入されない症状。`.exe` 配布の MCP (例: `openai-image`) や `claude-mermaid.cmd` のように拡張子を明示した登録は影響を受けない、ピンポイントな bug。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-spotter",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Audit agent running alongside Claude Code that catches missed tool calls — 気づく役と実行する役の分離",
5
5
  "type": "module",
6
6
  "bin": {
@@ -92,12 +92,18 @@ async function readMcpServersFile(path) {
92
92
  // - separator: `\` on Windows vs `/`
93
93
  // - drive-letter case: `C:\` vs `c:\` on Windows
94
94
  // - trailing slash: `/foo/bar` vs `/foo/bar/`
95
- // We canonicalize to forward slashes, strip trailing slashes, and lower-case on
96
- // Windows (case-insensitive filesystem). POSIX stays case-sensitive.
95
+ // On Windows we canonicalize to forward slashes and lower-case (case-insensitive
96
+ // filesystem). On POSIX, `\` is a legal filename character — collapsing it to `/`
97
+ // would conflate genuinely distinct paths (e.g. literal `C:\Users\u\proj` vs the
98
+ // hypothetical POSIX path `C:/Users/u/proj`), and case stays significant. POSIX
99
+ // only normalizes the trailing slash.
97
100
  export function normalizeProjectPath(p) {
98
101
  if (typeof p !== 'string' || p.length === 0) return '';
99
- let s = p.replace(/\\/g, '/').replace(/\/+$/, '');
100
- if (process.platform === 'win32') s = s.toLowerCase();
102
+ let s = p;
103
+ if (process.platform === 'win32') {
104
+ s = s.replace(/\\/g, '/').toLowerCase();
105
+ }
106
+ s = s.replace(/\/+$/, '');
101
107
  return s;
102
108
  }
103
109