@smmachine/launcher 0.6.20 → 0.6.21

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 (154) hide show
  1. package/apps/mcp/dist/bin.cjs +1561 -1184
  2. package/apps/mcp/dist/bin.cjs.map +1 -1
  3. package/apps/mcp/dist/index.cjs +1575 -1182
  4. package/apps/mcp/dist/index.cjs.map +1 -1
  5. package/apps/mcp/dist/index.d.ts +111 -14
  6. package/apps/webapp/.next/BUILD_ID +1 -1
  7. package/apps/webapp/.next/build-manifest.json +3 -3
  8. package/apps/webapp/.next/fallback-build-manifest.json +3 -3
  9. package/apps/webapp/.next/next-minimal-server.js.nft.json +1 -1
  10. package/apps/webapp/.next/next-server.js.nft.json +1 -1
  11. package/apps/webapp/.next/prerender-manifest.json +3 -3
  12. package/apps/webapp/.next/server/app/_global-error/page.js.nft.json +1 -1
  13. package/apps/webapp/.next/server/app/_global-error.html +1 -1
  14. package/apps/webapp/.next/server/app/_global-error.rsc +1 -1
  15. package/apps/webapp/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  16. package/apps/webapp/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  17. package/apps/webapp/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/apps/webapp/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/apps/webapp/.next/server/app/_not-found.html +1 -1
  20. package/apps/webapp/.next/server/app/_not-found.rsc +1 -1
  21. package/apps/webapp/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  22. package/apps/webapp/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/apps/webapp/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  24. package/apps/webapp/.next/server/app/api/source-code/big-o/file/route.js.nft.json +1 -1
  25. package/apps/webapp/.next/server/app/dashboard/architecture/page/server-reference-manifest.json +2 -2
  26. package/apps/webapp/.next/server/app/dashboard/architecture/page.js.nft.json +1 -1
  27. package/apps/webapp/.next/server/app/dashboard/architecture/page_client-reference-manifest.js +1 -1
  28. package/apps/webapp/.next/server/app/dashboard/change-requests/page/server-reference-manifest.json +2 -2
  29. package/apps/webapp/.next/server/app/dashboard/change-requests/page.js.nft.json +1 -1
  30. package/apps/webapp/.next/server/app/dashboard/change-requests/page_client-reference-manifest.js +1 -1
  31. package/apps/webapp/.next/server/app/dashboard/engineering-health/page/server-reference-manifest.json +2 -2
  32. package/apps/webapp/.next/server/app/dashboard/engineering-health/page.js.nft.json +1 -1
  33. package/apps/webapp/.next/server/app/dashboard/engineering-health/page_client-reference-manifest.js +1 -1
  34. package/apps/webapp/.next/server/app/dashboard/insights/page/server-reference-manifest.json +2 -2
  35. package/apps/webapp/.next/server/app/dashboard/insights/page.js.nft.json +1 -1
  36. package/apps/webapp/.next/server/app/dashboard/insights/page_client-reference-manifest.js +1 -1
  37. package/apps/webapp/.next/server/app/dashboard/page/server-reference-manifest.json +2 -2
  38. package/apps/webapp/.next/server/app/dashboard/page.js.nft.json +1 -1
  39. package/apps/webapp/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  40. package/apps/webapp/.next/server/app/dashboard/pipelines/page/server-reference-manifest.json +2 -2
  41. package/apps/webapp/.next/server/app/dashboard/pipelines/page.js.nft.json +1 -1
  42. package/apps/webapp/.next/server/app/dashboard/pipelines/page_client-reference-manifest.js +1 -1
  43. package/apps/webapp/.next/server/app/dashboard/references/page/server-reference-manifest.json +2 -2
  44. package/apps/webapp/.next/server/app/dashboard/references/page.js.nft.json +1 -1
  45. package/apps/webapp/.next/server/app/dashboard/references/page_client-reference-manifest.js +1 -1
  46. package/apps/webapp/.next/server/app/dashboard/settings/page/server-reference-manifest.json +2 -2
  47. package/apps/webapp/.next/server/app/dashboard/settings/page.js.nft.json +1 -1
  48. package/apps/webapp/.next/server/app/dashboard/settings/page_client-reference-manifest.js +1 -1
  49. package/apps/webapp/.next/server/app/dashboard/sonarqube/page/server-reference-manifest.json +2 -2
  50. package/apps/webapp/.next/server/app/dashboard/sonarqube/page.js.nft.json +1 -1
  51. package/apps/webapp/.next/server/app/dashboard/sonarqube/page_client-reference-manifest.js +1 -1
  52. package/apps/webapp/.next/server/app/dashboard/source-code/page/server-reference-manifest.json +2 -2
  53. package/apps/webapp/.next/server/app/dashboard/source-code/page.js.nft.json +1 -1
  54. package/apps/webapp/.next/server/app/dashboard/source-code/page_client-reference-manifest.js +1 -1
  55. package/apps/webapp/.next/server/app/engineering-health/page/server-reference-manifest.json +4 -4
  56. package/apps/webapp/.next/server/app/engineering-health/page.js.nft.json +1 -1
  57. package/apps/webapp/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  58. package/apps/webapp/.next/server/app/page/server-reference-manifest.json +2 -2
  59. package/apps/webapp/.next/server/app/page.js.nft.json +1 -1
  60. package/apps/webapp/.next/server/app/page_client-reference-manifest.js +1 -1
  61. package/apps/webapp/.next/server/app/reports/[id]/page/server-reference-manifest.json +4 -4
  62. package/apps/webapp/.next/server/app/reports/[id]/page.js.nft.json +1 -1
  63. package/apps/webapp/.next/server/app/reports/page/server-reference-manifest.json +4 -4
  64. package/apps/webapp/.next/server/app/reports/page.js.nft.json +1 -1
  65. package/apps/webapp/.next/server/app/reports/page_client-reference-manifest.js +1 -1
  66. package/apps/webapp/.next/server/chunks/ssr/044u_webapp__next-internal_server_app_dashboard_architecture_page_actions_0auf06l.js +1 -1
  67. package/apps/webapp/.next/server/chunks/ssr/044u_webapp__next-internal_server_app_dashboard_architecture_page_actions_0auf06l.js.map +1 -1
  68. package/apps/webapp/.next/server/chunks/ssr/044u_webapp__next-internal_server_app_dashboard_change-requests_page_actions_0m2phod.js +1 -1
  69. package/apps/webapp/.next/server/chunks/ssr/044u_webapp__next-internal_server_app_dashboard_change-requests_page_actions_0m2phod.js.map +1 -1
  70. package/apps/webapp/.next/server/chunks/ssr/0ha2__next-internal_server_app_dashboard_engineering-health_page_actions_0rdrmai.js +1 -1
  71. package/apps/webapp/.next/server/chunks/ssr/0ha2__next-internal_server_app_dashboard_engineering-health_page_actions_0rdrmai.js.map +1 -1
  72. package/apps/webapp/.next/server/chunks/ssr/{0zs2_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1u81xgy._.js → 0zs2_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1979eh7._.js} +1 -1
  73. package/apps/webapp/.next/server/chunks/ssr/{1crg_mermaid_dist_chunks_mermaid_core_1l4_vc-._.js → 1crg_mermaid_dist_chunks_mermaid_core_05hsnop._.js} +1 -1
  74. package/apps/webapp/.next/server/chunks/ssr/_0-7db18._.js +1 -1
  75. package/apps/webapp/.next/server/chunks/ssr/{_1lkjcrk._.js → _0aww5qt._.js} +2 -2
  76. package/apps/webapp/.next/server/chunks/ssr/_0dh0zlo._.js +1 -1
  77. package/apps/webapp/.next/server/chunks/ssr/_0imzkd7._.js +1 -1
  78. package/apps/webapp/.next/server/chunks/ssr/_0imzkd7._.js.map +1 -1
  79. package/apps/webapp/.next/server/chunks/ssr/_0xozcio._.js +1 -1
  80. package/apps/webapp/.next/server/chunks/ssr/_0xozcio._.js.map +1 -1
  81. package/apps/webapp/.next/server/chunks/ssr/_1wn-x3t._.js +1 -1
  82. package/apps/webapp/.next/server/chunks/ssr/_1wn-x3t._.js.map +1 -1
  83. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_insights_page_actions_195xpz5.js +1 -1
  84. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_insights_page_actions_195xpz5.js.map +1 -1
  85. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_page_actions_0ise39g.js +1 -1
  86. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_page_actions_0ise39g.js.map +1 -1
  87. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_pipelines_page_actions_0ifxarm.js +1 -1
  88. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_pipelines_page_actions_0ifxarm.js.map +1 -1
  89. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_references_page_actions_04n4jxm.js +1 -1
  90. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_references_page_actions_04n4jxm.js.map +1 -1
  91. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_settings_page_actions_1q57mfh.js +1 -1
  92. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_settings_page_actions_1q57mfh.js.map +1 -1
  93. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_sonarqube_page_actions_0od5kyp.js +1 -1
  94. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_sonarqube_page_actions_0od5kyp.js.map +1 -1
  95. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_source-code_page_actions_1hadxb7.js +1 -1
  96. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_dashboard_source-code_page_actions_1hadxb7.js.map +1 -1
  97. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_engineering-health_page_actions_0612tpe.js +1 -1
  98. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_engineering-health_page_actions_0612tpe.js.map +1 -1
  99. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_page_actions_1vgymff.js +1 -1
  100. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_page_actions_1vgymff.js.map +1 -1
  101. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_reports_[id]_page_actions_0xht0eq.js +1 -1
  102. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_reports_[id]_page_actions_0xht0eq.js.map +1 -1
  103. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_reports_page_actions_14i5qzx.js +1 -1
  104. package/apps/webapp/.next/server/chunks/ssr/apps_webapp__next-internal_server_app_reports_page_actions_14i5qzx.js.map +1 -1
  105. package/apps/webapp/.next/server/chunks/ssr/apps_webapp_app_dashboard_dashboard-frame_tsx_0rxse94._.js +1 -1
  106. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_14ywl9a._.js → node_modules__pnpm_03oelvl._.js} +1 -1
  107. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1ei4o1o._.js → node_modules__pnpm_04gpfm9._.js} +1 -1
  108. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_0c4yd05._.js → node_modules__pnpm_0ayyphf._.js} +1 -1
  109. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1um53cy._.js → node_modules__pnpm_0ey76w6._.js} +1 -1
  110. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_15b6v2q._.js → node_modules__pnpm_0hi_fgb._.js} +1 -1
  111. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1m6h1wj._.js → node_modules__pnpm_0mc-9iz._.js} +1 -1
  112. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_072ul8x._.js → node_modules__pnpm_0n0ha9r._.js} +1 -1
  113. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_196bbqt._.js → node_modules__pnpm_11y7nzs._.js} +1 -1
  114. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_012ijp_._.js → node_modules__pnpm_1fqj1mn._.js} +1 -1
  115. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_079-9vu._.js → node_modules__pnpm_1qs51iy._.js} +1 -1
  116. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1hvzm0p._.js → node_modules__pnpm_1ty2y-3._.js} +1 -1
  117. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1-7b_gi._.js → node_modules__pnpm_1vuz70r._.js} +1 -1
  118. package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1810k5h._.js → node_modules__pnpm_1xi8cq1._.js} +1 -1
  119. package/apps/webapp/.next/server/middleware-build-manifest.js +3 -3
  120. package/apps/webapp/.next/server/pages/404.html +1 -1
  121. package/apps/webapp/.next/server/pages/500.html +1 -1
  122. package/apps/webapp/.next/server/server-reference-manifest.js +1 -1
  123. package/apps/webapp/.next/server/server-reference-manifest.json +3 -3
  124. package/apps/webapp/.next/static/chunks/0cf9jy9nycczh.js +28 -0
  125. package/apps/webapp/.next/static/chunks/0ohb9yul5znlo.js +1 -0
  126. package/apps/webapp/.next/static/chunks/{2xa1cgv72bxza.js → 0s89ck6xylv6o.js} +1 -1
  127. package/apps/webapp/.next/static/chunks/1s98b4qcsotps.js +1 -0
  128. package/dist/index.cjs +1514 -1114
  129. package/dist/index.cjs.map +1 -1
  130. package/dist/rest/main.cjs +12 -2
  131. package/dist/rest/main.cjs.map +1 -1
  132. package/package.json +7 -5
  133. package/apps/webapp/.next/static/chunks/0c0szaea20j4u.js +0 -28
  134. package/apps/webapp/.next/static/chunks/0ger-8w6hogr3.js +0 -1
  135. package/apps/webapp/.next/static/chunks/1xd-2-h2y0pmk.js +0 -1
  136. /package/apps/webapp/.next/server/chunks/ssr/{0zs2_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1u81xgy._.js.map → 0zs2_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1979eh7._.js.map} +0 -0
  137. /package/apps/webapp/.next/server/chunks/ssr/{1crg_mermaid_dist_chunks_mermaid_core_1l4_vc-._.js.map → 1crg_mermaid_dist_chunks_mermaid_core_05hsnop._.js.map} +0 -0
  138. /package/apps/webapp/.next/server/chunks/ssr/{_1lkjcrk._.js.map → _0aww5qt._.js.map} +0 -0
  139. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_14ywl9a._.js.map → node_modules__pnpm_03oelvl._.js.map} +0 -0
  140. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1ei4o1o._.js.map → node_modules__pnpm_04gpfm9._.js.map} +0 -0
  141. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_0c4yd05._.js.map → node_modules__pnpm_0ayyphf._.js.map} +0 -0
  142. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1um53cy._.js.map → node_modules__pnpm_0ey76w6._.js.map} +0 -0
  143. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_15b6v2q._.js.map → node_modules__pnpm_0hi_fgb._.js.map} +0 -0
  144. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1m6h1wj._.js.map → node_modules__pnpm_0mc-9iz._.js.map} +0 -0
  145. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_072ul8x._.js.map → node_modules__pnpm_0n0ha9r._.js.map} +0 -0
  146. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_196bbqt._.js.map → node_modules__pnpm_11y7nzs._.js.map} +0 -0
  147. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_012ijp_._.js.map → node_modules__pnpm_1fqj1mn._.js.map} +0 -0
  148. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_079-9vu._.js.map → node_modules__pnpm_1qs51iy._.js.map} +0 -0
  149. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1hvzm0p._.js.map → node_modules__pnpm_1ty2y-3._.js.map} +0 -0
  150. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1-7b_gi._.js.map → node_modules__pnpm_1vuz70r._.js.map} +0 -0
  151. /package/apps/webapp/.next/server/chunks/ssr/{node_modules__pnpm_1810k5h._.js.map → node_modules__pnpm_1xi8cq1._.js.map} +0 -0
  152. /package/apps/webapp/.next/static/{1QJj5turQ_zLZgMb8ee_E → 42A-yEAAQq6m65gKOQyX1}/_buildManifest.js +0 -0
  153. /package/apps/webapp/.next/static/{1QJj5turQ_zLZgMb8ee_E → 42A-yEAAQq6m65gKOQyX1}/_clientMiddlewareManifest.js +0 -0
  154. /package/apps/webapp/.next/static/{1QJj5turQ_zLZgMb8ee_E → 42A-yEAAQq6m65gKOQyX1}/_ssgManifest.js +0 -0
@@ -43,8 +43,8 @@ var require_date_time = __commonJS({
43
43
  try {
44
44
  const dt = (0, date_fns_1.parseISO)(date);
45
45
  return (0, date_fns_1.format)(dt, "dd MMM yyyy, HH:mm");
46
- } catch (error2) {
47
- console.warn(`Failed to parse date: ${date}`, error2);
46
+ } catch (error) {
47
+ console.warn(`Failed to parse date: ${date}`, error);
48
48
  return date;
49
49
  }
50
50
  }
@@ -159,11 +159,11 @@ var require_logger = __commonJS({
159
159
  warn(message, data) {
160
160
  this.write("WARN", message, data, console.warn);
161
161
  }
162
- error(message, error2) {
163
- this.write("ERROR", message, error2, console.error);
162
+ error(message, error) {
163
+ this.write("ERROR", message, error, console.error);
164
164
  }
165
- critical(message, error2) {
166
- this.write("CRITICAL", message, error2, console.error);
165
+ critical(message, error) {
166
+ this.write("CRITICAL", message, error, console.error);
167
167
  }
168
168
  setLevel(level) {
169
169
  this.level = level;
@@ -216,18 +216,18 @@ var require_json = __commonJS({
216
216
  function parseJson(json) {
217
217
  try {
218
218
  return JSON.parse(json);
219
- } catch (error2) {
220
- throw new Error(`Failed to parse JSON: ${error2 instanceof Error ? error2.message : String(error2)}`);
219
+ } catch (error) {
220
+ throw new Error(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);
221
221
  }
222
222
  }
223
223
  __name(parseJson, "parseJson");
224
224
  function safeJsonStringify(value) {
225
225
  try {
226
226
  return JSON.stringify(value, null, 2);
227
- } catch (error2) {
227
+ } catch (error) {
228
228
  return JSON.stringify({
229
229
  error: "Failed to serialize",
230
- message: error2 instanceof Error ? error2.message : String(error2)
230
+ message: error instanceof Error ? error.message : String(error)
231
231
  }, null, 2);
232
232
  }
233
233
  }
@@ -1710,9 +1710,9 @@ var require_sqlite_repository = __commonJS({
1710
1710
  this.saveGenericRecords(db, items);
1711
1711
  }
1712
1712
  db.exec("COMMIT");
1713
- } catch (error2) {
1713
+ } catch (error) {
1714
1714
  db.exec("ROLLBACK");
1715
- throw error2;
1715
+ throw error;
1716
1716
  }
1717
1717
  } finally {
1718
1718
  db.close();
@@ -2061,9 +2061,9 @@ var require_sqlite_repository = __commonJS({
2061
2061
  await fs.mkdir(path.dirname(this.dbPath), {
2062
2062
  recursive: true
2063
2063
  });
2064
- } catch (error2) {
2065
- if (error2.code !== "EEXIST") {
2066
- throw error2;
2064
+ } catch (error) {
2065
+ if (error.code !== "EEXIST") {
2066
+ throw error;
2067
2067
  }
2068
2068
  }
2069
2069
  }
@@ -2709,9 +2709,9 @@ var require_sonarqube_service = __commonJS({
2709
2709
  this.logger.info("Fetching SonarQube quality metrics...");
2710
2710
  try {
2711
2711
  return await this.sonarqubeRepository.loadAll();
2712
- } catch (error2) {
2713
- this.logger.error("Error fetching SonarQube metrics:", error2);
2714
- throw error2;
2712
+ } catch (error) {
2713
+ this.logger.error("Error fetching SonarQube metrics:", error);
2714
+ throw error;
2715
2715
  }
2716
2716
  }
2717
2717
  };
@@ -3740,10 +3740,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3740
3740
  startDate: options?.startDate,
3741
3741
  endDate: options?.endDate
3742
3742
  };
3743
- } catch (error2) {
3744
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3743
+ } catch (error) {
3744
+ const errorMsg = error instanceof Error ? error.message : String(error);
3745
3745
  this.logger.error(`Failed to read code churn: ${errorMsg}`);
3746
- throw error2;
3746
+ throw error;
3747
3747
  }
3748
3748
  }
3749
3749
  async getCodeChurnHistory(options) {
@@ -3806,10 +3806,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3806
3806
  }
3807
3807
  this.logger.info(`Parsed ${data.length} author churn records`);
3808
3808
  return data;
3809
- } catch (error2) {
3810
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3809
+ } catch (error) {
3810
+ const errorMsg = error instanceof Error ? error.message : String(error);
3811
3811
  this.logger.error(`Failed to read author churn: ${errorMsg}`);
3812
- throw error2;
3812
+ throw error;
3813
3813
  }
3814
3814
  }
3815
3815
  async getFileCoupling(options) {
@@ -3864,10 +3864,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3864
3864
  this.logger.info(`Parsed ${coupleData.length} file coupling relationships`);
3865
3865
  const sorted = options?.sortBy === "degree" ? coupleData.sort((a, b) => b.degree - a.degree) : coupleData;
3866
3866
  return this.limitRows(sorted, options?.top);
3867
- } catch (error2) {
3868
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3867
+ } catch (error) {
3868
+ const errorMsg = error instanceof Error ? error.message : String(error);
3869
3869
  this.logger.error(`Failed to read file coupling: ${errorMsg}`);
3870
- throw error2;
3870
+ throw error;
3871
3871
  }
3872
3872
  }
3873
3873
  async getFileCouplingHistory(options) {
@@ -3888,10 +3888,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3888
3888
  averageRevs: this.toNumber(record["average-revs"] || record.average_revs)
3889
3889
  })).filter((row) => row.entity.length > 0 && row.coupled.length > 0).filter((row) => this.matchesCouplingFilters(row.entity, row.coupled, options)).sort((a, b) => b.degree - a.degree);
3890
3890
  return this.limitRows(coupledData, options?.top);
3891
- } catch (error2) {
3892
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3891
+ } catch (error) {
3892
+ const errorMsg = error instanceof Error ? error.message : String(error);
3893
3893
  this.logger.error(`Failed to read layered coupling: ${errorMsg}`);
3894
- throw error2;
3894
+ throw error;
3895
3895
  }
3896
3896
  }
3897
3897
  async getLayeredCouplingHistory(options) {
@@ -3950,10 +3950,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3950
3950
  };
3951
3951
  this.logger.info("CodeMaat analysis completed");
3952
3952
  return result;
