@mgsoftwarebv/mg-dashboard-mcp 2.4.2 → 2.4.3

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/dist/index.js CHANGED
@@ -388,7 +388,12 @@ var VALID_FINDING_TYPES = /* @__PURE__ */ new Set([
388
388
  "slow_endpoint",
389
389
  "memory_leak",
390
390
  "missing_memoization",
391
- "large_dependency"
391
+ "large_dependency",
392
+ "dead_code",
393
+ "unused_dependency",
394
+ "env_leak",
395
+ "i18n_missing_key",
396
+ "i18n_unused_key"
392
397
  ]);
393
398
  var VALID_SEVERITIES = /* @__PURE__ */ new Set(["info", "warning", "critical"]);
394
399
  var VALID_SCOPES = /* @__PURE__ */ new Set([
@@ -398,7 +403,9 @@ var VALID_SCOPES = /* @__PURE__ */ new Set([
398
403
  "api",
399
404
  "package",
400
405
  "security",
401
- "server_audit"
406
+ "server_audit",
407
+ "changelog",
408
+ "api-reference"
402
409
  ]);
403
410
  var VALID_REVIEW_STATUSES = /* @__PURE__ */ new Set([
404
411
  "pending",
@@ -439,7 +446,7 @@ var AGENT_TOOLS = [
439
446
  }
440
447
  }
441
448
  },
442
- required: ["repo_slug", "refront_project_id", "entries"]
449
+ required: ["repo_slug", "entries"]
443
450
  }
444
451
  },
445
452
  {
@@ -494,7 +501,7 @@ var AGENT_TOOLS = [
494
501
  }
495
502
  }
496
503
  },
497
- required: ["repo_slug", "refront_project_id", "category", "findings"]
504
+ required: ["repo_slug", "category", "findings"]
498
505
  }
499
506
  },
