@empiricalrun/test-gen 0.73.1 → 0.74.0

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 (313) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/actions/utils/index.d.ts.map +1 -1
  3. package/dist/actions/utils/index.js +1 -2
  4. package/dist/agent/browsing/index.d.ts.map +1 -1
  5. package/dist/agent/browsing/index.js +9 -7
  6. package/dist/agent/browsing/utils.d.ts.map +1 -1
  7. package/dist/agent/browsing/utils.js +3 -4
  8. package/dist/agent/chat/agent-loop.d.ts +7 -8
  9. package/dist/agent/chat/agent-loop.d.ts.map +1 -1
  10. package/dist/agent/chat/agent-loop.js +13 -17
  11. package/dist/agent/chat/exports.d.ts +5 -4
  12. package/dist/agent/chat/exports.d.ts.map +1 -1
  13. package/dist/agent/chat/exports.js +9 -4
  14. package/dist/agent/chat/filesystem-cache.d.ts +12 -0
  15. package/dist/agent/chat/filesystem-cache.d.ts.map +1 -0
  16. package/dist/agent/chat/filesystem-cache.js +101 -0
  17. package/dist/agent/chat/index.d.ts +4 -1
  18. package/dist/agent/chat/index.d.ts.map +1 -1
  19. package/dist/agent/chat/index.js +44 -22
  20. package/dist/agent/chat/models.d.ts +2 -1
  21. package/dist/agent/chat/models.d.ts.map +1 -1
  22. package/dist/agent/chat/models.js +25 -3
  23. package/dist/agent/chat/prompt/index.d.ts +3 -1
  24. package/dist/agent/chat/prompt/index.d.ts.map +1 -1
  25. package/dist/agent/chat/prompt/index.js +77 -2
  26. package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
  27. package/dist/agent/chat/prompt/repo.js +1 -0
  28. package/dist/agent/chat/state.d.ts +6 -5
  29. package/dist/agent/chat/state.d.ts.map +1 -1
  30. package/dist/agent/chat/state.js +35 -5
  31. package/dist/agent/chat/utils.d.ts +1 -0
  32. package/dist/agent/chat/utils.d.ts.map +1 -1
  33. package/dist/agent/chat/utils.js +16 -3
  34. package/dist/agent/cua/index.js +1 -1
  35. package/dist/agent/cua/model.js +1 -1
  36. package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
  37. package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -1
  38. package/dist/agent/master/browser-tests/fixtures.d.ts.map +1 -1
  39. package/dist/agent/master/browser-tests/fixtures.js +0 -1
  40. package/dist/agent/master/element-annotation.d.ts.map +1 -1
  41. package/dist/agent/master/element-annotation.js +1 -2
  42. package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
  43. package/dist/agent/master/execute-browser-action.js +8 -6
  44. package/dist/agent/master/icon-descriptor/index.js +2 -2
  45. package/dist/agent/master/next-action.js +1 -1
  46. package/dist/agent/master/planner.js +1 -1
  47. package/dist/agent/master/scroller.js +2 -2
  48. package/dist/agent/master/with-hints.d.ts.map +1 -1
  49. package/dist/agent/master/with-hints.js +6 -5
  50. package/dist/agent/planner/run-time-planner.js +1 -1
  51. package/dist/agent/planner/run.d.ts.map +1 -1
  52. package/dist/agent/planner/run.js +4 -2
  53. package/dist/auth/cli-auth.js +1 -1
  54. package/dist/auth/token-store.d.ts.map +1 -1
  55. package/dist/auth/token-store.js +4 -6
  56. package/dist/bin/index.js +30 -163
  57. package/dist/bin/utils/context.js +1 -1
  58. package/dist/bin/utils/index.d.ts +0 -12
  59. package/dist/bin/utils/index.d.ts.map +1 -1
  60. package/dist/bin/utils/index.js +0 -70
  61. package/dist/bin/utils/platform/web/index.d.ts +2 -2
  62. package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
  63. package/dist/bin/utils/platform/web/index.js +7 -5
  64. package/dist/bin/utils/scenarios/index.d.ts +11 -3
  65. package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
  66. package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -5
  67. package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -5
  68. package/dist/dashboard/client.d.ts +2 -2
  69. package/dist/dashboard/client.d.ts.map +1 -1
  70. package/dist/dashboard/client.js +4 -1
  71. package/dist/file-info/adapters/file-system/index.d.ts +9 -0
  72. package/dist/file-info/adapters/file-system/index.d.ts.map +1 -0
  73. package/dist/file-info/adapters/file-system/index.js +25 -0
  74. package/dist/file-info/adapters/file-system/reader.d.ts +6 -0
  75. package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -0
  76. package/dist/file-info/{file-system.js → adapters/file-system/reader.js} +16 -0
  77. package/dist/file-info/adapters/github/index.d.ts +11 -0
  78. package/dist/file-info/adapters/github/index.d.ts.map +1 -0
  79. package/dist/file-info/adapters/github/index.js +29 -0
  80. package/dist/file-info/adapters/github/reader.d.ts +16 -0
  81. package/dist/file-info/adapters/github/reader.d.ts.map +1 -0
  82. package/dist/file-info/adapters/github/reader.js +185 -0
  83. package/dist/file-info/index.d.ts +4 -0
  84. package/dist/file-info/index.d.ts.map +1 -0
  85. package/dist/file-info/index.js +10 -0
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +6 -1
  89. package/dist/recorder/index.d.ts +7 -3
  90. package/dist/recorder/index.d.ts.map +1 -1
  91. package/dist/recorder/index.js +181 -64
  92. package/dist/recorder/temp-files.d.ts +1 -1
  93. package/dist/recorder/temp-files.d.ts.map +1 -1
  94. package/dist/recorder/temp-files.js +2 -2
  95. package/dist/recorder/upload.d.ts +1 -1
  96. package/dist/recorder/upload.d.ts.map +1 -1
  97. package/dist/recorder/upload.js +3 -3
  98. package/dist/tools/{commit-and-create-pr.d.ts → commit-and-create-pr/index.d.ts} +1 -1
  99. package/dist/tools/commit-and-create-pr/index.d.ts.map +1 -0
  100. package/dist/tools/{commit-and-create-pr.js → commit-and-create-pr/index.js} +8 -28
  101. package/dist/tools/definitions/commit-and-create-pr.d.ts +3 -0
  102. package/dist/tools/definitions/commit-and-create-pr.d.ts.map +1 -0
  103. package/dist/tools/definitions/commit-and-create-pr.js +31 -0
  104. package/dist/tools/definitions/delete-file.d.ts +3 -0
  105. package/dist/tools/definitions/delete-file.d.ts.map +1 -0
  106. package/dist/tools/definitions/delete-file.js +20 -0
  107. package/dist/tools/{download-build.d.ts → definitions/download-build.d.ts} +2 -2
  108. package/dist/tools/definitions/download-build.d.ts.map +1 -0
  109. package/dist/tools/definitions/download-build.js +18 -0
  110. package/dist/tools/definitions/fetch-video-analysis.d.ts +11 -0
  111. package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -0
  112. package/dist/tools/definitions/fetch-video-analysis.js +26 -0
  113. package/dist/tools/definitions/grep.d.ts +3 -0
  114. package/dist/tools/definitions/grep.d.ts.map +1 -0
  115. package/dist/tools/definitions/grep.js +29 -0
  116. package/dist/tools/definitions/merge-conflicts.d.ts +3 -0
  117. package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -0
  118. package/dist/tools/definitions/merge-conflicts.js +24 -0
  119. package/dist/tools/definitions/run-test.d.ts +2 -2
  120. package/dist/tools/definitions/run-test.d.ts.map +1 -1
  121. package/dist/tools/definitions/run-test.js +4 -7
  122. package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
  123. package/dist/tools/definitions/str_replace_editor.js +9 -5
  124. package/dist/tools/definitions/test-gen-browser.d.ts +5 -5
  125. package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
  126. package/dist/tools/definitions/test-gen-browser.js +4 -7
  127. package/dist/tools/definitions/upgrade-packages.d.ts +36 -0
  128. package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -0
  129. package/dist/tools/definitions/upgrade-packages.js +21 -0
  130. package/dist/tools/definitions/utils.d.ts +15 -0
  131. package/dist/tools/definitions/utils.d.ts.map +1 -0
  132. package/dist/tools/definitions/utils.js +16 -0
  133. package/dist/tools/{delete-file.d.ts → delete-file/index.d.ts} +1 -1
  134. package/dist/tools/delete-file/index.d.ts.map +1 -0
  135. package/dist/tools/{delete-file.js → delete-file/index.js} +4 -16
  136. package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
  137. package/dist/tools/diagnosis-fetcher.js +13 -11
  138. package/dist/tools/download-build/index.d.ts +3 -0
  139. package/dist/tools/download-build/index.d.ts.map +1 -0
  140. package/dist/tools/{download-build.js → download-build/index.js} +4 -14
  141. package/dist/tools/executor/index.d.ts.map +1 -1
  142. package/dist/tools/executor/index.js +19 -4
  143. package/dist/tools/executor/utils/git.js +1 -1
  144. package/dist/tools/executor/utils/pr-description.d.ts +1 -1
  145. package/dist/tools/executor/utils/pr-description.d.ts.map +1 -1
  146. package/dist/tools/fetch-image/index.d.ts +10 -1
  147. package/dist/tools/fetch-image/index.d.ts.map +1 -1
  148. package/dist/tools/fetch-image/index.js +1 -0
  149. package/dist/tools/fetch-last-successful-test-run/index.d.ts +3 -0
  150. package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +1 -0
  151. package/dist/tools/fetch-last-successful-test-run/index.js +60 -0
  152. package/dist/tools/fetch-video-analysis/index.d.ts +5 -0
  153. package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -0
  154. package/dist/tools/fetch-video-analysis/index.js +89 -0
  155. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +24 -0
  156. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -0
  157. package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +209 -0
  158. package/dist/tools/fetch-video-analysis/utils.d.ts +10 -0
  159. package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -0
  160. package/dist/tools/fetch-video-analysis/utils.js +72 -0
  161. package/dist/tools/fetch-video-analysis/video-analysis.d.ts +7 -0
  162. package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -0
  163. package/dist/tools/fetch-video-analysis/video-analysis.js +54 -0
  164. package/dist/tools/file-operations/create.d.ts +11 -0
  165. package/dist/tools/file-operations/create.d.ts.map +1 -0
  166. package/dist/tools/file-operations/create.js +60 -0
  167. package/dist/tools/file-operations/index.d.ts +15 -0
  168. package/dist/tools/file-operations/index.d.ts.map +1 -0
  169. package/dist/tools/file-operations/index.js +143 -0
  170. package/dist/tools/file-operations/insert.d.ts +11 -0
  171. package/dist/tools/file-operations/insert.d.ts.map +1 -0
  172. package/dist/tools/file-operations/insert.js +61 -0
  173. package/dist/tools/file-operations/replace.d.ts +11 -0
  174. package/dist/tools/file-operations/replace.d.ts.map +1 -0
  175. package/dist/tools/file-operations/replace.js +80 -0
  176. package/dist/tools/file-operations/shared/git-helper.d.ts +4 -0
  177. package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -0
  178. package/dist/tools/file-operations/shared/git-helper.js +29 -0
  179. package/dist/tools/file-operations/shared/helpers.d.ts +19 -0
  180. package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -0
  181. package/dist/tools/file-operations/shared/helpers.js +133 -0
  182. package/dist/tools/file-operations/view/index.d.ts +14 -0
  183. package/dist/tools/file-operations/view/index.d.ts.map +1 -0
  184. package/dist/tools/file-operations/view/index.js +56 -0
  185. package/dist/tools/grep/index.d.ts.map +1 -1
  186. package/dist/tools/grep/index.js +2 -9
  187. package/dist/tools/grep/ripgrep/index.d.ts +2 -2
  188. package/dist/tools/grep/ripgrep/index.d.ts.map +1 -1
  189. package/dist/tools/grep/ripgrep/index.js +3 -3
  190. package/dist/tools/grep/types.d.ts.map +1 -0
  191. package/dist/tools/index.d.ts +7 -2
  192. package/dist/tools/index.d.ts.map +1 -1
  193. package/dist/tools/index.js +66 -22
  194. package/dist/tools/issues/create-issue.d.ts +3 -0
  195. package/dist/tools/issues/create-issue.d.ts.map +1 -0
  196. package/dist/tools/issues/create-issue.js +76 -0
  197. package/dist/tools/issues/index.d.ts +4 -0
  198. package/dist/tools/issues/index.d.ts.map +1 -0
  199. package/dist/tools/issues/index.js +9 -0
  200. package/dist/tools/issues/list-issues.d.ts +3 -0
  201. package/dist/tools/issues/list-issues.d.ts.map +1 -0
  202. package/dist/tools/issues/list-issues.js +32 -0
  203. package/dist/tools/issues/metadata-schema.d.ts +24 -0
  204. package/dist/tools/issues/metadata-schema.d.ts.map +1 -0
  205. package/dist/tools/issues/metadata-schema.js +22 -0
  206. package/dist/tools/issues/update-issue.d.ts +3 -0
  207. package/dist/tools/issues/update-issue.d.ts.map +1 -0
  208. package/dist/tools/issues/update-issue.js +75 -0
  209. package/dist/tools/issues/utils.d.ts +5 -0
  210. package/dist/tools/issues/utils.d.ts.map +1 -0
  211. package/dist/tools/issues/utils.js +26 -0
  212. package/dist/tools/list-environments.d.ts.map +1 -1
  213. package/dist/tools/list-environments.js +4 -0
  214. package/dist/tools/{merge-conflicts.d.ts → merge-conflicts/index.d.ts} +1 -1
  215. package/dist/tools/merge-conflicts/index.d.ts.map +1 -0
  216. package/dist/tools/{merge-conflicts.js → merge-conflicts/index.js} +3 -19
  217. package/dist/tools/test-gen-browser.js +4 -4
  218. package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
  219. package/dist/tools/test-run-fetcher/index.js +4 -0
  220. package/dist/tools/trace-dot-zip/index.d.ts +3 -0
  221. package/dist/tools/trace-dot-zip/index.d.ts.map +1 -0
  222. package/dist/tools/trace-dot-zip/index.js +48 -0
  223. package/dist/tools/trace-dot-zip/types.d.ts +86 -0
  224. package/dist/tools/trace-dot-zip/types.d.ts.map +1 -0
  225. package/dist/tools/trace-dot-zip/types.js +2 -0
  226. package/dist/tools/trace-dot-zip/utils/console-trace.d.ts +7 -0
  227. package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -0
  228. package/dist/tools/trace-dot-zip/utils/console-trace.js +34 -0
  229. package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +21 -0
  230. package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -0
  231. package/dist/tools/trace-dot-zip/utils/extract-zip.js +174 -0
  232. package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +21 -0
  233. package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -0
  234. package/dist/tools/trace-dot-zip/utils/network-trace.js +189 -0
  235. package/dist/tools/triage-summary/index.d.ts +3 -0
  236. package/dist/tools/triage-summary/index.d.ts.map +1 -0
  237. package/dist/tools/triage-summary/index.js +51 -0
  238. package/dist/tools/triage-summary/types.d.ts +5 -0
  239. package/dist/tools/triage-summary/types.d.ts.map +1 -0
  240. package/dist/tools/triage-summary/types.js +2 -0
  241. package/dist/tools/triage-summary/utils.d.ts +4 -0
  242. package/dist/tools/triage-summary/utils.d.ts.map +1 -0
  243. package/dist/tools/triage-summary/utils.js +16 -0
  244. package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
  245. package/dist/tools/upgrade-packages/index.js +5 -15
  246. package/dist/tools/view-failed-test-run-report/index.d.ts +12 -0
  247. package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -0
  248. package/dist/tools/view-failed-test-run-report/index.js +163 -0
  249. package/dist/trace-utils/index.d.ts +4 -0
  250. package/dist/trace-utils/index.d.ts.map +1 -0
  251. package/dist/trace-utils/index.js +10 -0
  252. package/dist/utils/dedup-image-fs.d.ts +27 -0
  253. package/dist/utils/dedup-image-fs.d.ts.map +1 -0
  254. package/dist/utils/dedup-image-fs.js +88 -0
  255. package/dist/utils/dedup-image.d.ts +25 -0
  256. package/dist/utils/dedup-image.d.ts.map +1 -0
  257. package/dist/utils/dedup-image.js +80 -0
  258. package/dist/utils/env.d.ts.map +1 -1
  259. package/dist/utils/env.js +0 -1
  260. package/dist/utils/json.js +1 -1
  261. package/dist/utils/model.d.ts +3 -0
  262. package/dist/utils/model.d.ts.map +1 -0
  263. package/dist/utils/model.js +18 -0
  264. package/dist/utils/playwright-report-parser.d.ts +13 -0
  265. package/dist/utils/playwright-report-parser.d.ts.map +1 -0
  266. package/dist/utils/playwright-report-parser.js +138 -0
  267. package/dist/utils/slug.d.ts +1 -0
  268. package/dist/utils/slug.d.ts.map +1 -1
  269. package/dist/utils/slug.js +9 -1
  270. package/dist/utils/stripAnsi.d.ts.map +1 -1
  271. package/dist/utils/stripAnsi.js +1 -3
  272. package/eslint.config.mjs +43 -0
  273. package/package.json +22 -6
  274. package/tsconfig.tsbuildinfo +1 -1
  275. package/dist/agent/codegen/generate-code-apply-changes.d.ts +0 -13
  276. package/dist/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
  277. package/dist/agent/codegen/generate-code-apply-changes.js +0 -379
  278. package/dist/agent/codegen/repo-edit.d.ts +0 -23
  279. package/dist/agent/codegen/repo-edit.d.ts.map +0 -1
  280. package/dist/agent/codegen/repo-edit.js +0 -81
  281. package/dist/agent/codegen/run.d.ts +0 -20
  282. package/dist/agent/codegen/run.d.ts.map +0 -1
  283. package/dist/agent/codegen/run.js +0 -116
  284. package/dist/agent/enrich-prompt/index.d.ts +0 -12
  285. package/dist/agent/enrich-prompt/index.d.ts.map +0 -1
  286. package/dist/agent/enrich-prompt/index.js +0 -80
  287. package/dist/agent/enrich-prompt/utils.d.ts +0 -6
  288. package/dist/agent/enrich-prompt/utils.d.ts.map +0 -1
  289. package/dist/agent/enrich-prompt/utils.js +0 -11
  290. package/dist/agent/infer-agent/index.d.ts +0 -10
  291. package/dist/agent/infer-agent/index.d.ts.map +0 -1
  292. package/dist/agent/infer-agent/index.js +0 -60
  293. package/dist/evals/add-scenario-agent.evals.d.ts +0 -4
  294. package/dist/evals/add-scenario-agent.evals.d.ts.map +0 -1
  295. package/dist/evals/add-scenario-agent.evals.js +0 -44
  296. package/dist/evals/infer-master-or-code-agent.evals.d.ts +0 -4
  297. package/dist/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
  298. package/dist/evals/infer-master-or-code-agent.evals.js +0 -22
  299. package/dist/file-info/file-system.d.ts +0 -3
  300. package/dist/file-info/file-system.d.ts.map +0 -1
  301. package/dist/file-info/github.d.ts +0 -3
  302. package/dist/file-info/github.d.ts.map +0 -1
  303. package/dist/file-info/github.js +0 -107
  304. package/dist/tools/commit-and-create-pr.d.ts.map +0 -1
  305. package/dist/tools/delete-file.d.ts.map +0 -1
  306. package/dist/tools/download-build.d.ts.map +0 -1
  307. package/dist/tools/grep/ripgrep/types.d.ts.map +0 -1
  308. package/dist/tools/merge-conflicts.d.ts.map +0 -1
  309. package/dist/tools/str_replace_editor.d.ts +0 -22
  310. package/dist/tools/str_replace_editor.d.ts.map +0 -1
  311. package/dist/tools/str_replace_editor.js +0 -429
  312. /package/dist/tools/grep/{ripgrep/types.d.ts → types.d.ts} +0 -0
  313. /package/dist/tools/grep/{ripgrep/types.js → types.js} +0 -0
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runRecorder = runRecorder;
7
+ const ast_parser_1 = require("@empiricalrun/ast-parser");
7
8
  const test_run_1 = require("@empiricalrun/test-run");
