@empiricalrun/test-gen 0.42.0 → 0.42.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/actions/fill.d.ts.map +1 -1
- package/dist/actions/fill.js +5 -3
- package/dist/agent/codegen/repo-edit.d.ts +3 -1
- package/dist/agent/codegen/repo-edit.d.ts.map +1 -1
- package/dist/agent/codegen/repo-edit.js +2 -1
- package/dist/agent/codegen/run.d.ts.map +1 -1
- package/dist/agent/codegen/run.js +1 -0
- package/dist/bin/index.js +1 -0
- package/dist/bin/utils/context.d.ts +1 -0
- package/dist/bin/utils/context.d.ts.map +1 -1
- package/dist/bin/utils/context.js +11 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.42.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 55a70ee: fix: revert to old version of playwright
|
|
8
|
+
- Updated dependencies [55a70ee]
|
|
9
|
+
- @empiricalrun/reporter@0.22.1
|
|
10
|
+
|
|
11
|
+
## 0.42.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 87743d9: fix: fill action in case of multi page and context
|
|
16
|
+
|
|
17
|
+
## 0.42.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- ce2b8c7: fix: filter allowed file extensions for repo agent input
|
|
22
|
+
|
|
3
23
|
## 0.42.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,yBAgGjC,CAAC"}
|
package/dist/actions/fill.js
CHANGED
|
@@ -12,12 +12,14 @@ const fillActionGenerator = (page, options) => {
|
|
|
12
12
|
execute: async ({ args }) => {
|
|
13
13
|
const css = args.css_selector;
|
|
14
14
|
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(css, args.xpath, page.pwPageInstance, args?.elementAnnotation);
|
|
15
|
-
const
|
|
15
|
+
const concernedStateVariable = options?.stateVariables[args.variable_name]
|
|
16
|
+
? args.variable_name
|
|
17
|
+
: "";
|
|
16
18
|
const testCaseLine = `${locator}.fill(${options?.stateVariables[args.variable_name]
|
|
17
19
|
? args.variable_name
|
|
18
20
|
: `"${args.text}"`})`;
|
|
19
|
-
const exec = new Function("page", ...
|
|
20
|
-
await exec(page.pwPageInstance,
|
|
21
|
+
const exec = new Function("page", ...(concernedStateVariable ? [concernedStateVariable] : []), `return page.${testCaseLine}`);
|
|
22
|
+
await exec(page.pwPageInstance, options?.stateVariables[args.variable_name]);
|
|
21
23
|
return {
|
|
22
24
|
locator,
|
|
23
25
|
testCaseLine,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { ChatCompletionMessageParam } from "openai/resources/index.mjs";
|
|
3
|
+
import { CustomLogger } from "../../bin/logger";
|
|
3
4
|
export declare function generateCodeUsingRepoAgent({ task, trace, repoFiles, }: {
|
|
4
5
|
trace?: TraceClient;
|
|
5
6
|
task: string;
|
|
@@ -14,9 +15,10 @@ export declare function generateCodeUsingRepoAgent({ task, trace, repoFiles, }:
|
|
|
14
15
|
reason: string | undefined;
|
|
15
16
|
}[];
|
|
16
17
|
}>;
|
|
17
|
-
export declare function repoEditAgent({ trace, task, }: {
|
|
18
|
+
export declare function repoEditAgent({ trace, task, logger, }: {
|
|
18
19
|
trace?: TraceClient;
|
|
19
20
|
task: string;
|
|
21
|
+
logger?: CustomLogger;
|
|
20
22
|
}): Promise<{
|
|
21
23
|
prompt: ChatCompletionMessageParam[];
|
|
22
24
|
agentResponse: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"repo-edit.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/repo-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAahD,wBAAsB,0BAA0B,CAAC,EAC/C,IAAI,EACJ,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE;QACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,EAAE,CAAC;CACL,CAAC,CA6GD;AAED,wBAAsB,aAAa,CAAC,EAClC,KAAK,EACL,IAAI,EACJ,MAAM,GACP,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE;QACX,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;KAC5B,EAAE,CAAC;CACL,CAAC,CAkED"}
|
|
@@ -122,9 +122,10 @@ Task: ${task}
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
exports.generateCodeUsingRepoAgent = generateCodeUsingRepoAgent;
|
|
125
|
-
async function repoEditAgent({ trace, task, }) {
|
|
125
|
+
async function repoEditAgent({ trace, task, logger, }) {
|
|
126
126
|
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
127
127
|
void testgenUpdatesReporter.sendMessage(`Updating test code as per the task. \n View [trace](${trace?.getTraceUrl()})`);
|
|
128
|
+
logger?.log(`Starting repo agent: ${trace?.getTraceUrl()}`);
|
|
128
129
|
const { prompt: repoFiles } = await (0, context_1.generateTxtForRepository)();
|
|
129
130
|
const repoAgentOutput = await generateCodeUsingRepoAgent({
|
|
130
131
|
task,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAK7D,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAK7D,wBAAsB,YAAY,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAmC5B"}
|
|
@@ -41,6 +41,7 @@ async function generateTest(testCase, file, options, trace) {
|
|
|
41
41
|
const repoAgentResponse = await (0, repo_edit_1.repoEditAgent)({
|
|
42
42
|
trace,
|
|
43
43
|
task: (0, utils_1.getTaskForCreateTest)({ testCase, file }),
|
|
44
|
+
logger,
|
|
44
45
|
});
|
|
45
46
|
createTestSpan?.end({ output: repoAgentResponse.fileChanges });
|
|
46
47
|
await (0, llm_1.flushAllTraces)();
|
package/dist/bin/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export declare function contextForGeneration(file?: string): Promise<{
|
|
|
5
5
|
nonSpecFilePrompt: string | undefined;
|
|
6
6
|
testFileContent: string;
|
|
7
7
|
}>;
|
|
8
|
+
export declare function createRepoEditFilter(): Promise<(filePath: string) => boolean>;
|
|
8
9
|
export declare function generateTxtForRepository(): Promise<{
|
|
9
10
|
prompt: string | undefined;
|
|
10
11
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/context.ts"],"names":[],"mappings":"AAQA,wBAAsB,yBAAyB,2CAe9C;AAED,wBAAsB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM;;;;;GAQvD;AAED,wBAAsB,wBAAwB;;GAK7C;AAED,wBAAsB,iBAAiB,oBAYtC"}
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/bin/utils/context.ts"],"names":[],"mappings":"AAQA,wBAAsB,yBAAyB,2CAe9C;AAED,wBAAsB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM;;;;;GAQvD;AAED,wBAAsB,oBAAoB,uBAItB,MAAM,cAMzB;AAED,wBAAsB,wBAAwB;;GAK7C;AAED,wBAAsB,iBAAiB,oBAYtC"}
|
|
@@ -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.fetchAppKnowledge = exports.generateTxtForRepository = exports.contextForGeneration = exports.createGitIgnoreFileFilter = void 0;
|
|
6
|
+
exports.fetchAppKnowledge = exports.generateTxtForRepository = exports.createRepoEditFilter = exports.contextForGeneration = exports.createGitIgnoreFileFilter = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const ignore_1 = __importDefault(require("ignore"));
|
|
9
9
|
const fs_1 = require("./fs");
|
|
@@ -34,8 +34,17 @@ async function contextForGeneration(file) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
exports.contextForGeneration = contextForGeneration;
|
|
37
|
+
async function createRepoEditFilter() {
|
|
38
|
+
const allowedExtensions = /\.(ts|js|mjs|json|md)$/i;
|
|
39
|
+
const gitIgnoreFilter = await createGitIgnoreFileFilter();
|
|
40
|
+
return (filePath) => {
|
|
41
|
+
return (gitIgnoreFilter(filePath) &&
|
|
42
|
+
(fs_extra_1.default.statSync(filePath).isDirectory() || allowedExtensions.test(filePath)));
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.createRepoEditFilter = createRepoEditFilter;
|
|
37
46
|
async function generateTxtForRepository() {
|
|
38
|
-
const filter = await
|
|
47
|
+
const filter = await createRepoEditFilter();
|
|
39
48
|
return {
|
|
40
49
|
prompt: await (0, fs_1.generatePromptFromDirectory)(".", filter),
|
|
41
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"typescript": "^5.3.3",
|
|
74
74
|
"@empiricalrun/llm": "^0.9.29",
|
|
75
75
|
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
76
|
-
"@empiricalrun/reporter": "^0.22.
|
|
76
|
+
"@empiricalrun/reporter": "^0.22.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@playwright/test": "1.
|
|
79
|
+
"@playwright/test": "1.47.1",
|
|
80
80
|
"@types/detect-port": "^1.3.5",
|
|
81
81
|
"@types/express": "^4.17.21",
|
|
82
82
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@types/lodash.isequal": "^4.5.8",
|
|
85
85
|
"@types/md5": "^2.3.5",
|
|
86
86
|
"js-levenshtein": "^1.1.6",
|
|
87
|
-
"playwright": "1.
|
|
87
|
+
"playwright": "1.47.1"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"dev": "tsc --build --watch",
|