@empiricalrun/test-gen 0.53.6 → 0.53.7

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.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 4f14f11: fix: handle git remote urls that have access tokens in them
8
+
3
9
  ## 0.53.6
4
10
 
5
11
  ### Patch Changes
@@ -1,3 +1,9 @@
1
1
  import type { Tool } from "@empiricalrun/llm/chat";
2
+ interface GitHubRepoInfo {
3
+ owner: string;
4
+ repo: string;
5
+ }
6
+ export declare function parseGitHubUrl(url: string): GitHubRepoInfo;
2
7
  export declare const commitAndPushChangesTool: Tool;
8
+ export {};
3
9
  //# sourceMappingURL=commit-and-create-pr.d.ts.map
@@ -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;AAyBnD,eAAO,MAAM,wBAAwB,EAAE,IAwFtC,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;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"}
@@ -3,13 +3,28 @@ 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.commitAndPushChangesTool = void 0;
6
+ 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
10
  const utils_1 = require("./utils");
11
11
  const GIT_USER_NAME = "empiricalrun[bot]";
12
12
  const GIT_USER_EMAIL = "180257021+empiricalrun[bot]@users.noreply.github.com";
13
+ function parseGitHubUrl(url) {
14
+ const githubIndex = url.indexOf("github.com");
15
+ if (githubIndex === -1) {
16
+ throw new Error("Invalid GitHub repository URL");
17
+ }
18
+ const [owner, repo] = url
19
+ .substring(githubIndex + "github.com/".length)
20
+ .replace(".git", "")
21
+ .split("/");
22
+ if (!owner || !repo) {
23
+ throw new Error("Invalid GitHub repository URL format - missing owner or repo");
24
+ }
25
+ return { owner, repo };
26
+ }
27
+ exports.parseGitHubUrl = parseGitHubUrl;
13
28
  const CommitAndPushChangesSchema = zod_1.z.object({
14
29
  commitMessage: zod_1.z
15
30
  .string()
@@ -57,10 +72,7 @@ Returns the URL of the created or updated pull request.`,
57
72
  const repoUrl = (0, child_process_1.execSync)("git config --get remote.origin.url")
58
73
  .toString()
59
74
  .trim();
60
- const [owner, repo] = repoUrl
61
- .replace("https://github.com/", "")
62
- .replace(".git", "")
63
- .split("/");
75
+ const { owner, repo } = parseGitHubUrl(repoUrl);
64
76
  const existingPRs = (await (0, utils_1.callGitHubProxy)({
65
77
  method: "GET",
66
78
  url: `https://api.github.com/repos/${owner}/${repo}/pulls`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.53.6",
3
+ "version": "0.53.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"