gitflic-cli-mcp 0.4.0 → 0.4.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/slim.mjs +15 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitflic-cli-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "MCP server wrapping the gitflic CLI — exposes the GitFlic REST API as typed tools for AI agents (Claude Code, Cursor, etc.)",
5
5
  "type": "module",
6
6
  "bin": {
package/slim.mjs CHANGED
@@ -223,7 +223,15 @@ export function applyListFilters(items, args = {}) {
223
223
  if (args.name) { const re = globToRe(args.name); out = out.filter((i) => re.test(i.name ?? "") || ci(i.name).includes(ci(args.name))); }
224
224
  if (args.q) {
225
225
  const q = ci(args.q);
226
- out = out.filter((i) => `${i.title ?? ""} ${i.description ?? ""} ${i.shortMessage ?? ""} ${i.message ?? ""}`.toLowerCase().includes(q));
226
+ // Haystack spans every entity's free-text/identity fields so `q` works for
227
+ // issues/MRs (title+description), commits (messages), users (username/
228
+ // fullName/name), projects (title/alias) and releases (tagName). Missing
229
+ // fields collapse to "" — harmless. (Bug fix: user_search used to drop all
230
+ // server results because the haystack lacked username/fullName.)
231
+ out = out.filter((i) =>
232
+ `${i.title ?? ""} ${i.description ?? ""} ${i.shortMessage ?? ""} ${i.message ?? ""} ${i.username ?? ""} ${i.fullName ?? ""} ${i.name ?? ""} ${i.alias ?? ""} ${i.tagName ?? ""}`
233
+ .toLowerCase()
234
+ .includes(q));
227
235
  }
228
236
  if (args.sort) {
229
237
  const desc = String(args.sort)[0] === "-";
@@ -279,7 +287,12 @@ export function slimResult(toolName, result, args = {}, env = process.env) {
279
287
  // Treat known list tools as lists even when GitFlic omits `_embedded` on a
280
288
  // zero-result response, so the {items,total,returned} contract is consistent.
281
289
  let lst = listOf(result);
282
- if (!lst && shape.list && result.page) lst = { items: [], total: result.page.totalElements };
290
+ // Zero-result lists omit `_embedded` entirely. Treat any list tool (mapped
291
+ // OR an unmapped *_list/*_search) carrying a `page` envelope as an empty list
292
+ // so the {items,total,returned} contract holds even when there are no items.
293
+ if (!lst && result.page && (shape.list || /_(list|search)$/.test(toolName))) {
294
+ lst = { items: [], total: result.page.totalElements };
295
+ }
283
296
 
284
297
  if (lst) {
285
298
  let items = Array.isArray(lst.items) ? lst.items : [];