8
9
  const detect_port_1 = __importDefault(require("detect-port"));
10
+ const fs_1 = __importDefault(require("fs"));
9
11
  const inquirer_1 = __importDefault(require("inquirer"));
10
12
  const path_1 = __importDefault(require("path"));
11
13
  const utils_1 = require("../agent/browsing/utils");
@@ -13,76 +15,66 @@ const pw_pause_1 = require("../agent/cua/pw-codegen/pw-pause");
13
15
  const client_1 = require("../dashboard/client");
14
16
  const server_1 = require("../file/server");
15
17
  const logger_1 = require("../logger");
18
+ const slug_1 = require("../utils/slug");
16
19
  const env_variables_1 = require("./env-variables");
17
20
  const request_1 = require("./request");
18
21
  const temp_files_1 = require("./temp-files");
19
22
  const upload_1 = require("./upload");
20
23
  const validation_1 = require("./validation");
21
- async function runRecorder({ name }) {
22
- try {
23
- await client_1.apiClient.ensureUserIsAuthenticated();
24
- }
25
- catch (error) {
26
- console.error("Authentication required: please run @empiricalrun/test-gen login first");
27
- process.exit(1);
28
- }
24
+ async function collectRepoInfo() {
29
25
  const repoDir = process.cwd();
30
26
  let repoName = "";
31
- let fileServer = null;
32
- let tempTestFilePath = "tests/temp-file.spec.ts";
33
- process.on("SIGINT", async () => {
34
- try {
35
- await (0, temp_files_1.deleteTempTestFile)(repoDir, tempTestFilePath);
36
- await (0, pw_pause_1.revertToOriginalPwCode)(repoDir);
37
- if (fileServer) {
38
- await fileServer.stop();
39
- }
40
- }
41
- catch (error) {
42
- console.error("Error during cleanup:", error);
43
- }
44
- process.exit(0);
45
- });
46
27
  try {
47
28
  repoName = await (0, validation_1.validatePackageJson)(repoDir);
48
29
  }
49
- catch (error) {
30
+ catch {
50
31
  console.error(`Could not validate package.json: ensure you are running this in an Empirical repo.`);
51
32
  process.exit(1);
52
33
  }
53
- try {
54
- logger_1.logger.debug("[generateTestWithBrowserAgent] Preparing playwright for codegen");
55
- await (0, pw_pause_1.preparePlaywrightForCodegen)(repoDir);
56
- }
57
- catch (err) {
58
- logger_1.logger.warn("[generateTestWithBrowserAgent] Error preparing playwright for codegen", err);
59
- }
60
34
  const envVariables = await (0, env_variables_1.fetchEnvironmentVariables)(repoName);
61
- // Start a file service for IPC with the agent (which runs in a different process)
62
- const availablePort = await (0, detect_port_1.default)(3030);
63
- fileServer = new server_1.FileServiceServer({
64
- port: availablePort,
35
+ return {
36
+ repoName,
65
37
  repoDir,
66
- updateFile: false,
67
- });
68
- await fileServer.startFileService();
38
+ envVariables,
39
+ };
40
+ }
41
+ async function collectTestInfo({ testName, project, repoDir, }) {
42
+ // Validate testName - prompt if not provided
43
+ let validatedTestName = testName || "";
44
+ if (!validatedTestName) {
45
+ const answer = await inquirer_1.default.prompt({
46
+ type: "input",
47
+ name: "value",
48
+ message: "Enter the test name:",
49
+ validate: (input) => input.trim().length > 0 || "Test name is required",
50
+ });
51
+ validatedTestName = answer.value;
52
+ }
69
53
  // Get available Playwright projects
70
54
  const projects = await (0, test_run_1.getProjectsFromPlaywrightConfig)(test_run_1.Platform.WEB, repoDir);
71
55
  let selectedProjects = ["chromium"]; // default fallback
72
56
  let selectedProjectObj;
57
+ let tempTestFilePath = "tests/temp-file.spec.ts";
73
58
  if (projects.length > 0) {
74
59
  const projectNames = projects.map((p) => p.name);
75
- const { selectedProject } = await inquirer_1.default.prompt([
76
- {
77
- type: "list",
78
- name: "selectedProject",
79
- message: "Select a Playwright project to use:",
80
- choices: projectNames,
81
- default: projectNames.includes("chromium")
82
- ? "chromium"
83
- : projectNames[0],
84
- },
85
- ]);
60
+ let selectedProject;
61
+ if (project && projectNames.includes(project)) {
62
+ selectedProject = project;
63
+ }
64
+ else {
65
+ const answer = await inquirer_1.default.prompt([
66
+ {
67
+ type: "list",
68
+ name: "selectedProject",
69
+ message: "Select a Playwright project to use:",
70
+ choices: projectNames,
71
+ default: projectNames.includes("chromium")
72
+ ? "chromium"
73
+ : projectNames[0],
74
+ },
75
+ ]);
76
+ selectedProject = answer.selectedProject;
77
+ }
86
78
  selectedProjects = [selectedProject];
87
79
  selectedProjectObj = projects.find((p) => p.name === selectedProject);
88
80
  if (selectedProjectObj) {
@@ -97,47 +89,172 @@ async function runRecorder({ name }) {
97
89
  }
98
90
  }
99
91
  }
100
- // Create temp test file in the determined location
101
- await (0, temp_files_1.createTempTestFile)(availablePort, repoDir, tempTestFilePath);
92
+ return {
93
+ testName: validatedTestName,
94
+ selectedProjects,
95
+ tempTestFilePath,
96
+ };
97
+ }
98
+ async function collectTestInfoFromDiagnosis(url) {
99
+ const slug = (0, slug_1.extractSlugFromDiagnosisUrl)(url);
100
+ const data = (await client_1.apiClient.request(`/api/diagnosis/${slug}/detailed`, {
101
+ method: "GET",
102
+ }));
103
+ if (!data.data ||
104
+ !data.data.error_stack?.file_info ||
105
+ data.data.error_stack.file_info.length === 0) {
106
+ throw new Error("No file info found in diagnosis");
107
+ }
108
+ const testFilePath = data.data.test_case.file_path.startsWith("tests/")
109
+ ? data.data.test_case.file_path
110
+ : `tests/${data.data.test_case.file_path}`;
111
+ const testName = data.data.test_case.name;
112
+ const selectedProjects = [data.data.diagnosis.test_project];
113
+ const fileInfo = data.data.error_stack.file_info.map((file) => ({
114
+ fileName: file.file_name,
115
+ filePath: file.file_path,
116
+ pauseLine: file.pause_line,
117
+ }));
118
+ return {
119
+ testName,
120
+ selectedProjects,
121
+ tempTestFilePath: testFilePath,
122
+ fileInfo,
123
+ };
124
+ }
125
+ async function addRecordTestToExistingFile(data) {
126
+ if (!data.fileInfo || data.fileInfo.length === 0) {
127
+ throw new Error("No file info provided");
128
+ }
129
+ const fileContent = fs_1.default.readFileSync(path_1.default.join(data.repoDir, data.tempTestFilePath), "utf-8");
130
+ const files = new Map([
131
+ [data.tempTestFilePath, { content: fileContent, sha: "" }],
132
+ ]);
133
+ ast_parser_1.astParser.addFiles(files);
134
+ const getRecordTestCode = (pageVariable) => {
135
+ return [`await recordTest(${pageVariable});`];
136
+ };
137
+ const result = (0, ast_parser_1.addStatementBeforeFailingLine)(data.fileInfo, getRecordTestCode);
138
+ if (result) {
139
+ fs_1.default.writeFileSync(path_1.default.join(data.repoDir, result.filePath), result.content);
140
+ await (0, utils_1.addImportForMethod)(path_1.default.join(data.repoDir, result.filePath), "recordTest");
141
+ }
142
+ }
143
+ async function collectRecorderData({ testName, project, url, }) {
144
+ try {
145
+ await client_1.apiClient.ensureUserIsAuthenticated();
146
+ }
147
+ catch {
148
+ console.error("Authentication required: please run @empiricalrun/test-gen login first");
149
+ process.exit(1);
150
+ }
151
+ const repoInfo = await collectRepoInfo();
152
+ let testInfo;
153
+ if (url) {
154
+ // Use diagnosis URL to get file info
155
+ testInfo = await collectTestInfoFromDiagnosis(url);
156
+ }
157
+ else {
158
+ // Normal flow with temp file creation
159
+ testInfo = await collectTestInfo({
160
+ testName,
161
+ project,
162
+ repoDir: repoInfo.repoDir,
163
+ });
164
+ }
165
+ return {
166
+ ...repoInfo,
167
+ ...testInfo,
168
+ diagnosisUrl: url,
169
+ };
170
+ }
171
+ async function prepareTestFile(availablePort, repoDir, tempTestFilePath, testName) {
172
+ await (0, temp_files_1.createTempTestFile)(availablePort, repoDir, tempTestFilePath, testName);
102
173
  const absFilePath = path_1.default.join(repoDir, tempTestFilePath);
103
174
  await (0, utils_1.addImportForMethod)(absFilePath, "recordTest");
175
+ }
176
+ async function executeRecording(data, isFromUrl) {
177
+ let fileServer = null;
178
+ const availablePort = await (0, detect_port_1.default)(3030);
179
+ process.on("SIGINT", async () => {
180
+ try {
181
+ if (!isFromUrl) {
182
+ await (0, temp_files_1.deleteTempTestFile)(data.repoDir, data.tempTestFilePath);
183
+ }
184
+ await (0, pw_pause_1.revertToOriginalPwCode)(data.repoDir);
185
+ if (fileServer) {
186
+ await fileServer.stop();
187
+ }
188
+ }
189
+ catch (error) {
190
+ console.error("Error during cleanup:", error);
191
+ }
192
+ process.exit(0);
193
+ });
194
+ try {
195
+ logger_1.logger.debug("[generateTestWithBrowserAgent] Preparing playwright for codegen");
196
+ await (0, pw_pause_1.preparePlaywrightForCodegen)(data.repoDir);
197
+ }
198
+ catch (err) {
199
+ logger_1.logger.warn("[generateTestWithBrowserAgent] Error preparing playwright for codegen", err);
200
+ }
201
+ // Start a file service for IPC with the agent (which runs in a different process)
202
+ fileServer = new server_1.FileServiceServer({
203
+ port: availablePort,
204
+ repoDir: data.repoDir,
205
+ updateFile: false,
206
+ });
207
+ await fileServer.startFileService();
208
+ if (!isFromUrl) {
209
+ await prepareTestFile(availablePort, data.repoDir, data.tempTestFilePath, data.testName);
210
+ }
211
+ else {
212
+ // For URL flow, add recordTest to existing file and add import
213
+ await addRecordTestToExistingFile(data);
214
+ }
104
215
  await (0, test_run_1.runSingleTest)({
105
- testName: "temp test",
216
+ testName: data.testName,
106
217
  suites: [],
107
- filePath: tempTestFilePath,
108
- projects: selectedProjects,
218
+ filePath: data.tempTestFilePath,
219
+ projects: data.selectedProjects,
109
220
  repoDir: process.cwd(),
110
221
  envOverrides: {
111
- ...envVariables,
222
+ ...data.envVariables,
112
223
  RUN_PLAYWRIGHT_HEADED: "true",
113
224
  PW_CODEGEN_NO_INSPECTOR: "1",
114
225
  IPC_FILE_SERVICE_PORT: availablePort.toString(),
115
226
  },
116
227
  });
117
- await (0, upload_1.waitForSummaryJson)(repoDir);
118
- const videoArtifacts = (0, upload_1.extractVideoAttachments)(repoDir);
228
+ await (0, upload_1.waitForSummaryJson)(data.repoDir);
229
+ const videoArtifacts = (0, upload_1.extractVideoAttachments)(data.repoDir, data.testName);
119
230
  let attachments = [];
120
231
  if (videoArtifacts.length === 0) {
121
- logger_1.logger.warn("No video attachments found for temp test");
232
+ logger_1.logger.warn(`No video attachments found for test: ${data.testName}`);
122
233
  }
123
234
  else {
124
- const videoUrls = await (0, upload_1.uploadVideosWithSpinner)(videoArtifacts, name);
235
+ const videoUrls = await (0, upload_1.uploadVideosWithSpinner)(videoArtifacts, data.testName);
125
236
  if (videoUrls) {
126
237
  attachments = [...attachments, ...videoUrls];
127
238
  }
128
239
  }
129
- await (0, temp_files_1.deleteTempTestFile)(repoDir, tempTestFilePath);
130
- await (0, pw_pause_1.revertToOriginalPwCode)(repoDir);
240
+ if (!isFromUrl) {
241
+ await (0, temp_files_1.deleteTempTestFile)(data.repoDir, data.tempTestFilePath);
242
+ }
243
+ await (0, pw_pause_1.revertToOriginalPwCode)(data.repoDir);
131
244
  const codegenResult = fileServer.getCodegenSources();
132
245
  await fileServer.stop();
133
- if (!name || !codegenResult) {
246
+ if (!data.testName || !codegenResult) {
134
247
  logger_1.logger.error("Test name or codegen result is missing");
135
248
  process.exit(1);
136
249
  }
137
250
  await (0, request_1.sendToDashboardAsRequest)({
138
- repoName,
139
- testName: name,
251
+ repoName: data.repoName,
252
+ testName: data.testName,
140
253
  codegenResult,
141
254
  attachments,
142
255
  });
143
256
  }
257
+ async function runRecorder({ testName, project, url, }) {
258
+ const data = await collectRecorderData({ testName, project, url });
259
+ await executeRecording(data, !!url);
260
+ }
@@ -8,6 +8,6 @@ export type PlaywrightProject = {
8
8
  };
9
9
  export declare function findSubDirs(dir: string, subDirs?: string[], rootDir?: string): void;
10
10
  export declare function getTempTestFileLocation(selectedProject: PlaywrightProject, repoDir: string): string | undefined;
11
- export declare function createTempTestFile(port: number, repoDir: string, tempFileRelativePath: string): Promise<void>;
11
+ export declare function createTempTestFile(port: number, repoDir: string, tempFileRelativePath: string, testName: string): Promise<void>;
12
12
  export declare function deleteTempTestFile(repoDir: string, tempFileRelativePath: string): Promise<void>;
13
13
  //# sourceMappingURL=temp-files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"temp-files.d.ts","sourceRoot":"","sources":["../../src/recorder/temp-files.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,EAAO,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAcN;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,iBAAiB,EAClC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAsDpB;AAqBD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,MAAM,iBAkB7B;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,MAAM,iBAS7B"}
1
+ {"version":3,"file":"temp-files.d.ts","sourceRoot":"","sources":["../../src/recorder/temp-files.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC;IACT,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,EAAO,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAcN;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,iBAAiB,EAClC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAsDpB;AAqBD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,MAAM,iBAkBjB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,MAAM,iBAS7B"}
@@ -85,7 +85,7 @@ function getFixturesImportPath(tempFileRelativePath) {
85
85
  const upLevels = subFolderDepth > 0 ? new Array(subFolderDepth).fill("../").join("") : "./";
86
86
  return `${upLevels}fixtures`;
87
87
  }
88
- async function createTempTestFile(port, repoDir, tempFileRelativePath) {
88
+ async function createTempTestFile(port, repoDir, tempFileRelativePath, testName) {
89
89
  logger_1.logger.debug("Creating temporary test file at:", tempFileRelativePath);
90
90
  const tempFilePath = path_1.default.join(repoDir, tempFileRelativePath);
91
91
  if (fs_1.default.existsSync(tempFilePath)) {
@@ -95,7 +95,7 @@ async function createTempTestFile(port, repoDir, tempFileRelativePath) {
95
95
  const fixturesImportPath = getFixturesImportPath(tempFileRelativePath);
96
96
  const content = `import { test, expect } from '${fixturesImportPath}';
97
97
 
98
- test('temp test', async ({ page }) => {
98
+ test('${testName}', async ({ page }) => {
99
99
  await page.goto('http://localhost:${port}/ready');
100
100
  await recordTest(page);
101
101
  });
@@ -1,5 +1,5 @@
1
1
  import { ArtifactInputPath, ArtifactInputUrl } from "@empiricalrun/shared-types";
2
2
  export declare function waitForSummaryJson(repoDir: string): Promise<void>;
3
- export declare function extractVideoAttachments(repoDir: string): Array<ArtifactInputPath | ArtifactInputUrl>;
3
+ export declare function extractVideoAttachments(repoDir: string, testName: string): Array<ArtifactInputPath | ArtifactInputUrl>;
4
4
  export declare function uploadVideosWithSpinner(videoArtifacts: Array<ArtifactInputPath | ArtifactInputUrl>, testName: string): Promise<void | string[]>;
5
5
  //# sourceMappingURL=upload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/recorder/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAepC,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,iBAmBvD;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GACd,KAAK,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,CAoB7C;AAmFD,wBAAsB,uBAAuB,CAC3C,cAAc,EAAE,KAAK,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,EAC3D,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CA0B1B"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/recorder/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAepC,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,iBAmBvD;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,KAAK,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,CAoB7C;AAmFD,wBAAsB,uBAAuB,CAC3C,cAAc,EAAE,KAAK,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,EAC3D,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CA0B1B"}
@@ -38,7 +38,7 @@ async function waitForSummaryJson(repoDir) {
38
38
  });
39
39
  return Promise.race([timerPromise, fsExistsPromise]);
40
40
  }
41
- function extractVideoAttachments(repoDir) {
41
+ function extractVideoAttachments(repoDir, testName) {
42
42
  try {
43
43
  const summaryPath = SUMMARY_JSON(repoDir);
44
44
  if (!fs_1.default.existsSync(summaryPath)) {
@@ -46,7 +46,7 @@ function extractVideoAttachments(repoDir) {
46
46
  return [];
47
47
  }
48
48
  const summaryContent = JSON.parse(fs_1.default.readFileSync(summaryPath, "utf-8"));
49
- const artifacts = (0, utils_1.extractAttachmentsFromPlaywrightJSONReport)(summaryContent, "temp test");
49
+ const artifacts = (0, utils_1.extractAttachmentsFromPlaywrightJSONReport)(summaryContent, testName);
50
50
  const videoArtifacts = artifacts.filter((artifact) => artifact.contentType === "video/webm");
51
51
  return videoArtifacts;
52
52
  }
@@ -140,7 +140,7 @@ async function uploadVideosWithSpinner(videoArtifacts, testName) {
140
140
  uploadSpinner.warn("Video upload skipped or failed");
141
141
  }
142
142
  }
143
- catch (error) {
143
+ catch {
144
144
  uploadSpinner.fail("Failed to upload video recordings");
145
145
  }
146
146
  }
@@ -1,3 +1,3 @@
1
1
  import type { Tool } from "@empiricalrun/shared-types";
2
2
  export declare const createPullRequestTool: Tool;
3
- //# sourceMappingURL=commit-and-create-pr.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/commit-and-create-pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAevD,eAAO,MAAM,qBAAqB,EAAE,IAgFnC,CAAC"}
@@ -2,35 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPullRequestTool = void 0;
4
4
  const child_process_1 = require("child_process");
5
- const zod_1 = require("zod");
6
- const utils_1 = require("./executor/utils");
7
- const git_1 = require("./executor/utils/git");
8
- const pr_description_1 = require("./executor/utils/pr-description");
9
- const createPullRequestSchema = zod_1.z.object({
10
- pullRequestTitle: zod_1.z
11
- .string()
12
- .describe("A short message to use for the commit. Should not be more than 8 words. Should follow conventional commit format."),
13
- pullRequestDescription: zod_1.z.string().describe(`A longer description of the changes you made. This will be used as the description of a pull request on GitHub, and so you should follow markdown formatting.
14
- Your code will be reviewed by a human, and you should include everything that will provide context and improve the reviewer's confidence in the changes.
15
-
16
- For example, if you used the test run tool, you should include the results (and the report URL if available). Report URL is especially important, because it contains
17
- videos and other artifacts that help the reviewer gain more context and confidence in the changes. If tests pass, reviewer will see the video and merge the PR.
18
- If tests fail, reviewer will see the video and the test artifacts, and will be able to help you debug the issue.`),
19
- });
5
+ const commit_and_create_pr_1 = require("../definitions/commit-and-create-pr");
6
+ const utils_1 = require("../executor/utils");
7
+ const git_1 = require("../executor/utils/git");
8
+ const pr_description_1 = require("../executor/utils/pr-description");
20
9
  exports.createPullRequestTool = {
21
- schema: {
22
- name: "createPullRequest",
23
- description: `Creates a new Pull Request on GitHub.
24
- If the current branch already has an open PR, commits and pushes changes to that PR.
25
- Uses the empiricalrun[bot] credentials for git operations.
26
- Returns the URL of the created or updated pull request.
27
-
28
- You must come up with a title and description for the pull request, based on the changes made.
29
- Don't ask the user for this information, just come up with it yourself.
30
- `,
31
- parameters: createPullRequestSchema,
32
- },
33
- needsBrowser: false,
10
+ ...commit_and_create_pr_1.createPullRequestTool,
34
11
  execute: async ({ input, repoPath, apiClient, chatSession }) => {
35
12
  try {
36
13
  const { pullRequestTitle, pullRequestDescription } = input;
@@ -44,6 +21,9 @@ Don't ask the user for this information, just come up with it yourself.
44
21
  (0, child_process_1.execSync)(`git push origin ${branchName} --set-upstream`, {
45
22
  cwd: repoPath,
46
23
  });
24
+ if (!apiClient) {
25
+ throw new Error("Dashboard API client is not available.");
26
+ }
47
27
  let pullRequest = await (0, utils_1.getExistingPR)({
48
28
  owner,
49
29
  repo,
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from "@empiricalrun/shared-types";
2
+ export declare const createPullRequestTool: ToolDefinition;
3
+ //# sourceMappingURL=commit-and-create-pr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-and-create-pr.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/commit-and-create-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmBjE,eAAO,MAAM,qBAAqB,EAAE,cAenC,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPullRequestTool = void 0;
4
+ const zod_1 = require("zod");
5
+ const createPullRequestSchema = zod_1.z.object({
6
+ pullRequestTitle: zod_1.z
7
+ .string()
8
+ .describe("A short message to use for the commit. Should not be more than 8 words. Should follow conventional commit format."),
9
+ pullRequestDescription: zod_1.z.string().describe(`A longer description of the changes you made. This will be used as the description of a pull request on GitHub, and so you should follow markdown formatting.
10
+ Your code will be reviewed by a human, and you should include everything that will provide context and improve the reviewer's confidence in the changes.
11
+
12
+ For example, if you used the test run tool, you should include the results (and the report URL if available). Report URL is especially important, because it contains
13
+ videos and other artifacts that help the reviewer gain more context and confidence in the changes. If tests pass, reviewer will see the video and merge the PR.
14
+ If tests fail, reviewer will see the video and the test artifacts, and will be able to help you debug the issue.`),
15
+ });
16
+ exports.createPullRequestTool = {
17
+ schema: {
18
+ name: "createPullRequest",
19
+ description: `Creates a new Pull Request on GitHub.
20
+ If the current branch already has an open PR, commits and pushes changes to that PR.
21
+ Uses the empiricalrun[bot] credentials for git operations.
22
+ Returns the URL of the created or updated pull request.
23
+
24
+ You must come up with a title and description for the pull request, based on the changes made.
25
+ Don't ask the user for this information, just come up with it yourself.
26
+ `,
27
+ parameters: createPullRequestSchema,
28
+ },
29
+ needsBrowser: false,
30
+ isInlineTool: false,
31
+ };
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from "@empiricalrun/shared-types";
2
+ export declare const deleteFileTool: ToolDefinition;
3
+ //# sourceMappingURL=delete-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/delete-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAWjE,eAAO,MAAM,cAAc,EAAE,cAU5B,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteFileTool = void 0;
4
+ const zod_1 = require("zod");
5
+ const DeleteFileInputSchema = zod_1.z.object({
6
+ path: zod_1.z
7
+ .string()
8
+ .describe("The path to the file to delete (relative to the repository root). For example, tests/foo.spec.ts"),
9
+ });
10
+ exports.deleteFileTool = {
11
+ schema: {
12
+ name: "deleteFile",
13
+ description: `Delete a file from the filesystem.
14
+ This tool will permanently remove the specified file.
15
+ Use with caution as deleted files cannot be recovered.`,
16
+ parameters: DeleteFileInputSchema,
17
+ },
18
+ needsBrowser: false,
19
+ isInlineTool: false,
20
+ };
@@ -1,4 +1,4 @@
1
- import type { Tool } from "@empiricalrun/shared-types";
1
+ import type { ToolDefinition } from "@empiricalrun/shared-types";
2
2
  import { z } from "zod";
3
3
  export declare const downloadBuildToolSchema: z.ZodObject<{
4
4
  buildUrl: z.ZodString;
@@ -8,5 +8,5 @@ export declare const downloadBuildToolSchema: z.ZodObject<{
8
8
  buildUrl: string;
9
9
  }>;
10
10
  export type DownloadBuildToolInput = z.infer<typeof downloadBuildToolSchema>;
11
- export declare const downloadBuildTool: Tool;
11
+ export declare const downloadBuildTool: ToolDefinition;
12
12
  //# sourceMappingURL=download-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-build.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/download-build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E,eAAO,MAAM,iBAAiB,EAAE,cAU/B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.downloadBuildTool = exports.downloadBuildToolSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.downloadBuildToolSchema = zod_1.z.object({
6
+ buildUrl: zod_1.z.string().describe("The URL of the build to download"),
7
+ });
8
+ exports.downloadBuildTool = {
9
+ schema: {
10
+ name: "downloadBuild",
11
+ description: `Download a build from a build URL. If you do not have
12
+ have a build URL, you can try getting the environment details with the getEnvironment tool.
13
+ Environment details will include the build URL.`,
14
+ parameters: exports.downloadBuildToolSchema,
15
+ },
16
+ needsBrowser: false,
17
+ isInlineTool: false,
18
+ };
@@ -0,0 +1,11 @@
1
+ import { ToolDefinition } from "@empiricalrun/shared-types";
2
+ import z from "zod";
3
+ export declare const videoAnalysisSchema: z.ZodObject<{
4
+ videoUrl: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ videoUrl: string;
7
+ }, {
8
+ videoUrl: string;
9
+ }>;
10
+ export declare const fetchVideoAnalysis: ToolDefinition<z.infer<typeof videoAnalysisSchema>>;
11
+ //# sourceMappingURL=fetch-video-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-video-analysis.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/fetch-video-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,mBAAmB;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAC7C,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAapC,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchVideoAnalysis = exports.videoAnalysisSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.videoAnalysisSchema = zod_1.default.object({
9
+ videoUrl: zod_1.default
10
+ .string()
11
+ .url("Must be a valid URL")
12
+ .describe("The URL of the video to analyze."),
13
+ });
14
+ exports.fetchVideoAnalysis = {
15
+ schema: {
16
+ name: "fetchVideoAnalysis",
17
+ description: `Analyzes Playwright test execution videos to identify test failures and UI issues.
18
+
19
+ **Input:** Video URL of a test execution recording, optional fps (frames per second, default: 30)
20
+ **Output:** analysis summary of what happened during the test execution
21
+ **Use when:** You have a failing test with a video recording and need to understand what went wrong`,
22
+ parameters: exports.videoAnalysisSchema,
23
+ },
24
+ needsBrowser: false,
25
+ isInlineTool: false,
26
+ };
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from "@empiricalrun/shared-types";
2
+ export declare const grepTool: ToolDefinition;
3
+ //# sourceMappingURL=grep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/grep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmBjE,eAAO,MAAM,QAAQ,EAAE,cAWtB,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.grepTool = void 0;
4
+ const zod_1 = require("zod");
5
+ const GrepInputSchema = zod_1.z.object({
6
+ pattern: zod_1.z
7
+ .string()
8
+ .describe("The pattern to search for. Case insensitive and regex patterns are not supported"),
9
+ directory: zod_1.z
10
+ .string()
11
+ .optional()
12
+ .describe("The directory to search in (defaults to current directory)"),
13
+ filePattern: zod_1.z
14
+ .string()
15
+ .optional()
16
+ .describe("File pattern to search in (e.g., '*.ts' for TypeScript files)"),
17
+ });
18
+ exports.grepTool = {
19
+ schema: {
20
+ name: "grep",
21
+ description: `Search for a pattern in files using ripgrep.
22
+ If ripgrep is not available, it will fall back to using system grep.
23
+
24
+ Search is case insensitive and regex patterns are not supported.`,
25
+ parameters: GrepInputSchema,
26
+ },
27
+ needsBrowser: false,
28
+ isInlineTool: false,
29
+ };
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from "@empiricalrun/shared-types";
2
+ export declare const mergeConflictsTool: ToolDefinition;
3
+ //# sourceMappingURL=merge-conflicts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-conflicts.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/merge-conflicts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKjE,eAAO,MAAM,kBAAkB,EAAE,cAkBhC,CAAC"}