@empiricalrun/test-gen 0.53.7 → 0.53.8

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,11 @@
1
1
  # @empiricalrun/test-gen
2
2
 
3
+ ## 0.53.8
4
+
5
+ ### Patch Changes
6
+
7
+ - ba5422f: fix: push intermediate file system changes to remote branch for chat agent
8
+
3
9
  ## 0.53.7
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAgBhE,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,iBAoFA;AA+BD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA8BA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/chat/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAgBhE,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,iBAoFA;AAqBD,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,aAAa,GACd,EAAE;IACD,aAAa,EAAE,mBAAmB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,iBA+BA"}
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runChatAgentForDashboard = exports.runChatAgentForCLI = void 0;
4
4
  const llm_1 = require("@empiricalrun/llm");
5
- const child_process_1 = require("child_process");
6
5
  const picocolors_1 = require("picocolors");
7
6
  const human_in_the_loop_1 = require("../../human-in-the-loop");
7
+ const git_1 = require("../../utils/git");
8
8
  const agent_loop_1 = require("./agent-loop");
9
9
  const model_1 = require("./model");
10
10
  const state_1 = require("./state");
@@ -112,21 +112,11 @@ async function getChatSessionFromDashboard(chatSessionId) {
112
112
  const data = await response.json();
113
113
  return data.data.chat_session;
114
114
  }
115
- async function checkoutBranch(branchName) {
116
- // TODO: This assumes repoDir is process.cwd()
117
- try {
118
- (0, child_process_1.execSync)(`git checkout ${branchName}`);
119
- }
120
- catch (e) {
121
- // If branch doesn't exist, create it
122
- (0, child_process_1.execSync)(`git checkout -b ${branchName}`);
123
- }
124
- }
125
115
  async function runChatAgentForDashboard({ chatSessionId, selectedModel, }) {
126
116
  const chatSession = await getChatSessionFromDashboard(chatSessionId);
127
117
  const chatState = chatSession.chat_state;
128
118
  const branchName = chatSession.branch_name;
129
- await checkoutBranch(branchName);
119
+ await (0, git_1.checkoutBranch)(branchName);
130
120
  let chatModel = (0, model_1.createChatModel)(chatState.messages, selectedModel);
131
121
  let reporterFunc = async (chatState, latest) => {
132
122
  const response = await fetch(`${DASHBOARD_DOMAIN}/api/chat-sessions/${chatSessionId}`, {
@@ -148,5 +138,6 @@ async function runChatAgentForDashboard({ chatSessionId, selectedModel, }) {
148
138
  selectedModel,
149
139
  reporter: reporterFunc,
150
140
  });
141
+ await (0, git_1.commitLocalAndPushBranchToRemote)(branchName);
151
142
  }
152
143
  exports.runChatAgentForDashboard = runChatAgentForDashboard;
@@ -1 +1 @@
1
- {"version":3,"file":"commit-and-create-pr.d.ts","sourceRoot":"","sources":["../../src/tools/commit-and-create-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAUnD,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAiB1D;AAiBD,eAAO,MAAM,wBAAwB,EAAE,IAqFtC,CAAC"}
1
+ {"version":3,"file":"commit-and-create-pr.d.ts","sourceRoot":"","sources":["../../src/tools/commit-and-create-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAQnD,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAiB1D;AAiBD,eAAO,MAAM,wBAAwB,EAAE,IAkFtC,CAAC"}
@@ -7,9 +7,8 @@ exports.commitAndPushChangesTool = exports.parseGitHubUrl = void 0;
7
7
  const child_process_1 = require("child_process");
8
8
  const crypto_1 = __importDefault(require("crypto"));
9
9
  const zod_1 = require("zod");
10
+ const git_1 = require("../utils/git");
10
11
  const utils_1 = require("./utils");
11
- const GIT_USER_NAME = "empiricalrun[bot]";
12
- const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
13
12
  function parseGitHubUrl(url) {
14
13
  const githubIndex = url.indexOf("github.com");
15
14
  if (githubIndex === -1) {
@@ -67,8 +66,7 @@ Returns the URL of the created or updated pull request.`,
67
66
  for (const file of modifiedFiles) {
68
67
  (0, child_process_1.execSync)(`git add "${file}"`);
69
68
  }
70
- // Use -c flag to set config just for this commit
71
- (0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessage} [skip ci]"`);
69
+ await (0, git_1.commitAsBotUser)(commitMessage);
72
70
  const repoUrl = (0, child_process_1.execSync)("git config --get remote.origin.url")
73
71
  .toString()
74
72
  .trim();
@@ -1,2 +1,5 @@
1
1
  export declare function getGitDiff(filepath: string): string;
2
+ export declare function checkoutBranch(branchName: string): Promise<void>;
3
+ export declare function commitAsBotUser(commitMessage: string): Promise<void>;
4
+ export declare function commitLocalAndPushBranchToRemote(branchName: string): Promise<void>;
2
5
  //# sourceMappingURL=git.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKnD"}
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"}
package/dist/utils/git.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGitDiff = void 0;
3
+ exports.commitLocalAndPushBranchToRemote = exports.commitAsBotUser = exports.checkoutBranch = exports.getGitDiff = void 0;
4
4
  const child_process_1 = require("child_process");
5
+ const GIT_USER_NAME = "empiricalrun[bot]";
6
+ const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
5
7
  function getGitDiff(filepath) {
6
8
  const diff = (0, child_process_1.execSync)(`git diff ${filepath}`, {
7
9
  encoding: "utf-8",
@@ -9,3 +11,29 @@ function getGitDiff(filepath) {
9
11
  return diff;
10
12
  }
11
13
  exports.getGitDiff = getGitDiff;
14
+ async function checkoutBranch(branchName) {
15
+ // TODO: This assumes repoDir is process.cwd()
16
+ try {
17
+ (0, child_process_1.execSync)(`git checkout ${branchName}`);
18
+ }
19
+ catch (e) {
20
+ // If branch doesn't exist, create it
21
+ (0, child_process_1.execSync)(`git checkout -b ${branchName}`);
22
+ }
23
+ }
24
+ exports.checkoutBranch = checkoutBranch;
25
+ async function commitAsBotUser(commitMessage) {
26
+ const status = (0, child_process_1.execSync)("git status --porcelain", { encoding: "utf-8" });
27
+ if (!status) {
28
+ return; // Nothing to commit
29
+ }
30
+ const commitMessageWithSkipCi = `${commitMessage} [skip ci]`;
31
+ (0, child_process_1.execSync)(`git -c user.name="${GIT_USER_NAME}" -c user.email="${GIT_USER_EMAIL}" commit -m "${commitMessageWithSkipCi}"`);
32
+ }
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.53.7",
3
+ "version": "0.53.8",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -56,9 +56,9 @@
56
56
  "tsx": "^4.16.2",
57
57
  "typescript": "^5.3.3",
58
58
  "zod": "^3.23.8",
59
- "@empiricalrun/llm": "^0.14.5",
60
59
  "@empiricalrun/r2-uploader": "^0.3.8",
61
- "@empiricalrun/test-run": "^0.7.6"
60
+ "@empiricalrun/test-run": "^0.7.6",
61
+ "@empiricalrun/llm": "^0.14.5"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@playwright/test": "1.47.1",