@empiricalrun/test-gen 0.57.2 → 0.59.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.
- package/CHANGELOG.md +69 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/skill.js +2 -2
- package/dist/actions/utils/index.js +2 -3
- package/dist/agent/browsing/index.js +1 -2
- package/dist/agent/browsing/run.d.ts +3 -1
- package/dist/agent/browsing/run.d.ts.map +1 -1
- package/dist/agent/browsing/run.js +24 -27
- package/dist/agent/browsing/utils.d.ts +1 -14
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +10 -67
- package/dist/agent/chat/agent-loop.d.ts +6 -3
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +43 -27
- package/dist/agent/chat/exports.d.ts +7 -8
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +14 -34
- package/dist/agent/chat/index.d.ts +1 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +20 -10
- package/dist/agent/chat/models.d.ts +6 -0
- package/dist/agent/chat/models.d.ts.map +1 -0
- package/dist/agent/chat/models.js +37 -0
- package/dist/agent/chat/prompt.d.ts +2 -1
- package/dist/agent/chat/prompt.d.ts.map +1 -1
- package/dist/agent/chat/prompt.js +40 -12
- package/dist/agent/chat/repo.d.ts +2 -1
- package/dist/agent/chat/repo.d.ts.map +1 -1
- package/dist/agent/chat/repo.js +32 -36
- package/dist/agent/chat/state.d.ts +15 -7
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +95 -32
- package/dist/agent/chat/types.d.ts +0 -1
- package/dist/agent/chat/types.d.ts.map +1 -1
- package/dist/agent/codegen/create-test-block.js +1 -2
- package/dist/agent/codegen/fix-ts-errors.js +1 -2
- package/dist/agent/codegen/generate-code-apply-changes.js +2 -3
- package/dist/agent/codegen/lexical-scoped-vars.js +1 -2
- package/dist/agent/codegen/repo-edit.js +2 -3
- package/dist/agent/codegen/run.js +2 -3
- package/dist/agent/codegen/skills-retriever.d.ts +3 -3
- package/dist/agent/codegen/skills-retriever.d.ts.map +1 -1
- package/dist/agent/codegen/skills-retriever.js +2 -2
- package/dist/agent/codegen/test-update-feedback.js +1 -2
- package/dist/agent/codegen/update-flow.js +4 -5
- package/dist/agent/codegen/use-skill.js +1 -2
- package/dist/agent/codegen/utils.js +9 -10
- package/dist/agent/cua/computer.js +3 -4
- package/dist/agent/cua/index.js +2 -3
- package/dist/agent/cua/model.js +1 -2
- package/dist/agent/diagnosis-agent/index.js +2 -3
- package/dist/agent/diagnosis-agent/strict-mode-violation.js +1 -2
- package/dist/agent/enrich-prompt/index.d.ts +1 -1
- package/dist/agent/enrich-prompt/index.d.ts.map +1 -1
- package/dist/agent/enrich-prompt/utils.js +1 -2
- package/dist/agent/infer-agent/index.js +1 -2
- package/dist/agent/master/action-tool-calls.js +3 -3
- package/dist/agent/master/browser-tests/index.spec.js +6 -6
- package/dist/agent/master/element-annotation.js +2 -3
- package/dist/agent/master/execute-browser-action.d.ts +1 -1
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +1 -2
- package/dist/agent/master/execute-skill-action.js +1 -2
- package/dist/agent/master/icon-descriptor/index.js +6 -7
- package/dist/agent/master/icon-descriptor/normalize-svg.js +1 -2
- package/dist/agent/master/next-action.js +1 -2
- package/dist/agent/master/planner.d.ts.map +1 -1
- package/dist/agent/master/planner.js +1 -2
- package/dist/agent/master/run.js +3 -3
- package/dist/agent/master/scroller.js +1 -2
- package/dist/agent/master/with-hints.d.ts +1 -1
- package/dist/agent/master/with-hints.d.ts.map +1 -1
- package/dist/agent/planner/run-time-planner.d.ts.map +1 -1
- package/dist/agent/planner/run-time-planner.js +1 -2
- package/dist/agent/planner/run.js +1 -2
- package/dist/bin/index.js +4 -0
- package/dist/bin/logger/index.js +2 -2
- package/dist/bin/utils/context.js +5 -6
- package/dist/bin/utils/fs/index.d.ts.map +1 -1
- package/dist/bin/utils/fs/index.js +4 -5
- package/dist/bin/utils/index.d.ts +1 -0
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +2 -3
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +21 -21
- package/dist/bin/utils/scenarios/index.js +3 -4
- package/dist/constants/index.js +1 -1
- package/dist/file/server.js +2 -2
- package/dist/human-in-the-loop/cli.js +1 -2
- package/dist/human-in-the-loop/ipc.js +2 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/prompts/lib/ts-transformer.js +17 -7
- package/dist/reporter/index.js +3 -3
- package/dist/reporter/lib.js +1 -1
- package/dist/session/index.js +6 -7
- package/dist/test-build/index.js +3 -4
- package/dist/tool-call-service/index.d.ts +3 -3
- package/dist/tool-call-service/index.d.ts.map +1 -1
- package/dist/tool-call-service/index.js +51 -71
- package/dist/tool-call-service/utils.d.ts +10 -0
- package/dist/tool-call-service/utils.d.ts.map +1 -0
- package/dist/tool-call-service/utils.js +23 -0
- package/dist/tools/commit-and-create-pr.js +2 -2
- package/dist/tools/download-build.d.ts +9 -0
- package/dist/tools/download-build.d.ts.map +1 -1
- package/dist/tools/download-build.js +5 -4
- package/dist/tools/grep/ripgrep/index.js +2 -3
- package/dist/tools/grep/ripgrep/types.d.ts +0 -2
- package/dist/tools/grep/ripgrep/types.d.ts.map +1 -1
- package/dist/tools/str_replace_editor.js +3 -3
- package/dist/tools/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/test-gen-browser.js +8 -13
- package/dist/tools/test-run-fetcher/index.js +2 -2
- package/dist/tools/test-run.d.ts.map +1 -1
- package/dist/tools/test-run.js +8 -13
- package/dist/tools/utils/index.js +2 -3
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/uploader/index.js +6 -6
- package/dist/uploader/utils.d.ts.map +1 -1
- package/dist/uploader/utils.js +2 -2
- package/dist/utils/checkpoint.d.ts.map +1 -1
- package/dist/utils/checkpoint.js +4 -3
- package/dist/utils/env.js +1 -2
- package/dist/utils/exec.d.ts +2 -2
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +7 -6
- package/dist/utils/file-tree.d.ts +3 -0
- package/dist/utils/file-tree.d.ts.map +1 -0
- package/dist/utils/file-tree.js +42 -0
- package/dist/utils/file.js +1 -2
- package/dist/utils/git.js +7 -8
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/pw-test.js +1 -2
- package/dist/utils/repo-tree.d.ts +2 -1
- package/dist/utils/repo-tree.d.ts.map +1 -1
- package/dist/utils/repo-tree.js +62 -53
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +1 -1
- package/dist/utils/string.js +1 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/agent/chat/model.d.ts +0 -4
- package/dist/agent/chat/model.d.ts.map +0 -1
- package/dist/agent/chat/model.js +0 -17
package/dist/tools/test-run.js
CHANGED
|
@@ -39,32 +39,27 @@ exports.runTestTool = {
|
|
|
39
39
|
},
|
|
40
40
|
execute: async (input) => {
|
|
41
41
|
let reportUrl = undefined;
|
|
42
|
-
let
|
|
43
|
-
let testRunId = undefined;
|
|
42
|
+
let envOverrides = undefined;
|
|
44
43
|
if (hasCloudflareCredentials()) {
|
|
45
|
-
projectName = "test-gen-chat-agent";
|
|
46
|
-
testRunId = Date.now().toString();
|
|
44
|
+
const projectName = "test-gen-chat-agent";
|
|
45
|
+
const testRunId = Date.now().toString();
|
|
47
46
|
reportUrl = buildReportUrl(projectName, testRunId);
|
|
47
|
+
envOverrides = {
|
|
48
|
+
PROJECT_NAME: projectName,
|
|
49
|
+
TEST_RUN_GITHUB_ACTION_ID: testRunId,
|
|
50
|
+
};
|
|
48
51
|
}
|
|
49
52
|
else {
|
|
50
53
|
console.warn("R2 credentials not found: report artifacts will not be uploaded");
|
|
51
54
|
}
|
|
52
55
|
const { testName, suites, fileName, project } = input;
|
|
53
56
|
try {
|
|
54
|
-
// {"project":"chromium","suites":[],"fileName":"tests/quizizz-for-work/group.spec.ts","testName":"Create a group"}
|
|
55
|
-
// This runs all tests - TODO: Debug this, should only run the testName
|
|
56
57
|
const result = await (0, test_run_1.runSingleTest)({
|
|
57
58
|
testName,
|
|
58
59
|
suites,
|
|
59
60
|
fileName,
|
|
60
61
|
projects: [project],
|
|
61
|
-
|
|
62
|
-
envOverrides: projectName && testRunId
|
|
63
|
-
? {
|
|
64
|
-
PROJECT_NAME: projectName,
|
|
65
|
-
TEST_RUN_GITHUB_ACTION_ID: testRunId,
|
|
66
|
-
}
|
|
67
|
-
: undefined,
|
|
62
|
+
envOverrides,
|
|
68
63
|
});
|
|
69
64
|
return {
|
|
70
65
|
result: buildResult({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.makeDashboardRequest = makeDashboardRequest;
|
|
4
|
+
exports.callGitHubProxy = callGitHubProxy;
|
|
4
5
|
async function makeDashboardRequest({ path, method = "GET", body, }) {
|
|
5
6
|
const API_KEY = process.env.EMPIRICALRUN_API_KEY;
|
|
6
7
|
if (!API_KEY) {
|
|
@@ -23,7 +24,6 @@ async function makeDashboardRequest({ path, method = "GET", body, }) {
|
|
|
23
24
|
}
|
|
24
25
|
return await response.json();
|
|
25
26
|
}
|
|
26
|
-
exports.makeDashboardRequest = makeDashboardRequest;
|
|
27
27
|
async function callGitHubProxy({ method, url, body, }) {
|
|
28
28
|
const githubApiPath = url.replace("https://api.github.com", "");
|
|
29
29
|
return makeDashboardRequest({
|
|
@@ -36,4 +36,3 @@ async function callGitHubProxy({ method, url, body, }) {
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
exports.callGitHubProxy = callGitHubProxy;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -65,5 +65,13 @@ export type SkillActionArgs = BaseActionArgs & {
|
|
|
65
65
|
skill: string;
|
|
66
66
|
action: string;
|
|
67
67
|
};
|
|
68
|
+
export type FileInfo = {
|
|
69
|
+
isDirectory: boolean;
|
|
70
|
+
isFile: boolean;
|
|
71
|
+
path: string;
|
|
72
|
+
name: string;
|
|
73
|
+
children: FileInfo[];
|
|
74
|
+
getContent: () => Promise<string>;
|
|
75
|
+
};
|
|
68
76
|
export type ActionArgs = ClickActionArgs | FillActionArgs | GotoActionArgs | PressActionArgs | AssertTextVisibilityActionArgs | TextContentActionArgs | HoverActionArgs | SkillActionArgs;
|
|
69
77
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,cAAc,GAAG,UAAU,IAAI,CAC7E,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;CAClE,KACE,MAAM,CAAC,CAAC,CAAC,CAAC;AAEf,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC;AAEtE,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,UAAU,IAAI;IAC1D,IAAI,EAAE,M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EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,cAAc,GACd,cAAc,GACd,eAAe,GACf,8BAA8B,GAC9B,qBAAqB,GACrB,eAAe,GACf,eAAe,CAAC"}
|
package/dist/uploader/index.js
CHANGED
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.UPLOAD_DOMAIN = exports.UPLOAD_BUCKET = void 0;
|
|
7
|
+
exports.getFullUploadPath = getFullUploadPath;
|
|
8
|
+
exports.getRelativeUploadPath = getRelativeUploadPath;
|
|
9
|
+
exports.uploadTestResultsUsingPrjRepo = uploadTestResultsUsingPrjRepo;
|
|
10
|
+
exports.getUploadPathForRun = getUploadPathForRun;
|
|
11
|
+
exports.checkIfResultsUploadAllowed = checkIfResultsUploadAllowed;
|
|
7
12
|
const r2_uploader_1 = require("@empiricalrun/r2-uploader");
|
|
8
13
|
const path_1 = __importDefault(require("path"));
|
|
9
14
|
const utils_1 = require("./utils");
|
|
@@ -21,11 +26,9 @@ function getFullUploadPath(repoDir, filePath, uploadDir) {
|
|
|
21
26
|
const relativeFilePath = getRelativeUploadPath(filePath, repoDir);
|
|
22
27
|
return `${exports.UPLOAD_DOMAIN}/${uploadDir}${relativeFilePath}`;
|
|
23
28
|
}
|
|
24
|
-
exports.getFullUploadPath = getFullUploadPath;
|
|
25
29
|
function getRelativeUploadPath(filePath, repoDir) {
|
|
26
30
|
return filePath.replace(path_1.default.join(repoDir, PLAYWRIGHT_REPORT_DATA), "");
|
|
27
31
|
}
|
|
28
|
-
exports.getRelativeUploadPath = getRelativeUploadPath;
|
|
29
32
|
/**
|
|
30
33
|
* Function to upload test results to R2 using the project repo name and test name.
|
|
31
34
|
* This function uploads both the JSON summary of test results and associated video files.
|
|
@@ -86,12 +89,10 @@ async function uploadTestResultsUsingPrjRepo({ projectRepoName, testName, repoDi
|
|
|
86
89
|
.filter((url) => !!url),
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
|
-
exports.uploadTestResultsUsingPrjRepo = uploadTestResultsUsingPrjRepo;
|
|
90
92
|
function getUploadPathForRun(projectRepoName) {
|
|
91
93
|
const uploadDir = `test-generation/${projectRepoName.replace("-tests", "")}/${uploadId}`;
|
|
92
94
|
return uploadDir;
|
|
93
95
|
}
|
|
94
|
-
exports.getUploadPathForRun = getUploadPathForRun;
|
|
95
96
|
function checkIfResultsUploadAllowed() {
|
|
96
97
|
// TODO: check for valid R2 credentials
|
|
97
98
|
// check for project repo name, and r2 creds
|
|
@@ -99,4 +100,3 @@ function checkIfResultsUploadAllowed() {
|
|
|
99
100
|
process.env.R2_ACCESS_KEY_ID &&
|
|
100
101
|
process.env.R2_SECRET_ACCESS_KEY);
|
|
101
102
|
}
|
|
102
|
-
exports.checkIfResultsUploadAllowed = checkIfResultsUploadAllowed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/uploader/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAGnC,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAErD;AAMD,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/uploader/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAGnC,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAErD;AAMD,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,eAAe,EAAE,KACxB,cAAc,EA4BhB,CAAC"}
|
package/dist/uploader/utils.js
CHANGED
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getFlattenedTestList =
|
|
6
|
+
exports.getFlattenedTestList = void 0;
|
|
7
|
+
exports.parseJsonReport = parseJsonReport;
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
function parseJsonReport(srcFile) {
|
|
9
10
|
return JSON.parse(fs_1.default.readFileSync(srcFile, { encoding: "utf-8" }));
|
|
10
11
|
}
|
|
11
|
-
exports.parseJsonReport = parseJsonReport;
|
|
12
12
|
const getFlattenedTestList = (suites) => {
|
|
13
13
|
let flattenedSpecs = [];
|
|
14
14
|
const traverseSuites = (suite, nesting = []) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/utils/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAAE,EAC5B,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/utils/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAAE,EAC5B,UAAU,EAAE,MAAM,iBAqBnB"}
|
package/dist/utils/checkpoint.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCheckpoint =
|
|
3
|
+
exports.createCheckpoint = createCheckpoint;
|
|
4
4
|
const git_1 = require("./git");
|
|
5
5
|
async function createCheckpoint(toolCalls, branchName) {
|
|
6
6
|
const filesChanged = await (0, git_1.getFilesChanged)();
|
|
7
7
|
const toolsWithUpdatedFiles = toolCalls
|
|
8
|
-
.filter((tc) =>
|
|
8
|
+
.filter((tc) => "path" in tc.input &&
|
|
9
|
+
tc.input.path &&
|
|
10
|
+
filesChanged.includes(tc.input.path))
|
|
9
11
|
.map((toolCall) => ({
|
|
10
12
|
name: toolCall.name,
|
|
11
13
|
path: toolCall.input.path,
|
|
@@ -16,4 +18,3 @@ async function createCheckpoint(toolCalls, branchName) {
|
|
|
16
18
|
await (0, git_1.commitFilesAndPushBranch)(commitMessage, branchName, filesToCommit);
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
exports.createCheckpoint = createCheckpoint;
|
package/dist/utils/env.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRunningOnCloud =
|
|
3
|
+
exports.isRunningOnCloud = isRunningOnCloud;
|
|
4
4
|
function isRunningOnCloud() {
|
|
5
5
|
return (process.env.CI === "true" ||
|
|
6
6
|
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
7
7
|
!!process.env.RUNNING_BROWSER_TESTS_FOR_TEST_GEN);
|
|
8
8
|
}
|
|
9
|
-
exports.isRunningOnCloud = isRunningOnCloud;
|
package/dist/utils/exec.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare class ProcessManager {
|
|
2
2
|
private childProcess;
|
|
3
|
-
execute(command: string[], options: {
|
|
3
|
+
execute(command: string, args: string[], options: {
|
|
4
4
|
env?: Record<string, string>;
|
|
5
5
|
}): Promise<number>;
|
|
6
6
|
terminate(): void;
|
|
7
7
|
isRunning(): boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare function cmd(command: string[], options: {
|
|
9
|
+
export declare function cmd(command: string, args: string[], options: {
|
|
10
10
|
env?: Record<string, string>;
|
|
11
11
|
}): Promise<number>;
|
|
12
12
|
//# sourceMappingURL=exec.d.ts.map
|
package/dist/utils/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAmBA,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAA6B;IAE3C,OAAO,CACX,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAmBA,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAA6B;IAE3C,OAAO,CACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GACxC,OAAO,CAAC,MAAM,CAAC;IAmDlB,SAAS,IAAI,IAAI;IASjB,SAAS,IAAI,OAAO;CAGrB;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACxC,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
package/dist/utils/exec.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.ProcessManager = void 0;
|
|
7
|
+
exports.cmd = cmd;
|
|
7
8
|
const child_process_1 = require("child_process");
|
|
8
9
|
const process_1 = __importDefault(require("process"));
|
|
9
10
|
function isAcceptableExit(exitCode, signal) {
|
|
@@ -20,7 +21,8 @@ function isAcceptableExit(exitCode, signal) {
|
|
|
20
21
|
}
|
|
21
22
|
class ProcessManager {
|
|
22
23
|
childProcess = null;
|
|
23
|
-
async execute(command, options) {
|
|
24
|
+
async execute(command, args, options) {
|
|
25
|
+
console.log(`Executing command: ${command} with args: ${args}`);
|
|
24
26
|
if (this.childProcess) {
|
|
25
27
|
throw new Error("Process is already running");
|
|
26
28
|
}
|
|
@@ -30,7 +32,7 @@ class ProcessManager {
|
|
|
30
32
|
rejectFunc(new Error("Command cannot be empty"));
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
|
-
const p = (0, child_process_1.spawn)(command
|
|
35
|
+
const p = (0, child_process_1.spawn)(command, args, {
|
|
34
36
|
env: { ...process_1.default.env, ...options.env },
|
|
35
37
|
detached: true, // Create process group so we can terminate all child processes
|
|
36
38
|
});
|
|
@@ -76,8 +78,7 @@ class ProcessManager {
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
exports.ProcessManager = ProcessManager;
|
|
79
|
-
async function cmd(command, options) {
|
|
81
|
+
async function cmd(command, args, options) {
|
|
80
82
|
const manager = new ProcessManager();
|
|
81
|
-
return manager.execute(command, options);
|
|
83
|
+
return manager.execute(command, args, options);
|
|
82
84
|
}
|
|
83
|
-
exports.cmd = cmd;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../src/utils/file-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgC5E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.getFileInfoFromFS = getFileInfoFromFS;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
async function getFileInfoFromFS(directory) {
|
|
10
|
+
let currentDirName = path_1.default.basename(directory);
|
|
11
|
+
let currentDir = {
|
|
12
|
+
isDirectory: true,
|
|
13
|
+
isFile: false,
|
|
14
|
+
path: currentDirName,
|
|
15
|
+
name: currentDirName,
|
|
16
|
+
children: [],
|
|
17
|
+
getContent: async () => {
|
|
18
|
+
return "";
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const files = await promises_1.default.readdir(directory);
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
const filePath = path_1.default.join(directory, file);
|
|
24
|
+
const stats = await promises_1.default.stat(filePath);
|
|
25
|
+
if (stats.isDirectory()) {
|
|
26
|
+
currentDir.children.push(await getFileInfoFromFS(filePath));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
currentDir.children.push({
|
|
30
|
+
isDirectory: false,
|
|
31
|
+
isFile: true,
|
|
32
|
+
path: filePath,
|
|
33
|
+
name: file,
|
|
34
|
+
children: [],
|
|
35
|
+
getContent: async () => {
|
|
36
|
+
return await promises_1.default.readFile(filePath, "utf8");
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return currentDir;
|
|
42
|
+
}
|
package/dist/utils/file.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.findFileRecursively =
|
|
6
|
+
exports.findFileRecursively = findFileRecursively;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
function findFileRecursively(directory, fileName) {
|
|
@@ -22,4 +22,3 @@ function findFileRecursively(directory, fileName) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.findFileRecursively = findFileRecursively;
|
package/dist/utils/git.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getGitDiff = getGitDiff;
|
|
4
|
+
exports.checkoutBranch = checkoutBranch;
|
|
5
|
+
exports.commitAsBotUser = commitAsBotUser;
|
|
6
|
+
exports.getCurrentBranchName = getCurrentBranchName;
|
|
7
|
+
exports.pullBranch = pullBranch;
|
|
8
|
+
exports.commitFilesAndPushBranch = commitFilesAndPushBranch;
|
|
9
|
+
exports.getFilesChanged = getFilesChanged;
|
|
4
10
|
const child_process_1 = require("child_process");
|
|
5
11
|
const GIT_USER_NAME = "empiricalrun[bot]";
|
|
6
12
|
const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
|
|
@@ -10,7 +16,6 @@ function getGitDiff(filepath) {
|
|
|
10
16
|
});
|
|
11
17
|
return diff;
|
|
12
18
|
}
|
|
13
|
-
exports.getGitDiff = getGitDiff;
|
|
14
19
|
async function checkoutBranch(branchName) {
|
|
15
20
|
// TODO: This assumes repoDir is process.cwd()
|
|
16
21
|
try {
|
|
@@ -21,7 +26,6 @@ async function checkoutBranch(branchName) {
|
|
|
21
26
|
(0, child_process_1.execSync)(`git checkout -b ${branchName}`);
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
exports.checkoutBranch = checkoutBranch;
|
|
25
29
|
async function commitAsBotUser(commitMessage) {
|
|
26
30
|
const status = (0, child_process_1.execSync)("git status --porcelain", { encoding: "utf-8" });
|
|
27
31
|
if (!status) {
|
|
@@ -30,22 +34,18 @@ async function commitAsBotUser(commitMessage) {
|
|
|
30
34
|
const commitMessageWithSkipCi = `${commitMessage} [skip ci]`;
|
|
31
35
|
(0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`);
|
|
32
36
|
}
|
|
33
|
-
exports.commitAsBotUser = commitAsBotUser;
|
|
34
37
|
async function getCurrentBranchName() {
|
|
35
38
|
const branchName = (0, child_process_1.execSync)("git branch --show-current").toString().trim();
|
|
36
39
|
return branchName;
|
|
37
40
|
}
|
|
38
|
-
exports.getCurrentBranchName = getCurrentBranchName;
|
|
39
41
|
async function pullBranch(branchName) {
|
|
40
42
|
(0, child_process_1.execSync)(`git pull origin ${branchName}`);
|
|
41
43
|
}
|
|
42
|
-
exports.pullBranch = pullBranch;
|
|
43
44
|
async function commitFilesAndPushBranch(commitMessage, branchName, files) {
|
|
44
45
|
(0, child_process_1.execSync)(`git add ${files.join(" ")}`);
|
|
45
46
|
await commitAsBotUser(commitMessage);
|
|
46
47
|
(0, child_process_1.execSync)(`git push origin ${branchName}`);
|
|
47
48
|
}
|
|
48
|
-
exports.commitFilesAndPushBranch = commitFilesAndPushBranch;
|
|
49
49
|
async function getFilesChanged() {
|
|
50
50
|
const output = (0, child_process_1.execSync)("git status --porcelain").toString();
|
|
51
51
|
let filesChanged = output
|
|
@@ -55,4 +55,3 @@ async function getFilesChanged() {
|
|
|
55
55
|
.filter((fileName) => fileName != "");
|
|
56
56
|
return filesChanged;
|
|
57
57
|
}
|
|
58
|
-
exports.getFilesChanged = getFilesChanged;
|
package/dist/utils/html.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,UAAS;IACP,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,WAsCP,CAAC"}
|
package/dist/utils/pw-test.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getTestFixtureModuleFromRepo =
|
|
6
|
+
exports.getTestFixtureModuleFromRepo = getTestFixtureModuleFromRepo;
|
|
7
7
|
const api_1 = __importDefault(require("tsx/cjs/api"));
|
|
8
8
|
async function getTestFixtureModuleFromRepo(repoDir) {
|
|
9
9
|
const [lastDir] = repoDir.split("/").reverse();
|
|
@@ -11,4 +11,3 @@ async function getTestFixtureModuleFromRepo(repoDir) {
|
|
|
11
11
|
const { test } = await api_1.default.require(`./tests/fixtures.ts`, dir);
|
|
12
12
|
return test;
|
|
13
13
|
}
|
|
14
|
-
exports.getTestFixtureModuleFromRepo = getTestFixtureModuleFromRepo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FileInfo } from "../types";
|
|
1
2
|
export declare const DEFAULT_EXCLUDE: (string | RegExp)[];
|
|
2
|
-
export declare function generateAsciiTree(
|
|
3
|
+
export declare function generateAsciiTree(root: FileInfo, options?: {}): string;
|
|
3
4
|
//# sourceMappingURL=repo-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-tree.d.ts","sourceRoot":"","sources":["../../src/utils/repo-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"repo-tree.d.ts","sourceRoot":"","sources":["../../src/utils/repo-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,eAAe,qBAW3B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,KAAK,UAqF7D"}
|
package/dist/utils/repo-tree.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
3
|
+
exports.DEFAULT_EXCLUDE = void 0;
|
|
4
|
+
exports.generateAsciiTree = generateAsciiTree;
|
|
9
5
|
exports.DEFAULT_EXCLUDE = [
|
|
10
6
|
"node_modules",
|
|
11
7
|
"dist",
|
|
@@ -18,62 +14,75 @@ exports.DEFAULT_EXCLUDE = [
|
|
|
18
14
|
"auth",
|
|
19
15
|
"package-lock.json",
|
|
20
16
|
];
|
|
21
|
-
function generateAsciiTree(
|
|
17
|
+
function generateAsciiTree(root, options = {}) {
|
|
22
18
|
const defaultOptions = {
|
|
23
19
|
showHidden: false,
|
|
24
20
|
exclude: exports.DEFAULT_EXCLUDE,
|
|
25
21
|
maxDepth: 10,
|
|
26
22
|
};
|
|
27
23
|
const opts = { ...defaultOptions, ...options };
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if (!root.isDirectory) {
|
|
25
|
+
throw new Error(`"${root.path}" is not a valid directory`);
|
|
26
|
+
}
|
|
27
|
+
let result = root.name + "\n";
|
|
28
|
+
const stack = [];
|
|
29
|
+
// Add root's children to stack in reverse order
|
|
30
|
+
const rootChildren = [...root.children]
|
|
31
|
+
.filter((child) => child !== undefined)
|
|
32
|
+
.sort((a, b) => {
|
|
33
|
+
// Files first, then directories
|
|
34
|
+
if (!a.isDirectory && b.isDirectory)
|
|
35
|
+
return -1;
|
|
36
|
+
if (a.isDirectory && !b.isDirectory)
|
|
37
|
+
return 1;
|
|
38
|
+
return a.name.localeCompare(b.name);
|
|
39
|
+
});
|
|
40
|
+
for (let i = rootChildren.length - 1; i >= 0; i--) {
|
|
41
|
+
const child = rootChildren[i];
|
|
42
|
+
if (child) {
|
|
43
|
+
stack.push([child, "", 1, i === 0]);
|
|
44
|
+
}
|
|
31
45
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
while (stack.length > 0) {
|
|
47
|
+
const current = stack.pop();
|
|
48
|
+
if (!current)
|
|
49
|
+
continue;
|
|
50
|
+
const [node, prefix, depth, isLast] = current;
|
|
36
51
|
if (depth > opts.maxDepth)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// Process subdirectories
|
|
70
|
-
if (isDirectory) {
|
|
71
|
-
processDirectory(itemPath, prefix + nextPrefix, depth + 1);
|
|
52
|
+
continue;
|
|
53
|
+
// Skip hidden files if not showing hidden
|
|
54
|
+
if (!opts.showHidden && node.name.startsWith("."))
|
|
55
|
+
continue;
|
|
56
|
+
// Skip excluded patterns
|
|
57
|
+
if (opts.exclude.some((pattern) => typeof pattern === "string"
|
|
58
|
+
? node.path === pattern
|
|
59
|
+
: pattern instanceof RegExp
|
|
60
|
+
? pattern.test(node.path)
|
|
61
|
+
: false))
|
|
62
|
+
continue;
|
|
63
|
+
// Add the current item to the result
|
|
64
|
+
const symbol = isLast ? "└── " : "├── ";
|
|
65
|
+
result += `${prefix}${symbol}${node.name}${node.isDirectory ? "/" : ""}\n`;
|
|
66
|
+
if (node.isDirectory && node.children.length > 0) {
|
|
67
|
+
const nextPrefix = prefix + (isLast ? " " : "│ ");
|
|
68
|
+
// Sort and add children to stack in reverse order
|
|
69
|
+
const children = [...node.children]
|
|
70
|
+
.filter((child) => child !== undefined)
|
|
71
|
+
.sort((a, b) => {
|
|
72
|
+
// Files first, then directories
|
|
73
|
+
if (!a.isDirectory && b.isDirectory)
|
|
74
|
+
return -1;
|
|
75
|
+
if (a.isDirectory && !b.isDirectory)
|
|
76
|
+
return 1;
|
|
77
|
+
return a.name.localeCompare(b.name);
|
|
78
|
+
});
|
|
79
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
80
|
+
const child = children[i];
|
|
81
|
+
if (child) {
|
|
82
|
+
stack.push([child, nextPrefix, depth + 1, i === 0]);
|
|
83
|
+
}
|
|
72
84
|
}
|
|
73
|
-
}
|
|
85
|
+
}
|
|
74
86
|
}
|
|
75
|
-
// Start the recursive processing
|
|
76
|
-
processDirectory(dirPath);
|
|
77
87
|
return result;
|
|
78
88
|
}
|
|
79
|
-
exports.generateAsciiTree = generateAsciiTree;
|
package/dist/utils/slug.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../src/utils/slug.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../src/utils/slug.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,uBAAuB,GAAU,MAAM,MAAM,oBAOzD,CAAC"}
|
package/dist/utils/slug.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asyncGenerateRandomSlug = void 0;
|
|
4
|
-
// @ts-
|
|
4
|
+
// @ts-ignore
|
|
5
5
|
let customAlphabet;
|
|
6
6
|
const loadNanoid = async () => {
|
|
7
7
|
const { customAlphabet: importedCustomAlphabet } = await import("nanoid");
|
package/dist/utils/string.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertTextToJsComments =
|
|
3
|
+
exports.convertTextToJsComments = convertTextToJsComments;
|
|
4
4
|
function convertTextToJsComments(text) {
|
|
5
5
|
const lines = text.split("\n");
|
|
6
6
|
const commentedLines = lines.map((line) => `// ${line}`);
|
|
7
7
|
return commentedLines.join("\n");
|
|
8
8
|
}
|
|
9
|
-
exports.convertTextToJsComments = convertTextToJsComments;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"tsx": "^4.16.2",
|
|
61
61
|
"typescript": "^5.3.3",
|
|
62
62
|
"zod": "^3.23.8",
|
|
63
|
-
"@empiricalrun/llm": "^0.
|
|
64
|
-
"@empiricalrun/r2-uploader": "^0.3.
|
|
65
|
-
"@empiricalrun/test-run": "^0.
|
|
63
|
+
"@empiricalrun/llm": "^0.16.0",
|
|
64
|
+
"@empiricalrun/r2-uploader": "^0.3.9",
|
|
65
|
+
"@empiricalrun/test-run": "^0.9.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@playwright/test": "1.47.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"playwright": "1.47.1",
|
|
77
77
|
"serve-handler": "^6.1.6",
|
|
78
78
|
"ts-patch": "^3.3.0",
|
|
79
|
-
"@empiricalrun/shared-types": "0.0
|
|
79
|
+
"@empiricalrun/shared-types": "0.1.0"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"dev": "tspc --build --watch",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/index.ts","./src/actions/assert.ts","./src/actions/click.ts","./src/actions/done.ts","./src/actions/fill.ts","./src/actions/goto.ts","./src/actions/hover.ts","./src/actions/index.ts","./src/actions/next-task.ts","./src/actions/press.ts","./src/actions/skill.ts","./src/actions/text-content.ts","./src/actions/constants/index.ts","./src/actions/utils/index.ts","./src/agent/browsing/index.ts","./src/agent/browsing/run.ts","./src/agent/browsing/utils.ts","./src/agent/chat/agent-loop.ts","./src/agent/chat/exports.ts","./src/agent/chat/index.ts","./src/agent/chat/models.ts","./src/agent/chat/prompt.ts","./src/agent/chat/repo.ts","./src/agent/chat/state.ts","./src/agent/chat/types.ts","./src/agent/codegen/create-test-block.ts","./src/agent/codegen/fix-ts-errors.ts","./src/agent/codegen/generate-code-apply-changes.ts","./src/agent/codegen/lexical-scoped-vars.ts","./src/agent/codegen/repo-edit.ts","./src/agent/codegen/run.ts","./src/agent/codegen/skills-retriever.ts","./src/agent/codegen/test-update-feedback.ts","./src/agent/codegen/types.ts","./src/agent/codegen/update-flow.ts","./src/agent/codegen/use-skill.ts","./src/agent/codegen/utils.ts","./src/agent/cua/computer.ts","./src/agent/cua/index.ts","./src/agent/cua/model.ts","./src/agent/diagnosis-agent/index.ts","./src/agent/diagnosis-agent/strict-mode-violation.ts","./src/agent/enrich-prompt/index.ts","./src/agent/enrich-prompt/utils.ts","./src/agent/infer-agent/index.ts","./src/agent/master/action-tool-calls.ts","./src/agent/master/element-annotation.ts","./src/agent/master/execute-browser-action.ts","./src/agent/master/execute-skill-action.ts","./src/agent/master/next-action.ts","./src/agent/master/planner.ts","./src/agent/master/run.ts","./src/agent/master/scroller.ts","./src/agent/master/with-hints.ts","./src/agent/master/browser-tests/cua.spec.ts","./src/agent/master/browser-tests/fixtures.ts","./src/agent/master/browser-tests/index.spec.ts","./src/agent/master/browser-tests/skills.spec.ts","./src/agent/master/icon-descriptor/index.ts","./src/agent/master/icon-descriptor/normalize-svg.ts","./src/agent/planner/run-time-planner.ts","./src/agent/planner/run.ts","./src/bin/index.ts","./src/bin/logger/index.ts","./src/bin/utils/context.ts","./src/bin/utils/index.ts","./src/bin/utils/fs/index.ts","./src/bin/utils/platform/web/index.ts","./src/bin/utils/platform/web/test-files/ts-path-import-validate.ts","./src/bin/utils/scenarios/index.ts","./src/browser-injected-scripts/annotate-elements.spec.ts","./src/constants/index.ts","./src/errors/index.ts","./src/evals/add-scenario-agent.evals.ts","./src/evals/append-create-test-agent.evals.ts","./src/evals/fetch-pom-skills-agent.evals.ts","./src/evals/infer-master-or-code-agent.evals.ts","./src/evals/master-agent.evals.ts","./src/evals/type.ts","./src/evals/update-scenario-agent.evals.ts","./src/file/client.ts","./src/file/server.ts","./src/human-in-the-loop/cli.ts","./src/human-in-the-loop/index.ts","./src/human-in-the-loop/ipc.ts","./src/page/index.ts","./src/prompts/lib/ts-transformer.ts","./src/reporter/index.ts","./src/reporter/lib.ts","./src/session/index.ts","./src/test-build/index.ts","./src/tool-call-service/index.ts","./src/tool-call-service/utils.ts","./src/tools/codegen-agent.ts","./src/tools/commit-and-create-pr.ts","./src/tools/diagnosis-fetcher.ts","./src/tools/download-build.ts","./src/tools/environment-crud.ts","./src/tools/str_replace_editor.ts","./src/tools/test-gen-browser.ts","./src/tools/test-run.ts","./src/tools/grep/index.ts","./src/tools/grep/ripgrep/index.ts","./src/tools/grep/ripgrep/types.ts","./src/tools/test-run-fetcher/index.ts","./src/tools/test-run-fetcher/types.ts","./src/tools/utils/index.ts","./src/types/handlebars.d.ts","./src/types/index.ts","./src/uploader/index.ts","./src/uploader/utils.ts","./src/utils/checkpoint.ts","./src/utils/env.ts","./src/utils/exec.ts","./src/utils/file-tree.ts","./src/utils/file.ts","./src/utils/git.ts","./src/utils/html.ts","./src/utils/index.ts","./src/utils/pw-test.ts","./src/utils/repo-tree.ts","./src/utils/slug.ts","./src/utils/string.ts"],"version":"5.8.3"}
|