@vheins/local-memory-mcp 0.14.4 → 0.14.5

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.14.4") {
85
- pkgVersion = "0.14.4";
84
+ if ("0.14.5") {
85
+ pkgVersion = "0.14.5";
86
86
  } else {
87
87
  let searchDir = __dirname2;
88
88
  for (let i = 0; i < 5; i++) {
@@ -1888,6 +1888,15 @@ var TaskEntity = class extends BaseEntity {
1888
1888
  const row = this.get(query, params);
1889
1889
  return (row?.count ?? 0) > 0;
1890
1890
  }
1891
+ getExistingTaskCodes(repo, codes) {
1892
+ if (codes.length === 0) return /* @__PURE__ */ new Set();
1893
+ const placeholders = codes.map(() => "?").join(",");
1894
+ const rows = this.all(
1895
+ `SELECT task_code FROM tasks WHERE repo = ? AND task_code IN (${placeholders})`,
1896
+ [repo, ...codes]
1897
+ );
1898
+ return new Set(rows.map((r) => r.task_code));
1899
+ }
1891
1900
  bulkInsertTasks(tasks) {
1892
1901
  return this.transaction(() => {
1893
1902
  let count = 0;
@@ -2446,6 +2455,42 @@ var StandardEntity = class extends BaseEntity {
2446
2455
  ]
2447
2456
  );
2448
2457
  }
2458
+ bulkInsertStandards(entries) {
2459
+ return this.transaction(() => {
2460
+ let count = 0;
2461
+ for (const entry of entries) {
2462
+ this.run(
2463
+ `INSERT INTO coding_standards (
2464
+ id, code, title, content, parent_id, context, version, language, stack,
2465
+ is_global, repo, tags, metadata, created_at, updated_at, hit_count, last_used_at, agent, model
2466
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2467
+ [
2468
+ entry.id,
2469
+ entry.code ?? null,
2470
+ entry.title,
2471
+ entry.content,
2472
+ entry.parent_id,
2473
+ entry.context,
2474
+ entry.version,
2475
+ entry.language ?? null,
2476
+ entry.stack.length > 0 ? JSON.stringify(entry.stack) : null,
2477
+ entry.is_global ? 1 : 0,
2478
+ entry.repo ?? null,
2479
+ entry.tags.length > 0 ? JSON.stringify(entry.tags) : null,
2480
+ Object.keys(entry.metadata).length > 0 ? JSON.stringify(entry.metadata) : null,
2481
+ entry.created_at,
2482
+ entry.updated_at,
2483
+ entry.hit_count,
2484
+ entry.last_used_at,
2485
+ entry.agent,
2486
+ entry.model
2487
+ ]
2488
+ );
2489
+ count++;
2490
+ }
2491
+ return count;
2492
+ });
2493
+ }
2449
2494
  getById(id) {
2450
2495
  const row = this.get("SELECT * FROM coding_standards WHERE id = ?", [id]);
2451
2496
  return row ? this.rowToEntry(row) : null;
@@ -3256,7 +3301,7 @@ var MemoryScopeSchema = z.object({
3256
3301
  language: z.string().optional()
3257
3302
  });
3258
3303
  var MemoryTypeSchema = z.enum(["code_fact", "decision", "mistake", "pattern", "task_archive"]);
3259
- var MemoryStoreSchema = z.object({
3304
+ var SingleMemorySchema = z.object({
3260
3305
  code: z.string().max(20).optional(),
3261
3306
  type: MemoryTypeSchema,
3262
3307
  title: z.string().min(3).max(255),
@@ -3267,12 +3312,48 @@ var MemoryStoreSchema = z.object({
3267
3312
  model: z.string().min(1),
3268
3313
  scope: MemoryScopeSchema,
3269
3314
  ttlDays: z.number().min(1).optional(),
3270
- supersedes: z.string().uuid().optional(),
3315
+ supersedes: z.string().optional(),
3271
3316
  tags: z.array(z.string()).optional(),
3272
3317
  metadata: z.record(z.string(), z.any()).optional(),
3273
- is_global: z.boolean().default(false),
3274
- structured: z.boolean().default(false)
3318
+ is_global: z.boolean().default(false)
3275
3319
  });
3320
+ var SingleStandardSchema = z.object({
3321
+ name: z.string().min(3).max(255),
3322
+ content: z.string().min(10),
3323
+ parent_id: z.string().optional(),
3324
+ context: z.string().optional(),
3325
+ version: z.string().optional(),
3326
+ language: z.string().optional(),
3327
+ stack: z.array(z.string()).optional(),
3328
+ is_global: z.boolean().optional(),
3329
+ tags: z.array(z.string().min(1)).min(1),
3330
+ metadata: z.record(z.string(), z.any()).refine((value) => Object.keys(value).length > 0, {
3331
+ message: "metadata must contain at least one key"
3332
+ }),
3333
+ agent: z.string().optional(),
3334
+ model: z.string().optional()
3335
+ });
3336
+ var MemoryStoreSchema = z.object({
3337
+ code: z.string().max(20).optional(),
3338
+ type: MemoryTypeSchema.optional(),
3339
+ title: z.string().min(3).max(255).optional(),
3340
+ content: z.string().min(10).optional(),
3341
+ importance: z.number().min(1).max(5).optional(),
3342
+ agent: z.string().min(1).optional(),
3343
+ role: z.string().optional().default("unknown"),
3344
+ model: z.string().min(1).optional(),
3345
+ scope: MemoryScopeSchema.optional(),
3346
+ ttlDays: z.number().min(1).optional(),
3347
+ supersedes: z.string().optional(),
3348
+ tags: z.array(z.string()).optional(),
3349
+ metadata: z.record(z.string(), z.any()).optional(),
3350
+ is_global: z.boolean().default(false),
3351
+ structured: z.boolean().default(false),
3352
+ memories: z.array(SingleMemorySchema).min(1).optional()
3353
+ }).refine((data) => {
3354
+ if (data.memories) return true;
3355
+ return !!(data.type && data.title && data.content && data.importance && data.agent && data.model && data.scope);
3356
+ }, { message: "Either 'memories' array or single memory fields (type, title, content, importance, agent, model, scope) must be provided" });
3276
3357
  var MemoryUpdateSchema = z.object({
3277
3358
  id: z.string().uuid().optional(),
3278
3359
  code: z.string().max(20).optional(),
@@ -3283,7 +3364,7 @@ var MemoryUpdateSchema = z.object({
3283
3364
  agent: z.string().optional(),
3284
3365
  role: z.string().optional(),
3285
3366
  status: z.enum(["active", "archived"]).optional(),
3286
- supersedes: z.string().uuid().optional(),
3367
+ supersedes: z.string().optional(),
3287
3368
  tags: z.array(z.string()).optional(),
3288
3369
  metadata: z.record(z.string(), z.any()).optional(),
3289
3370
  is_global: z.boolean().optional(),
@@ -3369,7 +3450,7 @@ var SingleTaskCreateSchema = z.object({
3369
3450
  tags: z.array(z.string()).optional(),
3370
3451
  metadata: z.record(z.string(), z.any()).optional(),
3371
3452
  parent_id: z.string().optional(),
3372
- depends_on: z.string().uuid().optional(),
3453
+ depends_on: z.string().optional(),
3373
3454
  est_tokens: z.number().int().min(0).optional()
3374
3455
  });
3375
3456
  var TaskCreateSchema = z.object({
@@ -3387,7 +3468,7 @@ var TaskCreateSchema = z.object({
3387
3468
  tags: z.array(z.string()).optional(),
3388
3469
  metadata: z.record(z.string(), z.any()).optional(),
3389
3470
  parent_id: z.string().optional(),
3390
- depends_on: z.string().uuid().optional(),
3471
+ depends_on: z.string().optional(),
3391
3472
  est_tokens: z.number().int().min(0).optional(),
3392
3473
  // Allow bulk tasks
3393
3474
  tasks: z.array(SingleTaskCreateSchema).min(1).optional(),
@@ -3421,7 +3502,7 @@ var TaskUpdateSchema = z.object({
3421
3502
  tags: z.array(z.string()).optional(),
3422
3503
  metadata: z.record(z.string(), z.any()).optional(),
3423
3504
  parent_id: z.string().optional(),
3424
- depends_on: z.string().uuid().optional(),
3505
+ depends_on: z.string().optional(),
3425
3506
  est_tokens: z.number().int().min(0).optional(),
3426
3507
  commit_id: z.string().optional(),
3427
3508
  changed_files: z.array(z.string()).optional(),
@@ -3561,31 +3642,34 @@ var ClaimReleaseSchema = z.object({
3561
3642
  message: "Provide either task_id or task_code, not both"
3562
3643
  });
3563
3644
  var StandardStoreSchema = z.object({
3564
- name: z.string().min(3).max(255),
3565
- content: z.string().min(10),
3566
- parent_id: z.string().uuid().optional(),
3645
+ name: z.string().min(3).max(255).optional(),
3646
+ content: z.string().min(10).optional(),
3647
+ parent_id: z.string().optional(),
3567
3648
  context: z.string().optional(),
3568
3649
  version: z.string().optional(),
3569
3650
  language: z.string().optional(),
3570
3651
  stack: z.array(z.string()).optional(),
3571
3652
  repo: z.string().transform(normalizeRepo).optional(),
3572
3653
  is_global: z.boolean().optional(),
3573
- tags: z.array(z.string().min(1)).min(1),
3574
- metadata: z.record(z.string(), z.any()).refine((value) => Object.keys(value).length > 0, {
3575
- message: "metadata must contain at least one key"
3576
- }),
3654
+ tags: z.array(z.string().min(1)).min(1).optional(),
3655
+ metadata: z.record(z.string(), z.any()).refine((value) => Object.keys(value).length > 0, { message: "metadata must contain at least one key" }).optional(),
3577
3656
  agent: z.string().optional(),
3578
3657
  model: z.string().optional(),
3579
- structured: z.boolean().default(false)
3580
- }).refine((data) => data.is_global !== false || !!data.repo, {
3581
- message: "repo is required for repo-specific standards"
3582
- });
3658
+ structured: z.boolean().default(false),
3659
+ standards: z.array(SingleStandardSchema).min(1).optional()
3660
+ }).refine((data) => {
3661
+ if (data.standards) return true;
3662
+ return !!(data.name && data.content && data.tags && data.metadata);
3663
+ }, { message: "Either 'standards' array or single standard fields (name, content, tags, metadata) must be provided" }).refine(
3664
+ (data) => data.is_global !== false || !!data.repo,
3665
+ { message: "repo is required for repo-specific standards" }
3666
+ );
3583
3667
  var StandardUpdateSchema = z.object({
3584
3668
  id: z.string().uuid().optional(),
3585
3669
  code: z.string().max(20).optional(),
3586
3670
  name: z.string().min(3).max(255).optional(),
3587
3671
  content: z.string().min(10).optional(),
3588
- parent_id: z.string().uuid().nullable().optional(),
3672
+ parent_id: z.string().nullable().optional(),
3589
3673
  context: z.string().optional(),
3590
3674
  version: z.string().optional(),
3591
3675
  language: z.string().optional(),
@@ -3835,14 +3919,46 @@ var TOOL_DEFINITIONS = [
3835
3919
  description: "If true, this memory is shared across all repositories"
3836
3920
  },
3837
3921
  ttlDays: { type: "number", minimum: 1 },
3838
- supersedes: { type: "string", format: "uuid" },
3922
+ supersedes: { type: "string", description: "Optional memory ID (UUID) or memory code to supersede. Resolved before storing." },
3923
+ memories: {
3924
+ type: "array",
3925
+ items: {
3926
+ type: "object",
3927
+ properties: {
3928
+ type: { type: "string", enum: ["code_fact", "decision", "mistake", "pattern", "task_archive"] },
3929
+ title: { type: "string", minLength: 3, maxLength: 100 },
3930
+ content: { type: "string", minLength: 10 },
3931
+ importance: { type: "number", minimum: 1, maximum: 5 },
3932
+ agent: { type: "string" },
3933
+ role: { type: "string", default: "unknown" },
3934
+ model: { type: "string" },
3935
+ scope: {
3936
+ type: "object",
3937
+ properties: {
3938
+ repo: { type: "string" },
3939
+ branch: { type: "string" },
3940
+ folder: { type: "string" },
3941
+ language: { type: "string" }
3942
+ },
3943
+ required: ["repo"]
3944
+ },
3945
+ code: { type: "string" },
3946
+ ttlDays: { type: "number", minimum: 1 },
3947
+ supersedes: { type: "string" },
3948
+ tags: { type: "array", items: { type: "string" } },
3949
+ metadata: { type: "object" },
3950
+ is_global: { type: "boolean", default: false }
3951
+ },
3952
+ required: ["type", "title", "content", "importance", "agent", "model", "scope"]
3953
+ },
3954
+ description: "Array of memories for bulk creation"
3955
+ },
3839
3956
  structured: {
3840
3957
  type: "boolean",
3841
3958
  default: false,
3842
3959
  description: "If true, returns structured JSON of the stored memory."
3843
3960
  }
3844
- },
3845
- required: ["type", "title", "content", "importance", "scope", "agent", "model"]
3961
+ }
3846
3962
  },
3847
3963
  outputSchema: {
3848
3964
  type: "object",
@@ -3914,7 +4030,7 @@ var TOOL_DEFINITIONS = [
3914
4030
  agent: { type: "string" },
3915
4031
  role: { type: "string" },
3916
4032
  status: { type: "string", enum: ["active", "archived"] },
3917
- supersedes: { type: "string", format: "uuid" },
4033
+ supersedes: { type: "string" },
3918
4034
  tags: { type: "array", items: { type: "string" } },
3919
4035
  metadata: { type: "object" },
3920
4036
  is_global: { type: "boolean" },
@@ -4268,7 +4384,7 @@ var TOOL_DEFINITIONS = [
4268
4384
  type: "string",
4269
4385
  description: "Optional parent task ID (UUID) or parent task code (e.g. TASK-001). Resolved to UUID before storing."
4270
4386
  },
4271
- depends_on: { type: "string", format: "uuid" },
4387
+ depends_on: { type: "string", description: "Optional task ID (UUID) or task code (e.g. TASK-001). Resolved to UUID before storing." },
4272
4388
  est_tokens: { type: "number", minimum: 0, description: "Estimated tokens budget for this task" },
4273
4389
  tasks: {
4274
4390
  type: "array",
@@ -4299,7 +4415,7 @@ var TOOL_DEFINITIONS = [
4299
4415
  type: "string",
4300
4416
  description: "Optional parent task ID (UUID) or parent task code (e.g. TASK-001). Resolved to UUID before storing."
4301
4417
  },
4302
- depends_on: { type: "string", format: "uuid" },
4418
+ depends_on: { type: "string", description: "Optional task ID (UUID) or task code (e.g. TASK-001). Resolved to UUID before storing." },
4303
4419
  est_tokens: { type: "number", minimum: 0 }
4304
4420
  },
4305
4421
  required: ["task_code", "phase", "title", "description"]
@@ -4374,7 +4490,7 @@ var TOOL_DEFINITIONS = [
4374
4490
  type: "string",
4375
4491
  description: "Optional parent task ID (UUID) or parent task code (e.g. TASK-001). Resolved to UUID before storing."
4376
4492
  },
4377
- depends_on: { type: "string", format: "uuid" },
4493
+ depends_on: { type: "string", description: "Optional task ID (UUID) or task code (e.g. TASK-001). Resolved to UUID before storing." },
4378
4494
  est_tokens: {
4379
4495
  type: "number",
4380
4496
  minimum: 0,
@@ -4853,8 +4969,7 @@ var TOOL_DEFINITIONS = [
4853
4969
  },
4854
4970
  parent_id: {
4855
4971
  type: "string",
4856
- format: "uuid",
4857
- description: "Optional parent standard ID when this rule is a child/specialization."
4972
+ description: "Optional parent standard ID (UUID) or standard code. Resolved to UUID before storing."
4858
4973
  },
4859
4974
  context: { type: "string", description: "Context or category (e.g., 'error-handling', 'security')" },
4860
4975
  version: { type: "string", description: "Version of the standard (e.g., '1.0.0')" },
@@ -4880,9 +4995,30 @@ var TOOL_DEFINITIONS = [
4880
4995
  },
4881
4996
  agent: { type: "string", description: "Agent creating the standard" },
4882
4997
  model: { type: "string", description: "AI model used" },
4998
+ standards: {
4999
+ type: "array",
5000
+ items: {
5001
+ type: "object",
5002
+ properties: {
5003
+ name: { type: "string" },
5004
+ content: { type: "string" },
5005
+ parent_id: { type: "string" },
5006
+ context: { type: "string" },
5007
+ version: { type: "string" },
5008
+ language: { type: "string" },
5009
+ stack: { type: "array", items: { type: "string" } },
5010
+ is_global: { type: "boolean" },
5011
+ tags: { type: "array", items: { type: "string" } },
5012
+ metadata: { type: "object" },
5013
+ agent: { type: "string" },
5014
+ model: { type: "string" }
5015
+ },
5016
+ required: ["name", "content", "tags", "metadata"]
5017
+ },
5018
+ description: "Array of standards for bulk creation"
5019
+ },
4883
5020
  structured: { type: "boolean", default: false }
4884
- },
4885
- required: ["name", "content", "tags", "metadata"]
5021
+ }
4886
5022
  },
4887
5023
  outputSchema: {
4888
5024
  type: "object",
@@ -4947,7 +5083,7 @@ var TOOL_DEFINITIONS = [
4947
5083
  code: { type: "string", maxLength: 20, description: "Short standard code. Optional if id is provided." },
4948
5084
  name: { type: "string", minLength: 3, maxLength: 255 },
4949
5085
  content: { type: "string", minLength: 10 },
4950
- parent_id: { type: "string", format: "uuid", nullable: true },
5086
+ parent_id: { type: "string", nullable: true },
4951
5087
  context: { type: "string" },
4952
5088
  version: { type: "string" },
4953
5089
  language: { type: "string" },
@@ -5614,10 +5750,13 @@ function createMcpResponse(data, summary, options) {
5614
5750
  text: contentSummary.trim()
5615
5751
  });
5616
5752
  } else if (summary && summary.trim().length > 0) {
5617
- const pointerText = structuredContentPathHint ? `Read structuredContent.${structuredContentPathHint} for details.` : `Read structuredContent for machine-readable results.`;
5753
+ let text = summary.trim();
5754
+ if (includeSerializedStructuredContent) {
5755
+ text += ` ${structuredContentPathHint ? `Read structuredContent.${structuredContentPathHint} for details.` : `Read structuredContent for machine-readable results.`}`;
5756
+ }
5618
5757
  content.push({
5619
5758
  type: "text",
5620
- text: `${summary.trim()} ${pointerText}`
5759
+ text
5621
5760
  });
5622
5761
  }
5623
5762
  const response = {