@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
@@ -48,8 +48,8 @@ var require_date_time = __commonJS({
48
48
  try {
49
49
  const dt = (0, date_fns_1.parseISO)(date);
50
50
  return (0, date_fns_1.format)(dt, "dd MMM yyyy, HH:mm");
51
- } catch (error2) {
52
- console.warn(`Failed to parse date: ${date}`, error2);
51
+ } catch (error) {
52
+ console.warn(`Failed to parse date: ${date}`, error);
53
53
  return date;
54
54
  }
55
55
  }
@@ -164,11 +164,11 @@ var require_logger = __commonJS({
164
164
  warn(message, data) {
165
165
  this.write("WARN", message, data, console.warn);
166
166
  }
167
- error(message, error2) {
168
- this.write("ERROR", message, error2, console.error);
167
+ error(message, error) {
168
+ this.write("ERROR", message, error, console.error);
169
169
  }
170
- critical(message, error2) {
171
- this.write("CRITICAL", message, error2, console.error);
170
+ critical(message, error) {
171
+ this.write("CRITICAL", message, error, console.error);
172
172
  }
173
173
  setLevel(level) {
174
174
  this.level = level;
@@ -221,18 +221,18 @@ var require_json = __commonJS({
221
221
  function parseJson(json) {
222
222
  try {
223
223
  return JSON.parse(json);
224
- } catch (error2) {
225
- throw new Error(`Failed to parse JSON: ${error2 instanceof Error ? error2.message : String(error2)}`);
224
+ } catch (error) {
225
+ throw new Error(`Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`);
226
226
  }
227
227
  }
228
228
  __name(parseJson, "parseJson");
229
229
  function safeJsonStringify(value) {
230
230
  try {
231
231
  return JSON.stringify(value, null, 2);
232
- } catch (error2) {
232
+ } catch (error) {
233
233
  return JSON.stringify({
234
234
  error: "Failed to serialize",
235
- message: error2 instanceof Error ? error2.message : String(error2)
235
+ message: error instanceof Error ? error.message : String(error)
236
236
  }, null, 2);
237
237
  }
238
238
  }
@@ -1715,9 +1715,9 @@ var require_sqlite_repository = __commonJS({
1715
1715
  this.saveGenericRecords(db, items);
1716
1716
  }
1717
1717
  db.exec("COMMIT");
1718
- } catch (error2) {
1718
+ } catch (error) {
1719
1719
  db.exec("ROLLBACK");
1720
- throw error2;
1720
+ throw error;
1721
1721
  }
1722
1722
  } finally {
1723
1723
  db.close();
@@ -2066,9 +2066,9 @@ var require_sqlite_repository = __commonJS({
2066
2066
  await fs.mkdir(path.dirname(this.dbPath), {
2067
2067
  recursive: true
2068
2068
  });
2069
- } catch (error2) {
2070
- if (error2.code !== "EEXIST") {
2071
- throw error2;
2069
+ } catch (error) {
2070
+ if (error.code !== "EEXIST") {
2071
+ throw error;
2072
2072
  }
2073
2073
  }
2074
2074
  }
@@ -2714,9 +2714,9 @@ var require_sonarqube_service = __commonJS({
2714
2714
  this.logger.info("Fetching SonarQube quality metrics...");
2715
2715
  try {
2716
2716
  return await this.sonarqubeRepository.loadAll();
2717
- } catch (error2) {
2718
- this.logger.error("Error fetching SonarQube metrics:", error2);
2719
- throw error2;
2717
+ } catch (error) {
2718
+ this.logger.error("Error fetching SonarQube metrics:", error);
2719
+ throw error;
2720
2720
  }
2721
2721
  }
2722
2722
  };
@@ -3745,10 +3745,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3745
3745
  startDate: options?.startDate,
3746
3746
  endDate: options?.endDate
3747
3747
  };
3748
- } catch (error2) {
3749
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3748
+ } catch (error) {
3749
+ const errorMsg = error instanceof Error ? error.message : String(error);
3750
3750
  this.logger.error(`Failed to read code churn: ${errorMsg}`);
3751
- throw error2;
3751
+ throw error;
3752
3752
  }
3753
3753
  }
3754
3754
  async getCodeChurnHistory(options) {
@@ -3811,10 +3811,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3811
3811
  }
3812
3812
  this.logger.info(`Parsed ${data.length} author churn records`);
3813
3813
  return data;
3814
- } catch (error2) {
3815
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3814
+ } catch (error) {
3815
+ const errorMsg = error instanceof Error ? error.message : String(error);
3816
3816
  this.logger.error(`Failed to read author churn: ${errorMsg}`);
3817
- throw error2;
3817
+ throw error;
3818
3818
  }
3819
3819
  }
3820
3820
  async getFileCoupling(options) {
@@ -3869,10 +3869,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3869
3869
  this.logger.info(`Parsed ${coupleData.length} file coupling relationships`);
3870
3870
  const sorted = options?.sortBy === "degree" ? coupleData.sort((a, b) => b.degree - a.degree) : coupleData;
3871
3871
  return this.limitRows(sorted, options?.top);
3872
- } catch (error2) {
3873
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3872
+ } catch (error) {
3873
+ const errorMsg = error instanceof Error ? error.message : String(error);
3874
3874
  this.logger.error(`Failed to read file coupling: ${errorMsg}`);
3875
- throw error2;
3875
+ throw error;
3876
3876
  }
3877
3877
  }
3878
3878
  async getFileCouplingHistory(options) {
@@ -3893,10 +3893,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3893
3893
  averageRevs: this.toNumber(record["average-revs"] || record.average_revs)
3894
3894
  })).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);
3895
3895
  return this.limitRows(coupledData, options?.top);
3896
- } catch (error2) {
3897
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3896
+ } catch (error) {
3897
+ const errorMsg = error instanceof Error ? error.message : String(error);
3898
3898
  this.logger.error(`Failed to read layered coupling: ${errorMsg}`);
3899
- throw error2;
3899
+ throw error;
3900
3900
  }
3901
3901
  }
3902
3902
  async getLayeredCouplingHistory(options) {
@@ -3955,10 +3955,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3955
3955
  };
3956
3956
  this.logger.info("CodeMaat analysis completed");
3957
3957
  return result;
3958
- } catch (error2) {
3959
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3958
+ } catch (error) {
3959
+ const errorMsg = error instanceof Error ? error.message : String(error);
3960
3960
  this.logger.error(`CodeMaat analysis failed: ${errorMsg}`);
3961
- throw error2;
3961
+ throw error;
3962
3962
  }
3963
3963
  }
3964
3964
  async getEntityChurn(options) {
@@ -3970,10 +3970,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3970
3970
  deleted: this.toNumber(record.deleted),
3971
3971
  commits: this.toNumber(record.commits)
3972
3972
  })).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));
3973
- } catch (error2) {
3974
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
3973
+ } catch (error) {
3974
+ const errorMsg = error instanceof Error ? error.message : String(error);
3975
3975
  this.logger.error(`Failed to read entity churn: ${errorMsg}`);
3976
- throw error2;
3976
+ throw error;
3977
3977
  }
3978
3978
  }
3979
3979
  async getEntityChurnHistory(options) {
@@ -3998,10 +3998,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
3998
3998
  entity,
3999
3999
  "total-revs": totalRevs
4000
4000
  })).sort((a, b) => b["total-revs"] - a["total-revs"]).slice(0, this.resolveLimit(options?.top, Number.POSITIVE_INFINITY));
4001
- } catch (error2) {
4002
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
4001
+ } catch (error) {
4002
+ const errorMsg = error instanceof Error ? error.message : String(error);
4003
4003
  this.logger.error(`Failed to read entity effort: ${errorMsg}`);
4004
- throw error2;
4004
+ throw error;
4005
4005
  }
4006
4006
  }
4007
4007
  async getEntityEffortHistory(options) {
@@ -4028,10 +4028,10 @@ var require_codemaat_metrics_repository_csv = __commonJS({
4028
4028
  return Array.from(new Set(rows.map((row) => row.author).filter((author) => author.length > 0))).sort((a, b) => a.localeCompare(b));
4029
4029
  }
4030
4030
  return rows.slice(0, this.resolveLimit(options?.top, Number.POSITIVE_INFINITY));
4031
- } catch (error2) {
4032
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
4031
+ } catch (error) {
4032
+ const errorMsg = error instanceof Error ? error.message : String(error);
4033
4033
  this.logger.error(`Failed to read entity ownership: ${errorMsg}`);
4034
- throw error2;
4034
+ throw error;
4035
4035
  }
4036
4036
  }
4037
4037
  async getEntityOwnershipHistory(options) {
@@ -4834,9 +4834,9 @@ var require_codemaat_fetch_repository_sqlite = __commonJS({
4834
4834
  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);
4835
4835
  db.exec("COMMIT");
4836
4836
  return imported;
4837
- } catch (error2) {
4837
+ } catch (error) {
4838
4838
  db.exec("ROLLBACK");
4839
- throw error2;
4839
+ throw error;
4840
4840
  }
4841
4841
  } finally {
4842
4842
  db.close();
@@ -5112,7 +5112,7 @@ var require_codemaat_service = __commonJS({
5112
5112
  value: true
5113
5113
  });
5114
5114
  exports2.CodemaatService = void 0;
5115
- var CodemaatService = class CodemaatService {
5115
+ var CodemaatService2 = class CodemaatService {
5116
5116
  static {
5117
5117
  __name(this, "CodemaatService");
5118
5118
  }
@@ -5144,7 +5144,7 @@ var require_codemaat_service = __commonJS({
5144
5144
  });
5145
5145
  }
5146
5146
  };
5147
- exports2.CodemaatService = CodemaatService;
5147
+ exports2.CodemaatService = CodemaatService2;
5148
5148
  }
5149
5149
  });
5150
5150
 
