@vheins/local-memory-mcp 0.18.12 → 0.18.13

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.
@@ -81,8 +81,8 @@ function loadServerInstructions() {
81
81
  // src/mcp/capabilities.ts
82
82
  var __dirname2 = path2.dirname(fileURLToPath2(import.meta.url));
83
83
  var pkgVersion = "0.1.0";
84
- if ("0.18.12") {
85
- pkgVersion = "0.18.12";
84
+ if ("0.18.13") {
85
+ pkgVersion = "0.18.13";
86
86
  } else {
87
87
  let searchDir = __dirname2;
88
88
  for (let i = 0; i < 5; i++) {
@@ -672,7 +672,7 @@ var MigrationManager = class {
672
672
  HAVING cnt > 1
673
673
  `);
674
674
  if (dupRows.length > 0) {
675
- console.log(`Found ${dupRows.length} duplicate task_code(s). Deduplicating by suffix...`);
675
+ logger.info(`Found ${dupRows.length} duplicate task_code(s). Deduplicating by suffix...`);
676
676
  for (const dup of dupRows) {
677
677
  const rows = this.all(
678
678
  `SELECT id, task_code, created_at FROM tasks
@@ -686,7 +686,7 @@ var MigrationManager = class {
686
686
  const newCode = `${dup.task_code}-${i + 1}`;
687
687
  this.run("UPDATE tasks SET task_code = ? WHERE id = ?", newCode, rows[i].id);
688
688
  }
689
- console.log(` Deduplicated ${dup.task_code}: kept 1 (${rows[0].id}), renamed ${rows.length - 1} rows`);
689
+ logger.info(` Deduplicated ${dup.task_code}: kept 1 (${rows[0].id}), renamed ${rows.length - 1} rows`);
690
690
  }
691
691
  }
692
692
  this.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_code_owner_repo ON tasks(owner, repo, task_code);`);
@@ -1323,7 +1323,7 @@ var MemoryEntity = class extends BaseEntity {
1323
1323
  let sql = "SELECT * FROM memories WHERE code = ?";
1324
1324
  const params = [code];
1325
1325
  if (owner && repo) {
1326
- sql += " AND owner = ? AND repo = ?";
1326
+ sql += " AND ((owner = ? AND repo = ?) OR is_global = 1)";
1327
1327
  params.push(owner, repo);
1328
1328
  }
1329
1329
  const row = this.get(sql, params);
@@ -1523,9 +1523,11 @@ var MemoryEntity = class extends BaseEntity {
1523
1523
  incrementHitCounts(ids) {
1524
1524
  if (!ids || ids.length === 0) return;
1525
1525
  const now = (/* @__PURE__ */ new Date()).toISOString();
1526
- for (const id of ids) {
1527
- this.run("UPDATE memories SET hit_count = hit_count + 1, last_used_at = ? WHERE id = ?", [now, id]);
1528
- }
1526
+ const placeholders = ids.map(() => "?").join(",");
1527
+ this.run(`UPDATE memories SET hit_count = hit_count + 1, last_used_at = ? WHERE id IN (${placeholders})`, [
1528
+ now,
1529
+ ...ids
1530
+ ]);
1529
1531
  }
1530
1532
  incrementRecallCount(id) {
1531
1533
  this.run("UPDATE memories SET recall_count = recall_count + 1, last_used_at = ? WHERE id = ?", [
@@ -1559,7 +1561,7 @@ var MemoryEntity = class extends BaseEntity {
1559
1561
  );
1560
1562
  }
1561
1563
  listMemoriesForDashboard(options) {
1562
- const {
1564
+ let {
1563
1565
  owner,
1564
1566
  repo,
1565
1567
  type,
@@ -1573,6 +1575,17 @@ var MemoryEntity = class extends BaseEntity {
1573
1575
  sortBy = "created_at",
1574
1576
  sortOrder = "DESC"
1575
1577
  } = options;
1578
+ const ALLOWED_SORT_COLUMNS = /* @__PURE__ */ new Set([
1579
+ "created_at",
1580
+ "updated_at",
1581
+ "importance",
1582
+ "hit_count",
1583
+ "title",
1584
+ "recall_rate"
1585
+ ]);
1586
+ if (!ALLOWED_SORT_COLUMNS.has(sortBy)) {
1587
+ sortBy = "created_at";
1588
+ }
1576
1589
  const where = ["1=1"];
1577
1590
  const params = [];
1578
1591
  if (owner) {
@@ -1616,7 +1629,7 @@ var MemoryEntity = class extends BaseEntity {
1616
1629
  ...this.rowToMemoryEntry(row),
1617
1630
  recall_rate: row.recall_rate || 0
1618
1631
  }));
1619
- return { items, memories: items, total, limit, offset };
1632
+ return { items, total, limit, offset };
1620
1633
  }
1621
1634
  };
1622
1635
 
@@ -2479,34 +2492,45 @@ var SystemEntity = class extends BaseEntity {
2479
2492
  const pendingHandoffsByRepo = Object.fromEntries(pendingHandoffRows.map((row) => [row.repo, row.count]));
2480
2493
  const unassignedHandoffsByRepo = Object.fromEntries(unassignedHandoffRows.map((row) => [row.repo, row.count]));
2481
2494
  const staleClaimsByRepo = Object.fromEntries(staleClaimRows.map((row) => [row.repo, row.count]));
2482
- const repoOwnerFilter = owner ? " AND owner = ?" : "";
2495
+ const ownerWhere = owner ? " WHERE owner = ?" : "";
2496
+ const memoryCountRows = this.all(
2497
+ `SELECT repo, COUNT(*) as count FROM memories${ownerWhere} GROUP BY repo`,
2498
+ ownerParams
2499
+ );
2500
+ const memoryCountByRepo = Object.fromEntries(memoryCountRows.map((r) => [r.repo, r.count]));
2501
+ const taskAggRows = this.all(
2502
+ `SELECT repo, status, COUNT(*) as count FROM tasks${ownerWhere} GROUP BY repo, status`,
2503
+ ownerParams
2504
+ );
2505
+ const taskCountsByRepo = {};
2506
+ for (const row of taskAggRows) {
2507
+ if (!taskCountsByRepo[row.repo]) {
2508
+ taskCountsByRepo[row.repo] = { total: 0, byStatus: {} };
2509
+ }
2510
+ taskCountsByRepo[row.repo].total += row.count;
2511
+ taskCountsByRepo[row.repo].byStatus[row.status] = row.count;
2512
+ }
2513
+ const lastActivityRows = this.all(
2514
+ `SELECT repo, MAX(updated_at) as last FROM (
2515
+ SELECT repo, updated_at FROM memories${ownerWhere}
2516
+ UNION ALL
2517
+ SELECT repo, updated_at FROM tasks${ownerWhere}
2518
+ ) GROUP BY repo`,
2519
+ owner ? [owner, owner] : []
2520
+ );
2521
+ const lastActivityByRepo = Object.fromEntries(lastActivityRows.map((r) => [r.repo, r.last]));
2483
2522
  return repos.map((repo) => {
2484
- const memoryCountRow = this.get(
2485
- `SELECT COUNT(*) as count FROM memories WHERE repo = ?${repoOwnerFilter}`,
2486
- owner ? [repo, owner] : [repo]
2487
- );
2488
- const lastActivityRow = this.get(
2489
- `SELECT MAX(created_at) as last FROM (SELECT created_at FROM memories WHERE repo = ?${repoOwnerFilter} UNION ALL SELECT created_at FROM tasks WHERE repo = ?${repoOwnerFilter} UNION ALL SELECT created_at FROM action_log WHERE repo = ?${repoOwnerFilter})`,
2490
- owner ? [repo, owner, repo, owner, repo, owner] : [repo, repo, repo]
2491
- );
2492
- const taskStatusRows = this.all(
2493
- `SELECT status, COUNT(*) as count FROM tasks WHERE repo = ?${repoOwnerFilter} GROUP BY status`,
2494
- owner ? [repo, owner] : [repo]
2495
- );
2496
- const taskStatusMap = {};
2497
- taskStatusRows.forEach((r) => {
2498
- taskStatusMap[r.status] = r.count;
2499
- });
2500
- const taskCount = taskStatusRows.reduce((sum, r) => sum + r.count, 0);
2523
+ const memCount = memoryCountByRepo[repo] ?? 0;
2524
+ const taskInfo = taskCountsByRepo[repo] ?? { total: 0, byStatus: {} };
2501
2525
  return {
2502
2526
  repo,
2503
- memoryCount: memoryCountRow?.count ?? 0,
2504
- taskCount,
2505
- inProgressCount: taskStatusMap["in_progress"] ?? 0,
2506
- pendingCount: taskStatusMap["pending"] ?? 0,
2507
- blockedCount: taskStatusMap["blocked"] ?? 0,
2508
- backlogCount: taskStatusMap["backlog"] ?? 0,
2509
- lastActivity: lastActivityRow?.last ?? null,
2527
+ memoryCount: memCount,
2528
+ taskCount: taskInfo.total,
2529
+ inProgressCount: taskInfo.byStatus["in_progress"] ?? 0,
2530
+ pendingCount: taskInfo.byStatus["pending"] ?? 0,
2531
+ blockedCount: taskInfo.byStatus["blocked"] ?? 0,
2532
+ backlogCount: taskInfo.byStatus["backlog"] ?? 0,
2533
+ lastActivity: lastActivityByRepo[repo] ?? null,
2510
2534
  activeClaims: activeClaimsByRepo[repo] ?? 0,
2511
2535
  pendingHandoffs: pendingHandoffsByRepo[repo] ?? 0,
2512
2536
  unassignedHandoffs: unassignedHandoffsByRepo[repo] ?? 0,
@@ -2766,7 +2790,7 @@ var StandardEntity = class extends BaseEntity {
2766
2790
  let sql = "SELECT * FROM coding_standards WHERE code = ?";
2767
2791
  const params = [code];
2768
2792
  if (owner && repo) {
2769
- sql += " AND owner = ? AND repo = ?";
2793
+ sql += " AND ((owner = ? AND repo = ?) OR is_global = 1)";
2770
2794
  params.push(owner, repo);
2771
2795
  }
2772
2796
  const row = this.get(sql, params);
@@ -3586,8 +3610,8 @@ function inferOwnerFromSession(session) {
3586
3610
  return void 0;
3587
3611
  }
3588
3612
 
3589
- // src/mcp/tools/tool-definitions.ts
3590
- var TOOL_DEFINITIONS = [
3613
+ // src/mcp/tools/definitions/memory.ts
3614
+ var MEMORY_TOOL_DEFINITIONS = [
3591
3615
  {
3592
3616
  name: "memory-synthesize",
3593
3617
  title: "Memory Synthesize",
@@ -3640,60 +3664,6 @@ var TOOL_DEFINITIONS = [
3640
3664
  required: ["repo", "objective", "answer", "iterations", "toolCalls"]
3641
3665
  }
3642
3666
  },
3643
- {
3644
- name: "task-create-interactive",
3645
- title: "Interactive Task Create",
3646
- description: "Create a task with MCP elicitation fallback for any missing required fields. Best when an agent knows a task is needed but still needs user confirmation for repo, title, or phase.",
3647
- annotations: {
3648
- readOnlyHint: false,
3649
- idempotentHint: false,
3650
- destructiveHint: false,
3651
- openWorldHint: false
3652
- },
3653
- inputSchema: {
3654
- type: "object",
3655
- properties: {
3656
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
3657
- repo: {
3658
- type: "string",
3659
- description: "Repository name. Optional when it can be inferred from MCP roots or elicited from the user."
3660
- },
3661
- task_code: { type: "string" },
3662
- phase: { type: "string" },
3663
- title: { type: "string", minLength: 3, maxLength: 100 },
3664
- description: {
3665
- type: "string",
3666
- minLength: 1,
3667
- description: "Detailed description. MUST follow format: 1. Context & Analysis, 2. Step & Implementation, 3. Acceptance & Verification"
3668
- },
3669
- status: { type: "string", enum: ["backlog", "pending"], default: "backlog" },
3670
- priority: {
3671
- type: "number",
3672
- minimum: 1,
3673
- maximum: 5,
3674
- default: 3,
3675
- description: "Task priority where 1=Low, 2=Normal, 3=Medium, 4=High, 5=Critical."
3676
- },
3677
- agent: { type: "string" },
3678
- role: { type: "string" },
3679
- doc_path: { type: "string" },
3680
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
3681
- },
3682
- required: ["owner"]
3683
- },
3684
- outputSchema: {
3685
- type: "object",
3686
- properties: {
3687
- repo: { type: "string" },
3688
- task_code: { type: "string" },
3689
- phase: { type: "string" },
3690
- title: { type: "string" },
3691
- status: { type: "string" },
3692
- priority: { type: "number" }
3693
- },
3694
- required: ["repo", "task_code", "phase", "title", "status", "priority"]
3695
- }
3696
- },
3697
3667
  {
3698
3668
  name: "memory-detail",
3699
3669
  title: "Memory Detail",
@@ -3722,91 +3692,6 @@ var TOOL_DEFINITIONS = [
3722
3692
  ]
3723
3693
  }
3724
3694
  },
3725
- {
3726
- name: "standard-detail",
3727
- title: "Standard Detail",
3728
- description: "Fetch full details of a specific coding standard by ID or short code. Use after standard-search when a result is relevant and full guidance is needed.",
3729
- inputSchema: {
3730
- type: "object",
3731
- oneOf: [
3732
- {
3733
- title: "By ID",
3734
- required: ["id"],
3735
- properties: {
3736
- id: { type: "string", format: "uuid", description: "Coding standard ID." },
3737
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON details." }
3738
- }
3739
- },
3740
- {
3741
- title: "By code",
3742
- required: ["code", "owner", "repo"],
3743
- properties: {
3744
- code: { type: "string", description: "Short standard code (e.g. 'A3KPQ2')." },
3745
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)." },
3746
- repo: { type: "string", description: "Repository/project name." },
3747
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON details." }
3748
- }
3749
- }
3750
- ]
3751
- }
3752
- },
3753
- {
3754
- name: "task-detail",
3755
- title: "Task Detail",
3756
- description: "Fetch full details of a specific task by ID or task code. Use this when you have a task ID or code and need to read the full description and comments.",
3757
- inputSchema: {
3758
- type: "object",
3759
- oneOf: [
3760
- {
3761
- title: "By ID",
3762
- required: ["owner", "repo", "id"],
3763
- properties: {
3764
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
3765
- repo: { type: "string", description: "Repository name" },
3766
- id: { type: "string", format: "uuid", description: "Task ID" },
3767
- structured: {
3768
- type: "boolean",
3769
- default: false,
3770
- description: "If true, returns structured JSON without the text content details."
3771
- }
3772
- }
3773
- },
3774
- {
3775
- title: "By task_code",
3776
- required: ["owner", "repo", "task_code"],
3777
- properties: {
3778
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
3779
- repo: { type: "string", description: "Repository name" },
3780
- task_code: { type: "string", description: "Task code (e.g. TASK-001)" },
3781
- structured: {
3782
- type: "boolean",
3783
- default: false,
3784
- description: "If true, returns structured JSON without the text content details."
3785
- }
3786
- }
3787
- },
3788
- {
3789
- title: "By task_codes",
3790
- required: ["owner", "repo", "task_codes"],
3791
- properties: {
3792
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
3793
- repo: { type: "string", description: "Repository name" },
3794
- task_codes: {
3795
- type: "array",
3796
- items: { type: "string" },
3797
- minItems: 1,
3798
- description: "Array of task codes (e.g. TASK-001)"
3799
- },
3800
- structured: {
3801
- type: "boolean",
3802
- default: false,
3803
- description: "If true, returns structured JSON without the text content details."
3804
- }
3805
- }
3806
- }
3807
- ]
3808
- }
3809
- },
3810
3695
  {
3811
3696
  name: "memory-store",
3812
3697
  title: "Memory Store",
@@ -4278,85 +4163,6 @@ var TOOL_DEFINITIONS = [
4278
4163
  required: ["success"]
4279
4164
  }
4280
4165
  },
4281
- {
4282
- name: "standard-delete",
4283
- title: "Standard Delete",
4284
- description: "Delete one or more coding standards. Supports single 'id' or bulk 'ids'.",
4285
- annotations: {
4286
- readOnlyHint: false,
4287
- idempotentHint: false,
4288
- destructiveHint: true,
4289
- openWorldHint: false
4290
- },
4291
- inputSchema: {
4292
- type: "object",
4293
- oneOf: [
4294
- {
4295
- title: "By single ID",
4296
- required: ["owner", "repo", "id"],
4297
- properties: {
4298
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4299
- repo: { type: "string", description: "Repository name." },
4300
- id: { type: "string", format: "uuid", description: "Coding standard ID to delete." },
4301
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
4302
- }
4303
- },
4304
- {
4305
- title: "By bulk IDs",
4306
- required: ["owner", "repo", "ids"],
4307
- properties: {
4308
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4309
- repo: { type: "string", description: "Repository name." },
4310
- ids: {
4311
- type: "array",
4312
- items: { type: "string", format: "uuid" },
4313
- minItems: 1,
4314
- description: "Array of coding standard IDs to delete"
4315
- },
4316
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
4317
- }
4318
- },
4319
- {
4320
- title: "By single code",
4321
- required: ["owner", "repo", "code"],
4322
- properties: {
4323
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4324
- repo: { type: "string", description: "Repository name." },
4325
- code: { type: "string", maxLength: 20, description: "Short standard code." },
4326
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
4327
- }
4328
- },
4329
- {
4330
- title: "By bulk codes",
4331
- required: ["owner", "repo", "codes"],
4332
- properties: {
4333
- owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4334
- repo: { type: "string", description: "Repository name." },
4335
- codes: {
4336
- type: "array",
4337
- items: { type: "string", maxLength: 20 },
4338
- minItems: 1,
4339
- description: "Array of standard codes to delete"
4340
- },
4341
- structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
4342
- }
4343
- }
4344
- ]
4345
- },
4346
- outputSchema: {
4347
- type: "object",
4348
- properties: {
4349
- success: { type: "boolean" },
4350
- id: { type: "string" },
4351
- code: { type: "string" },
4352
- ids: { type: "array", items: { type: "string" } },
4353
- codes: { type: "array", items: { type: "string" } },
4354
- repo: { type: "string" },
4355
- deletedCount: { type: "number" }
4356
- },
4357
- required: ["success"]
4358
- }
4359
- },
4360
4166
  {
4361
4167
  name: "memory-recap",
4362
4168
  title: "Memory Recap",
@@ -4430,6 +4236,121 @@ var TOOL_DEFINITIONS = [
4430
4236
  },
4431
4237
  required: ["schema", "repo", "count", "total", "offset", "limit", "stats", "top"]
4432
4238
  }
4239
+ }
4240
+ ];
4241
+
4242
+ // src/mcp/tools/definitions/task.ts
4243
+ var TASK_TOOL_DEFINITIONS = [
4244
+ {
4245
+ name: "task-create-interactive",
4246
+ title: "Interactive Task Create",
4247
+ description: "Create a task with MCP elicitation fallback for any missing required fields. Best when an agent knows a task is needed but still needs user confirmation for repo, title, or phase.",
4248
+ annotations: {
4249
+ readOnlyHint: false,
4250
+ idempotentHint: false,
4251
+ destructiveHint: false,
4252
+ openWorldHint: false
4253
+ },
4254
+ inputSchema: {
4255
+ type: "object",
4256
+ properties: {
4257
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4258
+ repo: {
4259
+ type: "string",
4260
+ description: "Repository name. Optional when it can be inferred from MCP roots or elicited from the user."
4261
+ },
4262
+ task_code: { type: "string" },
4263
+ phase: { type: "string" },
4264
+ title: { type: "string", minLength: 3, maxLength: 100 },
4265
+ description: {
4266
+ type: "string",
4267
+ minLength: 1,
4268
+ description: "Detailed description. MUST follow format: 1. Context & Analysis, 2. Step & Implementation, 3. Acceptance & Verification"
4269
+ },
4270
+ status: { type: "string", enum: ["backlog", "pending"], default: "backlog" },
4271
+ priority: {
4272
+ type: "number",
4273
+ minimum: 1,
4274
+ maximum: 5,
4275
+ default: 3,
4276
+ description: "Task priority where 1=Low, 2=Normal, 3=Medium, 4=High, 5=Critical."
4277
+ },
4278
+ agent: { type: "string" },
4279
+ role: { type: "string" },
4280
+ doc_path: { type: "string" },
4281
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
4282
+ },
4283
+ required: ["owner"]
4284
+ },
4285
+ outputSchema: {
4286
+ type: "object",
4287
+ properties: {
4288
+ repo: { type: "string" },
4289
+ task_code: { type: "string" },
4290
+ phase: { type: "string" },
4291
+ title: { type: "string" },
4292
+ status: { type: "string" },
4293
+ priority: { type: "number" }
4294
+ },
4295
+ required: ["repo", "task_code", "phase", "title", "status", "priority"]
4296
+ }
4297
+ },
4298
+ {
4299
+ name: "task-detail",
4300
+ title: "Task Detail",
4301
+ description: "Fetch full details of a specific task by ID or task code. Use this when you have a task ID or code and need to read the full description and comments.",
4302
+ inputSchema: {
4303
+ type: "object",
4304
+ oneOf: [
4305
+ {
4306
+ title: "By ID",
4307
+ required: ["owner", "repo", "id"],
4308
+ properties: {
4309
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4310
+ repo: { type: "string", description: "Repository name" },
4311
+ id: { type: "string", format: "uuid", description: "Task ID" },
4312
+ structured: {
4313
+ type: "boolean",
4314
+ default: false,
4315
+ description: "If true, returns structured JSON without the text content details."
4316
+ }
4317
+ }
4318
+ },
4319
+ {
4320
+ title: "By task_code",
4321
+ required: ["owner", "repo", "task_code"],
4322
+ properties: {
4323
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4324
+ repo: { type: "string", description: "Repository name" },
4325
+ task_code: { type: "string", description: "Task code (e.g. TASK-001)" },
4326
+ structured: {
4327
+ type: "boolean",
4328
+ default: false,
4329
+ description: "If true, returns structured JSON without the text content details."
4330
+ }
4331
+ }
4332
+ },
4333
+ {
4334
+ title: "By task_codes",
4335
+ required: ["owner", "repo", "task_codes"],
4336
+ properties: {
4337
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
4338
+ repo: { type: "string", description: "Repository name" },
4339
+ task_codes: {
4340
+ type: "array",
4341
+ items: { type: "string" },
4342
+ minItems: 1,
4343
+ description: "Array of task codes (e.g. TASK-001)"
4344
+ },
4345
+ structured: {
4346
+ type: "boolean",
4347
+ default: false,
4348
+ description: "If true, returns structured JSON without the text content details."
4349
+ }
4350
+ }
4351
+ }
4352
+ ]
4353
+ }
4433
4354
  },
4434
4355
  {
4435
4356
  name: "task-create",
@@ -5047,7 +4968,11 @@ var TOOL_DEFINITIONS = [
5047
4968
  },
5048
4969
  required: ["schema", "query", "count", "total", "offset", "limit", "results"]
5049
4970
  }
5050
- },
4971
+ }
4972
+ ];
4973
+
4974
+ // src/mcp/tools/definitions/handoff.ts
4975
+ var HANDOFF_TOOL_DEFINITIONS = [
5051
4976
  {
5052
4977
  name: "handoff-create",
5053
4978
  title: "Handoff Create",
@@ -5303,6 +5228,117 @@ var TOOL_DEFINITIONS = [
5303
5228
  },
5304
5229
  required: ["success", "repo", "task_id"]
5305
5230
  }
5231
+ }
5232
+ ];
5233
+
5234
+ // src/mcp/tools/definitions/standard.ts
5235
+ var STANDARD_TOOL_DEFINITIONS = [
5236
+ {
5237
+ name: "standard-detail",
5238
+ title: "Standard Detail",
5239
+ description: "Fetch full details of a specific coding standard by ID or short code. Use after standard-search when a result is relevant and full guidance is needed.",
5240
+ inputSchema: {
5241
+ type: "object",
5242
+ oneOf: [
5243
+ {
5244
+ title: "By ID",
5245
+ required: ["id"],
5246
+ properties: {
5247
+ id: { type: "string", format: "uuid", description: "Coding standard ID." },
5248
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON details." }
5249
+ }
5250
+ },
5251
+ {
5252
+ title: "By code",
5253
+ required: ["code", "owner", "repo"],
5254
+ properties: {
5255
+ code: { type: "string", description: "Short standard code (e.g. 'A3KPQ2')." },
5256
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)." },
5257
+ repo: { type: "string", description: "Repository/project name." },
5258
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON details." }
5259
+ }
5260
+ }
5261
+ ]
5262
+ }
5263
+ },
5264
+ {
5265
+ name: "standard-delete",
5266
+ title: "Standard Delete",
5267
+ description: "Delete one or more coding standards. Supports single 'id' or bulk 'ids'.",
5268
+ annotations: {
5269
+ readOnlyHint: false,
5270
+ idempotentHint: false,
5271
+ destructiveHint: true,
5272
+ openWorldHint: false
5273
+ },
5274
+ inputSchema: {
5275
+ type: "object",
5276
+ oneOf: [
5277
+ {
5278
+ title: "By single ID",
5279
+ required: ["owner", "repo", "id"],
5280
+ properties: {
5281
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
5282
+ repo: { type: "string", description: "Repository name." },
5283
+ id: { type: "string", format: "uuid", description: "Coding standard ID to delete." },
5284
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
5285
+ }
5286
+ },
5287
+ {
5288
+ title: "By bulk IDs",
5289
+ required: ["owner", "repo", "ids"],
5290
+ properties: {
5291
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
5292
+ repo: { type: "string", description: "Repository name." },
5293
+ ids: {
5294
+ type: "array",
5295
+ items: { type: "string", format: "uuid" },
5296
+ minItems: 1,
5297
+ description: "Array of coding standard IDs to delete"
5298
+ },
5299
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
5300
+ }
5301
+ },
5302
+ {
5303
+ title: "By single code",
5304
+ required: ["owner", "repo", "code"],
5305
+ properties: {
5306
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
5307
+ repo: { type: "string", description: "Repository name." },
5308
+ code: { type: "string", maxLength: 20, description: "Short standard code." },
5309
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
5310
+ }
5311
+ },
5312
+ {
5313
+ title: "By bulk codes",
5314
+ required: ["owner", "repo", "codes"],
5315
+ properties: {
5316
+ owner: { type: "string", description: "Organization/namespace (e.g., GitHub org or username)" },
5317
+ repo: { type: "string", description: "Repository name." },
5318
+ codes: {
5319
+ type: "array",
5320
+ items: { type: "string", maxLength: 20 },
5321
+ minItems: 1,
5322
+ description: "Array of standard codes to delete"
5323
+ },
5324
+ structured: { type: "boolean", default: false, description: "If true, returns structured JSON result." }
5325
+ }
5326
+ }
5327
+ ]
5328
+ },
5329
+ outputSchema: {
5330
+ type: "object",
5331
+ properties: {
5332
+ success: { type: "boolean" },
5333
+ id: { type: "string" },
5334
+ code: { type: "string" },
5335
+ ids: { type: "array", items: { type: "string" } },
5336
+ codes: { type: "array", items: { type: "string" } },
5337
+ repo: { type: "string" },
5338
+ deletedCount: { type: "number" }
5339
+ },
5340
+ required: ["success"]
5341
+ }
5306
5342
  },
5307
5343
  {
5308
5344
  name: "standard-store",
@@ -5559,6 +5595,14 @@ var TOOL_DEFINITIONS = [
5559
5595
  }
5560
5596
  ];
5561
5597
 
5598
+ // src/mcp/tools/definitions/index.ts
5599
+ var TOOL_DEFINITIONS = [
5600
+ ...MEMORY_TOOL_DEFINITIONS,
5601
+ ...TASK_TOOL_DEFINITIONS,
5602
+ ...HANDOFF_TOOL_DEFINITIONS,
5603
+ ...STANDARD_TOOL_DEFINITIONS
5604
+ ];
5605
+
5562
5606
  // src/mcp/utils/pagination.ts
5563
5607
  function encodeCursor(offset) {
5564
5608
  return Buffer.from(String(offset), "utf8").toString("base64");
@@ -6216,7 +6260,7 @@ var SingleMemorySchema = z2.object({
6216
6260
  ttlDays: z2.number().min(1).optional(),
6217
6261
  supersedes: z2.string().optional(),
6218
6262
  tags: z2.array(z2.string()).optional(),
6219
- metadata: z2.record(z2.string(), z2.any()).optional(),
6263
+ metadata: z2.record(z2.string(), z2.unknown()).optional(),
6220
6264
  is_global: z2.boolean().default(false)
6221
6265
  });
6222
6266
  var SingleStandardSchema = z2.object({
@@ -6229,7 +6273,7 @@ var SingleStandardSchema = z2.object({
6229
6273
  stack: z2.array(z2.string()).optional(),
6230
6274
  is_global: z2.boolean().optional(),
6231
6275
  tags: z2.array(z2.string().min(1)).min(1),
6232
- metadata: z2.record(z2.string(), z2.any()).refine((value) => Object.keys(value).length > 0, {
6276
+ metadata: z2.record(z2.string(), z2.unknown()).refine((value) => Object.keys(value).length > 0, {
6233
6277
  message: "metadata must contain at least one key"
6234
6278
  }),
6235
6279
  agent: z2.string().optional(),
@@ -6252,7 +6296,7 @@ var MemoryStoreSchema = z3.object({
6252
6296
  ttlDays: z3.number().min(1).optional(),
6253
6297
  supersedes: z3.string().optional(),
6254
6298
  tags: z3.array(z3.string()).optional(),
6255
- metadata: z3.record(z3.string(), z3.any()).optional(),
6299
+ metadata: z3.record(z3.string(), z3.unknown()).optional(),
6256
6300
  is_global: z3.boolean().default(false),
6257
6301
  structured: z3.boolean().default(false),
6258
6302
  memories: z3.array(SingleMemorySchema).min(1).optional()
@@ -6279,7 +6323,7 @@ var MemoryUpdateSchema = z3.object({
6279
6323
  status: z3.enum(["active", "archived"]).optional(),
6280
6324
  supersedes: z3.string().optional(),
6281
6325
  tags: z3.array(z3.string()).optional(),
6282
- metadata: z3.record(z3.string(), z3.any()).optional(),
6326
+ metadata: z3.record(z3.string(), z3.unknown()).optional(),
6283
6327
  is_global: z3.boolean().optional(),
6284
6328
  completed_at: z3.string().optional(),
6285
6329
  structured: z3.boolean().default(false)
@@ -6367,7 +6411,7 @@ var MemorySynthesizeSchema = z3.object({
6367
6411
 
6368
6412
  // src/mcp/tools/schemas/task.ts
6369
6413
  import { z as z4 } from "zod";
6370
- var TaskMetadataSchema = z4.record(z4.string(), z4.any()).optional().superRefine((metadata, ctx) => {
6414
+ var TaskMetadataSchema = z4.record(z4.string(), z4.unknown()).optional().superRefine((metadata, ctx) => {
6371
6415
  if (!metadata) return;
6372
6416
  if (metadata.required_skills !== void 0) {
6373
6417
  if (!Array.isArray(metadata.required_skills)) {
@@ -6453,7 +6497,7 @@ var TaskCreateSchema = z4.object({
6453
6497
  doc_path: z4.string().optional(),
6454
6498
  tags: z4.array(z4.string()).optional(),
6455
6499
  suggested_skills: z4.array(z4.string()).optional(),
6456
- metadata: z4.record(z4.string(), z4.any()).optional(),
6500
+ metadata: z4.record(z4.string(), z4.unknown()).optional(),
6457
6501
  parent_id: z4.string().optional(),
6458
6502
  depends_on: z4.string().optional(),
6459
6503
  est_tokens: z4.number().int().min(0).optional(),
@@ -6490,7 +6534,7 @@ var TaskUpdateSchema = z4.object({
6490
6534
  comment: z4.string().min(1).optional(),
6491
6535
  doc_path: z4.string().optional(),
6492
6536
  tags: z4.array(z4.string()).optional(),
6493
- metadata: z4.record(z4.string(), z4.any()).optional(),
6537
+ metadata: z4.record(z4.string(), z4.unknown()).optional(),
6494
6538
  suggested_skills: z4.array(z4.string()).optional(),
6495
6539
  parent_id: z4.string().optional(),
6496
6540
  depends_on: z4.string().optional(),
@@ -6559,7 +6603,7 @@ var HandoffCreateSchema = z5.object({
6559
6603
  task_id: z5.string().uuid().optional(),
6560
6604
  task_code: z5.string().optional(),
6561
6605
  summary: z5.string().min(1),
6562
- context: z5.record(z5.string(), z5.any()).optional(),
6606
+ context: z5.record(z5.string(), z5.unknown()).optional(),
6563
6607
  expires_at: z5.string().optional(),
6564
6608
  structured: z5.boolean().default(false)
6565
6609
  }).refine((data) => !(data.task_id && data.task_code), {
@@ -6592,7 +6636,7 @@ var TaskClaimSchema = z5.object({
6592
6636
  task_code: z5.string().optional(),
6593
6637
  agent: z5.string().min(1),
6594
6638
  role: z5.string().optional(),
6595
- metadata: z5.record(z5.string(), z5.any()).optional(),
6639
+ metadata: z5.record(z5.string(), z5.unknown()).optional(),
6596
6640
  structured: z5.boolean().default(false)
6597
6641
  }).refine((data) => data.task_id !== void 0 || data.task_code !== void 0, {
6598
6642
  message: "Either task_id or task_code must be provided"
@@ -6635,7 +6679,7 @@ var StandardStoreSchema = z6.object({
6635
6679
  repo: z6.string().transform(normalizeRepo).optional(),
6636
6680
  is_global: z6.boolean().optional(),
6637
6681
  tags: z6.array(z6.string().min(1)).min(1).optional(),
6638
- metadata: z6.record(z6.string(), z6.any()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
6682
+ metadata: z6.record(z6.string(), z6.unknown()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
6639
6683
  agent: z6.string().optional(),
6640
6684
  model: z6.string().optional(),
6641
6685
  structured: z6.boolean().default(false),
@@ -6663,7 +6707,7 @@ var StandardUpdateSchema = z6.object({
6663
6707
  repo: z6.string().transform(normalizeRepo),
6664
6708
  is_global: z6.boolean().optional(),
6665
6709
  tags: z6.array(z6.string().min(1)).min(1).optional(),
6666
- metadata: z6.record(z6.string(), z6.any()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
6710
+ metadata: z6.record(z6.string(), z6.unknown()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
6667
6711
  agent: z6.string().optional(),
6668
6712
  model: z6.string().optional(),
6669
6713
  structured: z6.boolean().default(false)