@empiricalrun/test-gen 0.74.2 → 0.76.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 +37 -0
- package/dist/agent/base/index.d.ts +43 -0
- package/dist/agent/base/index.d.ts.map +1 -0
- package/dist/agent/base/index.js +106 -0
- package/dist/agent/chat/agent-loop.d.ts +7 -7
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +5 -18
- package/dist/agent/chat/exports.d.ts +6 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +9 -8
- package/dist/agent/chat/index.d.ts +6 -10
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +130 -200
- package/dist/agent/chat/prompt/index.d.ts +5 -4
- package/dist/agent/chat/prompt/index.d.ts.map +1 -1
- package/dist/agent/chat/prompt/index.js +79 -68
- package/dist/agent/chat/state.d.ts +3 -5
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +2 -10
- package/dist/agent/chat/utils.d.ts +2 -4
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +2 -16
- package/dist/agent/cli.d.ts +11 -0
- package/dist/agent/cli.d.ts.map +1 -0
- package/dist/agent/cli.js +209 -0
- package/dist/agent/code-review/index.d.ts +7 -0
- package/dist/agent/code-review/index.d.ts.map +1 -0
- package/dist/agent/code-review/index.js +65 -0
- package/dist/agent/code-review/prompt.d.ts +1 -1
- package/dist/agent/code-review/prompt.d.ts.map +1 -1
- package/dist/agent/code-review/prompt.js +52 -16
- package/dist/agent/index.d.ts +10 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/triage/index.d.ts +7 -0
- package/dist/agent/triage/index.d.ts.map +1 -0
- package/dist/agent/triage/index.js +102 -0
- package/dist/agent/video-analysis/index.d.ts +7 -0
- package/dist/agent/video-analysis/index.d.ts.map +1 -0
- package/dist/agent/video-analysis/index.js +35 -0
- package/dist/bin/index.js +6 -6
- package/dist/file-info/adapters/github/index.d.ts +2 -2
- package/dist/file-info/adapters/github/index.d.ts.map +1 -1
- package/dist/file-info/adapters/github/index.js +4 -4
- package/dist/file-info/adapters/github/reader.d.ts +5 -10
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +168 -138
- package/dist/tools/create-pull-request/index.d.ts.map +1 -0
- package/dist/tools/{definitions/commit-and-create-pr.js → create-pull-request/index.js} +30 -1
- package/dist/tools/create-pull-request/utils.d.ts +21 -0
- package/dist/tools/create-pull-request/utils.d.ts.map +1 -0
- package/dist/tools/create-pull-request/utils.js +83 -0
- package/dist/tools/definitions/extract-frames-from-video.d.ts +39 -0
- package/dist/tools/definitions/extract-frames-from-video.d.ts.map +1 -0
- package/dist/tools/definitions/extract-frames-from-video.js +60 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts +28 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -1
- package/dist/tools/definitions/fetch-video-analysis.js +39 -4
- package/dist/tools/definitions/rename-file.d.ts +3 -0
- package/dist/tools/definitions/rename-file.d.ts.map +1 -0
- package/dist/tools/definitions/rename-file.js +23 -0
- package/dist/tools/delete-file/index.d.ts.map +1 -1
- package/dist/tools/delete-file/index.js +13 -1
- package/dist/tools/executor/index.d.ts +1 -1
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +22 -7
- package/dist/tools/executor/utils/checkpoint.d.ts +1 -3
- package/dist/tools/executor/utils/checkpoint.d.ts.map +1 -1
- package/dist/tools/executor/utils/checkpoint.js +17 -17
- package/dist/tools/executor/utils/git.d.ts +9 -1
- package/dist/tools/executor/utils/git.d.ts.map +1 -1
- package/dist/tools/executor/utils/git.js +72 -2
- package/dist/tools/extract-frames-from-video/index.d.ts +7 -0
- package/dist/tools/extract-frames-from-video/index.d.ts.map +1 -0
- package/dist/tools/extract-frames-from-video/index.js +145 -0
- package/dist/tools/{fetch-image → fetch-file}/index.d.ts +2 -2
- package/dist/tools/fetch-file/index.d.ts.map +1 -0
- package/dist/tools/fetch-file/index.js +97 -0
- package/dist/tools/fetch-session-diff/index.d.ts +3 -0
- package/dist/tools/fetch-session-diff/index.d.ts.map +1 -0
- package/dist/tools/fetch-session-diff/index.js +46 -0
- package/dist/tools/fetch-video-analysis/index.d.ts +3 -3
- package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/index.js +84 -24
- package/dist/tools/fetch-video-analysis/open-ai.d.ts +6 -0
- package/dist/tools/fetch-video-analysis/open-ai.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/open-ai.js +37 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts +9 -3
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/utils.js +64 -15
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +2 -2
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -1
- package/dist/tools/fetch-video-analysis/video-analysis.js +24 -8
- package/dist/tools/file-operations/create.d.ts.map +1 -1
- package/dist/tools/file-operations/create.js +6 -3
- package/dist/tools/file-operations/insert.d.ts.map +1 -1
- package/dist/tools/file-operations/insert.js +6 -3
- package/dist/tools/file-operations/replace.d.ts.map +1 -1
- package/dist/tools/file-operations/replace.js +6 -3
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -1
- package/dist/tools/file-operations/shared/git-helper.js +1 -1
- package/dist/tools/file-operations/view/index.d.ts +2 -5
- package/dist/tools/file-operations/view/index.d.ts.map +1 -1
- package/dist/tools/file-operations/view/index.js +2 -22
- package/dist/tools/index.d.ts +28 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +50 -22
- package/dist/tools/issues/update-issue.d.ts.map +1 -1
- package/dist/tools/issues/update-issue.js +16 -9
- package/dist/tools/merge-conflicts/index.js +1 -1
- package/dist/tools/rename-file/index.d.ts +3 -0
- package/dist/tools/rename-file/index.d.ts.map +1 -0
- package/dist/tools/rename-file/index.js +88 -0
- package/dist/tools/review-pull-request/index.d.ts +3 -0
- package/dist/tools/review-pull-request/index.d.ts.map +1 -0
- package/dist/tools/review-pull-request/index.js +103 -0
- package/dist/tools/run-test.js +2 -2
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -14
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/index.js +2 -1
- package/dist/tools/trace-dot-zip/types.d.ts +35 -3
- package/dist/tools/trace-dot-zip/types.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +7 -2
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -1
- package/dist/tools/trace-dot-zip/utils/network-trace.js +130 -10
- package/dist/tools/upgrade-packages/index.js +1 -1
- package/dist/tools/utils/urls.d.ts +5 -0
- package/dist/tools/utils/urls.d.ts.map +1 -0
- package/dist/tools/utils/urls.js +19 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -1
- package/dist/tools/view-failed-test-run-report/index.js +3 -15
- package/dist/utils/file.d.ts +1 -0
- package/dist/utils/file.d.ts.map +1 -1
- package/dist/utils/file.js +45 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/local-ffmpeg-client.d.ts +27 -0
- package/dist/utils/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/{tools/fetch-video-analysis → utils}/local-ffmpeg-client.js +117 -27
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/chat/utils/tool-calls.d.ts +0 -21
- package/dist/agent/chat/utils/tool-calls.d.ts.map +0 -1
- package/dist/agent/chat/utils/tool-calls.js +0 -64
- package/dist/tools/commit-and-create-pr/index.d.ts.map +0 -1
- package/dist/tools/commit-and-create-pr/index.js +0 -83
- package/dist/tools/definitions/commit-and-create-pr.d.ts +0 -3
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/fetch-image/index.d.ts.map +0 -1
- package/dist/tools/fetch-image/index.js +0 -63
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +0 -24
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +0 -1
- /package/dist/tools/{commit-and-create-pr → create-pull-request}/index.d.ts +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ToolDefinition } from "@empiricalrun/shared-types";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
export declare const extractFramesFromVideoSchema: z.ZodObject<{
|
|
4
|
+
videoUrl: z.ZodString;
|
|
5
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
fps: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
7
|
+
threshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
8
|
+
startTime: z.ZodOptional<z.ZodString>;
|
|
9
|
+
duration: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
startTime?: string | undefined;
|
|
12
|
+
threshold?: number | undefined;
|
|
13
|
+
fps?: number | undefined;
|
|
14
|
+
duration?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
startTime?: string | undefined;
|
|
17
|
+
threshold?: number | undefined;
|
|
18
|
+
fps?: number | undefined;
|
|
19
|
+
duration?: string | undefined;
|
|
20
|
+
}>>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
videoUrl: string;
|
|
23
|
+
params?: {
|
|
24
|
+
startTime?: string | undefined;
|
|
25
|
+
threshold?: number | undefined;
|
|
26
|
+
fps?: number | undefined;
|
|
27
|
+
duration?: string | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
videoUrl: string;
|
|
31
|
+
params?: {
|
|
32
|
+
startTime?: string | undefined;
|
|
33
|
+
threshold?: number | undefined;
|
|
34
|
+
fps?: number | undefined;
|
|
35
|
+
duration?: string | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const extractFramesFromVideo: ToolDefinition<z.infer<typeof extractFramesFromVideoSchema>>;
|
|
39
|
+
//# sourceMappingURL=extract-frames-from-video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-frames-from-video.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/extract-frames-from-video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCvC,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,cAAc,CACjD,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAoB7C,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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.extractFramesFromVideo = exports.extractFramesFromVideoSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.extractFramesFromVideoSchema = zod_1.default.object({
|
|
9
|
+
videoUrl: zod_1.default
|
|
10
|
+
.string()
|
|
11
|
+
.url("Must be a valid URL")
|
|
12
|
+
.describe("The URL of the video to extract frames from."),
|
|
13
|
+
params: zod_1.default
|
|
14
|
+
.object({
|
|
15
|
+
fps: zod_1.default
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(120)
|
|
20
|
+
.default(30)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Frames per second to extract from the video (default: 30)"),
|
|
23
|
+
threshold: zod_1.default
|
|
24
|
+
.number()
|
|
25
|
+
.min(0)
|
|
26
|
+
.max(0.5)
|
|
27
|
+
.default(0.001)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Deduplication threshold (fraction of pixels that may differ to consider frames identical). Lower = stricter. Default: 0.001"),
|
|
30
|
+
startTime: zod_1.default
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Start time in format MM:SS, example 1 min 32 sec -> 01:32"),
|
|
34
|
+
duration: zod_1.default
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("Duration time in format MM:SS, example 1 min 32 sec -> 01:32"),
|
|
38
|
+
})
|
|
39
|
+
.optional(),
|
|
40
|
+
});
|
|
41
|
+
exports.extractFramesFromVideo = {
|
|
42
|
+
schema: {
|
|
43
|
+
name: "extractFramesFromVideo",
|
|
44
|
+
description: `
|
|
45
|
+
Extracts frames from a video with precise timing control.
|
|
46
|
+
|
|
47
|
+
**Input:** Video URL (required), optional parameters for timing, frame rate, and output format
|
|
48
|
+
**Output:** PNG formate Frame URLs with metadata.
|
|
49
|
+
**Use when:** You need specific frames from a video segment, want to analyze particular time ranges, or need distinct frames fromthe video, or just need all frames from the video for further processing
|
|
50
|
+
|
|
51
|
+
**Key Features:**
|
|
52
|
+
- Time-based frame extraction (start time + duration)
|
|
53
|
+
- Configurable frame rate and deduplication threshold
|
|
54
|
+
- Frame metadata including timestamps and indices
|
|
55
|
+
- Memory-efficient processing for large videos`,
|
|
56
|
+
parameters: exports.extractFramesFromVideoSchema,
|
|
57
|
+
},
|
|
58
|
+
needsBrowser: false,
|
|
59
|
+
isInlineTool: false,
|
|
60
|
+
};
|
|
@@ -2,10 +2,38 @@ import { ToolDefinition } from "@empiricalrun/shared-types";
|
|
|
2
2
|
import z from "zod";
|
|
3
3
|
export declare const videoAnalysisSchema: z.ZodObject<{
|
|
4
4
|
videoUrl: z.ZodString;
|
|
5
|
+
params: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
fps: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
7
|
+
threshold: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
8
|
+
model: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
9
|
+
featureFlag: z.ZodOptional<z.ZodDefault<z.ZodEnum<["none", "send-all-frames", "separate-threshold", "ai-based-frames"]>>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
model?: string | undefined;
|
|
12
|
+
threshold?: number | undefined;
|
|
13
|
+
fps?: number | undefined;
|
|
14
|
+
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
model?: string | undefined;
|
|
17
|
+
threshold?: number | undefined;
|
|
18
|
+
fps?: number | undefined;
|
|
19
|
+
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
20
|
+
}>>;
|
|
5
21
|
}, "strip", z.ZodTypeAny, {
|
|
6
22
|
videoUrl: string;
|
|
23
|
+
params?: {
|
|
24
|
+
model?: string | undefined;
|
|
25
|
+
threshold?: number | undefined;
|
|
26
|
+
fps?: number | undefined;
|
|
27
|
+
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
28
|
+
} | undefined;
|
|
7
29
|
}, {
|
|
8
30
|
videoUrl: string;
|
|
31
|
+
params?: {
|
|
32
|
+
model?: string | undefined;
|
|
33
|
+
threshold?: number | undefined;
|
|
34
|
+
fps?: number | undefined;
|
|
35
|
+
featureFlag?: "none" | "send-all-frames" | "separate-threshold" | "ai-based-frames" | undefined;
|
|
36
|
+
} | undefined;
|
|
9
37
|
}>;
|
|
10
38
|
export declare const fetchVideoAnalysis: ToolDefinition<z.infer<typeof videoAnalysisSchema>>;
|
|
11
39
|
//# sourceMappingURL=fetch-video-analysis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-video-analysis.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/fetch-video-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"fetch-video-analysis.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/fetch-video-analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2C9B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAC7C,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAcpC,CAAC"}
|
|
@@ -10,15 +10,50 @@ exports.videoAnalysisSchema = zod_1.default.object({
|
|
|
10
10
|
.string()
|
|
11
11
|
.url("Must be a valid URL")
|
|
12
12
|
.describe("The URL of the video to analyze."),
|
|
13
|
+
params: zod_1.default
|
|
14
|
+
.object({
|
|
15
|
+
fps: zod_1.default
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(120)
|
|
20
|
+
.default(30)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Frames per second to extract from the video (default: 30)"),
|
|
23
|
+
threshold: zod_1.default
|
|
24
|
+
.number()
|
|
25
|
+
.min(0)
|
|
26
|
+
.max(0.5)
|
|
27
|
+
.default(0.001)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Deduplication threshold (fraction of pixels that may differ to consider frames identical). Lower = stricter. Default: 0.001"),
|
|
30
|
+
model: zod_1.default
|
|
31
|
+
.string()
|
|
32
|
+
.default("gemini-2.5-pro")
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Gemini LLM model identifier to use for analysis defaults to gemini-2.5-pro"),
|
|
35
|
+
featureFlag: zod_1.default
|
|
36
|
+
.enum([
|
|
37
|
+
"none",
|
|
38
|
+
"send-all-frames",
|
|
39
|
+
"separate-threshold",
|
|
40
|
+
"ai-based-frames",
|
|
41
|
+
])
|
|
42
|
+
.default("none")
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Feature flag to use for analysis defaults to none"),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
13
47
|
});
|
|
14
48
|
exports.fetchVideoAnalysis = {
|
|
15
49
|
schema: {
|
|
16
50
|
name: "fetchVideoAnalysis",
|
|
17
|
-
description: `
|
|
51
|
+
description: `
|
|
52
|
+
Analyzes Playwright test execution videos to identify test failures and UI issues.
|
|
18
53
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
54
|
+
**Input:** The video URL is mandatory (supports webm, mp4). DO NOT specify params UNLESS the user has explicitly asked for a specific param value to be tested.
|
|
55
|
+
**Output:** analysis summary of what happened during the test execution.
|
|
56
|
+
**Use when:** You have a failing test with a video recording and need to understand what went wrong`,
|
|
22
57
|
parameters: exports.videoAnalysisSchema,
|
|
23
58
|
},
|
|
24
59
|
needsBrowser: false,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename-file.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/rename-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAgBjE,eAAO,MAAM,cAAc,EAAE,cAU5B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renameFileTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const RenameFileInputSchema = zod_1.z.object({
|
|
6
|
+
oldPath: zod_1.z
|
|
7
|
+
.string()
|
|
8
|
+
.describe("The current path to the file to rename (relative to the repository root). For example, tests/foo.spec.ts"),
|
|
9
|
+
newPath: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.describe("The new path for the file (relative to the repository root). For example, tests/new-dir/bar.spec.ts"),
|
|
12
|
+
});
|
|
13
|
+
exports.renameFileTool = {
|
|
14
|
+
schema: {
|
|
15
|
+
name: "renameFile",
|
|
16
|
+
description: `Rename or move a file in the filesystem.
|
|
17
|
+
This tool will move the specified file from oldPath to newPath.
|
|
18
|
+
The operation can rename the file, move it to a different directory, or both.`,
|
|
19
|
+
parameters: RenameFileInputSchema,
|
|
20
|
+
},
|
|
21
|
+
needsBrowser: false,
|
|
22
|
+
isInlineTool: false,
|
|
23
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/delete-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/delete-file/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AASpC,eAAO,MAAM,cAAc,EAAE,IA4E5B,CAAC"}
|
|
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.deleteFileTool = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const promises_1 = require("fs/promises");
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const web_1 = require("../../bin/utils/platform/web");
|
|
9
11
|
const delete_file_1 = require("../definitions/delete-file");
|
|
10
12
|
const git_1 = require("../executor/utils/git");
|
|
11
13
|
exports.deleteFileTool = {
|
|
@@ -38,10 +40,12 @@ exports.deleteFileTool = {
|
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
await (0, promises_1.unlink)(filePath);
|
|
43
|
+
// Stage the deletion
|
|
44
|
+
(0, child_process_1.execSync)(`git add "${input.path}"`, { cwd: repoPath });
|
|
41
45
|
// Collect git patch artifact after deletion
|
|
42
46
|
if (collectArtifacts) {
|
|
43
47
|
try {
|
|
44
|
-
const gitPatch = (0, git_1.
|
|
48
|
+
const gitPatch = (0, git_1.getGitDiffStaged)(input.path, repoPath);
|
|
45
49
|
if (gitPatch.trim()) {
|
|
46
50
|
const patchArtifact = {
|
|
47
51
|
name: `${path_1.default.basename(input.path, path_1.default.extname(input.path))}_delete.patch`,
|
|
@@ -55,6 +59,14 @@ exports.deleteFileTool = {
|
|
|
55
59
|
console.warn("Failed to create git patch artifact:", error);
|
|
56
60
|
}
|
|
57
61
|
}
|
|
62
|
+
// Run TypeScript compilation check
|
|
63
|
+
const tscResult = await (0, web_1.runTypescriptCompiler)(repoPath);
|
|
64
|
+
if (!tscResult.success) {
|
|
65
|
+
return {
|
|
66
|
+
result: `File ${input.path} has been deleted. However, type checks are failing with errors:\n\n${tscResult.errors.join("\n")}`,
|
|
67
|
+
isError: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
58
70
|
return {
|
|
59
71
|
isError: false,
|
|
60
72
|
result: `Successfully deleted file: ${input.path}`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TraceClient } from "@empiricalrun/llm";
|
|
2
2
|
import { PendingToolCall, ToolResult } from "@empiricalrun/llm/chat";
|
|
3
|
-
import { ChatSessionInfo, IDashboardAPIClient, ToolExecute } from "@empiricalrun/shared-types";
|
|
3
|
+
import type { ChatSessionInfo, IDashboardAPIClient, ToolExecute } from "@empiricalrun/shared-types";
|
|
4
4
|
export declare class ToolExecutor {
|
|
5
5
|
toolExecutors: Record<string, ToolExecute>;
|
|
6
6
|
chatSession: ChatSessionInfo | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAEV,eAAe,EACf,mBAAmB,EACnB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AA8BpC,qBAAa,YAAY;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAM;IAChD,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEjC,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,YAAY,EACZ,oBAAyB,GAC1B,EAAE;QACD,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,mBAAmB,CAAC;QAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C;IAiDK,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CA8EnE"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ToolExecutor = void 0;
|
|
4
4
|
const artifacts_1 = require("../../artifacts");
|
|
5
|
-
const
|
|
5
|
+
const file_1 = require("../../utils/file");
|
|
6
|
+
const create_pull_request_1 = require("../create-pull-request");
|
|
6
7
|
const delete_file_1 = require("../delete-file");
|
|
7
8
|
const diagnosis_fetcher_1 = require("../diagnosis-fetcher");
|
|
8
9
|
const download_build_1 = require("../download-build");
|
|
9
|
-
const
|
|
10
|
+
const extract_frames_from_video_1 = require("../extract-frames-from-video");
|
|
11
|
+
const fetch_file_1 = require("../fetch-file");
|
|
10
12
|
const fetch_last_successful_test_run_1 = require("../fetch-last-successful-test-run");
|
|
13
|
+
const fetch_session_diff_1 = require("../fetch-session-diff");
|
|
11
14
|
const fetch_video_analysis_1 = require("../fetch-video-analysis");
|
|
12
15
|
const file_operations_1 = require("../file-operations");
|
|
13
16
|
const grep_1 = require("../grep");
|
|
@@ -15,6 +18,8 @@ const issues_1 = require("../issues");
|
|
|
15
18
|
const list_environments_1 = require("../list-environments");
|
|
16
19
|
const list_tests_and_projects_1 = require("../list-tests-and-projects");
|
|
17
20
|
const merge_conflicts_1 = require("../merge-conflicts");
|
|
21
|
+
const rename_file_1 = require("../rename-file");
|
|
22
|
+
const review_pull_request_1 = require("../review-pull-request");
|
|
18
23
|
const run_test_1 = require("../run-test");
|
|
19
24
|
const test_gen_browser_1 = require("../test-gen-browser");
|
|
20
25
|
const test_run_fetcher_1 = require("../test-run-fetcher");
|
|
@@ -47,22 +52,26 @@ class ToolExecutor {
|
|
|
47
52
|
test_run_fetcher_1.fetchTestRunReportTool,
|
|
48
53
|
diagnosis_fetcher_1.fetchDiagnosisReportTool,
|
|
49
54
|
test_gen_browser_1.generateTestWithBrowserAgent,
|
|
50
|
-
|
|
55
|
+
create_pull_request_1.createPullRequestTool,
|
|
51
56
|
merge_conflicts_1.mergeConflictsTool,
|
|
52
57
|
list_environments_1.listEnvironmentsTool,
|
|
53
58
|
issues_1.listIssuesTool,
|
|
54
59
|
issues_1.createIssueTool,
|
|
55
60
|
download_build_1.downloadBuildTool,
|
|
56
61
|
upgrade_packages_1.upgradePackagesTool,
|
|
57
|
-
|
|
62
|
+
fetch_file_1.fetchFileTool,
|
|
58
63
|
fetch_video_analysis_1.fetchVideoAnalysis,
|
|
59
64
|
delete_file_1.deleteFileTool,
|
|
65
|
+
rename_file_1.renameFileTool,
|
|
60
66
|
trace_dot_zip_1.traceDotZipTool,
|
|
61
67
|
view_failed_test_run_report_1.viewFailedTestRunReportTool,
|
|
62
68
|
issues_1.updateIssueTool,
|
|
63
69
|
fetch_last_successful_test_run_1.fetchLastSuccessfulTestRunTool,
|
|
64
70
|
triage_summary_1.sendTriageSummaryTool,
|
|
65
71
|
list_tests_and_projects_1.listProjectsTool,
|
|
72
|
+
extract_frames_from_video_1.extractFramesFromVideo,
|
|
73
|
+
fetch_session_diff_1.fetchSessionDiffTool,
|
|
74
|
+
review_pull_request_1.reviewPullRequestTool,
|
|
66
75
|
...file_operations_1.textEditorTools,
|
|
67
76
|
];
|
|
68
77
|
tools.forEach((tool) => {
|
|
@@ -87,8 +96,15 @@ class ToolExecutor {
|
|
|
87
96
|
input: toolCall.input,
|
|
88
97
|
});
|
|
89
98
|
const uploadArtifactsQueue = new artifacts_1.UploadArtifactsQueue(this.repoPath, toolCall.id);
|
|
90
|
-
const collectArtifactsFn = (artifactsInput) => {
|
|
91
|
-
uploadArtifactsQueue
|
|
99
|
+
const collectArtifactsFn = (artifactsInput, cleanUpDir) => {
|
|
100
|
+
uploadArtifactsQueue
|
|
101
|
+
.addTask(artifactsInput)
|
|
102
|
+
.then(() => {
|
|
103
|
+
if (cleanUpDir) {
|
|
104
|
+
void (0, file_1.safeCleanupDirectory)(cleanUpDir);
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
.catch((error) => {
|
|
92
108
|
console.error("Error collecting artifacts:", error);
|
|
93
109
|
});
|
|
94
110
|
};
|
|
@@ -129,7 +145,6 @@ class ToolExecutor {
|
|
|
129
145
|
}
|
|
130
146
|
}
|
|
131
147
|
(0, checkpoint_1.createCommitCheckpoint)({
|
|
132
|
-
toolCalls,
|
|
133
148
|
branchName: this.branchName,
|
|
134
149
|
repoPath: this.repoPath,
|
|
135
150
|
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function createCommitCheckpoint({ toolCalls, branchName, repoPath, }: {
|
|
3
|
-
toolCalls: PendingToolCall[];
|
|
1
|
+
export declare function createCommitCheckpoint({ branchName, repoPath, }: {
|
|
4
2
|
branchName: string;
|
|
5
3
|
repoPath: string;
|
|
6
4
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/checkpoint.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,QAsBA"}
|
|
@@ -3,24 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createCommitCheckpoint = createCommitCheckpoint;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const git_1 = require("./git");
|
|
6
|
-
function createCommitCheckpoint({
|
|
7
|
-
const filesChanged = (0, git_1.
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
commitMessage,
|
|
21
|
-
files: filesToCommit,
|
|
22
|
-
repoPath,
|
|
6
|
+
function createCommitCheckpoint({ branchName, repoPath, }) {
|
|
7
|
+
const filesChanged = (0, git_1.getStagedFiles)(repoPath);
|
|
8
|
+
if (filesChanged.length > 0) {
|
|
9
|
+
const commitMessages = filesChanged.map((change) => {
|
|
10
|
+
switch (change.type) {
|
|
11
|
+
case "added":
|
|
12
|
+
return `added ${change.path}`;
|
|
13
|
+
case "modified":
|
|
14
|
+
return `modified ${change.path}`;
|
|
15
|
+
case "removed":
|
|
16
|
+
return `removed ${change.path}`;
|
|
17
|
+
case "renamed":
|
|
18
|
+
return `renamed ${change.oldPath} → ${change.path}`;
|
|
19
|
+
}
|
|
23
20
|
});
|
|
21
|
+
const commitMessage = commitMessages.join(", ");
|
|
22
|
+
// Files are already staged by individual tools, just commit
|
|
23
|
+
(0, git_1.commitAsBotUser)(commitMessage, repoPath);
|
|
24
24
|
(0, child_process_1.execSync)(`git push origin ${branchName}`, { cwd: repoPath });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { IDashboardAPIClient } from "@empiricalrun/shared-types";
|
|
2
2
|
export declare function getGitDiff(filepath: string, cwd: string): string;
|
|
3
|
+
export declare function getGitDiffStaged(filepath: string, cwd: string): string;
|
|
4
|
+
export declare function getGitDiffForStagedOrUnstaged(filepath: string, cwd: string): string;
|
|
3
5
|
export declare function getGitDiffForNewFile(filepath: string, cwd: string): string;
|
|
4
6
|
export declare function checkoutBranch(branchName: string, cwd: string): Promise<void>;
|
|
5
7
|
export declare function commitAsBotUser(commitMessage: string, cwd: string): boolean;
|
|
6
8
|
export declare function getCurrentBranchName(repoPath: string): Promise<string>;
|
|
7
9
|
export declare function pullBranch(branchName: string, cwd: string): Promise<void>;
|
|
8
|
-
export declare function
|
|
10
|
+
export declare function stageAndCommitFilesAsBotUser({ commitMessage, files, repoPath, }: {
|
|
9
11
|
commitMessage: string;
|
|
10
12
|
files: string[];
|
|
11
13
|
repoPath: string;
|
|
12
14
|
}): void;
|
|
15
|
+
export type FileChange = {
|
|
16
|
+
type: "added" | "modified" | "removed" | "renamed";
|
|
17
|
+
path: string;
|
|
18
|
+
oldPath?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function getStagedFiles(cwd: string): FileChange[];
|
|
13
21
|
export declare function getFilesChanged(cwd: string): string[];
|
|
14
22
|
export declare function mergePullRequest({ repoName, prNumber, apiClient, }: {
|
|
15
23
|
repoName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAe1E;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAMnE;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,WAcjE;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,mBAO1D;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAE/D;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../src/tools/executor/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAaR;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAe1E;AAED,wBAAsB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAMnE;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,WAcjE;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,mBAO1D;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAE/D;AAED,wBAAgB,4BAA4B,CAAC,EAC3C,aAAa,EACb,KAAK,EACL,QAAQ,GACT,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,QAGA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CA6CxD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAUrD;AAED,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,CAAC;CAChC,oBA8BA"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGitDiff = getGitDiff;
|
|
4
|
+
exports.getGitDiffStaged = getGitDiffStaged;
|
|
5
|
+
exports.getGitDiffForStagedOrUnstaged = getGitDiffForStagedOrUnstaged;
|
|
4
6
|
exports.getGitDiffForNewFile = getGitDiffForNewFile;
|
|
5
7
|
exports.checkoutBranch = checkoutBranch;
|
|
6
8
|
exports.commitAsBotUser = commitAsBotUser;
|
|
7
9
|
exports.getCurrentBranchName = getCurrentBranchName;
|
|
8
10
|
exports.pullBranch = pullBranch;
|
|
9
|
-
exports.
|
|
11
|
+
exports.stageAndCommitFilesAsBotUser = stageAndCommitFilesAsBotUser;
|
|
12
|
+
exports.getStagedFiles = getStagedFiles;
|
|
10
13
|
exports.getFilesChanged = getFilesChanged;
|
|
11
14
|
exports.mergePullRequest = mergePullRequest;
|
|
12
15
|
const child_process_1 = require("child_process");
|
|
@@ -19,6 +22,27 @@ function getGitDiff(filepath, cwd) {
|
|
|
19
22
|
});
|
|
20
23
|
return diff;
|
|
21
24
|
}
|
|
25
|
+
function getGitDiffStaged(filepath, cwd) {
|
|
26
|
+
const diff = (0, child_process_1.execSync)(`git diff --cached ${filepath}`, {
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
cwd,
|
|
29
|
+
});
|
|
30
|
+
return diff;
|
|
31
|
+
}
|
|
32
|
+
function getGitDiffForStagedOrUnstaged(filepath, cwd) {
|
|
33
|
+
// First try to get staged changes (index vs HEAD)
|
|
34
|
+
try {
|
|
35
|
+
const stagedDiff = getGitDiffStaged(filepath, cwd);
|
|
36
|
+
if (stagedDiff.trim()) {
|
|
37
|
+
return stagedDiff;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Fall through to try unstaged diff
|
|
42
|
+
}
|
|
43
|
+
// If no staged changes, try unstaged changes (working dir vs index)
|
|
44
|
+
return getGitDiff(filepath, cwd);
|
|
45
|
+
}
|
|
22
46
|
function getGitDiffForNewFile(filepath, cwd) {
|
|
23
47
|
try {
|
|
24
48
|
const diff = (0, child_process_1.execSync)(`git diff --no-index /dev/null ${filepath}`, {
|
|
@@ -67,10 +91,56 @@ async function getCurrentBranchName(repoPath) {
|
|
|
67
91
|
async function pullBranch(branchName, cwd) {
|
|
68
92
|
(0, child_process_1.execSync)(`git pull origin ${branchName}`, { cwd });
|
|
69
93
|
}
|
|
70
|
-
function
|
|
94
|
+
function stageAndCommitFilesAsBotUser({ commitMessage, files, repoPath, }) {
|
|
71
95
|
(0, child_process_1.execSync)(`git add ${files.join(" ")}`, { cwd: repoPath });
|
|
72
96
|
commitAsBotUser(commitMessage, repoPath);
|
|
73
97
|
}
|
|
98
|
+
function getStagedFiles(cwd) {
|
|
99
|
+
const output = (0, child_process_1.execSync)("git diff --cached --name-status", {
|
|
100
|
+
cwd,
|
|
101
|
+
}).toString();
|
|
102
|
+
const filesChanged = [];
|
|
103
|
+
output.split("\n").forEach((line) => {
|
|
104
|
+
const trimmed = line.trim();
|
|
105
|
+
if (!trimmed)
|
|
106
|
+
return;
|
|
107
|
+
const parts = trimmed.split("\t");
|
|
108
|
+
if (parts.length < 2)
|
|
109
|
+
return;
|
|
110
|
+
const status = parts[0];
|
|
111
|
+
const filePath = parts[1];
|
|
112
|
+
if (status.startsWith("R")) {
|
|
113
|
+
// Handle rename: "R100 old_file new_file"
|
|
114
|
+
const newFilePath = parts[2];
|
|
115
|
+
if (newFilePath) {
|
|
116
|
+
filesChanged.push({
|
|
117
|
+
type: "renamed",
|
|
118
|
+
path: newFilePath,
|
|
119
|
+
oldPath: filePath,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else if (status === "A") {
|
|
124
|
+
filesChanged.push({
|
|
125
|
+
type: "added",
|
|
126
|
+
path: filePath,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (status === "M") {
|
|
130
|
+
filesChanged.push({
|
|
131
|
+
type: "modified",
|
|
132
|
+
path: filePath,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else if (status === "D") {
|
|
136
|
+
filesChanged.push({
|
|
137
|
+
type: "removed",
|
|
138
|
+
path: filePath,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return filesChanged;
|
|
143
|
+
}
|
|
74
144
|
function getFilesChanged(cwd) {
|
|
75
145
|
const output = (0, child_process_1.execSync)("git status --porcelain --untracked-files", {
|
|
76
146
|
cwd,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tool } from "@empiricalrun/shared-types";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import { type extractFramesFromVideoSchema } from "../definitions/extract-frames-from-video";
|
|
4
|
+
type ExtractFramesInput = z.infer<typeof extractFramesFromVideoSchema>;
|
|
5
|
+
export declare const extractFramesFromVideo: Tool<ExtractFramesInput>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/extract-frames-from-video/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAElD,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AA0EvE,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,kBAAkB,CAkH3D,CAAC"}
|