@alwaysmeticulous/debug-workspace 2.280.0 → 2.282.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/dist/__tests__/detect-snapshot-assets.spec.d.ts +1 -0
- package/dist/__tests__/detect-snapshot-assets.spec.js +49 -0
- package/dist/__tests__/detect-snapshot-assets.spec.js.map +1 -0
- package/dist/__tests__/extract-screenshot-dom-files.spec.js +7 -16
- package/dist/__tests__/extract-screenshot-dom-files.spec.js.map +1 -1
- package/dist/download-debug-data.js +49 -3
- package/dist/download-debug-data.js.map +1 -1
- package/dist/extract-screenshot-dom-files.d.ts +2 -3
- package/dist/extract-screenshot-dom-files.js +7 -16
- package/dist/extract-screenshot-dom-files.js.map +1 -1
- package/dist/generate-debug-workspace.d.ts +29 -3
- package/dist/generate-debug-workspace.js +100 -40
- package/dist/generate-debug-workspace.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/pipeline.js +3 -2
- package/dist/pipeline.js.map +1 -1
- package/dist/replay-walk.d.ts +0 -3
- package/dist/replay-walk.js +2 -2
- package/dist/replay-walk.js.map +1 -1
- package/dist/templates/CLAUDE.md +63 -70
- package/dist/templates/hooks/check-file-size.sh +0 -0
- package/dist/templates/hooks/load-context.sh +0 -0
- package/dist/templates/skills/debugging-diffs/SKILL.md +3 -1
- package/package.json +19 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3535bd4b-5cfe-5051-ac8d-3f4d0c4518ce")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const vitest_1 = require("vitest");
|
|
9
|
+
const debug_constants_1 = require("../debug-constants");
|
|
10
|
+
const generate_debug_workspace_1 = require("../generate-debug-workspace");
|
|
11
|
+
(0, vitest_1.describe)("detectSnapshotAssets", () => {
|
|
12
|
+
let workspace;
|
|
13
|
+
(0, vitest_1.beforeEach)(() => {
|
|
14
|
+
workspace = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), "met-detect-snapshot-"));
|
|
15
|
+
});
|
|
16
|
+
(0, vitest_1.afterEach)(() => {
|
|
17
|
+
(0, fs_1.rmSync)(workspace, { recursive: true, force: true });
|
|
18
|
+
});
|
|
19
|
+
const assetsDir = (role, replayId) => (0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", role, replayId, "snapshotted-assets");
|
|
20
|
+
(0, vitest_1.it)("returns false when the replays directory is missing", () => {
|
|
21
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
(0, vitest_1.it)("returns false when no snapshotted-assets directories exist", () => {
|
|
24
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", "head", "r1"), { recursive: true });
|
|
25
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
(0, vitest_1.it)("returns false when snapshotted-assets exists but is empty", () => {
|
|
28
|
+
(0, fs_1.mkdirSync)(assetsDir("head", "r1"), { recursive: true });
|
|
29
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.it)("returns true when at least one role has populated snapshotted-assets", () => {
|
|
32
|
+
(0, fs_1.mkdirSync)(assetsDir("base", "r2"), { recursive: true });
|
|
33
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(assetsDir("base", "r2"), "main.js"), "console.log(1);");
|
|
34
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.it)("scans head, base, and other roles", () => {
|
|
37
|
+
(0, fs_1.mkdirSync)(assetsDir("other", "r3"), { recursive: true });
|
|
38
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(assetsDir("other", "r3"), "style.css"), "body {}");
|
|
39
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
(0, vitest_1.it)("returns false when only unrelated role directories have files", () => {
|
|
42
|
+
const unrelated = (0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", "unknown-role", "r4", "snapshotted-assets");
|
|
43
|
+
(0, fs_1.mkdirSync)(unrelated, { recursive: true });
|
|
44
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(unrelated, "x.js"), "x");
|
|
45
|
+
(0, vitest_1.expect)((0, generate_debug_workspace_1.detectSnapshotAssets)(workspace)).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=detect-snapshot-assets.spec.js.map
|
|
49
|
+
//# debugId=3535bd4b-5cfe-5051-ac8d-3f4d0c4518ce
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-snapshot-assets.spec.js","sources":["../../src/__tests__/detect-snapshot-assets.spec.ts"],"sourceRoot":"","names":[],"mappings":";;;;AAAA,2BAAmE;AACnE,2BAA4B;AAC5B,+BAA4B;AAC5B,mCAAqE;AACrE,wDAA0D;AAC1D,0EAAmE;AAEnE,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,SAAi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,IAAA,+CAAoB,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","debugId":"3535bd4b-5cfe-5051-ac8d-3f4d0c4518ce"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="987d3e92-0fa1-5dc4-b5fa-27a83367f0b2")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const fs_1 = require("fs");
|
|
@@ -16,7 +16,7 @@ const extract_screenshot_dom_files_1 = require("../extract-screenshot-dom-files"
|
|
|
16
16
|
(0, vitest_1.afterEach)(() => {
|
|
17
17
|
(0, fs_1.rmSync)(workspace, { recursive: true, force: true });
|
|
18
18
|
});
|
|
19
|
-
(0, vitest_1.it)("writes <name>.html
|
|
19
|
+
(0, vitest_1.it)("writes <name>.html when before.dom is present", () => {
|
|
20
20
|
const screenshotsDir = (0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", "head", "replay-1", "screenshots");
|
|
21
21
|
(0, fs_1.mkdirSync)(screenshotsDir, { recursive: true });
|
|
22
22
|
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, "screenshot-after-event-00001.metadata.json"), JSON.stringify({
|
|
@@ -24,29 +24,20 @@ const extract_screenshot_dom_files_1 = require("../extract-screenshot-dom-files"
|
|
|
24
24
|
routeData: { url: "https://example.com/page" },
|
|
25
25
|
dom: "<div>before</div>",
|
|
26
26
|
},
|
|
27
|
-
after: {
|
|
28
|
-
dom: "<div>after</div>",
|
|
29
|
-
},
|
|
30
27
|
}));
|
|
31
28
|
(0, extract_screenshot_dom_files_1.extractScreenshotDomFiles)(workspace);
|
|
32
29
|
const beforePath = (0, path_1.join)(screenshotsDir, "screenshot-after-event-00001.html");
|
|
33
|
-
const afterPath = (0, path_1.join)(screenshotsDir, "screenshot-after-event-00001.after.html");
|
|
34
30
|
(0, vitest_1.expect)((0, fs_1.existsSync)(beforePath)).toBe(true);
|
|
35
|
-
(0, vitest_1.expect)((0, fs_1.existsSync)(afterPath)).toBe(true);
|
|
36
31
|
const beforeContent = (0, fs_1.readFileSync)(beforePath, "utf-8");
|
|
37
|
-
(0, vitest_1.expect)(beforeContent).toMatch(/^<!-- screenshot=screenshot-after-event-00001
|
|
32
|
+
(0, vitest_1.expect)(beforeContent).toMatch(/^<!-- screenshot=screenshot-after-event-00001 url=https:\/\/example\.com\/page( vt=\d+)? -->\n/);
|
|
38
33
|
(0, vitest_1.expect)(beforeContent).toContain("<div>before</div>");
|
|
39
|
-
const afterContent = (0, fs_1.readFileSync)(afterPath, "utf-8");
|
|
40
|
-
(0, vitest_1.expect)(afterContent).toContain("side=after");
|
|
41
|
-
(0, vitest_1.expect)(afterContent).toContain("<div>after</div>");
|
|
42
34
|
});
|
|
43
|
-
(0, vitest_1.it)("skips
|
|
35
|
+
(0, vitest_1.it)("skips writing when before.dom is missing", () => {
|
|
44
36
|
const screenshotsDir = (0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", "head", "replay-1", "screenshots");
|
|
45
37
|
(0, fs_1.mkdirSync)(screenshotsDir, { recursive: true });
|
|
46
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, "final-state-v2.metadata.json"), JSON.stringify({ before: {
|
|
38
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, "final-state-v2.metadata.json"), JSON.stringify({ before: {} }));
|
|
47
39
|
(0, extract_screenshot_dom_files_1.extractScreenshotDomFiles)(workspace);
|
|
48
|
-
(0, vitest_1.expect)((0, fs_1.existsSync)((0, path_1.join)(screenshotsDir, "final-state-v2.html"))).toBe(
|
|
49
|
-
(0, vitest_1.expect)((0, fs_1.existsSync)((0, path_1.join)(screenshotsDir, "final-state-v2.after.html"))).toBe(false);
|
|
40
|
+
(0, vitest_1.expect)((0, fs_1.existsSync)((0, path_1.join)(screenshotsDir, "final-state-v2.html"))).toBe(false);
|
|
50
41
|
});
|
|
51
42
|
(0, vitest_1.it)("tolerates malformed metadata JSON without throwing", () => {
|
|
52
43
|
const screenshotsDir = (0, path_1.join)(workspace, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays", "head", "replay-1", "screenshots");
|
|
@@ -56,4 +47,4 @@ const extract_screenshot_dom_files_1 = require("../extract-screenshot-dom-files"
|
|
|
56
47
|
});
|
|
57
48
|
});
|
|
58
49
|
//# sourceMappingURL=extract-screenshot-dom-files.spec.js.map
|
|
59
|
-
//# debugId=
|
|
50
|
+
//# debugId=987d3e92-0fa1-5dc4-b5fa-27a83367f0b2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-screenshot-dom-files.spec.js","sources":["../../src/__tests__/extract-screenshot-dom-files.spec.ts"],"sourceRoot":"","names":[],"mappings":";;;;AAAA,2BAOY;AACZ,2BAA4B;AAC5B,+BAA4B;AAC5B,mCAAqE;AACrE,wDAA0D;AAC1D,kFAA4E;AAE5E,IAAA,iBAAQ,EAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,SAAiB,CAAC;IAEtB,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,SAAS,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,IAAA,WAAM,GAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,IAAA,WAAM,EAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,
|
|
1
|
+
{"version":3,"file":"extract-screenshot-dom-files.spec.js","sources":["../../src/__tests__/extract-screenshot-dom-files.spec.ts"],"sourceRoot":"","names":[],"mappings":";;;;AAAA,2BAOY;AACZ,2BAA4B;AAC5B,+BAA4B;AAC5B,mCAAqE;AACrE,wDAA0D;AAC1D,kFAA4E;AAE5E,IAAA,iBAAQ,EAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,SAAiB,CAAC;IAEtB,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,SAAS,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,IAAA,WAAM,GAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,IAAA,WAAM,EAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,cAAc,GAAG,IAAA,WAAI,EACzB,SAAS,EACT,sCAAoB,EACpB,SAAS,EACT,MAAM,EACN,UAAU,EACV,aAAa,CACd,CAAC;QACF,IAAA,cAAS,EAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAA,kBAAa,EACX,IAAA,WAAI,EAAC,cAAc,EAAE,4CAA4C,CAAC,EAClE,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE;gBACN,SAAS,EAAE,EAAE,GAAG,EAAE,0BAA0B,EAAE;gBAC9C,GAAG,EAAE,mBAAmB;aACzB;SACF,CAA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,CAAC;QACF,IAAA,cAAS,EAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAA,kBAAa,EACX,IAAA,WAAI,EAAC,cAAc,EAAE,mBAAmB,CAAC,EACzC,iBAAiB,CAClB,CAAC;QAEF,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,wDAAyB,EAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","debugId":"987d3e92-0fa1-5dc4-b5fa-27a83367f0b2"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="59517f21-b707-5127-85f8-36d3301962be")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -24,6 +24,7 @@ const downloadDebugData = async (options) => {
|
|
|
24
24
|
downloadSessionData(client, debugContext, debugDataDir, maxConcurrency),
|
|
25
25
|
downloadReplayDiffs(client, debugContext, debugDataDir, maxConcurrency),
|
|
26
26
|
downloadTestRunMetadata(client, debugContext, debugDataDir),
|
|
27
|
+
downloadPrDiffFromApi(client, debugContext, debugDataDir),
|
|
27
28
|
options.additionalDownloads?.(debugContext, debugDataDir),
|
|
28
29
|
]);
|
|
29
30
|
};
|
|
@@ -34,7 +35,8 @@ const downloadReplays = async (client, debugContext, debugDataDir, maxConcurrenc
|
|
|
34
35
|
console.log(chalk_1.default.cyan(` Downloading ${debugContext.replayIds.length} replays...`));
|
|
35
36
|
const limit = (0, p_limit_1.default)(maxConcurrency);
|
|
36
37
|
const results = await Promise.all(debugContext.replayIds.map((replayId) => limit(async () => {
|
|
37
|
-
const { fileName: cachedPath } = await (0, downloading_helpers_1.getOrFetchReplayArchive)(client, replayId, "everything", true);
|
|
38
|
+
const { fileName: cachedPath } = await (0, downloading_helpers_1.getOrFetchReplayArchive)(client, replayId, "everything", true, { excludeFileTypes: DEBUG_WORKSPACE_EXCLUDED_FILE_TYPES });
|
|
39
|
+
await (0, downloading_helpers_1.ensureReplayLogTextFiles)(cachedPath);
|
|
38
40
|
console.log(chalk_1.default.cyan(` Downloaded replay ${replayId}`));
|
|
39
41
|
return { replayId, cachedPath };
|
|
40
42
|
})));
|
|
@@ -48,6 +50,19 @@ const downloadReplays = async (client, debugContext, debugDataDir, maxConcurrenc
|
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
};
|
|
53
|
+
// File-type keys (matching `REPLAY_V3_UPLOAD_FILE_KEYS` on the backend) that
|
|
54
|
+
// the debug agent never reads, so we tell the downloader not to fetch them at
|
|
55
|
+
// all. `playbackData` and the raw coverage variants are duplicates/derivatives
|
|
56
|
+
// of data we already have; `diffs/` only stores pixel-diff PNG overlays the
|
|
57
|
+
// agent can't act on (the actionable info is in `debug-data/diffs/*.summary.json`
|
|
58
|
+
// and the DOM diffs).
|
|
59
|
+
const DEBUG_WORKSPACE_EXCLUDED_FILE_TYPES = new Set([
|
|
60
|
+
"playbackData",
|
|
61
|
+
"rawCoverage",
|
|
62
|
+
"rawPerScreenshotCssCoverage",
|
|
63
|
+
"rawPerScreenshotJsCoverage",
|
|
64
|
+
"diffs",
|
|
65
|
+
]);
|
|
51
66
|
const copyReplayDir = (src, dest) => {
|
|
52
67
|
(0, fs_1.mkdirSync)(dest, { recursive: true });
|
|
53
68
|
for (const entry of (0, fs_1.readdirSync)(src, { withFileTypes: true })) {
|
|
@@ -64,6 +79,12 @@ const copyReplayDir = (src, dest) => {
|
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
else {
|
|
82
|
+
// `previously-downloaded.txt` is an internal cache marker. We don't write
|
|
83
|
+
// it ourselves (excludeFileTypes is set), but a prior unfiltered caller
|
|
84
|
+
// running locally may have left one — don't surface it in the workspace.
|
|
85
|
+
if (entry.name === "previously-downloaded.txt") {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
67
88
|
(0, fs_1.cpSync)(srcPath, destPath);
|
|
68
89
|
}
|
|
69
90
|
}
|
|
@@ -119,5 +140,30 @@ const downloadTestRunMetadata = async (client, debugContext, debugDataDir) => {
|
|
|
119
140
|
});
|
|
120
141
|
(0, fs_1.writeFileSync)((0, path_1.join)(testRunDir, `${debugContext.testRunId}.json`), JSON.stringify(testRun, null, 2));
|
|
121
142
|
};
|
|
143
|
+
const downloadPrDiffFromApi = async (client, debugContext, debugDataDir) => {
|
|
144
|
+
if (!debugContext.testRunId) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
console.log(chalk_1.default.cyan(` Downloading PR diff...`));
|
|
148
|
+
try {
|
|
149
|
+
const response = await (0, client_1.getPrDiffForTestRun)({
|
|
150
|
+
client,
|
|
151
|
+
testRunId: debugContext.testRunId,
|
|
152
|
+
});
|
|
153
|
+
if (response.content && response.content.trim()) {
|
|
154
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(debugDataDir, "pr-diff.txt"), response.content);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
const status = error?.response?.status;
|
|
159
|
+
const serverMessage = error?.response?.data?.message;
|
|
160
|
+
const detail = serverMessage
|
|
161
|
+
? `${status ?? "unknown"}: ${serverMessage}`
|
|
162
|
+
: error instanceof Error
|
|
163
|
+
? error.message
|
|
164
|
+
: String(error);
|
|
165
|
+
console.warn(chalk_1.default.yellow(` Warning: Could not download PR diff (${detail}).`));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
122
168
|
//# sourceMappingURL=download-debug-data.js.map
|
|
123
|
-
//# debugId=
|
|
169
|
+
//# debugId=59517f21-b707-5127-85f8-36d3301962be
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-debug-data.js","sources":["../src/download-debug-data.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;AAAA,2BAA+E;AAC/E,+BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"download-debug-data.js","sources":["../src/download-debug-data.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;AAAA,2BAA+E;AAC/E,+BAA4B;AAC5B,qDAKkC;AAClC,+EAK+C;AAC/C,kDAA0B;AAC1B,sDAA6B;AAC7B,uDAAyD;AAGzD,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAehC,MAAM,iBAAiB,GAAG,KAAK,EACpC,OAAiC,EAClB,EAAE;IACjB,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACvD,MAAM,cAAc,GAClB,OAAO,CAAC,sBAAsB,IAAI,4BAA4B,CAAC;IAEjE,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,sCAAoB,CAAC,CAAC;IAC9D,IAAA,cAAS,EAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7C,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,CAAC;QACnE,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,CAAC;QACvE,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,CAAC;QACvE,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;QAC3D,qBAAqB,CAAC,MAAM,EAA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|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Extract each `*.metadata.json`'s `before.dom`
|
|
3
|
-
*
|
|
4
|
-
* `<!-- screenshot=... url=... vt=... -->` header.
|
|
2
|
+
* Extract each `*.metadata.json`'s `before.dom` into `<name>.html`,
|
|
3
|
+
* prefixed with a one-line `<!-- screenshot=... url=... vt=... -->` header.
|
|
5
4
|
*/
|
|
6
5
|
export declare const extractScreenshotDomFiles: (workspaceDir: string) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3318f987-719d-58d4-955d-a2ac7e778b5d")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -13,9 +13,8 @@ const debug_constants_1 = require("./debug-constants");
|
|
|
13
13
|
const replay_walk_1 = require("./replay-walk");
|
|
14
14
|
const screenshot_identifier_1 = require("./screenshot-identifier");
|
|
15
15
|
/**
|
|
16
|
-
* Extract each `*.metadata.json`'s `before.dom`
|
|
17
|
-
*
|
|
18
|
-
* `<!-- screenshot=... url=... vt=... -->` header.
|
|
16
|
+
* Extract each `*.metadata.json`'s `before.dom` into `<name>.html`,
|
|
17
|
+
* prefixed with a one-line `<!-- screenshot=... url=... vt=... -->` header.
|
|
19
18
|
*/
|
|
20
19
|
const extractScreenshotDomFiles = (workspaceDir) => {
|
|
21
20
|
const debugDataDir = (0, path_1.join)(workspaceDir, debug_constants_1.DEBUG_DATA_DIRECTORY);
|
|
@@ -47,12 +46,7 @@ const extractScreenshotDomFiles = (workspaceDir) => {
|
|
|
47
46
|
const virtualTime = virtualTimeByName.get(baseName) ?? null;
|
|
48
47
|
const beforeDom = metadata.before?.dom;
|
|
49
48
|
if (typeof beforeDom === "string") {
|
|
50
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, `${baseName}.html`), renderWithHeader(beforeDom, baseName, url, virtualTime
|
|
51
|
-
extractedCount++;
|
|
52
|
-
}
|
|
53
|
-
const afterDom = metadata.after?.dom;
|
|
54
|
-
if (typeof afterDom === "string") {
|
|
55
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, `${baseName}.after.html`), renderWithHeader(afterDom, baseName, url, virtualTime, "after"));
|
|
49
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(screenshotsDir, `${baseName}.html`), renderWithHeader(beforeDom, baseName, url, virtualTime));
|
|
56
50
|
extractedCount++;
|
|
57
51
|
}
|
|
58
52
|
}
|
|
@@ -65,11 +59,8 @@ const extractScreenshotDomFiles = (workspaceDir) => {
|
|
|
65
59
|
}
|
|
66
60
|
};
|
|
67
61
|
exports.extractScreenshotDomFiles = extractScreenshotDomFiles;
|
|
68
|
-
const renderWithHeader = (dom, baseName, url, virtualTime
|
|
69
|
-
const headerParts = [
|
|
70
|
-
`screenshot=${baseName}`,
|
|
71
|
-
`side=${side}`,
|
|
72
|
-
];
|
|
62
|
+
const renderWithHeader = (dom, baseName, url, virtualTime) => {
|
|
63
|
+
const headerParts = [`screenshot=${baseName}`];
|
|
73
64
|
if (url != null) {
|
|
74
65
|
headerParts.push(`url=${url}`);
|
|
75
66
|
}
|
|
@@ -101,4 +92,4 @@ const logMalformed = (replayDir, filename) => {
|
|
|
101
92
|
console.warn(chalk_1.default.yellow(` Warning: Could not parse ${replayDir.role}/${replayDir.replayId}/screenshots/${filename}`));
|
|
102
93
|
};
|
|
103
94
|
//# sourceMappingURL=extract-screenshot-dom-files.js.map
|
|
104
|
-
//# debugId=
|
|
95
|
+
//# debugId=3318f987-719d-58d4-955d-a2ac7e778b5d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-screenshot-dom-files.js","sources":["../src/extract-screenshot-dom-files.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;AAAA,2BAA4D;AAC5D,+BAA4B;AAC5B,kDAA0B;AAC1B,uDAAyD;AACzD,+CAKuB;AACvB,mEAAyE;AAEzE
|
|
1
|
+
{"version":3,"file":"extract-screenshot-dom-files.js","sources":["../src/extract-screenshot-dom-files.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;AAAA,2BAA4D;AAC5D,+BAA4B;AAC5B,kDAA0B;AAC1B,uDAAyD;AACzD,+CAKuB;AACvB,mEAAyE;AAEzE;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CAAC,YAAoB,EAAQ,EAAE;IACtE,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,sCAAoB,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,IAAA,gCAAkB,EAAC,UAAU,CAAC,CAAC;IAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,qBAAqB,GAAG,CAAC,CAAC;IAE9B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAA,eAAU,EAAC,cAAc,CAAC,EAAE,CAAC;YAChC,SAAS;QACX,CAAC;QAED,MAAM,iBAAiB,GAAG,wBAAwB,CAChD,IAAA,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,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;YACnD,SAAS;QACX,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAE,QAAgB,EAAQ,EAAE;IACpE,OAAO,CAAC,IAAI,CACV,eAAK,CAAC,MAAM,CACV,8BAA8B,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,gBAAgB,QAAQ,EAAE,CAC7F,CACF,CAAC;AACJ,CAAC,CAAC","debugId":"3318f987-719d-58d4-955d-a2ac7e778b5d"}
|
|
@@ -15,8 +15,6 @@ export interface ScreenshotMapEntry {
|
|
|
15
15
|
eventNumber: number | null;
|
|
16
16
|
/** Name of the `before.dom` HTML file in the replay's `screenshots/`, or `null` if missing. */
|
|
17
17
|
htmlFilename: string | null;
|
|
18
|
-
/** Name of the `after.dom` HTML file, or `null` when the screenshot captured no after DOM. */
|
|
19
|
-
afterHtmlFilename: string | null;
|
|
20
18
|
}
|
|
21
19
|
export interface ReplayComparisonEntry {
|
|
22
20
|
replayId: string;
|
|
@@ -34,6 +32,34 @@ export interface GenerateDebugWorkspaceOptions {
|
|
|
34
32
|
projectRepoDir: string | undefined;
|
|
35
33
|
maxConcurrency?: number | undefined;
|
|
36
34
|
additionalTemplatesDir?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* When true, do not write `.claude/CLAUDE.md`, `.claude/settings.json`, or
|
|
37
|
+
* `.claude/hooks/` into the workspace. Used by the agent-cloud-worker, which
|
|
38
|
+
* inlines the rendered CLAUDE.md (returned by this function) into its system
|
|
39
|
+
* prompt and configures permissions, hooks, and sandboxing inline via the
|
|
40
|
+
* Claude Agent SDK rather than from filesystem settings. Skills, agents, and
|
|
41
|
+
* rules are still written -- they're referenced by the Task and Skill tools
|
|
42
|
+
* at runtime and need to live on disk.
|
|
43
|
+
*/
|
|
44
|
+
skipDefaultClaudeFiles?: boolean | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the workspace is being prepared for the local `meticulous debug`
|
|
47
|
+
* CLI or for a non-CLI runner like the agent-cloud-worker. Defaults to
|
|
48
|
+
* `false`; the local CLI passes `true` explicitly. When `false`, CLI-specific
|
|
49
|
+
* guidance (project-repo paths, `--baseReplayId` notes, direct CLI
|
|
50
|
+
* invocations) is stripped from CLAUDE.md and templated agent markdown via
|
|
51
|
+
* `<!-- if-local-cli -->` markers.
|
|
52
|
+
*/
|
|
53
|
+
isLocalCli?: boolean | undefined;
|
|
37
54
|
writeContextJson?: ((debugContext: DebugContext, workspaceDir: string, fileMetadata: FileMetadataEntry[], projectRepoDir: string | undefined, screenshotMap: Record<string, ScreenshotMapEntry>, replayComparison: ReplayComparisonEntry[], domDiffMap: DomDiffMap) => void) | undefined;
|
|
38
55
|
}
|
|
39
|
-
export
|
|
56
|
+
export interface GenerateDebugWorkspaceResult {
|
|
57
|
+
/**
|
|
58
|
+
* The fully-rendered CLAUDE.md content (with all `<!-- if-* -->` conditionals
|
|
59
|
+
* resolved). Returned regardless of whether the file was written to disk so
|
|
60
|
+
* SDK consumers can inline it into a custom system prompt directly.
|
|
61
|
+
*/
|
|
62
|
+
claudeMd: string;
|
|
63
|
+
}
|
|
64
|
+
export declare const generateDebugWorkspace: (options: GenerateDebugWorkspaceOptions) => Promise<GenerateDebugWorkspaceResult>;
|
|
65
|
+
export declare const detectSnapshotAssets: (workspaceDir: string) => boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="15f6c23f-bf45-56e9-a5ab-623cc4cd2f7f")}catch(e){}}();
|
|
3
3
|
|
|
4
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.generateDebugWorkspace = void 0;
|
|
8
|
+
exports.detectSnapshotAssets = exports.generateDebugWorkspace = void 0;
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
10
10
|
const crypto_1 = require("crypto");
|
|
11
11
|
const fs_1 = require("fs");
|
|
@@ -28,7 +28,17 @@ const generateDebugWorkspace = async (options) => {
|
|
|
28
28
|
generateDiffSummaries(workspaceDir);
|
|
29
29
|
generatePrDiff(debugContext, workspaceDir);
|
|
30
30
|
const hasPrDiff = (0, fs_1.existsSync)((0, path_1.join)(workspaceDir, debug_constants_1.DEBUG_DATA_DIRECTORY, "pr-diff.txt"));
|
|
31
|
-
|
|
31
|
+
const isLocalCli = options.isLocalCli ?? false;
|
|
32
|
+
const hasSnapshotAssets = (0, exports.detectSnapshotAssets)(workspaceDir);
|
|
33
|
+
const conditions = {
|
|
34
|
+
hasPrDiff,
|
|
35
|
+
isLocalCli,
|
|
36
|
+
hasSnapshotAssets,
|
|
37
|
+
};
|
|
38
|
+
const claudeMd = renderClaudeMd(options.additionalTemplatesDir, conditions);
|
|
39
|
+
if (!options.skipDefaultClaudeFiles) {
|
|
40
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(claudeDir, "CLAUDE.md"), claudeMd);
|
|
41
|
+
}
|
|
32
42
|
generateParamsDiffs(debugContext, workspaceDir);
|
|
33
43
|
generateAssetsDiff(debugContext, workspaceDir);
|
|
34
44
|
generateTimelineSummaries(workspaceDir);
|
|
@@ -49,17 +59,20 @@ const generateDebugWorkspace = async (options) => {
|
|
|
49
59
|
const writeCtx = options.writeContextJson ?? defaultWriteContextJson;
|
|
50
60
|
writeCtx(debugContext, workspaceDir, fileMetadata, options.projectRepoDir, screenshotMap, replayComparison, domDiffMap);
|
|
51
61
|
copyClaudeSubdir(workspaceDir, "rules", options.additionalTemplatesDir);
|
|
52
|
-
copyClaudeSubdir(workspaceDir, "hooks", options.additionalTemplatesDir, {
|
|
53
|
-
makeExecutable: true,
|
|
54
|
-
});
|
|
55
62
|
copyClaudeSubdir(workspaceDir, "agents", options.additionalTemplatesDir, {
|
|
56
|
-
|
|
63
|
+
conditions,
|
|
57
64
|
});
|
|
58
|
-
copySkills(workspaceDir, options.additionalTemplatesDir,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
copySkills(workspaceDir, options.additionalTemplatesDir, conditions);
|
|
66
|
+
if (!options.skipDefaultClaudeFiles) {
|
|
67
|
+
copyClaudeSubdir(workspaceDir, "hooks", options.additionalTemplatesDir, {
|
|
68
|
+
makeExecutable: true,
|
|
69
|
+
});
|
|
70
|
+
const settingsSrc = resolveTemplateFile("settings.json", options.additionalTemplatesDir);
|
|
71
|
+
if (settingsSrc) {
|
|
72
|
+
(0, fs_1.copyFileSync)(settingsSrc, (0, path_1.join)(claudeDir, "settings.json"));
|
|
73
|
+
}
|
|
62
74
|
}
|
|
75
|
+
return { claudeMd };
|
|
63
76
|
};
|
|
64
77
|
exports.generateDebugWorkspace = generateDebugWorkspace;
|
|
65
78
|
// ---------------------------------------------------------------------------
|
|
@@ -83,17 +96,16 @@ const resolveTemplateFile = (relativePath, additionalTemplatesDir) => {
|
|
|
83
96
|
// dangling references.
|
|
84
97
|
const PR_DIFF_ONLY_AGENT_FILES = new Set(["pr-analyzer.md"]);
|
|
85
98
|
const PR_DIFF_ONLY_SKILL_DIRS = new Set(["pr-analysis"]);
|
|
86
|
-
const
|
|
99
|
+
const renderClaudeMd = (additionalTemplatesDir, conditions) => {
|
|
87
100
|
const src = resolveTemplateFile("CLAUDE.md", additionalTemplatesDir);
|
|
88
101
|
if (!src) {
|
|
89
|
-
|
|
102
|
+
throw new Error("CLAUDE.md template not found in the debug-workspace package. This indicates a packaging bug.");
|
|
90
103
|
}
|
|
91
|
-
|
|
92
|
-
writeMarkdownWithConditionals(src, dest, options.hasPrDiff);
|
|
104
|
+
return renderMarkdownWithConditionals((0, fs_1.readFileSync)(src, "utf8"), conditions);
|
|
93
105
|
};
|
|
94
106
|
const copyClaudeSubdir = (workspaceDir, subdir, additionalTemplatesDir, options = {}) => {
|
|
95
107
|
const destDir = (0, path_1.join)(workspaceDir, ".claude", subdir);
|
|
96
|
-
const skipNames = options.hasPrDiff === false && subdir === "agents"
|
|
108
|
+
const skipNames = options.conditions?.hasPrDiff === false && subdir === "agents"
|
|
97
109
|
? PR_DIFF_ONLY_AGENT_FILES
|
|
98
110
|
: new Set();
|
|
99
111
|
let copied = false;
|
|
@@ -109,8 +121,8 @@ const copyClaudeSubdir = (workspaceDir, subdir, additionalTemplatesDir, options
|
|
|
109
121
|
for (const filename of entries) {
|
|
110
122
|
const destPath = (0, path_1.join)(destDir, filename);
|
|
111
123
|
const srcPath = (0, path_1.join)(srcDir, filename);
|
|
112
|
-
if (filename.endsWith(".md") && options.
|
|
113
|
-
writeMarkdownWithConditionals(srcPath, destPath, options.
|
|
124
|
+
if (filename.endsWith(".md") && options.conditions) {
|
|
125
|
+
writeMarkdownWithConditionals(srcPath, destPath, options.conditions);
|
|
114
126
|
}
|
|
115
127
|
else {
|
|
116
128
|
(0, fs_1.copyFileSync)(srcPath, destPath);
|
|
@@ -131,7 +143,7 @@ const copyClaudeSubdir = (workspaceDir, subdir, additionalTemplatesDir, options
|
|
|
131
143
|
}
|
|
132
144
|
}
|
|
133
145
|
};
|
|
134
|
-
const copySkills = (workspaceDir, additionalTemplatesDir,
|
|
146
|
+
const copySkills = (workspaceDir, additionalTemplatesDir, conditions) => {
|
|
135
147
|
const skillDirNames = new Set();
|
|
136
148
|
const baseSrcDir = (0, path_1.join)(TEMPLATES_DIR, "skills");
|
|
137
149
|
if ((0, fs_1.existsSync)(baseSrcDir)) {
|
|
@@ -152,27 +164,75 @@ const copySkills = (workspaceDir, additionalTemplatesDir, options) => {
|
|
|
152
164
|
}
|
|
153
165
|
}
|
|
154
166
|
for (const skillName of skillDirNames) {
|
|
155
|
-
if (!
|
|
167
|
+
if (!conditions.hasPrDiff && PR_DIFF_ONLY_SKILL_DIRS.has(skillName)) {
|
|
156
168
|
continue;
|
|
157
169
|
}
|
|
158
|
-
copyClaudeSubdir(workspaceDir, (0, path_1.join)("skills", skillName), additionalTemplatesDir, {
|
|
159
|
-
hasPrDiff: options.hasPrDiff,
|
|
160
|
-
});
|
|
170
|
+
copyClaudeSubdir(workspaceDir, (0, path_1.join)("skills", skillName), additionalTemplatesDir, { conditions });
|
|
161
171
|
}
|
|
162
172
|
};
|
|
163
|
-
// Strips <!-- if
|
|
164
|
-
// markers and the trailing newline) when
|
|
165
|
-
// the block content but removes the marker
|
|
166
|
-
// rendered prompt.
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
173
|
+
// Strips <!-- if-<marker> --> ... <!-- end-if-<marker> --> blocks (including the
|
|
174
|
+
// markers and the trailing newline) when the corresponding condition is false.
|
|
175
|
+
// When the condition is true, leaves the block content but removes the marker
|
|
176
|
+
// comments so they don't leak into the rendered prompt.
|
|
177
|
+
const CONDITION_MARKERS = {
|
|
178
|
+
hasPrDiff: "pr-diff",
|
|
179
|
+
isLocalCli: "local-cli",
|
|
180
|
+
hasSnapshotAssets: "snapshot-assets",
|
|
181
|
+
};
|
|
182
|
+
const renderMarkdownWithConditionals = (content, conditions) => {
|
|
183
|
+
let result = content;
|
|
184
|
+
for (const [conditionKey, marker] of Object.entries(CONDITION_MARKERS)) {
|
|
185
|
+
const startRe = new RegExp(`^[ \\t]*<!--\\s*if-${marker}\\s*-->[ \\t]*\\r?\\n`, "gm");
|
|
186
|
+
const endRe = new RegExp(`^[ \\t]*<!--\\s*end-if-${marker}\\s*-->[ \\t]*\\r?\\n`, "gm");
|
|
187
|
+
if (conditions[conditionKey]) {
|
|
188
|
+
result = result.replace(startRe, "").replace(endRe, "");
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const blockRe = new RegExp(`^[ \\t]*<!--\\s*if-${marker}\\s*-->[ \\t]*\\r?\\n[\\s\\S]*?^[ \\t]*<!--\\s*end-if-${marker}\\s*-->[ \\t]*\\r?\\n`, "gm");
|
|
192
|
+
result = result.replace(blockRe, "");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
};
|
|
197
|
+
const writeMarkdownWithConditionals = (srcPath, destPath, conditions) => {
|
|
198
|
+
const content = (0, fs_1.readFileSync)(srcPath, "utf8");
|
|
199
|
+
(0, fs_1.writeFileSync)(destPath, renderMarkdownWithConditionals(content, conditions));
|
|
200
|
+
};
|
|
201
|
+
// True when at least one replay's `snapshotted-assets/` directory exists and
|
|
202
|
+
// contains files. Drives the `if-snapshot-assets` markdown conditional so that
|
|
203
|
+
// snapshot/asset guidance is only surfaced when the data is actually available.
|
|
204
|
+
// Exported for testing.
|
|
205
|
+
const detectSnapshotAssets = (workspaceDir) => {
|
|
206
|
+
const replaysDir = (0, path_1.join)(workspaceDir, debug_constants_1.DEBUG_DATA_DIRECTORY, "replays");
|
|
207
|
+
if (!(0, fs_1.existsSync)(replaysDir)) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
for (const subDir of ["head", "base", "other"]) {
|
|
211
|
+
const subDirPath = (0, path_1.join)(replaysDir, subDir);
|
|
212
|
+
if (!(0, fs_1.existsSync)(subDirPath)) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
for (const replayId of (0, fs_1.readdirSync)(subDirPath)) {
|
|
216
|
+
const assetsDir = (0, path_1.join)(subDirPath, replayId, "snapshotted-assets");
|
|
217
|
+
if (!(0, fs_1.existsSync)(assetsDir)) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
if ((0, fs_1.readdirSync)(assetsDir).length > 0) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
// Permission/IO error reading this directory — keep scanning the
|
|
227
|
+
// others. Surface at warn so the snapshot-assets conditional being
|
|
228
|
+
// disabled isn't a silent surprise downstream.
|
|
229
|
+
(0, common_1.initLogger)().warn(`Could not read snapshotted-assets dir ${assetsDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
175
234
|
};
|
|
235
|
+
exports.detectSnapshotAssets = detectSnapshotAssets;
|
|
176
236
|
// ---------------------------------------------------------------------------
|
|
177
237
|
// Log filtering and diffs
|
|
178
238
|
// ---------------------------------------------------------------------------
|
|
@@ -490,7 +550,10 @@ const generatePrDiff = (debugContext, workspaceDir) => {
|
|
|
490
550
|
const resolveBaseShaFromGit = (repoDir, headSha) => {
|
|
491
551
|
for (const branch of ["origin/main", "origin/master"]) {
|
|
492
552
|
try {
|
|
493
|
-
const mergeBase = (0, child_process_1.execFileSync)("git", ["merge-base", branch, headSha], {
|
|
553
|
+
const mergeBase = (0, child_process_1.execFileSync)("git", ["merge-base", branch, headSha], {
|
|
554
|
+
cwd: repoDir,
|
|
555
|
+
encoding: "utf8",
|
|
556
|
+
}).trim();
|
|
494
557
|
if (mergeBase) {
|
|
495
558
|
return mergeBase;
|
|
496
559
|
}
|
|
@@ -940,9 +1003,7 @@ const buildScreenshotMap = (debugContext, workspaceDir) => {
|
|
|
940
1003
|
? filename.slice(0, -".png".length)
|
|
941
1004
|
: filename;
|
|
942
1005
|
const htmlFilename = `${baseName}.html`;
|
|
943
|
-
const afterHtmlFilename = `${baseName}.after.html`;
|
|
944
1006
|
const htmlExists = (0, fs_1.existsSync)((0, path_1.join)(screenshotsDir, htmlFilename));
|
|
945
|
-
const afterHtmlExists = (0, fs_1.existsSync)((0, path_1.join)(screenshotsDir, afterHtmlFilename));
|
|
946
1007
|
map[`${subDir}/${replayId}/${filename}`] = {
|
|
947
1008
|
replayId,
|
|
948
1009
|
replayRole: subDir,
|
|
@@ -951,7 +1012,6 @@ const buildScreenshotMap = (debugContext, workspaceDir) => {
|
|
|
951
1012
|
virtualTimeEnd: e.virtualTimeEnd ?? null,
|
|
952
1013
|
eventNumber: e.data.identifier.eventNumber ?? null,
|
|
953
1014
|
htmlFilename: htmlExists ? htmlFilename : null,
|
|
954
|
-
afterHtmlFilename: afterHtmlExists ? afterHtmlFilename : null,
|
|
955
1015
|
};
|
|
956
1016
|
}
|
|
957
1017
|
}
|
|
@@ -1341,4 +1401,4 @@ const defaultWriteContextJson = (debugContext, workspaceDir, fileMetadata, proje
|
|
|
1341
1401
|
(0, fs_1.writeFileSync)((0, path_1.join)(workspaceDir, debug_constants_1.DEBUG_DATA_DIRECTORY, "context.json"), JSON.stringify(context, null, 2));
|
|
1342
1402
|
};
|
|
1343
1403
|
//# sourceMappingURL=generate-debug-workspace.js.map
|
|
1344
|
-
//# debugId=
|
|
1404
|
+
//# debugId=15f6c23f-bf45-56e9-a5ab-623cc4cd2f7f
|