@skyramp/mcp 0.3.2-rc.pom-4 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/build/adapters/jestAdapter.d.ts +14 -0
  2. package/build/adapters/jestAdapter.js +113 -0
  3. package/build/adapters/mochaAdapter.d.ts +13 -0
  4. package/build/adapters/mochaAdapter.js +87 -0
  5. package/build/adapters/playwrightAdapter.d.ts +17 -0
  6. package/build/adapters/playwrightAdapter.js +182 -0
  7. package/build/adapters/pytestAdapter.d.ts +15 -0
  8. package/build/adapters/pytestAdapter.js +108 -0
  9. package/build/commands/commandLibrary.d.ts +1 -0
  10. package/build/commands/commandLibrary.js +19 -13
  11. package/build/commands/localDevTestChangesCommand.d.ts +15 -0
  12. package/build/commands/localDevTestChangesCommand.js +201 -0
  13. package/build/index.js +129 -8
  14. package/build/playwright/PlaywrightTraceService.d.ts +8 -0
  15. package/build/playwright/PlaywrightTraceService.js +1 -0
  16. package/build/prompts/code-reuse.js +3 -0
  17. package/build/prompts/enhance-assertions/sharedAssertionRules.d.ts +1 -0
  18. package/build/prompts/enhance-assertions/sharedAssertionRules.js +17 -0
  19. package/build/prompts/initialize-workspace/initializeWorkspacePrompt.js +11 -9
  20. package/build/prompts/local-dev/local-dev-plan.d.ts +35 -0
  21. package/build/prompts/local-dev/local-dev-plan.js +429 -0
  22. package/build/prompts/local-dev/local-dev-prompts.d.ts +4 -0
  23. package/build/prompts/local-dev/local-dev-prompts.js +190 -0
  24. package/build/prompts/pom-aware-code-reuse.js +17 -8
  25. package/build/prompts/prompt-utils.d.ts +8 -0
  26. package/build/prompts/prompt-utils.js +33 -0
  27. package/build/prompts/sut-setup/modes/adaptWorkflowPrompt.js +70 -7
  28. package/build/prompts/sut-setup/modes/dockerComposePrompt.js +1 -1
  29. package/build/prompts/sut-setup/shared.js +19 -17
  30. package/build/prompts/test-maintenance/drift-analysis-prompt.d.ts +10 -1
  31. package/build/prompts/test-maintenance/drift-analysis-prompt.js +54 -1
  32. package/build/prompts/test-recommendation/analysisOutputPrompt.js +21 -29
  33. package/build/prompts/test-recommendation/scopeAssessment.d.ts +5 -2
  34. package/build/prompts/test-recommendation/scopeAssessment.js +78 -6
  35. package/build/prompts/test-recommendation/test-recommendation-prompt.js +41 -4
  36. package/build/prompts/testbot/testbot-prompts.d.ts +2 -17
  37. package/build/prompts/testbot/testbot-prompts.js +63 -60
  38. package/build/recommendation/planRanker.d.ts +15 -2
  39. package/build/recommendation/planRanker.js +76 -5
  40. package/build/resources/testbotResource.js +23 -5
  41. package/build/services/AnalyticsService.d.ts +1 -1
  42. package/build/services/TestExecutionService.d.ts +15 -9
  43. package/build/services/TestExecutionService.js +56 -28
  44. package/build/services/TestGenerationService.d.ts +2 -2
  45. package/build/services/TestGenerationService.js +39 -21
  46. package/build/services/containerEnv.js +27 -1
  47. package/build/tool-phases.js +7 -0
  48. package/build/tools/code-refactor/codeReuseTool.js +43 -4
  49. package/build/tools/code-refactor/enhanceAssertionsTool.js +68 -18
  50. package/build/tools/code-refactor/reuse-outcome.d.ts +109 -0
  51. package/build/tools/code-refactor/reuse-outcome.js +158 -0
  52. package/build/tools/code-refactor/reuse-state.d.ts +45 -0
  53. package/build/tools/code-refactor/reuse-state.js +140 -0
  54. package/build/tools/enrichTestWithMocksTool.d.ts +28 -0
  55. package/build/tools/enrichTestWithMocksTool.js +726 -0
  56. package/build/tools/executeSkyrampTestTool.d.ts +11 -0
  57. package/build/tools/executeSkyrampTestTool.js +62 -21
  58. package/build/tools/generate-tests/batchMockGenerationTool.d.ts +106 -0
  59. package/build/tools/generate-tests/batchMockGenerationTool.js +545 -0
  60. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +25 -23
  61. package/build/tools/generate-tests/generateContractRestTool.js +2 -2
  62. package/build/tools/generate-tests/generateE2ERestTool.d.ts +1 -1
  63. package/build/tools/generate-tests/generateE2ERestTool.js +1 -1
  64. package/build/tools/generate-tests/generateLoadRestTool.d.ts +1 -1
  65. package/build/tools/generate-tests/generateLoadRestTool.js +1 -1
  66. package/build/tools/generate-tests/generateMockRestTool.d.ts +179 -6
  67. package/build/tools/generate-tests/generateMockRestTool.js +391 -22
  68. package/build/tools/generate-tests/loadTestSchema.d.ts +1 -1
  69. package/build/tools/generate-tests/planGuard.js +2 -22
  70. package/build/tools/generateEnrichedIntegrationTestTool.d.ts +25 -0
  71. package/build/tools/generateEnrichedIntegrationTestTool.js +235 -0
  72. package/build/tools/localDevWorkerComposeTool.d.ts +24 -0
  73. package/build/tools/localDevWorkerComposeTool.js +264 -0
  74. package/build/tools/one-click/oneClickTool.d.ts +13 -0
  75. package/build/tools/one-click/oneClickTool.js +195 -24
  76. package/build/tools/preflightMockCheckTool.d.ts +2 -0
  77. package/build/tools/preflightMockCheckTool.js +96 -0
  78. package/build/tools/queryProxyMocksTool.d.ts +70 -0
  79. package/build/tools/queryProxyMocksTool.js +521 -0
  80. package/build/tools/runExistingTestsTool.d.ts +138 -0
  81. package/build/tools/runExistingTestsTool.js +644 -0
  82. package/build/tools/submitReportTool.js +40 -2
  83. package/build/tools/test-management/actionsTool.js +12 -2
  84. package/build/tools/test-management/analyzeChangesTool.d.ts +2 -1
  85. package/build/tools/test-management/analyzeChangesTool.js +63 -40
  86. package/build/tools/test-management/analyzeTestHealthTool.d.ts +11 -0
  87. package/build/tools/test-management/analyzeTestHealthTool.js +63 -1
  88. package/build/tools/test-management/registerTestPlanTool.js +55 -7
  89. package/build/tools/trace/startTraceCollectionTool.js +3 -3
  90. package/build/types/ExternalTestExecution.d.ts +67 -0
  91. package/build/types/ExternalTestExecution.js +8 -0
  92. package/build/types/OneClickCommands.d.ts +1 -1
  93. package/build/types/Recommendation.d.ts +20 -0
  94. package/build/types/Recommendation.js +32 -6
  95. package/build/types/RepositoryAnalysis.d.ts +131 -14
  96. package/build/types/RepositoryAnalysis.js +16 -2
  97. package/build/types/ReuseOutcome.d.ts +63 -0
  98. package/build/types/ReuseOutcome.js +33 -0
  99. package/build/types/TestAnalysis.d.ts +7 -3
  100. package/build/types/TestExecution.d.ts +1 -0
  101. package/build/types/TestTypes.d.ts +25 -7
  102. package/build/types/TestTypes.js +25 -7
  103. package/build/types/TestbotPromptOptions.d.ts +35 -0
  104. package/build/types/TestbotPromptOptions.js +1 -0
  105. package/build/types/TestbotReport.d.ts +7 -0
  106. package/build/types/index.d.ts +3 -0
  107. package/build/types/index.js +1 -0
  108. package/build/utils/AnalysisStateManager.d.ts +33 -0
  109. package/build/utils/AnalysisStateManager.js +36 -2
  110. package/build/utils/analyze-openapi.js +18 -1
  111. package/build/utils/branchDiff.d.ts +17 -1
  112. package/build/utils/branchDiff.js +99 -14
  113. package/build/utils/featureFlags.d.ts +31 -0
  114. package/build/utils/featureFlags.js +37 -0
  115. package/build/utils/frontendSelectors.js +0 -1
  116. package/build/utils/gitStaging.d.ts +5 -0
  117. package/build/utils/gitStaging.js +1 -1
  118. package/build/utils/grpcMockValidation.d.ts +1 -0
  119. package/build/utils/grpcMockValidation.js +49 -0
  120. package/build/utils/httpMethodValidation.d.ts +4 -0
  121. package/build/utils/httpMethodValidation.js +15 -0
  122. package/build/utils/logger.js +1 -1
  123. package/build/utils/mockCompatibility.d.ts +49 -0
  124. package/build/utils/mockCompatibility.js +82 -0
  125. package/build/utils/pom-catalog.d.ts +23 -0
  126. package/build/utils/pom-catalog.js +30 -0
  127. package/build/utils/pom-scope/pom-files.d.ts +14 -0
  128. package/build/utils/pom-scope/pom-files.js +32 -6
  129. package/build/utils/pom-scope/testIdDiscovery.d.ts +40 -0
  130. package/build/utils/pom-scope/testIdDiscovery.js +104 -0
  131. package/build/utils/pom-verify/verify.d.ts +5 -0
  132. package/build/utils/pom-verify/verify.js +1 -0
  133. package/build/utils/progress.js +10 -5
  134. package/build/utils/proxy-terminal.js +3 -3
  135. package/build/utils/reportVerification.d.ts +7 -2
  136. package/build/utils/reportVerification.js +9 -3
  137. package/build/utils/routeParsers.d.ts +3 -9
  138. package/build/utils/routeParsers.js +79 -4
  139. package/build/utils/utils.js +2 -2
  140. package/build/utils/versions.d.ts +4 -3
  141. package/build/utils/versions.js +3 -1
  142. package/build/utils/workspaceAuth.d.ts +46 -0
  143. package/build/utils/workspaceAuth.js +156 -1
  144. package/build/workspace/frameworks.d.ts +11 -0
  145. package/build/workspace/frameworks.js +22 -0
  146. package/build/workspace/testSuites.d.ts +20 -0
  147. package/build/workspace/testSuites.js +17 -0
  148. package/build/workspace/workspace.d.ts +206 -24
  149. package/build/workspace/workspace.js +52 -2
  150. package/node_modules/playwright/ThirdPartyNotices.txt +319 -266
  151. package/node_modules/playwright/lib/dom-analyzer/blueprint.js +154 -27
  152. package/node_modules/playwright/lib/dom-analyzer/crawler.js +2 -2
  153. package/node_modules/playwright/lib/mcp/browser/tools/pageBlueprint.js +1 -1
  154. package/node_modules/playwright/lib/mcp/browser/tools/sitemap.js +6 -2
  155. package/node_modules/playwright/lib/mcp/skyramp/loadTraceTool.js +3 -2
  156. package/node_modules/playwright/lib/mcp/skyramp/resultCode.js +4 -3
  157. package/node_modules/playwright/lib/mcp/skyramp/skyRampImport.js +15 -3
  158. package/node_modules/playwright/lib/mcp/skyramp/specImport.js +781 -0
  159. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +14 -3
  160. package/node_modules/playwright/lib/mcp/test/resultCode.test.js +2 -1
  161. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +1 -1
  162. package/node_modules/playwright/lib/mcp/test/skyRampExport.test.js +30 -0
  163. package/node_modules/playwright/lib/transform/babelBundleImpl.js +200 -199
  164. package/node_modules/playwright/node_modules/playwright-core/ThirdPartyNotices.txt +3 -3
  165. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/.package-lock.json +3 -3
  166. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/aws-lambda/handler.js +16 -25
  167. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
  168. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/lambda-edge/handler.js +20 -4
  169. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +16 -25
  170. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
  171. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +20 -4
  172. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/client/client.js +10 -1
  173. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/client/utils.js +1 -1
  174. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
  175. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
  176. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/base.js +8 -14
  177. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/components.js +41 -21
  178. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/context.js +131 -5
  179. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
  180. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
  181. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
  182. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
  183. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
  184. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
  185. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/language/language.js +10 -32
  186. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
  187. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/serve-static/index.js +2 -2
  188. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/timing/timing.js +3 -1
  189. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
  190. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/body.js +12 -4
  191. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
  192. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/ipaddr.js +6 -1
  193. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/validator/validator.js +3 -3
  194. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/client/client.js +10 -1
  195. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/client/utils.js +1 -1
  196. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/helper/css/common.js +3 -1
  197. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/helper/css/index.js +9 -1
  198. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/base.js +15 -15
  199. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/components.js +42 -22
  200. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/context.js +129 -5
  201. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/streaming.js +10 -8
  202. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
  203. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/cache/index.js +1 -1
  204. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/compress/index.js +2 -1
  205. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/cors/index.js +2 -5
  206. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/etag/index.js +2 -1
  207. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/language/language.js +10 -32
  208. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/method-override/index.js +5 -3
  209. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/serve-static/index.js +2 -2
  210. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/timing/timing.js +3 -1
  211. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/router/trie-router/node.js +9 -0
  212. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
  213. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
  214. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
  215. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
  216. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
  217. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
  218. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
  219. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/utils/body.d.ts +1 -1
  220. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/utils/types.d.ts +1 -1
  221. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/body.js +12 -4
  222. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/buffer.js +2 -1
  223. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/ipaddr.js +6 -1
  224. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/validator/validator.js +3 -3
  225. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/package.json +29 -22
  226. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/package-lock.json +3 -3
  227. package/node_modules/playwright/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +1 -1
  228. package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/jsonlReader.js +5 -1
  229. package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/specReader.js +781 -0
  230. package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder/recorderApp.js +25 -6
  231. package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder/skyramp/replayEngine.js +3 -1
  232. package/node_modules/playwright/node_modules/playwright-core/lib/utils.js +2 -0
  233. package/node_modules/playwright/node_modules/playwright-core/lib/vite/htmlReport/index.html +253 -27
  234. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/{codeMirrorModule-D0BjbCb7.js → codeMirrorModule-DtudTj_v.js} +1 -1
  235. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-BpDwp16L.js +422 -0
  236. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/index.html +1 -1
  237. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-Bzd72-bG.js → codeMirrorModule-FNMuBzX1.js} +1 -1
  238. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-Co9upU5h.js +1035 -0
  239. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.DXNIQ_dx.js +2 -0
  240. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
  241. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CIKB3XSv.js +5 -0
  242. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
  243. package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
  244. package/node_modules/playwright/node_modules/playwright-core/src/generated/pollingRecorderSource.ts +1 -1
  245. package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/jsonlReader.ts +4 -0
  246. package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/specReader.ts +1028 -0
  247. package/node_modules/playwright/node_modules/playwright-core/src/server/recorder/recorderApp.ts +31 -8
  248. package/node_modules/playwright/node_modules/playwright-core/src/server/recorder/skyramp/replayEngine.ts +1 -0
  249. package/node_modules/playwright/node_modules/playwright-core/src/utils.ts +1 -0
  250. package/node_modules/playwright/package.json +1 -1
  251. package/package.json +12 -6
  252. package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
  253. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-lvTRGFx-.js +0 -193
  254. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-DzxTioTK.js +0 -809
  255. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.BGc30U3S.js +0 -2
  256. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.IaDrb29A.js +0 -5