500
507
  {
@@ -504,7 +511,7 @@ var AGENT_TOOLS = [
504
511
  type: "object",
505
512
  properties: {
506
513
  repo_slug: { type: "string", description: "Repository slug" },
507
- refront_project_id: { type: "string", description: "Refront project UUID" },
514
+ refront_project_id: { type: "string", description: "Refront project UUID (optional for standalone repos)" },
508
515
  scope: {
509
516
  type: "string",
510
517
  enum: [...VALID_SCOPES],
@@ -522,7 +529,7 @@ var AGENT_TOOLS = [
522
529
  description: 'Review status (default: "pending")'
523
530
  }
524
531
  },
525
- required: ["repo_slug", "refront_project_id", "scope", "path", "title", "content"]
532
+ required: ["repo_slug", "scope", "path", "title", "content"]
526
533
  }
527
534
  },
528
535
  {
@@ -578,7 +585,7 @@ var AGENT_TOOLS = [
578
585
  },
579
586
  {
580
587
  name: "agent-validate-suggestions",
581
- description: "Validate existing open suggestions against the actual codebase. For each suggestion, report whether it is valid, invalid (should be dismissed), or needs adjustment. Invalid suggestions are auto-dismissed with a reason.",
588
+ description: "Validate existing open suggestions against the actual codebase. For each suggestion, report whether it is resolved (fixed), valid (still open), invalid (should be dismissed), or needs adjustment.",
582
589
  inputSchema: {
583
590
  type: "object",
584
591
  properties: {
@@ -598,8 +605,8 @@ var AGENT_TOOLS = [
598
605
  },
599
606
  verdict: {
600
607
  type: "string",
601
- enum: ["valid", "invalid", "adjusted"],
602
- description: "Validation verdict: valid (keep as-is), invalid (dismiss), adjusted (update fields)"
608
+ enum: ["valid", "invalid", "adjusted", "resolved"],
609
+ description: "resolved = fix applied (sets status resolved), valid = still relevant (keep open), invalid = dismiss, adjusted = update fields"
603
610
  },
604
611
  reason: {
605
612
  type: "string",
@@ -670,7 +677,6 @@ async function handleAgentTool(name, args2, deps) {
670
677
  const refrontProjectId = sanitizeString(args2.refront_project_id, 100);
671
678
  const entries = Array.isArray(args2.entries) ? args2.entries : [];
672
679
  if (!repoSlug) throw new Error("repo_slug is required");
673
- if (!refrontProjectId) throw new Error("refront_project_id is required");
674
680
  if (entries.length === 0) throw new Error("entries array must not be empty");
675
681
  const wsId = deps.workspaceId;
676
682
  const scanCommit = wsId ? `agent-scan-${wsId.slice(0, 8)}` : `agent-scan-${Date.now().toString(36)}`;
@@ -710,14 +716,13 @@ async function handleAgentTool(name, args2, deps) {
710
716
  const category = args2.category;
711
717
  const findings = Array.isArray(args2.findings) ? args2.findings : [];
712
718
  if (!repoSlug) throw new Error("repo_slug is required");
713
- if (!refrontProjectId) throw new Error("refront_project_id is required");
714
719
  if (!category || !["scan_findings", "perf_audit"].includes(category)) {
715
720
  throw new Error('category must be "scan_findings" or "perf_audit"');
716
721
  }
717
722
  if (findings.length === 0) throw new Error("findings array must not be empty");
718
723
  const SIMILARITY_THRESHOLD = 0.55;
719
724
  const MAX_OPEN_PER_TYPE = 30;
720
- const { data: existingFindings } = await supabase2.from("doc_suggestion").select("id, type, description, file_path, severity, category, status").eq("repo_slug", repoSlug).in("status", ["open", "dismissed"]).limit(500);
725
+ const { data: existingFindings } = await supabase2.from("doc_suggestion").select("id, type, description, file_path, severity, category, status").eq("repo_slug", repoSlug).in("status", ["open", "dismissed", "resolved", "ticket_created"]).limit(500);
721
726
  const existing = existingFindings ?? [];
722
727
  const typeCountMap = /* @__PURE__ */ new Map();
723
728
  for (const e of existing) {
@@ -738,6 +743,9 @@ async function handleAgentTool(name, args2, deps) {
738
743
  if (!description) continue;
739
744
  const isDuplicate = existing.some((e) => {
740
745
  if (e.type !== findingType) return false;
746
+ if (filePath && e.file_path === filePath && ["dismissed", "resolved"].includes(e.status)) {
747
+ return true;
748
+ }
741
749
  if (filePath && e.file_path === filePath) {
742
750
  return textSimilarity(e.description ?? "", description) > 0.4;
743
751
  }
@@ -812,7 +820,6 @@ ${items.map((i) => `\u2022 ${i}`).join("\n")}`;
812
820
  const content = sanitizeString(args2.content, 1e5);
813
821
  const reviewStatus = VALID_REVIEW_STATUSES.has(args2.review_status) ? args2.review_status : "pending";
814
822
  if (!repoSlug) throw new Error("repo_slug is required");
815
- if (!refrontProjectId) throw new Error("refront_project_id is required");
816
823
  if (!path) throw new Error("path is required");
817
824
  if (!title) throw new Error("title is required");
818
825
  if (!content) throw new Error("content is required");
@@ -895,13 +902,16 @@ ${summary}`
895
902
  return { content: [{ type: "text", text: `No documentation found for repo "${repoSlug}"` }] };
896
903
  }
897
904
  const output = docs.map((d) => {
898
- const contentPreview = String(d.content || "").slice(0, 500);
905
+ const fullContent = String(d.content || "");
906
+ const isChangelog = d.scope === "changelog";
907
+ const maxPreview = isChangelog ? 5e4 : 500;
908
+ const preview = fullContent.slice(0, maxPreview);
899
909
  return [
900
910
  `## ${d.title} (${d.scope}/${d.path})`,
901
911
  `Status: ${d.review_status} | By: ${d.generated_by || "unknown"}`,
902
912
  `Updated: ${d.updated_at || d.created_at}`,
903
913
  "",
904
- contentPreview + (String(d.content || "").length > 500 ? "\n...(truncated)" : ""),
914
+ preview + (fullContent.length > maxPreview ? "\n...(truncated)" : ""),
905
915
  ""
906
916
  ].join("\n");
907
917
  }).join("\n---\n\n");
@@ -923,15 +933,24 @@ ${output}` }]
923
933
  let adjusted = 0;
924
934
  let validated = 0;
925
935
  let errors = 0;
936
+ let resolved = 0;
926
937
  for (const r of results) {
927
938
  const id = sanitizeString(r.suggestion_id, 100);
928
939
  const verdict = r.verdict;
929
940
  const reason = sanitizeString(r.reason, 2e3);
930
- if (!id || !["valid", "invalid", "adjusted"].includes(verdict)) {
941
+ if (!id || !["valid", "invalid", "adjusted", "resolved"].includes(verdict)) {
931
942
  errors++;
932
943
  continue;
933
944
  }
934
- if (verdict === "invalid") {
945
+ if (verdict === "resolved") {
946
+ const { error } = await supabase2.from("doc_suggestion").update({
947
+ status: "resolved",
948
+ validated_at: now,
949
+ validated_by: validatedBy
950
+ }).eq("id", id).eq("repo_slug", repoSlug);
951
+ if (error) errors++;
952
+ else resolved++;
953
+ } else if (verdict === "invalid") {
935
954
  const { error } = await supabase2.from("doc_suggestion").update({
936
955
  status: "dismissed",
937
956
  dismissed_reason: reason || "Dismissed by validation agent",
@@ -964,6 +983,7 @@ ${output}` }]
964
983
  }
965
984
  }
966
985
  const parts = [];
986
+ if (resolved > 0) parts.push(`${resolved} resolved`);
967
987
  if (validated > 0) parts.push(`${validated} valid`);
968
988
  if (dismissed > 0) parts.push(`${dismissed} dismissed`);
969
989
  if (adjusted > 0) parts.push(`${adjusted} adjusted`);