@skyramp/mcp 0.3.2-rc.pom-3 → 0.3.2

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 (289) hide show
  1. package/build/commands/commandLibrary.d.ts +1 -0
  2. package/build/commands/commandLibrary.js +19 -13
  3. package/build/commands/localDevTestChangesCommand.d.ts +15 -0
  4. package/build/commands/localDevTestChangesCommand.js +201 -0
  5. package/build/index.js +80 -6
  6. package/build/prompts/code-reuse.js +3 -0
  7. package/build/prompts/enhance-assertions/sharedAssertionRules.d.ts +1 -0
  8. package/build/prompts/enhance-assertions/sharedAssertionRules.js +17 -0
  9. package/build/prompts/initialize-workspace/initializeWorkspacePrompt.js +11 -9
  10. package/build/prompts/local-dev/local-dev-plan.d.ts +35 -0
  11. package/build/prompts/local-dev/local-dev-plan.js +429 -0
  12. package/build/prompts/local-dev/local-dev-prompts.d.ts +4 -0
  13. package/build/prompts/local-dev/local-dev-prompts.js +190 -0
  14. package/build/prompts/pom-aware-code-reuse.js +12 -0
  15. package/build/prompts/prompt-utils.d.ts +8 -0
  16. package/build/prompts/prompt-utils.js +33 -0
  17. package/build/prompts/sut-setup/modes/adaptWorkflowPrompt.js +37 -14
  18. package/build/prompts/sut-setup/shared.js +16 -12
  19. package/build/prompts/test-recommendation/analysisOutputPrompt.js +21 -29
  20. package/build/prompts/test-recommendation/scopeAssessment.d.ts +24 -7
  21. package/build/prompts/test-recommendation/scopeAssessment.js +111 -12
  22. package/build/prompts/test-recommendation/test-recommendation-prompt.js +41 -4
  23. package/build/prompts/testbot/testbot-prompts.d.ts +0 -5
  24. package/build/prompts/testbot/testbot-prompts.js +32 -52
  25. package/build/recommendation/planRanker.d.ts +15 -2
  26. package/build/recommendation/planRanker.js +76 -5
  27. package/build/resources/testbotResource.js +2 -1
  28. package/build/services/AnalyticsService.d.ts +1 -1
  29. package/build/services/TestExecutionService.d.ts +2 -1
  30. package/build/services/TestExecutionService.js +8 -3
  31. package/build/services/TestGenerationService.d.ts +2 -2
  32. package/build/services/TestGenerationService.js +39 -21
  33. package/build/services/containerEnv.js +3 -1
  34. package/build/tool-phases.js +6 -0
  35. package/build/tools/code-refactor/codeReuseTool.js +43 -4
  36. package/build/tools/code-refactor/enhanceAssertionsTool.js +68 -18
  37. package/build/tools/code-refactor/reuse-outcome.d.ts +109 -0
  38. package/build/tools/code-refactor/reuse-outcome.js +158 -0
  39. package/build/tools/code-refactor/reuse-state.d.ts +45 -0
  40. package/build/tools/code-refactor/reuse-state.js +140 -0
  41. package/build/tools/enrichTestWithMocksTool.d.ts +28 -0
  42. package/build/tools/enrichTestWithMocksTool.js +726 -0
  43. package/build/tools/executeSkyrampTestTool.d.ts +11 -0
  44. package/build/tools/executeSkyrampTestTool.js +62 -21
  45. package/build/tools/generate-tests/batchMockGenerationTool.d.ts +106 -0
  46. package/build/tools/generate-tests/batchMockGenerationTool.js +545 -0
  47. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +25 -23
  48. package/build/tools/generate-tests/generateContractRestTool.js +2 -2
  49. package/build/tools/generate-tests/generateE2ERestTool.d.ts +1 -1
  50. package/build/tools/generate-tests/generateE2ERestTool.js +1 -1
  51. package/build/tools/generate-tests/generateLoadRestTool.d.ts +1 -1
  52. package/build/tools/generate-tests/generateLoadRestTool.js +1 -1
  53. package/build/tools/generate-tests/generateMockRestTool.d.ts +179 -6
  54. package/build/tools/generate-tests/generateMockRestTool.js +391 -22
  55. package/build/tools/generate-tests/loadTestSchema.d.ts +1 -1
  56. package/build/tools/generate-tests/planGuard.js +2 -22
  57. package/build/tools/generateEnrichedIntegrationTestTool.d.ts +25 -0
  58. package/build/tools/generateEnrichedIntegrationTestTool.js +235 -0
  59. package/build/tools/localDevWorkerComposeTool.d.ts +24 -0
  60. package/build/tools/localDevWorkerComposeTool.js +264 -0
  61. package/build/tools/one-click/oneClickTool.d.ts +13 -0
  62. package/build/tools/one-click/oneClickTool.js +195 -24
  63. package/build/tools/preflightMockCheckTool.d.ts +2 -0
  64. package/build/tools/preflightMockCheckTool.js +96 -0
  65. package/build/tools/queryProxyMocksTool.d.ts +70 -0
  66. package/build/tools/queryProxyMocksTool.js +522 -0
  67. package/build/tools/runExistingTestsTool.d.ts +31 -0
  68. package/build/tools/runExistingTestsTool.js +214 -13
  69. package/build/tools/submitReportTool.js +38 -3
  70. package/build/tools/test-management/analyzeChangesTool.d.ts +2 -1
  71. package/build/tools/test-management/analyzeChangesTool.js +63 -40
  72. package/build/tools/test-management/registerTestPlanTool.js +55 -7
  73. package/build/tools/trace/startTraceCollectionTool.js +3 -3
  74. package/build/types/FrontendIntegration.d.ts +3 -0
  75. package/build/types/FrontendIntegration.js +3 -0
  76. package/build/types/OneClickCommands.d.ts +1 -1
  77. package/build/types/Recommendation.d.ts +20 -0
  78. package/build/types/Recommendation.js +32 -6
  79. package/build/types/RepositoryAnalysis.d.ts +131 -14
  80. package/build/types/RepositoryAnalysis.js +16 -2
  81. package/build/types/ReuseOutcome.d.ts +63 -0
  82. package/build/types/ReuseOutcome.js +33 -0
  83. package/build/types/TestExecution.d.ts +1 -0
  84. package/build/types/TestTypes.d.ts +25 -7
  85. package/build/types/TestTypes.js +22 -6
  86. package/build/types/TestbotReport.d.ts +7 -0
  87. package/build/types/index.d.ts +2 -0
  88. package/build/types/index.js +1 -0
  89. package/build/utils/AnalysisStateManager.d.ts +26 -0
  90. package/build/utils/AnalysisStateManager.js +31 -1
  91. package/build/utils/analyze-openapi.js +18 -1
  92. package/build/utils/branchDiff.d.ts +17 -1
  93. package/build/utils/branchDiff.js +99 -14
  94. package/build/utils/featureFlags.d.ts +31 -0
  95. package/build/utils/featureFlags.js +37 -0
  96. package/build/utils/frontendIntegration.js +8 -1
  97. package/build/utils/grpcMockValidation.d.ts +1 -0
  98. package/build/utils/grpcMockValidation.js +49 -0
  99. package/build/utils/httpMethodValidation.d.ts +4 -0
  100. package/build/utils/httpMethodValidation.js +15 -0
  101. package/build/utils/logger.js +1 -1
  102. package/build/utils/mockCompatibility.d.ts +49 -0
  103. package/build/utils/mockCompatibility.js +82 -0
  104. package/build/utils/pom-scope/pom-files.js +7 -0
  105. package/build/utils/pom-verify/bindings.js +11 -1
  106. package/build/utils/pom-verify/re-exports.d.ts +10 -0
  107. package/build/utils/pom-verify/re-exports.js +61 -0
  108. package/build/utils/pom-verify/resolve.d.ts +4 -1
  109. package/build/utils/pom-verify/resolve.js +7 -4
  110. package/build/utils/pom-verify/verify.d.ts +5 -0
  111. package/build/utils/pom-verify/verify.js +25 -3
  112. package/build/utils/progress.js +10 -5
  113. package/build/utils/proxy-terminal.js +3 -3
  114. package/build/utils/routeParsers.d.ts +3 -9
  115. package/build/utils/routeParsers.js +79 -4
  116. package/build/utils/utils.js +2 -2
  117. package/build/utils/versions.d.ts +4 -3
  118. package/build/utils/versions.js +3 -1
  119. package/build/utils/workspaceAuth.d.ts +46 -0
  120. package/build/utils/workspaceAuth.js +156 -1
  121. package/build/workspace/testSuites.d.ts +2 -1
  122. package/build/workspace/testSuites.js +1 -1
  123. package/build/workspace/workspace.d.ts +108 -32
  124. package/build/workspace/workspace.js +32 -4
  125. package/package.json +5 -2
  126. package/build/adapters/jestAdapter.test.d.ts +0 -1
  127. package/build/adapters/jestAdapter.test.js +0 -93
  128. package/build/adapters/mochaAdapter.test.d.ts +0 -1
  129. package/build/adapters/mochaAdapter.test.js +0 -63
  130. package/build/adapters/playwrightAdapter.test.d.ts +0 -1
  131. package/build/adapters/playwrightAdapter.test.js +0 -169
  132. package/build/adapters/pytestAdapter.test.d.ts +0 -1
  133. package/build/adapters/pytestAdapter.test.js +0 -90
  134. package/build/prompts/code-reuse.test.d.ts +0 -1
  135. package/build/prompts/code-reuse.test.js +0 -62
  136. package/build/prompts/pom-aware-code-reuse.test.d.ts +0 -1
  137. package/build/prompts/pom-aware-code-reuse.test.js +0 -11
  138. package/build/prompts/test-maintenance/drift-analysis-prompt.test.d.ts +0 -1
  139. package/build/prompts/test-maintenance/drift-analysis-prompt.test.js +0 -51
  140. package/build/prompts/test-recommendation/analysisOutputPrompt.test.d.ts +0 -1
  141. package/build/prompts/test-recommendation/analysisOutputPrompt.test.js +0 -264
  142. package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.d.ts +0 -1
  143. package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.js +0 -126
  144. package/build/prompts/test-recommendation/promptPlan.test.d.ts +0 -1
  145. package/build/prompts/test-recommendation/promptPlan.test.js +0 -336
  146. package/build/prompts/test-recommendation/scopeAssessment.test.d.ts +0 -1
  147. package/build/prompts/test-recommendation/scopeAssessment.test.js +0 -371
  148. package/build/prompts/test-recommendation/test-recommendation-prompt.test.d.ts +0 -1
  149. package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +0 -1925
  150. package/build/prompts/testbot/testbot-prompts.test.d.ts +0 -1
  151. package/build/prompts/testbot/testbot-prompts.test.js +0 -451
  152. package/build/recommendation/budgeters/diversityBalancedBudgeter.test.d.ts +0 -1
  153. package/build/recommendation/budgeters/diversityBalancedBudgeter.test.js +0 -138
  154. package/build/recommendation/budgeters/fixedNBudgeter.test.d.ts +0 -1
  155. package/build/recommendation/budgeters/fixedNBudgeter.test.js +0 -66
  156. package/build/recommendation/discriminators.test.d.ts +0 -1
  157. package/build/recommendation/discriminators.test.js +0 -324
  158. package/build/recommendation/diversity.test.d.ts +0 -1
  159. package/build/recommendation/diversity.test.js +0 -77
  160. package/build/recommendation/planRanker.test.d.ts +0 -1
  161. package/build/recommendation/planRanker.test.js +0 -110
  162. package/build/resources/testbotResource.test.d.ts +0 -1
  163. package/build/resources/testbotResource.test.js +0 -44
  164. package/build/services/AnalyticsService.test.d.ts +0 -1
  165. package/build/services/AnalyticsService.test.js +0 -86
  166. package/build/services/ScenarioGenerationService.integration.test.d.ts +0 -1
  167. package/build/services/ScenarioGenerationService.integration.test.js +0 -162
  168. package/build/services/ScenarioGenerationService.test.d.ts +0 -1
  169. package/build/services/ScenarioGenerationService.test.js +0 -414
  170. package/build/services/TestDiscoveryService.test.d.ts +0 -1
  171. package/build/services/TestDiscoveryService.test.js +0 -983
  172. package/build/services/TestExecutionService.test.d.ts +0 -1
  173. package/build/services/TestExecutionService.test.js +0 -1032
  174. package/build/services/TestGenerationService.test.d.ts +0 -1
  175. package/build/services/TestGenerationService.test.js +0 -578
  176. package/build/tool-phase-coverage.test.d.ts +0 -1
  177. package/build/tool-phase-coverage.test.js +0 -49
  178. package/build/tools/code-refactor/codeReuseTool.test.d.ts +0 -1
  179. package/build/tools/code-refactor/codeReuseTool.test.js +0 -572
  180. package/build/tools/generate-tests/generateBatchScenarioRestTool.test.d.ts +0 -1
  181. package/build/tools/generate-tests/generateBatchScenarioRestTool.test.js +0 -433
  182. package/build/tools/generate-tests/generateContractRestTool.test.d.ts +0 -1
  183. package/build/tools/generate-tests/generateContractRestTool.test.js +0 -142
  184. package/build/tools/generate-tests/generateIntegrationRestTool.test.d.ts +0 -1
  185. package/build/tools/generate-tests/generateIntegrationRestTool.test.js +0 -159
  186. package/build/tools/generate-tests/generateLoadRestTool.test.d.ts +0 -1
  187. package/build/tools/generate-tests/generateLoadRestTool.test.js +0 -169
  188. package/build/tools/generate-tests/generateUIRestTool.test.d.ts +0 -1
  189. package/build/tools/generate-tests/generateUIRestTool.test.js +0 -32
  190. package/build/tools/generate-tests/planGuard.test.d.ts +0 -1
  191. package/build/tools/generate-tests/planGuard.test.js +0 -185
  192. package/build/tools/generate-tests/scenarioLint.test.d.ts +0 -1
  193. package/build/tools/generate-tests/scenarioLint.test.js +0 -100
  194. package/build/tools/runExistingTestsTool.test.d.ts +0 -1
  195. package/build/tools/runExistingTestsTool.test.js +0 -379
  196. package/build/tools/submitReportTool.test.d.ts +0 -1
  197. package/build/tools/submitReportTool.test.js +0 -1428
  198. package/build/tools/test-management/actionsTool.test.d.ts +0 -1
  199. package/build/tools/test-management/actionsTool.test.js +0 -436
  200. package/build/tools/test-management/analyzeChangesTool.test.d.ts +0 -1
  201. package/build/tools/test-management/analyzeChangesTool.test.js +0 -522
  202. package/build/tools/test-management/analyzeTestHealthTool.test.d.ts +0 -1
  203. package/build/tools/test-management/analyzeTestHealthTool.test.js +0 -385
  204. package/build/tools/test-management/registerTestPlanTool.test.d.ts +0 -1
  205. package/build/tools/test-management/registerTestPlanTool.test.js +0 -296
  206. package/build/tools/trace/resolveSaveStoragePath.test.d.ts +0 -1
  207. package/build/tools/trace/resolveSaveStoragePath.test.js +0 -17
  208. package/build/tools/trace/resolveSessionPaths.test.d.ts +0 -1
  209. package/build/tools/trace/resolveSessionPaths.test.js +0 -104
  210. package/build/tools/trace/sessionState.test.d.ts +0 -1
  211. package/build/tools/trace/sessionState.test.js +0 -17
  212. package/build/tools/workspace/initializeWorkspaceTool.test.d.ts +0 -1
  213. package/build/tools/workspace/initializeWorkspaceTool.test.js +0 -139
  214. package/build/tools/workspace/serviceUpsert.test.d.ts +0 -1
  215. package/build/tools/workspace/serviceUpsert.test.js +0 -50
  216. package/build/utils/AnalysisStateManager.test.d.ts +0 -1
  217. package/build/utils/AnalysisStateManager.test.js +0 -134
  218. package/build/utils/dartRouteExtractor.test.d.ts +0 -1
  219. package/build/utils/dartRouteExtractor.test.js +0 -307
  220. package/build/utils/docker.test.d.ts +0 -1
  221. package/build/utils/docker.test.js +0 -114
  222. package/build/utils/featureFlags.test.d.ts +0 -1
  223. package/build/utils/featureFlags.test.js +0 -81
  224. package/build/utils/fileWalk.test.d.ts +0 -1
  225. package/build/utils/fileWalk.test.js +0 -252
  226. package/build/utils/frontendIntegration.test.d.ts +0 -1
  227. package/build/utils/frontendIntegration.test.js +0 -229
  228. package/build/utils/frontendSelectors.test.d.ts +0 -1
  229. package/build/utils/frontendSelectors.test.js +0 -118
  230. package/build/utils/gitStaging.test.d.ts +0 -1
  231. package/build/utils/gitStaging.test.js +0 -111
  232. package/build/utils/httpDefaults.test.d.ts +0 -1
  233. package/build/utils/httpDefaults.test.js +0 -21
  234. package/build/utils/importerHop.test.d.ts +0 -1
  235. package/build/utils/importerHop.test.js +0 -469
  236. package/build/utils/pathAffinityClassification.test.d.ts +0 -1
  237. package/build/utils/pathAffinityClassification.test.js +0 -208
  238. package/build/utils/planMatchKeys.test.d.ts +0 -1
  239. package/build/utils/planMatchKeys.test.js +0 -123
  240. package/build/utils/pom-scope/index.test.d.ts +0 -1
  241. package/build/utils/pom-scope/index.test.js +0 -278
  242. package/build/utils/pom-scope/pom-files.test.d.ts +0 -1
  243. package/build/utils/pom-scope/pom-files.test.js +0 -29
  244. package/build/utils/pom-scope/scoring.test.d.ts +0 -1
  245. package/build/utils/pom-scope/scoring.test.js +0 -39
  246. package/build/utils/pom-scope/selector-extractor.test.d.ts +0 -1
  247. package/build/utils/pom-scope/selector-extractor.test.js +0 -67
  248. package/build/utils/pom-verify/bindings.test.d.ts +0 -1
  249. package/build/utils/pom-verify/bindings.test.js +0 -164
  250. package/build/utils/pom-verify/calls.test.d.ts +0 -1
  251. package/build/utils/pom-verify/calls.test.js +0 -61
  252. package/build/utils/pom-verify/resolve.test.d.ts +0 -1
  253. package/build/utils/pom-verify/resolve.test.js +0 -114
  254. package/build/utils/pom-verify/verify.test.d.ts +0 -1
  255. package/build/utils/pom-verify/verify.test.js +0 -374
  256. package/build/utils/pr-comment-parser.test.d.ts +0 -1
  257. package/build/utils/pr-comment-parser.test.js +0 -428
  258. package/build/utils/progress.test.d.ts +0 -1
  259. package/build/utils/progress.test.js +0 -37
  260. package/build/utils/projectMetadata.test.d.ts +0 -1
  261. package/build/utils/projectMetadata.test.js +0 -172
  262. package/build/utils/pythonMountPrefixes.test.d.ts +0 -1
  263. package/build/utils/pythonMountPrefixes.test.js +0 -113
  264. package/build/utils/repoScanner.test.d.ts +0 -1
  265. package/build/utils/repoScanner.test.js +0 -190
  266. package/build/utils/reportVerification.test.d.ts +0 -1
  267. package/build/utils/reportVerification.test.js +0 -185
  268. package/build/utils/routeParsers.test.d.ts +0 -1
  269. package/build/utils/routeParsers.test.js +0 -1011
  270. package/build/utils/scenarioDrafting.test.d.ts +0 -1
  271. package/build/utils/scenarioDrafting.test.js +0 -876
  272. package/build/utils/sourceRouteExtractor.test.d.ts +0 -1
  273. package/build/utils/sourceRouteExtractor.test.js +0 -738
  274. package/build/utils/telemetry.test.d.ts +0 -1
  275. package/build/utils/telemetry.test.js +0 -70
  276. package/build/utils/trace-parser.test.d.ts +0 -6
  277. package/build/utils/trace-parser.test.js +0 -140
  278. package/build/utils/uiPageEnumerator.test.d.ts +0 -1
  279. package/build/utils/uiPageEnumerator.test.js +0 -824
  280. package/build/utils/utils.test.d.ts +0 -1
  281. package/build/utils/utils.test.js +0 -103
  282. package/build/utils/walkerCharacterization.test.d.ts +0 -1
  283. package/build/utils/walkerCharacterization.test.js +0 -233
  284. package/build/utils/workspaceAuth.test.d.ts +0 -1
  285. package/build/utils/workspaceAuth.test.js +0 -260
  286. package/build/workspace/testSuites.test.d.ts +0 -1
  287. package/build/workspace/testSuites.test.js +0 -23
  288. package/build/workspace/workspace.test.d.ts +0 -1
  289. package/build/workspace/workspace.test.js +0 -264
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The POM code-reuse shape carried in a TestbotReport — the wire contract between
3
+ * this server and the consumers that render it (test-bot.git).
4
+ *
5
+ * Lives in types/ rather than beside the derivation logic in
6
+ * tools/code-refactor/reuse-outcome.ts, and is re-exported from types/index.ts,
7
+ * so consumers have exactly one definition to import. The enums matter here as
8
+ * VALUES, not just types: a renderer validating an incoming `verification` or
9
+ * `declinedBy` needs the actual members to compare against, which a structurally
10
+ * inherited type cannot provide.
11
+ *
12
+ * The internal record that run state keeps between the verify pass and the report
13
+ * step (`ReuseRecord`) deliberately stays private to the derivation module — it is
14
+ * not part of this contract and must never reach a report.
15
+ */
16
+ /** Which gate declined a POM member. */
17
+ export declare enum ReuseDeclinedBy {
18
+ /** The mapping table never promoted it — no call was ever written. */
19
+ NotMapped = "not-mapped",
20
+ /** It was substituted, then verification rejected it and the raw form was
21
+ * restored. A `passed` verdict does NOT cover this: it counts only the calls
22
+ * that survived. */
23
+ DemotedByVerify = "demoted-by-verify"
24
+ }
25
+ /** Outcome of the reuse verification loop for a spec. */
26
+ export declare enum ReuseVerificationOutcome {
27
+ Passed = "passed",
28
+ Failed = "failed",
29
+ /** No page-object layer existed to reuse. */
30
+ SkippedNoPom = "skipped-no-pom"
31
+ }
32
+ /** A POM member the refactor did not reuse. Keyed on the member rather than the
33
+ * file: a class is routinely part-reused (a property substituted while a method
34
+ * from the same class is demoted), so a file-level list would show that file as
35
+ * reused and lose the decline. */
36
+ export interface ReuseSkippedEntry {
37
+ /** The POM file BASENAME the decline was attributed to — the name the agent
38
+ * wrote in its `// kept inline: <file basename> — <reason>` comment, which is
39
+ * what the decline is parsed out of. A class name appears only in `member`. */
40
+ pageObject: string;
41
+ /** `<binding>.<member>` as the verification report names it. Absent when the
42
+ * decline cannot be attributed to one member — a file with several declines
43
+ * gives no way to say which is which. */
44
+ member?: string;
45
+ declinedBy?: ReuseDeclinedBy;
46
+ reason: string;
47
+ }
48
+ /**
49
+ * What lands in a report's `reuse` field, for a UI test whose generation ran POM
50
+ * code reuse. Every member is optional: consumers must render from whatever
51
+ * subset is present, and omit the summary entirely when the object is absent (as
52
+ * it is for non-UI tests, and in reports from versions predating the field).
53
+ *
54
+ * `candidatesDetected` counts FILES while the call counts count CALLS — an
55
+ * indicator, never a fraction. Do not render the pair as a ratio or percentage.
56
+ */
57
+ export interface ReuseOutcome {
58
+ candidatesDetected?: number;
59
+ callsReused?: number;
60
+ callsVerified?: number;
61
+ verification?: ReuseVerificationOutcome;
62
+ skipped?: ReuseSkippedEntry[];
63
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The POM code-reuse shape carried in a TestbotReport — the wire contract between
3
+ * this server and the consumers that render it (test-bot.git).
4
+ *
5
+ * Lives in types/ rather than beside the derivation logic in
6
+ * tools/code-refactor/reuse-outcome.ts, and is re-exported from types/index.ts,
7
+ * so consumers have exactly one definition to import. The enums matter here as
8
+ * VALUES, not just types: a renderer validating an incoming `verification` or
9
+ * `declinedBy` needs the actual members to compare against, which a structurally
10
+ * inherited type cannot provide.
11
+ *
12
+ * The internal record that run state keeps between the verify pass and the report
13
+ * step (`ReuseRecord`) deliberately stays private to the derivation module — it is
14
+ * not part of this contract and must never reach a report.
15
+ */
16
+ /** Which gate declined a POM member. */
17
+ export var ReuseDeclinedBy;
18
+ (function (ReuseDeclinedBy) {
19
+ /** The mapping table never promoted it — no call was ever written. */
20
+ ReuseDeclinedBy["NotMapped"] = "not-mapped";
21
+ /** It was substituted, then verification rejected it and the raw form was
22
+ * restored. A `passed` verdict does NOT cover this: it counts only the calls
23
+ * that survived. */
24
+ ReuseDeclinedBy["DemotedByVerify"] = "demoted-by-verify";
25
+ })(ReuseDeclinedBy || (ReuseDeclinedBy = {}));
26
+ /** Outcome of the reuse verification loop for a spec. */
27
+ export var ReuseVerificationOutcome;
28
+ (function (ReuseVerificationOutcome) {
29
+ ReuseVerificationOutcome["Passed"] = "passed";
30
+ ReuseVerificationOutcome["Failed"] = "failed";
31
+ /** No page-object layer existed to reuse. */
32
+ ReuseVerificationOutcome["SkippedNoPom"] = "skipped-no-pom";
33
+ })(ReuseVerificationOutcome || (ReuseVerificationOutcome = {}));
@@ -44,6 +44,7 @@ export interface TestExecutionOptions {
44
44
  token?: string;
45
45
  timeout?: number;
46
46
  playwrightSaveStoragePath?: string;
47
+ dockerNetwork?: string;
47
48
  useHostNetwork?: boolean;
48
49
  }
49
50
  /**
@@ -15,10 +15,19 @@ export declare enum TestType {
15
15
  INTEGRATION = "integration",
16
16
  E2E = "e2e",
17
17
  UI = "ui",
18
- MOCK = "mock",
19
18
  UNIT = "unit",
20
19
  UNKNOWN = "unknown"
21
20
  }
21
+ /**
22
+ * Mock is not a test type — mock files are deployed via apply_mock(),
23
+ * not executed as tests. Kept as a standalone constant for mock generation.
24
+ */
25
+ export declare const MOCK_TYPE: "mock";
26
+ export declare enum MockProtocol {
27
+ Rest = "rest",
28
+ Grpc = "grpc",
29
+ Kafka = "kafka"
30
+ }
22
31
  export declare enum HttpMethod {
23
32
  GET = "GET",
24
33
  POST = "POST",
@@ -31,7 +40,16 @@ export declare enum HttpMethod {
31
40
  export declare enum RuntimeEnvironment {
32
41
  LOCAL = "local",
33
42
  DOCKER = "docker",
34
- KUBERNETES = "kubernetes"
43
+ KUBERNETES = "k8s"
44
+ }
45
+ export declare const runtimeEnvironmentSchema: z.ZodNativeEnum<typeof RuntimeEnvironment>;
46
+ export declare const runtimeEnvironmentInputSchema: z.ZodEffects<z.ZodNativeEnum<typeof RuntimeEnvironment>, RuntimeEnvironment, unknown>;
47
+ export declare function normalizeRuntimeEnvironment(value: RuntimeEnvironment | "kubernetes"): RuntimeEnvironment;
48
+ export interface TestConfig {
49
+ testType: TestType;
50
+ toolName: string;
51
+ description: string;
52
+ additionalFields?: Record<string, z.ZodSchema>;
35
53
  }
36
54
  export declare const languageSchema: z.ZodObject<{
37
55
  language: z.ZodNativeEnum<typeof ProgrammingLanguage>;
@@ -45,7 +63,7 @@ export declare const languageSchema: z.ZodObject<{
45
63
  }>;
46
64
  export declare const baseSchema: z.ZodObject<{
47
65
  deployDashboard: z.ZodDefault<z.ZodBoolean>;
48
- runtime: z.ZodDefault<z.ZodNativeEnum<typeof RuntimeEnvironment>>;
66
+ runtime: z.ZodDefault<z.ZodEffects<z.ZodNativeEnum<typeof RuntimeEnvironment>, RuntimeEnvironment, unknown>>;
49
67
  dockerNetwork: z.ZodDefault<z.ZodString>;
50
68
  dockerWorkerPort: z.ZodDefault<z.ZodNumber>;
51
69
  k8sNamespace: z.ZodDefault<z.ZodString>;
@@ -87,7 +105,7 @@ export declare const baseSchema: z.ZodObject<{
87
105
  outputDir: string;
88
106
  prompt: string;
89
107
  deployDashboard?: boolean | undefined;
90
- runtime?: RuntimeEnvironment | undefined;
108
+ runtime?: unknown;
91
109
  dockerNetwork?: string | undefined;
92
110
  dockerWorkerPort?: number | undefined;
93
111
  k8sNamespace?: string | undefined;
@@ -125,7 +143,7 @@ export declare const basePlaywrightSchema: z.ZodObject<{
125
143
  }>;
126
144
  export declare const baseTraceSchema: z.ZodObject<{
127
145
  deployDashboard: z.ZodDefault<z.ZodBoolean>;
128
- runtime: z.ZodDefault<z.ZodNativeEnum<typeof RuntimeEnvironment>>;
146
+ runtime: z.ZodDefault<z.ZodEffects<z.ZodNativeEnum<typeof RuntimeEnvironment>, RuntimeEnvironment, unknown>>;
129
147
  dockerNetwork: z.ZodDefault<z.ZodString>;
130
148
  dockerWorkerPort: z.ZodDefault<z.ZodNumber>;
131
149
  k8sNamespace: z.ZodDefault<z.ZodString>;
@@ -174,7 +192,7 @@ export declare const baseTraceSchema: z.ZodObject<{
174
192
  prompt: string;
175
193
  trace: string;
176
194
  deployDashboard?: boolean | undefined;
177
- runtime?: RuntimeEnvironment | undefined;
195
+ runtime?: unknown;
178
196
  dockerNetwork?: string | undefined;
179
197
  dockerWorkerPort?: number | undefined;
180
198
  k8sNamespace?: string | undefined;
@@ -192,7 +210,7 @@ export declare const baseTraceSchema: z.ZodObject<{
192
210
  }>;
193
211
  export declare const baseTestSchema: {
194
212
  deployDashboard: z.ZodDefault<z.ZodBoolean>;
195
- runtime: z.ZodDefault<z.ZodNativeEnum<typeof RuntimeEnvironment>>;
213
+ runtime: z.ZodDefault<z.ZodEffects<z.ZodNativeEnum<typeof RuntimeEnvironment>, RuntimeEnvironment, unknown>>;
196
214
  dockerNetwork: z.ZodDefault<z.ZodString>;
197
215
  dockerWorkerPort: z.ZodDefault<z.ZodNumber>;
198
216
  k8sNamespace: z.ZodDefault<z.ZodString>;
@@ -18,10 +18,20 @@ export var TestType;
18
18
  TestType["INTEGRATION"] = "integration";
19
19
  TestType["E2E"] = "e2e";
20
20
  TestType["UI"] = "ui";
21
- TestType["MOCK"] = "mock";
22
21
  TestType["UNIT"] = "unit";
23
22
  TestType["UNKNOWN"] = "unknown";
24
23
  })(TestType || (TestType = {}));
24
+ /**
25
+ * Mock is not a test type — mock files are deployed via apply_mock(),
26
+ * not executed as tests. Kept as a standalone constant for mock generation.
27
+ */
28
+ export const MOCK_TYPE = "mock";
29
+ export var MockProtocol;
30
+ (function (MockProtocol) {
31
+ MockProtocol["Rest"] = "rest";
32
+ MockProtocol["Grpc"] = "grpc";
33
+ MockProtocol["Kafka"] = "kafka";
34
+ })(MockProtocol || (MockProtocol = {}));
25
35
  export var HttpMethod;
26
36
  (function (HttpMethod) {
27
37
  HttpMethod["GET"] = "GET";
@@ -36,8 +46,13 @@ export var RuntimeEnvironment;
36
46
  (function (RuntimeEnvironment) {
37
47
  RuntimeEnvironment["LOCAL"] = "local";
38
48
  RuntimeEnvironment["DOCKER"] = "docker";
39
- RuntimeEnvironment["KUBERNETES"] = "kubernetes";
49
+ RuntimeEnvironment["KUBERNETES"] = "k8s";
40
50
  })(RuntimeEnvironment || (RuntimeEnvironment = {}));
51
+ export const runtimeEnvironmentSchema = z.nativeEnum(RuntimeEnvironment);
52
+ export const runtimeEnvironmentInputSchema = z.preprocess((value) => (value === "kubernetes" ? RuntimeEnvironment.KUBERNETES : value), runtimeEnvironmentSchema);
53
+ export function normalizeRuntimeEnvironment(value) {
54
+ return value === "kubernetes" ? RuntimeEnvironment.KUBERNETES : value;
55
+ }
41
56
  export const languageSchema = z.object({
42
57
  language: z
43
58
  .nativeEnum(ProgrammingLanguage)
@@ -53,10 +68,9 @@ export const baseSchema = z.object({
53
68
  .boolean()
54
69
  .default(false)
55
70
  .describe("Whether to deploy the Skyramp dashboard for test monitoring"),
56
- runtime: z
57
- .nativeEnum(RuntimeEnvironment)
71
+ runtime: runtimeEnvironmentInputSchema
58
72
  .default(RuntimeEnvironment.LOCAL)
59
- .describe("Runtime environment (docker, kubernetes, local)"),
73
+ .describe("Runtime environment (local, docker, or k8s; accepts kubernetes as an alias)"),
60
74
  dockerNetwork: z
61
75
  .string()
62
76
  .default("")
@@ -201,7 +215,9 @@ export const baseTestSchema = {
201
215
  queryParams: z
202
216
  .string()
203
217
  .default("")
204
- .describe("MUST be string of comma separated values like 'id=1,name=John' for URL query parameters"),
218
+ .describe("MUST be string of comma separated values like 'id=1,name=John' for URL query parameters. "
219
+ + "Workspace-configured api.defaultQueryParams (if set) are merged in automatically — "
220
+ + "no need to repeat them here. An explicit value for the same key here overrides the workspace default."),
205
221
  formParams: z
206
222
  .string()
207
223
  .default("")
@@ -1,6 +1,7 @@
1
1
  import type { DriftAction } from "./TestAnalysis.js";
2
2
  import type { TestExecutionStatus } from "./TestExecution.js";
3
3
  import type { HttpMethod, TestType } from "./TestTypes.js";
4
+ import type { ReuseOutcome } from "./ReuseOutcome.js";
4
5
  /**
5
6
  * Shape of the JSON report written by skyramp_submit_report and read by testbot
6
7
  * for rendering as Markdown. All fields mirror the corresponding Zod schemas in
@@ -18,6 +19,12 @@ export interface TestbotReport {
18
19
  scenarioFile?: string;
19
20
  traceFile?: string;
20
21
  frontendTrace?: string;
22
+ /** UI tests only: POM code-reuse outcome, present when skyramp_reuse_code ran
23
+ * for this test. Server-derived — imported from its source of truth rather
24
+ * than re-declared, since that module already exports a plain interface (the
25
+ * rest of this file mirrors Zod schemas by hand, which is why only this field
26
+ * is imported). Absent in reports from MCP versions predating it. */
27
+ reuse?: ReuseOutcome;
21
28
  }[];
22
29
  /** Omitted when no existing tests were found (agent omits the field). */
23
30
  testMaintenance?: {
@@ -2,3 +2,5 @@ export { TestExecutionStatus } from "./TestExecution.js";
2
2
  export { DriftAction } from "./TestAnalysis.js";
3
3
  export { TestType, HttpMethod } from "./TestTypes.js";
4
4
  export type { TestbotReport } from "./TestbotReport.js";
5
+ export { ReuseDeclinedBy, ReuseVerificationOutcome } from "./ReuseOutcome.js";
6
+ export type { ReuseOutcome, ReuseSkippedEntry } from "./ReuseOutcome.js";
@@ -1,3 +1,4 @@
1
1
  export { TestExecutionStatus } from "./TestExecution.js";
2
2
  export { DriftAction } from "./TestAnalysis.js";
3
3
  export { TestType, HttpMethod } from "./TestTypes.js";
4
+ export { ReuseDeclinedBy, ReuseVerificationOutcome } from "./ReuseOutcome.js";
@@ -1,3 +1,4 @@
1
+ import type { ReuseRecord } from "../tools/code-refactor/reuse-outcome.js";
1
2
  import { TestAnalysisResult, MaintenanceActionCore } from "../types/TestAnalysis.js";
2
3
  import { RepositoryAnalysis, AnalysisScope } from "../types/RepositoryAnalysis.js";
3
4
  import { PRTestContext } from "./pr-comment-parser.js";
@@ -9,10 +10,30 @@ import type { ExternalTestRunRecord } from "../types/ExternalTestExecution.js";
9
10
  export type { CandidateUiPage } from "./uiPageEnumerator.js";
10
11
  export declare function setTestsRepoDir(dir: string | undefined): void;
11
12
  export declare function getTestsRepoDir(): string | undefined;
13
+ /** Filename of the run-scoped analysis state file under `<RUNNER_TEMP>/skyramp/`.
14
+ * Single-sourced so the constructor that WRITES there and `resolveRunStatePath`
15
+ * which LOOKS there cannot drift apart. */
16
+ export declare const RUN_STATE_FILE_NAME = "analyze-changes-state.json";
12
17
  export declare function setActiveRunStatePath(stateFilePath: string): void;
13
18
  export declare function getActiveRunStatePath(): string | undefined;
14
19
  /** Reset the run anchor — for tests, and as a safety hook between runs. */
15
20
  export declare function clearActiveRunStatePath(): void;
21
+ /**
22
+ * The run's state-file path, for tools that need to read or amend it without the
23
+ * agent naming it.
24
+ *
25
+ * `setActiveRunStatePath` is only called by skyramp_analyze_changes on multi-repo
26
+ * runs (the ones carrying a `repository` param), but a single-repo Testbot run's
27
+ * path is still deterministic in CI: the StateManager constructor above roots
28
+ * "analysis" state under `$RUNNER_TEMP/skyramp/`. Falling back to that covers
29
+ * single-repo runs without a new anchor mechanism. Standalone/IDE usage has no
30
+ * RUNNER_TEMP and resolves to undefined — correct, since there is no run state.
31
+ *
32
+ * Lives here rather than in each caller so the convention has one home: this is
33
+ * the module that decides where the file goes, so it is the module that should
34
+ * decide where to look for it.
35
+ */
36
+ export declare function resolveRunStatePath(explicitPath?: string): string | undefined;
16
37
  export declare function registerSession(sessionId: string, stateFilePath: string): void;
17
38
  export declare function getSessionFilePath(sessionId: string): string | undefined;
18
39
  export declare function getRegisteredSessions(): ReadonlyMap<string, string>;
@@ -140,6 +161,11 @@ export interface UnifiedAnalysisState {
140
161
  * CONFIRMED failures from here instead of guessing. Absent until the tool runs.
141
162
  */
142
163
  externalTestResults?: ExternalTestRunRecord[];
164
+ /** POM code-reuse outcome per generated UI spec, keyed by test-file BASENAME
165
+ * (what `newTestsCreated[].fileName` carries). Written by skyramp_reuse_code,
166
+ * which computes every value in-process; skyramp_submit_report merges it into
167
+ * the report's `reuse` field. Never supplied by the LLM. */
168
+ reuseOutcomes?: Record<string, ReuseRecord>;
143
169
  }
144
170
  /**
145
171
  * State file metadata
@@ -35,6 +35,10 @@ export function getTestsRepoDir() {
35
35
  * Single-repo / standalone calls (no `repository`) never set or read this.
36
36
  */
37
37
  let _activeRunStatePath;
38
+ /** Filename of the run-scoped analysis state file under `<RUNNER_TEMP>/skyramp/`.
39
+ * Single-sourced so the constructor that WRITES there and `resolveRunStatePath`
40
+ * which LOOKS there cannot drift apart. */
41
+ export const RUN_STATE_FILE_NAME = "analyze-changes-state.json";
38
42
  export function setActiveRunStatePath(stateFilePath) {
39
43
  _activeRunStatePath = stateFilePath;
40
44
  }
@@ -45,6 +49,32 @@ export function getActiveRunStatePath() {
45
49
  export function clearActiveRunStatePath() {
46
50
  _activeRunStatePath = undefined;
47
51
  }
52
+ /**
53
+ * The run's state-file path, for tools that need to read or amend it without the
54
+ * agent naming it.
55
+ *
56
+ * `setActiveRunStatePath` is only called by skyramp_analyze_changes on multi-repo
57
+ * runs (the ones carrying a `repository` param), but a single-repo Testbot run's
58
+ * path is still deterministic in CI: the StateManager constructor above roots
59
+ * "analysis" state under `$RUNNER_TEMP/skyramp/`. Falling back to that covers
60
+ * single-repo runs without a new anchor mechanism. Standalone/IDE usage has no
61
+ * RUNNER_TEMP and resolves to undefined — correct, since there is no run state.
62
+ *
63
+ * Lives here rather than in each caller so the convention has one home: this is
64
+ * the module that decides where the file goes, so it is the module that should
65
+ * decide where to look for it.
66
+ */
67
+ export function resolveRunStatePath(explicitPath) {
68
+ if (explicitPath)
69
+ return explicitPath;
70
+ const anchored = getActiveRunStatePath();
71
+ if (anchored)
72
+ return anchored;
73
+ if (process.env.RUNNER_TEMP) {
74
+ return path.join(process.env.RUNNER_TEMP, "skyramp", RUN_STATE_FILE_NAME);
75
+ }
76
+ return undefined;
77
+ }
48
78
  /**
49
79
  * In-memory session store: sessionId → { data, storedAt }.
50
80
  * Eliminates the need for the LLM to read/write state files on disk.
@@ -149,7 +179,7 @@ export class StateManager {
149
179
  // (see getTestbotPrompt TODO). RUNNER_TEMP is GitHub Actions-specific; other CI systems
150
180
  // (Jenkins, GitLab, Buildkite) must set it explicitly. Once merged, path flows through
151
181
  // summaryOutputFile which is already testbot-controlled and CI-agnostic.
152
- this.stateFile = path.join(process.env.RUNNER_TEMP, "skyramp", "analyze-changes-state.json");
182
+ this.stateFile = path.join(process.env.RUNNER_TEMP, "skyramp", RUN_STATE_FILE_NAME);
153
183
  }
154
184
  else {
155
185
  const baseDir = stateDir || os.tmpdir();
@@ -1,5 +1,10 @@
1
1
  import { SkyrampClient } from "@skyramp/skyramp";
2
2
  import { IsValidKeyValueList } from "./utils.js";
3
+ import { logger } from "./logger.js";
4
+ function isOpenApiRuntimeFailure(error) {
5
+ const message = error instanceof Error ? error.message : String(error);
6
+ return /(?:ECONNREFUSED|ECONNRESET|ENOTFOUND|EAI_AGAIN|ETIMEDOUT|socket hang up|connection refused|unavailable|timed? out)/i.test(message);
7
+ }
3
8
  // Analyze OpenAPI to check for required path params
4
9
  export async function analyzeOpenAPIWithGivenEndpoint(apiSchemaInput, uriInput, pathParamsInput) {
5
10
  const client = new SkyrampClient();
@@ -7,7 +12,19 @@ export async function analyzeOpenAPIWithGivenEndpoint(apiSchemaInput, uriInput,
7
12
  apiSchema: apiSchemaInput,
8
13
  uri: uriInput,
9
14
  };
10
- const pathParamRequired = await client.analyzeOpenapi(analyzeOpenapiOptions);
15
+ let pathParamRequired;
16
+ try {
17
+ pathParamRequired = await client.analyzeOpenapi(analyzeOpenapiOptions);
18
+ }
19
+ catch (e) {
20
+ if (isOpenApiRuntimeFailure(e)) {
21
+ logger.warning("Skipping OpenAPI path-param validation because schema analysis is unavailable", {
22
+ error: e instanceof Error ? e.message : String(e),
23
+ });
24
+ return null;
25
+ }
26
+ throw e;
27
+ }
11
28
  if (IsValidKeyValueList(pathParamRequired)) {
12
29
  const requiredPathParams = pathParamRequired
13
30
  ? pathParamRequired.split(",").map((p) => p.trim())
@@ -15,4 +15,20 @@ export interface BranchDiffData {
15
15
  * Always uses the `b/` form so renames return the new path.
16
16
  */
17
17
  export declare function parseChangedFilesFromDiff(rawDiff: string): string[];
18
- export declare function computeBranchDiff(repositoryPath: string, providedBaseBranch?: string): Promise<BranchDiffData>;
18
+ /**
19
+ * Normalize and validate a caller-provided base branch/ref before passing it
20
+ * to git. Reject option-like or ambiguous values so the ref is always treated
21
+ * as a revision name, not as a command-line flag.
22
+ */
23
+ export declare function normalizeProvidedBaseRef(providedBaseBranch?: string): string | undefined;
24
+ /**
25
+ * Compute the diff between a base reference and the current state.
26
+ *
27
+ * @param repositoryPath Absolute path to the git repository.
28
+ * @param providedBaseBranch A branch name, tag, or commit SHA to diff against.
29
+ * When omitted, the remote default branch is auto-detected.
30
+ * @param includeUncommitted When true, diffs against the working tree so
31
+ * uncommitted/unstaged changes are included. Defaults to false (CI mode
32
+ * that only considers committed changes via the three-dot form).
33
+ */
34
+ export declare function computeBranchDiff(repositoryPath: string, providedBaseBranch?: string, includeUncommitted?: boolean): Promise<BranchDiffData>;
@@ -14,6 +14,9 @@ export function parseChangedFilesFromDiff(rawDiff) {
14
14
  return out;
15
15
  }
16
16
  /** Parse diff headers to find newly created and deleted files. */
17
+ function isShaLikeRef(ref) {
18
+ return /^[0-9a-f]{7,40}$/i.test(ref);
19
+ }
17
20
  function parseNewAndDeletedFiles(rawDiff) {
18
21
  const newFiles = [];
19
22
  const deletedFiles = [];
@@ -34,24 +37,87 @@ function parseNewAndDeletedFiles(rawDiff) {
34
37
  }
35
38
  return { newFiles, deletedFiles };
36
39
  }
37
- async function tryDiff(git, ref) {
40
+ /**
41
+ * Normalize and validate a caller-provided base branch/ref before passing it
42
+ * to git. Reject option-like or ambiguous values so the ref is always treated
43
+ * as a revision name, not as a command-line flag.
44
+ */
45
+ export function normalizeProvidedBaseRef(providedBaseBranch) {
46
+ if (providedBaseBranch === undefined)
47
+ return undefined;
48
+ const trimmed = providedBaseBranch.trim();
49
+ if (!trimmed)
50
+ return undefined;
51
+ if (trimmed.startsWith("-")) {
52
+ throw new Error(`Invalid base branch/ref "${providedBaseBranch}": refs must not start with '-'.`);
53
+ }
54
+ if (/\s/.test(trimmed) || trimmed.includes("\0")) {
55
+ throw new Error(`Invalid base branch/ref "${providedBaseBranch}": refs must not contain whitespace or NUL characters.`);
56
+ }
57
+ if (trimmed.includes("..")) {
58
+ throw new Error(`Invalid base branch/ref "${providedBaseBranch}": range syntax (".."/""..."") is not allowed — provide a single ref.`);
59
+ }
60
+ return trimmed;
61
+ }
62
+ async function tryDiff(git, ref, includeUncommitted = false) {
38
63
  try {
39
- const changedFilesRaw = await git.diff([`${ref}...HEAD`, "--name-only"]);
64
+ // When includeUncommitted is true, diff the ref directly against the
65
+ // working tree so uncommitted/unstaged local changes are captured.
66
+ const diffRange = includeUncommitted ? ref : `${ref}...HEAD`;
67
+ const changedFilesRaw = await git.diff([diffRange, "--name-only"]);
40
68
  const changedFiles = changedFilesRaw
41
69
  .split("\n")
42
70
  .map((f) => f.trim())
43
71
  .filter((f) => f.length > 0);
44
- const diffStat = await git.diff([`${ref}...HEAD`, "--stat"]);
45
- const fullDiff = await git.diff([`${ref}...HEAD`]);
72
+ const diffStat = await git.diff([diffRange, "--stat"]);
73
+ const fullDiff = await git.diff([diffRange]);
46
74
  const { newFiles, deletedFiles } = parseNewAndDeletedFiles(fullDiff);
47
- return { changedFiles, diffContent: fullDiff, diffStat, newFiles, deletedFiles };
75
+ // git diff does not include untracked files. Include them as both changed
76
+ // and new so endpoint classification treats newly created local files as new.
77
+ if (includeUncommitted) {
78
+ const statusResult = await git.status();
79
+ const untrackedFiles = statusResult.not_added ?? [];
80
+ if (untrackedFiles.length > 0) {
81
+ const changedSet = new Set(changedFiles);
82
+ const newSet = new Set(newFiles);
83
+ for (const file of untrackedFiles) {
84
+ if (!changedSet.has(file)) {
85
+ changedFiles.push(file);
86
+ changedSet.add(file);
87
+ }
88
+ if (!newSet.has(file)) {
89
+ newFiles.push(file);
90
+ newSet.add(file);
91
+ }
92
+ }
93
+ }
94
+ }
95
+ return {
96
+ changedFiles,
97
+ diffContent: fullDiff,
98
+ diffStat,
99
+ newFiles,
100
+ deletedFiles,
101
+ };
48
102
  }
49
103
  catch (err) {
50
- logger.debug(`tryDiff against ${ref} failed`, { error: err instanceof Error ? err.message : String(err) });
104
+ logger.debug(`tryDiff against ${ref} failed`, {
105
+ error: err instanceof Error ? err.message : String(err),
106
+ });
51
107
  return undefined;
52
108
  }
53
109
  }
54
- export async function computeBranchDiff(repositoryPath, providedBaseBranch) {
110
+ /**
111
+ * Compute the diff between a base reference and the current state.
112
+ *
113
+ * @param repositoryPath Absolute path to the git repository.
114
+ * @param providedBaseBranch A branch name, tag, or commit SHA to diff against.
115
+ * When omitted, the remote default branch is auto-detected.
116
+ * @param includeUncommitted When true, diffs against the working tree so
117
+ * uncommitted/unstaged changes are included. Defaults to false (CI mode
118
+ * that only considers committed changes via the three-dot form).
119
+ */
120
+ export async function computeBranchDiff(repositoryPath, providedBaseBranch, includeUncommitted = false) {
55
121
  const git = simpleGit(repositoryPath);
56
122
  const isRepo = await git.checkIsRepo();
57
123
  if (!isRepo) {
@@ -60,14 +126,32 @@ export async function computeBranchDiff(repositoryPath, providedBaseBranch) {
60
126
  const branchInfo = await git.branch();
61
127
  const currentBranch = branchInfo.current || "HEAD";
62
128
  // Build candidate base refs in priority order:
63
- // 1. Provided branch name (most specific)
64
- // 2. Remote default branch auto-detected from available remotes
65
- // 3. FETCH_HEAD — present in base_commit repos (git fetch --depth 1 origin <sha>)
129
+ // 1. Provided value used directly (supports SHAs, local branches, tags)
130
+ // 2. Provided value with origin/ prefix (remote branch)
131
+ // 3. Remote default branch auto-detected from available remotes
132
+ // 4. FETCH_HEAD — present in base_commit repos (git fetch --depth 1 origin <sha>)
66
133
  // where no remote tracking branch is created
67
- // 4. HEAD~1 — last resort for repos with no remote at all
134
+ // 5. HEAD~1 — last resort for repos with no remote at all
68
135
  const candidates = [];
69
- if (providedBaseBranch) {
70
- candidates.push(`origin/${providedBaseBranch}`);
136
+ const normalizedBaseBranch = normalizeProvidedBaseRef(providedBaseBranch);
137
+ if (normalizedBaseBranch) {
138
+ const isRemoteQualified = normalizedBaseBranch.startsWith("origin/");
139
+ const looksLikeSimpleBranch = !isRemoteQualified &&
140
+ !isShaLikeRef(normalizedBaseBranch) &&
141
+ !/[~^:@]/.test(normalizedBaseBranch);
142
+ if (includeUncommitted && looksLikeSimpleBranch) {
143
+ // Local-dev diffs should prefer the remote base branch when available;
144
+ // a developer's local main may be ahead of origin/main.
145
+ candidates.push(`origin/${normalizedBaseBranch}`);
146
+ candidates.push(normalizedBaseBranch);
147
+ }
148
+ else {
149
+ // Try the raw value first — handles commit SHAs, tags, and explicit local refs.
150
+ candidates.push(normalizedBaseBranch);
151
+ if (!isRemoteQualified) {
152
+ candidates.push(`origin/${normalizedBaseBranch}`);
153
+ }
154
+ }
71
155
  }
72
156
  // Auto-detect remote default branch
73
157
  try {
@@ -89,12 +173,13 @@ export async function computeBranchDiff(repositoryPath, providedBaseBranch) {
89
173
  // Final fallback
90
174
  candidates.push("HEAD~1");
91
175
  for (const ref of candidates) {
92
- const result = await tryDiff(git, ref);
176
+ const result = await tryDiff(git, ref, includeUncommitted);
93
177
  if (result) {
94
178
  logger.info("Branch diff computed", {
95
179
  currentBranch,
96
180
  baseBranch: ref,
97
181
  changedFiles: result.changedFiles.length,
182
+ includeUncommitted,
98
183
  });
99
184
  return { currentBranch, baseBranch: ref, ...result };
100
185
  }
@@ -35,3 +35,34 @@ export declare function isContractConsumerModeEnabled(): boolean;
35
35
  * (SKYRAMP_FEATURE_TESTBOT=1).
36
36
  */
37
37
  export declare function isTestbotEnabled(): boolean;
38
+ /**
39
+ * Returns true when the local-dev workflow is enabled
40
+ * (SKYRAMP_FEATURE_LOCAL_DEV=1).
41
+ *
42
+ * The local-dev workflow registers the `skyramp_local_dev` prompt and
43
+ * one-click routing, which diffs from a base commit against the current
44
+ * working state, generates mock configurations and backend tests, executes
45
+ * them locally, and reports results — without requiring a pull request or
46
+ * CI environment.
47
+ */
48
+ export declare function isLocalDevEnabled(): boolean;
49
+ /**
50
+ * Returns true when general one-click workflows are enabled
51
+ * (SKYRAMP_FEATURE_ONE_CLICK=1).
52
+ */
53
+ export declare function isOneClickEnabled(): boolean;
54
+ /**
55
+ * Gates the POM-aware path of `skyramp_reuse_code`
56
+ * (SKYRAMP_FEATURE_POM_REUSE=1).
57
+ *
58
+ * When OFF (default), TypeScript/JavaScript + Playwright targets are treated
59
+ * like every other target: `skyramp_reuse_code` returns the SkyrampUtils
60
+ * consolidation prompt, and none of the POM machinery runs — no deterministic
61
+ * POM pre-scoping, no POM catalog / mapping-table workflow, no `verify: true`
62
+ * compliance gates, and consequently no `reuse` summary on the report (nothing
63
+ * records an outcome to re-derive).
64
+ *
65
+ * When ON, the test is refactored against the repo's existing page objects and
66
+ * the verification gates apply.
67
+ */
68
+ export declare function isPomReuseEnabled(): boolean;