@empiricalrun/test-gen 0.73.1 → 0.74.1
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.
- package/CHANGELOG.md +94 -0
- package/dist/actions/utils/index.d.ts.map +1 -1
- package/dist/actions/utils/index.js +1 -2
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +9 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +3 -4
- package/dist/agent/chat/agent-loop.d.ts +7 -8
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +13 -17
- package/dist/agent/chat/exports.d.ts +5 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +9 -4
- package/dist/agent/chat/filesystem-cache.d.ts +12 -0
- package/dist/agent/chat/filesystem-cache.d.ts.map +1 -0
- package/dist/agent/chat/filesystem-cache.js +101 -0
- package/dist/agent/chat/index.d.ts +4 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +44 -22
- package/dist/agent/chat/models.d.ts +2 -1
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +25 -3
- package/dist/agent/chat/prompt/index.d.ts +3 -1
- package/dist/agent/chat/prompt/index.d.ts.map +1 -1
- package/dist/agent/chat/prompt/index.js +77 -2
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +1 -0
- package/dist/agent/chat/state.d.ts +6 -5
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +35 -5
- package/dist/agent/chat/utils.d.ts +1 -0
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +16 -3
- package/dist/agent/cua/index.js +1 -1
- package/dist/agent/cua/model.js +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -1
- package/dist/agent/master/browser-tests/fixtures.d.ts.map +1 -1
- package/dist/agent/master/browser-tests/fixtures.js +0 -1
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +1 -2
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +8 -6
- package/dist/agent/master/icon-descriptor/index.js +2 -2
- package/dist/agent/master/next-action.js +1 -1
- package/dist/agent/master/planner.js +1 -1
- package/dist/agent/master/scroller.js +2 -2
- package/dist/agent/master/with-hints.d.ts.map +1 -1
- package/dist/agent/master/with-hints.js +6 -5
- package/dist/agent/planner/run-time-planner.js +1 -1
- package/dist/agent/planner/run.d.ts.map +1 -1
- package/dist/agent/planner/run.js +4 -2
- package/dist/auth/cli-auth.js +1 -1
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +4 -6
- package/dist/bin/index.js +30 -163
- package/dist/bin/utils/context.js +1 -1
- package/dist/bin/utils/index.d.ts +0 -12
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +0 -70
- package/dist/bin/utils/platform/web/index.d.ts +2 -2
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +7 -5
- package/dist/bin/utils/scenarios/index.d.ts +11 -3
- package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
- package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -5
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -5
- package/dist/dashboard/client.d.ts +2 -2
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +4 -1
- package/dist/file-info/adapters/file-system/index.d.ts +9 -0
- package/dist/file-info/adapters/file-system/index.d.ts.map +1 -0
- package/dist/file-info/adapters/file-system/index.js +25 -0
- package/dist/file-info/adapters/file-system/reader.d.ts +6 -0
- package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -0
- package/dist/file-info/{file-system.js → adapters/file-system/reader.js} +16 -0
- package/dist/file-info/adapters/github/index.d.ts +11 -0
- package/dist/file-info/adapters/github/index.d.ts.map +1 -0
- package/dist/file-info/adapters/github/index.js +29 -0
- package/dist/file-info/adapters/github/reader.d.ts +16 -0
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -0
- package/dist/file-info/adapters/github/reader.js +185 -0
- package/dist/file-info/index.d.ts +4 -0
- package/dist/file-info/index.d.ts.map +1 -0
- package/dist/file-info/index.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/recorder/index.d.ts +7 -3
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +181 -64
- package/dist/recorder/temp-files.d.ts +1 -1
- package/dist/recorder/temp-files.d.ts.map +1 -1
- package/dist/recorder/temp-files.js +2 -2
- package/dist/recorder/upload.d.ts +1 -1
- package/dist/recorder/upload.d.ts.map +1 -1
- package/dist/recorder/upload.js +3 -3
- package/dist/tools/{commit-and-create-pr.d.ts → commit-and-create-pr/index.d.ts} +1 -1
- package/dist/tools/commit-and-create-pr/index.d.ts.map +1 -0
- package/dist/tools/{commit-and-create-pr.js → commit-and-create-pr/index.js} +8 -28
- package/dist/tools/definitions/commit-and-create-pr.d.ts +3 -0
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +1 -0
- package/dist/tools/definitions/commit-and-create-pr.js +31 -0
- package/dist/tools/definitions/delete-file.d.ts +3 -0
- package/dist/tools/definitions/delete-file.d.ts.map +1 -0
- package/dist/tools/definitions/delete-file.js +20 -0
- package/dist/tools/{download-build.d.ts → definitions/download-build.d.ts} +2 -2
- package/dist/tools/definitions/download-build.d.ts.map +1 -0
- package/dist/tools/definitions/download-build.js +18 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts +11 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -0
- package/dist/tools/definitions/fetch-video-analysis.js +26 -0
- package/dist/tools/definitions/grep.d.ts +3 -0
- package/dist/tools/definitions/grep.d.ts.map +1 -0
- package/dist/tools/definitions/grep.js +29 -0
- package/dist/tools/definitions/merge-conflicts.d.ts +3 -0
- package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -0
- package/dist/tools/definitions/merge-conflicts.js +24 -0
- package/dist/tools/definitions/run-test.d.ts +2 -2
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/run-test.js +4 -7
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.js +9 -5
- package/dist/tools/definitions/test-gen-browser.d.ts +5 -5
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.js +4 -7
- package/dist/tools/definitions/upgrade-packages.d.ts +36 -0
- package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -0
- package/dist/tools/definitions/upgrade-packages.js +21 -0
- package/dist/tools/definitions/utils.d.ts +15 -0
- package/dist/tools/definitions/utils.d.ts.map +1 -0
- package/dist/tools/definitions/utils.js +16 -0
- package/dist/tools/{delete-file.d.ts → delete-file/index.d.ts} +1 -1
- package/dist/tools/delete-file/index.d.ts.map +1 -0
- package/dist/tools/{delete-file.js → delete-file/index.js} +4 -16
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +13 -11
- package/dist/tools/download-build/index.d.ts +3 -0
- package/dist/tools/download-build/index.d.ts.map +1 -0
- package/dist/tools/{download-build.js → download-build/index.js} +4 -14
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +19 -4
- package/dist/tools/executor/utils/git.js +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.d.ts +10 -1
- package/dist/tools/fetch-image/index.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.js +1 -0
- package/dist/tools/fetch-last-successful-test-run/index.d.ts +3 -0
- package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +1 -0
- package/dist/tools/fetch-last-successful-test-run/index.js +60 -0
- package/dist/tools/fetch-video-analysis/index.d.ts +5 -0
- package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/index.js +89 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +24 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +209 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts +10 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/utils.js +72 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +7 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/video-analysis.js +54 -0
- package/dist/tools/file-operations/create.d.ts +11 -0
- package/dist/tools/file-operations/create.d.ts.map +1 -0
- package/dist/tools/file-operations/create.js +60 -0
- package/dist/tools/file-operations/index.d.ts +15 -0
- package/dist/tools/file-operations/index.d.ts.map +1 -0
- package/dist/tools/file-operations/index.js +143 -0
- package/dist/tools/file-operations/insert.d.ts +11 -0
- package/dist/tools/file-operations/insert.d.ts.map +1 -0
- package/dist/tools/file-operations/insert.js +61 -0
- package/dist/tools/file-operations/replace.d.ts +11 -0
- package/dist/tools/file-operations/replace.d.ts.map +1 -0
- package/dist/tools/file-operations/replace.js +80 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts +4 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/git-helper.js +29 -0
- package/dist/tools/file-operations/shared/helpers.d.ts +19 -0
- package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/helpers.js +133 -0
- package/dist/tools/file-operations/view/index.d.ts +14 -0
- package/dist/tools/file-operations/view/index.d.ts.map +1 -0
- package/dist/tools/file-operations/view/index.js +56 -0
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +2 -9
- package/dist/tools/grep/ripgrep/index.d.ts +2 -2
- package/dist/tools/grep/ripgrep/index.d.ts.map +1 -1
- package/dist/tools/grep/ripgrep/index.js +3 -3
- package/dist/tools/grep/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +7 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +66 -22
- package/dist/tools/issues/create-issue.d.ts +3 -0
- package/dist/tools/issues/create-issue.d.ts.map +1 -0
- package/dist/tools/issues/create-issue.js +76 -0
- package/dist/tools/issues/index.d.ts +4 -0
- package/dist/tools/issues/index.d.ts.map +1 -0
- package/dist/tools/issues/index.js +9 -0
- package/dist/tools/issues/list-issues.d.ts +3 -0
- package/dist/tools/issues/list-issues.d.ts.map +1 -0
- package/dist/tools/issues/list-issues.js +32 -0
- package/dist/tools/issues/metadata-schema.d.ts +24 -0
- package/dist/tools/issues/metadata-schema.d.ts.map +1 -0
- package/dist/tools/issues/metadata-schema.js +22 -0
- package/dist/tools/issues/update-issue.d.ts +3 -0
- package/dist/tools/issues/update-issue.d.ts.map +1 -0
- package/dist/tools/issues/update-issue.js +75 -0
- package/dist/tools/issues/utils.d.ts +5 -0
- package/dist/tools/issues/utils.d.ts.map +1 -0
- package/dist/tools/issues/utils.js +26 -0
- package/dist/tools/list-environments.d.ts.map +1 -1
- package/dist/tools/list-environments.js +4 -0
- package/dist/tools/{merge-conflicts.d.ts → merge-conflicts/index.d.ts} +1 -1
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -0
- package/dist/tools/{merge-conflicts.js → merge-conflicts/index.js} +3 -19
- package/dist/tools/test-gen-browser.js +4 -4
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -0
- package/dist/tools/trace-dot-zip/index.d.ts +3 -0
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/index.js +48 -0
- package/dist/tools/trace-dot-zip/types.d.ts +86 -0
- package/dist/tools/trace-dot-zip/types.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/types.js +2 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts +7 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.js +34 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.js +174 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.js +189 -0
- package/dist/tools/triage-summary/index.d.ts +3 -0
- package/dist/tools/triage-summary/index.d.ts.map +1 -0
- package/dist/tools/triage-summary/index.js +51 -0
- package/dist/tools/triage-summary/types.d.ts +5 -0
- package/dist/tools/triage-summary/types.d.ts.map +1 -0
- package/dist/tools/triage-summary/types.js +2 -0
- package/dist/tools/triage-summary/utils.d.ts +4 -0
- package/dist/tools/triage-summary/utils.d.ts.map +1 -0
- package/dist/tools/triage-summary/utils.js +16 -0
- package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.js +5 -15
- package/dist/tools/view-failed-test-run-report/index.d.ts +12 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -0
- package/dist/tools/view-failed-test-run-report/index.js +163 -0
- package/dist/trace-utils/index.d.ts +4 -0
- package/dist/trace-utils/index.d.ts.map +1 -0
- package/dist/trace-utils/index.js +10 -0
- package/dist/utils/dedup-image-fs.d.ts +27 -0
- package/dist/utils/dedup-image-fs.d.ts.map +1 -0
- package/dist/utils/dedup-image-fs.js +88 -0
- package/dist/utils/dedup-image.d.ts +25 -0
- package/dist/utils/dedup-image.d.ts.map +1 -0
- package/dist/utils/dedup-image.js +80 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +0 -1
- package/dist/utils/json.js +1 -1
- package/dist/utils/model.d.ts +3 -0
- package/dist/utils/model.d.ts.map +1 -0
- package/dist/utils/model.js +18 -0
- package/dist/utils/playwright-report-parser.d.ts +13 -0
- package/dist/utils/playwright-report-parser.d.ts.map +1 -0
- package/dist/utils/playwright-report-parser.js +138 -0
- package/dist/utils/slug.d.ts +1 -0
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +9 -1
- package/dist/utils/stripAnsi.d.ts.map +1 -1
- package/dist/utils/stripAnsi.js +1 -3
- package/eslint.config.mjs +43 -0
- package/package.json +22 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/codegen/generate-code-apply-changes.d.ts +0 -13
- package/dist/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
- package/dist/agent/codegen/generate-code-apply-changes.js +0 -379
- package/dist/agent/codegen/repo-edit.d.ts +0 -23
- package/dist/agent/codegen/repo-edit.d.ts.map +0 -1
- package/dist/agent/codegen/repo-edit.js +0 -81
- package/dist/agent/codegen/run.d.ts +0 -20
- package/dist/agent/codegen/run.d.ts.map +0 -1
- package/dist/agent/codegen/run.js +0 -116
- package/dist/agent/enrich-prompt/index.d.ts +0 -12
- package/dist/agent/enrich-prompt/index.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/index.js +0 -80
- package/dist/agent/enrich-prompt/utils.d.ts +0 -6
- package/dist/agent/enrich-prompt/utils.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/utils.js +0 -11
- package/dist/agent/infer-agent/index.d.ts +0 -10
- package/dist/agent/infer-agent/index.d.ts.map +0 -1
- package/dist/agent/infer-agent/index.js +0 -60
- package/dist/evals/add-scenario-agent.evals.d.ts +0 -4
- package/dist/evals/add-scenario-agent.evals.d.ts.map +0 -1
- package/dist/evals/add-scenario-agent.evals.js +0 -44
- package/dist/evals/infer-master-or-code-agent.evals.d.ts +0 -4
- package/dist/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
- package/dist/evals/infer-master-or-code-agent.evals.js +0 -22
- package/dist/file-info/file-system.d.ts +0 -3
- package/dist/file-info/file-system.d.ts.map +0 -1
- package/dist/file-info/github.d.ts +0 -3
- package/dist/file-info/github.d.ts.map +0 -1
- package/dist/file-info/github.js +0 -107
- package/dist/tools/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/download-build.d.ts.map +0 -1
- package/dist/tools/grep/ripgrep/types.d.ts.map +0 -1
- package/dist/tools/merge-conflicts.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.d.ts +0 -22
- package/dist/tools/str_replace_editor.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.js +0 -429
- /package/dist/tools/grep/{ripgrep/types.d.ts → types.d.ts} +0 -0
- /package/dist/tools/grep/{ripgrep/types.js → types.js} +0 -0
package/dist/recorder/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
fileServer = new server_1.FileServiceServer({
|
|
64
|
-
port: availablePort,
|
|
35
|
+
return {
|
|
36
|
+
repoName,
|
|
65
37
|
repoDir,
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:
|
|
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
|
-
|
|
101
|
-
|
|
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:
|
|
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(
|
|
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,
|
|
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
|
-
|
|
130
|
-
|
|
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 (!
|
|
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:
|
|
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,
|
|
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('
|
|
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,
|
|
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"}
|
package/dist/recorder/upload.js
CHANGED
|
@@ -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,
|
|
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
|
|
143
|
+
catch {
|
|
144
144
|
uploadSpinner.fail("Failed to upload video recordings");
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -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
|
|
6
|
-
const utils_1 = require("
|
|
7
|
-
const git_1 = require("
|
|
8
|
-
const pr_description_1 = require("
|
|
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
|
-
|
|
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 @@
|
|
|
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 @@
|
|
|
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 {
|
|
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:
|
|
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 @@
|
|
|
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 @@
|
|
|
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"}
|