@makimoto/cc-log-viewer 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.js +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makimoto/cc-log-viewer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Search through Claude Code session logs with full-text search",
5
5
  "author": "Shimpei Makimoto",
6
6
  "license": "MIT",
package/src/server.js CHANGED
@@ -22,14 +22,20 @@ function sanitizeFtsQuery(q) {
22
22
  if (!terms.length || (terms.length === 1 && terms[0] === "")) {
23
23
  return '""';
24
24
  }
25
- const quoted = [];
25
+ const cleaned = [];
26
26
  for (const term of terms) {
27
- const clean = term.replace(/["\x00]/g, "");
27
+ // Strip FTS5 special chars
28
+ const clean = term.replace(/["\x00*(){}^~:]/g, "");
28
29
  if (clean) {
29
- quoted.push(`"${clean}"`);
30
+ cleaned.push(clean);
30
31
  }
31
32
  }
32
- return quoted.length ? quoted.join(" ") : '""';
33
+ if (!cleaned.length) return '""';
34
+ // Quote all terms except the last; last term uses prefix matching (*)
35
+ const parts = cleaned.slice(0, -1).map((t) => `"${t}"`);
36
+ const last = cleaned[cleaned.length - 1];
37
+ parts.push(`"${last}"*`);
38
+ return parts.join(" ");
33
39
  }
34
40
 
35
41
  // SPA routing