3953
- } catch (error2) {
3954
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3953
+ } catch (error) {
3954
+ const errorMsg = error instanceof Error ? error.message : String(error);
3955
3955
  this.logger.error(`CodeMaat analysis failed: ${errorMsg}`);
3956
- throw error2;
3956
+ throw error;
3957
3957
  }
3958
3958
  }
3959
3959
  async getEntityChurn(options) {
@@ -3965,10 +3965,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3965
3965
  deleted: this.toNumber(record.deleted),
3966
3966
  commits: this.toNumber(record.commits)
3967
3967
  })).filter((row) => row.entity.length > 0).filter((row) => this.matchesEntityFilters(row.entity, options)).sort((a, b) => b.added + b.deleted - (a.added + a.deleted)).slice(0, this.resolveLimit(options?.top, Number.POSITIVE_INFINITY));
3968
- } catch (error2) {
3969
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3968
+ } catch (error) {
3969
+ const errorMsg = error instanceof Error ? error.message : String(error);
3970
3970
  this.logger.error(`Failed to read entity churn: ${errorMsg}`);
3971
- throw error2;
3971
+ throw error;
3972
3972
  }
3973
3973
  }
3974
3974
  async getEntityChurnHistory(options) {
@@ -3993,10 +3993,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3993
3993
  entity,
3994
3994
  "total-revs": totalRevs
3995
3995
  })).sort((a, b) => b["total-revs"] - a["total-revs"]).slice(0, this.resolveLimit(options?.top, Number.POSITIVE_INFINITY));
3996
- } catch (error2) {
3997
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3996
+ } catch (error) {
3997
+ const errorMsg = error instanceof Error ? error.message : String(error);
3998
3998
  this.logger.error(`Failed to read entity effort: ${errorMsg}`);
3999
- throw error2;
3999
+ throw error;
4000
4000
  }
4001
4001
  }
4002
4002
  async getEntityEffortHistory(options) {
@@ -4023,10 +4023,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
4023
4023
  return Array.from(new Set(rows.map((row) => row.author).filter((author) => author.length > 0))).sort((a, b) => a.localeCompare(b));
4024
4024
  }
4025
4025
  return rows.slice(0, this.resolveLimit(options?.top, Number.POSITIVE_INFINITY));
4026
- } catch (error2) {
4027
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
4026
+ } catch (error) {
4027
+ const errorMsg = error instanceof Error ? error.message : String(error);
4028
4028
  this.logger.error(`Failed to read entity ownership: ${errorMsg}`);
4029
- throw error2;
4029
+ throw error;
4030
4030
  }
4031
4031
  }
4032
4032
  async getEntityOwnershipHistory(options) {
@@ -4829,9 +4829,9 @@ var require_codemaat_fetch_repository_sqlite = __commonJS({
4829
4829
  const imported = this.importCodeChurn(db, fetchedAt, dataDirectory) + this.importAuthorChurn(db, fetchedAt, dataDirectory) + this.importFileCoupling(db, fetchedAt, dataDirectory) + this.importLayeredCoupling(db, fetchedAt, dataDirectory) + this.importEntityChurn(db, fetchedAt, dataDirectory) + this.importEntityEffort(db, fetchedAt, dataDirectory) + this.importEntityOwnership(db, fetchedAt, dataDirectory);
4830
4830
  db.exec("COMMIT");
4831
4831
  return imported;
4832
- } catch (error2) {
4832
+ } catch (error) {
4833
4833
  db.exec("ROLLBACK");
4834
- throw error2;
4834
+ throw error;
4835
4835
  }
4836
4836
  } finally {
4837
4837
  db.close();
@@ -5107,7 +5107,7 @@ var require_codemaat_service = __commonJS({
5107
5107
  value: true
5108
5108
  });
5109
5109
  exports2.CodemaatService = void 0;
5110
- var CodemaatService = class CodemaatService {
5110
+ var CodemaatService2 = class CodemaatService {
5111
5111
  static {
5112
5112
  __name(this, "CodemaatService");
5113
5113
  }
@@ -5139,7 +5139,7 @@ var require_codemaat_service = __commonJS({
5139
5139
  });
5140
5140
  }
5141
5141
  };
5142
- exports2.CodemaatService = CodemaatService;
5142
+ exports2.CodemaatService = CodemaatService2;
5143
5143
  }
5144
5144
  });
5145
5145
 