@@ -1,18 +1,149 @@
1
1
  import { z } from "zod";
2
- import { baseSchema, HttpMethod, TestType } from "../../types/TestTypes.js";
2
+ import { baseSchema, MockProtocol, MOCK_TYPE } from "../../types/TestTypes.js";
3
+ export { MockProtocol } from "../../types/TestTypes.js";
3
4
  import { TestGenerationService } from "../../services/TestGenerationService.js";
4
5
  import { AnalyticsService } from "../../services/AnalyticsService.js";
5
6
  import { getEntryPoint } from "../../utils/telemetry.js";
7
+ import { getRestMockMethodValidationError, normalizeRestMockMethod, } from "../../utils/httpMethodValidation.js";
8
+ import { getGrpcMockResponseValidationError } from "../../utils/grpcMockValidation.js";
9
+ import { isLocalDevEnabled } from "../../utils/featureFlags.js";
10
+ export const MOCK_PROTOCOL_EXAMPLES = `
11
+ <example protocol="rest">
12
+ Generate a REST mock for one HTTP endpoint. Required fields: protocol="rest", endpointURL, method. Use apiSchema with an empty method only when intentionally generating all schema methods.
13
+ {
14
+ "protocol": "rest",
15
+ "endpointURL": "http://payment-service:5001/orders/:order_id/payment_authorizations",
16
+ "method": "PUT",
17
+ "requestAware": true,
18
+ "requestData": "{\"payment_method_id\":\"pm_123\"}",
19
+ "responseData": "{\"accepted\":true}",
20
+ "responseStatusCode": "200"
21
+ }
22
+ </example>
23
+
24
+ <example protocol="rest-traffic-simulation">
25
+ Generate a REST mock with traffic simulation (latency + drop rate). minLatency/maxLatency inject a random delay per response; dropRate drops a percentage of requests.
26
+ {
27
+ "protocol": "rest",
28
+ "endpointURL": "http://payment-service:5001/payments",
29
+ "method": "POST",
30
+ "responseData": "{\"status\":\"ok\"}",
31
+ "minLatency": 500,
32
+ "maxLatency": 1000,
33
+ "dropRate": 10
34
+ }
35
+ </example>
36
+
37
+ <example protocol="rest-conditional">
38
+ Generate a conditional REST mock that selects a response based on request data. Use "when" to match request fields and "requestSchema" to validate the request body. Multiple mocks for the same endpoint+method are evaluated in order; the first matching "when" wins.
39
+ {
40
+ "protocol": "rest",
41
+ "endpointURL": "http://payment-service:5001/api/v1/orders",
42
+ "method": "POST",
43
+ "when": {"request.body.payment.method": "card"},
44
+ "requestSchema": "{\"type\":\"object\",\"required\":[\"orderId\",\"payment\"]}",
45
+ "responseData": "{\"status\":\"confirmed\"}",
46
+ "responseStatusCode": "201",
47
+ "noMatchStatusCode": 404,
48
+ "validationFailureStatusCode": 422
49
+ }
50
+ </example>
51
+
52
+ <example protocol="grpc">
53
+ Generate a gRPC mock. Required fields: protocol="grpc", endpointURL as host:port, protoPath, grpcServiceName. method is the RPC method name; omit or leave empty to generate all service methods. use responseData for successful protobuf-shaped responses, or grpcStatusCode/grpcStatusMessage for gRPC status errors.
54
+ {
55
+ "protocol": "grpc",
56
+ "endpointURL": "profile-service:50051",
57
+ "protoPath": "/repo/proto/profiles.proto",
58
+ "grpcServiceName": "ProfileService",
59
+ "method": "GetProfile",
60
+ "responseData": "{\"eligible\":true}"
61
+ }
62
+ </example>
63
+
64
+ <example protocol="grpc-traffic-simulation">
65
+ Generate a gRPC mock with traffic simulation. Same latency/drop fields as REST.
66
+ {
67
+ "protocol": "grpc",
68
+ "endpointURL": "profile-service:50051",
69
+ "protoPath": "/repo/proto/profiles.proto",
70
+ "grpcServiceName": "ProfileService",
71
+ "method": "GetProfile",
72
+ "responseData": "{\"eligible\":true}",
73
+ "minLatency": 200,
74
+ "maxLatency": 800,
75
+ "dropRate": 5
76
+ }
77
+ </example>
78
+
79
+ <example protocol="grpc-status-error">
80
+ Generate a gRPC status error mock. Do not provide responseData with grpcStatusCode.
81
+ {
82
+ "protocol": "grpc",
83
+ "endpointURL": "profile-service:50051",
84
+ "protoPath": "/repo/proto/profiles.proto",
85
+ "grpcServiceName": "ProfileService",
86
+ "method": "GetProfile",
87
+ "grpcStatusCode": 5,
88
+ "grpcStatusMessage": "profile not found"
89
+ }
90
+ </example>
91
+
92
+ <example protocol="kafka-producer">
93
+ Generate a Kafka producer validation mock. Required fields: protocol="kafka", endpointURL as broker host:port, kafkaTopic, and requestData. Do not pass method or responseData. Traffic simulation (minLatency/maxLatency/dropRate) is NOT supported for Kafka.
94
+ {
95
+ "protocol": "kafka",
96
+ "endpointURL": "broker:9092",
97
+ "kafkaTopic": "events",
98
+ "requestData": "{\"name\":\"order.created\"}"
99
+ }
100
+ </example>
101
+
102
+ <example protocol="kafka-consumer">
103
+ Generate a Kafka consumer message mock. Required fields: protocol="kafka", endpointURL as broker host:port, kafkaTopic, and responseData. Do not pass method or requestData. Traffic simulation (minLatency/maxLatency/dropRate) is NOT supported for Kafka.
104
+ {
105
+ "protocol": "kafka",
106
+ "endpointURL": "broker:9092",
107
+ "kafkaTopic": "events",
108
+ "responseData": "{\"accepted\":true}"
109
+ }
110
+ </example>`;
6
111
  const mockSchema = {
112
+ protocol: z
113
+ .nativeEnum(MockProtocol)
114
+ .default(MockProtocol.Rest)
115
+ .describe("Protocol for the mock to generate. Use 'rest' for HTTP/OpenAPI mocks, 'grpc' for protobuf/gRPC mocks, and 'kafka' for Kafka topic mocks. See <example> blocks in the tool description for protocol-specific required fields."),
7
116
  endpointURL: z
8
117
  .string()
9
- .describe("The base URL or endpoint URL to generate a mock for. " +
10
- "If only a base URL is provided (e.g., https://api.example.com) and an apiSchema is given, mocks will be generated for ALL endpoints and methods in the schema — do NOT append paths to the URL. " +
11
- "Only include a specific path (e.g., https://api.example.com/api/v1/products) if the user explicitly requests mocking a single endpoint."),
118
+ .describe("For REST: the base URL or endpoint URL to generate a mock for. " +
119
+ "For gRPC: the target service address as host:port (for example, profile-service:50051); do not include http://. " +
120
+ "For Kafka: the broker address as host:port (for example, broker:9092); do not include http://. " +
121
+ "If only a base URL is provided (e.g., https://api.example.com) and an apiSchema is given, REST mocks will be generated for ALL endpoints and methods in the schema — do NOT append paths to the URL. " +
122
+ "Only include a specific path (e.g., https://api.example.com/api/v1/products) if the user explicitly requests mocking a single REST endpoint."),
123
+ protoPath: z
124
+ .string()
125
+ .optional()
126
+ .describe("Required for protocol='grpc'. Absolute or repo-relative path to the .proto file that defines the gRPC service."),
127
+ grpcServiceName: z
128
+ .string()
129
+ .optional()
130
+ .describe("Required for protocol='grpc'. gRPC service name from the proto file, e.g. Greeter or ProfileService."),
131
+ protobufExtraFiles: z
132
+ .array(z.string())
133
+ .optional()
134
+ .describe("Optional extra .proto files needed to compile the primary proto for gRPC mocks."),
135
+ protobufExtraImportPath: z
136
+ .array(z.string())
137
+ .optional()
138
+ .describe("Optional extra import directories used when compiling protobuf files for gRPC mocks."),
139
+ kafkaTopic: z
140
+ .string()
141
+ .optional()
142
+ .describe("Required for protocol='kafka'. Kafka topic name to mock, e.g. order.created or orders."),
12
143
  method: z
13
- .union([z.nativeEnum(HttpMethod), z.literal("")])
144
+ .string()
14
145
  .default("")
15
- .describe('HTTP method to mock. DEFAULT: Use empty string ("") to mock ALL available methods from the OpenAPI schema. Only specify a specific method (GET, POST, PUT, DELETE, etc.) if the user explicitly requests mocking a single method.'),
146
+ .describe('For REST: HTTP method to mock; required unless apiSchema is provided for schema-wide generation. Empty string ("") with apiSchema mocks ALL available schema methods. For gRPC: RPC method name to mock; empty string generates all service methods. For Kafka: MUST be empty; use kafkaTopic for the topic name.'),
16
147
  apiSchema: z
17
148
  .string()
18
149
  .default("")
@@ -20,16 +151,29 @@ const mockSchema = {
20
151
  responseData: z
21
152
  .string()
22
153
  .optional()
23
- .describe("Sample response body data to use in the mock, provided either as an inline JSON/YAML string or as an absolute file path prefixed with '@' (e.g., @/absolute/path/to/file)."),
154
+ .describe("REST/gRPC: sample response body data to return. Kafka: consumer messages to inject. Provide inline JSON/YAML or an absolute file path prefixed with '@' (e.g., @/absolute/path/to/file)."),
24
155
  responseStatusCode: z
25
156
  .string()
26
157
  .default("")
27
- .refine((val) => !val || /^\d{3}$/.test(val), { message: "Must be a 3-digit HTTP status code (e.g., '200', '201') or empty string" })
158
+ .refine((val) => !val || /^\d{3}$/.test(val), {
159
+ message: "Must be a 3-digit HTTP status code (e.g., '200', '201') or empty string",
160
+ })
28
161
  .describe("HTTP status code the mock should return (e.g., '200', '201'). DO NOT ASSUME a status code if not provided."),
162
+ grpcStatusCode: z
163
+ .number()
164
+ .int()
165
+ .min(1)
166
+ .max(16)
167
+ .optional()
168
+ .describe("For protocol='grpc' error mocks only. Non-OK gRPC status code number, e.g. 5 for NOT_FOUND or 14 for UNAVAILABLE. Do not combine with responseData."),
169
+ grpcStatusMessage: z
170
+ .string()
171
+ .optional()
172
+ .describe("For protocol='grpc' error mocks only. gRPC status message to return with grpcStatusCode."),
29
173
  requestData: z
30
174
  .string()
31
175
  .default("")
32
- .describe("Sample request body data for request-aware mocks, provided either as an inline JSON/YAML string or as an absolute file path prefixed with '@' (e.g., @/absolute/path/to/file)."),
176
+ .describe("REST: request body sample for request-aware matching. Kafka: producer validation payload/schema. Provide inline JSON/YAML or an absolute file path prefixed with '@' (e.g., @/absolute/path/to/file)."),
33
177
  formParams: z
34
178
  .string()
35
179
  .default("")
@@ -38,21 +182,96 @@ const mockSchema = {
38
182
  .boolean()
39
183
  .default(false)
40
184
  .describe("When true, generates a dynamic mock that varies its response based on the incoming request data."),
185
+ minLatency: z
186
+ .number()
187
+ .int()
188
+ .min(0)
189
+ .optional()
190
+ .describe("Minimum injected response delay in milliseconds for traffic simulation (REST and gRPC only). " +
191
+ "Combined with maxLatency to delay each mocked response by a random amount in [minLatency, maxLatency]."),
192
+ maxLatency: z
193
+ .number()
194
+ .int()
195
+ .min(0)
196
+ .optional()
197
+ .describe("Maximum injected response delay in milliseconds for traffic simulation (REST and gRPC only). " +
198
+ "Combined with minLatency to delay each mocked response by a random amount in [minLatency, maxLatency]."),
199
+ dropRate: z
200
+ .number()
201
+ .int()
202
+ .min(0)
203
+ .max(100)
204
+ .optional()
205
+ .describe("Percentage [0-100] of requests that are dropped/errored for traffic simulation (REST and gRPC only). " +
206
+ "For example, dropRate=10 means ~10% of requests will fail."),
41
207
  trace: z
42
208
  .string()
43
209
  .optional()
44
210
  .describe("MUST be absolute path to a trace file (e.g., /path/to/trace.json) to generate the mock from captured traffic."),
45
- ...(({ authHeader, insecure, ...rest }) => rest)(baseSchema.shape),
211
+ when: z
212
+ .record(z.unknown())
213
+ .optional()
214
+ .describe("Conditional-selection predicate (operator map) for REST and gRPC mocks. " +
215
+ "When multiple mocks share an (endpoint, method), the server evaluates each mock's `when` in declared order " +
216
+ "and returns the first match; a mock without `when` is the default. " +
217
+ "Keys are request paths (request.body.<jsonpath>, request.path.<name>, request.query.<name>, " +
218
+ "request.header.<name>, request.form.<name>); values are a bare value (equality) or " +
219
+ "an operator object ({eq,ne,gt,gte,lt,lte,in,contains,regex,exists}). " +
220
+ 'Example: {"request.body.payment.method": "card"}'),
221
+ requestSchema: z
222
+ .string()
223
+ .optional()
224
+ .describe("Explicit JSON Schema (string) to validate the request body before serving the mock response. " +
225
+ "Falls back to a schema derived from requestData when not provided. REST and gRPC only."),
226
+ noMatchStatusCode: z
227
+ .number()
228
+ .int()
229
+ .min(100)
230
+ .max(599)
231
+ .optional()
232
+ .describe("HTTP status code returned when no `when` branch matches and there is no default response " +
233
+ "(default 404 / gRPC NOT_FOUND). REST and gRPC only."),
234
+ validationFailureStatusCode: z
235
+ .number()
236
+ .int()
237
+ .min(100)
238
+ .max(599)
239
+ .optional()
240
+ .describe("HTTP status code returned when request body validation against requestSchema fails " +
241
+ "(default 400 / gRPC INVALID_ARGUMENT). REST and gRPC only."),
242
+ ...(({ authHeader: _authHeader, insecure: _insecure, ...rest }) => rest)(baseSchema.shape),
46
243
  };
244
+ export function validateTrafficConfig(params) {
245
+ const hasMin = params.minLatency !== undefined;
246
+ const hasMax = params.maxLatency !== undefined;
247
+ if (hasMin !== hasMax) {
248
+ return "minLatency and maxLatency must be provided together";
249
+ }
250
+ if (hasMin && hasMax && params.minLatency > params.maxLatency) {
251
+ return "minLatency must be less than or equal to maxLatency";
252
+ }
253
+ return null;
254
+ }
255
+ export function buildTrafficConfigOptions(params) {
256
+ const result = {};
257
+ if (params.minLatency !== undefined)
258
+ result.minLatency = params.minLatency;
259
+ if (params.maxLatency !== undefined)
260
+ result.maxLatency = params.maxLatency;
261
+ if (params.dropRate !== undefined)
262
+ result.dropRate = params.dropRate;
263
+ return result;
264
+ }
47
265
  export class MockGenerationService extends TestGenerationService {
48
266
  getTestType() {
49
- return TestType.MOCK;
267
+ return MOCK_TYPE;
50
268
  }
51
269
  async generateTest(params) {
52
270
  const result = await super.generateTest(params);
53
271
  if (result.isError)
54
272
  return result;
55
- if (!params.apiSchema)
273
+ if (!params.apiSchema ||
274
+ (params.protocol ?? MockProtocol.Rest) !== MockProtocol.Rest)
56
275
  return result;
57
276
  return {
58
277
  ...result,
@@ -123,11 +342,97 @@ This file must:
123
342
  - Do NOT modify any mock logic, response data, or function signatures — only reorganize and add import/export wiring.
124
343
  `;
125
344
  }
126
- buildGenerationOptions(params) {
345
+ validateInputs(params) {
346
+ const result = super.validateInputs(params);
347
+ const protocol = params.protocol ?? MockProtocol.Rest;
348
+ if (protocol === MockProtocol.Rest) {
349
+ const methodError = getRestMockMethodValidationError(params.method);
350
+ if (methodError) {
351
+ result.content.push({
352
+ type: "text",
353
+ text: `Error: ${methodError}.`,
354
+ });
355
+ result.isError = true;
356
+ }
357
+ if (!params.apiSchema && !params.method) {
358
+ result.content.push({
359
+ type: "text",
360
+ text: "Error: REST mock method is required unless apiSchema is provided for schema-wide generation.",
361
+ });
362
+ result.isError = true;
363
+ }
364
+ }
365
+ const missing = [];
366
+ if (protocol === MockProtocol.Rest) {
367
+ const trafficError = validateTrafficConfig(params);
368
+ if (trafficError) {
369
+ result.content.push({ type: "text", text: `Error: ${trafficError}.` });
370
+ result.isError = true;
371
+ }
372
+ return result;
373
+ }
374
+ if (protocol === MockProtocol.Grpc) {
375
+ if (!params.protoPath)
376
+ missing.push("protoPath is required for protocol='grpc'");
377
+ if (!params.grpcServiceName)
378
+ missing.push("grpcServiceName is required for protocol='grpc'");
379
+ if (params.grpcStatusCode !== undefined && params.responseData?.trim()) {
380
+ missing.push("gRPC status error mocks must use grpcStatusCode/grpcStatusMessage instead of responseData");
381
+ }
382
+ if (params.grpcStatusMessage && params.grpcStatusCode === undefined) {
383
+ missing.push("grpcStatusMessage requires grpcStatusCode");
384
+ }
385
+ const grpcResponseError = getGrpcMockResponseValidationError(params.responseData);
386
+ if (grpcResponseError)
387
+ missing.push(grpcResponseError);
388
+ }
389
+ if (protocol === MockProtocol.Kafka) {
390
+ if (!params.kafkaTopic) {
391
+ missing.push("kafkaTopic is required for protocol='kafka'");
392
+ }
393
+ if (params.method) {
394
+ missing.push("Kafka mock method must be empty; use kafkaTopic for the topic name. Produce validation uses requestData and consumer messages use responseData");
395
+ }
396
+ const hasRequestData = Boolean(params.requestData && params.requestData.trim());
397
+ const hasResponseData = Boolean(params.responseData && params.responseData.trim());
398
+ if (hasRequestData === hasResponseData) {
399
+ missing.push("Kafka mock requires exactly one of requestData (producer validation) or responseData (consumer messages)");
400
+ }
401
+ if (params.minLatency !== undefined ||
402
+ params.maxLatency !== undefined ||
403
+ params.dropRate !== undefined) {
404
+ missing.push("traffic config (minLatency/maxLatency/dropRate) is not applicable for Kafka mocks");
405
+ }
406
+ if (params.when !== undefined ||
407
+ params.requestSchema !== undefined ||
408
+ params.noMatchStatusCode !== undefined ||
409
+ params.validationFailureStatusCode !== undefined) {
410
+ missing.push("conditional response fields (when/requestSchema/noMatchStatusCode/validationFailureStatusCode) are not applicable for Kafka mocks");
411
+ }
412
+ }
413
+ if (protocol !== MockProtocol.Kafka) {
414
+ const trafficError = validateTrafficConfig(params);
415
+ if (trafficError)
416
+ missing.push(trafficError);
417
+ }
418
+ if (missing.length === 0) {
419
+ return result;
420
+ }
127
421
  return {
128
- uri: params.endpointURL,
129
- method: params.method,
130
- apiSchema: params.apiSchema ? [params.apiSchema] : [],
422
+ content: [
423
+ ...result.content,
424
+ {
425
+ type: "text",
426
+ text: `Error: ${missing.join("; ")}.`,
427
+ },
428
+ ],
429
+ isError: true,
430
+ };
431
+ }
432
+ buildGenerationOptions(params) {
433
+ const protocol = params.protocol ?? MockProtocol.Rest;
434
+ const common = {
435
+ protocol,
131
436
  language: params.language ?? "python",
132
437
  framework: params.framework ??
133
438
  (params.language === "typescript" || params.language === "javascript"
@@ -143,20 +448,70 @@ This file must:
143
448
  k8sNamespace: params.k8sNamespace,
144
449
  k8sConfig: params.k8sConfig,
145
450
  k8sContext: params.k8sContext,
451
+ entrypoint: getEntryPoint(),
452
+ };
453
+ const responseDataOption = params.responseData !== undefined &&
454
+ !(protocol === MockProtocol.Grpc && params.grpcStatusCode !== undefined)
455
+ ? { responseData: params.responseData }
456
+ : {};
457
+ const trafficConfig = buildTrafficConfigOptions(params);
458
+ if (protocol === MockProtocol.Grpc) {
459
+ return {
460
+ ...common,
461
+ ...responseDataOption,
462
+ ...trafficConfig,
463
+ method: params.method,
464
+ url: params.endpointURL,
465
+ protoPath: params.protoPath,
466
+ service: params.grpcServiceName,
467
+ grpcStatusCode: params.grpcStatusCode,
468
+ grpcStatusMessage: params.grpcStatusMessage,
469
+ extraFiles: params.protobufExtraFiles ?? [],
470
+ extraImports: params.protobufExtraImportPath ?? [],
471
+ when: params.when,
472
+ requestSchema: params.requestSchema,
473
+ noMatchStatusCode: params.noMatchStatusCode ?? 0,
474
+ validationFailureStatusCode: params.validationFailureStatusCode ?? 0,
475
+ };
476
+ }
477
+ if (protocol === MockProtocol.Kafka) {
478
+ return {
479
+ ...common,
480
+ ...responseDataOption,
481
+ url: params.endpointURL,
482
+ topic: params.kafkaTopic,
483
+ requestData: params.requestData?.trim() ? params.requestData : undefined,
484
+ };
485
+ }
486
+ return {
487
+ ...common,
488
+ ...responseDataOption,
489
+ ...trafficConfig,
490
+ method: normalizeRestMockMethod(params.method),
491
+ uri: params.endpointURL,
492
+ apiSchema: params.apiSchema ? [params.apiSchema] : [],
146
493
  requestData: params.requestData,
147
- responseData: params.responseData,
148
494
  responseStatusCode: params.responseStatusCode,
149
495
  formParams: params.formParams,
150
496
  requestAware: params.requestAware,
151
497
  traceFilePath: params.trace,
152
- entrypoint: getEntryPoint(),
153
498
  mockPort: params.mockPort ?? 0,
154
499
  optionalFields: params.optionalFields ?? false,
500
+ when: params.when,
501
+ requestSchema: params.requestSchema,
502
+ noMatchStatusCode: params.noMatchStatusCode,
503
+ validationFailureStatusCode: params.validationFailureStatusCode,
155
504
  };
156
505
  }
157
506
  async executeGeneration(generateOptions) {
158
507
  try {
159
- const result = await this.client.generateRestMock(generateOptions);
508
+ const protocol = generateOptions.protocol ?? MockProtocol.Rest;
509
+ const client = this.client;
510
+ const result = protocol === MockProtocol.Grpc
511
+ ? await client.generateGrpcMock(generateOptions)
512
+ : protocol === MockProtocol.Kafka
513
+ ? await client.generateKafkaMock(generateOptions)
514
+ : await client.generateRestMock(generateOptions);
160
515
  if (result && result.length > 0) {
161
516
  const lowerResult = result.toLowerCase();
162
517
  if (!lowerResult.includes("success")) {
@@ -177,12 +532,18 @@ ${result}`;
177
532
  }
178
533
  }
179
534
  }
535
+ const LOCAL_DEV_GUARD = `
536
+ **LOCAL-DEV GUARD:** If the user asked to run a local-dev workflow, test local changes, validate a feature branch, test against a base/prod/main branch, or mock downstream services for local testing, do NOT start with this tool. First call \`skyramp_one_click_tool\` with workflow \`local_dev_test_changes\`, \`callingAgent\` set to the current MCP client, \`repositoryPath\`, and \`baseBranch\`; that workflow installs skills, initializes the workspace, analyzes the diff, and then calls mock generation at the correct phase.
537
+ `;
538
+ function getLocalDevGuard() {
539
+ return isLocalDevEnabled() ? LOCAL_DEV_GUARD : "";
540
+ }
180
541
  const TOOL_NAME = "skyramp_mock_generation";
181
542
  export function registerMockTool(server) {
182
543
  server.registerTool(TOOL_NAME, {
183
- description: `Generate a mock server implementation using Skyramp's deterministic mock generation platform.
544
+ description: `${getLocalDevGuard()}Generate a mock server implementation using Skyramp's deterministic mock generation platform.
184
545
 
185
- Mocks simulate API endpoints so that consumers can develop and test against them without requiring a live backend. They are useful for parallel development, isolating dependencies, and simulating edge-case responses.
546
+ Mocks simulate REST, gRPC, or Kafka dependencies so that consumers can develop and test against them without requiring a live backend. They are useful for parallel development, isolating dependencies, and simulating edge-case responses.
186
547
 
187
548
  **IMPORTANT: If an apiSchema parameter (OpenAPI/Swagger file path or URL) is provided, DO NOT attempt to read or analyze the file contents. Simply pass the path/URL to the tool — the backend will handle reading and processing the schema file.**
188
549
 
@@ -191,10 +552,18 @@ Mocks simulate API endpoints so that consumers can develop and test against them
191
552
  **Request-aware mocks:**
192
553
  - \`requestAware: true\` generates a dynamic mock that inspects the incoming request and varies its response accordingly. Use this when the consumer sends different request bodies and expects different responses.
193
554
 
555
+ **Conditional response selection:**
556
+ - Use \`when\` to define a predicate that selects which response branch to serve. Multiple mocks for the same endpoint and method are evaluated in declared order; the first matching \`when\` wins. A mock without \`when\` acts as the default fallback.
557
+ - Use \`requestSchema\` to validate the request body against a JSON Schema before serving the response.
558
+ - Use \`noMatchStatusCode\` (default 404) and \`validationFailureStatusCode\` (default 400) to control error responses.
559
+ - Response bodies can reference request values with \`$request.body.<path>\`, \`$request.path.<name>\`, \`$request.query.<name>\`, \`$request.header.<name>\`, or \`$request.form.<name>\` tokens for value chaining.
560
+
194
561
  **Sources (in order of preference):**
195
562
  1. Trace file (\`trace\`): generates the mock from captured real traffic.
196
563
  2. OpenAPI schema (\`apiSchema\`): generates the mock from the spec.
197
- 3. Inline response data (\`responseData\`): generates a static mock with a fixed response.`,
564
+ 3. Inline response data (\`responseData\`): generates a static mock with a fixed response.
565
+
566
+ ${MOCK_PROTOCOL_EXAMPLES}`,
198
567
  inputSchema: mockSchema,
199
568
  }, async (params) => {
200
569
  const service = new MockGenerationService();
@@ -12,7 +12,7 @@ export declare const loadTestSchema: {
12
12
  exclude: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
13
13
  endpointURL: z.ZodDefault<z.ZodString>;
14
14
  deployDashboard: z.ZodDefault<z.ZodBoolean>;
15
- runtime: z.ZodDefault<z.ZodNativeEnum<typeof import("../../types/TestTypes.js").RuntimeEnvironment>>;
15
+ runtime: z.ZodDefault<z.ZodEffects<z.ZodNativeEnum<typeof import("../../types/TestTypes.js").RuntimeEnvironment>, import("../../types/TestTypes.js").RuntimeEnvironment, unknown>>;
16
16
  dockerNetwork: z.ZodDefault<z.ZodString>;
17
17
  dockerWorkerPort: z.ZodDefault<z.ZodNumber>;
18
18
  k8sNamespace: z.ZodDefault<z.ZodString>;
@@ -4,29 +4,9 @@
4
4
  * / IDE MCP usage (no active run) and runs that never pre-seeded or
5
5
  * registered a plan are both unaffected (return null = allowed).
6
6
  */
7
- import * as path from "path";
8
- import { getActiveRunStatePath, StateManager } from "../../utils/AnalysisStateManager.js";
7
+ import { resolveRunStatePath, StateManager } from "../../utils/AnalysisStateManager.js";
9
8
  import { matchesApprovedPlan } from "../../utils/planMatchKeys.js";
10
9
  import { TOOL_REGISTER_TEST_PLAN } from "../../toolNames.js";
11
- /**
12
- * Resolve the active run's state file path. `getActiveRunStatePath()` is only
13
- * set by skyramp_analyze_changes for multi-repo runs (the ones carrying a
14
- * `repository` param — see AnalysisStateManager.ts). Single-repo Testbot runs
15
- * never set it, but their stateFile path is still deterministic in CI: the
16
- * StateManager constructor roots "analysis"-type state under
17
- * `$RUNNER_TEMP/skyramp/analyze-changes-state.json`. Falling back to that path
18
- * covers single-repo Testbot runs without requiring a new anchor mechanism;
19
- * standalone/IDE usage (no RUNNER_TEMP) still resolves to undefined.
20
- */
21
- function resolveGuardStatePath() {
22
- const anchored = getActiveRunStatePath();
23
- if (anchored)
24
- return anchored;
25
- if (process.env.RUNNER_TEMP) {
26
- return path.join(process.env.RUNNER_TEMP, "skyramp", "analyze-changes-state.json");
27
- }
28
- return undefined;
29
- }
30
10
  /** Extract the URL path from a generation tool's `endpointURL` param — used
31
11
  * for contract/direct-mode integration guard queries. Falls back to treating
32
12
  * the value as a bare path when it isn't a parseable absolute URL, and to
@@ -50,7 +30,7 @@ export function pathFromEndpointURL(endpointURL) {
50
30
  * any item in the approved plan's GENERATE list.
51
31
  */
52
32
  export async function guardScenarioApproved(query) {
53
- const statePath = resolveGuardStatePath();
33
+ const statePath = resolveRunStatePath();
54
34
  if (!statePath)
55
35
  return null;
56
36
  let stateData;
@@ -0,0 +1,25 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ /**
4
+ * skyramp_generate_enriched_integration_test
5
+ *
6
+ * Combines integration test generation (from a scenario file) and mock enrichment
7
+ * into a single atomic operation. Eliminates the need to call
8
+ * skyramp_integration_test_generation and skyramp_enrich_test_with_mocks separately.
9
+ */
10
+ export declare function registerGenerateEnrichedIntegrationTestTool(server: McpServer): void;
11
+ export declare function executeGenerateEnrichedIntegrationTest(params: {
12
+ scenarioFile: string;
13
+ mockFiles: string[];
14
+ scenarioName: string;
15
+ outputDir: string;
16
+ output?: string;
17
+ runtime?: string;
18
+ dockerNetwork?: string;
19
+ dockerWorkerPort?: number;
20
+ authHeader?: string;
21
+ authScheme?: string;
22
+ language?: string;
23
+ framework?: string;
24
+ traceComments?: string[];
25
+ }): Promise<CallToolResult>;