mixgram 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixgram",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "MCP memory server with Markdown source of truth and SQLite FTS5.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -168,6 +168,36 @@ export const scenarios = [
168
168
  return { passed: p, failed: f };
169
169
  }
170
170
  },
171
+ {
172
+ name: 'Search with hyphen and slash in query (FTS5 sanitization)',
173
+ goal: 'mem_search does not throw on queries containing "-" or "/" (no "syntax error near /" or "no such column").',
174
+ run: async function (ctx) {
175
+ const { h, reporter } = ctx;
176
+ const parseRes = ctx.parse || parse;
177
+ let p = 0, f = 0;
178
+ const ok = (cond, msg) => { if (cond) p++; else f++; reporter.check(msg, cond); };
179
+
180
+ reporter.startScenario(this.name, this.goal);
181
+
182
+ const queries = ['sdd-init', 'sdd-init/alchemy-tycoon', 'alchemy-tycoon sdd-init'];
183
+ for (const query of queries) {
184
+ let res;
185
+ try {
186
+ res = await h.mem_search({ query, project: PROJECT_NAME, limit: 5 });
187
+ } catch (e) {
188
+ reporter.check(`mem_search("${query}") does not throw`, false);
189
+ f++;
190
+ reporter.endScenario(p, f);
191
+ return { passed: p, failed: f };
192
+ }
193
+ const data = parseRes(res).results;
194
+ ok(Array.isArray(data), `mem_search("${query}") returns array`);
195
+ }
196
+
197
+ reporter.endScenario(p, f);
198
+ return { passed: p, failed: f };
199
+ }
200
+ },
171
201
  {
172
202
  name: 'Context for project',
173
203
  goal: 'mem_context returns usable context (recent or query-based).',
@@ -15,13 +15,22 @@ function getBm25Weights(config) {
15
15
  ];
16
16
  }
17
17
 
18
+ // FTS5 uses "/" for NEAR (e.g. term/5) and "-" for NOT; dash-like chars between words break parsing.
19
+ const FTS5_NEAR_SLASH = /\//g;
20
+ const FTS5_NOT_HYPHEN = /(?<=\w)[-\u2010-\u2015\u2212](?=\w)/g; // hyphen, en/em-dash, minus
21
+
18
22
  /**
19
23
  * Normalize query for FTS5: same as indexed text (NFD, remove diacritics, lowercase).
24
+ * Replaces "/" with space so it is not interpreted as FTS5 NEAR syntax (e.g. term/5).
25
+ * Replaces "-" (and Unicode dashes) between word chars with space so "alchemy-tycoon" is not parsed as "alchemy" NOT "tycoon".
20
26
  * Leaves FTS5 operators (AND, OR, NOT, "phrase") intact.
21
27
  */
22
28
  function normalizeQuery(q) {
23
29
  if (q == null || typeof q !== 'string') return '';
24
- return normalizeForFts(q.trim());
30
+ const trimmed = q.trim();
31
+ const slashSafe = trimmed.replace(FTS5_NEAR_SLASH, ' ');
32
+ const hyphenSafe = slashSafe.replace(FTS5_NOT_HYPHEN, ' ');
33
+ return normalizeForFts(hyphenSafe);
25
34
  }
26
35
 
27
36
  /**