@@ -5728,24 +5728,24 @@ var require_github_client_retriable = __commonJS({
5728
5728
  this.rateLimitManager.updateFromHeaders(response.headers);
5729
5729
  }
5730
5730
  return response;
5731
- } catch (error2) {
5732
- if (this.isRateLimitError(error2)) {
5731
+ } catch (error) {
5732
+ if (this.isRateLimitError(error)) {
5733
5733
  if (attempt < maxRetries - 1 && this.rateLimitManager) {
5734
5734
  await this.rateLimitManager.waitForReset(attempt);
5735
5735
  continue;
5736
5736
  }
5737
- this.logger.error(`Rate limit error after ${maxRetries} retries: ${error2.response?.status}`);
5738
- throw error2;
5737
+ this.logger.error(`Rate limit error after ${maxRetries} retries: ${error.response?.status}`);
5738
+ throw error;
5739
5739
  }
5740
- if (this.isRetryableNetworkError(error2)) {
5740
+ if (this.isRetryableNetworkError(error)) {
5741
5741
  if (attempt < maxRetries - 1) {
5742
5742
  await this.waitForRetry(attempt);
5743
5743
  continue;
5744
5744
  }
5745
- this.logger.error(`Network error after ${maxRetries} retries: ${error2.message}`);
5746
- throw error2;
5745
+ this.logger.error(`Network error after ${maxRetries} retries: ${error.message}`);
5746
+ throw error;
5747
5747
  }
5748
- throw error2;
5748
+ throw error;
5749
5749
  }
5750
5750
  }
5751
5751
  throw new Error("rateLimitedGet: unexpected exit from retry loop");
@@ -5755,8 +5755,8 @@ var require_github_client_retriable = __commonJS({
5755
5755
  * Acts as a type guard so callers can access `AxiosError` properties
5756
5756
  * without casting.
5757
5757
  */
5758
- isRateLimitError(error2) {
5759
- return axios_1.default.isAxiosError(error2) && (error2.response?.status === 429 || error2.response?.status === 403);
5758
+ isRateLimitError(error) {
5759
+ return axios_1.default.isAxiosError(error) && (error.response?.status === 429 || error.response?.status === 403);
5760
5760
  }
5761
5761
  /**
5762
5762
  * Check if the error is a transient network error that can be retried.
@@ -5772,11 +5772,11 @@ var require_github_client_retriable = __commonJS({
5772
5772
  * Acts as a type guard so callers can access `AxiosError` properties
5773
5773
  * without casting.
5774
5774
  */
5775
- isRetryableNetworkError(error2) {
5776
- if (!axios_1.default.isAxiosError(error2)) {
5775
+ isRetryableNetworkError(error) {
5776
+ if (!axios_1.default.isAxiosError(error)) {
5777
5777
  return false;
5778
5778
  }
5779
- if (!error2.response) {
5779
+ if (!error.response) {
5780
5780
  const retryableCodes = [
5781
5781
  "ECONNRESET",
5782
5782
  "ECONNABORTED",
@@ -5785,14 +5785,14 @@ var require_github_client_retriable = __commonJS({
5785
5785
  "ENOTFOUND",
5786
5786
  "ERR_NETWORK"
5787
5787
  ];
5788
- if (error2.code && retryableCodes.includes(error2.code)) {
5788
+ if (error.code && retryableCodes.includes(error.code)) {
5789
5789
  return true;
5790
5790
  }
5791
- if (error2.message && /socket hang up|network error/i.test(error2.message)) {
5791
+ if (error.message && /socket hang up|network error/i.test(error.message)) {
5792
5792
  return true;
5793
5793
  }
5794
5794
  }
5795
- if (error2.response && (error2.response.status === 502 || error2.response.status === 503)) {
5795
+ if (error.response && (error.response.status === 502 || error.response.status === 503)) {
5796
5796
  return true;
5797
5797
  }
5798
5798
  return false;
@@ -5935,15 +5935,15 @@ var require_github_pr_client = __commonJS({
5935
5935
  }
5936
5936
  this.logger.info(`Fetched ${allPRs.length} PRs total`);
5937
5937
  return allPRs;
5938
- } catch (error2) {
5939
- if (axios_1.default.isAxiosError(error2)) {
5940
- this.logger.error(`GitHub API error fetching PRs: ${error2.response?.status} - ${error2.response?.statusText}`);
5941
- if (error2.response?.status === 401) {
5938
+ } catch (error) {
5939
+ if (axios_1.default.isAxiosError(error)) {
5940
+ this.logger.error(`GitHub API error fetching PRs: ${error.response?.status} - ${error.response?.statusText}`);
5941
+ if (error.response?.status === 401) {
5942
5942
  throw new Error("GitHub authentication failed - invalid token");
5943
5943
  }
5944
- throw new Error(`Failed to fetch PRs: ${error2.message}`);
5944
+ throw new Error(`Failed to fetch PRs: ${error.message}`);
5945
5945
  }
5946
- throw error2;
5946
+ throw error;
5947
5947
  }
5948
5948
  }
5949
5949
  async fetchPRComments(prNumber) {
@@ -5971,12 +5971,12 @@ var require_github_pr_client = __commonJS({
5971
5971
  }
5972
5972
  this.logger.info(`Fetched ${allComments.length} comments for PR #${prNumber} total`);
5973
5973
  return allComments;
5974
- } catch (error2) {
5975
- if (axios_1.default.isAxiosError(error2)) {
5976
- this.logger.error(`GitHub API error fetching PR comments: ${error2.message}`);
5977
- throw new Error(`Failed to fetch PR comments: ${error2.message}`);
5974
+ } catch (error) {
5975
+ if (axios_1.default.isAxiosError(error)) {
5976
+ this.logger.error(`GitHub API error fetching PR comments: ${error.message}`);
5977
+ throw new Error(`Failed to fetch PR comments: ${error.message}`);
5978
5978
  }
5979
- throw error2;
5979
+ throw error;
5980
5980
  }
5981
5981
  }
5982
5982
  };
@@ -6129,15 +6129,15 @@ var require_github_workflow_client = __commonJS({
6129
6129
  }
6130
6130
  this.logger.info(`Fetched ${allRuns.length} workflow runs total`);
6131
6131
  return allRuns;
6132
- } catch (error2) {
6133
- if (axios_1.default.isAxiosError(error2)) {
6134
- this.logger.error(`GitHub API error fetching workflows: ${error2.response?.status} - ${error2.response?.statusText}`);
6135
- if (error2.response?.status === 401) {
6132
+ } catch (error) {
6133
+ if (axios_1.default.isAxiosError(error)) {
6134
+ this.logger.error(`GitHub API error fetching workflows: ${error.response?.status} - ${error.response?.statusText}`);
6135
+ if (error.response?.status === 401) {
6136
6136
  throw new Error("GitHub authentication failed - invalid token");
6137
6137
  }
6138
- throw new Error(`Failed to fetch workflows: ${error2.message}`);
6138
+ throw new Error(`Failed to fetch workflows: ${error.message}`);
6139
6139
  }
6140
- throw error2;
6140
+ throw error;
6141
6141
  }
6142
6142
  }
6143
6143
  async fetchWorkflowsForDay(startDate, endDate, rawFilters) {
@@ -6940,8 +6940,8 @@ var require_gitlab_clients = __commonJS({
6940
6940
  ...pipeline,
6941
6941
  ...details
6942
6942
  };
6943
- } catch (error2) {
6944
- this.logger.error(`Failed to fetch GitLab pipeline ${pipeline.id} details`, error2);
6943
+ } catch (error) {
6944
+ this.logger.error(`Failed to fetch GitLab pipeline ${pipeline.id} details`, error);
6945
6945
  return pipeline;
6946
6946
  }
6947
6947
  }
@@ -7271,19 +7271,19 @@ var require_jira_client = __commonJS({
7271
7271
  }
7272
7272
  this.logger.info(`Fetched ${allIssues.length} Jira issues total`);
7273
7273
  return allIssues;
7274
- } catch (error2) {
7275
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7274
+ } catch (error) {
7275
+ const errorMsg = error instanceof Error ? error.message : String(error);
7276
7276
  this.logger.error(`Failed to fetch Jira issues: ${errorMsg}`);
7277
- if (axios_1.default.isAxiosError(error2)) {
7278
- if (error2.response?.status === 401) {
7277
+ if (axios_1.default.isAxiosError(error)) {
7278
+ if (error.response?.status === 401) {
7279
7279
  throw new Error("Jira authentication failed. Check email and token.");
7280
- } else if (error2.response?.status === 404) {
7280
+ } else if (error.response?.status === 404) {
7281
7281
  throw new Error("Jira project not found or API endpoint not accessible.");
7282
- } else if (error2.code === "ECONNABORTED") {
7282
+ } else if (error.code === "ECONNABORTED") {
7283
7283
  throw new Error("Jira API request timeout (30s).");
7284
7284
  }
7285
7285
  }
7286
- throw error2;
7286
+ throw error;
7287
7287
  }
7288
7288
  }
7289
7289
  async fetchIssueChanges(issueKey) {
@@ -7297,15 +7297,15 @@ var require_jira_client = __commonJS({
7297
7297
  const changelog = response.data.changelog?.histories || [];
7298
7298
  this.logger.info(`Fetched ${changelog.length} changelog entries for ${issueKey}`);
7299
7299
  return changelog;
7300
- } catch (error2) {
7301
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7300
+ } catch (error) {
7301
+ const errorMsg = error instanceof Error ? error.message : String(error);
7302
7302
  this.logger.error(`Failed to fetch changelog for ${issueKey}: ${errorMsg}`);
7303
- if (axios_1.default.isAxiosError(error2)) {
7304
- if (error2.response?.status === 404) {
7303
+ if (axios_1.default.isAxiosError(error)) {
7304
+ if (error.response?.status === 404) {
7305
7305
  throw new Error(`Jira issue ${issueKey} not found.`);
7306
7306
  }
7307
7307
  }
7308
- throw error2;
7308
+ throw error;
7309
7309
  }
7310
7310
  }
7311
7311
  async fetchIssueComments(issueKey) {
@@ -7315,15 +7315,15 @@ var require_jira_client = __commonJS({
7315
7315
  const comments = response.data.comments || [];
7316
7316
  this.logger.info(`Fetched ${comments.length} comments for ${issueKey}`);
7317
7317
  return comments;
7318
- } catch (error2) {
7319
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7318
+ } catch (error) {
7319
+ const errorMsg = error instanceof Error ? error.message : String(error);
7320
7320
  this.logger.error(`Failed to fetch comments for ${issueKey}: ${errorMsg}`);
7321
- if (axios_1.default.isAxiosError(error2)) {
7322
- if (error2.response?.status === 404) {
7321
+ if (axios_1.default.isAxiosError(error)) {
7322
+ if (error.response?.status === 404) {
7323
7323
  throw new Error(`Jira issue ${issueKey} not found.`);
7324
7324
  }
7325
7325
  }
7326
- throw error2;
7326
+ throw error;
7327
7327
  }
7328
7328
  }
7329
7329
  };
@@ -7413,21 +7413,21 @@ var require_sonarqube_client = __commonJS({
7413
7413
  }
7414
7414
  this.logger.info(`Fetched ${(component.measures || []).length} metrics for project ${this.projectKey}`);
7415
7415
  return component;
7416
- } catch (error2) {
7417
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7416
+ } catch (error) {
7417
+ const errorMsg = error instanceof Error ? error.message : String(error);
7418
7418
  this.logger.error(`Failed to fetch SonarQube measures: ${errorMsg}`);
7419
- if (axios_1.default.isAxiosError(error2)) {
7420
- if (error2.response?.status === 401) {
7419
+ if (axios_1.default.isAxiosError(error)) {
7420
+ if (error.response?.status === 401) {
7421
7421
  throw new Error("SonarQube authentication failed. Check token.");
7422
- } else if (error2.response?.status === 403) {
7422
+ } else if (error.response?.status === 403) {
7423
7423
  throw new Error(`SonarQube access denied for project ${this.projectKey}. Ensure the token user has Browse permission for this project.`);
7424
- } else if (error2.response?.status === 404) {
7424
+ } else if (error.response?.status === 404) {
7425
7425
  throw new Error(`SonarQube project ${this.projectKey} not found.`);
7426
- } else if (error2.code === "ECONNABORTED") {
7426
+ } else if (error.code === "ECONNABORTED") {
7427
7427
  throw new Error("SonarQube API request timeout (30s).");
7428
7428
  }
7429
7429
  }
7430
- throw error2;
7430
+ throw error;
7431
7431
  }
7432
7432
  }
7433
7433
  async fetchHistoricalMeasures(options) {
@@ -7493,19 +7493,19 @@ var require_sonarqube_client = __commonJS({
7493
7493
  }
7494
7494
  this.logger.info(`Fetched ${flatMeasures.length} historical measurements for project ${this.projectKey}`);
7495
7495
  return flatMeasures;
7496
- } catch (error2) {
7497
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7496
+ } catch (error) {
7497
+ const errorMsg = error instanceof Error ? error.message : String(error);
7498
7498
  this.logger.error(`Failed to fetch SonarQube historical measures: ${errorMsg}`);
7499
- if (axios_1.default.isAxiosError(error2)) {
7500
- if (error2.response?.status === 401) {
7499
+ if (axios_1.default.isAxiosError(error)) {
7500
+ if (error.response?.status === 401) {
7501
7501
  throw new Error("SonarQube authentication failed. Check token.");
7502
- } else if (error2.response?.status === 403) {
7502
+ } else if (error.response?.status === 403) {
7503
7503
  throw new Error(`SonarQube access denied for project ${this.projectKey}. Ensure the token user has Browse permission for this project.`);
7504
- } else if (error2.code === "ECONNABORTED") {
7504
+ } else if (error.code === "ECONNABORTED") {
7505
7505
  throw new Error("SonarQube API request timeout (30s).");
7506
7506
  }
7507
7507
  }
7508
- throw error2;
7508
+ throw error;
7509
7509
  }
7510
7510
  }
7511
7511
  async fetchComponentTree(options) {
@@ -7562,21 +7562,21 @@ var require_sonarqube_client = __commonJS({
7562
7562
  ] : allComponents;
7563
7563
  this.logger.info(`Fetched component tree with ${result.length} components for ${component}`);
7564
7564
  return result;
7565
- } catch (error2) {
7566
- const errorMsg = error2 instanceof Error ? error2.message : String(error2);
7565
+ } catch (error) {
7566
+ const errorMsg = error instanceof Error ? error.message : String(error);
7567
7567
  this.logger.error(`Failed to fetch SonarQube component tree: ${errorMsg}`);
7568
- if (axios_1.default.isAxiosError(error2)) {
7569
- if (error2.response?.status === 401) {
7568
+ if (axios_1.default.isAxiosError(error)) {
7569
+ if (error.response?.status === 401) {
7570
7570
  throw new Error("SonarQube authentication failed. Check token.");
7571
- } else if (error2.response?.status === 403) {
7571
+ } else if (error.response?.status === 403) {
7572
7572
  throw new Error(`SonarQube access denied for component ${options?.component || this.projectKey}. Ensure the token user has Browse permission for this project/component.`);
7573
- } else if (error2.response?.status === 404) {
7573
+ } else if (error.response?.status === 404) {
7574
7574
  throw new Error(`SonarQube component ${options?.component || this.projectKey} not found.`);
7575
- } else if (error2.code === "ECONNABORTED") {
7575
+ } else if (error.code === "ECONNABORTED") {
7576
7576
  throw new Error("SonarQube API request timeout (30s).");
7577
7577
  }
7578
7578
  }
7579
- throw error2;
7579
+ throw error;
7580
7580
  }
7581
7581
  }
7582
7582
  };
@@ -7620,7 +7620,7 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7620
7620
  }
7621
7621
  async fetchComponentTree(options) {
7622
7622
  try {
7623
- this.logger.debug(`Fetching component tree: ${JSON.stringify(options)}`);
7623
+ this.logger.debug(`Fetching component tree: ${this.describeOptions(options)}`);
7624
7624
  const componentTree = await this.sonarqubeClient.fetchComponentTree({
7625
7625
  component: options?.component,
7626
7626
  depth: options?.depth,
@@ -7628,14 +7628,14 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7628
7628
  });
7629
7629
  await this.appendTimestampedEntry(this.componentTreeJsonRepository, componentTree);
7630
7630
  return componentTree;
7631
- } catch (error2) {
7632
- this.logger.error(`Failed to fetch component tree: ${error2}`, error2 instanceof Error ? error2.stack : "");
7633
- throw new Error(`Failed to fetch component tree: ${error2 instanceof Error ? error2.message : String(error2)}`);
7631
+ } catch (error) {
7632
+ this.logger.error(`Failed to fetch component tree: ${error}`, error instanceof Error ? error.stack : "");
7633
+ throw new Error(`Failed to fetch component tree: ${error instanceof Error ? error.message : String(error)}`);
7634
7634
  }
7635
7635
  }
7636
7636
  async fetchHistoricalMeasures(options) {
7637
7637
  try {
7638
- this.logger.debug(`Fetching historical measures: ${JSON.stringify(options)}`);
7638
+ this.logger.debug(`Fetching historical measures: ${this.describeOptions(options)}`);
7639
7639
  const fromDisk = await this.historicalMeasuresJsonRepository.load();
7640
7640
  const cachedData = (0, types_1.extractLatestData)(fromDisk);
7641
7641
  const cached = Array.isArray(cachedData) ? cachedData : [];
@@ -7669,9 +7669,9 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7669
7669
  const historical = await this.sonarqubeClient.fetchHistoricalMeasures(options);
7670
7670
  await this.appendTimestampedEntry(this.historicalMeasuresJsonRepository, historical);
7671
7671
  return historical;
7672
- } catch (error2) {
7673
- this.logger.error(`Failed to fetch historical measures: ${error2}`, error2 instanceof Error ? error2.stack : "");
7674
- throw new Error(`Failed to fetch historical measures: ${error2 instanceof Error ? error2.message : String(error2)}`);
7672
+ } catch (error) {
7673
+ this.logger.error(`Failed to fetch historical measures: ${error}`, error instanceof Error ? error.stack : "");
7674
+ throw new Error(`Failed to fetch historical measures: ${error instanceof Error ? error.message : String(error)}`);
7675
7675
  }
7676
7676
  }
7677
7677
  findLatestDateInMeasures(measures) {
@@ -7679,6 +7679,16 @@ var require_sonarqube_fetch_metrics_repository_json = __commonJS({
7679
7679
  if (timestamps.length === 0) return (/* @__PURE__ */ new Date(0)).toISOString();
7680
7680
  return new Date(Math.max(...timestamps)).toISOString();
7681
7681
  }
7682
+ /**
7683
+ * Formats fetch options for debug logging. When no options are provided the
7684
+ * call is expected: the client falls back to default metrics and date ranges.
7685
+ */
7686
+ describeOptions(options) {
7687
+ if (options === void 0) {
7688
+ return "no options provided \u2014 defaults will be applied";
7689
+ }
7690
+ return JSON.stringify(options);
7691
+ }
7682
7692
  mergeHistoricalMeasures(existing, incoming) {
7683
7693
  const key = /* @__PURE__ */ __name((m) => `${m.metric ?? ""}_${m.timestamp ?? ""}`, "key");
7684
7694
  const map = /* @__PURE__ */ new Map();
@@ -10852,12 +10862,12 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10852
10862
  };
10853
10863
  ee.Ignore = Ae;
10854
10864
  });
10855
- var Fs = R((z) => {
10865
+ var Fs = R((z2) => {
10856
10866
  "use strict";
10857
- Object.defineProperty(z, "__esModule", {
10867
+ Object.defineProperty(z2, "__esModule", {
10858
10868
  value: true
10859
10869
  });
10860
- z.Processor = z.SubWalks = z.MatchRecord = z.HasWalkedCache = void 0;
10870
+ z2.Processor = z2.SubWalks = z2.MatchRecord = z2.HasWalkedCache = void 0;
10861
10871
  var Ds = H(), se = class n {
10862
10872
  static {
10863
10873
  __name(this, "n");
@@ -10879,7 +10889,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10879
10889
  ]));
10880
10890
  }
10881
10891
  };
10882
- z.HasWalkedCache = se;
10892
+ z2.HasWalkedCache = se;
10883
10893
  var ie = class {
10884
10894
  static {
10885
10895
  __name(this, "ie");
@@ -10899,7 +10909,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10899
10909
  ]);
10900
10910
  }
10901
10911
  };
10902
- z.MatchRecord = ie;
10912
+ z2.MatchRecord = ie;
10903
10913
  var re = class {
10904
10914
  static {
10905
10915
  __name(this, "re");
@@ -10929,7 +10939,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
10929
10939
  ].filter((t) => t.canReaddir());
10930
10940
  }
10931
10941
  };
10932
- z.SubWalks = re;
10942
+ z2.SubWalks = re;
10933
10943
  var Me = class n {
10934
10944
  static {
10935
10945
  __name(this, "n");
@@ -11016,7 +11026,7 @@ globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) retur
11016
11026
  t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
11017
11027
  }
11018
11028
  };
11019
- z.Processor = Me;
11029
+ z2.Processor = Me;
11020
11030
  });
11021
11031
  var Ls = R((X) => {
11022
11032
  "use strict";
@@ -12746,8 +12756,8 @@ var require_sonarqube_local_analysis = __commonJS({
12746
12756
  this.logger.info(`\u{1F9F9} Removing existing local SonarQube data at "${this.localDataFilePath}" to ensure clean state.`);
12747
12757
  try {
12748
12758
  (0, node_fs_1.unlinkSync)(this.localDataFilePath);
12749
- } catch (error2) {
12750
- this.logger.warn(`Failed to clear local SonarQube data at "${this.localDataFilePath}". You may want to delete this file manually: ${error2}`);
12759
+ } catch (error) {
12760
+ this.logger.warn(`Failed to clear local SonarQube data at "${this.localDataFilePath}". You may want to delete this file manually: ${error}`);
12751
12761
  }
12752
12762
  }
12753
12763
  }
@@ -12936,12 +12946,12 @@ var require_commit_traverser = __commonJS({
12936
12946
  pairedCommits,
12937
12947
  commits: filtered
12938
12948
  };
12939
- } catch (error2) {
12940
- if (error2 instanceof Error) {
12941
- this.logger.error(`Error traversing commits: ${error2.message}`);
12942
- throw new Error(`Failed to traverse commits: ${error2.message}`);
12949
+ } catch (error) {
12950
+ if (error instanceof Error) {
12951
+ this.logger.error(`Error traversing commits: ${error.message}`);
12952
+ throw new Error(`Failed to traverse commits: ${error.message}`);
12943
12953
  }
12944
- throw error2;
12954
+ throw error;
12945
12955
  }
12946
12956
  }
12947
12957
  /**
@@ -12977,12 +12987,12 @@ var require_commit_traverser = __commonJS({
12977
12987
  });
12978
12988
  const commits = this.parseCommitOutput(output.toString());
12979
12989
  return commits;
12980
- } catch (error2) {
12981
- if (error2 instanceof Error) {
12982
- this.logger.error(`Git command failed: ${error2.message}`);
12983
- throw error2;
12990
+ } catch (error) {
12991
+ if (error instanceof Error) {
12992
+ this.logger.error(`Git command failed: ${error.message}`);
12993
+ throw error;
12984
12994
  }
12985
- throw error2;
12995
+ throw error;
12986
12996
  }
12987
12997
  }
12988
12998
  /**
@@ -19022,8 +19032,8 @@ var require_pipelines_fetch_repository_json = __commonJS({
19022
19032
  await this.writeJson(progressPath, {
19023
19033
  page
19024
19034
  });
19025
- } catch (error2) {
19026
- if (this.isUnprocessableEntityError(error2)) {
19035
+ } catch (error) {
19036
+ if (this.isUnprocessableEntityError(error)) {
19027
19037
  this.logger.info(`GitHub returned 422 while fetching workflows page ${page}; treating as pagination end.`);
19028
19038
  await this.writeJson(incompletedPath, runs);
19029
19039
  await this.writeJson(progressPath, {
@@ -19035,7 +19045,7 @@ var require_pipelines_fetch_repository_json = __commonJS({
19035
19045
  await this.writeJson(progressPath, {
19036
19046
  page
19037
19047
  });
19038
- throw error2;
19048
+ throw error;
19039
19049
  }
19040
19050
  }
19041
19051
  await this.deleteFile(progressPath);
@@ -19063,11 +19073,11 @@ var require_pipelines_fetch_repository_json = __commonJS({
19063
19073
  try {
19064
19074
  const contents = await fs.readFile(filePath, "utf-8");
19065
19075
  return JSON.parse(contents);
19066
- } catch (error2) {
19067
- if (error2.code === "ENOENT") {
19076
+ } catch (error) {
19077
+ if (error.code === "ENOENT") {
19068
19078
  return fallback;
19069
19079
  }
19070
- throw error2;
19080
+ throw error;
19071
19081
  }
19072
19082
  }
19073
19083
  async writeJson(filePath, value) {
@@ -19079,17 +19089,17 @@ var require_pipelines_fetch_repository_json = __commonJS({
19079
19089
  async deleteFile(filePath) {
19080
19090
  try {
19081
19091
  await fs.unlink(filePath);
19082
- } catch (error2) {
19083
- if (error2.code !== "ENOENT") {
19084
- throw error2;
19092
+ } catch (error) {
19093
+ if (error.code !== "ENOENT") {
19094
+ throw error;
19085
19095
  }
19086
19096
  }
19087
19097
  }
19088
- isUnprocessableEntityError(error2) {
19089
- if (!error2 || typeof error2 !== "object") {
19098
+ isUnprocessableEntityError(error) {
19099
+ if (!error || typeof error !== "object") {
19090
19100
  return false;
19091
19101
  }
19092
- const maybeError = error2;
19102
+ const maybeError = error;
19093
19103
  return maybeError.status === 422 || maybeError.response?.status === 422;
19094
19104
  }
19095
19105
  };
@@ -19336,8 +19346,8 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19336
19346
  partial: null
19337
19347
  });
19338
19348
  break;
19339
- } catch (error2) {
19340
- const statusCode = this.getHttpStatusCode(error2);
19349
+ } catch (error) {
19350
+ const statusCode = this.getHttpStatusCode(error);
19341
19351
  if (statusCode === 404 || statusCode === 502) {
19342
19352
  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.`);
19343
19353
  processedRunIds.add(runId);
@@ -19356,7 +19366,7 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19356
19366
  page
19357
19367
  }
19358
19368
  });
19359
- throw error2;
19369
+ throw error;
19360
19370
  }
19361
19371
  }
19362
19372
  }
@@ -19384,11 +19394,11 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19384
19394
  try {
19385
19395
  const contents = await fs.readFile(filePath, "utf-8");
19386
19396
  return JSON.parse(contents);
19387
- } catch (error2) {
19388
- if (error2.code === "ENOENT") {
19397
+ } catch (error) {
19398
+ if (error.code === "ENOENT") {
19389
19399
  return fallback;
19390
19400
  }
19391
- throw error2;
19401
+ throw error;
19392
19402
  }
19393
19403
  }
19394
19404
  async writeJson(filePath, value) {
@@ -19400,14 +19410,14 @@ var require_pipelines_job_fetch_repository_json = __commonJS({
19400
19410
  async deleteFile(filePath) {
19401
19411
  try {
19402
19412
  await fs.unlink(filePath);
19403
- } catch (error2) {
19404
- if (error2.code !== "ENOENT") {
19405
- throw error2;
19413
+ } catch (error) {
19414
+ if (error.code !== "ENOENT") {
19415
+ throw error;
19406
19416
  }
19407
19417
  }
19408
19418
  }
19409
- getHttpStatusCode(error2) {
19410
- const err = error2;
19419
+ getHttpStatusCode(error) {
19420
+ const err = error;
19411
19421
  return err?.status ?? err?.response?.status;
19412
19422
  }
19413
19423
  toDateBoundary(dateValue, boundary = "start") {
@@ -21546,7 +21556,7 @@ var require_filter_resolver = __commonJS({
21546
21556
  exports2.FilterResolver = void 0;
21547
21557
  var index_1 = require_filters();
21548
21558
  var index_2 = require_infrastructure();
21549
- var FilterResolver = class FilterResolver {
21559
+ var FilterResolver2 = class FilterResolver {
21550
21560
  static {
21551
21561
  __name(this, "FilterResolver");
21552
21562
  }
@@ -21682,7 +21692,7 @@ var require_filter_resolver = __commonJS({
21682
21692
  return true;
21683
21693
  }
21684
21694
  };
21685
- exports2.FilterResolver = FilterResolver;
21695
+ exports2.FilterResolver = FilterResolver2;
21686
21696
  }
21687
21697
  });
21688
21698
 
@@ -23417,12 +23427,14 @@ __export(src_exports, {
23417
23427
  buildIssueMetricsInputSchema: () => buildIssueMetricsInputSchema,
23418
23428
  buildMetricsInputSchema: () => buildMetricsInputSchema,
23419
23429
  buildPipelineDashboardInputSchema: () => buildPipelineDashboardInputSchema,
23430
+ buildSavedFilterGetInputSchema: () => buildSavedFilterGetInputSchema,
23431
+ buildSavedFilterListInputSchema: () => buildSavedFilterListInputSchema,
23420
23432
  buildSonarqubeComponentTreeInputSchema: () => buildSonarqubeComponentTreeInputSchema,
23421
23433
  configureMcpLogging: () => configureMcpLogging,
23422
23434
  createMcpMetricsReader: () => createMcpMetricsReader,
23435
+ createMcpServer: () => createMcpServer,
23423
23436
  findTool: () => findTool,
23424
23437
  getPrompt: () => getPrompt,
23425
- handleRequest: () => handleRequest,
23426
23438
  listEngineeringHealthMetricCatalog: () => listEngineeringHealthMetricCatalog,
23427
23439
  listResourceTemplates: () => listResourceTemplates,
23428
23440
  listResources: () => listResources,
@@ -23440,12 +23452,18 @@ __export(src_exports, {
23440
23452
  parseIssueMetricsArguments: () => parseIssueMetricsArguments,
23441
23453
  parseMetricsToolArguments: () => parseMetricsToolArguments,
23442
23454
  parsePipelineDashboardArguments: () => parsePipelineDashboardArguments,
23455
+ parseSavedFilterGetArguments: () => parseSavedFilterGetArguments,
23456
+ parseSavedFilterListArguments: () => parseSavedFilterListArguments,
23443
23457
  parseSonarqubeComponentTreeArguments: () => parseSonarqubeComponentTreeArguments,
23444
23458
  prompts: () => prompts,
23445
23459
  readResource: () => readResource,
23446
23460
  readString: () => readString,
23447
23461
  redactSecrets: () => redactSecrets,
23448
23462
  redirectConsoleToStderr: () => redirectConsoleToStderr,
23463
+ registerAll: () => registerAll,
23464
+ registerPrompts: () => registerPrompts,
23465
+ registerResources: () => registerResources,
23466
+ registerTools: () => registerTools,
23449
23467
  resolveMcpLogLevel: () => resolveMcpLogLevel,
23450
23468
  startMcpServer: () => startMcpServer,
23451
23469
  tools: () => tools
@@ -23453,7 +23471,8 @@ __export(src_exports, {
23453
23471
  module.exports = __toCommonJS(src_exports);
23454
23472
 
23455
23473
  // src/server.ts
23456
- var import_node_readline = require("node:readline");
23474
+ var import_server2 = require("@modelcontextprotocol/server");
23475
+ var import_stdio = require("@modelcontextprotocol/server/stdio");
23457
23476
  var import_utils5 = __toESM(require_dist());
23458
23477
  var import_core4 = __toESM(require_dist2());
23459
23478
 
@@ -23529,216 +23548,11 @@ var toolLogger = new import_utils.Logger("SmmMcpTool", mcpLogLevel);
23529
23548
  var resourceLogger = new import_utils.Logger("SmmMcpResource", mcpLogLevel);
23530
23549
  var promptLogger = new import_utils.Logger("SmmMcpPrompt", mcpLogLevel);
23531
23550
 
23532
- // src/prompts.ts
23533
- var prompts = [
23534
- {
23535
- name: "smm_sprint_health_review",
23536
- description: "Review engineering health for the current sprint and highlight metrics that need attention.",
23537
- arguments: [
23538
- {
23539
- name: "project",
23540
- description: "Optional github_repository project name from smm_config.json.",
23541
- required: false
23542
- },
23543
- {
23544
- name: "startDate",
23545
- description: "Current window start date (YYYY-MM-DD).",
23546
- required: false
23547
- },
23548
- {
23549
- name: "endDate",
23550
- description: "Current window end date (YYYY-MM-DD).",
23551
- required: false
23552
- }
23553
- ]
23554
- },
23555
- {
23556
- name: "smm_compare_windows",
23557
- description: "Compare engineering health between two time windows and summarise what improved or regressed.",
23558
- arguments: [
23559
- {
23560
- name: "project",
23561
- description: "Optional github_repository project name from smm_config.json.",
23562
- required: false
23563
- },
23564
- {
23565
- name: "startDate",
23566
- description: "Current window start date (YYYY-MM-DD).",
23567
- required: true
23568
- },
23569
- {
23570
- name: "endDate",
23571
- description: "Current window end date (YYYY-MM-DD).",
23572
- required: true
23573
- },
23574
- {
23575
- name: "compareStartDate",
23576
- description: "Previous window start date (YYYY-MM-DD).",
23577
- required: true
23578
- },
23579
- {
23580
- name: "compareEndDate",
23581
- description: "Previous window end date (YYYY-MM-DD).",
23582
- required: true
23583
- }
23584
- ]
23585
- },
23586
- {
23587
- name: "smm_dora_summary",
23588
- description: "Summarise DORA metrics for a project, including deployment frequency and failure rate.",
23589
- arguments: [
23590
- {
23591
- name: "project",
23592
- description: "Optional github_repository project name from smm_config.json.",
23593
- required: false
23594
- },
23595
- {
23596
- name: "startDate",
23597
- description: "Optional window start date (YYYY-MM-DD).",
23598
- required: false
23599
- },
23600
- {
23601
- name: "endDate",
23602
- description: "Optional window end date (YYYY-MM-DD).",
23603
- required: false
23604
- }
23605
- ]
23606
- },
23607
- {
23608
- name: "smm_code_hotspots",
23609
- description: "Identify code hotspots (high churn and high coupling files) and pair-programming gaps for a project.",
23610
- arguments: [
23611
- {
23612
- name: "project",
23613
- description: "Optional github_repository project name from smm_config.json.",
23614
- required: false
23615
- },
23616
- {
23617
- name: "startDate",
23618
- description: "Optional window start date (YYYY-MM-DD).",
23619
- required: false
23620
- },
23621
- {
23622
- name: "endDate",
23623
- description: "Optional window end date (YYYY-MM-DD).",
23624
- required: false
23625
- }
23626
- ]
23627
- }
23628
- ];
23629
- function getArg(values, name) {
23630
- const value = values[name];
23631
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
23632
- }
23633
- __name(getArg, "getArg");
23634
- function optional(value) {
23635
- return value ? value : "<not provided>";
23636
- }
23637
- __name(optional, "optional");
23638
- async function getPrompt(name, argumentsValue) {
23639
- promptLogger.debug(`Building prompt ${name}`, {
23640
- arguments: argumentsValue
23641
- });
23642
- const values = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
23643
- const project = getArg(values, "project");
23644
- const startDate = getArg(values, "startDate");
23645
- const endDate = getArg(values, "endDate");
23646
- const compareStartDate = getArg(values, "compareStartDate");
23647
- const compareEndDate = getArg(values, "compareEndDate");
23648
- const messages = [];
23649
- switch (name) {
23650
- case "smm_sprint_health_review":
23651
- messages.push({
23652
- role: "user",
23653
- content: {
23654
- type: "text",
23655
- text: [
23656
- "You are acting as a software engineering coach.",
23657
- "Use the Software Metrics Machine MCP tools to evaluate the engineering health of the project.",
23658
- "",
23659
- `Project: ${optional(project)}`,
23660
- `Current window: ${optional(startDate)} to ${optional(endDate)}`,
23661
- "",
23662
- "Steps:",
23663
- "1. Call smm_get_engineering_health with the filters above.",
23664
- '2. Highlight any metric whose recommendation level is "watch" or "critical".',
23665
- "3. Suggest one concrete action for each degraded metric, grounded in the data returned."
23666
- ].join("\n")
23667
- }
23668
- });
23669
- break;
23670
- case "smm_compare_windows":
23671
- messages.push({
23672
- role: "user",
23673
- content: {
23674
- type: "text",
23675
- text: [
23676
- "You are acting as a software engineering coach.",
23677
- "Use the Software Metrics Machine MCP tools to compare two windows.",
23678
- "",
23679
- `Project: ${optional(project)}`,
23680
- `Current window: ${optional(startDate)} to ${optional(endDate)}`,
23681
- `Previous window: ${optional(compareStartDate)} to ${optional(compareEndDate)}`,
23682
- "",
23683
- "Steps:",
23684
- "1. Call smm_get_engineering_health with startDate, endDate, compareStartDate, and compareEndDate.",
23685
- "2. For each metric, summarise whether the trend is improving, stable, or degrading.",
23686
- "3. Produce a short before/after table and a prioritised list of follow-up actions."
23687
- ].join("\n")
23688
- }
23689
- });
23690
- break;
23691
- case "smm_dora_summary":
23692
- messages.push({
23693
- role: "user",
23694
- content: {
23695
- type: "text",
23696
- text: [
23697
- "You are acting as a DORA metrics analyst.",
23698
- "Use the Software Metrics Machine MCP tools to report DORA metrics.",
23699
- "",
23700
- `Project: ${optional(project)}`,
23701
- `Window: ${optional(startDate)} to ${optional(endDate)}`,
23702
- "",
23703
- "Steps:",
23704
- "1. Call smm_get_dora_metrics with the filters above.",
23705
- "2. Report deployment frequency, failure rate signals, and pipeline duration.",
23706
- "3. Classify the project against the DORA tiers (elite, high, medium, low) where possible."
23707
- ].join("\n")
23708
- }
23709
- });
23710
- break;
23711
- case "smm_code_hotspots":
23712
- messages.push({
23713
- role: "user",
23714
- content: {
23715
- type: "text",
23716
- text: [
23717
- "You are acting as a code health reviewer.",
23718
- "Use the Software Metrics Machine MCP tools to surface code hotspots.",
23719
- "",
23720
- `Project: ${optional(project)}`,
23721
- `Window: ${optional(startDate)} to ${optional(endDate)}`,
23722
- "",
23723
- "Steps:",
23724
- "1. Call smm_get_code_metrics to retrieve churn, coupling, and pairing data.",
23725
- "2. Identify files with the highest churn and strongest coupling.",
23726
- "3. Cross-reference pairing gaps and propose concrete refactoring or pairing actions."
23727
- ].join("\n")
23728
- }
23729
- });
23730
- break;
23731
- default:
23732
- throw new Error(`Unknown MCP prompt: ${name}`);
23733
- }
23734
- return {
23735
- description: prompts.find((prompt) => prompt.name === name)?.description,
23736
- messages
23737
- };
23738
- }
23739
- __name(getPrompt, "getPrompt");
23551
+ // src/registration.ts
23552
+ var import_server = require("@modelcontextprotocol/server");
23553
+ var import_zod = require("zod");
23740
23554
 
23741
- // src/resources.ts
23555
+ // src/tools.ts
23742
23556
  var import_core2 = __toESM(require_dist2());
23743
23557
  var import_utils3 = __toESM(require_dist());
23744
23558
 
@@ -23922,6 +23736,13 @@ function parseDoraMetricsArguments(argumentsValue) {
23922
23736
  "include",
23923
23737
  "flag",
23924
23738
  "exclude"
23739
+ ]),
23740
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23741
+ filter: readString(args.filter, "filter"),
23742
+ period: readEnum(args.period, "period", [
23743
+ "day",
23744
+ "week",
23745
+ "month"
23925
23746
  ])
23926
23747
  };
23927
23748
  }
@@ -23963,7 +23784,9 @@ function parseChangeRequestMetricsArguments(argumentsValue) {
23963
23784
  "include",
23964
23785
  "flag",
23965
23786
  "exclude"
23966
- ])
23787
+ ]),
23788
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23789
+ filter: readString(args.filter, "filter")
23967
23790
  };
23968
23791
  }
23969
23792
  __name(parseChangeRequestMetricsArguments, "parseChangeRequestMetricsArguments");
@@ -23991,6 +23814,13 @@ function parsePipelineDashboardArguments(argumentsValue) {
23991
23814
  "include",
23992
23815
  "flag",
23993
23816
  "exclude"
23817
+ ]),
23818
+ rawFilters: readString(args.rawFilters, "rawFilters"),
23819
+ filter: readString(args.filter, "filter"),
23820
+ period: readEnum(args.period, "period", [
23821
+ "day",
23822
+ "week",
23823
+ "month"
23994
23824
  ])
23995
23825
  };
23996
23826
  }
@@ -24005,7 +23835,9 @@ function parseCodeEntityArguments(argumentsValue) {
24005
23835
  ignorePatterns: readString(args.ignorePatterns, "ignorePatterns"),
24006
23836
  includePatterns: readString(args.includePatterns, "includePatterns"),
24007
23837
  top: readNumber(args.top, "top"),
24008
- authors: readString(args.authors, "authors")
23838
+ authors: readString(args.authors, "authors"),
23839
+ minCoupling: readNumber(args.minCoupling, "minCoupling"),
23840
+ entity: readString(args.entity, "entity")
24009
23841
  };
24010
23842
  }
24011
23843
  __name(parseCodeEntityArguments, "parseCodeEntityArguments");
@@ -24014,7 +23846,11 @@ function parseCodeHistoryArguments(argumentsValue) {
24014
23846
  if (!args) {
24015
23847
  return {};
24016
23848
  }
24017
- return parseMetricsToolArguments(args);
23849
+ return {
23850
+ ...parseMetricsToolArguments(args),
23851
+ authors: readString(args.authors, "authors"),
23852
+ minShared: readNumber(args.minShared, "minShared")
23853
+ };
24018
23854
  }
24019
23855
  __name(parseCodeHistoryArguments, "parseCodeHistoryArguments");
24020
23856
  function parseSonarqubeComponentTreeArguments(argumentsValue) {
@@ -24093,6 +23929,40 @@ function parseHealthCheckArguments(argumentsValue) {
24093
23929
  };
24094
23930
  }
24095
23931
  __name(parseHealthCheckArguments, "parseHealthCheckArguments");
23932
+ function parseSavedFilterListArguments(argumentsValue) {
23933
+ const args = readObject(argumentsValue);
23934
+ if (!args) {
23935
+ return {};
23936
+ }
23937
+ return {
23938
+ project: readString(args.project, "project"),
23939
+ section: readEnum(args.section, "section", [
23940
+ "insights",
23941
+ "pipelines",
23942
+ "change-requests",
23943
+ "source-code",
23944
+ "engineering-health",
23945
+ "architecture",
23946
+ "sonarqube"
23947
+ ])
23948
+ };
23949
+ }
23950
+ __name(parseSavedFilterListArguments, "parseSavedFilterListArguments");
23951
+ function parseSavedFilterGetArguments(argumentsValue) {
23952
+ const args = readObject(argumentsValue);
23953
+ if (!args) {
23954
+ throw new Error("name is required");
23955
+ }
23956
+ const name = readString(args.name, "name");
23957
+ if (!name) {
23958
+ throw new Error("name is required");
23959
+ }
23960
+ return {
23961
+ project: readString(args.project, "project"),
23962
+ name
23963
+ };
23964
+ }
23965
+ __name(parseSavedFilterGetArguments, "parseSavedFilterGetArguments");
24096
23966
  function buildMetricsInputSchema(description) {
24097
23967
  return {
24098
23968
  type: "object",
@@ -24304,11 +24174,28 @@ function buildDoraMetricsInputSchema() {
24304
24174
  "exclude"
24305
24175
  ],
24306
24176
  description: "Outlier handling mode. Defaults to include."
24307
- }
24308
- }
24309
- };
24310
- }
24311
- __name(buildDoraMetricsInputSchema, "buildDoraMetricsInputSchema");
24177
+ },
24178
+ rawFilters: {
24179
+ type: "string",
24180
+ description: "Optional raw provider filter string (e.g. status=success,branch=main). Passed through to the provider."
24181
+ },
24182
+ filter: {
24183
+ type: "string",
24184
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24185
+ },
24186
+ period: {
24187
+ type: "string",
24188
+ enum: [
24189
+ "day",
24190
+ "week",
24191
+ "month"
24192
+ ],
24193
+ description: "Optional DORA rating period: day (elite), week (high), month (medium). Defaults to week."
24194
+ }
24195
+ }
24196
+ };
24197
+ }
24198
+ __name(buildDoraMetricsInputSchema, "buildDoraMetricsInputSchema");
24312
24199
  function buildArchitectureViewInputSchema() {
24313
24200
  return {
24314
24201
  type: "object",
@@ -24418,6 +24305,54 @@ function buildHealthCheckInputSchema() {
24418
24305
  };
24419
24306
  }
24420
24307
  __name(buildHealthCheckInputSchema, "buildHealthCheckInputSchema");
24308
+ function buildSavedFilterListInputSchema() {
24309
+ return {
24310
+ type: "object",
24311
+ description: "Saved filters list filters.",
24312
+ additionalProperties: false,
24313
+ properties: {
24314
+ project: {
24315
+ type: "string",
24316
+ description: "Optional github_repository project name from smm_config.json."
24317
+ },
24318
+ section: {
24319
+ type: "string",
24320
+ enum: [
24321
+ "insights",
24322
+ "pipelines",
24323
+ "change-requests",
24324
+ "source-code",
24325
+ "engineering-health",
24326
+ "architecture",
24327
+ "sonarqube"
24328
+ ],
24329
+ description: "Optional dashboard section filter. Only saved filters in this section are returned."
24330
+ }
24331
+ }
24332
+ };
24333
+ }
24334
+ __name(buildSavedFilterListInputSchema, "buildSavedFilterListInputSchema");
24335
+ function buildSavedFilterGetInputSchema() {
24336
+ return {
24337
+ type: "object",
24338
+ description: "Saved filter lookup by name or id.",
24339
+ additionalProperties: false,
24340
+ required: [
24341
+ "name"
24342
+ ],
24343
+ properties: {
24344
+ project: {
24345
+ type: "string",
24346
+ description: "Optional github_repository project name from smm_config.json."
24347
+ },
24348
+ name: {
24349
+ type: "string",
24350
+ description: "Required saved filter name or id to look up."
24351
+ }
24352
+ }
24353
+ };
24354
+ }
24355
+ __name(buildSavedFilterGetInputSchema, "buildSavedFilterGetInputSchema");
24421
24356
  function buildEvaluationInputSchema(description) {
24422
24357
  return {
24423
24358
  type: "object",
@@ -24523,6 +24458,14 @@ function buildChangeRequestMetricsInputSchema(description) {
24523
24458
  "exclude"
24524
24459
  ],
24525
24460
  description: "Optional outlier handling mode."
24461
+ },
24462
+ rawFilters: {
24463
+ type: "string",
24464
+ description: "Optional raw provider filter string (e.g. status=draft,author=john). Passed through to the provider."
24465
+ },
24466
+ filter: {
24467
+ type: "string",
24468
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24526
24469
  }
24527
24470
  }
24528
24471
  };
@@ -24602,6 +24545,23 @@ function buildPipelineDashboardInputSchema(description) {
24602
24545
  "exclude"
24603
24546
  ],
24604
24547
  description: "Optional outlier handling mode."
24548
+ },
24549
+ rawFilters: {
24550
+ type: "string",
24551
+ description: "Optional raw provider filter string (e.g. status=success,branch=main). Passed through to the provider."
24552
+ },
24553
+ filter: {
24554
+ type: "string",
24555
+ description: "Optional saved filter name or id. When set, missing filter fields are filled from the saved filter."
24556
+ },
24557
+ period: {
24558
+ type: "string",
24559
+ enum: [
24560
+ "day",
24561
+ "week",
24562
+ "month"
24563
+ ],
24564
+ description: "Optional aggregation period for runs_by time series. Defaults to day (raw per-day)."
24605
24565
  }
24606
24566
  }
24607
24567
  };
@@ -24636,6 +24596,22 @@ function buildCodeEntityInputSchema(description) {
24636
24596
  authors: {
24637
24597
  type: "string",
24638
24598
  description: "Optional comma-separated authors filter (entity ownership only)."
24599
+ },
24600
+ minCoupling: {
24601
+ type: "number",
24602
+ description: "Optional minimum coupling threshold (0-100). Filters coupling relationships below this degree."
24603
+ },
24604
+ entity: {
24605
+ type: "string",
24606
+ description: "Optional entity/file substring filter. Only entities containing this string are returned."
24607
+ },
24608
+ startDate: {
24609
+ type: "string",
24610
+ description: "Optional ISO 8601 start date."
24611
+ },
24612
+ endDate: {
24613
+ type: "string",
24614
+ description: "Optional ISO 8601 end date."
24639
24615
  }
24640
24616
  }
24641
24617
  };
@@ -24662,6 +24638,14 @@ function buildCodeHistoryInputSchema(description) {
24662
24638
  endDate: {
24663
24639
  type: "string",
24664
24640
  description: "Optional ISO 8601 end date."
24641
+ },
24642
+ authors: {
24643
+ type: "string",
24644
+ description: "Optional comma-separated authors filter. When set on code churn, returns per-author churn."
24645
+ },
24646
+ minShared: {
24647
+ type: "number",
24648
+ description: "Optional minimum shared commits for pairing index. Defaults to 0 (all pairs included)."
24665
24649
  }
24666
24650
  }
24667
24651
  };
@@ -24803,13 +24787,13 @@ async function traceOperation(operation, details, task) {
24803
24787
  durationMs: Date.now() - startedAt
24804
24788
  });
24805
24789
  return result;
24806
- } catch (error2) {
24790
+ } catch (error) {
24807
24791
  operationLogger.warn(`Failed ${operation}`, {
24808
24792
  ...details,
24809
24793
  durationMs: Date.now() - startedAt,
24810
- error: error2 instanceof Error ? error2.message : String(error2)
24794
+ error: error instanceof Error ? error.message : String(error)
24811
24795
  });
24812
- throw error2;
24796
+ throw error;
24813
24797
  }
24814
24798
  }
24815
24799
  __name(traceOperation, "traceOperation");
@@ -24829,11 +24813,12 @@ function buildChangeRequestFiltersFromArgs(args) {
24829
24813
  return {
24830
24814
  startDate: args.startDate,
24831
24815
  endDate: args.endDate,
24832
- authors: args.authors,
24833
- excludeAuthors: args.excludeAuthors,
24834
- excludeCommenters: args.excludeCommenters,
24835
- labels: args.labels,
24816
+ authors: args.authors ? parseCsvList(args.authors, "authors") : void 0,
24817
+ excludeAuthors: args.excludeAuthors ? parseCsvList(args.excludeAuthors, "excludeAuthors") : void 0,
24818
+ excludeCommenters: args.excludeCommenters ? parseCsvList(args.excludeCommenters, "excludeCommenters") : void 0,
24819
+ labels: args.labels ? parseCsvList(args.labels, "labels") : void 0,
24836
24820
  state: args.status,
24821
+ rawFilters: args.rawFilters,
24837
24822
  cleaning
24838
24823
  };
24839
24824
  }
@@ -24853,6 +24838,7 @@ function buildPipelineFiltersFromArgs(args) {
24853
24838
  jobName: args.jobName,
24854
24839
  jobConclusion: args.jobConclusion,
24855
24840
  event: args.event,
24841
+ rawFilters: args.rawFilters,
24856
24842
  method: args.method,
24857
24843
  cleaning
24858
24844
  };
@@ -24863,7 +24849,10 @@ function buildCodeEntityFilterOptions(args) {
24863
24849
  ignorePatterns: args.ignorePatterns,
24864
24850
  includePatterns: args.includePatterns,
24865
24851
  top: args.top,
24866
- authors: args.authors
24852
+ authors: args.authors,
24853
+ minCoupling: args.minCoupling,
24854
+ startDate: args.startDate,
24855
+ endDate: args.endDate
24867
24856
  };
24868
24857
  }
24869
24858
  __name(buildCodeEntityFilterOptions, "buildCodeEntityFilterOptions");
@@ -24874,6 +24863,68 @@ function buildCodeChurnOptions(args) {
24874
24863
  };
24875
24864
  }
24876
24865
  __name(buildCodeChurnOptions, "buildCodeChurnOptions");
24866
+ function toPeriodKey(inputPeriod, period) {
24867
+ if (period === "day") {
24868
+ return inputPeriod;
24869
+ }
24870
+ const date = new Date(inputPeriod);
24871
+ if (Number.isNaN(date.getTime())) {
24872
+ return inputPeriod;
24873
+ }
24874
+ if (period === "month") {
24875
+ const year = date.getUTCFullYear();
24876
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
24877
+ return `${year}-${month}`;
24878
+ }
24879
+ const utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
24880
+ const dayOfWeek = utcDate.getUTCDay() || 7;
24881
+ utcDate.setUTCDate(utcDate.getUTCDate() + 4 - dayOfWeek);
24882
+ const isoYear = utcDate.getUTCFullYear();
24883
+ const firstDay = new Date(Date.UTC(isoYear, 0, 1));
24884
+ const week = Math.ceil(((utcDate.getTime() - firstDay.getTime()) / 864e5 + 1) / 7);
24885
+ return `${isoYear}-W${String(week).padStart(2, "0")}`;
24886
+ }
24887
+ __name(toPeriodKey, "toPeriodKey");
24888
+ function aggregateRunsByPeriod(metrics, requestedPeriod) {
24889
+ const period = requestedPeriod || "day";
24890
+ if (period === "day") {
24891
+ return metrics;
24892
+ }
24893
+ const grouped = /* @__PURE__ */ new Map();
24894
+ for (const item of metrics) {
24895
+ const normalizedPeriod = toPeriodKey(item.period, period);
24896
+ const key = `${normalizedPeriod}||${item.workflow}`;
24897
+ grouped.set(key, (grouped.get(key) || 0) + item.runs);
24898
+ }
24899
+ return Array.from(grouped.entries()).map(([key, runs]) => {
24900
+ const [normalizedPeriod, workflow] = key.split("||");
24901
+ return {
24902
+ period: normalizedPeriod,
24903
+ workflow,
24904
+ runs
24905
+ };
24906
+ }).sort((a, b) => {
24907
+ const periodComparison = a.period.localeCompare(b.period);
24908
+ if (periodComparison !== 0) {
24909
+ return periodComparison;
24910
+ }
24911
+ return a.workflow.localeCompare(b.workflow);
24912
+ });
24913
+ }
24914
+ __name(aggregateRunsByPeriod, "aggregateRunsByPeriod");
24915
+ function computeDoraRating(deploymentCounts, period) {
24916
+ if (period === "day" && deploymentCounts.daily_counts >= 1) {
24917
+ return "Elite";
24918
+ }
24919
+ if (period === "week" && deploymentCounts.weekly_counts >= 1) {
24920
+ return "High";
24921
+ }
24922
+ if (period === "month" && deploymentCounts.monthly_counts >= 1) {
24923
+ return "Medium";
24924
+ }
24925
+ return "Low";
24926
+ }
24927
+ __name(computeDoraRating, "computeDoraRating");
24877
24928
  function buildSonarqubeComponentTreeOptions(args) {
24878
24929
  return {
24879
24930
  component: args.component,
@@ -24937,7 +24988,9 @@ var McpMetricsReader = class {
24937
24988
  project: this.configuration.githubRepository,
24938
24989
  startDate: filters.startDate,
24939
24990
  endDate: filters.endDate,
24940
- authors: filters.authors
24991
+ authors: filters.authors,
24992
+ includePatterns: filters.includePatterns,
24993
+ ignorePatterns: filters.ignorePatterns
24941
24994
  }, async () => {
24942
24995
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
24943
24996
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
@@ -24948,7 +25001,8 @@ var McpMetricsReader = class {
24948
25001
  operationLogger.debug("getCodeMetrics: retrieving file coupling");
24949
25002
  const coupling = await codeRepository.getFileCoupling({
24950
25003
  authors: filters.authors ? parseCsvList(filters.authors, "authors") : void 0,
24951
- ...filters
25004
+ includePatterns: filters.includePatterns,
25005
+ ignorePatterns: filters.ignorePatterns
24952
25006
  });
24953
25007
  return {
24954
25008
  pairingIndex: pairing,
@@ -25058,22 +25112,27 @@ var McpMetricsReader = class {
25058
25112
  workflowPath: args.workflowPath,
25059
25113
  branch: args.branch,
25060
25114
  startDate: args.startDate,
25061
- endDate: args.endDate
25115
+ endDate: args.endDate,
25116
+ rawFilters: args.rawFilters,
25117
+ filter: args.filter,
25118
+ period: args.period
25062
25119
  }, async () => {
25120
+ const resolved = await this.resolvePipelineArgs(args);
25063
25121
  const pipelineArtifacts = import_core.PipelineFactory.create(this.configuration, createLogger(this.configuration, "DoraPipelineRepository"), this.timeZoneProvider);
25064
25122
  const cleaning = (0, import_core.parseMetricCleaningOptions)({
25065
25123
  weekends: args.weekends,
25066
25124
  outlierMode: args.outlierMode
25067
25125
  });
25068
25126
  const baseFilters = {
25069
- startDate: args.startDate,
25070
- endDate: args.endDate,
25071
- workflowPath: args.workflowPath,
25072
- status: args.status,
25073
- conclusion: args.conclusion,
25074
- targetBranch: args.branch,
25075
- jobName: args.jobName,
25076
- event: args.event,
25127
+ startDate: resolved.startDate ?? args.startDate,
25128
+ endDate: resolved.endDate ?? args.endDate,
25129
+ workflowPath: resolved.workflowPath ?? args.workflowPath,
25130
+ status: resolved.status ?? args.status,
25131
+ conclusion: resolved.conclusion ?? args.conclusion,
25132
+ targetBranch: resolved.branch ?? args.branch,
25133
+ jobName: resolved.jobName ?? args.jobName,
25134
+ event: resolved.event ?? args.event,
25135
+ rawFilters: resolved.rawFilters ?? args.rawFilters,
25077
25136
  cleaning
25078
25137
  };
25079
25138
  const pipelinesService = new import_core.PipelinesService(pipelineArtifacts.pipelineRepository, this.configuration, createLogger(this.configuration, "DoraPipelinesService"), this.timeZoneProvider);
@@ -25084,9 +25143,15 @@ var McpMetricsReader = class {
25084
25143
  pipelinesService.getMetrics(baseFilters),
25085
25144
  pipelinesService.getJobMetrics(baseFilters)
25086
25145
  ]);
25146
+ const doraRating = computeDoraRating({
25147
+ daily_counts: deploymentFrequency[0]?.daily_counts ?? 0,
25148
+ weekly_counts: deploymentFrequency[0]?.weekly_counts ?? 0,
25149
+ monthly_counts: deploymentFrequency[0]?.monthly_counts ?? 0
25150
+ }, args.period);
25087
25151
  return {
25088
25152
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
25089
25153
  deploymentFrequency,
25154
+ doraRating,
25090
25155
  pipelineMetrics,
25091
25156
  jobMetrics,
25092
25157
  filters: baseFilters
@@ -25193,25 +25258,31 @@ var McpMetricsReader = class {
25193
25258
  project: this.configuration.githubRepository,
25194
25259
  startDate: filters.startDate,
25195
25260
  endDate: filters.endDate,
25196
- authors: filters.authors
25261
+ authors: filters.authors,
25262
+ includePatterns: filters.includePatterns,
25263
+ ignorePatterns: filters.ignorePatterns
25197
25264
  }, async () => {
25198
25265
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25199
25266
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
25200
25267
  const bigOService = new import_core.BigOService(this.configuration);
25201
25268
  const evaluationService = new import_core.CodeEvaluationService();
25269
+ const entityFilterOptions = {
25270
+ includePatterns: filters.includePatterns,
25271
+ ignorePatterns: filters.ignorePatterns,
25272
+ authors: filters.authors
25273
+ };
25202
25274
  const [entityChurn, coupling, entityEffort, churnResult, entityOwnership, pairing, bigOFiles] = await Promise.all([
25203
- codeRepository.getEntityChurn({}),
25275
+ codeRepository.getEntityChurn(entityFilterOptions),
25204
25276
  codeRepository.getFileCoupling({
25277
+ ...entityFilterOptions,
25205
25278
  sortBy: "degree"
25206
25279
  }),
25207
- codeRepository.getEntityEffort({}),
25280
+ codeRepository.getEntityEffort(entityFilterOptions),
25208
25281
  codeRepository.getCodeChurn({
25209
25282
  startDate: filters.startDate,
25210
25283
  endDate: filters.endDate
25211
25284
  }),
25212
- codeRepository.getEntityOwnership({
25213
- authors: filters.authors
25214
- }),
25285
+ codeRepository.getEntityOwnership(entityFilterOptions),
25215
25286
  pairingService.getPairingIndex(filters).catch(() => null),
25216
25287
  bigOService.listFiles({
25217
25288
  limit: 200
@@ -25414,10 +25485,12 @@ var McpMetricsReader = class {
25414
25485
  project: this.configuration.githubRepository,
25415
25486
  startDate: args.startDate,
25416
25487
  endDate: args.endDate,
25417
- status: args.status
25488
+ status: args.status,
25489
+ filter: args.filter
25418
25490
  }, async () => {
25491
+ const resolved = await this.resolveChangeRequestArgs(args);
25419
25492
  const service = this.createChangeRequestsService();
25420
- return service.getSummary(buildChangeRequestFiltersFromArgs(args));
25493
+ return service.getSummary(buildChangeRequestFiltersFromArgs(resolved));
25421
25494
  });
25422
25495
  }
25423
25496
  async getChangeRequestThroughTime(args) {
@@ -25425,10 +25498,12 @@ var McpMetricsReader = class {
25425
25498
  project: this.configuration.githubRepository,
25426
25499
  startDate: args.startDate,
25427
25500
  endDate: args.endDate,
25428
- aggregateBy: args.aggregateBy
25501
+ aggregateBy: args.aggregateBy,
25502
+ filter: args.filter
25429
25503
  }, async () => {
25504
+ const resolved = await this.resolveChangeRequestArgs(args);
25430
25505
  const service = this.createChangeRequestsService();
25431
- return service.getThroughTime(buildChangeRequestFiltersFromArgs(args), args.aggregateBy);
25506
+ return service.getThroughTime(buildChangeRequestFiltersFromArgs(resolved), args.aggregateBy);
25432
25507
  });
25433
25508
  }
25434
25509
  async getChangeRequestByAuthor(args) {
@@ -25448,10 +25523,12 @@ var McpMetricsReader = class {
25448
25523
  startDate: args.startDate,
25449
25524
  endDate: args.endDate,
25450
25525
  method: args.method,
25451
- top: args.top
25526
+ top: args.top,
25527
+ filter: args.filter
25452
25528
  }, async () => {
25529
+ const resolved = await this.resolveChangeRequestArgs(args);
25453
25530
  const service = this.createChangeRequestsService();
25454
- return service.getReviewTime(buildChangeRequestFiltersFromArgs(args), args.top ?? 10, args.method ?? "average");
25531
+ return service.getReviewTime(buildChangeRequestFiltersFromArgs(resolved), args.top ?? 10, args.method ?? "average");
25455
25532
  });
25456
25533
  }
25457
25534
  async getChangeRequestOpenTime(args) {
@@ -25460,10 +25537,12 @@ var McpMetricsReader = class {
25460
25537
  startDate: args.startDate,
25461
25538
  endDate: args.endDate,
25462
25539
  aggregateBy: args.aggregateBy,
25463
- method: args.method
25540
+ method: args.method,
25541
+ filter: args.filter
25464
25542
  }, async () => {
25543
+ const resolved = await this.resolveChangeRequestArgs(args);
25465
25544
  const service = this.createChangeRequestsService();
25466
- return service.getOpenTimeBy(buildChangeRequestFiltersFromArgs(args), args.aggregateBy, args.method ?? "average");
25545
+ return service.getOpenTimeBy(buildChangeRequestFiltersFromArgs(resolved), args.aggregateBy, args.method ?? "average");
25467
25546
  });
25468
25547
  }
25469
25548
  async getChangeRequestComments(args) {
@@ -25471,10 +25550,19 @@ var McpMetricsReader = class {
25471
25550
  project: this.configuration.githubRepository,
25472
25551
  startDate: args.startDate,
25473
25552
  endDate: args.endDate,
25474
- method: args.method
25553
+ method: args.method,
25554
+ aggregateBy: args.aggregateBy,
25555
+ filter: args.filter
25475
25556
  }, async () => {
25557
+ const resolved = await this.resolveChangeRequestArgs(args);
25476
25558
  const service = this.createChangeRequestsService();
25477
- return service.getMetrics(buildChangeRequestFiltersFromArgs(args), args.method ?? "average");
25559
+ const filters = buildChangeRequestFiltersFromArgs(resolved);
25560
+ const method = args.method ?? "average";
25561
+ if (args.aggregateBy) {
25562
+ const mode = args.aggregateBy.toLowerCase();
25563
+ return mode === "month" ? service.getMetricsByMonth(filters, method) : service.getMetricsByWeek(filters, method);
25564
+ }
25565
+ return service.getMetrics(filters, method);
25478
25566
  });
25479
25567
  }
25480
25568
  async getChangeRequestCommentsByAuthor(args) {
@@ -25500,6 +25588,32 @@ var McpMetricsReader = class {
25500
25588
  return service.getFirstCommentTime(buildChangeRequestFiltersFromArgs(args), args.top ?? 10, args.method ?? "average");
25501
25589
  });
25502
25590
  }
25591
+ async getChangeRequestMetricsByMonth(args) {
25592
+ return traceOperation("getChangeRequestMetricsByMonth", {
25593
+ project: this.configuration.githubRepository,
25594
+ startDate: args.startDate,
25595
+ endDate: args.endDate,
25596
+ method: args.method,
25597
+ filter: args.filter
25598
+ }, async () => {
25599
+ const resolved = await this.resolveChangeRequestArgs(args);
25600
+ const service = this.createChangeRequestsService();
25601
+ return service.getMetricsByMonth(buildChangeRequestFiltersFromArgs(resolved), args.method ?? "average");
25602
+ });
25603
+ }
25604
+ async getChangeRequestMetricsByWeek(args) {
25605
+ return traceOperation("getChangeRequestMetricsByWeek", {
25606
+ project: this.configuration.githubRepository,
25607
+ startDate: args.startDate,
25608
+ endDate: args.endDate,
25609
+ method: args.method,
25610
+ filter: args.filter
25611
+ }, async () => {
25612
+ const resolved = await this.resolveChangeRequestArgs(args);
25613
+ const service = this.createChangeRequestsService();
25614
+ return service.getMetricsByWeek(buildChangeRequestFiltersFromArgs(resolved), args.method ?? "average");
25615
+ });
25616
+ }
25503
25617
  async getPipelineDashboard(args) {
25504
25618
  return traceOperation("getPipelineDashboard", {
25505
25619
  project: this.configuration.githubRepository,
@@ -25507,23 +25621,35 @@ var McpMetricsReader = class {
25507
25621
  endDate: args.endDate,
25508
25622
  workflowPath: args.workflowPath,
25509
25623
  branch: args.branch,
25510
- method: args.method
25624
+ method: args.method,
25625
+ filter: args.filter,
25626
+ period: args.period
25511
25627
  }, async () => {
25628
+ const resolved = await this.resolvePipelineArgs(args);
25512
25629
  const pipelineArtifacts = import_core.PipelineFactory.create(this.configuration, createLogger(this.configuration, "PipelineDashboardRepository"), this.timeZoneProvider);
25513
25630
  const pipelineImpl = new import_core.PipelineImplementation(pipelineArtifacts.pipelineRepository, this.configuration.getDeploymentFrequencyTargets(), createLogger(this.configuration, "PipelineDashboardImplementation"), this.timeZoneProvider);
25514
- return pipelineImpl.dashboard(buildPipelineFiltersFromArgs(args));
25631
+ const dashboard = await pipelineImpl.dashboard(buildPipelineFiltersFromArgs(resolved));
25632
+ if (args.period && args.period !== "day") {
25633
+ return {
25634
+ ...dashboard,
25635
+ runs_by: aggregateRunsByPeriod(dashboard.runs_by, args.period)
25636
+ };
25637
+ }
25638
+ return dashboard;
25515
25639
  });
25516
25640
  }
25517
25641
  async getCodePairingIndex(args) {
25518
25642
  return traceOperation("getCodePairingIndex", {
25519
25643
  project: this.configuration.githubRepository,
25520
25644
  startDate: args.startDate,
25521
- endDate: args.endDate
25645
+ endDate: args.endDate,
25646
+ minShared: args.minShared
25522
25647
  }, async () => {
25523
25648
  const pairingService = import_core.PairingFactory.create(this.configuration, createLogger(this.configuration, "PairingService"), this.timeZoneProvider);
25524
25649
  return pairingService.getPairingIndex({
25525
25650
  startDate: args.startDate,
25526
- endDate: args.endDate
25651
+ endDate: args.endDate,
25652
+ minShared: args.minShared
25527
25653
  });
25528
25654
  });
25529
25655
  }
@@ -25531,9 +25657,21 @@ var McpMetricsReader = class {
25531
25657
  return traceOperation("getCodeChurn", {
25532
25658
  project: this.configuration.githubRepository,
25533
25659
  startDate: args.startDate,
25534
- endDate: args.endDate
25660
+ endDate: args.endDate,
25661
+ authors: args.authors
25535
25662
  }, async () => {
25536
25663
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25664
+ if (args.authors) {
25665
+ const codemaatService = new import_core.CodemaatService(codeRepository);
25666
+ const authors = parseCsvList(args.authors, "authors");
25667
+ return {
25668
+ authorChurn: await codemaatService.getAuthorChurn({
25669
+ startDate: args.startDate,
25670
+ endDate: args.endDate,
25671
+ authors
25672
+ })
25673
+ };
25674
+ }
25537
25675
  return codeRepository.getCodeChurn(buildCodeChurnOptions(args));
25538
25676
  });
25539
25677
  }
@@ -25625,10 +25763,16 @@ var McpMetricsReader = class {
25625
25763
  }
25626
25764
  async getCodeEntityOwnership(args) {
25627
25765
  return traceOperation("getCodeEntityOwnership", {
25628
- project: this.configuration.githubRepository
25766
+ project: this.configuration.githubRepository,
25767
+ entity: args.entity
25629
25768
  }, async () => {
25630
25769
  const codeRepository = import_core.CodemaatFactory.create(this.configuration, createLogger(this.configuration, "CodeMetricsRepository"));
25631
- return codeRepository.getEntityOwnership(buildCodeEntityFilterOptions(args));
25770
+ const ownership = await codeRepository.getEntityOwnership(buildCodeEntityFilterOptions(args));
25771
+ if (args.entity) {
25772
+ const records = ownership;
25773
+ return records.filter((row) => row.entity.includes(args.entity));
25774
+ }
25775
+ return ownership;
25632
25776
  });
25633
25777
  }
25634
25778
  async getCodeEntityOwnershipHistory(args) {
@@ -25719,17 +25863,17 @@ var McpMetricsReader = class {
25719
25863
  };
25720
25864
  });
25721
25865
  }
25722
- async listSavedFilters() {
25866
+ async listSavedFilters(args) {
25723
25867
  return traceOperation("listSavedFilters", {
25724
- project: this.configuration.githubRepository
25868
+ project: this.configuration.githubRepository,
25869
+ section: args?.section
25725
25870
  }, async () => {
25726
25871
  const baseDir = this.configuration.getBaseDirectory();
25727
25872
  const adapter = new import_core.FileSystemSavedFiltersAdapter(baseDir);
25728
25873
  const store = new import_core.SavedFiltersStore(adapter);
25729
- const [filters, reports] = await Promise.all([
25730
- store.getAll(),
25731
- store.getReports()
25732
- ]);
25874
+ const section = args?.section;
25875
+ const filters = section ? await store.getBySection(section) : await store.getAll();
25876
+ const reports = await store.getReports();
25733
25877
  return {
25734
25878
  version: 1,
25735
25879
  filters,
@@ -25737,10 +25881,39 @@ var McpMetricsReader = class {
25737
25881
  };
25738
25882
  });
25739
25883
  }
25884
+ async getSavedFilter(args) {
25885
+ return traceOperation("getSavedFilter", {
25886
+ project: this.configuration.githubRepository,
25887
+ name: args.name
25888
+ }, async () => {
25889
+ const resolver = new import_core.FilterResolver();
25890
+ const entry = await resolver.showFilter(this.configuration, args.name);
25891
+ if (!entry) {
25892
+ return null;
25893
+ }
25894
+ return entry;
25895
+ });
25896
+ }
25740
25897
  createChangeRequestsService() {
25741
25898
  const repository = import_core.ChangeRequestFactory.create(this.configuration, createLogger(this.configuration, "ChangeRequestsRepository"), this.timeZoneProvider);
25742
25899
  return new import_core.ChangeRequestsService(repository, this.timeZoneProvider, createLogger(this.configuration, "ChangeRequestsService"));
25743
25900
  }
25901
+ async resolveChangeRequestArgs(args) {
25902
+ if (!args.filter) {
25903
+ return args;
25904
+ }
25905
+ const resolver = new import_core.FilterResolver();
25906
+ const merged = await resolver.resolveSavedFilterOptions(this.configuration, "change-requests", args);
25907
+ return merged;
25908
+ }
25909
+ async resolvePipelineArgs(args) {
25910
+ if (!args.filter) {
25911
+ return args;
25912
+ }
25913
+ const resolver = new import_core.FilterResolver();
25914
+ const merged = await resolver.resolveSavedFilterOptions(this.configuration, "pipelines", args);
25915
+ return merged;
25916
+ }
25744
25917
  };
25745
25918
  function viewToMermaid(view) {
25746
25919
  const lines = [
@@ -25794,485 +25967,59 @@ function redactSecrets(value) {
25794
25967
  }
25795
25968
  __name(redactSecrets, "redactSecrets");
25796
25969
 
25797
- // src/resources.ts
25798
- function getConfigurationRepository() {
25799
- return new import_core2.ConfigurationRepository(process.env, void 0, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
25800
- }
25801
- __name(getConfigurationRepository, "getConfigurationRepository");
25802
- function encodeProject(project) {
25803
- return encodeURIComponent(project);
25804
- }
25805
- __name(encodeProject, "encodeProject");
25806
- function decodeProject(project) {
25807
- return decodeURIComponent(project);
25808
- }
25809
- __name(decodeProject, "decodeProject");
25810
- function jsonResource(uri, value) {
25970
+ // src/tools.ts
25971
+ function asToolResult(value) {
25811
25972
  return {
25812
- contents: [
25973
+ content: [
25813
25974
  {
25814
- uri,
25815
- mimeType: "application/json",
25975
+ type: "text",
25816
25976
  text: JSON.stringify(value, null, 2)
25817
25977
  }
25818
- ]
25978
+ ],
25979
+ structuredContent: value
25819
25980
  };
25820
25981
  }
25821
- __name(jsonResource, "jsonResource");
25822
- function listResourceTemplates() {
25823
- return [
25824
- {
25825
- uriTemplate: "smm://project/{project}/engineering-health",
25826
- name: "Project engineering health",
25827
- description: "Full engineering health evaluation (delivery, quality, collaboration, architecture) for a project.",
25828
- mimeType: "application/json"
25829
- },
25830
- {
25831
- uriTemplate: "smm://project/{project}/dora",
25832
- name: "Project DORA metrics",
25833
- description: "DORA and pipeline metrics for a project.",
25834
- mimeType: "application/json"
25835
- },
25836
- {
25837
- uriTemplate: "smm://project/{project}/architecture/snapshots",
25838
- name: "Project architecture snapshots",
25839
- description: "List of architecture snapshots stored for a project.",
25840
- mimeType: "application/json"
25841
- },
25842
- {
25843
- uriTemplate: "smm://project/{project}/architecture/summary",
25844
- name: "Project architecture summary",
25845
- description: "Architecture snapshot metadata for the latest snapshot of a project.",
25846
- mimeType: "application/json"
25847
- },
25848
- {
25849
- uriTemplate: "smm://project/{project}/pipeline-dashboard",
25850
- name: "Project pipeline dashboard",
25851
- description: "Full pipeline dashboard for a project.",
25852
- mimeType: "application/json"
25982
+ __name(asToolResult, "asToolResult");
25983
+ function getReader(argumentsValue) {
25984
+ const args = parseMetricsToolArguments(argumentsValue);
25985
+ return {
25986
+ args,
25987
+ reader: createMcpMetricsReader({
25988
+ project: args.project,
25989
+ timezone: args.timezone
25990
+ })
25991
+ };
25992
+ }
25993
+ __name(getReader, "getReader");
25994
+ var tools = [
25995
+ {
25996
+ name: "smm_list_projects",
25997
+ description: "List configured Software Metrics Machine projects from smm_config.json, including git provider and repository.",
25998
+ inputSchema: {
25999
+ type: "object",
26000
+ additionalProperties: false,
26001
+ properties: {}
25853
26002
  },
25854
- {
25855
- uriTemplate: "smm://project/{project}/evaluation/change-requests",
25856
- name: "Project change request evaluation",
25857
- description: "Change request health evaluation for a project.",
25858
- mimeType: "application/json"
25859
- },
25860
- {
25861
- uriTemplate: "smm://project/{project}/evaluation/pipelines",
25862
- name: "Project pipeline evaluation",
25863
- description: "Pipeline health evaluation for a project.",
25864
- mimeType: "application/json"
25865
- },
25866
- {
25867
- uriTemplate: "smm://project/{project}/evaluation/code",
25868
- name: "Project code evaluation",
25869
- description: "Code health evaluation for a project.",
25870
- mimeType: "application/json"
25871
- },
25872
- {
25873
- uriTemplate: "smm://project/{project}/evaluation/quality",
25874
- name: "Project quality evaluation",
25875
- description: "SonarQube quality evaluation for a project.",
25876
- mimeType: "application/json"
25877
- },
25878
- {
25879
- uriTemplate: "smm://project/{project}/evaluation/architecture",
25880
- name: "Project architecture evaluation",
25881
- description: "Architecture health evaluation for a project.",
25882
- mimeType: "application/json"
25883
- },
25884
- {
25885
- uriTemplate: "smm://project/{project}/big-o",
25886
- name: "Project Big-O files",
25887
- description: "Big-O complexity classification for source files in a project.",
25888
- mimeType: "application/json"
25889
- },
25890
- {
25891
- uriTemplate: "smm://project/{project}/health-check",
25892
- name: "Project health check",
25893
- description: "Dataset health report for a project.",
25894
- mimeType: "application/json"
25895
- },
25896
- {
25897
- uriTemplate: "smm://project/{project}/saved-filters",
25898
- name: "Project saved filters",
25899
- description: "Saved filters and reports for a project.",
25900
- mimeType: "application/json"
25901
- },
25902
- {
25903
- uriTemplate: "smm://project/{project}/sonarqube/measurements",
25904
- name: "Project SonarQube measurements",
25905
- description: "Latest SonarQube measurements for a project.",
25906
- mimeType: "application/json"
25907
- },
25908
- {
25909
- uriTemplate: "smm://project/{project}/sonarqube/measurements/history",
25910
- name: "Project SonarQube measurements history",
25911
- description: "Timestamped SonarQube measurement entries for a project.",
25912
- mimeType: "application/json"
25913
- },
25914
- {
25915
- uriTemplate: "smm://project/{project}/sonarqube/component-tree",
25916
- name: "Project SonarQube component tree",
25917
- description: "SonarQube component tree with metrics for a project.",
25918
- mimeType: "application/json"
25919
- },
25920
- {
25921
- uriTemplate: "smm://project/{project}/sonarqube/component-tree/history",
25922
- name: "Project SonarQube component tree history",
25923
- description: "Timestamped SonarQube component tree entries for a project.",
25924
- mimeType: "application/json"
25925
- }
25926
- ];
25927
- }
25928
- __name(listResourceTemplates, "listResourceTemplates");
25929
- function listResources() {
25930
- const repository = getConfigurationRepository();
25931
- const projects = repository.getAllProjectNames();
25932
- return [
25933
- {
25934
- uri: "smm://projects",
25935
- name: "SMM projects",
25936
- description: "Configured Software Metrics Machine projects.",
25937
- mimeType: "application/json"
25938
- },
25939
- {
25940
- uri: "smm://engineering-health/metrics",
25941
- name: "Engineering health metric catalog",
25942
- description: "Metric ids, categories, and labels available for engineering health evaluations.",
25943
- mimeType: "application/json"
25944
- },
25945
- ...projects.flatMap((project) => [
25946
- {
25947
- uri: `smm://project/${encodeProject(project)}/configuration`,
25948
- name: `${project} configuration`,
25949
- description: "Redacted project configuration.",
25950
- mimeType: "application/json"
25951
- },
25952
- {
25953
- uri: `smm://project/${encodeProject(project)}/report`,
25954
- name: `${project} report`,
25955
- description: "Complete metrics report for the project.",
25956
- mimeType: "application/json"
25957
- },
25958
- {
25959
- uri: `smm://project/${encodeProject(project)}/engineering-health`,
25960
- name: `${project} engineering health`,
25961
- description: "Engineering health evaluation for the project.",
25962
- mimeType: "application/json"
25963
- },
25964
- {
25965
- uri: `smm://project/${encodeProject(project)}/dora`,
25966
- name: `${project} DORA metrics`,
25967
- description: "DORA and pipeline metrics for the project.",
25968
- mimeType: "application/json"
25969
- },
25970
- {
25971
- uri: `smm://project/${encodeProject(project)}/architecture/snapshots`,
25972
- name: `${project} architecture snapshots`,
25973
- description: "Architecture snapshots stored for the project.",
25974
- mimeType: "application/json"
25975
- },
25976
- {
25977
- uri: `smm://project/${encodeProject(project)}/evaluation/change-requests`,
25978
- name: `${project} change request evaluation`,
25979
- description: "Change request health evaluation for the project.",
25980
- mimeType: "application/json"
25981
- },
25982
- {
25983
- uri: `smm://project/${encodeProject(project)}/evaluation/pipelines`,
25984
- name: `${project} pipeline evaluation`,
25985
- description: "Pipeline health evaluation for the project.",
25986
- mimeType: "application/json"
25987
- },
25988
- {
25989
- uri: `smm://project/${encodeProject(project)}/evaluation/code`,
25990
- name: `${project} code evaluation`,
25991
- description: "Code health evaluation for the project.",
25992
- mimeType: "application/json"
25993
- },
25994
- {
25995
- uri: `smm://project/${encodeProject(project)}/evaluation/quality`,
25996
- name: `${project} quality evaluation`,
25997
- description: "SonarQube quality evaluation for the project.",
25998
- mimeType: "application/json"
25999
- },
26000
- {
26001
- uri: `smm://project/${encodeProject(project)}/evaluation/architecture`,
26002
- name: `${project} architecture evaluation`,
26003
- description: "Architecture health evaluation for the project.",
26004
- mimeType: "application/json"
26005
- },
26006
- {
26007
- uri: `smm://project/${encodeProject(project)}/big-o`,
26008
- name: `${project} Big-O files`,
26009
- description: "Big-O complexity classification for source files.",
26010
- mimeType: "application/json"
26011
- },
26012
- {
26013
- uri: `smm://project/${encodeProject(project)}/health-check`,
26014
- name: `${project} health check`,
26015
- description: "Dataset health report for the project.",
26016
- mimeType: "application/json"
26017
- },
26018
- {
26019
- uri: `smm://project/${encodeProject(project)}/architecture/summary`,
26020
- name: `${project} architecture summary`,
26021
- description: "Architecture snapshot metadata for the latest snapshot.",
26022
- mimeType: "application/json"
26023
- },
26024
- {
26025
- uri: `smm://project/${encodeProject(project)}/pipeline-dashboard`,
26026
- name: `${project} pipeline dashboard`,
26027
- description: "Full pipeline dashboard for the project.",
26028
- mimeType: "application/json"
26029
- },
26030
- {
26031
- uri: `smm://project/${encodeProject(project)}/saved-filters`,
26032
- name: `${project} saved filters`,
26033
- description: "Saved filters and reports for the project.",
26034
- mimeType: "application/json"
26035
- },
26036
- {
26037
- uri: `smm://project/${encodeProject(project)}/sonarqube/measurements`,
26038
- name: `${project} SonarQube measurements`,
26039
- description: "Latest SonarQube measurements for the project.",
26040
- mimeType: "application/json"
26041
- },
26042
- {
26043
- uri: `smm://project/${encodeProject(project)}/sonarqube/measurements/history`,
26044
- name: `${project} SonarQube measurements history`,
26045
- description: "Timestamped SonarQube measurement entries for the project.",
26046
- mimeType: "application/json"
26047
- },
26048
- {
26049
- uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree`,
26050
- name: `${project} SonarQube component tree`,
26051
- description: "SonarQube component tree with metrics for the project.",
26052
- mimeType: "application/json"
26053
- },
26054
- {
26055
- uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree/history`,
26056
- name: `${project} SonarQube component tree history`,
26057
- description: "Timestamped SonarQube component tree entries for the project.",
26058
- mimeType: "application/json"
26059
- }
26060
- ])
26061
- ];
26062
- }
26063
- __name(listResources, "listResources");
26064
- async function readResource(uri) {
26065
- const resourceStartedAt = Date.now();
26066
- resourceLogger.debug(`Reading resource ${uri}`);
26067
- const repository = getConfigurationRepository();
26068
- if (uri === "smm://projects") {
26069
- resourceLogger.debug("Listing projects for resource smm://projects");
26070
- const result = jsonResource(uri, {
26071
- projects: repository.getAllProjects().map((project2) => ({
26072
- github_repository: project2.github_repository,
26073
- git_provider: project2.git_provider
26074
- }))
26075
- });
26076
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26077
- return result;
26078
- }
26079
- if (uri === "smm://engineering-health/metrics") {
26080
- resourceLogger.debug("Returning engineering health metric catalog");
26081
- const result = jsonResource(uri, {
26082
- categories: [
26083
- "delivery",
26084
- "quality",
26085
- "collaboration",
26086
- "architecture"
26087
- ],
26088
- metrics: listEngineeringHealthMetricCatalog()
26089
- });
26090
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26091
- return result;
26092
- }
26093
- 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))$/);
26094
- if (!match) {
26095
- resourceLogger.warn(`Unknown MCP resource requested: ${uri}`);
26096
- throw new Error(`Unknown MCP resource: ${uri}`);
26097
- }
26098
- const projectName = decodeProject(match[1]);
26099
- const resourceType = match[2];
26100
- resourceLogger.debug(`Resolved resource ${uri}`, {
26101
- projectName,
26102
- resourceType
26103
- });
26104
- const project = repository.getProjectByName(projectName);
26105
- if (!project) {
26106
- resourceLogger.warn(`Unknown project for resource ${uri}: ${projectName}`);
26107
- throw new Error(`Unknown project: ${projectName}`);
26108
- }
26109
- if (resourceType === "configuration") {
26110
- resourceLogger.debug(`Returning redacted configuration for ${projectName}`);
26111
- const result = jsonResource(uri, redactSecrets(project));
26112
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26113
- return result;
26114
- }
26115
- const reader = createMcpMetricsReader({
26116
- project: projectName
26117
- });
26118
- if (resourceType === "report") {
26119
- const result = jsonResource(uri, await reader.getFullReport());
26120
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26121
- return result;
26122
- }
26123
- if (resourceType === "engineering-health") {
26124
- const result = jsonResource(uri, await reader.getEngineeringHealthEvaluation({
26125
- project: projectName
26126
- }));
26127
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26128
- return result;
26129
- }
26130
- if (resourceType === "dora") {
26131
- const result = jsonResource(uri, await reader.getDoraMetrics({
26132
- project: projectName
26133
- }));
26134
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26135
- return result;
26136
- }
26137
- if (resourceType === "evaluation/change-requests") {
26138
- const result = jsonResource(uri, await reader.evaluateChangeRequests());
26139
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26140
- return result;
26141
- }
26142
- if (resourceType === "evaluation/pipelines") {
26143
- const result = jsonResource(uri, await reader.evaluatePipelines());
26144
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26145
- return result;
26146
- }
26147
- if (resourceType === "evaluation/code") {
26148
- const result = jsonResource(uri, await reader.evaluateCode());
26149
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26150
- return result;
26151
- }
26152
- if (resourceType === "evaluation/quality") {
26153
- const result = jsonResource(uri, await reader.evaluateQuality());
26154
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26155
- return result;
26156
- }
26157
- if (resourceType === "evaluation/architecture") {
26158
- const result = jsonResource(uri, await reader.evaluateArchitecture({
26159
- project: projectName
26160
- }));
26161
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26162
- return result;
26163
- }
26164
- if (resourceType === "big-o") {
26165
- const result = jsonResource(uri, await reader.listBigOFiles());
26166
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26167
- return result;
26168
- }
26169
- if (resourceType === "health-check") {
26170
- const result = jsonResource(uri, await reader.healthCheck());
26171
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26172
- return result;
26173
- }
26174
- if (resourceType === "architecture/summary") {
26175
- const result = jsonResource(uri, await reader.getArchitectureSummary());
26176
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26177
- return result;
26178
- }
26179
- if (resourceType === "pipeline-dashboard") {
26180
- const result = jsonResource(uri, await reader.getPipelineDashboard({
26181
- project: projectName
26182
- }));
26183
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26184
- return result;
26185
- }
26186
- if (resourceType === "saved-filters") {
26187
- const result = jsonResource(uri, await reader.listSavedFilters());
26188
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26189
- return result;
26190
- }
26191
- if (resourceType === "sonarqube/measurements") {
26192
- const result = jsonResource(uri, await reader.getSonarqubeMeasurements());
26193
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26194
- return result;
26195
- }
26196
- if (resourceType === "sonarqube/measurements/history") {
26197
- const result = jsonResource(uri, await reader.getSonarqubeMeasurementsHistory());
26198
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26199
- return result;
26200
- }
26201
- if (resourceType === "sonarqube/component-tree") {
26202
- const result = jsonResource(uri, await reader.getSonarqubeComponentTree({
26203
- project: projectName
26204
- }));
26205
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26206
- return result;
26207
- }
26208
- if (resourceType === "sonarqube/component-tree/history") {
26209
- const result = jsonResource(uri, await reader.getSonarqubeComponentTreeHistory({
26210
- project: projectName
26211
- }));
26212
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26213
- return result;
26214
- }
26215
- const snapshotsResult = jsonResource(uri, await reader.listArchitectureSnapshots());
26216
- resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
26217
- return snapshotsResult;
26218
- }
26219
- __name(readResource, "readResource");
26220
-
26221
- // src/tools.ts
26222
- var import_core3 = __toESM(require_dist2());
26223
- var import_utils4 = __toESM(require_dist());
26224
- function asToolResult(value) {
26225
- return {
26226
- content: [
26227
- {
26228
- type: "text",
26229
- text: JSON.stringify(value, null, 2)
26230
- }
26231
- ],
26232
- structuredContent: value
26233
- };
26234
- }
26235
- __name(asToolResult, "asToolResult");
26236
- function getReader(argumentsValue) {
26237
- const args = parseMetricsToolArguments(argumentsValue);
26238
- return {
26239
- args,
26240
- reader: createMcpMetricsReader({
26241
- project: args.project,
26242
- timezone: args.timezone
26243
- })
26244
- };
26245
- }
26246
- __name(getReader, "getReader");
26247
- var tools = [
26248
- {
26249
- name: "smm_list_projects",
26250
- description: "List configured Software Metrics Machine projects from smm_config.json, including git provider and repository.",
26251
- inputSchema: {
26252
- type: "object",
26253
- additionalProperties: false,
26254
- properties: {}
26255
- },
26256
- async handler() {
26257
- toolLogger.debug("smm_list_projects: loading project list from smm_config.json");
26258
- const repository = new import_core3.ConfigurationRepository(process.env, void 0, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26259
- const projects = repository.getAllProjects().map((project) => ({
26260
- github_repository: project.github_repository,
26261
- git_provider: project.git_provider
26262
- }));
26263
- toolLogger.debug(`smm_list_projects: found ${projects.length} projects`);
26264
- return asToolResult({
26265
- projects
26266
- });
26267
- }
26268
- },
26269
- {
26270
- name: "smm_list_engineering_health_metrics",
26271
- 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.",
26272
- inputSchema: {
26273
- type: "object",
26274
- additionalProperties: false,
26275
- properties: {}
26003
+ async handler() {
26004
+ toolLogger.debug("smm_list_projects: loading project list from smm_config.json");
26005
+ const repository = new import_core2.ConfigurationRepository(process.env, void 0, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
26006
+ const projects = repository.getAllProjects().map((project) => ({
26007
+ github_repository: project.github_repository,
26008
+ git_provider: project.git_provider
26009
+ }));
26010
+ toolLogger.debug(`smm_list_projects: found ${projects.length} projects`);
26011
+ return asToolResult({
26012
+ projects
26013
+ });
26014
+ }
26015
+ },
26016
+ {
26017
+ name: "smm_list_engineering_health_metrics",
26018
+ 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.",
26019
+ inputSchema: {
26020
+ type: "object",
26021
+ additionalProperties: false,
26022
+ properties: {}
26276
26023
  },
26277
26024
  async handler() {
26278
26025
  toolLogger.debug("smm_list_engineering_health_metrics: returning metric catalog");
@@ -26324,7 +26071,9 @@ var tools = [
26324
26071
  return asToolResult(await reader.getCodeMetrics({
26325
26072
  startDate: parsed.startDate,
26326
26073
  endDate: parsed.endDate,
26327
- authors: parsed.authors
26074
+ authors: parsed.authors,
26075
+ includePatterns: parsed.includePatterns,
26076
+ ignorePatterns: parsed.ignorePatterns
26328
26077
  }));
26329
26078
  }
26330
26079
  },
@@ -26453,7 +26202,9 @@ var tools = [
26453
26202
  return asToolResult(await reader.evaluateCode({
26454
26203
  startDate: parsed.startDate,
26455
26204
  endDate: parsed.endDate,
26456
- authors: parsed.authors
26205
+ authors: parsed.authors,
26206
+ includePatterns: parsed.includePatterns,
26207
+ ignorePatterns: parsed.ignorePatterns
26457
26208
  }));
26458
26209
  }
26459
26210
  },
@@ -26542,7 +26293,7 @@ var tools = [
26542
26293
  },
26543
26294
  async handler() {
26544
26295
  return asToolResult({
26545
- version: (0, import_utils4.getApplicationVersion)(),
26296
+ version: (0, import_utils3.getApplicationVersion)(),
26546
26297
  name: "software-metrics-machine"
26547
26298
  });
26548
26299
  }
@@ -26553,7 +26304,7 @@ var tools = [
26553
26304
  inputSchema: buildMetricsInputSchema("Configuration lookup filters."),
26554
26305
  async handler(argumentsValue) {
26555
26306
  const args = parseMetricsToolArguments(argumentsValue);
26556
- const repository = new import_core3.ConfigurationRepository(process.env, args.project, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26307
+ const repository = new import_core2.ConfigurationRepository(process.env, args.project, new import_utils3.Logger("SmmMcpServer", "CRITICAL"));
26557
26308
  const project = repository.getProjectByName(args.project || "");
26558
26309
  if (!project) {
26559
26310
  throw new Error(`Unknown project: ${args.project || "<default>"}`);
@@ -26692,6 +26443,32 @@ var tools = [
26692
26443
  return asToolResult(await reader.getChangeRequestFirstCommentTime(parsed));
26693
26444
  }
26694
26445
  },
26446
+ {
26447
+ name: "smm_get_change_request_metrics_by_month",
26448
+ description: "Get change request metrics (comments, review time, open time) grouped by month, with selectable statistical method.",
26449
+ inputSchema: buildChangeRequestMetricsInputSchema("Change request by-month filters."),
26450
+ async handler(argumentsValue) {
26451
+ const parsed = parseChangeRequestMetricsArguments(argumentsValue);
26452
+ const reader = createMcpMetricsReader({
26453
+ project: parsed.project,
26454
+ timezone: parsed.timezone
26455
+ });
26456
+ return asToolResult(await reader.getChangeRequestMetricsByMonth(parsed));
26457
+ }
26458
+ },
26459
+ {
26460
+ name: "smm_get_change_request_metrics_by_week",
26461
+ description: "Get change request metrics (comments, review time, open time) grouped by week, with selectable statistical method.",
26462
+ inputSchema: buildChangeRequestMetricsInputSchema("Change request by-week filters."),
26463
+ async handler(argumentsValue) {
26464
+ const parsed = parseChangeRequestMetricsArguments(argumentsValue);
26465
+ const reader = createMcpMetricsReader({
26466
+ project: parsed.project,
26467
+ timezone: parsed.timezone
26468
+ });
26469
+ return asToolResult(await reader.getChangeRequestMetricsByWeek(parsed));
26470
+ }
26471
+ },
26695
26472
  {
26696
26473
  name: "smm_get_pipeline_dashboard",
26697
26474
  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.",
@@ -26866,273 +26643,910 @@ var tools = [
26866
26643
  description: "Get timestamped entity ownership history entries.",
26867
26644
  inputSchema: buildCodeEntityInputSchema("Code entity ownership history filters."),
26868
26645
  async handler(argumentsValue) {
26869
- const parsed = parseCodeEntityArguments(argumentsValue);
26646
+ const parsed = parseCodeEntityArguments(argumentsValue);
26647
+ const reader = createMcpMetricsReader({
26648
+ project: parsed.project,
26649
+ timezone: parsed.timezone
26650
+ });
26651
+ return asToolResult(await reader.getCodeEntityOwnershipHistory(parsed));
26652
+ }
26653
+ },
26654
+ {
26655
+ name: "smm_get_sonarqube_component_tree",
26656
+ description: "Get the SonarQube component tree with metrics, optional component/depth/metrics/pattern filters.",
26657
+ inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree filters."),
26658
+ async handler(argumentsValue) {
26659
+ const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26660
+ const reader = createMcpMetricsReader({
26661
+ project: parsed.project
26662
+ });
26663
+ return asToolResult(await reader.getSonarqubeComponentTree(parsed));
26664
+ }
26665
+ },
26666
+ {
26667
+ name: "smm_get_sonarqube_component_tree_history",
26668
+ description: "Get timestamped SonarQube component tree history entries.",
26669
+ inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree history filters."),
26670
+ async handler(argumentsValue) {
26671
+ const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26672
+ const reader = createMcpMetricsReader({
26673
+ project: parsed.project
26674
+ });
26675
+ return asToolResult(await reader.getSonarqubeComponentTreeHistory(parsed));
26676
+ }
26677
+ },
26678
+ {
26679
+ name: "smm_get_sonarqube_measurements",
26680
+ description: "Get all SonarQube measurements (latest snapshot) for a configured SMM project.",
26681
+ inputSchema: buildMetricsInputSchema("SonarQube measurements lookup."),
26682
+ async handler(argumentsValue) {
26683
+ const args = parseMetricsToolArguments(argumentsValue);
26684
+ const reader = createMcpMetricsReader({
26685
+ project: args.project
26686
+ });
26687
+ return asToolResult(await reader.getSonarqubeMeasurements());
26688
+ }
26689
+ },
26690
+ {
26691
+ name: "smm_get_sonarqube_measurements_history",
26692
+ description: "Get timestamped SonarQube measurement history entries for a configured SMM project.",
26693
+ inputSchema: buildMetricsInputSchema("SonarQube measurements history lookup."),
26694
+ async handler(argumentsValue) {
26695
+ const args = parseMetricsToolArguments(argumentsValue);
26696
+ const reader = createMcpMetricsReader({
26697
+ project: args.project
26698
+ });
26699
+ return asToolResult(await reader.getSonarqubeMeasurementsHistory());
26700
+ }
26701
+ },
26702
+ {
26703
+ name: "smm_get_architecture_summary",
26704
+ description: "Get architecture snapshot metadata (snapshot id, generated at, branch, commit count, view counts) for the latest or a specific snapshot.",
26705
+ inputSchema: buildArchitectureViewInputSchema(),
26706
+ async handler(argumentsValue) {
26707
+ const parsed = parseArchitectureViewArguments(argumentsValue);
26708
+ const reader = createMcpMetricsReader({
26709
+ project: parsed.project
26710
+ });
26711
+ return asToolResult(await reader.getArchitectureSummary(parsed.snapshotId));
26712
+ }
26713
+ },
26714
+ {
26715
+ name: "smm_export_architecture_view",
26716
+ description: "Export an architecture view (context, container, component, code) as JSON plus a Mermaid diagram string.",
26717
+ inputSchema: buildArchitectureViewInputSchema(),
26718
+ async handler(argumentsValue) {
26719
+ const parsed = parseArchitectureViewArguments(argumentsValue);
26720
+ const reader = createMcpMetricsReader({
26721
+ project: parsed.project
26722
+ });
26723
+ return asToolResult(await reader.exportArchitectureView(parsed));
26724
+ }
26725
+ },
26726
+ {
26727
+ name: "smm_list_saved_filters",
26728
+ 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.",
26729
+ inputSchema: buildSavedFilterListInputSchema(),
26730
+ async handler(argumentsValue) {
26731
+ const parsed = parseSavedFilterListArguments(argumentsValue);
26870
26732
  const reader = createMcpMetricsReader({
26871
- project: parsed.project,
26872
- timezone: parsed.timezone
26733
+ project: parsed.project
26873
26734
  });
26874
- return asToolResult(await reader.getCodeEntityOwnershipHistory(parsed));
26735
+ return asToolResult(await reader.listSavedFilters(parsed));
26875
26736
  }
26876
26737
  },
26877
26738
  {
26878
- name: "smm_get_sonarqube_component_tree",
26879
- description: "Get the SonarQube component tree with metrics, optional component/depth/metrics/pattern filters.",
26880
- inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree filters."),
26739
+ name: "smm_get_saved_filter",
26740
+ 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.",
26741
+ inputSchema: buildSavedFilterGetInputSchema(),
26881
26742
  async handler(argumentsValue) {
26882
- const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26743
+ const parsed = parseSavedFilterGetArguments(argumentsValue);
26883
26744
  const reader = createMcpMetricsReader({
26884
26745
  project: parsed.project
26885
26746
  });
26886
- return asToolResult(await reader.getSonarqubeComponentTree(parsed));
26747
+ return asToolResult(await reader.getSavedFilter(parsed));
26887
26748
  }
26888
- },
26749
+ }
26750
+ ];
26751
+ function findTool(name) {
26752
+ return tools.find((tool) => tool.name === name);
26753
+ }
26754
+ __name(findTool, "findTool");
26755
+
26756
+ // src/resources.ts
26757
+ var import_core3 = __toESM(require_dist2());
26758
+ var import_utils4 = __toESM(require_dist());
26759
+ function getConfigurationRepository() {
26760
+ return new import_core3.ConfigurationRepository(process.env, void 0, new import_utils4.Logger("SmmMcpServer", "CRITICAL"));
26761
+ }
26762
+ __name(getConfigurationRepository, "getConfigurationRepository");
26763
+ function encodeProject(project) {
26764
+ return encodeURIComponent(project);
26765
+ }
26766
+ __name(encodeProject, "encodeProject");
26767
+ function decodeProject(project) {
26768
+ return decodeURIComponent(project);
26769
+ }
26770
+ __name(decodeProject, "decodeProject");
26771
+ function jsonResource(uri, value) {
26772
+ return {
26773
+ contents: [
26774
+ {
26775
+ uri,
26776
+ mimeType: "application/json",
26777
+ text: JSON.stringify(value, null, 2)
26778
+ }
26779
+ ]
26780
+ };
26781
+ }
26782
+ __name(jsonResource, "jsonResource");
26783
+ function listResourceTemplates() {
26784
+ return [
26785
+ {
26786
+ uriTemplate: "smm://project/{project}/engineering-health",
26787
+ name: "Project engineering health",
26788
+ description: "Full engineering health evaluation (delivery, quality, collaboration, architecture) for a project.",
26789
+ mimeType: "application/json"
26790
+ },
26791
+ {
26792
+ uriTemplate: "smm://project/{project}/dora",
26793
+ name: "Project DORA metrics",
26794
+ description: "DORA and pipeline metrics for a project.",
26795
+ mimeType: "application/json"
26796
+ },
26797
+ {
26798
+ uriTemplate: "smm://project/{project}/architecture/snapshots",
26799
+ name: "Project architecture snapshots",
26800
+ description: "List of architecture snapshots stored for a project.",
26801
+ mimeType: "application/json"
26802
+ },
26803
+ {
26804
+ uriTemplate: "smm://project/{project}/architecture/summary",
26805
+ name: "Project architecture summary",
26806
+ description: "Architecture snapshot metadata for the latest snapshot of a project.",
26807
+ mimeType: "application/json"
26808
+ },
26809
+ {
26810
+ uriTemplate: "smm://project/{project}/pipeline-dashboard",
26811
+ name: "Project pipeline dashboard",
26812
+ description: "Full pipeline dashboard for a project.",
26813
+ mimeType: "application/json"
26814
+ },
26815
+ {
26816
+ uriTemplate: "smm://project/{project}/evaluation/change-requests",
26817
+ name: "Project change request evaluation",
26818
+ description: "Change request health evaluation for a project.",
26819
+ mimeType: "application/json"
26820
+ },
26821
+ {
26822
+ uriTemplate: "smm://project/{project}/evaluation/pipelines",
26823
+ name: "Project pipeline evaluation",
26824
+ description: "Pipeline health evaluation for a project.",
26825
+ mimeType: "application/json"
26826
+ },
26827
+ {
26828
+ uriTemplate: "smm://project/{project}/evaluation/code",
26829
+ name: "Project code evaluation",
26830
+ description: "Code health evaluation for a project.",
26831
+ mimeType: "application/json"
26832
+ },
26833
+ {
26834
+ uriTemplate: "smm://project/{project}/evaluation/quality",
26835
+ name: "Project quality evaluation",
26836
+ description: "SonarQube quality evaluation for a project.",
26837
+ mimeType: "application/json"
26838
+ },
26839
+ {
26840
+ uriTemplate: "smm://project/{project}/evaluation/architecture",
26841
+ name: "Project architecture evaluation",
26842
+ description: "Architecture health evaluation for a project.",
26843
+ mimeType: "application/json"
26844
+ },
26845
+ {
26846
+ uriTemplate: "smm://project/{project}/big-o",
26847
+ name: "Project Big-O files",
26848
+ description: "Big-O complexity classification for source files in a project.",
26849
+ mimeType: "application/json"
26850
+ },
26851
+ {
26852
+ uriTemplate: "smm://project/{project}/health-check",
26853
+ name: "Project health check",
26854
+ description: "Dataset health report for a project.",
26855
+ mimeType: "application/json"
26856
+ },
26857
+ {
26858
+ uriTemplate: "smm://project/{project}/saved-filters",
26859
+ name: "Project saved filters",
26860
+ description: "Saved filters and reports for a project.",
26861
+ mimeType: "application/json"
26862
+ },
26863
+ {
26864
+ uriTemplate: "smm://project/{project}/sonarqube/measurements",
26865
+ name: "Project SonarQube measurements",
26866
+ description: "Latest SonarQube measurements for a project.",
26867
+ mimeType: "application/json"
26868
+ },
26869
+ {
26870
+ uriTemplate: "smm://project/{project}/sonarqube/measurements/history",
26871
+ name: "Project SonarQube measurements history",
26872
+ description: "Timestamped SonarQube measurement entries for a project.",
26873
+ mimeType: "application/json"
26874
+ },
26875
+ {
26876
+ uriTemplate: "smm://project/{project}/sonarqube/component-tree",
26877
+ name: "Project SonarQube component tree",
26878
+ description: "SonarQube component tree with metrics for a project.",
26879
+ mimeType: "application/json"
26880
+ },
26881
+ {
26882
+ uriTemplate: "smm://project/{project}/sonarqube/component-tree/history",
26883
+ name: "Project SonarQube component tree history",
26884
+ description: "Timestamped SonarQube component tree entries for a project.",
26885
+ mimeType: "application/json"
26886
+ }
26887
+ ];
26888
+ }
26889
+ __name(listResourceTemplates, "listResourceTemplates");
26890
+ function listResources() {
26891
+ const repository = getConfigurationRepository();
26892
+ const projects = repository.getAllProjectNames();
26893
+ return [
26894
+ {
26895
+ uri: "smm://projects",
26896
+ name: "SMM projects",
26897
+ description: "Configured Software Metrics Machine projects.",
26898
+ mimeType: "application/json"
26899
+ },
26900
+ {
26901
+ uri: "smm://engineering-health/metrics",
26902
+ name: "Engineering health metric catalog",
26903
+ description: "Metric ids, categories, and labels available for engineering health evaluations.",
26904
+ mimeType: "application/json"
26905
+ },
26906
+ ...projects.flatMap((project) => [
26907
+ {
26908
+ uri: `smm://project/${encodeProject(project)}/configuration`,
26909
+ name: `${project} configuration`,
26910
+ description: "Redacted project configuration.",
26911
+ mimeType: "application/json"
26912
+ },
26913
+ {
26914
+ uri: `smm://project/${encodeProject(project)}/report`,
26915
+ name: `${project} report`,
26916
+ description: "Complete metrics report for the project.",
26917
+ mimeType: "application/json"
26918
+ },
26919
+ {
26920
+ uri: `smm://project/${encodeProject(project)}/engineering-health`,
26921
+ name: `${project} engineering health`,
26922
+ description: "Engineering health evaluation for the project.",
26923
+ mimeType: "application/json"
26924
+ },
26925
+ {
26926
+ uri: `smm://project/${encodeProject(project)}/dora`,
26927
+ name: `${project} DORA metrics`,
26928
+ description: "DORA and pipeline metrics for the project.",
26929
+ mimeType: "application/json"
26930
+ },
26931
+ {
26932
+ uri: `smm://project/${encodeProject(project)}/architecture/snapshots`,
26933
+ name: `${project} architecture snapshots`,
26934
+ description: "Architecture snapshots stored for the project.",
26935
+ mimeType: "application/json"
26936
+ },
26937
+ {
26938
+ uri: `smm://project/${encodeProject(project)}/evaluation/change-requests`,
26939
+ name: `${project} change request evaluation`,
26940
+ description: "Change request health evaluation for the project.",
26941
+ mimeType: "application/json"
26942
+ },
26943
+ {
26944
+ uri: `smm://project/${encodeProject(project)}/evaluation/pipelines`,
26945
+ name: `${project} pipeline evaluation`,
26946
+ description: "Pipeline health evaluation for the project.",
26947
+ mimeType: "application/json"
26948
+ },
26949
+ {
26950
+ uri: `smm://project/${encodeProject(project)}/evaluation/code`,
26951
+ name: `${project} code evaluation`,
26952
+ description: "Code health evaluation for the project.",
26953
+ mimeType: "application/json"
26954
+ },
26955
+ {
26956
+ uri: `smm://project/${encodeProject(project)}/evaluation/quality`,
26957
+ name: `${project} quality evaluation`,
26958
+ description: "SonarQube quality evaluation for the project.",
26959
+ mimeType: "application/json"
26960
+ },
26961
+ {
26962
+ uri: `smm://project/${encodeProject(project)}/evaluation/architecture`,
26963
+ name: `${project} architecture evaluation`,
26964
+ description: "Architecture health evaluation for the project.",
26965
+ mimeType: "application/json"
26966
+ },
26967
+ {
26968
+ uri: `smm://project/${encodeProject(project)}/big-o`,
26969
+ name: `${project} Big-O files`,
26970
+ description: "Big-O complexity classification for source files.",
26971
+ mimeType: "application/json"
26972
+ },
26973
+ {
26974
+ uri: `smm://project/${encodeProject(project)}/health-check`,
26975
+ name: `${project} health check`,
26976
+ description: "Dataset health report for the project.",
26977
+ mimeType: "application/json"
26978
+ },
26979
+ {
26980
+ uri: `smm://project/${encodeProject(project)}/architecture/summary`,
26981
+ name: `${project} architecture summary`,
26982
+ description: "Architecture snapshot metadata for the latest snapshot.",
26983
+ mimeType: "application/json"
26984
+ },
26985
+ {
26986
+ uri: `smm://project/${encodeProject(project)}/pipeline-dashboard`,
26987
+ name: `${project} pipeline dashboard`,
26988
+ description: "Full pipeline dashboard for the project.",
26989
+ mimeType: "application/json"
26990
+ },
26991
+ {
26992
+ uri: `smm://project/${encodeProject(project)}/saved-filters`,
26993
+ name: `${project} saved filters`,
26994
+ description: "Saved filters and reports for the project.",
26995
+ mimeType: "application/json"
26996
+ },
26997
+ {
26998
+ uri: `smm://project/${encodeProject(project)}/sonarqube/measurements`,
26999
+ name: `${project} SonarQube measurements`,
27000
+ description: "Latest SonarQube measurements for the project.",
27001
+ mimeType: "application/json"
27002
+ },
27003
+ {
27004
+ uri: `smm://project/${encodeProject(project)}/sonarqube/measurements/history`,
27005
+ name: `${project} SonarQube measurements history`,
27006
+ description: "Timestamped SonarQube measurement entries for the project.",
27007
+ mimeType: "application/json"
27008
+ },
27009
+ {
27010
+ uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree`,
27011
+ name: `${project} SonarQube component tree`,
27012
+ description: "SonarQube component tree with metrics for the project.",
27013
+ mimeType: "application/json"
27014
+ },
27015
+ {
27016
+ uri: `smm://project/${encodeProject(project)}/sonarqube/component-tree/history`,
27017
+ name: `${project} SonarQube component tree history`,
27018
+ description: "Timestamped SonarQube component tree entries for the project.",
27019
+ mimeType: "application/json"
27020
+ }
27021
+ ])
27022
+ ];
27023
+ }
27024
+ __name(listResources, "listResources");
27025
+ async function readResource(uri) {
27026
+ const resourceStartedAt = Date.now();
27027
+ resourceLogger.debug(`Reading resource ${uri}`);
27028
+ const repository = getConfigurationRepository();
27029
+ if (uri === "smm://projects") {
27030
+ resourceLogger.debug("Listing projects for resource smm://projects");
27031
+ const result = jsonResource(uri, {
27032
+ projects: repository.getAllProjects().map((project2) => ({
27033
+ github_repository: project2.github_repository,
27034
+ git_provider: project2.git_provider
27035
+ }))
27036
+ });
27037
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27038
+ return result;
27039
+ }
27040
+ if (uri === "smm://engineering-health/metrics") {
27041
+ resourceLogger.debug("Returning engineering health metric catalog");
27042
+ const result = jsonResource(uri, {
27043
+ categories: [
27044
+ "delivery",
27045
+ "quality",
27046
+ "collaboration",
27047
+ "architecture"
27048
+ ],
27049
+ metrics: listEngineeringHealthMetricCatalog()
27050
+ });
27051
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27052
+ return result;
27053
+ }
27054
+ 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))$/);
27055
+ if (!match) {
27056
+ resourceLogger.warn(`Unknown MCP resource requested: ${uri}`);
27057
+ throw new Error(`Unknown MCP resource: ${uri}`);
27058
+ }
27059
+ const projectName = decodeProject(match[1]);
27060
+ const resourceType = match[2];
27061
+ resourceLogger.debug(`Resolved resource ${uri}`, {
27062
+ projectName,
27063
+ resourceType
27064
+ });
27065
+ const project = repository.getProjectByName(projectName);
27066
+ if (!project) {
27067
+ resourceLogger.warn(`Unknown project for resource ${uri}: ${projectName}`);
27068
+ throw new Error(`Unknown project: ${projectName}`);
27069
+ }
27070
+ if (resourceType === "configuration") {
27071
+ resourceLogger.debug(`Returning redacted configuration for ${projectName}`);
27072
+ const result = jsonResource(uri, redactSecrets(project));
27073
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27074
+ return result;
27075
+ }
27076
+ const reader = createMcpMetricsReader({
27077
+ project: projectName
27078
+ });
27079
+ if (resourceType === "report") {
27080
+ const result = jsonResource(uri, await reader.getFullReport());
27081
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27082
+ return result;
27083
+ }
27084
+ if (resourceType === "engineering-health") {
27085
+ const result = jsonResource(uri, await reader.getEngineeringHealthEvaluation({
27086
+ project: projectName
27087
+ }));
27088
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27089
+ return result;
27090
+ }
27091
+ if (resourceType === "dora") {
27092
+ const result = jsonResource(uri, await reader.getDoraMetrics({
27093
+ project: projectName
27094
+ }));
27095
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27096
+ return result;
27097
+ }
27098
+ if (resourceType === "evaluation/change-requests") {
27099
+ const result = jsonResource(uri, await reader.evaluateChangeRequests());
27100
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27101
+ return result;
27102
+ }
27103
+ if (resourceType === "evaluation/pipelines") {
27104
+ const result = jsonResource(uri, await reader.evaluatePipelines());
27105
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27106
+ return result;
27107
+ }
27108
+ if (resourceType === "evaluation/code") {
27109
+ const result = jsonResource(uri, await reader.evaluateCode());
27110
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27111
+ return result;
27112
+ }
27113
+ if (resourceType === "evaluation/quality") {
27114
+ const result = jsonResource(uri, await reader.evaluateQuality());
27115
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27116
+ return result;
27117
+ }
27118
+ if (resourceType === "evaluation/architecture") {
27119
+ const result = jsonResource(uri, await reader.evaluateArchitecture({
27120
+ project: projectName
27121
+ }));
27122
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27123
+ return result;
27124
+ }
27125
+ if (resourceType === "big-o") {
27126
+ const result = jsonResource(uri, await reader.listBigOFiles());
27127
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27128
+ return result;
27129
+ }
27130
+ if (resourceType === "health-check") {
27131
+ const result = jsonResource(uri, await reader.healthCheck());
27132
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27133
+ return result;
27134
+ }
27135
+ if (resourceType === "architecture/summary") {
27136
+ const result = jsonResource(uri, await reader.getArchitectureSummary());
27137
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27138
+ return result;
27139
+ }
27140
+ if (resourceType === "pipeline-dashboard") {
27141
+ const result = jsonResource(uri, await reader.getPipelineDashboard({
27142
+ project: projectName
27143
+ }));
27144
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27145
+ return result;
27146
+ }
27147
+ if (resourceType === "saved-filters") {
27148
+ const result = jsonResource(uri, await reader.listSavedFilters());
27149
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27150
+ return result;
27151
+ }
27152
+ if (resourceType === "sonarqube/measurements") {
27153
+ const result = jsonResource(uri, await reader.getSonarqubeMeasurements());
27154
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27155
+ return result;
27156
+ }
27157
+ if (resourceType === "sonarqube/measurements/history") {
27158
+ const result = jsonResource(uri, await reader.getSonarqubeMeasurementsHistory());
27159
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27160
+ return result;
27161
+ }
27162
+ if (resourceType === "sonarqube/component-tree") {
27163
+ const result = jsonResource(uri, await reader.getSonarqubeComponentTree({
27164
+ project: projectName
27165
+ }));
27166
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27167
+ return result;
27168
+ }
27169
+ if (resourceType === "sonarqube/component-tree/history") {
27170
+ const result = jsonResource(uri, await reader.getSonarqubeComponentTreeHistory({
27171
+ project: projectName
27172
+ }));
27173
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27174
+ return result;
27175
+ }
27176
+ const snapshotsResult = jsonResource(uri, await reader.listArchitectureSnapshots());
27177
+ resourceLogger.debug(`Read resource ${uri} in ${Date.now() - resourceStartedAt}ms`);
27178
+ return snapshotsResult;
27179
+ }
27180
+ __name(readResource, "readResource");
27181
+
27182
+ // src/prompts.ts
27183
+ var prompts = [
26889
27184
  {
26890
- name: "smm_get_sonarqube_component_tree_history",
26891
- description: "Get timestamped SonarQube component tree history entries.",
26892
- inputSchema: buildSonarqubeComponentTreeInputSchema("SonarQube component tree history filters."),
26893
- async handler(argumentsValue) {
26894
- const parsed = parseSonarqubeComponentTreeArguments(argumentsValue);
26895
- const reader = createMcpMetricsReader({
26896
- project: parsed.project
26897
- });
26898
- return asToolResult(await reader.getSonarqubeComponentTreeHistory(parsed));
26899
- }
27185
+ name: "smm_sprint_health_review",
27186
+ description: "Review engineering health for the current sprint and highlight metrics that need attention.",
27187
+ arguments: [
27188
+ {
27189
+ name: "project",
27190
+ description: "Optional github_repository project name from smm_config.json.",
27191
+ required: false
27192
+ },
27193
+ {
27194
+ name: "startDate",
27195
+ description: "Current window start date (YYYY-MM-DD).",
27196
+ required: false
27197
+ },
27198
+ {
27199
+ name: "endDate",
27200
+ description: "Current window end date (YYYY-MM-DD).",
27201
+ required: false
27202
+ }
27203
+ ]
26900
27204
  },
26901
27205
  {
26902
- name: "smm_get_sonarqube_measurements",
26903
- description: "Get all SonarQube measurements (latest snapshot) for a configured SMM project.",
26904
- inputSchema: buildMetricsInputSchema("SonarQube measurements lookup."),
26905
- async handler(argumentsValue) {
26906
- const args = parseMetricsToolArguments(argumentsValue);
26907
- const reader = createMcpMetricsReader({
26908
- project: args.project
26909
- });
26910
- return asToolResult(await reader.getSonarqubeMeasurements());
26911
- }
27206
+ name: "smm_compare_windows",
27207
+ description: "Compare engineering health between two time windows and summarise what improved or regressed.",
27208
+ arguments: [
27209
+ {
27210
+ name: "project",
27211
+ description: "Optional github_repository project name from smm_config.json.",
27212
+ required: false
27213
+ },
27214
+ {
27215
+ name: "startDate",
27216
+ description: "Current window start date (YYYY-MM-DD).",
27217
+ required: true
27218
+ },
27219
+ {
27220
+ name: "endDate",
27221
+ description: "Current window end date (YYYY-MM-DD).",
27222
+ required: true
27223
+ },
27224
+ {
27225
+ name: "compareStartDate",
27226
+ description: "Previous window start date (YYYY-MM-DD).",
27227
+ required: true
27228
+ },
27229
+ {
27230
+ name: "compareEndDate",
27231
+ description: "Previous window end date (YYYY-MM-DD).",
27232
+ required: true
27233
+ }
27234
+ ]
26912
27235
  },
26913
27236
  {
26914
- name: "smm_get_sonarqube_measurements_history",
26915
- description: "Get timestamped SonarQube measurement history entries for a configured SMM project.",
26916
- inputSchema: buildMetricsInputSchema("SonarQube measurements history lookup."),
26917
- async handler(argumentsValue) {
26918
- const args = parseMetricsToolArguments(argumentsValue);
26919
- const reader = createMcpMetricsReader({
26920
- project: args.project
26921
- });
26922
- return asToolResult(await reader.getSonarqubeMeasurementsHistory());
26923
- }
27237
+ name: "smm_dora_summary",
27238
+ description: "Summarise DORA metrics for a project, including deployment frequency and failure rate.",
27239
+ arguments: [
27240
+ {
27241
+ name: "project",
27242
+ description: "Optional github_repository project name from smm_config.json.",
27243
+ required: false
27244
+ },
27245
+ {
27246
+ name: "startDate",
27247
+ description: "Optional window start date (YYYY-MM-DD).",
27248
+ required: false
27249
+ },
27250
+ {
27251
+ name: "endDate",
27252
+ description: "Optional window end date (YYYY-MM-DD).",
27253
+ required: false
27254
+ }
27255
+ ]
26924
27256
  },
26925
27257
  {
26926
- name: "smm_get_architecture_summary",
26927
- description: "Get architecture snapshot metadata (snapshot id, generated at, branch, commit count, view counts) for the latest or a specific snapshot.",
26928
- inputSchema: buildArchitectureViewInputSchema(),
26929
- async handler(argumentsValue) {
26930
- const parsed = parseArchitectureViewArguments(argumentsValue);
26931
- const reader = createMcpMetricsReader({
26932
- project: parsed.project
27258
+ name: "smm_code_hotspots",
27259
+ description: "Identify code hotspots (high churn and high coupling files) and pair-programming gaps for a project.",
27260
+ arguments: [
27261
+ {
27262
+ name: "project",
27263
+ description: "Optional github_repository project name from smm_config.json.",
27264
+ required: false
27265
+ },
27266
+ {
27267
+ name: "startDate",
27268
+ description: "Optional window start date (YYYY-MM-DD).",
27269
+ required: false
27270
+ },
27271
+ {
27272
+ name: "endDate",
27273
+ description: "Optional window end date (YYYY-MM-DD).",
27274
+ required: false
27275
+ }
27276
+ ]
27277
+ }
27278
+ ];
27279
+ function getArg(values, name) {
27280
+ const value = values[name];
27281
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
27282
+ }
27283
+ __name(getArg, "getArg");
27284
+ function optional(value) {
27285
+ return value ? value : "<not provided>";
27286
+ }
27287
+ __name(optional, "optional");
27288
+ async function getPrompt(name, argumentsValue) {
27289
+ promptLogger.debug(`Building prompt ${name}`, {
27290
+ arguments: argumentsValue
27291
+ });
27292
+ const values = argumentsValue && typeof argumentsValue === "object" && !Array.isArray(argumentsValue) ? argumentsValue : {};
27293
+ const project = getArg(values, "project");
27294
+ const startDate = getArg(values, "startDate");
27295
+ const endDate = getArg(values, "endDate");
27296
+ const compareStartDate = getArg(values, "compareStartDate");
27297
+ const compareEndDate = getArg(values, "compareEndDate");
27298
+ const messages = [];
27299
+ switch (name) {
27300
+ case "smm_sprint_health_review":
27301
+ messages.push({
27302
+ role: "user",
27303
+ content: {
27304
+ type: "text",
27305
+ text: [
27306
+ "You are acting as a software engineering coach.",
27307
+ "Use the Software Metrics Machine MCP tools to evaluate the engineering health of the project.",
27308
+ "",
27309
+ `Project: ${optional(project)}`,
27310
+ `Current window: ${optional(startDate)} to ${optional(endDate)}`,
27311
+ "",
27312
+ "Steps:",
27313
+ "1. Call smm_get_engineering_health with the filters above.",
27314
+ '2. Highlight any metric whose recommendation level is "watch" or "critical".',
27315
+ "3. Suggest one concrete action for each degraded metric, grounded in the data returned."
27316
+ ].join("\n")
27317
+ }
26933
27318
  });
26934
- return asToolResult(await reader.getArchitectureSummary(parsed.snapshotId));
26935
- }
26936
- },
26937
- {
26938
- name: "smm_export_architecture_view",
26939
- description: "Export an architecture view (context, container, component, code) as JSON plus a Mermaid diagram string.",
26940
- inputSchema: buildArchitectureViewInputSchema(),
26941
- async handler(argumentsValue) {
26942
- const parsed = parseArchitectureViewArguments(argumentsValue);
26943
- const reader = createMcpMetricsReader({
26944
- project: parsed.project
27319
+ break;
27320
+ case "smm_compare_windows":
27321
+ messages.push({
27322
+ role: "user",
27323
+ content: {
27324
+ type: "text",
27325
+ text: [
27326
+ "You are acting as a software engineering coach.",
27327
+ "Use the Software Metrics Machine MCP tools to compare two windows.",
27328
+ "",
27329
+ `Project: ${optional(project)}`,
27330
+ `Current window: ${optional(startDate)} to ${optional(endDate)}`,
27331
+ `Previous window: ${optional(compareStartDate)} to ${optional(compareEndDate)}`,
27332
+ "",
27333
+ "Steps:",
27334
+ "1. Call smm_get_engineering_health with startDate, endDate, compareStartDate, and compareEndDate.",
27335
+ "2. For each metric, summarise whether the trend is improving, stable, or degrading.",
27336
+ "3. Produce a short before/after table and a prioritised list of follow-up actions."
27337
+ ].join("\n")
27338
+ }
26945
27339
  });
26946
- return asToolResult(await reader.exportArchitectureView(parsed));
26947
- }
26948
- },
26949
- {
26950
- name: "smm_list_saved_filters",
26951
- description: "List saved filters and reports (read-only) for a configured SMM project, including filter id, name, section, repository, and createdAt.",
26952
- inputSchema: buildMetricsInputSchema("Saved filters lookup."),
26953
- async handler(argumentsValue) {
26954
- const args = parseMetricsToolArguments(argumentsValue);
26955
- const reader = createMcpMetricsReader({
26956
- project: args.project
27340
+ break;
27341
+ case "smm_dora_summary":
27342
+ messages.push({
27343
+ role: "user",
27344
+ content: {
27345
+ type: "text",
27346
+ text: [
27347
+ "You are acting as a DORA metrics analyst.",
27348
+ "Use the Software Metrics Machine MCP tools to report DORA metrics.",
27349
+ "",
27350
+ `Project: ${optional(project)}`,
27351
+ `Window: ${optional(startDate)} to ${optional(endDate)}`,
27352
+ "",
27353
+ "Steps:",
27354
+ "1. Call smm_get_dora_metrics with the filters above.",
27355
+ "2. Report deployment frequency, failure rate signals, and pipeline duration.",
27356
+ "3. Classify the project against the DORA tiers (elite, high, medium, low) where possible."
27357
+ ].join("\n")
27358
+ }
26957
27359
  });
26958
- return asToolResult(await reader.listSavedFilters());
26959
- }
27360
+ break;
27361
+ case "smm_code_hotspots":
27362
+ messages.push({
27363
+ role: "user",
27364
+ content: {
27365
+ type: "text",
27366
+ text: [
27367
+ "You are acting as a code health reviewer.",
27368
+ "Use the Software Metrics Machine MCP tools to surface code hotspots.",
27369
+ "",
27370
+ `Project: ${optional(project)}`,
27371
+ `Window: ${optional(startDate)} to ${optional(endDate)}`,
27372
+ "",
27373
+ "Steps:",
27374
+ "1. Call smm_get_code_metrics to retrieve churn, coupling, and pairing data.",
27375
+ "2. Identify files with the highest churn and strongest coupling.",
27376
+ "3. Cross-reference pairing gaps and propose concrete refactoring or pairing actions."
27377
+ ].join("\n")
27378
+ }
27379
+ });
27380
+ break;
27381
+ default:
27382
+ throw new Error(`Unknown MCP prompt: ${name}`);
26960
27383
  }
26961
- ];
26962
- function findTool(name) {
26963
- return tools.find((tool) => tool.name === name);
27384
+ return {
27385
+ description: prompts.find((prompt) => prompt.name === name)?.description,
27386
+ messages
27387
+ };
26964
27388
  }
26965
- __name(findTool, "findTool");
27389
+ __name(getPrompt, "getPrompt");
26966
27390
 
26967
- // src/server.ts
26968
- var SERVER_INFO = {
26969
- name: "software-metrics-machine",
26970
- version: (0, import_utils5.getApplicationVersion)()
26971
- };
26972
- var log = /* @__PURE__ */ __name((message) => transportLogger.info(message), "log");
26973
- function isJsonRpcRequest(value) {
26974
- 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
26975
- (!("id" in value) || value.id === void 0 || value.id === null || typeof value.id === "string" || typeof value.id === "number");
27391
+ // src/registration.ts
27392
+ function jsonSchemaPropertyToZod(prop) {
27393
+ if (!prop) {
27394
+ return import_zod.z.unknown();
27395
+ }
27396
+ const description = typeof prop.description === "string" ? prop.description : void 0;
27397
+ if (Array.isArray(prop.enum)) {
27398
+ const values = prop.enum.filter((v) => typeof v === "string");
27399
+ if (values.length > 0) {
27400
+ const literals = values.map((v) => import_zod.z.literal(v));
27401
+ const schema = literals.length === 1 ? literals[0] : import_zod.z.union(literals);
27402
+ return description ? schema.describe(description) : schema;
27403
+ }
27404
+ }
27405
+ switch (prop.type) {
27406
+ case "string":
27407
+ return description ? import_zod.z.string().describe(description) : import_zod.z.string();
27408
+ case "number":
27409
+ return description ? import_zod.z.number().describe(description) : import_zod.z.number();
27410
+ case "boolean":
27411
+ return description ? import_zod.z.boolean().describe(description) : import_zod.z.boolean();
27412
+ default:
27413
+ return import_zod.z.unknown();
27414
+ }
26976
27415
  }
26977
- __name(isJsonRpcRequest, "isJsonRpcRequest");
26978
- function ok(id, result) {
26979
- return {
26980
- jsonrpc: "2.0",
26981
- id: id ?? null,
26982
- result
26983
- };
27416
+ __name(jsonSchemaPropertyToZod, "jsonSchemaPropertyToZod");
27417
+ function jsonSchemaToZodShape(schema) {
27418
+ if (!schema || typeof schema !== "object") {
27419
+ return {};
27420
+ }
27421
+ const properties = schema.properties ?? {};
27422
+ const shape = {};
27423
+ for (const [key, prop] of Object.entries(properties)) {
27424
+ const propSchema = prop;
27425
+ shape[key] = jsonSchemaPropertyToZod(propSchema).optional();
27426
+ }
27427
+ return shape;
26984
27428
  }
26985
- __name(ok, "ok");
26986
- function error(id, code, message, data) {
27429
+ __name(jsonSchemaToZodShape, "jsonSchemaToZodShape");
27430
+ function adaptToolResult(result) {
26987
27431
  return {
26988
- jsonrpc: "2.0",
26989
- id: id ?? null,
26990
- error: {
26991
- code,
26992
- message,
26993
- data
26994
- }
27432
+ content: result.content,
27433
+ ...result.structuredContent !== void 0 ? {
27434
+ structuredContent: result.structuredContent
27435
+ } : {},
27436
+ ...result.isError !== void 0 ? {
27437
+ isError: result.isError
27438
+ } : {}
26995
27439
  };
26996
27440
  }
26997
- __name(error, "error");
26998
- function getStringParam(params, fieldName) {
26999
- const value = params?.[fieldName];
27000
- return typeof value === "string" ? value : void 0;
27001
- }
27002
- __name(getStringParam, "getStringParam");
27003
- async function handleRequest(request) {
27004
- return handleRequestWithLogging(request);
27441
+ __name(adaptToolResult, "adaptToolResult");
27442
+ function registerTools(server) {
27443
+ for (const tool of tools) {
27444
+ const zodShape = jsonSchemaToZodShape(tool.inputSchema);
27445
+ const inputSchema = import_zod.z.object(zodShape);
27446
+ server.registerTool(tool.name, {
27447
+ description: tool.description,
27448
+ inputSchema
27449
+ }, async (args) => {
27450
+ const result = await tool.handler(args);
27451
+ return adaptToolResult(result);
27452
+ });
27453
+ }
27005
27454
  }
27006
- __name(handleRequest, "handleRequest");
27007
- async function handleRequestWithLogging(request, log2) {
27008
- if (request.id === void 0 && request.method.startsWith("notifications/")) {
27009
- log2?.(`Received notification: ${request.method}`);
27010
- return void 0;
27455
+ __name(registerTools, "registerTools");
27456
+ function registerResources(server) {
27457
+ const staticResources = listResources();
27458
+ for (const resource of staticResources) {
27459
+ server.registerResource(resource.name, resource.uri, {
27460
+ description: resource.description,
27461
+ mimeType: resource.mimeType
27462
+ }, async (uri) => {
27463
+ const result = await readResource(uri.toString());
27464
+ return {
27465
+ contents: result.contents.map((entry) => ({
27466
+ uri: entry.uri,
27467
+ mimeType: entry.mimeType,
27468
+ text: entry.text
27469
+ }))
27470
+ };
27471
+ });
27011
27472
  }
27012
- try {
27013
- switch (request.method) {
27014
- case "initialize":
27015
- log2?.("Client initialized MCP session");
27016
- return ok(request.id, {
27017
- protocolVersion: "2025-06-18",
27018
- capabilities: {
27019
- tools: {},
27020
- resources: {
27021
- list: true,
27022
- read: true,
27023
- listChanged: false
27024
- },
27025
- prompts: {
27026
- list: true,
27027
- get: true,
27028
- listChanged: false
27029
- },
27030
- logging: {}
27031
- },
27032
- serverInfo: SERVER_INFO
27033
- });
27034
- case "ping":
27035
- log2?.("Received ping");
27036
- return ok(request.id, {});
27037
- case "tools/list":
27038
- log2?.(`Listing ${tools.length} MCP tools`);
27039
- return ok(request.id, {
27040
- tools: tools.map(({ handler: _handler, ...tool }) => tool)
27041
- });
27042
- case "tools/call": {
27043
- const name = getStringParam(request.params, "name");
27044
- const selectedTool = name ? findTool(name) : void 0;
27045
- if (!selectedTool) {
27046
- log2?.(`Rejected unknown tool call: ${name || "<missing>"}`);
27047
- return error(request.id, -32602, `Unknown tool: ${name || "<missing>"}`);
27048
- }
27049
- const toolStartedAt = Date.now();
27050
- log2?.(`Running tool: ${name}`);
27051
- try {
27052
- const result = await selectedTool.handler(request.params?.arguments);
27053
- log2?.(`Completed tool: ${name} in ${Date.now() - toolStartedAt}ms`);
27054
- return ok(request.id, result);
27055
- } catch (toolError) {
27056
- const toolMessage = toolError instanceof Error ? toolError.message : String(toolError);
27057
- log2?.(`Failed tool: ${name} after ${Date.now() - toolStartedAt}ms (${toolMessage})`);
27058
- throw toolError;
27059
- }
27060
- }
27061
- case "resources/list":
27062
- log2?.("Listing MCP resources");
27063
- return ok(request.id, {
27064
- resources: listResources()
27065
- });
27066
- case "resources/templates/list":
27067
- log2?.("Listing MCP resource templates");
27068
- return ok(request.id, {
27069
- resourceTemplates: listResourceTemplates()
27070
- });
27071
- case "resources/read": {
27072
- const uri = getStringParam(request.params, "uri");
27073
- if (!uri) {
27074
- log2?.("Rejected resources/read request without uri");
27075
- return error(request.id, -32602, "resources/read requires a uri parameter");
27076
- }
27077
- const resourceStartedAt = Date.now();
27078
- log2?.(`Reading resource: ${uri}`);
27079
- try {
27080
- const resourceResult = await readResource(uri);
27081
- log2?.(`Read resource: ${uri} in ${Date.now() - resourceStartedAt}ms`);
27082
- return ok(request.id, resourceResult);
27083
- } catch (resourceError) {
27084
- const resourceMessage = resourceError instanceof Error ? resourceError.message : String(resourceError);
27085
- log2?.(`Failed resource: ${uri} after ${Date.now() - resourceStartedAt}ms (${resourceMessage})`);
27086
- throw resourceError;
27087
- }
27088
- }
27089
- case "prompts/list":
27090
- log2?.(`Listing ${prompts.length} MCP prompts`);
27091
- return ok(request.id, {
27092
- prompts
27093
- });
27094
- case "prompts/get": {
27095
- const name = getStringParam(request.params, "name");
27096
- if (!name) {
27097
- log2?.("Rejected prompts/get request without name");
27098
- return error(request.id, -32602, "prompts/get requires a name parameter");
27099
- }
27100
- const knownPrompt = prompts.find((prompt) => prompt.name === name);
27101
- if (!knownPrompt) {
27102
- log2?.(`Rejected unknown prompt: ${name}`);
27103
- return error(request.id, -32602, `Unknown prompt: ${name}`);
27104
- }
27105
- log2?.(`Reading prompt: ${name}`);
27106
- return ok(request.id, await getPrompt(name, request.params?.arguments));
27107
- }
27108
- case "logging/setLevel": {
27109
- const level = getStringParam(request.params, "level");
27110
- if (!level) {
27111
- return error(request.id, -32602, "logging/setLevel requires a level parameter");
27112
- }
27113
- const normalized = level.toLowerCase();
27114
- if (normalized !== "debug" && normalized !== "info" && normalized !== "critical") {
27115
- return error(request.id, -32602, `Invalid log level: ${level}. Must be debug, info, or critical.`);
27116
- }
27117
- log2?.(`Setting MCP log level to ${normalized}`);
27118
- configureMcpLogging(normalized === "debug" ? {
27119
- debug: true
27120
- } : normalized === "critical" ? {
27121
- quiet: true
27122
- } : {});
27123
- return ok(request.id, {});
27124
- }
27125
- default:
27126
- log2?.(`Rejected unknown method: ${request.method}`);
27127
- return error(request.id, -32601, `Method not found: ${request.method}`);
27473
+ const templates = listResourceTemplates();
27474
+ for (const template of templates) {
27475
+ server.registerResource(template.name, new import_server.ResourceTemplate(template.uriTemplate, {
27476
+ list: void 0
27477
+ }), {
27478
+ description: template.description,
27479
+ mimeType: template.mimeType
27480
+ }, async (uri) => {
27481
+ const result = await readResource(uri.toString());
27482
+ return {
27483
+ contents: result.contents.map((entry) => ({
27484
+ uri: entry.uri,
27485
+ mimeType: entry.mimeType,
27486
+ text: entry.text
27487
+ }))
27488
+ };
27489
+ });
27490
+ }
27491
+ }
27492
+ __name(registerResources, "registerResources");
27493
+ function registerPrompts(server) {
27494
+ for (const prompt of prompts) {
27495
+ const argsShape = {};
27496
+ if (prompt.arguments) {
27497
+ for (const arg of prompt.arguments) {
27498
+ argsShape[arg.name] = import_zod.z.string().optional().describe(arg.description);
27499
+ }
27128
27500
  }
27129
- } catch (caught) {
27130
- const message = caught instanceof Error ? caught.message : String(caught);
27131
- log2?.(`Request failed for ${request.method}: ${message}`);
27132
- return error(request.id, -32e3, message);
27501
+ server.registerPrompt(prompt.name, {
27502
+ description: prompt.description,
27503
+ argsSchema: argsShape
27504
+ }, async (args) => {
27505
+ const result = await getPrompt(prompt.name, args);
27506
+ return {
27507
+ ...result.description !== void 0 ? {
27508
+ description: result.description
27509
+ } : {},
27510
+ messages: result.messages.map((message) => ({
27511
+ role: message.role,
27512
+ content: {
27513
+ type: "text",
27514
+ text: message.content.text
27515
+ }
27516
+ }))
27517
+ };
27518
+ });
27133
27519
  }
27134
27520
  }
27135
- __name(handleRequestWithLogging, "handleRequestWithLogging");
27521
+ __name(registerPrompts, "registerPrompts");
27522
+ function registerAll(server) {
27523
+ registerTools(server);
27524
+ registerResources(server);
27525
+ registerPrompts(server);
27526
+ }
27527
+ __name(registerAll, "registerAll");
27528
+
27529
+ // src/server.ts
27530
+ var SERVER_INFO = {
27531
+ name: "software-metrics-machine",
27532
+ version: (0, import_utils5.getApplicationVersion)()
27533
+ };
27534
+ var log = /* @__PURE__ */ __name((message) => {
27535
+ transportLogger.info(message);
27536
+ }, "log");
27537
+ function createMcpServer() {
27538
+ const server = new import_server2.McpServer(SERVER_INFO, {
27539
+ capabilities: {
27540
+ tools: {},
27541
+ resources: {},
27542
+ prompts: {},
27543
+ logging: {}
27544
+ }
27545
+ });
27546
+ registerAll(server);
27547
+ return server;
27548
+ }
27549
+ __name(createMcpServer, "createMcpServer");
27136
27550
  async function startMcpServer(options = {}) {
27137
27551
  redirectConsoleToStderr();
27138
27552
  configureMcpLogging({
@@ -27141,37 +27555,8 @@ async function startMcpServer(options = {}) {
27141
27555
  log(`Starting Software Metrics Machine MCP server v${SERVER_INFO.version} over stdio`);
27142
27556
  log(`Configuration directory: ${(0, import_core4.resolveStoreDataAt)(process.env) || "<not set>"}`);
27143
27557
  log(`Available tools: ${tools.map((tool) => tool.name).join(", ")}`);
27144
- const reader = (0, import_node_readline.createInterface)({
27145
- input: process.stdin,
27146
- output: process.stdout,
27147
- terminal: false
27148
- });
27149
- reader.on("close", () => {
27150
- log("MCP stdio input closed; server stopped");
27151
- });
27152
- for await (const line of reader) {
27153
- if (!line.trim()) {
27154
- continue;
27155
- }
27156
- let response;
27157
- try {
27158
- const parsed = JSON.parse(line);
27159
- if (!isJsonRpcRequest(parsed)) {
27160
- log("Rejected invalid JSON-RPC request");
27161
- response = error(null, -32600, "Invalid JSON-RPC request");
27162
- } else {
27163
- log(`Received request: ${parsed.method}`);
27164
- response = await handleRequestWithLogging(parsed, log);
27165
- }
27166
- } catch (caught) {
27167
- log(`Failed to parse request: ${caught instanceof Error ? caught.message : "Invalid JSON payload"}`);
27168
- response = error(null, -32700, caught instanceof Error ? caught.message : "Invalid JSON payload");
27169
- }
27170
- if (response) {
27171
- process.stdout.write(`${JSON.stringify(response)}
27172
- `);
27173
- }
27174
- }
27558
+ await (0, import_stdio.serveStdio)(() => createMcpServer());
27559
+ log("MCP server connected to stdio transport");
27175
27560
  }
27176
27561
  __name(startMcpServer, "startMcpServer");
27177
27562
  // Annotate the CommonJS export names for ESM import in node:
@@ -27194,12 +27579,14 @@ __name(startMcpServer, "startMcpServer");
27194
27579
  buildIssueMetricsInputSchema,
27195
27580
  buildMetricsInputSchema,
27196
27581
  buildPipelineDashboardInputSchema,
27582
+ buildSavedFilterGetInputSchema,
27583
+ buildSavedFilterListInputSchema,
27197
27584
  buildSonarqubeComponentTreeInputSchema,
27198
27585
  configureMcpLogging,
27199
27586
  createMcpMetricsReader,
27587
+ createMcpServer,
27200
27588
  findTool,
27201
27589
  getPrompt,
27202
- handleRequest,
27203
27590
  listEngineeringHealthMetricCatalog,
27204
27591
  listResourceTemplates,
27205
27592
  listResources,
@@ -27217,12 +27604,18 @@ __name(startMcpServer, "startMcpServer");
27217
27604
  parseIssueMetricsArguments,
27218
27605
  parseMetricsToolArguments,
27219
27606
  parsePipelineDashboardArguments,
27607
+ parseSavedFilterGetArguments,
27608
+ parseSavedFilterListArguments,
27220
27609
  parseSonarqubeComponentTreeArguments,
27221
27610
  prompts,
27222
27611
  readResource,
27223
27612
  readString,
27224
27613
  redactSecrets,
27225
27614
  redirectConsoleToStderr,
27615
+ registerAll,
27616
+ registerPrompts,
27617
+ registerResources,
27618
+ registerTools,
27226
27619
  resolveMcpLogLevel,
27227
27620
  startMcpServer,
27228
27621
  tools