@empiricalrun/test-gen 0.57.1 → 0.57.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.57.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 8d69fe6: fix: use headless browser and authenticate project api key for all tool calls
8
+ - d7c9b1d: fix: ripgrep tool is breaking on regex inputs
9
+ - ca91d3c: fix: dont commit backup files in dashboard flow
10
+
3
11
  ## 0.57.1
4
12
 
5
13
  ### Patch Changes
@@ -38,7 +38,7 @@ async function generateTestsUsingMasterAgent({ testFilePath, filePathToUpdate, p
38
38
  const isTestRunTriggeredForTeardown = teardownFileRegex.test(testFilePath);
39
39
  const teardowns = new utils_1.TeardownManager(testsDirectory);
40
40
  let removeListeners;
41
- const command = `npx playwright test ${testFilePath} --retries 0 --project ${project} --timeout 0 --headed`;
41
+ const command = `npx playwright test ${testFilePath} --retries 0 --project ${project} --timeout 0`;
42
42
  let isError = false;
43
43
  let error = "";
44
44
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAiBhE,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBA8FA;AA0BD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA+CA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAiBhE,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,aAAa,EACb,oBAAoB,GACrB,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,iBA8FA;AA0BD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA8CA"}
@@ -160,6 +160,5 @@ async function runChatAgentForDashboard({ chatSessionId, selectedModel, }) {
160
160
  trace,
161
161
  toolCallService,
162
162
  });
163
- await (0, git_1.commitLocalAndPushBranchToRemote)(branchName);
164
163
  }
165
164
  exports.runChatAgentForDashboard = runChatAgentForDashboard;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,wBAAwB,CAAC;AAqH/D,eAAO,MAAM,QAAQ,EAAE,IAkBtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,wBAAwB,CAAC;AAyH/D,eAAO,MAAM,QAAQ,EAAE,IAmBtB,CAAC"}
@@ -11,7 +11,9 @@ const zod_1 = require("zod");
11
11
  const repo_tree_1 = require("../../utils/repo-tree");
12
12
  const ripgrep_1 = require("./ripgrep");