@@ -5723,24 +5723,24 @@ var require_github_client_retriable = __commonJS({
5723
5723
  this.rateLimitManager.updateFromHeaders(response.headers);
5724
5724
  }
5725
5725
  return response;
5726
- } catch (error2) {
5727
- if (this.isRateLimitError(error2)) {
5726
+ } catch (error) {
5727
+ if (this.isRateLimitError(error)) {
5728
5728
  if (attempt < maxRetries - 1 && this.rateLimitManager) {
5729
5729
  await this.rateLimitManager.waitForReset(attempt);
5730
5730
  continue;
5731
5731
  }
5732
- this.logger.error(`Rate limit error after ${maxRetries} retries: ${error2.response?.status}`);
5733
- throw error2;
5732
+ this.logger.error(`Rate limit error after ${maxRetries} retries: ${error.response?.status}`);
5733
+ throw error;
5734
5734
  }
5735
- if (this.isRetryableNetworkError(error2)) {
5735
+ if (this.isRetryableNetworkError(error)) {
5736
5736
  if (attempt < maxRetries - 1) {
5737
5737
  await this.waitForRetry(attempt);
5738
5738
  continue;
5739
5739
  }
5740
- this.logger.error(`Network error after ${maxRetries} retries: ${error2.message}`);
5741
- throw error2;
5740
+ this.logger.error(`Network error after ${maxRetries} retries: ${error.message}`);
5741
+ throw error;
5742
5742
  }
5743
- throw error2;
5743
+ throw error;
5744
5744
  }
5745
5745
  }
5746
5746
  throw new Error("rateLimitedGet: unexpected exit from retry loop");
@@ -5750,8 +5750,8 @@ var require_github_client_retriable = __commonJS({
5750
5750
  * Acts as a type guard so callers can access `AxiosError` properties
5751
5751
  * without casting.
5752
5752
  */
5753
- isRateLimitError(error2) {
5754
- return axios_1.default.isAxiosError(error2) && (error2.response?.status === 429 || error2.response?.status === 403);
5753
+ isRateLimitError(error) {
5754
+ return axios_1.default.isAxiosError(error) && (error.response?.status === 429 || error.response?.status === 403);
5755
5755
  }
5756
5756
  /**
5757
5757
  * Check if the error is a transient network error that can be retried.
@@ -5767,11 +5767,11 @@ var require_github_client_retriable = __commonJS({
5767
5767
  * Acts as a type guard so callers can access `AxiosError` properties
5768
5768
  * without casting.
5769
5769
  */
5770
- isRetryableNetworkError(error2) {
5771
- if (!axios_1.default.isAxiosError(error2)) {
5770
+ isRetryableNetworkError(error) {
5771
+ if (!axios_1.default.isAxiosError(error)) {
5772
5772
  return false;
5773
5773
  }
5774
- if (!error2.response) {
5774
+ if (!error.response) {
5775
5775
  const retryableCodes = [
5776
5776
  "ECONNRESET",
5777
5777
  "ECONNABORTED",
@@ -5780,14 +5780,14 @@ var require_github_client_retriable = __commonJS({
5780
5780
  "ENOTFOUND",
5781
5781
  "ERR_NETWORK"
5782
5782
  ];
5783
- if (error2.code && retryableCodes.includes(error2.code)) {
5783
+ if (error.code && retryableCodes.includes(error.code)) {
5784
5784
  return true;
5785
5785
  }
5786
- if (error2.message && /socket hang up|network error/i.test(error2.message)) {
5786
+ if (error.message && /socket hang up|network error/i.test(error.message)) {
5787
5787
  return true;
5788
5788
  }
5789
5789
  }
5790
- if (error2.response && (error2.response.status === 502 || error2.response.status === 503)) {
5790
+ if (error.response && (error.response.status === 502 || error.response.status === 503)) {
5791
5791
  return true;
5792
5792
  }
5793
5793
  return false;
@@ -5930,15 +5930,15 @@ var require_github_pr_client = __commonJS({
5930
5930
  }
5931
5931
  this.logger.info(`Fetched ${allPRs.length} PRs total`);
5932
5932
  return allPRs;
5933
- } catch (error2) {
5934
- if (axios_1.default.isAxiosError(error2)) {
5935
- this.logger.error(`GitHub API error fetching PRs: ${error2.response?.status} - ${error2.response?.statusText}`);
5936
- if (error2.response?.status === 401) {
5933
+ } catch (error) {
5934
+ if (axios_1.default.isAxiosError(error)) {
5935
+ this.logger.error(`GitHub API error fetching PRs: ${error.response?.status} - ${error.response?.statusText}`);
5936
+ if (error.response?.status === 401) {
5937
5937
  throw new Error("GitHub authentication failed - invalid token");
5938
5938
  }
5939
- throw new Error(`Failed to fetch PRs: ${error2.message}`);
5939
+ throw new Error(`Failed to fetch PRs: ${error.message}`);
5940
5940
  }
5941
- throw error2;
5941
+ throw error;
5942
5942
  }
5943
5943
  }
5944
5944
  async fetchPRComments(prNumber) {
@@ -5966,12 +5966,12 @@ var require_github_pr_client = __commonJS({
5966
5966
  }
5967
5967
  this.logger.info(`Fetched ${allComments.length} comments for PR #${prNumber} total`);
5968
5968
  return allComments;
5969
- } catch (error2) {
5970
- if (axios_1.default.isAxiosError(error2)) {
5971
- this.logger.error(`GitHub API error fetching PR comments: ${error2.message}`);
5972
- throw new Error(`Failed to fetch PR comments: ${error2.message}`);
5969
+ } catch (error) {
5970
+ if (axios_1.default.isAxiosError(error)) {
5971
+ this.logger.error(`GitHub API error fetching PR comments: ${error.message}`);
5972
+ throw new Error(`Failed to fetch PR comments: ${error.message}`);
5973
5973
  }
5974
- throw error2;
5974
+ throw error;
5975
5975
  }
5976
5976
  }
5977
5977
  };
@@ -6124,15 +6124,15 @@ var require_github_workflow_client = __commonJS({
6124
6124
  }
6125
6125
  this.logger.info(`Fetched ${allRuns.length} workflow runs total`);
6126
6126
  return allRuns;
6127
- } catch (error2) {
6128
- if (axios_1.default.isAxiosError(error2)) {
6129
- this.logger.error(`GitHub API error fetching workflows: ${error2.response?.status} - ${error2.response?.statusText}`);
6130
- if (error2.response?.status === 401) {
6127
+ } catch (error) {
6128
+ if (axios_1.default.isAxiosError(error)) {
6129
+ this.logger.error(`GitHub API error fetching workflows: ${error.response?.status} - ${error.response?.statusText}`);
6130
+ if (error.response?.status === 401) {
6131
6131
  throw new Error("GitHub authentication failed - invalid token");
6132
6132
  }
6133
- throw new Error(`Failed to fetch workflows: ${error2.message}`);
6133
+ throw new Error(`Failed to fetch workflows: ${error.message}`);
6134
6134
  }
6135
- throw error2;
6135
+ throw error;
6136
6136
  }
6137
6137
  }
6138
6138
  async fetchWorkflowsForDay(startDate, endDate, rawFilters) {
@@ -6935,8 +6935,8 @@ var require_gitlab_clients = __commonJS({
6935
6935
  ...pipeline,
6936
6936
  ...details
6937
6937
  };
6938
- } catch (error2) {
6939
- this.logger.error(`Failed to fetch GitLab pipeline ${pipeline.id} details`, error2);
6938
+ } catch (error) {
6939
+ this.logger.error(`Failed to fetch GitLab pipeline ${pipeline.id} details`, error);
6940
6940
  return pipeline;
6941
6941
  }
6942
6942
  }
@@ -7266,19 +7266,19 @@ var require_jira_client = __commonJS({
7266
7266
  }
7267
7267
  this.logger.info(`Fetched ${allIssues.length} Jira issues total`);
7268
7268
  return allIssues;
7269
- } catch (error2) {
7270
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7269
+ } catch (error) {
7270
+ const errorMsg = error instanceof Error ? error.message : String(error);
7271
7271
  this.logger.error(`Failed to fetch Jira issues: ${errorMsg}`);
7272
- if (axios_1.default.isAxiosError(error2)) {
7273
- if (error2.response?.status === 401) {
7272
+ if (axios_1.default.isAxiosError(error)) {
7273
+ if (error.response?.status === 401) {
7274
7274
  throw new Error("Jira authentication failed. Check email and token.");
7275
- } else if (error2.response?.status === 404) {
7275
+ } else if (error.response?.status === 404) {
7276
7276
  throw new Error("Jira project not found or API endpoint not accessible.");
7277
- } else if (error2.code === "ECONNABORTED") {
7277
+ } else if (error.code === "ECONNABORTED") {
7278
7278
  throw new Error("Jira API request timeout (30s).");
7279
7279
  }
7280
7280
  }
7281
- throw error2;
7281
+ throw error;
7282
7282
  }
7283
7283
  }
7284
7284
  async fetchIssueChanges(issueKey) {
@@ -7292,15 +7292,15 @@ var require_jira_client = __commonJS({
7292
7292
  const changelog = response.data.changelog?.histories || [];
7293
7293
  this.logger.info(`Fetched ${changelog.length} changelog entries for ${issueKey}`);
7294
7294
  return changelog;
7295
- } catch (error2) {
7296
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7295
+ } catch (error) {
7296
+ const errorMsg = error instanceof Error ? error.message : String(error);
7297
7297
  this.logger.error(`Failed to fetch changelog for ${issueKey}: ${errorMsg}`);
7298
- if (axios_1.default.isAxiosError(error2)) {
7299
- if (error2.response?.status === 404) {
7298
+ if (axios_1.default.isAxiosError(error)) {
7299
+ if (error.response?.status === 404) {
7300
7300
  throw new Error(`Jira issue ${issueKey} not found.`);
7301
7301
  }
7302
7302
  }
7303
- throw error2;
7303
+ throw error;
7304
7304
  }
7305
7305
  }
7306
7306
  async fetchIssueComments(issueKey) {
@@ -7310,15 +7310,15 @@ var require_jira_client = __commonJS({
7310
7310
  const comments = response.data.comments || [];
7311
7311
  this.logger.info(`Fetched ${comments.length} comments for ${issueKey}`);
7312
7312
  return comments;
7313
- } catch (error2) {
7314
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7313
+ } catch (error) {
7314
+ const errorMsg = error instanceof Error ? error.message : String(error);
7315
7315
  this.logger.error(`Failed to fetch comments for ${issueKey}: ${errorMsg}`);
7316
- if (axios_1.default.isAxiosError(error2)) {
7317
- if (error2.response?.status === 404) {
7316
+ if (axios_1.default.isAxiosError(error)) {
7317
+ if (error.response?.status === 404) {
7318
7318
  throw new Error(`Jira issue ${issueKey} not found.`);
7319
7319
  }
7320
7320
  }
7321
- throw error2;
7321
+ throw error;
7322
7322
  }
7323
7323
  }
7324
7324
  };
@@ -7408,21 +7408,21 @@ var require_sonarqube_client = __commonJS({
7408
7408
  }
7409
7409
  this.logger.info(`Fetched ${(component.measures || []).length} metrics for project ${this.projectKey}`);
7410
7410
  return component;
7411
- } catch (error2) {
7412
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7411
+ } catch (error) {
7412
+ const errorMsg = error instanceof Error ? error.message : String(error);
7413
7413
  this.logger.error(`Failed to fetch SonarQube measures: ${errorMsg}`);
7414
- if (axios_1.default.isAxiosError(error2)) {
7415
- if (error2.response?.status === 401) {
7414
+ if (axios_1.default.isAxiosError(error)) {
7415
+ if (error.response?.status === 401) {
7416
7416
  throw new Error("SonarQube authentication failed. Check token.");
7417
- } else if (error2.response?.status === 403) {
7417
+ } else if (error.response?.status === 403) {
7418
7418
  throw new Error(`SonarQube access denied for project ${this.projectKey}. Ensure the token user has Browse permission for this project.`);
7419
- } else if (error2.response?.status === 404) {
7419
+ } else if (error.response?.status === 404) {
7420
7420
  throw new Error(`SonarQube project ${this.projectKey} not found.`);
7421
- } else if (error2.code === "ECONNABORTED") {
7421
+ } else if (error.code === "ECONNABORTED") {
7422
7422
  throw new Error("SonarQube API request timeout (30s).");
7423
7423
  }
7424
7424
  }
7425
- throw error2;
7425
+ throw error;
7426
7426
  }
7427
7427
  }
7428
7428
  async fetchHistoricalMeasures(options) {
@@ -7488,19 +7488,19 @@ var require_sonarqube_client = __commonJS({
7488
7488
  }
7489
7489
  this.logger.info(`Fetched ${flatMeasures.length} historical measurements for project ${this.projectKey}`);
7490
7490
  return flatMeasures;
7491
- } catch (error2) {
7492
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7491
+ } catch (error) {
7492
+ const errorMsg = error instanceof Error ? error.message : String(error);
7493
7493
  this.logger.error(`Failed to fetch SonarQube historical measures: ${errorMsg}`);
7494
- if (axios_1.default.isAxiosError(error2)) {
7495
- if (error2.response?.status === 401) {
7494
+ if (axios_1.default.isAxiosError(error)) {
7495
+ if (error.response?.status === 401) {
7496
7496
  throw new Error("SonarQube authentication failed. Check token.");
7497
- } else if (error2.response?.status === 403) {
7497
+ } else if (error.response?.status === 403) {
7498
7498
  throw new Error(`SonarQube access denied for project ${this.projectKey}. Ensure the token user has Browse permission for this project.`);
7499
- } else if (error2.code === "ECONNABORTED") {
7499
+ } else if (error.code === "ECONNABORTED") {
7500
7500
  throw new Error("SonarQube API request timeout (30s).");
7501
7501
  }
7502
7502
  }
7503
- throw error2;
7503
+ throw error;
7504
7504
  }
7505
7505
  }
7506
7506
  async fetchComponentTree(options) {
@@ -7557,21 +7557,21 @@ var require_sonarqube_client = __commonJS({
7557
7557
  ] : allComponents;
7558
7558
  this.logger.info(`Fetched component tree with ${result.length} components for ${component}`);
7559
7559
  return result;
7560
- } catch (error2) {
7561
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7560
+ } catch (error) {
7561
+ const errorMsg = error instanceof Error ? error.message : String(error);
7562
7562
  this.logger.error(`Failed to fetch SonarQube component tree: ${errorMsg}`);
7563
- if (axios_1.default.isAxiosError(error2)) {
7564
- if (error2.response?.status === 401) {
7563
+ if (axios_1.default.isAxiosError(error)) {
7564
+ if (error.response?.status === 401) {
7565
7565
  throw new Error("SonarQube authentication failed. Check token.");
7566
- } else if (error2.response?.status === 403) {
7566
+ } else if (error.response?.status === 403) {
7567
7567
  throw new Error(`SonarQube access denied for component ${options?.component || this.projectKey}. Ensure the token user has Browse permission for this project/component.`);
7568
- } else if (error2.response?.status === 404) {
7568
+ } else if (error.response?.status === 404) {
7569
7569
  throw new Error(`SonarQube component ${options?.component || this.projectKey} not found.`);
7570
- } else if (error2.code === "ECONNABORTED") {
7570
+ } else if (error.code === "ECONNABORTED") {
7571
7571
  throw new Error("SonarQube API request timeout (30s).");
7572
7572
  }
7573
7573
  }
7574
- throw error2;
7574
+ throw error;
7575
7575
  }
7576
7576
  }
7577
7577
  };
@@ -7615,7 +7615,7 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7615
7615
  }
7616
7616
  async fetchComponentTree(options) {
7617
7617
  try {
7618
- this.logger.debug(`Fetching component tree: ${JSON.stringify(options)}`);
7618
+ this.logger.debug(`Fetching component tree: ${this.describeOptions(options)}`);
7619
7619
  const componentTree = await this.sonarqubeClient.fetchComponentTree({
7620
7620
  component: options?.component,
7621
7621
  depth: options?.depth,
@@ -7623,14 +7623,14 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7623
7623
  });
7624
7624
  await this.appendTimestampedEntry(this.componentTreeJsonRepository, componentTree);
7625
7625
  return componentTree;
7626
- } catch (error2) {
7627
- this.logger.error(`Failed to fetch component tree: ${error2}`, error2 instanceof Error ? error2.stack : "");
7628
- throw new Error(`Failed to fetch component tree: ${error2 instanceof Error ? error2.message : String(error2)}`);
7626
+ } catch (error) {
7627
+ this.logger.error(`Failed to fetch component tree: ${error}`, error instanceof Error ? error.stack : "");
7628
+ throw new Error(`Failed to fetch component tree: ${error instanceof Error ? error.message : String(error)}`);
7629
7629
  }
7630
7630
  }
7631
7631
  async fetchHistoricalMeasures(options) {
7632
7632
  try {
7633
- this.logger.debug(`Fetching historical measures: ${JSON.stringify(options)}`);
7633
+ this.logger.debug(`Fetching historical measures: ${this.describeOptions(options)}`);
7634
7634
  const fromDisk = await this.historicalMeasuresJsonRepository.load();
7635
7635
  const cachedData = (0, types_1.extractLatestData)(fromDisk);
7636
7636
  const cached = Array.isArray(cachedData) ? cachedData : [];
@@ -7664,9 +7664,9 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7664
7664
  const historical = await this.sonarqubeClient.fetchHistoricalMeasures(options);
7665
7665
  await this.appendTimestampedEntry(this.historicalMeasuresJsonRepository, historical);
7666
7666
  return historical;
7667
- } catch (error2) {
7668
- this.logger.error(`Failed to fetch historical measures: ${error2}`, error2 instanceof Error ? error2.stack : "");
7669
- throw new Error(`Failed to fetch historical measures: ${error2 instanceof Error ? error2.message : String(error2)}`);
7667
+ } catch (error) {
7668
+ this.logger.error(`Failed to fetch historical measures: ${error}`, error instanceof Error ? error.stack : "");
7669
+ throw new Error(`Failed to fetch historical measures: ${error instanceof Error ? error.message : String(error)}`);
7670
7670
  }
7671
7671
  }
7672
7672
  findLatestDateInMeasures(measures) {
@@ -7674,6 +7674,16 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7674
7674
  if (timestamps.length === 0) return (/* @__PURE__ */ new Date(0)).toISOString();
7675
7675
  return new Date(Math.max(...timestamps)).toISOString();
7676
7676
  }
7677
+ /**
7678
+ * Formats fetch options for debug logging. When no options are provided the
7679
+ * call is expected: the client falls back to default metrics and date ranges.
7680
+ */
7681
+ describeOptions(options) {
7682
+ if (options === void 0) {
7683
+ return "no options provided \u2014 defaults will be applied";
7684
+ }
7685
+ return JSON.stringify(options);
7686
+ }
7677
7687
  mergeHistoricalMeasures(existing, incoming) {
7678
7688
  const key = /* @__PURE__ */ __name((m) => `${m.metric ?? ""}_${m.timestamp ?? ""}`, "key");
7679
7689
  const map = /* @__PURE__ */ new Map();
@@ -10847,12 +10857,12 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10847
10857
  };
10848
10858
  ee.Ignore = Ae;
10849
10859
  });
10850
- var Fs = R((z) => {
10860
+ var Fs = R((z2) => {
10851
10861
  "use strict";
10852
- Object.defineProperty(z, "__esModule", {
10862
+ Object.defineProperty(z2, "__esModule", {
10853
10863
  value: true
10854
10864
  });
10855
- z.Processor = z.SubWalks = z.MatchRecord = z.HasWalkedCache = void 0;
10865
+ z2.Processor = z2.SubWalks = z2.MatchRecord = z2.HasWalkedCache = void 0;
10856
10866
  var Ds = H(), se = class n {
10857
10867
  static {
10858
10868
  __name(this, "n");
@@ -10874,7 +10884,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10874
10884
  ]));
10875
10885
  }
10876
10886
  };
10877
- z.HasWalkedCache = se;
10887
+ z2.HasWalkedCache = se;
10878
10888
  var ie = class {
10879
10889
  static {
10880
10890
  __name(this, "ie");
@@ -10894,7 +10904,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10894
10904
  ]);
10895
10905
  }
10896
10906
  };
10897
- z.MatchRecord = ie;
10907
+ z2.MatchRecord = ie;
10898
10908
  var re = class {
10899
10909
  static {
10900
10910
  __name(this, "re");
@@ -10924,7 +10934,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10924
10934
  ].filter((t) => t.canReaddir());
10925
10935
  }
10926
10936
  };
10927
- z.SubWalks = re;
10937
+ z2.SubWalks = re;
10928
10938
  var Me = class n {
10929
10939
  static {
10930
10940
  __name(this, "n");
@@ -11011,7 +11021,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
11011
11021
  t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
11012
11022
  }
11013
11023
  };
11014
- z.Processor = Me;
11024
+ z2.Processor = Me;
11015
11025
  });
11016
11026
  var Ls = R((X) => {
11017
11027
  "use strict";
@@ -12741,8 +12751,8 @@ var require_sonarqube_local_analysis = __commonJS({
12741
12751
  this.logger.info(`\u{1F9F9} Removing existing local SonarQube data at "${this.localDataFilePath}" to ensure clean state.`);
12742
12752
  try {
12743
12753
  (0, node_fs_1.unlinkSync)(this.localDataFilePath);
12744
- } catch (error2) {
12745
- this.logger.warn(`Failed to clear local SonarQube data at "${this.localDataFilePath}". You may want to delete this file manually: ${error2}`);
12754
+ } catch (error) {
12755
+ this.logger.warn(`Failed to clear local SonarQube data at "${this.localDataFilePath}". You may want to delete this file manually: ${error}`);
12746
12756
  }
12747
12757
  }
12748
12758
  }
@@ -12931,12 +12941,12 @@ var require_commit_traverser = __commonJS({
12931
12941
  pairedCommits,
12932
12942
  commits: filtered
12933
12943
  };
12934
- } catch (error2) {
12935
- if (error2 instanceof Error) {
12936
- this.logger.error(`Error traversing commits: ${error2.message}`);
12937
- throw new Error(`Failed to traverse commits: ${error2.message}`);
12944
+ } catch (error) {
12945
+ if (error instanceof Error) {
12946
+ this.logger.error(`Error traversing commits: ${error.message}`);
12947
+ throw new Error(`Failed to traverse commits: ${error.message}`);
12938
12948
  }
12939
- throw error2;
12949
+ throw error;
12940
12950
  }
12941
12951
  }
12942
12952
  /**
@@ -12972,12 +12982,12 @@ var require_commit_traverser = __commonJS({
12972
12982
  });
12973
12983
  const commits = this.parseCommitOutput(output.toString());
12974
12984
  return commits;
12975
- } catch (error2) {
12976
- if (error2 instanceof Error) {
12977
- this.logger.error(`Git command failed: ${error2.message}`);
12978
- throw error2;
12985
+ } catch (error) {
12986
+ if (error instanceof Error) {
12987
+ this.logger.error(`Git command failed: ${error.message}`);
12988
+ throw error;
12979
12989
  }
12980
- throw error2;
12990
+ throw error;
12981
12991
  }
12982
12992
  }
12983
12993
  /**
@@ -19017,8 +19027,8 @@ var require_pipelines_fetch_repository_json = __commonJS({
19017
19027
  await this.writeJson(progressPath, {
19018
19028
  page
19019
19029
  });
19020
- } catch (error2) {
19021
- if (this.isUnprocessableEntityError(error2)) {
19030
+ } catch (error) {
19031
+ if (this.isUnprocessableEntityError(error)) {
19022
19032
  this.logger.info(`GitHub returned 422 while fetching workflows page ${page}; treating as pagination end.`);
19023
19033
  await this.writeJson(incompletedPath, runs);
19024
19034
  await this.writeJson(progressPath, {
@@ -19030,7 +19040,7 @@ var require_pipelines_fetch_repository_json = __commonJS({
19030
19040
  await this.writeJson(progressPath, {
19031
19041
  page
19032
19042
  });
19033
- throw error2;
19043
+ throw error;
19034
19044
  }
19035
19045
  }
19036
19046
  await this.deleteFile(progressPath);
@@ -19058,11 +19068,11 @@ var require_pipelines_fetch_repository_json = __commonJS({
19058
19068
  try {
19059
19069
  const contents = await fs.readFile(filePath, "utf-8");
19060
19070
  return JSON.parse(contents);
19061
- } catch (error2) {
19062
- if (error2.code === "ENOENT") {
19071
+ } catch (error) {
19072
+ if (error.code === "ENOENT") {
19063
19073
  return fallback;
19064
19074
  }
19065
- throw error2;
19075
+ throw error;
19066
19076
  }
19067
19077
  }
19068
19078
  async writeJson(filePath, value) {
@@ -19074,17 +19084,17 @@ var require_pipelines_fetch_repository_json = __commonJS({
19074
19084
  async deleteFile(filePath) {
19075
19085
  try {
19076
19086
  await fs.unlink(filePath);
19077
- } catch (error2) {
19078
- if (error2.code !== "ENOENT") {
19079
- throw error2;
19087
+ } catch (error) {
19088
+ if (error.code !== "ENOENT") {
19089
+ throw error;
19080
19090
  }
19081
19091
  }
19082
19092
  }
19083
- isUnprocessableEntityError(error2) {
19084
- if (!error2 || typeof error2 !== "object") {
19093
+ isUnprocessableEntityError(error) {
19094
+ if (!error || typeof error !== "object") {
19085
19095
  return false;
19086
19096
  }
19087
- const maybeError = error2;
19097
+ const maybeError = error;
19088
19098
  return maybeError.status === 422 || maybeError.response?.status === 422;
19089
19099
  }
19090
19100
  };
@@ -19331,8 +19341,8 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19331
19341
  partial: null
19332
19342
  });
19333
19343
  break;
19334
- } catch (error2) {
19335
- const statusCode = this.getHttpStatusCode(error2);
19344
+ } catch (error) {
19345
+ const statusCode = this.getHttpStatusCode(error);
19336
19346
  if (statusCode === 404 || statusCode === 502) {
19337
19347
  this.logger.error(`Skipping workflow run ${runId} at page ${page}: jobs endpoint returned ${statusCode}. This run will be marked as processed to avoid blocking the pipeline, but its jobs will not be included.`);
19338
19348
  processedRunIds.add(runId);
@@ -19351,7 +19361,7 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19351
19361
  page
19352
19362
  }
19353
19363
  });
19354
- throw error2;
19364
+ throw error;
19355
19365
  }
19356
19366
  }
19357
19367
  }
@@ -19379,11 +19389,11 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19379
19389
  try {
19380
19390
  const contents = await fs.readFile(filePath, "utf-8");
19381
19391
  return JSON.parse(contents);
19382
- } catch (error2) {
19383
- if (error2.code === "ENOENT") {
19392
+ } catch (error) {
19393
+ if (error.code === "ENOENT") {
19384
19394
  return fallback;
19385
19395
  }
19386
- throw error2;
19396
+ throw error;
19387
19397
  }
19388
19398
  }
19389
19399
  async writeJson(filePath, value) {
@@ -19395,14 +19405,14 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19395
19405
  async deleteFile(filePath) {
19396
19406
  try {
19397
19407
  await fs.unlink(filePath);
19398
- } catch (error2) {
19399
- if (error2.code !== "ENOENT") {
19400
- throw error2;
19408
+ } catch (error) {
19409
+ if (error.code !== "ENOENT") {
19410
+ throw error;
19401
19411
  }
19402
19412
  }
19403
19413
  }
19404
- getHttpStatusCode(error2) {
19405
- const err = error2;
19414
+ getHttpStatusCode(error) {
19415
+ const err = error;
19406
19416
  return err?.status ?? err?.response?.status;
19407
19417
  }
19408
19418
  toDateBoundary(dateValue, boundary = "start") {
@@ -21541,7 +21551,7 @@ var require_filter_resolver = __commonJS({
21541
21551
  exports2.FilterResolver = void 0;
21542
21552
  var index_1 = require_filters();
21543
21553
  var index_2 = require_infrastructure();
21544
- var FilterResolver = class FilterResolver {
21554
+ var FilterResolver2 = class FilterResolver {
21545
21555
  static {
21546
21556
  __name(this, "FilterResolver");
21547
21557
  }
@@ -21677,7 +21687,7 @@ var require_filter_resolver = __commonJS({
21677
21687
  return true;
21678
21688
  }
21679
21689
  };
21680
- exports2.FilterResolver = FilterResolver;
21690
+ exports2.FilterResolver = FilterResolver2;
21681
21691
  }
21682
21692
  });
21683
21693
 
@@ -23460,220 +23470,16 @@ var resourceLogger = new import_utils.Logger("SmmMcpResource", mcpLogLevel);
23460
23470
  var promptLogger = new import_utils.Logger("SmmMcpPrompt", mcpLogLevel);
23461
23471
 
23462
23472
  // src/server.ts
23463
- var import_node_readline = require("node:readline");
23473
+ var import_server2 = require("@modelcontextprotocol/server");
23474
+ var import_stdio = require("@modelcontextprotocol/server/stdio");
23464
23475
  var import_utils5 = __toESM(require_dist());
23465
23476
  var import_core4 = __toESM(require_dist2());
23466
23477
 
23467
- // src/prompts.ts
23468
- var prompts = [
23469
- {
23470
- name: "smm_sprint_health_review",
23471
- description: "Review engineering health for the current sprint and highlight metrics that need attention.",
23472
- arguments: [
23473
- {
23474
- name: "project",
23475
- description: "Optional github_repository project name from smm_config.json.",
23476
- required: false
23477
- },
23478
- {
23479
- name: "startDate",
23480
- description: "Current window start date (YYYY-MM-DD).",
23481
- required: false
23482
- },
23483
- {
23484
- name: "endDate",
23485
- description: "Current window end date (YYYY-MM-DD).",
23486
- required: false
23487
- }
23488
- ]
23489
- },
23490
- {
23491
- name: "smm_compare_windows",
23492
- description: "Compare engineering health between two time windows and summarise what improved or regressed.",
23493
- arguments: [
23494
- {
23495
- name: "project",
23496
- description: "Optional github_repository project name from smm_config.json.",
23497
- required: false
23498
- },
23499
- {
23500
- name: "startDate",
23501
- description: "Current window start date (YYYY-MM-DD).",
23502
- required: true
23503
- },
23504
- {
23505
- name: "endDate",
23506
- description: "Current window end date (YYYY-MM-DD).",
23507
- required: true
23508
- },
23509
- {
23510
- name: "compareStartDate",
23511
- description: "Previous window start date (YYYY-MM-DD).",
23512
- required: true
23513
- },
23514
- {
23515
- name: "compareEndDate",
23516
- description: "Previous window end date (YYYY-MM-DD).",
23517
- required: true
23518
- }
23519
- ]
23520
- },
23521
- {
23522
- name: "smm_dora_summary",
23523
- description: "Summarise DORA metrics for a project, including deployment frequency and failure rate.",
23524
- arguments: [
23525
- {
23526
- name: "project",
23527
- description: "Optional github_repository project name from smm_config.json.",
23528
- required: false
23529
- },
23530
- {
23531
- name: "startDate",
23532
- description: "Optional window start date (YYYY-MM-DD).",
23533
- required: false
23534
- },
23535
- {
23536
- name: "endDate",
23537
- description: "Optional window end date (YYYY-MM-DD).",
23538
- required: false
23539
- }
23540
- ]
23541
- },
23542
- {
23543
- name: "smm_code_hotspots",
23544
- description: "Identify code hotspots (high churn and high coupling files) and pair-programming gaps for a project.",
23545
- arguments: [
23546
- {
23547
- name: "project",
23548
- description: "Optional github_repository project name from smm_config.json.",
23549
- required: false
23550
- },
23551
- {
23552
- name: "startDate",
23553
- description: "Optional window start date (YYYY-MM-DD).",
23554
- required: false
23555
- },
23556
- {
23557
- name: "endDate",
23558
- description: "Optional window end date (YYYY-MM-DD).",
23559
- required: false
23560
- }
23561
- ]
23562
- }
23563
- ];
23564
- function getArg(values, name) {
23565
- const value = values[name];
23566
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
23567
- }
23568
- __name(getArg, "getArg");
23569
- function optional(value) {
23570
- return value ? value : "<not provided>";
23571
- }
23572
- __name(optional, "optional");
23573
- async function getPrompt(name, argumentsValue) {
23574
- promptLogger.debug(`Building prompt ${name}`, {
23575
- arguments: argumentsValue
23576
- });
23577
- const values = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
23578
- const project = getArg(values, "project");
23579
- const startDate = getArg(values, "startDate");
23580
- const endDate = getArg(values, "endDate");
23581
- const compareStartDate = getArg(values, "compareStartDate");
23582
- const compareEndDate = getArg(values, "compareEndDate");
23583
- const messages = [];
23584
- switch (name) {
23585
- case "smm_sprint_health_review":
23586
- messages.push({
23587
- role: "user",
23588
- content: {
23589
- type: "text",
23590
- text: [
23591
- "You are acting as a software engineering coach.",
23592
- "Use the Software Metrics Machine MCP tools to evaluate the engineering health of the project.",
23593
- "",
23594
- `Project: ${optional(project)}`,
23595
- `Current window: ${optional(startDate)} to ${optional(endDate)}`,
23596
- "",
23597
- "Steps:",
23598
- "1. Call smm_get_engineering_health with the filters above.",
23599
- '2. Highlight any metric whose recommendation level is "watch" or "critical".',
23600
- "3. Suggest one concrete action for each degraded metric, grounded in the data returned."
23601
- ].join("\n")
23602
- }
23603
- });
23604
- break;
23605
- case "smm_compare_windows":
23606
- messages.push({
23607
- role: "user",
23608
- content: {
23609
- type: "text",
23610
- text: [
23611
- "You are acting as a software engineering coach.",
23612
- "Use the Software Metrics Machine MCP tools to compare two windows.",
23613
- "",
23614
- `Project: ${optional(project)}`,
23615
- `Current window: ${optional(startDate)} to ${optional(endDate)}`,
23616
- `Previous window: ${optional(compareStartDate)} to ${optional(compareEndDate)}`,
23617
- "",
23618
- "Steps:",
23619
- "1. Call smm_get_engineering_health with startDate, endDate, compareStartDate, and compareEndDate.",
23620
- "2. For each metric, summarise whether the trend is improving, stable, or degrading.",
23621
- "3. Produce a short before/after table and a prioritised list of follow-up actions."
23622
- ].join("\n")
23623
- }
23624
- });
23625
- break;
23626
- case "smm_dora_summary":
23627
- messages.push({
23628
- role: "user",
23629
- content: {
23630
- type: "text",
23631
- text: [
23632
- "You are acting as a DORA metrics analyst.",
23633
- "Use the Software Metrics Machine MCP tools to report DORA metrics.",
23634
- "",
23635
- `Project: ${optional(project)}`,
23636
- `Window: ${optional(startDate)} to ${optional(endDate)}`,
23637
- "",
23638
- "Steps:",
23639
- "1. Call smm_get_dora_metrics with the filters above.",
23640
- "2. Report deployment frequency, failure rate signals, and pipeline duration.",
23641
- "3. Classify the project against the DORA tiers (elite, high, medium, low) where possible."
23642
- ].join("\n")
23643
- }
23644
- });
23645
- break;
23646
- case "smm_code_hotspots":
23647
- messages.push({
23648
- role: "user",
23649
- content: {
23650
- type: "text",
23651
- text: [
23652
- "You are acting as a code health reviewer.",
23653
- "Use the Software Metrics Machine MCP tools to surface code hotspots.",
23654
- "",
23655
- `Project: ${optional(project)}`,
23656
- `Window: ${optional(startDate)} to ${optional(endDate)}`,
23657
- "",
23658
- "Steps:",
23659
- "1. Call smm_get_code_metrics to retrieve churn, coupling, and pairing data.",
23660
- "2. Identify files with the highest churn and strongest coupling.",
23661
- "3. Cross-reference pairing gaps and propose concrete refactoring or pairing actions."
23662
- ].join("\n")
23663
- }
23664
- });
23665
- break;
23666
- default:
23667
- throw new Error(`Unknown MCP prompt: ${name}`);
23668
- }
23669
- return {
23670
- description: prompts.find((prompt) => prompt.name === name)?.description,
23671
- messages
23672
- };
23673
- }
23674
- __name(getPrompt, "getPrompt");
23478
+ // src/registration.ts
23479
+ var import_server = require("@modelcontextprotocol/server");
23480
+ var import_zod = require("zod");
23675
23481
 
23676
- // src/resources.ts
23482
+ // src/tools.ts
23677
23483
  var import_core2 = __toESM(require_dist2());
23678
23484
  var import_utils3 = __toESM(require_dist());
23679
23485
 
@@ -23857,6 +23663,13 @@ function parseDoraMetricsArguments(argumentsValue) {
23857
23663
  "include",
23858
23664
  "flag",
23859
23665
  "exclude"
23666
+ ]),
23667
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23668
+ filter: readString(args.filter, "filter"),
23669
+ period: readEnum(args.period, "period", [
23670
+ "day",
23671
+ "week",
23672
+ "month"
23860
23673
  ])
23861
23674
  };
23862
23675
  }
@@ -23898,7 +23711,9 @@ function parseChangeRequestMetricsArguments(argumentsValue) {
23898
23711
  "include",
23899
23712
  "flag",
23900
23713
  "exclude"
23901
- ])
23714
+ ]),
23715
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23716
+ filter: readString(args.filter, "filter")
23902
23717
  };
23903
23718
  }
23904
23719
  __name(parseChangeRequestMetricsArguments, "parseChangeRequestMetricsArguments");
@@ -23926,6 +23741,13 @@ function parsePipelineDashboardArguments(argumentsValue) {
23926
23741
  "include",
23927
23742
  "flag",
23928
23743
  "exclude"
23744
+ ]),
23745
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23746
+ filter: readString(args.filter, "filter"),
23747
+ period: readEnum(args.period, "period", [
23748
+ "day",
23749
+ "week",
23750
+ "month"
23929
23751
  ])
23930
23752
  };
23931
23753
  }
@@ -23940,7 +23762,9 @@ function parseCodeEntityArguments(argumentsValue) {
23940
23762
  ignorePatterns: readString(args.ignorePatterns, "ignorePatterns"),
23941
23763
  includePatterns: readString(args.includePatterns, "includePatterns"),
23942
23764
  top: readNumber(args.top, "top"),
23943
- authors: readString(args.authors, "authors")
23765
+ authors: readString(args.authors, "authors"),
23766
+ minCoupling: readNumber(args.minCoupling, "minCoupling"),
23767
+ entity: readString(args.entity, "entity")
23944
23768
  };
23945
23769
  }
23946
23770
  __name(parseCodeEntityArguments, "parseCodeEntityArguments");
@@ -23949,7 +23773,11 @@ function parseCodeHistoryArguments(argumentsValue) {
23949
23773
  if (!args) {
23950
23774
  return {};
23951
23775
  }
23952
- return parseMetricsToolArguments(args);
23776
+ return {
23777
+ ...parseMetricsToolArguments(args),
23778
+ authors: readString(args.authors, "authors"),
23779
+ minShared: readNumber(args.minShared, "minShared")
23780
+ };
23953
23781
  }
23954
23782
  __name(parseCodeHistoryArguments, "parseCodeHistoryArguments");
23955
23783
  function parseSonarqubeComponentTreeArguments(argumentsValue) {
@@ -24028,6 +23856,40 @@ function parseHealthCheckArguments(argumentsValue) {
24028
23856
  };
24029
23857
  }
24030
23858
  __name(parseHealthCheckArguments, "parseHealthCheckArguments");
23859
+ function parseSavedFilterListArguments(argumentsValue) {
23860
+ const args = readObject(argumentsValue);
23861
+ if (!args) {
23862
+ return {};
23863
+ }
23864
+ return {
23865
+ project: readString(args.project, "project"),
23866
+ section: readEnum(args.section, "section", [
23867
+ "insights",
23868
+ "pipelines",
23869
+ "change-requests",
23870
+ "source-code",
23871
+ "engineering-health",
23872
+ "architecture",
23873
+ "sonarqube"
23874
+ ])
23875
+ };
23876
+ }
23877
+ __name(parseSavedFilterListArguments, "parseSavedFilterListArguments");
23878
+ function parseSavedFilterGetArguments(argumentsValue) {
23879
+ const args = readObject(argumentsValue);
23880
+ if (!args) {
23881
+ throw new Error("name is required");
23882
+ }
23883
+ const name = readString(args.name, "name");
23884
+ if (!name) {
23885
+ throw new Error("name is required");
23886
+ }
23887
+ return {
23888
+ project: readString(args.project, "project"),
23889
+ name
23890
+ };
23891
+ }
23892
+ __name(parseSavedFilterGetArguments, "parseSavedFilterGetArguments");
24031
23893
  function buildMetricsInputSchema(description) {
24032
23894
  return {
24033
23895
  type: "object",
@@ -24239,11 +24101,28 @@ function buildDoraMetricsInputSchema() {
24239
24101
  "exclude"
24240
24102
  ],
24241
24103
  description: "Outlier handling mode. Defaults to include."
24242
- }
24243
- }
24244
- };
24245
- }
24246
- __name(buildDoraMetricsInputSchema, "buildDoraMetricsInputSchema");
24104
+ },
24105
+ rawFilters: {
24106
+ type: "string",
24107
+ description: "Optional raw provider filter string (e.g. status=success,branch=main). Passed through to the provider."
24108
+ },
24109
+ filter: {
24110
+ type: "string",
24111
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24112
+ },
24113
+ period: {
24114
+ type: "string",
24115
+ enum: [
24116
+ "day",
24117
+ "week",
24118
+ "month"
24119
+ ],
24120
+ description: "Optional DORA rating period: day (elite), week (high), month (medium). Defaults to week."
24121
+ }
24122
+ }
24123
+ };
24124
+ }
24125
+ __name(buildDoraMetricsInputSchema, "buildDoraMetricsInputSchema");
24247
24126
  function buildArchitectureViewInputSchema() {
24248
24127
  return {
24249
24128
  type: "object",
@@ -24353,6 +24232,54 @@ function buildHealthCheckInputSchema() {
24353
24232
  };
24354
24233
  }
24355
24234
  __name(buildHealthCheckInputSchema, "buildHealthCheckInputSchema");
24235
+ function buildSavedFilterListInputSchema() {
24236
+ return {
24237
+ type: "object",
24238
+ description: "Saved filters list filters.",
24239
+ additionalProperties: false,
24240
+ properties: {
24241
+ project: {
24242
+ type: "string",
24243
+ description: "Optional github_repository project name from smm_config.json."
24244
+ },
24245
+ section: {
24246
+ type: "string",
24247
+ enum: [
24248
+ "insights",
24249
+ "pipelines",
24250
+ "change-requests",
24251
+ "source-code",
24252
+ "engineering-health",
24253
+ "architecture",
24254
+ "sonarqube"
24255
+ ],
24256
+ description: "Optional dashboard section filter. Only saved filters in this section are returned."
24257
+ }
24258
+ }
24259
+ };
24260
+ }
24261
+ __name(buildSavedFilterListInputSchema, "buildSavedFilterListInputSchema");
24262
+ function buildSavedFilterGetInputSchema() {
24263
+ return {
24264
+ type: "object",
24265
+ description: "Saved filter lookup by name or id.",
24266
+ additionalProperties: false,
24267
+ required: [
24268
+ "name"
24269
+ ],
24270
+ properties: {
24271
+ project: {
24272
+ type: "string",
24273
+ description: "Optional github_repository project name from smm_config.json."
24274
+ },
24275
+ name: {
24276
+ type: "string",
24277
+ description: "Required saved filter name or id to look up."
24278
+ }
24279
+ }
24280
+ };
24281
+ }
24282
+ __name(buildSavedFilterGetInputSchema, "buildSavedFilterGetInputSchema");
24356
24283
  function buildEvaluationInputSchema(description) {
24357
24284
  return {
24358
24285
  type: "object",
@@ -24458,6 +24385,14 @@ function buildChangeRequestMetricsInputSchema(description) {
24458
24385
  "exclude"
24459
24386
  ],
24460
24387
  description: "Optional outlier handling mode."
24388
+ },
24389
+ rawFilters: {
24390
+ type: "string",
24391
+ description: "Optional raw provider filter string (e.g. status=draft,author=john). Passed through to the provider."
24392
+ },
24393
+ filter: {
24394
+ type: "string",
24395
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24461
24396
  }
24462
24397
  }
24463
24398
  };
@@ -24537,6 +24472,23 @@ function buildPipelineDashboardInputSchema(description) {
24537
24472
  "exclude"
24538
24473
  ],
24539
24474
  description: "Optional outlier handling mode."
24475
+ },
24476
+ rawFilters: {
24477
+ type: "string",
24478
+ description: "Optional raw provider filter string (e.g. status=success,branch=main). Passed through to the provider."
24479
+ },
24480
+ filter: {
24481
+ type: "string",
24482
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24483
+ },
24484
+ period: {
24485
+ type: "string",
24486
+ enum: [
24487
+ "day",
24488
+ "week",
24489
+ "month"
24490
+ ],
24491
+ description: "Optional aggregation period for runs_by time series. Defaults to day (raw per-day)."
24540
24492
  }
24541
24493
  }
24542
24494
  };
@@ -24571,6 +24523,22 @@ function buildCodeEntityInputSchema(description) {
24571
24523
  authors: {
24572
24524
  type: "string",
24573
24525
  description: "Optional comma-separated authors filter (entity ownership only)."
24526
+ },
24527
+ minCoupling: {
24528
+ type: "number",
24529
+ description: "Optional minimum coupling threshold (0-100). Filters coupling relationships below this degree."
24530
+ },
24531
+ entity: {
24532
+ type: "string",
24533
+ description: "Optional entity/file substring filter. Only entities containing this string are returned."
24534
+ },
24535
+ startDate: {
24536
+ type: "string",
24537
+ description: "Optional ISO 8601 start date."
24538
+ },
24539
+ endDate: {
24540
+ type: "string",
24541
+ description: "Optional ISO 8601 end date."
24574
24542
  }
24575
24543
  }
24576
24544
  };
@@ -24597,6 +24565,14 @@ function buildCodeHistoryInputSchema(description) {
24597
24565
  endDate: {
24598
24566
  type: "string",
24599
24567
  description: "Optional ISO 8601 end date."
24568
+ },
24569
+ authors: {
24570
+ type: "string",
24571
+ description: "Optional comma-separated authors filter. When set on code churn, returns per-author churn."
24572
+ },
24573
+ minShared: {
24574
+ type: "number",
24575
+ description: "Optional minimum shared commits for pairing index. Defaults to 0 (all pairs included)."
24600
24576
  }
24601
24577
  }
24602
24578
  };
@@ -24732,13 +24708,13 @@ async function traceOperation(operation, details, task) {
24732
24708
  durationMs: Date.now() - startedAt
24733
24709
  });
24734
24710
  return result;
24735
- } catch (error2) {
24711
+ } catch (error) {
24736
24712
  operationLogger.warn(`Failed ${operation}`, {
24737
24713
  ...details,
24738
24714
  durationMs: Date.now() - startedAt,
24739
- error: error2 instanceof Error ? error2.message : String(error2)
24715
+ error: error instanceof Error ? error.message : String(error)
24740
24716
  });
24741
- throw error2;
24717
+ throw error;
24742
24718
  }
24743
24719
  }
24744
24720
  __name(traceOperation, "traceOperation");
@@ -24758,11 +24734,12 @@ function buildChangeRequestFiltersFromArgs(args) {
24758
24734
  return {
24759
24735
  startDate: args.startDate,
24760
24736
  endDate: args.endDate,
24761
- authors: args.authors,
24762
- excludeAuthors: args.excludeAuthors,
24763
- excludeCommenters: args.excludeCommenters,
24764
- labels: args.labels,
24737
+ authors: args.authors ? parseCsvList(args.authors, "authors") : void 0,
24738
+ excludeAuthors: args.excludeAuthors ? parseCsvList(args.excludeAuthors, "excludeAuthors") : void 0,
24739
+ excludeCommenters: args.excludeCommenters ? parseCsvList(args.excludeCommenters, "excludeCommenters") : void 0,
24740
+ labels: args.labels ? parseCsvList(args.labels, "labels") : void 0,
24765
24741
  state: args.status,
24742
+ rawFilters: args.rawFilters,
24766
24743
  cleaning
24767
24744
  };
24768
24745
  }
@@ -24782,6 +24759,7 @@ function buildPipelineFiltersFromArgs(args) {
24782
24759
  jobName: args.jobName,
24783
24760
  jobConclusion: args.jobConclusion,
24784
24761
  event: args.event,
24762
+ rawFilters: args.rawFilters,
24785
24763
  method: args.method,
24786
24764
  cleaning
24787
24765
  };
@@ -24792,7 +24770,10 @@ function buildCodeEntityFilterOptions(args) {
24792
24770
  ignorePatterns: args.ignorePatterns,
24793
24771
  includePatterns: args.includePatterns,
24794
24772
  top: args.top,
24795
- authors: args.authors
24773
+ authors: args.authors,
24774
+ minCoupling: args.minCoupling,
24775
+ startDate: args.startDate,
24776
+ endDate: args.endDate
24796
24777
  };
24797
24778
  }
24798
24779
  __name(buildCodeEntityFilterOptions, "buildCodeEntityFilterOptions");
@@ -24803,6 +24784,68 @@ function buildCodeChurnOptions(args) {
24803
24784
  };
24804
24785
  }
24805
24786
  __name(buildCodeChurnOptions, "buildCodeChurnOptions");
24787
+ function toPeriodKey(inputPeriod, period) {
24788
+ if (period === "day") {
24789
+ return inputPeriod;
24790
+ }
24791
+ const date = new Date(inputPeriod);
24792
+ if (Number.isNaN(date.getTime())) {
24793
+ return inputPeriod;
24794
+ }
24795
+ if (period === "month") {
24796
+ const year = date.getUTCFullYear();
24797
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
24798
+ return `${year}-${month}`;
24799
+ }
24800
+ const utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
24801
+ const dayOfWeek = utcDate.getUTCDay() || 7;
24802
+ utcDate.setUTCDate(utcDate.getUTCDate() + 4 - dayOfWeek);
24803
+ const isoYear = utcDate.getUTCFullYear();
24804
+ const firstDay = new Date(Date.UTC(isoYear, 0, 1));
24805
+ const week = Math.ceil(((utcDate.getTime() - firstDay.getTime()) / 864e5 + 1) / 7);
24806
+ return `${isoYear}-W${String(week).padStart(2, "0")}`;
24807
+ }
24808
+ __name(toPeriodKey, "toPeriodKey");
24809
+ function aggregateRunsByPeriod(metrics, requestedPeriod) {
24810
+ const period = requestedPeriod || "day";
24811
+ if (period === "day") {
24812
+ return metrics;
24813
+ }
24814
+ const grouped = /* @__PURE__ */ new Map();
24815
+ for (const item of metrics) {
24816
+ const normalizedPeriod = toPeriodKey(item.period, period);
24817
+ const key = `${normalizedPeriod}||${item.workflow}`;
24818
+ grouped.set(key, (grouped.get(key) || 0) + item.runs);
24819
+ }
24820
+ return Array.from(grouped.entries()).map(([key, runs]) => {
24821
+ const [normalizedPeriod, workflow] = key.split("||");
24822
+ return {
24823
+ period: normalizedPeriod,
24824
+ workflow,
24825
+ runs
24826
+ };
24827
+ }).sort((a, b) => {
24828
+ const periodComparison = a.period.localeCompare(b.period);
24829
+ if (periodComparison !== 0) {
24830
+ return periodComparison;
24831
+ }
24832
+ return a.workflow.localeCompare(b.workflow);
24833
+ });
24834
+ }
24835
+ __name(aggregateRunsByPeriod, "aggregateRunsByPeriod");
24836
+ function computeDoraRating(deploymentCounts, period) {
24837
+ if (period === "day" && deploymentCounts.daily_counts >= 1) {
24838
+ return "Elite";
24839
+ }
24840
+ if (period === "week" && deploymentCounts.weekly_counts >= 1) {
24841
+ return "High";
24842
+ }
24843
+ if (period === "month" && deploymentCounts.monthly_counts >= 1) {
24844
+ return "Medium";
24845
+ }
24846
+ return "Low";
24847
+ }
24848
+ __name(computeDoraRating, "computeDoraRating");
24806
24849
  function buildSonarqubeComponentTreeOptions(args) {
24807
24850
  return {
24808
24851
  component: args.component,
@@ -24866,7 +24909,9 @@ var McpMetricsReader = class {
24866
24909
  project: this.configuration.githubRepository,
24867
24910
  startDate: filters.startDate,
24868
24911
  endDate: filters.endDate,
24869
- authors: filters.authors
24912
+ authors: filters.authors,
24913
+ includePatterns: filters.includePatterns,
24914
+ ignorePatterns: filters.ignorePatterns
24870
24915
  }, async () => {
24871
24916
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
24872
24917
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
@@ -24877,7 +24922,8 @@ var McpMetricsReader = class {
24877
24922
  operationLogger.debug("getCodeMetrics: retrieving file coupling");
24878
24923
  const coupling = await codeRepository.getFileCoupling({
24879
24924
  authors: filters.authors ? parseCsvList(filters.authors, "authors") : void 0,
24880
- ...filters
24925
+ includePatterns: filters.includePatterns,
24926
+ ignorePatterns: filters.ignorePatterns
24881
24927
  });
24882
24928
  return {
24883
24929
  pairingIndex: pairing,
@@ -24987,22 +25033,27 @@ var McpMetricsReader = class {
24987
25033
  workflowPath: args.workflowPath,
24988
25034
  branch: args.branch,
24989
25035
  startDate: args.startDate,
24990
- endDate: args.endDate
25036
+ endDate: args.endDate,
25037
+ rawFilters: args.rawFilters,
25038
+ filter: args.filter,
25039
+ period: args.period
24991
25040
  }, async () => {
25041
+ const resolved = await this.resolvePipelineArgs(args);
24992
25042
  const pipelineArtifacts = import_core.PipelineFactory.create(this.configuration, createLogger(this.configuration, "DoraPipelineRepository"), this.timeZoneProvider);
24993
25043
  const cleaning = (0, import_core.parseMetricCleaningOptions)({
24994
25044
  weekends: args.weekends,
24995
25045
  outlierMode: args.outlierMode
24996
25046
  });
24997
25047
  const baseFilters = {
24998
- startDate: args.startDate,
24999
- endDate: args.endDate,
25000
- workflowPath: args.workflowPath,
25001
- status: args.status,
25002
- conclusion: args.conclusion,
25003
- targetBranch: args.branch,
25004
- jobName: args.jobName,
25005
- event: args.event,
25048
+ startDate: resolved.startDate ?? args.startDate,
25049
+ endDate: resolved.endDate ?? args.endDate,
25050
+ workflowPath: resolved.workflowPath ?? args.workflowPath,
25051
+ status: resolved.status ?? args.status,
25052
+ conclusion: resolved.conclusion ?? args.conclusion,
25053
+ targetBranch: resolved.branch ?? args.branch,
25054
+ jobName: resolved.jobName ?? args.jobName,
25055
+ event: resolved.event ?? args.event,
25056
+ rawFilters: resolved.rawFilters ?? args.rawFilters,
25006
25057
  cleaning
25007
25058
  };
25008
25059
  const pipelinesService = new import_core.PipelinesService(pipelineArtifacts.pipelineRepository, this.configuration, createLogger(this.configuration, "DoraPipelinesService"), this.timeZoneProvider);
@@ -25013,9 +25064,15 @@ var McpMetricsReader = class {
25013
25064
  pipelinesService.getMetrics(baseFilters),
25014
25065
  pipelinesService.getJobMetrics(baseFilters)
25015
25066
  ]);
25067
+ const doraRating = computeDoraRating({
25068
+ daily_counts: deploymentFrequency[0]?.daily_counts ?? 0,
25069
+ weekly_counts: deploymentFrequency[0]?.weekly_counts ?? 0,
25070
+ monthly_counts: deploymentFrequency[0]?.monthly_counts ?? 0
25071
+ }, args.period);
25016
25072
  return {
25017
25073
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
25018
25074
  deploymentFrequency,
25075
+ doraRating,
25019
25076
  pipelineMetrics,
25020
25077
  jobMetrics,
25021
25078
  filters: baseFilters
@@ -25122,25 +25179,31 @@ var McpMetricsReader = class {
25122
25179
  project: this.configuration.githubRepository,
25123
25180
  startDate: filters.startDate,
25124
25181
  endDate: filters.endDate,
25125
- authors: filters.authors
25182
+ authors: filters.authors,
25183
+ includePatterns: filters.includePatterns,
25184
+ ignorePatterns: filters.ignorePatterns
25126
25185
  }, async () => {
25127
25186
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25128
25187
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
25129
25188
  const bigOService = new import_core.BigOService(this.configuration);
25130
25189
  const evaluationService = new import_core.CodeEvaluationService();
25190
+ const entityFilterOptions = {
25191
+ includePatterns: filters.includePatterns,
25192
+ ignorePatterns: filters.ignorePatterns,
25193
+ authors: filters.authors
25194
+ };
25131
25195
  const [entityChurn, coupling, entityEffort, churnResult, entityOwnership, pairing, bigOFiles] = await Promise.all([
25132
- codeRepository.getEntityChurn({}),
25196
+ codeRepository.getEntityChurn(entityFilterOptions),
25133
25197
  codeRepository.getFileCoupling({
25198
+ ...entityFilterOptions,
25134
25199
  sortBy: "degree"
25135
25200
  }),
25136
- codeRepository.getEntityEffort({}),
25201
+ codeRepository.getEntityEffort(entityFilterOptions),
25137
25202
  codeRepository.getCodeChurn({
25138
25203
  startDate: filters.startDate,
25139
25204
  endDate: filters.endDate
25140
25205
  }),
25141
- codeRepository.getEntityOwnership({
25142
- authors: filters.authors
25143
- }),
25206
+ codeRepository.getEntityOwnership(entityFilterOptions),
25144
25207
  pairingService.getPairingIndex(filters).catch(() => null),
25145
25208
  bigOService.listFiles({
25146
25209
  limit: 200
@@ -25343,10 +25406,12 @@ var McpMetricsReader = class {
25343
25406
  project: this.configuration.githubRepository,
25344
25407
  startDate: args.startDate,
25345
25408
  endDate: args.endDate,
25346
- status: args.status
25409
+ status: args.status,
25410
+ filter: args.filter
25347
25411
  }, async () => {
25412
+ const resolved = await this.resolveChangeRequestArgs(args);
25348
25413
  const service = this.createChangeRequestsService();
25349
- return service.getSummary(buildChangeRequestFiltersFromArgs(args));
25414
+ return service.getSummary(buildChangeRequestFiltersFromArgs(resolved));
25350
25415
  });
25351
25416
  }
25352
25417
  async getChangeRequestThroughTime(args) {
@@ -25354,10 +25419,12 @@ var McpMetricsReader = class {
25354
25419
  project: this.configuration.githubRepository,
25355
25420
  startDate: args.startDate,
25356
25421
  endDate: args.endDate,
25357
- aggregateBy: args.aggregateBy
25422
+ aggregateBy: args.aggregateBy,
25423
+ filter: args.filter
25358
25424
  }, async () => {
25425
+ const resolved = await this.resolveChangeRequestArgs(args);
25359
25426
  const service = this.createChangeRequestsService();
25360
- return service.getThroughTime(buildChangeRequestFiltersFromArgs(args), args.aggregateBy);
25427
+ return service.getThroughTime(buildChangeRequestFiltersFromArgs(resolved), args.aggregateBy);
25361
25428
  });
25362
25429
  }
25363
25430
  async getChangeRequestByAuthor(args) {
@@ -25377,10 +25444,12 @@ var McpMetricsReader = class {
25377
25444
  startDate: args.startDate,
25378
25445
  endDate: args.endDate,
25379
25446
  method: args.method,
25380
- top: args.top
25447
+ top: args.top,
25448
+ filter: args.filter
25381
25449
  }, async () => {
25450
+ const resolved = await this.resolveChangeRequestArgs(args);
25382
25451
  const service = this.createChangeRequestsService();
25383
- return service.getReviewTime(buildChangeRequestFiltersFromArgs(args), args.top ?? 10, args.method ?? "average");
25452
+ return service.getReviewTime(buildChangeRequestFiltersFromArgs(resolved), args.top ?? 10, args.method ?? "average");
25384
25453
  });
25385
25454
  }
25386
25455
  async getChangeRequestOpenTime(args) {
@@ -25389,10 +25458,12 @@ var McpMetricsReader = class {
25389
25458
  startDate: args.startDate,
25390
25459
  endDate: args.endDate,
25391
25460
  aggregateBy: args.aggregateBy,
25392
- method: args.method
25461
+ method: args.method,
25462
+ filter: args.filter
25393
25463
  }, async () => {
25464
+ const resolved = await this.resolveChangeRequestArgs(args);
25394
25465
  const service = this.createChangeRequestsService();
25395
- return service.getOpenTimeBy(buildChangeRequestFiltersFromArgs(args), args.aggregateBy, args.method ?? "average");
25466
+ return service.getOpenTimeBy(buildChangeRequestFiltersFromArgs(resolved), args.aggregateBy, args.method ?? "average");
25396
25467
  });
25397
25468
  }
25398
25469
  async getChangeRequestComments(args) {
@@ -25400,10 +25471,19 @@ var McpMetricsReader = class {
25400
25471
  project: this.configuration.githubRepository,
25401
25472
  startDate: args.startDate,
25402
25473
  endDate: args.endDate,
25403
- method: args.method
25474
+ method: args.method,
25475
+ aggregateBy: args.aggregateBy,
25476
+ filter: args.filter
25404
25477
  }, async () => {
25478
+ const resolved = await this.resolveChangeRequestArgs(args);
25405
25479
  const service = this.createChangeRequestsService();
25406
- return service.getMetrics(buildChangeRequestFiltersFromArgs(args), args.method ?? "average");
25480
+ const filters = buildChangeRequestFiltersFromArgs(resolved);
25481
+ const method = args.method ?? "average";
25482
+ if (args.aggregateBy) {
25483
+ const mode = args.aggregateBy.toLowerCase();
25484
+ return mode === "month" ? service.getMetricsByMonth(filters, method) : service.getMetricsByWeek(filters, method);
25485
+ }
25486
+ return service.getMetrics(filters, method);
25407
25487
  });
25408
25488
  }
25409
25489
  async getChangeRequestCommentsByAuthor(args) {
@@ -25429,6 +25509,32 @@ var McpMetricsReader = class {
25429
25509
  return service.getFirstCommentTime(buildChangeRequestFiltersFromArgs(args), args.top ?? 10, args.method ?? "average");
25430
25510
  });
25431
25511
  }
25512
+ async getChangeRequestMetricsByMonth(args) {
25513
+ return traceOperation("getChangeRequestMetricsByMonth", {
25514
+ project: this.configuration.githubRepository,
25515
+ startDate: args.startDate,
25516
+ endDate: args.endDate,
25517
+ method: args.method,
25518
+ filter: args.filter
25519
+ }, async () => {
25520
+ const resolved = await this.resolveChangeRequestArgs(args);
25521
+ const service = this.createChangeRequestsService();
25522
+ return service.getMetricsByMonth(buildChangeRequestFiltersFromArgs(resolved), args.method ?? "average");
25523
+ });
25524
+ }
25525
+ async getChangeRequestMetricsByWeek(args) {
25526
+ return traceOperation("getChangeRequestMetricsByWeek", {
25527
+ project: this.configuration.githubRepository,
25528
+ startDate: args.startDate,
25529
+ endDate: args.endDate,
25530
+ method: args.method,
25531
+ filter: args.filter
25532
+ }, async () => {
25533
+ const resolved = await this.resolveChangeRequestArgs(args);
25534
+ const service = this.createChangeRequestsService();
25535
+ return service.getMetricsByWeek(buildChangeRequestFiltersFromArgs(resolved), args.method ?? "average");
25536
+ });
25537
+ }
25432
25538
  async getPipelineDashboard(args) {
25433
25539
  return traceOperation("getPipelineDashboard", {
25434
25540
  project: this.configuration.githubRepository,
@@ -25436,23 +25542,35 @@ var McpMetricsReader = class {
25436
25542
  endDate: args.endDate,
25437
25543
  workflowPath: args.workflowPath,
25438
25544
  branch: args.branch,
25439
- method: args.method
25545
+ method: args.method,
25546
+ filter: args.filter,
25547
+ period: args.period
25440
25548
  }, async () => {
25549
+ const resolved = await this.resolvePipelineArgs(args);
25441
25550
  const pipelineArtifacts = import_core.PipelineFactory.create(this.configuration, createLogger(this.configuration, "PipelineDashboardRepository"), this.timeZoneProvider);
25442
25551
  const pipelineImpl = new import_core.PipelineImplementation(pipelineArtifacts.pipelineRepository, this.configuration.getDeploymentFrequencyTargets(), createLogger(this.configuration, "PipelineDashboardImplementation"), this.timeZoneProvider);
25443
- return pipelineImpl.dashboard(buildPipelineFiltersFromArgs(args));
25552
+ const dashboard = await pipelineImpl.dashboard(buildPipelineFiltersFromArgs(resolved));
25553
+ if (args.period && args.period !== "day") {
25554
+ return {
25555
+ ...dashboard,
25556
+ runs_by: aggregateRunsByPeriod(dashboard.runs_by, args.period)
25557
+ };
25558
+ }
25559
+ return dashboard;
25444
25560
  });
25445
25561
  }
25446
25562
  async getCodePairingIndex(args) {
25447
25563
  return traceOperation("getCodePairingIndex", {
25448
25564
  project: this.configuration.githubRepository,
25449
25565
  startDate: args.startDate,
25450
- endDate: args.endDate
25566
+ endDate: args.endDate,
25567
+ minShared: args.minShared
25451
25568
  }, async () => {
25452
25569
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
25453
25570
  return pairingService.getPairingIndex({
25454
25571
  startDate: args.startDate,
25455
- endDate: args.endDate
25572
+ endDate: args.endDate,
25573
+ minShared: args.minShared
25456
25574
  });
25457
25575
  });
25458
25576
  }
@@ -25460,9 +25578,21 @@ var McpMetricsReader = class {
25460
25578
  return traceOperation("getCodeChurn", {
25461
25579
  project: this.configuration.githubRepository,
25462
25580
  startDate: args.startDate,
25463
- endDate: args.endDate
25581
+ endDate: args.endDate,
25582
+ authors: args.authors
25464
25583
  }, async () => {
25465
25584
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25585
+ if (args.authors) {
25586
+ const codemaatService = new import_core.CodemaatService(codeRepository);
25587
+ const authors = parseCsvList(args.authors, "authors");
25588
+ return {
25589
+ authorChurn: await codemaatService.getAuthorChurn({
25590
+ startDate: args.startDate,
25591
+ endDate: args.endDate,
25592
+ authors
25593
+ })
25594
+ };
25595
+ }
25466
25596
  return codeRepository.getCodeChurn(buildCodeChurnOptions(args));
25467
25597
  });
25468
25598
  }
@@ -25554,10 +25684,16 @@ var McpMetricsReader = class {
25554
25684
  }
25555
25685
  async getCodeEntityOwnership(args) {
25556
25686
  return traceOperation("getCodeEntityOwnership", {
25557
- project: this.configuration.githubRepository
25687
+ project: this.configuration.githubRepository,
25688
+ entity: args.entity
25558
25689
  }, async () => {
25559
25690
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25560
- return codeRepository.getEntityOwnership(buildCodeEntityFilterOptions(args));
25691
+ const ownership = await codeRepository.getEntityOwnership(buildCodeEntityFilterOptions(args));
25692
+ if (args.entity) {
25693
+ const records = ownership;
25694
+ return records.filter((row) => row.entity.includes(args.entity));
25695
+ }
25696
+ return ownership;
25561
25697
  });
25562
25698
  }
25563
25699
  async getCodeEntityOwnershipHistory(args) {
@@ -25648,17 +25784,17 @@ var McpMetricsReader = class {
25648
25784
  };
25649
25785
  });
25650
25786
  }
25651
- async listSavedFilters() {
25787
+ async listSavedFilters(args) {
25652
25788
  return traceOperation("listSavedFilters", {
25653
- project: this.configuration.githubRepository
25789
+ project: this.configuration.githubRepository,
25790
+ section: args?.section
25654
25791
  }, async () => {
25655
25792
  const baseDir = this.configuration.getBaseDirectory();
25656
25793
  const adapter = new import_core.FileSystemSavedFiltersAdapter(baseDir);
25657
25794
  const store = new import_core.SavedFiltersStore(adapter);
25658
- const [filters, reports] = await Promise.all([
25659
- store.getAll(),
25660
- store.getReports()
25661
- ]);
25795
+ const section = args?.section;
25796
+ const filters = section ? await store.getBySection(section) : await store.getAll();
25797
+ const reports = await store.getReports();
25662
25798
  return {
25663
25799
  version: 1,
25664
25800
  filters,
@@ -25666,10 +25802,39 @@ var McpMetricsReader = class {
25666
25802
  };
25667
25803
  });
25668
25804
  }
25805
+ async getSavedFilter(args) {
25806
+ return traceOperation("getSavedFilter", {
25807
+ project: this.configuration.githubRepository,
25808
+ name: args.name
25809
+ }, async () => {
25810
+ const resolver = new import_core.FilterResolver();
25811
+ const entry = await resolver.showFilter(this.configuration, args.name);
25812
+ if (!entry) {
25813
+ return null;
25814
+ }
25815
+ return entry;
25816
+ });
25817
+ }
25669
25818
  createChangeRequestsService() {
25670
25819
  const repository = import_core.ChangeRequestFactory.create(this.configuration, createLogger(this.configuration, "ChangeRequestsRepository"), this.timeZoneProvider);
25671
25820
  return new import_core.ChangeRequestsService(repository, this.timeZoneProvider, createLogger(this.configuration, "ChangeRequestsService"));
25672
25821
  }
25822
+ async resolveChangeRequestArgs(args) {
25823
+ if (!args.filter) {
25824
+ return args;
25825
+ }
25826
+ const resolver = new import_core.FilterResolver();
25827
+ const merged = await resolver.resolveSavedFilterOptions(this.configuration, "change-requests", args);
25828
+ return merged;
25829
+ }
25830
+ async resolvePipelineArgs(args) {
25831
+ if (!args.filter) {
25832
+ return args;
25833
+ }
25834
+ const resolver = new import_core.FilterResolver();
25835
+ const merged = await resolver.resolveSavedFilterOptions(this.configuration, "pipelines", args);
25836
+ return merged;
25837
+ }
25673
25838
  };
25674
25839
  function viewToMermaid(view) {
25675
25840
  const lines = [
@@ -25723,485 +25888,59 @@ function redactSecrets(value) {
25723
25888
  }
25724
25889
  __name(redactSecrets, "redactSecrets");
25725
25890
 
25726
- // src/resources.ts
25727
- function getConfigurationRepository() {
25728
- return new import_core2.ConfigurationRepository(process.env, void 0, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
25729
- }
25730
- __name(getConfigurationRepository, "getConfigurationRepository");
25731
- function encodeProject(project) {
25732
- return encodeURIComponent(project);
25733
- }
25734
- __name(encodeProject, "encodeProject");
25735
- function decodeProject(project) {
25736
- return decodeURIComponent(project);
25737
- }
25738
- __name(decodeProject, "decodeProject");
25739
- function jsonResource(uri, value) {
25891
+ // src/tools.ts
25892
+ function asToolResult(value) {
25740
25893
  return {
25741
- contents: [
25894
+ content: [
25742
25895
  {
25743
- uri,
25744
- mimeType: "application/json",
25896
+ type: "text",
25745
25897
  text: JSON.stringify(value, null, 2)
25746
25898
  }
25747
- ]
25899
+ ],
25900
+ structuredContent: value
25748
25901
  };
25749
25902
  }
25750
- __name(jsonResource, "jsonResource");
25751
- function listResourceTemplates() {
25752
- return [
25753
- {
25754
- uriTemplate: "smm://project/{project}/engineering-health",
25755
- name: "Project engineering health",
25756
- description: "Full engineering health evaluation (delivery, quality, collaboration, architecture) for a project.",
25757
- mimeType: "application/json"
25758
- },
25759
- {
25760
- uriTemplate: "smm://project/{project}/dora",
25761
- name: "Project DORA metrics",
25762
- description: "DORA and pipeline metrics for a project.",
25763
- mimeType: "application/json"
25764
- },
25765
- {
25766
- uriTemplate: "smm://project/{project}/architecture/snapshots",
25767
- name: "Project architecture snapshots",
25768
- description: "List of architecture snapshots stored for a project.",
25769
- mimeType: "application/json"
25770
- },
25771
- {
25772
- uriTemplate: "smm://project/{project}/architecture/summary",
25773
- name: "Project architecture summary",
25774
- description: "Architecture snapshot metadata for the latest snapshot of a project.",
25775
- mimeType: "application/json"
25776
- },
25777
- {
25778
- uriTemplate: "smm://project/{project}/pipeline-dashboard",
25779
- name: "Project pipeline dashboard",
25780
- description: "Full pipeline dashboard for a project.",
25781
- mimeType: "application/json"
25903
+ __name(asToolResult, "asToolResult");
25904
+ function getReader(argumentsValue) {
25905
+ const args = parseMetricsToolArguments(argumentsValue);
25906
+ return {
25907
+ args,
25908
+ reader: createMcpMetricsReader({
25909
+ project: args.project,
25910
+ timezone: args.timezone
25911
+ })
25912
+ };
25913
+ }
25914
+ __name(getReader, "getReader");
25915
+ var tools = [
25916
+ {
25917
+ name: "smm_list_projects",
25918
+ description: "List configured Software Metrics Machine projects from smm_config.json, including git provider and repository.",
25919
+ inputSchema: {
25920
+ type: "object",
25921
+ additionalProperties: false,
25922
+ properties: {}
25782
25923
  },
25783
- {
25784
- uriTemplate: "smm://project/{project}/evaluation/change-requests",
25785
- name: "Project change request evaluation",
25786
- description: "Change request health evaluation for a project.",
25787
- mimeType: "application/json"
25788
- },
25789
- {
25790
- uriTemplate: "smm://project/{project}/evaluation/pipelines",
25791
- name: "Project pipeline evaluation",
25792
- description: "Pipeline health evaluation for a project.",
25793
- mimeType: "application/json"
25794
- },
25795
- {
25796
- uriTemplate: "smm://project/{project}/evaluation/code",
25797
- name: "Project code evaluation",
25798
- description: "Code health evaluation for a project.",
25799
- mimeType: "application/json"
25800
- },
25801
- {
25802
- uriTemplate: "smm://project/{project}/evaluation/quality",
25803
- name: "Project quality evaluation",
25804
- description: "SonarQube quality evaluation for a project.",
25805
- mimeType: "application/json"
25806
- },
25807
- {
25808
- uriTemplate: "smm://project/{project}/evaluation/architecture",
25809
- name: "Project architecture evaluation",
25810
- description: "Architecture health evaluation for a project.",
25811
- mimeType: "application/json"
25812
- },
25813
- {
25814
- uriTemplate: "smm://project/{project}/big-o",
25815
- name: "Project Big-O files",
25816
- description: "Big-O complexity classification for source files in a project.",
25817
- mimeType: "application/json"
25818
- },
25819
- {
25820
- uriTemplate: "smm://project/{project}/health-check",
25821
- name: "Project health check",
25822
- description: "Dataset health report for a project.",
25823
- mimeType: "application/json"
25824
- },
25825
- {
25826
- uriTemplate: "smm://project/{project}/saved-filters",
25827
- name: "Project saved filters",
25828
- description: "Saved filters and reports for a project.",
25829
- mimeType: "application/json"
25830
- },
25831
- {
25832
- uriTemplate: "smm://project/{project}/sonarqube/measurements",
25833
- name: "Project SonarQube measurements",
25834
- description: "Latest SonarQube measurements for a project.",
25835
- mimeType: "application/json"
25836
- },
25837
- {
25838
- uriTemplate: "smm://project/{project}/sonarqube/measurements/history",
25839
- name: "Project SonarQube measurements history",
25840
- description: "Timestamped SonarQube measurement entries for a project.",
25841
- mimeType: "application/json"
25842
- },
25843
- {
25844
- uriTemplate: "smm://project/{project}/sonarqube/component-tree",
25845
- name: "Project SonarQube component tree",
25846
- description: "SonarQube component tree with metrics for a project.",
25847
- mimeType: "application/json"
25848
- },
25849
- {
25850
- uriTemplate: "smm://project/{project}/sonarqube/component-tree/history",
25851
- name: "Project SonarQube component tree history",
25852
- description: "Timestamped SonarQube component tree entries for a project.",
25853
- mimeType: "application/json"
25854
- }
25855
- ];
25856
- }
25857
- __name(listResourceTemplates, "listResourceTemplates");
25858
- function listResources() {
25859
- const repository = getConfigurationRepository();
25860
- const projects = repository.getAllProjectNames();
25861
- return [
25862
- {
25863
- uri: "smm://projects",
25864
- name: "SMM projects",
25865
- description: "Configured Software Metrics Machine projects.",
25866
- mimeType: "application/json"
25867
- },
25868
- {
25869
- uri: "smm://engineering-health/metrics",
25870
- name: "Engineering health metric catalog",
25871
- description: "Metric ids, categories, and labels available for engineering health evaluations.",
25872
- mimeType: "application/json"
25873
- },
25874
- ...projects.flatMap((project) => [
25875
- {
25876
- uri: `smm://project/${encodeProject(project)}/configuration`,
25877
- name: `${project} configuration`,
25878
- description: "Redacted project configuration.",
25879
- mimeType: "application/json"
25880
- },
25881
- {
25882
- uri: `smm://project/${encodeProject(project)}/report`,
25883
- name: `${project} report`,
25884
- description: "Complete metrics report for the project.",
25885
- mimeType: "application/json"
25886
- },
25887
- {
25888
- uri: `smm://project/${encodeProject(project)}/engineering-health`,
25889
- name: `${project} engineering health`,
25890
- description: "Engineering health evaluation for the project.",
25891
- mimeType: "application/json"
25892
- },
25893
- {
25894
- uri: `smm://project/${encodeProject(project)}/dora`,
25895
- name: `${project} DORA metrics`,
25896
- description: "DORA and pipeline metrics for the project.",
25897
- mimeType: "application/json"
25898
- },
25899
- {
25900
- uri: `smm://project/${encodeProject(project)}/architecture/snapshots`,
25901
- name: `${project} architecture snapshots`,
25902
- description: "Architecture snapshots stored for the project.",
25903
- mimeType: "application/json"
25904
- },
25905
- {
25906
- uri: `smm://project/${encodeProject(project)}/evaluation/change-requests`,
25907
- name: `${project} change request evaluation`,
25908
- description: "Change request health evaluation for the project.",
25909
- mimeType: "application/json"
25910
- },
25911
- {
25912
- uri: `smm://project/${encodeProject(project)}/evaluation/pipelines`,
25913
- name: `${project} pipeline evaluation`,
25914
- description: "Pipeline health evaluation for the project.",
25915
- mimeType: "application/json"
25916
- },
25917
- {
25918
- uri: `smm://project/${encodeProject(project)}/evaluation/code`,
25919
- name: `${project} code evaluation`,
25920
- description: "Code health evaluation for the project.",
25921
- mimeType: "application/json"
25922
- },
25923
- {
25924
- uri: `smm://project/${encodeProject(project)}/evaluation/quality`,
25925
- name: `${project} quality evaluation`,
25926
- description: "SonarQube quality evaluation for the project.",
25927
- mimeType: "application/json"
25928
- },
25929
- {
25930
- uri: `smm://project/${encodeProject(project)}/evaluation/architecture`,
25931
- name: `${project} architecture evaluation`,
25932
- description: "Architecture health evaluation for the project.",
25933
- mimeType: "application/json"
25934
- },
25935
- {
25936
- uri: `smm://project/${encodeProject(project)}/big-o`,
25937
- name: `${project} Big-O files`,
25938
- description: "Big-O complexity classification for source files.",
25939
- mimeType: "application/json"
25940
- },
25941
- {
25942
- uri: `smm://project/${encodeProject(project)}/health-check`,
25943
- name: `${project} health check`,
25944
- description: "Dataset health report for the project.",
25945
- mimeType: "application/json"
25946
- },
25947
- {
25948
- uri: `smm://project/${encodeProject(project)}/architecture/summary`,
25949
- name: `${project} architecture summary`,
25950
- description: "Architecture snapshot metadata for the latest snapshot.",
25951
- mimeType: "application/json"
25952
- },
25953
- {
25954
- uri: `smm://project/${encodeProject(project)}/pipeline-dashboard`,
25955
- name: `${project} pipeline dashboard`,
25956
- description: "Full pipeline dashboard for the project.",
25957
- mimeType: "application/json"
25958
- },
25959
- {
25960
- uri: `smm://project/${encodeProject(project)}/saved-filters`,
25961
- name: `${project} saved filters`,
25962
- description: "Saved filters and reports for the project.",
25963
- mimeType: "application/json"
25964
- },
25965
- {
25966
- uri: `smm://project/${encodeProject(project)}/sonarqube/measurements`,
25967
- name: `${project} SonarQube measurements`,
25968
- description: "Latest SonarQube measurements for the project.",
25969
- mimeType: "application/json"
25970
- },
25971
- {
25972
- uri: `smm://project/${encodeProject(project)}/sonarqube/measurements/history`,
25973
- name: `${project} SonarQube measurements history`,
25974
- description: "Timestamped SonarQube measurement entries for the project.",
25975
- mimeType: "application/json"
25976
- },
25977
- {
25978
- uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree`,
25979
- name: `${project} SonarQube component tree`,
25980
- description: "SonarQube component tree with metrics for the project.",
25981
- mimeType: "application/json"
25982
- },
25983
- {
25984
- uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree/history`,
25985
- name: `${project} SonarQube component tree history`,
25986
- description: "Timestamped SonarQube component tree entries for the project.",
25987
- mimeType: "application/json"
25988
- }
25989
- ])
25990
- ];
25991
- }
25992
- __name(listResources, "listResources");
25993
- async function readResource(uri) {
25994
- const resourceStartedAt = Date.now();
25995
- resourceLogger.debug(`Reading resource ${uri}`);
25996
- const repository = getConfigurationRepository();
25997
- if (uri === "smm://projects") {
25998
- resourceLogger.debug("Listing projects for resource smm://projects");
25999
- const result = jsonResource(uri, {
26000
- projects: repository.getAllProjects().map((project2) => ({
26001
- github_repository: project2.github_repository,
26002
- git_provider: project2.git_provider
26003
- }))
26004
- });
26005
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26006
- return result;
26007
- }
26008
- if (uri === "smm://engineering-health/metrics") {
26009
- resourceLogger.debug("Returning engineering health metric catalog");
26010
- const result = jsonResource(uri, {
26011
- categories: [
26012
- "delivery",
26013
- "quality",
26014
- "collaboration",
26015
- "architecture"
26016
- ],
26017
- metrics: listEngineeringHealthMetricCatalog()
26018
- });
26019
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26020
- return result;
26021
- }
26022
- const match = uri.match(/^smm:\/\/project\/([^/]+)\/(configuration|report|engineering-health|dora|architecture\/snapshots|architecture\/summary|evaluation\/(change-requests|pipelines|code|quality|architecture)|big-o|health-check|pipeline-dashboard|saved-filters|sonarqube\/(measurements|measurements\/history|component-tree|component-tree\/history))$/);
26023
- if (!match) {
26024
- resourceLogger.warn(`Unknown MCP resource requested: ${uri}`);
26025
- throw new Error(`Unknown MCP resource: ${uri}`);
26026
- }
26027
- const projectName = decodeProject(match[1]);
26028
- const resourceType = match[2];
26029
- resourceLogger.debug(`Resolved resource ${uri}`, {
26030
- projectName,
26031
- resourceType
26032
- });
26033
- const project = repository.getProjectByName(projectName);
26034
- if (!project) {
26035
- resourceLogger.warn(`Unknown project for resource ${uri}: ${projectName}`);
26036
- throw new Error(`Unknown project: ${projectName}`);
26037
- }
26038
- if (resourceType === "configuration") {
26039
- resourceLogger.debug(`Returning redacted configuration for ${projectName}`);
26040
- const result = jsonResource(uri, redactSecrets(project));
26041
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26042
- return result;
26043
- }
26044
- const reader = createMcpMetricsReader({
26045
- project: projectName
26046
- });
26047
- if (resourceType === "report") {
26048
- const result = jsonResource(uri, await reader.getFullReport());
26049
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26050
- return result;
26051
- }
26052
- if (resourceType === "engineering-health") {
26053
- const result = jsonResource(uri, await reader.getEngineeringHealthEvaluation({
26054
- project: projectName
26055
- }));
26056
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26057
- return result;
26058
- }
26059
- if (resourceType === "dora") {
26060
- const result = jsonResource(uri, await reader.getDoraMetrics({
26061
- project: projectName
26062
- }));
26063
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26064
- return result;
26065
- }
26066
- if (resourceType === "evaluation/change-requests") {
26067
- const result = jsonResource(uri, await reader.evaluateChangeRequests());
26068
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26069
- return result;
26070
- }
26071
- if (resourceType === "evaluation/pipelines") {
26072
- const result = jsonResource(uri, await reader.evaluatePipelines());
26073
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26074
- return result;
26075
- }
26076
- if (resourceType === "evaluation/code") {
26077
- const result = jsonResource(uri, await reader.evaluateCode());
26078
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26079
- return result;
26080
- }
26081
- if (resourceType === "evaluation/quality") {
26082
- const result = jsonResource(uri, await reader.evaluateQuality());
26083
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26084
- return result;
26085
- }
26086
- if (resourceType === "evaluation/architecture") {
26087
- const result = jsonResource(uri, await reader.evaluateArchitecture({
26088
- project: projectName
26089
- }));
26090
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26091
- return result;
26092
- }
26093
- if (resourceType === "big-o") {
26094
- const result = jsonResource(uri, await reader.listBigOFiles());
26095
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26096
- return result;
26097
- }
26098
- if (resourceType === "health-check") {
26099
- const result = jsonResource(uri, await reader.healthCheck());
26100
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26101
- return result;
26102
- }
26103
- if (resourceType === "architecture/summary") {
26104
- const result = jsonResource(uri, await reader.getArchitectureSummary());
26105
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26106
- return result;
26107
- }
26108
- if (resourceType === "pipeline-dashboard") {
26109
- const result = jsonResource(uri, await reader.getPipelineDashboard({
26110
- project: projectName
26111
- }));
26112
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26113
- return result;
26114
- }
26115
- if (resourceType === "saved-filters") {
26116
- const result = jsonResource(uri, await reader.listSavedFilters());
26117
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26118
- return result;
26119
- }
26120
- if (resourceType === "sonarqube/measurements") {
26121
- const result = jsonResource(uri, await reader.getSonarqubeMeasurements());
26122
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26123
- return result;
26124
- }
26125
- if (resourceType === "sonarqube/measurements/history") {
26126
- const result = jsonResource(uri, await reader.getSonarqubeMeasurementsHistory());
26127
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26128
- return result;
26129
- }
26130
- if (resourceType === "sonarqube/component-tree") {
26131
- const result = jsonResource(uri, await reader.getSonarqubeComponentTree({
26132
- project: projectName
26133
- }));
26134
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26135
- return result;
26136
- }
26137
- if (resourceType === "sonarqube/component-tree/history") {
26138
- const result = jsonResource(uri, await reader.getSonarqubeComponentTreeHistory({
26139
- project: projectName
26140
- }));
26141
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26142
- return result;
26143
- }
26144
- const snapshotsResult = jsonResource(uri, await reader.listArchitectureSnapshots());
26145
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26146
- return snapshotsResult;
26147
- }
26148
- __name(readResource, "readResource");
26149
-
26150
- // src/tools.ts
26151
- var import_core3 = __toESM(require_dist2());
26152
- var import_utils4 = __toESM(require_dist());
26153
- function asToolResult(value) {
26154
- return {
26155
- content: [
26156
- {
26157
- type: "text",
26158
- text: JSON.stringify(value, null, 2)
26159
- }
26160
- ],
26161
- structuredContent: value
26162
- };
26163
- }
26164
- __name(asToolResult, "asToolResult");
26165
- function getReader(argumentsValue) {
26166
- const args = parseMetricsToolArguments(argumentsValue);
26167
- return {
26168
- args,
26169
- reader: createMcpMetricsReader({
26170
- project: args.project,
26171
- timezone: args.timezone
26172
- })
26173
- };
26174
- }
26175
- __name(getReader, "getReader");
26176
- var tools = [
26177
- {
26178
- name: "smm_list_projects",
26179
- description: "List configured Software Metrics Machine projects from smm_config.json, including git provider and repository.",
26180
- inputSchema: {
26181
- type: "object",
26182
- additionalProperties: false,
26183
- properties: {}
26184
- },
26185
- async handler() {
26186
- toolLogger.debug("smm_list_projects: loading project list from smm_config.json");
26187
- const repository = new import_core3.ConfigurationRepository(process.env, void 0, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26188
- const projects = repository.getAllProjects().map((project) => ({
26189
- github_repository: project.github_repository,
26190
- git_provider: project.git_provider
26191
- }));
26192
- toolLogger.debug(`smm_list_projects: found ${projects.length} projects`);
26193
- return asToolResult({
26194
- projects
26195
- });
26196
- }
26197
- },
26198
- {
26199
- name: "smm_list_engineering_health_metrics",
26200
- description: "List the available engineering health metric ids, categories, and labels. Use this to discover which metric ids can be passed to smm_get_engineering_health.",
26201
- inputSchema: {
26202
- type: "object",
26203
- additionalProperties: false,
26204
- properties: {}
25924
+ async handler() {
25925
+ toolLogger.debug("smm_list_projects: loading project list from smm_config.json");
25926
+ const repository = new import_core2.ConfigurationRepository(process.env, void 0, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
25927
+ const projects = repository.getAllProjects().map((project) => ({
25928
+ github_repository: project.github_repository,
25929
+ git_provider: project.git_provider
25930
+ }));
25931
+ toolLogger.debug(`smm_list_projects: found ${projects.length} projects`);
25932
+ return asToolResult({
25933
+ projects
25934
+ });
25935
+ }
25936
+ },
25937
+ {
25938
+ name: "smm_list_engineering_health_metrics",
25939
+ description: "List the available engineering health metric ids, categories, and labels. Use this to discover which metric ids can be passed to smm_get_engineering_health.",
25940
+ inputSchema: {
25941
+ type: "object",
25942
+ additionalProperties: false,
25943
+ properties: {}
26205
25944
  },
26206
25945
  async handler() {
26207
25946
  toolLogger.debug("smm_list_engineering_health_metrics: returning metric catalog");
@@ -26253,7 +25992,9 @@ var tools = [
26253
25992
  return asToolResult(await reader.getCodeMetrics({
26254
25993
  startDate: parsed.startDate,
26255
25994
  endDate: parsed.endDate,
26256
- authors: parsed.authors
25995
+ authors: parsed.authors,
25996
+ includePatterns: parsed.includePatterns,
25997
+ ignorePatterns: parsed.ignorePatterns
26257
25998
  }));
26258
25999
  }
26259
26000
  },
@@ -26382,7 +26123,9 @@ var tools = [
26382
26123
  return asToolResult(await reader.evaluateCode({
26383
26124
  startDate: parsed.startDate,
26384
26125
  endDate: parsed.endDate,
26385
- authors: parsed.authors
26126
+ authors: parsed.authors,
26127
+ includePatterns: parsed.includePatterns,
26128
+ ignorePatterns: parsed.ignorePatterns
26386
26129
  }));
26387
26130
  }
26388
26131
  },
@@ -26471,7 +26214,7 @@ var tools = [
26471
26214
  },
26472
26215
  async handler() {
26473
26216
  return asToolResult({
26474
- version: (0, import_utils4.getApplicationVersion)(),
26217
+ version: (0, import_utils3.getApplicationVersion)(),
26475
26218
  name: "software-metrics-machine"
26476
26219
  });
26477
26220
  }
@@ -26482,7 +26225,7 @@ var tools = [
26482
26225
  inputSchema: buildMetricsInputSchema("Configuration lookup filters."),
26483
26226
  async handler(argumentsValue) {
26484
26227
  const args = parseMetricsToolArguments(argumentsValue);
26485
- const repository = new import_core3.ConfigurationRepository(process.env, args.project, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26228
+ const repository = new import_core2.ConfigurationRepository(process.env, args.project, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
26486
26229
  const project = repository.getProjectByName(args.project || "");
26487
26230
  if (!project) {
26488
26231
  throw new Error(`Unknown project: ${args.project || "<default>"}`);
@@ -26621,6 +26364,32 @@ var tools = [
26621
26364
  return asToolResult(await reader.getChangeRequestFirstCommentTime(parsed));
26622
26365
  }
26623
26366
  },
26367
+ {
26368
+ name: "smm_get_change_request_metrics_by_month",
26369
+ description: "Get change request metrics (comments, review time, open time) grouped by month, with selectable statistical method.",
26370
+ inputSchema: buildChangeRequestMetricsInputSchema("Change request by-month filters."),
26371
+ async handler(argumentsValue) {
26372
+ const parsed = parseChangeRequestMetricsArguments(argumentsValue);
26373
+ const reader = createMcpMetricsReader({
26374
+ project: parsed.project,
26375
+ timezone: parsed.timezone
26376
+ });
26377
+ return asToolResult(await reader.getChangeRequestMetricsByMonth(parsed));
26378
+ }
26379
+ },
26380
+ {
26381
+ name: "smm_get_change_request_metrics_by_week",
26382
+ description: "Get change request metrics (comments, review time, open time) grouped by week, with selectable statistical method.",
26383
+ inputSchema: buildChangeRequestMetricsInputSchema("Change request by-week filters."),
26384
+ async handler(argumentsValue) {
26385
+ const parsed = parseChangeRequestMetricsArguments(argumentsValue);
26386
+ const reader = createMcpMetricsReader({
26387
+ project: parsed.project,
26388
+ timezone: parsed.timezone
26389
+ });
26390
+ return asToolResult(await reader.getChangeRequestMetricsByWeek(parsed));
26391
+ }
26392
+ },
26624
26393
  {
26625
26394
  name: "smm_get_pipeline_dashboard",
26626
26395
  description: "Get the full pipeline dashboard (summary, runs_duration, runs_by, jobs_time, jobs_summary, job_steps_time, jobs_duration_by_workflow) with rich filtering.",
@@ -26784,280 +26553,917 @@ var tools = [
26784
26553
  async handler(argumentsValue) {
26785
26554
  const parsed = parseCodeEntityArguments(argumentsValue);
26786
26555
  const reader = createMcpMetricsReader({
26787
- project: parsed.project,
26788
- timezone: parsed.timezone
26556
+ project: parsed.project,
26557
+ timezone: parsed.timezone
26558
+ });
26559
+ return asToolResult(await reader.getCodeEntityOwnership(parsed));
26560
+ }
26561
+ },
26562
+ {
26563
+ name: "smm_get_code_entity_ownership_history",
26564
+ description: "Get timestamped entity ownership history entries.",
26565
+ inputSchema: buildCodeEntityInputSchema("Code entity ownership history filters."),
26566
+ async handler(argumentsValue) {
26567
+ const parsed = parseCodeEntityArguments(argumentsValue);
26568
+ const reader = createMcpMetricsReader({
26569
+ project: parsed.project,
26570
+ timezone: parsed.timezone
26571
+ });
26572
+ return asToolResult(await reader.getCodeEntityOwnershipHistory(parsed));
26573
+ }
26574
+ },
26575
+ {
26576
+ name: "smm_get_sonarqube_component_tree",
26577
+ description: "Get the SonarQube component tree with metrics, optional component/depth/metrics/pattern filters.",
26578
+ inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree filters."),
26579
+ async handler(argumentsValue) {
26580
+ const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26581
+ const reader = createMcpMetricsReader({
26582
+ project: parsed.project
26583
+ });
26584
+ return asToolResult(await reader.getSonarqubeComponentTree(parsed));
26585
+ }
26586
+ },
26587
+ {
26588
+ name: "smm_get_sonarqube_component_tree_history",
26589
+ description: "Get timestamped SonarQube component tree history entries.",
26590
+ inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree history filters."),
26591
+ async handler(argumentsValue) {
26592
+ const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26593
+ const reader = createMcpMetricsReader({
26594
+ project: parsed.project
26595
+ });
26596
+ return asToolResult(await reader.getSonarqubeComponentTreeHistory(parsed));
26597
+ }
26598
+ },
26599
+ {
26600
+ name: "smm_get_sonarqube_measurements",
26601
+ description: "Get all SonarQube measurements (latest snapshot) for a configured SMM project.",
26602
+ inputSchema: buildMetricsInputSchema("SonarQube measurements lookup."),
26603
+ async handler(argumentsValue) {
26604
+ const args = parseMetricsToolArguments(argumentsValue);
26605
+ const reader = createMcpMetricsReader({
26606
+ project: args.project
26607
+ });
26608
+ return asToolResult(await reader.getSonarqubeMeasurements());
26609
+ }
26610
+ },
26611
+ {
26612
+ name: "smm_get_sonarqube_measurements_history",
26613
+ description: "Get timestamped SonarQube measurement history entries for a configured SMM project.",
26614
+ inputSchema: buildMetricsInputSchema("SonarQube measurements history lookup."),
26615
+ async handler(argumentsValue) {
26616
+ const args = parseMetricsToolArguments(argumentsValue);
26617
+ const reader = createMcpMetricsReader({
26618
+ project: args.project
26619
+ });
26620
+ return asToolResult(await reader.getSonarqubeMeasurementsHistory());
26621
+ }
26622
+ },
26623
+ {
26624
+ name: "smm_get_architecture_summary",
26625
+ description: "Get architecture snapshot metadata (snapshot id, generated at, branch, commit count, view counts) for the latest or a specific snapshot.",
26626
+ inputSchema: buildArchitectureViewInputSchema(),
26627
+ async handler(argumentsValue) {
26628
+ const parsed = parseArchitectureViewArguments(argumentsValue);
26629
+ const reader = createMcpMetricsReader({
26630
+ project: parsed.project
26631
+ });
26632
+ return asToolResult(await reader.getArchitectureSummary(parsed.snapshotId));
26633
+ }
26634
+ },
26635
+ {
26636
+ name: "smm_export_architecture_view",
26637
+ description: "Export an architecture view (context, container, component, code) as JSON plus a Mermaid diagram string.",
26638
+ inputSchema: buildArchitectureViewInputSchema(),
26639
+ async handler(argumentsValue) {
26640
+ const parsed = parseArchitectureViewArguments(argumentsValue);
26641
+ const reader = createMcpMetricsReader({
26642
+ project: parsed.project
26789
26643
  });
26790
- return asToolResult(await reader.getCodeEntityOwnership(parsed));
26644
+ return asToolResult(await reader.exportArchitectureView(parsed));
26791
26645
  }
26792
26646
  },
26793
26647
  {
26794
- name: "smm_get_code_entity_ownership_history",
26795
- description: "Get timestamped entity ownership history entries.",
26796
- inputSchema: buildCodeEntityInputSchema("Code entity ownership history filters."),
26648
+ name: "smm_list_saved_filters",
26649
+ description: "List saved filters and reports (read-only) for a configured SMM project, including filter id, name, section, repository, and createdAt. Optionally filter by dashboard section.",
26650
+ inputSchema: buildSavedFilterListInputSchema(),
26797
26651
  async handler(argumentsValue) {
26798
- const parsed = parseCodeEntityArguments(argumentsValue);
26652
+ const parsed = parseSavedFilterListArguments(argumentsValue);
26799
26653
  const reader = createMcpMetricsReader({
26800
- project: parsed.project,
26801
- timezone: parsed.timezone
26654
+ project: parsed.project
26802
26655
  });
26803
- return asToolResult(await reader.getCodeEntityOwnershipHistory(parsed));
26656
+ return asToolResult(await reader.listSavedFilters(parsed));
26804
26657
  }
26805
26658
  },
26806
26659
  {
26807
- name: "smm_get_sonarqube_component_tree",
26808
- description: "Get the SonarQube component tree with metrics, optional component/depth/metrics/pattern filters.",
26809
- inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree filters."),
26660
+ name: "smm_get_saved_filter",
26661
+ description: "Look up a single saved filter by name or id for a configured SMM project. Returns the full filter entry including section, filters, and repository.",
26662
+ inputSchema: buildSavedFilterGetInputSchema(),
26810
26663
  async handler(argumentsValue) {
26811
- const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26664
+ const parsed = parseSavedFilterGetArguments(argumentsValue);
26812
26665
  const reader = createMcpMetricsReader({
26813
26666
  project: parsed.project
26814
26667
  });
26815
- return asToolResult(await reader.getSonarqubeComponentTree(parsed));
26668
+ return asToolResult(await reader.getSavedFilter(parsed));
26816
26669
  }
26817
- },
26670
+ }
26671
+ ];
26672
+
26673
+ // src/resources.ts
26674
+ var import_core3 = __toESM(require_dist2());
26675
+ var import_utils4 = __toESM(require_dist());
26676
+ function getConfigurationRepository() {
26677
+ return new import_core3.ConfigurationRepository(process.env, void 0, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26678
+ }
26679
+ __name(getConfigurationRepository, "getConfigurationRepository");
26680
+ function encodeProject(project) {
26681
+ return encodeURIComponent(project);
26682
+ }
26683
+ __name(encodeProject, "encodeProject");
26684
+ function decodeProject(project) {
26685
+ return decodeURIComponent(project);
26686
+ }
26687
+ __name(decodeProject, "decodeProject");
26688
+ function jsonResource(uri, value) {
26689
+ return {
26690
+ contents: [
26691
+ {
26692
+ uri,
26693
+ mimeType: "application/json",
26694
+ text: JSON.stringify(value, null, 2)
26695
+ }
26696
+ ]
26697
+ };
26698
+ }
26699
+ __name(jsonResource, "jsonResource");
26700
+ function listResourceTemplates() {
26701
+ return [
26702
+ {
26703
+ uriTemplate: "smm://project/{project}/engineering-health",
26704
+ name: "Project engineering health",
26705
+ description: "Full engineering health evaluation (delivery, quality, collaboration, architecture) for a project.",
26706
+ mimeType: "application/json"
26707
+ },
26708
+ {
26709
+ uriTemplate: "smm://project/{project}/dora",
26710
+ name: "Project DORA metrics",
26711
+ description: "DORA and pipeline metrics for a project.",
26712
+ mimeType: "application/json"
26713
+ },
26714
+ {
26715
+ uriTemplate: "smm://project/{project}/architecture/snapshots",
26716
+ name: "Project architecture snapshots",
26717
+ description: "List of architecture snapshots stored for a project.",
26718
+ mimeType: "application/json"
26719
+ },
26720
+ {
26721
+ uriTemplate: "smm://project/{project}/architecture/summary",
26722
+ name: "Project architecture summary",
26723
+ description: "Architecture snapshot metadata for the latest snapshot of a project.",
26724
+ mimeType: "application/json"
26725
+ },
26726
+ {
26727
+ uriTemplate: "smm://project/{project}/pipeline-dashboard",
26728
+ name: "Project pipeline dashboard",
26729
+ description: "Full pipeline dashboard for a project.",
26730
+ mimeType: "application/json"
26731
+ },
26732
+ {
26733
+ uriTemplate: "smm://project/{project}/evaluation/change-requests",
26734
+ name: "Project change request evaluation",
26735
+ description: "Change request health evaluation for a project.",
26736
+ mimeType: "application/json"
26737
+ },
26738
+ {
26739
+ uriTemplate: "smm://project/{project}/evaluation/pipelines",
26740
+ name: "Project pipeline evaluation",
26741
+ description: "Pipeline health evaluation for a project.",
26742
+ mimeType: "application/json"
26743
+ },
26744
+ {
26745
+ uriTemplate: "smm://project/{project}/evaluation/code",
26746
+ name: "Project code evaluation",
26747
+ description: "Code health evaluation for a project.",
26748
+ mimeType: "application/json"
26749
+ },
26750
+ {
26751
+ uriTemplate: "smm://project/{project}/evaluation/quality",
26752
+ name: "Project quality evaluation",
26753
+ description: "SonarQube quality evaluation for a project.",
26754
+ mimeType: "application/json"
26755
+ },
26756
+ {
26757
+ uriTemplate: "smm://project/{project}/evaluation/architecture",
26758
+ name: "Project architecture evaluation",
26759
+ description: "Architecture health evaluation for a project.",
26760
+ mimeType: "application/json"
26761
+ },
26762
+ {
26763
+ uriTemplate: "smm://project/{project}/big-o",
26764
+ name: "Project Big-O files",
26765
+ description: "Big-O complexity classification for source files in a project.",
26766
+ mimeType: "application/json"
26767
+ },
26768
+ {
26769
+ uriTemplate: "smm://project/{project}/health-check",
26770
+ name: "Project health check",
26771
+ description: "Dataset health report for a project.",
26772
+ mimeType: "application/json"
26773
+ },
26774
+ {
26775
+ uriTemplate: "smm://project/{project}/saved-filters",
26776
+ name: "Project saved filters",
26777
+ description: "Saved filters and reports for a project.",
26778
+ mimeType: "application/json"
26779
+ },
26780
+ {
26781
+ uriTemplate: "smm://project/{project}/sonarqube/measurements",
26782
+ name: "Project SonarQube measurements",
26783
+ description: "Latest SonarQube measurements for a project.",
26784
+ mimeType: "application/json"
26785
+ },
26786
+ {
26787
+ uriTemplate: "smm://project/{project}/sonarqube/measurements/history",
26788
+ name: "Project SonarQube measurements history",
26789
+ description: "Timestamped SonarQube measurement entries for a project.",
26790
+ mimeType: "application/json"
26791
+ },
26792
+ {
26793
+ uriTemplate: "smm://project/{project}/sonarqube/component-tree",
26794
+ name: "Project SonarQube component tree",
26795
+ description: "SonarQube component tree with metrics for a project.",
26796
+ mimeType: "application/json"
26797
+ },
26798
+ {
26799
+ uriTemplate: "smm://project/{project}/sonarqube/component-tree/history",
26800
+ name: "Project SonarQube component tree history",
26801
+ description: "Timestamped SonarQube component tree entries for a project.",
26802
+ mimeType: "application/json"
26803
+ }
26804
+ ];
26805
+ }
26806
+ __name(listResourceTemplates, "listResourceTemplates");
26807
+ function listResources() {
26808
+ const repository = getConfigurationRepository();
26809
+ const projects = repository.getAllProjectNames();
26810
+ return [
26811
+ {
26812
+ uri: "smm://projects",
26813
+ name: "SMM projects",
26814
+ description: "Configured Software Metrics Machine projects.",
26815
+ mimeType: "application/json"
26816
+ },
26817
+ {
26818
+ uri: "smm://engineering-health/metrics",
26819
+ name: "Engineering health metric catalog",
26820
+ description: "Metric ids, categories, and labels available for engineering health evaluations.",
26821
+ mimeType: "application/json"
26822
+ },
26823
+ ...projects.flatMap((project) => [
26824
+ {
26825
+ uri: `smm://project/${encodeProject(project)}/configuration`,
26826
+ name: `${project} configuration`,
26827
+ description: "Redacted project configuration.",
26828
+ mimeType: "application/json"
26829
+ },
26830
+ {
26831
+ uri: `smm://project/${encodeProject(project)}/report`,
26832
+ name: `${project} report`,
26833
+ description: "Complete metrics report for the project.",
26834
+ mimeType: "application/json"
26835
+ },
26836
+ {
26837
+ uri: `smm://project/${encodeProject(project)}/engineering-health`,
26838
+ name: `${project} engineering health`,
26839
+ description: "Engineering health evaluation for the project.",
26840
+ mimeType: "application/json"
26841
+ },
26842
+ {
26843
+ uri: `smm://project/${encodeProject(project)}/dora`,
26844
+ name: `${project} DORA metrics`,
26845
+ description: "DORA and pipeline metrics for the project.",
26846
+ mimeType: "application/json"
26847
+ },
26848
+ {
26849
+ uri: `smm://project/${encodeProject(project)}/architecture/snapshots`,
26850
+ name: `${project} architecture snapshots`,
26851
+ description: "Architecture snapshots stored for the project.",
26852
+ mimeType: "application/json"
26853
+ },
26854
+ {
26855
+ uri: `smm://project/${encodeProject(project)}/evaluation/change-requests`,
26856
+ name: `${project} change request evaluation`,
26857
+ description: "Change request health evaluation for the project.",
26858
+ mimeType: "application/json"
26859
+ },
26860
+ {
26861
+ uri: `smm://project/${encodeProject(project)}/evaluation/pipelines`,
26862
+ name: `${project} pipeline evaluation`,
26863
+ description: "Pipeline health evaluation for the project.",
26864
+ mimeType: "application/json"
26865
+ },
26866
+ {
26867
+ uri: `smm://project/${encodeProject(project)}/evaluation/code`,
26868
+ name: `${project} code evaluation`,
26869
+ description: "Code health evaluation for the project.",
26870
+ mimeType: "application/json"
26871
+ },
26872
+ {
26873
+ uri: `smm://project/${encodeProject(project)}/evaluation/quality`,
26874
+ name: `${project} quality evaluation`,
26875
+ description: "SonarQube quality evaluation for the project.",
26876
+ mimeType: "application/json"
26877
+ },
26878
+ {
26879
+ uri: `smm://project/${encodeProject(project)}/evaluation/architecture`,
26880
+ name: `${project} architecture evaluation`,
26881
+ description: "Architecture health evaluation for the project.",
26882
+ mimeType: "application/json"
26883
+ },
26884
+ {
26885
+ uri: `smm://project/${encodeProject(project)}/big-o`,
26886
+ name: `${project} Big-O files`,
26887
+ description: "Big-O complexity classification for source files.",
26888
+ mimeType: "application/json"
26889
+ },
26890
+ {
26891
+ uri: `smm://project/${encodeProject(project)}/health-check`,
26892
+ name: `${project} health check`,
26893
+ description: "Dataset health report for the project.",
26894
+ mimeType: "application/json"
26895
+ },
26896
+ {
26897
+ uri: `smm://project/${encodeProject(project)}/architecture/summary`,
26898
+ name: `${project} architecture summary`,
26899
+ description: "Architecture snapshot metadata for the latest snapshot.",
26900
+ mimeType: "application/json"
26901
+ },
26902
+ {
26903
+ uri: `smm://project/${encodeProject(project)}/pipeline-dashboard`,
26904
+ name: `${project} pipeline dashboard`,
26905
+ description: "Full pipeline dashboard for the project.",
26906
+ mimeType: "application/json"
26907
+ },
26908
+ {
26909
+ uri: `smm://project/${encodeProject(project)}/saved-filters`,
26910
+ name: `${project} saved filters`,
26911
+ description: "Saved filters and reports for the project.",
26912
+ mimeType: "application/json"
26913
+ },
26914
+ {
26915
+ uri: `smm://project/${encodeProject(project)}/sonarqube/measurements`,
26916
+ name: `${project} SonarQube measurements`,
26917
+ description: "Latest SonarQube measurements for the project.",
26918
+ mimeType: "application/json"
26919
+ },
26920
+ {
26921
+ uri: `smm://project/${encodeProject(project)}/sonarqube/measurements/history`,
26922
+ name: `${project} SonarQube measurements history`,
26923
+ description: "Timestamped SonarQube measurement entries for the project.",
26924
+ mimeType: "application/json"
26925
+ },
26926
+ {
26927
+ uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree`,
26928
+ name: `${project} SonarQube component tree`,
26929
+ description: "SonarQube component tree with metrics for the project.",
26930
+ mimeType: "application/json"
26931
+ },
26932
+ {
26933
+ uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree/history`,
26934
+ name: `${project} SonarQube component tree history`,
26935
+ description: "Timestamped SonarQube component tree entries for the project.",
26936
+ mimeType: "application/json"
26937
+ }
26938
+ ])
26939
+ ];
26940
+ }
26941
+ __name(listResources, "listResources");
26942
+ async function readResource(uri) {
26943
+ const resourceStartedAt = Date.now();
26944
+ resourceLogger.debug(`Reading resource ${uri}`);
26945
+ const repository = getConfigurationRepository();
26946
+ if (uri === "smm://projects") {
26947
+ resourceLogger.debug("Listing projects for resource smm://projects");
26948
+ const result = jsonResource(uri, {
26949
+ projects: repository.getAllProjects().map((project2) => ({
26950
+ github_repository: project2.github_repository,
26951
+ git_provider: project2.git_provider
26952
+ }))
26953
+ });
26954
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26955
+ return result;
26956
+ }
26957
+ if (uri === "smm://engineering-health/metrics") {
26958
+ resourceLogger.debug("Returning engineering health metric catalog");
26959
+ const result = jsonResource(uri, {
26960
+ categories: [
26961
+ "delivery",
26962
+ "quality",
26963
+ "collaboration",
26964
+ "architecture"
26965
+ ],
26966
+ metrics: listEngineeringHealthMetricCatalog()
26967
+ });
26968
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26969
+ return result;
26970
+ }
26971
+ const match = uri.match(/^smm:\/\/project\/([^/]+)\/(configuration|report|engineering-health|dora|architecture\/snapshots|architecture\/summary|evaluation\/(change-requests|pipelines|code|quality|architecture)|big-o|health-check|pipeline-dashboard|saved-filters|sonarqube\/(measurements|measurements\/history|component-tree|component-tree\/history))$/);
26972
+ if (!match) {
26973
+ resourceLogger.warn(`Unknown MCP resource requested: ${uri}`);
26974
+ throw new Error(`Unknown MCP resource: ${uri}`);
26975
+ }
26976
+ const projectName = decodeProject(match[1]);
26977
+ const resourceType = match[2];
26978
+ resourceLogger.debug(`Resolved resource ${uri}`, {
26979
+ projectName,
26980
+ resourceType
26981
+ });
26982
+ const project = repository.getProjectByName(projectName);
26983
+ if (!project) {
26984
+ resourceLogger.warn(`Unknown project for resource ${uri}: ${projectName}`);
26985
+ throw new Error(`Unknown project: ${projectName}`);
26986
+ }
26987
+ if (resourceType === "configuration") {
26988
+ resourceLogger.debug(`Returning redacted configuration for ${projectName}`);
26989
+ const result = jsonResource(uri, redactSecrets(project));
26990
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26991
+ return result;
26992
+ }
26993
+ const reader = createMcpMetricsReader({
26994
+ project: projectName
26995
+ });
26996
+ if (resourceType === "report") {
26997
+ const result = jsonResource(uri, await reader.getFullReport());
26998
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26999
+ return result;
27000
+ }
27001
+ if (resourceType === "engineering-health") {
27002
+ const result = jsonResource(uri, await reader.getEngineeringHealthEvaluation({
27003
+ project: projectName
27004
+ }));
27005
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27006
+ return result;
27007
+ }
27008
+ if (resourceType === "dora") {
27009
+ const result = jsonResource(uri, await reader.getDoraMetrics({
27010
+ project: projectName
27011
+ }));
27012
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27013
+ return result;
27014
+ }
27015
+ if (resourceType === "evaluation/change-requests") {
27016
+ const result = jsonResource(uri, await reader.evaluateChangeRequests());
27017
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27018
+ return result;
27019
+ }
27020
+ if (resourceType === "evaluation/pipelines") {
27021
+ const result = jsonResource(uri, await reader.evaluatePipelines());
27022
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27023
+ return result;
27024
+ }
27025
+ if (resourceType === "evaluation/code") {
27026
+ const result = jsonResource(uri, await reader.evaluateCode());
27027
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27028
+ return result;
27029
+ }
27030
+ if (resourceType === "evaluation/quality") {
27031
+ const result = jsonResource(uri, await reader.evaluateQuality());
27032
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27033
+ return result;
27034
+ }
27035
+ if (resourceType === "evaluation/architecture") {
27036
+ const result = jsonResource(uri, await reader.evaluateArchitecture({
27037
+ project: projectName
27038
+ }));
27039
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27040
+ return result;
27041
+ }
27042
+ if (resourceType === "big-o") {
27043
+ const result = jsonResource(uri, await reader.listBigOFiles());
27044
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27045
+ return result;
27046
+ }
27047
+ if (resourceType === "health-check") {
27048
+ const result = jsonResource(uri, await reader.healthCheck());
27049
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27050
+ return result;
27051
+ }
27052
+ if (resourceType === "architecture/summary") {
27053
+ const result = jsonResource(uri, await reader.getArchitectureSummary());
27054
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27055
+ return result;
27056
+ }
27057
+ if (resourceType === "pipeline-dashboard") {
27058
+ const result = jsonResource(uri, await reader.getPipelineDashboard({
27059
+ project: projectName
27060
+ }));
27061
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27062
+ return result;
27063
+ }
27064
+ if (resourceType === "saved-filters") {
27065
+ const result = jsonResource(uri, await reader.listSavedFilters());
27066
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27067
+ return result;
27068
+ }
27069
+ if (resourceType === "sonarqube/measurements") {
27070
+ const result = jsonResource(uri, await reader.getSonarqubeMeasurements());
27071
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27072
+ return result;
27073
+ }
27074
+ if (resourceType === "sonarqube/measurements/history") {
27075
+ const result = jsonResource(uri, await reader.getSonarqubeMeasurementsHistory());
27076
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27077
+ return result;
27078
+ }
27079
+ if (resourceType === "sonarqube/component-tree") {
27080
+ const result = jsonResource(uri, await reader.getSonarqubeComponentTree({
27081
+ project: projectName
27082
+ }));
27083
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27084
+ return result;
27085
+ }
27086
+ if (resourceType === "sonarqube/component-tree/history") {
27087
+ const result = jsonResource(uri, await reader.getSonarqubeComponentTreeHistory({
27088
+ project: projectName
27089
+ }));
27090
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27091
+ return result;
27092
+ }
27093
+ const snapshotsResult = jsonResource(uri, await reader.listArchitectureSnapshots());
27094
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27095
+ return snapshotsResult;
27096
+ }
27097
+ __name(readResource, "readResource");
27098
+
27099
+ // src/prompts.ts
27100
+ var prompts = [
26818
27101
  {
26819
- name: "smm_get_sonarqube_component_tree_history",
26820
- description: "Get timestamped SonarQube component tree history entries.",
26821
- inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree history filters."),
26822
- async handler(argumentsValue) {
26823
- const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26824
- const reader = createMcpMetricsReader({
26825
- project: parsed.project
26826
- });
26827
- return asToolResult(await reader.getSonarqubeComponentTreeHistory(parsed));
26828
- }
27102
+ name: "smm_sprint_health_review",
27103
+ description: "Review engineering health for the current sprint and highlight metrics that need attention.",
27104
+ arguments: [
27105
+ {
27106
+ name: "project",
27107
+ description: "Optional github_repository project name from smm_config.json.",
27108
+ required: false
27109
+ },
27110
+ {
27111
+ name: "startDate",
27112
+ description: "Current window start date (YYYY-MM-DD).",
27113
+ required: false
27114
+ },
27115
+ {
27116
+ name: "endDate",
27117
+ description: "Current window end date (YYYY-MM-DD).",
27118
+ required: false
27119
+ }
27120
+ ]
26829
27121
  },
26830
27122
  {
26831
- name: "smm_get_sonarqube_measurements",
26832
- description: "Get all SonarQube measurements (latest snapshot) for a configured SMM project.",
26833
- inputSchema: buildMetricsInputSchema("SonarQube measurements lookup."),
26834
- async handler(argumentsValue) {
26835
- const args = parseMetricsToolArguments(argumentsValue);
26836
- const reader = createMcpMetricsReader({
26837
- project: args.project
26838
- });
26839
- return asToolResult(await reader.getSonarqubeMeasurements());
26840
- }
27123
+ name: "smm_compare_windows",
27124
+ description: "Compare engineering health between two time windows and summarise what improved or regressed.",
27125
+ arguments: [
27126
+ {
27127
+ name: "project",
27128
+ description: "Optional github_repository project name from smm_config.json.",
27129
+ required: false
27130
+ },
27131
+ {
27132
+ name: "startDate",
27133
+ description: "Current window start date (YYYY-MM-DD).",
27134
+ required: true
27135
+ },
27136
+ {
27137
+ name: "endDate",
27138
+ description: "Current window end date (YYYY-MM-DD).",
27139
+ required: true
27140
+ },
27141
+ {
27142
+ name: "compareStartDate",
27143
+ description: "Previous window start date (YYYY-MM-DD).",
27144
+ required: true
27145
+ },
27146
+ {
27147
+ name: "compareEndDate",
27148
+ description: "Previous window end date (YYYY-MM-DD).",
27149
+ required: true
27150
+ }
27151
+ ]
26841
27152
  },
26842
27153
  {
26843
- name: "smm_get_sonarqube_measurements_history",
26844
- description: "Get timestamped SonarQube measurement history entries for a configured SMM project.",
26845
- inputSchema: buildMetricsInputSchema("SonarQube measurements history lookup."),
26846
- async handler(argumentsValue) {
26847
- const args = parseMetricsToolArguments(argumentsValue);
26848
- const reader = createMcpMetricsReader({
26849
- project: args.project
26850
- });
26851
- return asToolResult(await reader.getSonarqubeMeasurementsHistory());
26852
- }
27154
+ name: "smm_dora_summary",
27155
+ description: "Summarise DORA metrics for a project, including deployment frequency and failure rate.",
27156
+ arguments: [
27157
+ {
27158
+ name: "project",
27159
+ description: "Optional github_repository project name from smm_config.json.",
27160
+ required: false
27161
+ },
27162
+ {
27163
+ name: "startDate",
27164
+ description: "Optional window start date (YYYY-MM-DD).",
27165
+ required: false
27166
+ },
27167
+ {
27168
+ name: "endDate",
27169
+ description: "Optional window end date (YYYY-MM-DD).",
27170
+ required: false
27171
+ }
27172
+ ]
26853
27173
  },
26854
27174
  {
26855
- name: "smm_get_architecture_summary",
26856
- description: "Get architecture snapshot metadata (snapshot id, generated at, branch, commit count, view counts) for the latest or a specific snapshot.",
26857
- inputSchema: buildArchitectureViewInputSchema(),
26858
- async handler(argumentsValue) {
26859
- const parsed = parseArchitectureViewArguments(argumentsValue);
26860
- const reader = createMcpMetricsReader({
26861
- project: parsed.project
27175
+ name: "smm_code_hotspots",
27176
+ description: "Identify code hotspots (high churn and high coupling files) and pair-programming gaps for a project.",
27177
+ arguments: [
27178
+ {
27179
+ name: "project",
27180
+ description: "Optional github_repository project name from smm_config.json.",
27181
+ required: false
27182
+ },
27183
+ {
27184
+ name: "startDate",
27185
+ description: "Optional window start date (YYYY-MM-DD).",
27186
+ required: false
27187
+ },
27188
+ {
27189
+ name: "endDate",
27190
+ description: "Optional window end date (YYYY-MM-DD).",
27191
+ required: false
27192
+ }
27193
+ ]
27194
+ }
27195
+ ];
27196
+ function getArg(values, name) {
27197
+ const value = values[name];
27198
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
27199
+ }
27200
+ __name(getArg, "getArg");
27201
+ function optional(value) {
27202
+ return value ? value : "<not provided>";
27203
+ }
27204
+ __name(optional, "optional");
27205
+ async function getPrompt(name, argumentsValue) {
27206
+ promptLogger.debug(`Building prompt ${name}`, {
27207
+ arguments: argumentsValue
27208
+ });
27209
+ const values = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
27210
+ const project = getArg(values, "project");
27211
+ const startDate = getArg(values, "startDate");
27212
+ const endDate = getArg(values, "endDate");
27213
+ const compareStartDate = getArg(values, "compareStartDate");
27214
+ const compareEndDate = getArg(values, "compareEndDate");
27215
+ const messages = [];
27216
+ switch (name) {
27217
+ case "smm_sprint_health_review":
27218
+ messages.push({
27219
+ role: "user",
27220
+ content: {
27221
+ type: "text",
27222
+ text: [
27223
+ "You are acting as a software engineering coach.",
27224
+ "Use the Software Metrics Machine MCP tools to evaluate the engineering health of the project.",
27225
+ "",
27226
+ `Project: ${optional(project)}`,
27227
+ `Current window: ${optional(startDate)} to ${optional(endDate)}`,
27228
+ "",
27229
+ "Steps:",
27230
+ "1. Call smm_get_engineering_health with the filters above.",
27231
+ '2. Highlight any metric whose recommendation level is "watch" or "critical".',
27232
+ "3. Suggest one concrete action for each degraded metric, grounded in the data returned."
27233
+ ].join("\n")
27234
+ }
26862
27235
  });
26863
- return asToolResult(await reader.getArchitectureSummary(parsed.snapshotId));
26864
- }
26865
- },
26866
- {
26867
- name: "smm_export_architecture_view",
26868
- description: "Export an architecture view (context, container, component, code) as JSON plus a Mermaid diagram string.",
26869
- inputSchema: buildArchitectureViewInputSchema(),
26870
- async handler(argumentsValue) {
26871
- const parsed = parseArchitectureViewArguments(argumentsValue);
26872
- const reader = createMcpMetricsReader({
26873
- project: parsed.project
27236
+ break;
27237
+ case "smm_compare_windows":
27238
+ messages.push({
27239
+ role: "user",
27240
+ content: {
27241
+ type: "text",
27242
+ text: [
27243
+ "You are acting as a software engineering coach.",
27244
+ "Use the Software Metrics Machine MCP tools to compare two windows.",
27245
+ "",
27246
+ `Project: ${optional(project)}`,
27247
+ `Current window: ${optional(startDate)} to ${optional(endDate)}`,
27248
+ `Previous window: ${optional(compareStartDate)} to ${optional(compareEndDate)}`,
27249
+ "",
27250
+ "Steps:",
27251
+ "1. Call smm_get_engineering_health with startDate, endDate, compareStartDate, and compareEndDate.",
27252
+ "2. For each metric, summarise whether the trend is improving, stable, or degrading.",
27253
+ "3. Produce a short before/after table and a prioritised list of follow-up actions."
27254
+ ].join("\n")
27255
+ }
26874
27256
  });
26875
- return asToolResult(await reader.exportArchitectureView(parsed));
26876
- }
26877
- },
26878
- {
26879
- name: "smm_list_saved_filters",
26880
- description: "List saved filters and reports (read-only) for a configured SMM project, including filter id, name, section, repository, and createdAt.",
26881
- inputSchema: buildMetricsInputSchema("Saved filters lookup."),
26882
- async handler(argumentsValue) {
26883
- const args = parseMetricsToolArguments(argumentsValue);
26884
- const reader = createMcpMetricsReader({
26885
- project: args.project
27257
+ break;
27258
+ case "smm_dora_summary":
27259
+ messages.push({
27260
+ role: "user",
27261
+ content: {
27262
+ type: "text",
27263
+ text: [
27264
+ "You are acting as a DORA metrics analyst.",
27265
+ "Use the Software Metrics Machine MCP tools to report DORA metrics.",
27266
+ "",
27267
+ `Project: ${optional(project)}`,
27268
+ `Window: ${optional(startDate)} to ${optional(endDate)}`,
27269
+ "",
27270
+ "Steps:",
27271
+ "1. Call smm_get_dora_metrics with the filters above.",
27272
+ "2. Report deployment frequency, failure rate signals, and pipeline duration.",
27273
+ "3. Classify the project against the DORA tiers (elite, high, medium, low) where possible."
27274
+ ].join("\n")
27275
+ }
26886
27276
  });
26887
- return asToolResult(await reader.listSavedFilters());
26888
- }
27277
+ break;
27278
+ case "smm_code_hotspots":
27279
+ messages.push({
27280
+ role: "user",
27281
+ content: {
27282
+ type: "text",
27283
+ text: [
27284
+ "You are acting as a code health reviewer.",
27285
+ "Use the Software Metrics Machine MCP tools to surface code hotspots.",
27286
+ "",
27287
+ `Project: ${optional(project)}`,
27288
+ `Window: ${optional(startDate)} to ${optional(endDate)}`,
27289
+ "",
27290
+ "Steps:",
27291
+ "1. Call smm_get_code_metrics to retrieve churn, coupling, and pairing data.",
27292
+ "2. Identify files with the highest churn and strongest coupling.",
27293
+ "3. Cross-reference pairing gaps and propose concrete refactoring or pairing actions."
27294
+ ].join("\n")
27295
+ }
27296
+ });
27297
+ break;
27298
+ default:
27299
+ throw new Error(`Unknown MCP prompt: ${name}`);
26889
27300
  }
26890
- ];
26891
- function findTool(name) {
26892
- return tools.find((tool) => tool.name === name);
27301
+ return {
27302
+ description: prompts.find((prompt) => prompt.name === name)?.description,
27303
+ messages
27304
+ };
26893
27305
  }
26894
- __name(findTool, "findTool");
27306
+ __name(getPrompt, "getPrompt");
26895
27307
 
26896
- // src/server.ts
26897
- var SERVER_INFO = {
26898
- name: "software-metrics-machine",
26899
- version: (0, import_utils5.getApplicationVersion)()
26900
- };
26901
- var log = /* @__PURE__ */ __name((message) => transportLogger.info(message), "log");
26902
- function isJsonRpcRequest(value) {
26903
- return typeof value === "object" && value !== null && "jsonrpc" in value && value.jsonrpc === "2.0" && "method" in value && typeof value.method === "string" && // Optional: check id is string, number, null, or undefined
26904
- (!("id" in value) || value.id === void 0 || value.id === null || typeof value.id === "string" || typeof value.id === "number");
27308
+ // src/registration.ts
27309
+ function jsonSchemaPropertyToZod(prop) {
27310
+ if (!prop) {
27311
+ return import_zod.z.unknown();
27312
+ }
27313
+ const description = typeof prop.description === "string" ? prop.description : void 0;
27314
+ if (Array.isArray(prop.enum)) {
27315
+ const values = prop.enum.filter((v) => typeof v === "string");
27316
+ if (values.length > 0) {
27317
+ const literals = values.map((v) => import_zod.z.literal(v));
27318
+ const schema = literals.length === 1 ? literals[0] : import_zod.z.union(literals);
27319
+ return description ? schema.describe(description) : schema;
27320
+ }
27321
+ }
27322
+ switch (prop.type) {
27323
+ case "string":
27324
+ return description ? import_zod.z.string().describe(description) : import_zod.z.string();
27325
+ case "number":
27326
+ return description ? import_zod.z.number().describe(description) : import_zod.z.number();
27327
+ case "boolean":
27328
+ return description ? import_zod.z.boolean().describe(description) : import_zod.z.boolean();
27329
+ default:
27330
+ return import_zod.z.unknown();
27331
+ }
26905
27332
  }
26906
- __name(isJsonRpcRequest, "isJsonRpcRequest");
26907
- function ok(id, result) {
26908
- return {
26909
- jsonrpc: "2.0",
26910
- id: id ?? null,
26911
- result
26912
- };
27333
+ __name(jsonSchemaPropertyToZod, "jsonSchemaPropertyToZod");
27334
+ function jsonSchemaToZodShape(schema) {
27335
+ if (!schema || typeof schema !== "object") {
27336
+ return {};
27337
+ }
27338
+ const properties = schema.properties ?? {};
27339
+ const shape = {};
27340
+ for (const [key, prop] of Object.entries(properties)) {
27341
+ const propSchema = prop;
27342
+ shape[key] = jsonSchemaPropertyToZod(propSchema).optional();
27343
+ }
27344
+ return shape;
26913
27345
  }
26914
- __name(ok, "ok");
26915
- function error(id, code, message, data) {
27346
+ __name(jsonSchemaToZodShape, "jsonSchemaToZodShape");
27347
+ function adaptToolResult(result) {
26916
27348
  return {
26917
- jsonrpc: "2.0",
26918
- id: id ?? null,
26919
- error: {
26920
- code,
26921
- message,
26922
- data
26923
- }
27349
+ content: result.content,
27350
+ ...result.structuredContent !== void 0 ? {
27351
+ structuredContent: result.structuredContent
27352
+ } : {},
27353
+ ...result.isError !== void 0 ? {
27354
+ isError: result.isError
27355
+ } : {}
26924
27356
  };
26925
27357
  }
26926
- __name(error, "error");
26927
- function getStringParam(params, fieldName) {
26928
- const value = params?.[fieldName];
26929
- return typeof value === "string" ? value : void 0;
27358
+ __name(adaptToolResult, "adaptToolResult");
27359
+ function registerTools(server) {
27360
+ for (const tool of tools) {
27361
+ const zodShape = jsonSchemaToZodShape(tool.inputSchema);
27362
+ const inputSchema = import_zod.z.object(zodShape);
27363
+ server.registerTool(tool.name, {
27364
+ description: tool.description,
27365
+ inputSchema
27366
+ }, async (args) => {
27367
+ const result = await tool.handler(args);
27368
+ return adaptToolResult(result);
27369
+ });
27370
+ }
26930
27371
  }
26931
- __name(getStringParam, "getStringParam");
26932
- async function handleRequestWithLogging(request, log2) {
26933
- if (request.id === void 0 && request.method.startsWith("notifications/")) {
26934
- log2?.(`Received notification: ${request.method}`);
26935
- return void 0;
27372
+ __name(registerTools, "registerTools");
27373
+ function registerResources(server) {
27374
+ const staticResources = listResources();
27375
+ for (const resource of staticResources) {
27376
+ server.registerResource(resource.name, resource.uri, {
27377
+ description: resource.description,
27378
+ mimeType: resource.mimeType
27379
+ }, async (uri) => {
27380
+ const result = await readResource(uri.toString());
27381
+ return {
27382
+ contents: result.contents.map((entry) => ({
27383
+ uri: entry.uri,
27384
+ mimeType: entry.mimeType,
27385
+ text: entry.text
27386
+ }))
27387
+ };
27388
+ });
26936
27389
  }
26937
- try {
26938
- switch (request.method) {
26939
- case "initialize":
26940
- log2?.("Client initialized MCP session");
26941
- return ok(request.id, {
26942
- protocolVersion: "2025-06-18",
26943
- capabilities: {
26944
- tools: {},
26945
- resources: {
26946
- list: true,
26947
- read: true,
26948
- listChanged: false
26949
- },
26950
- prompts: {
26951
- list: true,
26952
- get: true,
26953
- listChanged: false
26954
- },
26955
- logging: {}
26956
- },
26957
- serverInfo: SERVER_INFO
26958
- });
26959
- case "ping":
26960
- log2?.("Received ping");
26961
- return ok(request.id, {});
26962
- case "tools/list":
26963
- log2?.(`Listing ${tools.length} MCP tools`);
26964
- return ok(request.id, {
26965
- tools: tools.map(({ handler: _handler, ...tool }) => tool)
26966
- });
26967
- case "tools/call": {
26968
- const name = getStringParam(request.params, "name");
26969
- const selectedTool = name ? findTool(name) : void 0;
26970
- if (!selectedTool) {
26971
- log2?.(`Rejected unknown tool call: ${name || "<missing>"}`);
26972
- return error(request.id, -32602, `Unknown tool: ${name || "<missing>"}`);
26973
- }
26974
- const toolStartedAt = Date.now();
26975
- log2?.(`Running tool: ${name}`);
26976
- try {
26977
- const result = await selectedTool.handler(request.params?.arguments);
26978
- log2?.(`Completed tool: ${name} in ${Date.now() - toolStartedAt}ms`);
26979
- return ok(request.id, result);
26980
- } catch (toolError) {
26981
- const toolMessage = toolError instanceof Error ? toolError.message : String(toolError);
26982
- log2?.(`Failed tool: ${name} after ${Date.now() - toolStartedAt}ms (${toolMessage})`);
26983
- throw toolError;
26984
- }
26985
- }
26986
- case "resources/list":
26987
- log2?.("Listing MCP resources");
26988
- return ok(request.id, {
26989
- resources: listResources()
26990
- });
26991
- case "resources/templates/list":
26992
- log2?.("Listing MCP resource templates");
26993
- return ok(request.id, {
26994
- resourceTemplates: listResourceTemplates()
26995
- });
26996
- case "resources/read": {
26997
- const uri = getStringParam(request.params, "uri");
26998
- if (!uri) {
26999
- log2?.("Rejected resources/read request without uri");
27000
- return error(request.id, -32602, "resources/read requires a uri parameter");
27001
- }
27002
- const resourceStartedAt = Date.now();
27003
- log2?.(`Reading resource: ${uri}`);
27004
- try {
27005
- const resourceResult = await readResource(uri);
27006
- log2?.(`Read resource: ${uri} in ${Date.now() - resourceStartedAt}ms`);
27007
- return ok(request.id, resourceResult);
27008
- } catch (resourceError) {
27009
- const resourceMessage = resourceError instanceof Error ? resourceError.message : String(resourceError);
27010
- log2?.(`Failed resource: ${uri} after ${Date.now() - resourceStartedAt}ms (${resourceMessage})`);
27011
- throw resourceError;
27012
- }
27013
- }
27014
- case "prompts/list":
27015
- log2?.(`Listing ${prompts.length} MCP prompts`);
27016
- return ok(request.id, {
27017
- prompts
27018
- });
27019
- case "prompts/get": {
27020
- const name = getStringParam(request.params, "name");
27021
- if (!name) {
27022
- log2?.("Rejected prompts/get request without name");
27023
- return error(request.id, -32602, "prompts/get requires a name parameter");
27024
- }
27025
- const knownPrompt = prompts.find((prompt) => prompt.name === name);
27026
- if (!knownPrompt) {
27027
- log2?.(`Rejected unknown prompt: ${name}`);
27028
- return error(request.id, -32602, `Unknown prompt: ${name}`);
27029
- }
27030
- log2?.(`Reading prompt: ${name}`);
27031
- return ok(request.id, await getPrompt(name, request.params?.arguments));
27032
- }
27033
- case "logging/setLevel": {
27034
- const level = getStringParam(request.params, "level");
27035
- if (!level) {
27036
- return error(request.id, -32602, "logging/setLevel requires a level parameter");
27037
- }
27038
- const normalized = level.toLowerCase();
27039
- if (normalized !== "debug" && normalized !== "info" && normalized !== "critical") {
27040
- return error(request.id, -32602, `Invalid log level: ${level}. Must be debug, info, or critical.`);
27041
- }
27042
- log2?.(`Setting MCP log level to ${normalized}`);
27043
- configureMcpLogging(normalized === "debug" ? {
27044
- debug: true
27045
- } : normalized === "critical" ? {
27046
- quiet: true
27047
- } : {});
27048
- return ok(request.id, {});
27049
- }
27050
- default:
27051
- log2?.(`Rejected unknown method: ${request.method}`);
27052
- return error(request.id, -32601, `Method not found: ${request.method}`);
27390
+ const templates = listResourceTemplates();
27391
+ for (const template of templates) {
27392
+ server.registerResource(template.name, new import_server.ResourceTemplate(template.uriTemplate, {
27393
+ list: void 0
27394
+ }), {
27395
+ description: template.description,
27396
+ mimeType: template.mimeType
27397
+ }, async (uri) => {
27398
+ const result = await readResource(uri.toString());
27399
+ return {
27400
+ contents: result.contents.map((entry) => ({
27401
+ uri: entry.uri,
27402
+ mimeType: entry.mimeType,
27403
+ text: entry.text
27404
+ }))
27405
+ };
27406
+ });
27407
+ }
27408
+ }
27409
+ __name(registerResources, "registerResources");
27410
+ function registerPrompts(server) {
27411
+ for (const prompt of prompts) {
27412
+ const argsShape = {};
27413
+ if (prompt.arguments) {
27414
+ for (const arg of prompt.arguments) {
27415
+ argsShape[arg.name] = import_zod.z.string().optional().describe(arg.description);
27416
+ }
27053
27417
  }
27054
- } catch (caught) {
27055
- const message = caught instanceof Error ? caught.message : String(caught);
27056
- log2?.(`Request failed for ${request.method}: ${message}`);
27057
- return error(request.id, -32e3, message);
27418
+ server.registerPrompt(prompt.name, {
27419
+ description: prompt.description,
27420
+ argsSchema: argsShape
27421
+ }, async (args) => {
27422
+ const result = await getPrompt(prompt.name, args);
27423
+ return {
27424
+ ...result.description !== void 0 ? {
27425
+ description: result.description
27426
+ } : {},
27427
+ messages: result.messages.map((message) => ({
27428
+ role: message.role,
27429
+ content: {
27430
+ type: "text",
27431
+ text: message.content.text
27432
+ }
27433
+ }))
27434
+ };
27435
+ });
27058
27436
  }
27059
27437
  }
27060
- __name(handleRequestWithLogging, "handleRequestWithLogging");
27438
+ __name(registerPrompts, "registerPrompts");
27439
+ function registerAll(server) {
27440
+ registerTools(server);
27441
+ registerResources(server);
27442
+ registerPrompts(server);
27443
+ }
27444
+ __name(registerAll, "registerAll");
27445
+
27446
+ // src/server.ts
27447
+ var SERVER_INFO = {
27448
+ name: "software-metrics-machine",
27449
+ version: (0, import_utils5.getApplicationVersion)()
27450
+ };
27451
+ var log = /* @__PURE__ */ __name((message) => {
27452
+ transportLogger.info(message);
27453
+ }, "log");
27454
+ function createMcpServer() {
27455
+ const server = new import_server2.McpServer(SERVER_INFO, {
27456
+ capabilities: {
27457
+ tools: {},
27458
+ resources: {},
27459
+ prompts: {},
27460
+ logging: {}
27461
+ }
27462
+ });
27463
+ registerAll(server);
27464
+ return server;
27465
+ }
27466
+ __name(createMcpServer, "createMcpServer");
27061
27467
  async function startMcpServer(options = {}) {
27062
27468
  redirectConsoleToStderr();
27063
27469
  configureMcpLogging({
@@ -27066,44 +27472,15 @@ async function startMcpServer(options = {}) {
27066
27472
  log(`Starting Software Metrics Machine MCP server v${SERVER_INFO.version} over stdio`);
27067
27473
  log(`Configuration directory: ${(0, import_core4.resolveStoreDataAt)(process.env) || "<not set>"}`);
27068
27474
  log(`Available tools: ${tools.map((tool) => tool.name).join(", ")}`);
27069
- const reader = (0, import_node_readline.createInterface)({
27070
- input: process.stdin,
27071
- output: process.stdout,
27072
- terminal: false
27073
- });
27074
- reader.on("close", () => {
27075
- log("MCP stdio input closed; server stopped");
27076
- });
27077
- for await (const line of reader) {
27078
- if (!line.trim()) {
27079
- continue;
27080
- }
27081
- let response;
27082
- try {
27083
- const parsed = JSON.parse(line);
27084
- if (!isJsonRpcRequest(parsed)) {
27085
- log("Rejected invalid JSON-RPC request");
27086
- response = error(null, -32600, "Invalid JSON-RPC request");
27087
- } else {
27088
- log(`Received request: ${parsed.method}`);
27089
- response = await handleRequestWithLogging(parsed, log);
27090
- }
27091
- } catch (caught) {
27092
- log(`Failed to parse request: ${caught instanceof Error ? caught.message : "Invalid JSON payload"}`);
27093
- response = error(null, -32700, caught instanceof Error ? caught.message : "Invalid JSON payload");
27094
- }
27095
- if (response) {
27096
- process.stdout.write(`${JSON.stringify(response)}
27097
- `);
27098
- }
27099
- }
27475
+ await (0, import_stdio.serveStdio)(() => createMcpServer());
27476
+ log("MCP server connected to stdio transport");
27100
27477
  }
27101
27478
  __name(startMcpServer, "startMcpServer");
27102
27479
 
27103
27480
  // src/bin.ts
27104
27481
  redirectConsoleToStderr();
27105
- startMcpServer().catch((error2) => {
27106
- process.stderr.write(`Failed to start Software Metrics Machine MCP server: ${error2 instanceof Error ? error2.message : String(error2)}
27482
+ startMcpServer().catch((error) => {
27483
+ process.stderr.write(`Failed to start Software Metrics Machine MCP server: ${error instanceof Error ? error.message : String(error)}
27107
27484
  `);
27108
27485
  process.exit(1);
27109
27486
  });