13
13
  const GrepInputSchema = zod_1.z.object({
14
- pattern: zod_1.z.string().describe("The pattern to search for"),
14
+ pattern: zod_1.z
15
+ .string()
16
+ .describe("The pattern to search for. Case insensitive and regex patterns are not supported"),
15
17
  directory: zod_1.z
16
18
  .string()
17
19
  .optional()
@@ -113,12 +115,14 @@ All paths are relative to the current working directory.`;
113
115
  exports.grepTool = {
114
116
  schema: {
115
117
  name: "grep",
116
- description: "Search for a pattern in files using grep (case insensitive)",
118
+ description: `Search for a pattern in files using ripgrep.
119
+ If ripgrep is not available, it will fall back to using system grep.
120
+
121
+ Search is case insensitive and regex patterns are not supported.`,
117
122
  parameters: GrepInputSchema,
118
123
  },
119
124
  execute: async (input) => {
120
- const isAvailable = await (0, ripgrep_1.isRgAvailable)();
121
- if (isAvailable) {
125
+ if ((0, ripgrep_1.isRgAvailable)()) {
122
126
  return usingRipgrep(input);
123
127
  }
124
128
  else {
@@ -1,5 +1,5 @@
1
1
  import { Match, Options } from "./types";
2
2
  export * from "./types";
3
- export declare function isRgAvailable(): Promise<unknown>;
4
- export declare function ripgrep(cwd: string, options: Options): Promise<Array<Match>>;
3
+ export declare function isRgAvailable(): boolean;
4
+ export declare function ripgrep(cwd: string, options: Options): Array<Match>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/grep/ripgrep/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAEvD,cAAc,SAAS,CAAC;AAcxB,wBAAgB,aAAa,qBAY5B;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CA8C5E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/grep/ripgrep/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAEvD,cAAc,SAAS,CAAC;AAcxB,wBAAgB,aAAa,YAS5B;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAiDnE"}
@@ -30,26 +30,23 @@ function formatResults(stdout) {
30
30
  .map((jsonLine) => jsonLine.data);
31
31
  }
32
32
  function isRgAvailable() {
33
- return new Promise((resolve) => {
33
+ try {
34
34
  // Use 'where' on Windows and 'which' on Unix-like systems
35
35
  const command = process.platform === "win32" ? "where rg" : "which rg";
36
- (0, child_process_1.exec)(command, (error) => {
37
- if (error) {
38
- resolve(false);
39
- }
40
- else {
41
- resolve(true);
42
- }
43
- });
44
- });
36
+ (0, child_process_1.execSync)(command);
37
+ return true;
38
+ }
39
+ catch (error) {
40
+ return false;
41
+ }
45
42
  }
46
43
  exports.isRgAvailable = isRgAvailable;
47
44
  function ripgrep(cwd, options) {
48
45
  if (!cwd) {
49
- return Promise.reject(new Error("No `cwd` provided"));
46
+ throw new Error("No `cwd` provided");
50
47
  }
51
- if (arguments.length === 1) {
52
- return Promise.reject(new Error("No search term provided"));
48
+ if (!options) {
49
+ throw new Error("No search term provided");
53
50
  }
54
51
  let execString = "rg --json -i";
55
52
  if ("regex" in options) {
@@ -76,15 +73,18 @@ function ripgrep(cwd, options) {
76
73
  }
77
74
  // https://github.com/alexlafroscia/ripgrep-js/pull/175/files
78
75
  execString += ` -- ${cwd}`;
79
- return new Promise(function (resolve, reject) {
80
- (0, child_process_1.exec)(execString, { cwd }, (error, stdout, stderr) => {
81
- if (!error || (error && stderr === "")) {
82
- resolve(formatResults(stdout));
83
- }
84
- else {
85
- reject(new types_1.RipGrepError(error, stderr));
86
- }
87
- });
88
- });
76
+ try {
77
+ const stdout = (0, child_process_1.execSync)(execString, { cwd }).toString();
78
+ return formatResults(stdout);
79
+ }
80
+ catch (error) {
81
+ if (error.status === 1) {
82
+ // Exit code is 1 for no results found
83
+ // Ref: https://github.com/BurntSushi/ripgrep/issues/948
84
+ return [];
85
+ }
86
+ const stderr = error.stderr?.toString() || "";
87
+ throw new types_1.RipGrepError(error, stderr);
88
+ }
89
89
  }
90
90
  exports.ripgrep = ripgrep;
@@ -36,7 +36,7 @@ export type RipGrepJsonMatch = {
36
36
  };
37
37
  export type Match = RipGrepJsonMatch["data"];
38
38
  export declare class RipGrepError {
39
- private error;
39
+ error: ExecException;
40
40
  stderr: string;
41
41
  constructor(error: ExecException, stderr: string);
42
42
  get message(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/tools/grep/ripgrep/types.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAE/D,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC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AU,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;KACxC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE7C,qBAAa,YAAY;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;gBAEH,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM;IAKhD,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF"}
@@ -12,7 +12,7 @@ async function createCheckpoint(toolCalls, branchName) {
12
12
  }));
13
13
  const filesToCommit = toolsWithUpdatedFiles.map((tool) => tool.path);
14
14
  if (toolsWithUpdatedFiles.length > 0) {
15
- let commitMessage = `Toolcall Checkpoint: ${toolsWithUpdatedFiles.map((tool) => `${tool.name} on ${tool.path}`).join(", ")}`;
15
+ let commitMessage = `${toolsWithUpdatedFiles.map((tool) => `${tool.name} on ${tool.path}`).join(", ")}`;
16
16
  await (0, git_1.commitFilesAndPushBranch)(commitMessage, branchName, filesToCommit);
17
17
  }
18
18
  }
@@ -1,7 +1,6 @@
1
1
  export declare function getGitDiff(filepath: string): string;
2
2
  export declare function checkoutBranch(branchName: string): Promise<void>;
3
3
  export declare function commitAsBotUser(commitMessage: string): Promise<void>;
4
- export declare function commitLocalAndPushBranchToRemote(branchName: string): Promise<void>;
5
4
  export declare function getCurrentBranchName(): Promise<string>;
6
5
  export declare function pullBranch(branchName: string): Promise<void>;
7
6
  export declare function commitFilesAndPushBranch(commitMessage: string, branchName: string, files: string[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,iBAQtD;AAED,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,iBAS1D;AAED,wBAAsB,gCAAgC,CAAC,UAAU,EAAE,MAAM,iBAIxE;AAED,wBAAsB,oBAAoB,oBAGzC;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,iBAElD;AAED,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,iBAOhB;AAED,wBAAsB,eAAe,sBAQpC"}
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,iBAQtD;AAED,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,iBAS1D;AAED,wBAAsB,oBAAoB,oBAGzC;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,iBAElD;AAED,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE,iBAKhB;AAED,wBAAsB,eAAe,sBAQpC"}
package/dist/utils/git.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFilesChanged = exports.commitFilesAndPushBranch = exports.pullBranch = exports.getCurrentBranchName = exports.commitLocalAndPushBranchToRemote = exports.commitAsBotUser = exports.checkoutBranch = exports.getGitDiff = void 0;
3
+ exports.getFilesChanged = exports.commitFilesAndPushBranch = exports.pullBranch = exports.getCurrentBranchName = exports.commitAsBotUser = exports.checkoutBranch = exports.getGitDiff = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const GIT_USER_NAME = "empiricalrun[bot]";
6
6
  const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
@@ -31,12 +31,6 @@ async function commitAsBotUser(commitMessage) {
31
31
  (0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`);
32
32
  }
33
33
  exports.commitAsBotUser = commitAsBotUser;
34
- async function commitLocalAndPushBranchToRemote(branchName) {
35
- (0, child_process_1.execSync)(`git add .`);
36
- await commitAsBotUser("Intermediate commit from @empiricalrun/test-gen");
37
- (0, child_process_1.execSync)(`git push origin ${branchName}`);
38
- }
39
- exports.commitLocalAndPushBranchToRemote = commitLocalAndPushBranchToRemote;
40
34
  async function getCurrentBranchName() {
41
35
  const branchName = (0, child_process_1.execSync)("git branch --show-current").toString().trim();
42
36
  return branchName;
@@ -48,7 +42,7 @@ async function pullBranch(branchName) {
48
42
  exports.pullBranch = pullBranch;
49
43
  async function commitFilesAndPushBranch(commitMessage, branchName, files) {
50
44
  (0, child_process_1.execSync)(`git add ${files.join(" ")}`);
51
- await commitAsBotUser(commitMessage || "Intermediate commit from @empiricalrun/test-gen");
45
+ await commitAsBotUser(commitMessage);
52
46
  (0, child_process_1.execSync)(`git push origin ${branchName}`);
53
47
  }
54
48
  exports.commitFilesAndPushBranch = commitFilesAndPushBranch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.57.1",
3
+ "version": "0.57.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"