@blazediff/agent 0.4.0 → 0.6.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/README.md +18 -13
- package/SKILL.md +10 -9
- package/dist/cli.js +524 -411
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +70 -89
- package/dist/index.mjs +70 -89
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -151,7 +151,7 @@ interface CaptureOptions {
|
|
|
151
151
|
}
|
|
152
152
|
interface DiscoveredRoute {
|
|
153
153
|
url: string;
|
|
154
|
-
source: "
|
|
154
|
+
source: "crawl";
|
|
155
155
|
auth?: string;
|
|
156
156
|
}
|
|
157
157
|
interface CheckReport {
|
|
@@ -271,11 +271,16 @@ interface DiffOutcome {
|
|
|
271
271
|
}
|
|
272
272
|
declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
|
|
273
273
|
|
|
274
|
+
interface TemplateSampling {
|
|
275
|
+
threshold: number;
|
|
276
|
+
samples: number;
|
|
277
|
+
}
|
|
278
|
+
|
|
274
279
|
interface DiscoverOptions {
|
|
275
280
|
baseUrl: string;
|
|
276
281
|
cwd?: string;
|
|
277
282
|
maxRoutes?: number;
|
|
278
|
-
|
|
283
|
+
sampleTemplates?: boolean | TemplateSampling;
|
|
279
284
|
}
|
|
280
285
|
declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
|
|
281
286
|
|
package/dist/index.d.ts
CHANGED
|
@@ -151,7 +151,7 @@ interface CaptureOptions {
|
|
|
151
151
|
}
|
|
152
152
|
interface DiscoveredRoute {
|
|
153
153
|
url: string;
|
|
154
|
-
source: "
|
|
154
|
+
source: "crawl";
|
|
155
155
|
auth?: string;
|
|
156
156
|
}
|
|
157
157
|
interface CheckReport {
|
|
@@ -271,11 +271,16 @@ interface DiffOutcome {
|
|
|
271
271
|
}
|
|
272
272
|
declare function diffEntry(id: string, baselinePath: string, actualPath: string, opts?: DiffOptions, cwd?: string): Promise<DiffOutcome>;
|
|
273
273
|
|
|
274
|
+
interface TemplateSampling {
|
|
275
|
+
threshold: number;
|
|
276
|
+
samples: number;
|
|
277
|
+
}
|
|
278
|
+
|
|
274
279
|
interface DiscoverOptions {
|
|
275
280
|
baseUrl: string;
|
|
276
281
|
cwd?: string;
|
|
277
282
|
maxRoutes?: number;
|
|
278
|
-
|
|
283
|
+
sampleTemplates?: boolean | TemplateSampling;
|
|
279
284
|
}
|
|
280
285
|
declare function discover(opts: DiscoverOptions): Promise<DiscoveredRoute[]>;
|
|
281
286
|
|
package/dist/index.js
CHANGED
|
@@ -513,7 +513,9 @@ function resolveBaseUrl(config, override) {
|
|
|
513
513
|
if (override) return override;
|
|
514
514
|
if (config?.baseUrl) return config.baseUrl;
|
|
515
515
|
if (config?.devServer) return `http://127.0.0.1:${config.devServer.port}`;
|
|
516
|
-
throw new Error(
|
|
516
|
+
throw new Error(
|
|
517
|
+
"no baseUrl: pass --base-url or run `blazediff-agent onboard`"
|
|
518
|
+
);
|
|
517
519
|
}
|
|
518
520
|
|
|
519
521
|
// src/graph/semaphore.ts
|
|
@@ -876,9 +878,9 @@ function extractInternalLinks(base, target, hrefs) {
|
|
|
876
878
|
try {
|
|
877
879
|
const u = new URL(href, target);
|
|
878
880
|
if (u.origin !== base.origin) continue;
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
881
|
-
out.push(
|
|
881
|
+
const path22 = u.pathname + u.search;
|
|
882
|
+
if (path22.startsWith("/api/")) continue;
|
|
883
|
+
out.push(path22);
|
|
882
884
|
} catch {
|
|
883
885
|
}
|
|
884
886
|
}
|
|
@@ -908,6 +910,8 @@ async function crawlRoutes(opts) {
|
|
|
908
910
|
waitUntil: "domcontentloaded",
|
|
909
911
|
timeout: 15e3
|
|
910
912
|
});
|
|
913
|
+
await page.waitForLoadState("networkidle", { timeout: 5e3 }).catch(() => {
|
|
914
|
+
});
|
|
911
915
|
const hrefs = await page.evaluate(
|
|
912
916
|
() => Array.from(
|
|
913
917
|
document.querySelectorAll("a[href]")
|
|
@@ -932,74 +936,38 @@ async function crawlRoutes(opts) {
|
|
|
932
936
|
}
|
|
933
937
|
return discovered.slice(0, maxRoutes);
|
|
934
938
|
}
|
|
935
|
-
async function fileExists2(p) {
|
|
936
|
-
try {
|
|
937
|
-
await promises.access(p);
|
|
938
|
-
return true;
|
|
939
|
-
} catch {
|
|
940
|
-
return false;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
async function readJsonOrNull(file) {
|
|
944
|
-
try {
|
|
945
|
-
return JSON.parse(await promises.readFile(file, "utf8"));
|
|
946
|
-
} catch {
|
|
947
|
-
return null;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
// src/discover/next.ts
|
|
952
|
-
var DYNAMIC_SEGMENT = /\[[^\]]+\]/;
|
|
953
|
-
function isPublicRoute(route) {
|
|
954
|
-
if (DYNAMIC_SEGMENT.test(route)) return false;
|
|
955
|
-
if (route === "/api" || route.startsWith("/api/")) return false;
|
|
956
|
-
return true;
|
|
957
|
-
}
|
|
958
|
-
async function discoverFromNextManifest(cwd = process.cwd()) {
|
|
959
|
-
const nextDir = path__default.default.join(cwd, ".next");
|
|
960
|
-
if (!fs.existsSync(nextDir)) return [];
|
|
961
|
-
const seen = /* @__PURE__ */ new Set();
|
|
962
|
-
const out = [];
|
|
963
|
-
const add = (url) => {
|
|
964
|
-
if (seen.has(url)) return;
|
|
965
|
-
seen.add(url);
|
|
966
|
-
out.push({ url, source: "next-manifest" });
|
|
967
|
-
};
|
|
968
|
-
const routes = await readJsonOrNull(
|
|
969
|
-
path__default.default.join(nextDir, "routes-manifest.json")
|
|
970
|
-
);
|
|
971
|
-
for (const r of routes?.staticRoutes ?? []) {
|
|
972
|
-
if (isPublicRoute(r.page)) add(r.page);
|
|
973
|
-
}
|
|
974
|
-
const appPaths = await readJsonOrNull(
|
|
975
|
-
path__default.default.join(nextDir, "server", "app-paths-manifest.json")
|
|
976
|
-
);
|
|
977
|
-
for (const route of Object.keys(appPaths ?? {})) {
|
|
978
|
-
const normalized = route.replace(/\/page$/, "") || "/";
|
|
979
|
-
if (isPublicRoute(normalized)) add(normalized);
|
|
980
|
-
}
|
|
981
|
-
return out;
|
|
982
|
-
}
|
|
983
939
|
|
|
984
|
-
// src/discover/
|
|
985
|
-
var
|
|
986
|
-
var
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
940
|
+
// src/discover/templates.ts
|
|
941
|
+
var DEFAULT_SAMPLE_THRESHOLD = 5;
|
|
942
|
+
var DEFAULT_SAMPLES_PER_TEMPLATE = 2;
|
|
943
|
+
var DEFAULT_SAMPLING = {
|
|
944
|
+
threshold: DEFAULT_SAMPLE_THRESHOLD,
|
|
945
|
+
samples: DEFAULT_SAMPLES_PER_TEMPLATE
|
|
946
|
+
};
|
|
947
|
+
function parentPath(path22) {
|
|
948
|
+
const [pathPart] = path22.split("?", 2);
|
|
949
|
+
const idx = pathPart.lastIndexOf("/");
|
|
950
|
+
return idx <= 0 ? "/" : pathPart.slice(0, idx);
|
|
951
|
+
}
|
|
952
|
+
function collapseTemplates(routes, { threshold, samples } = DEFAULT_SAMPLING) {
|
|
953
|
+
const groups = /* @__PURE__ */ new Map();
|
|
954
|
+
for (const route of routes) {
|
|
955
|
+
const parent = parentPath(route.url);
|
|
956
|
+
const group = groups.get(parent);
|
|
957
|
+
if (group) group.push(route);
|
|
958
|
+
else groups.set(parent, [route]);
|
|
959
|
+
}
|
|
960
|
+
const drop = /* @__PURE__ */ new Set();
|
|
961
|
+
const collapsed = [];
|
|
962
|
+
for (const [parent, group] of groups) {
|
|
963
|
+
if (parent === "/" || group.length < threshold) continue;
|
|
964
|
+
for (const route of group.slice(samples)) drop.add(route.url);
|
|
965
|
+
collapsed.push(`${parent}/* (${group.length} \u2192 ${samples})`);
|
|
1001
966
|
}
|
|
1002
|
-
return
|
|
967
|
+
return {
|
|
968
|
+
routes: drop.size ? routes.filter((r) => !drop.has(r.url)) : routes,
|
|
969
|
+
collapsed
|
|
970
|
+
};
|
|
1003
971
|
}
|
|
1004
972
|
|
|
1005
973
|
// src/discover/index.ts
|
|
@@ -1009,27 +977,23 @@ function normalizePath(url) {
|
|
|
1009
977
|
const normalizedPath = trimmed === "" ? "/" : trimmed;
|
|
1010
978
|
return query ? `${normalizedPath}?${query}` : normalizedPath;
|
|
1011
979
|
}
|
|
1012
|
-
function
|
|
980
|
+
function dedupe(routes) {
|
|
981
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1013
982
|
for (const r of routes) {
|
|
1014
983
|
const key = normalizePath(r.url);
|
|
1015
|
-
if (!
|
|
984
|
+
if (!merged.has(key)) merged.set(key, { ...r, url: key });
|
|
1016
985
|
}
|
|
986
|
+
return Array.from(merged.values());
|
|
1017
987
|
}
|
|
1018
988
|
async function discover(opts) {
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
await crawlRoutes({ baseUrl: opts.baseUrl, maxRoutes: crawlMax }),
|
|
1028
|
-
merged
|
|
1029
|
-
);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
return Array.from(merged.values()).sort((a, b) => a.url.localeCompare(b.url));
|
|
989
|
+
const crawled = await crawlRoutes({
|
|
990
|
+
baseUrl: opts.baseUrl,
|
|
991
|
+
maxRoutes: opts.maxRoutes ?? 50
|
|
992
|
+
});
|
|
993
|
+
const deduped = dedupe(crawled);
|
|
994
|
+
const sampling = opts.sampleTemplates ?? true;
|
|
995
|
+
const routes = sampling === false ? deduped : collapseTemplates(deduped, sampling === true ? void 0 : sampling).routes;
|
|
996
|
+
return routes.sort((a, b) => a.url.localeCompare(b.url));
|
|
1033
997
|
}
|
|
1034
998
|
function envFiles(cwd) {
|
|
1035
999
|
const root = paths(cwd).root;
|
|
@@ -1907,6 +1871,23 @@ var noneJudge = {
|
|
|
1907
1871
|
return { kind: "judged", verdict: input.heuristicVerdict };
|
|
1908
1872
|
}
|
|
1909
1873
|
};
|
|
1874
|
+
async function fileExists2(p) {
|
|
1875
|
+
try {
|
|
1876
|
+
await promises.access(p);
|
|
1877
|
+
return true;
|
|
1878
|
+
} catch {
|
|
1879
|
+
return false;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
async function readJsonOrNull(file) {
|
|
1883
|
+
try {
|
|
1884
|
+
return JSON.parse(await promises.readFile(file, "utf8"));
|
|
1885
|
+
} catch {
|
|
1886
|
+
return null;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
// src/report/json.ts
|
|
1910
1891
|
async function writeReport(report, cwd = process.cwd()) {
|
|
1911
1892
|
const file = paths(cwd).report;
|
|
1912
1893
|
await promises.mkdir(path__default.default.dirname(file), { recursive: true });
|
|
@@ -2024,7 +2005,7 @@ async function reconstructFromDisk(cwd, dirs) {
|
|
|
2024
2005
|
const manifest = await loadManifest(cwd);
|
|
2025
2006
|
if (!manifest) {
|
|
2026
2007
|
throw new Error(
|
|
2027
|
-
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent
|
|
2008
|
+
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent onboard\` first.`
|
|
2028
2009
|
);
|
|
2029
2010
|
}
|
|
2030
2011
|
const dirById = new Map(dirs.map((d) => [d.id, d]));
|
|
@@ -2068,7 +2049,7 @@ async function applyJudgments(opts = {}) {
|
|
|
2068
2049
|
const manifest = await loadManifest(cwd);
|
|
2069
2050
|
if (!manifest) {
|
|
2070
2051
|
throw new Error(
|
|
2071
|
-
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent
|
|
2052
|
+
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent onboard\` first.`
|
|
2072
2053
|
);
|
|
2073
2054
|
}
|
|
2074
2055
|
const dirs = await readJudgmentDirs(paths(cwd).judgments);
|
|
@@ -3044,7 +3025,7 @@ async function loadNode(state) {
|
|
|
3044
3025
|
const manifest = await loadManifest(state.options.cwd);
|
|
3045
3026
|
if (!manifest) {
|
|
3046
3027
|
throw new Error(
|
|
3047
|
-
`no manifest found at ${paths(state.options.cwd).manifest}. Run \`blazediff
|
|
3028
|
+
`no manifest found at ${paths(state.options.cwd).manifest}. Run \`blazediff-agent onboard\` then \`/blazediff\` (or capture manually) first.`
|
|
3048
3029
|
);
|
|
3049
3030
|
}
|
|
3050
3031
|
return { entries: manifest.entries, manifest };
|
package/dist/index.mjs
CHANGED
|
@@ -485,7 +485,9 @@ function resolveBaseUrl(config, override) {
|
|
|
485
485
|
if (override) return override;
|
|
486
486
|
if (config?.baseUrl) return config.baseUrl;
|
|
487
487
|
if (config?.devServer) return `http://127.0.0.1:${config.devServer.port}`;
|
|
488
|
-
throw new Error(
|
|
488
|
+
throw new Error(
|
|
489
|
+
"no baseUrl: pass --base-url or run `blazediff-agent onboard`"
|
|
490
|
+
);
|
|
489
491
|
}
|
|
490
492
|
|
|
491
493
|
// src/graph/semaphore.ts
|
|
@@ -848,9 +850,9 @@ function extractInternalLinks(base, target, hrefs) {
|
|
|
848
850
|
try {
|
|
849
851
|
const u = new URL(href, target);
|
|
850
852
|
if (u.origin !== base.origin) continue;
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
853
|
-
out.push(
|
|
853
|
+
const path22 = u.pathname + u.search;
|
|
854
|
+
if (path22.startsWith("/api/")) continue;
|
|
855
|
+
out.push(path22);
|
|
854
856
|
} catch {
|
|
855
857
|
}
|
|
856
858
|
}
|
|
@@ -880,6 +882,8 @@ async function crawlRoutes(opts) {
|
|
|
880
882
|
waitUntil: "domcontentloaded",
|
|
881
883
|
timeout: 15e3
|
|
882
884
|
});
|
|
885
|
+
await page.waitForLoadState("networkidle", { timeout: 5e3 }).catch(() => {
|
|
886
|
+
});
|
|
883
887
|
const hrefs = await page.evaluate(
|
|
884
888
|
() => Array.from(
|
|
885
889
|
document.querySelectorAll("a[href]")
|
|
@@ -904,74 +908,38 @@ async function crawlRoutes(opts) {
|
|
|
904
908
|
}
|
|
905
909
|
return discovered.slice(0, maxRoutes);
|
|
906
910
|
}
|
|
907
|
-
async function fileExists2(p) {
|
|
908
|
-
try {
|
|
909
|
-
await access(p);
|
|
910
|
-
return true;
|
|
911
|
-
} catch {
|
|
912
|
-
return false;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
async function readJsonOrNull(file) {
|
|
916
|
-
try {
|
|
917
|
-
return JSON.parse(await readFile(file, "utf8"));
|
|
918
|
-
} catch {
|
|
919
|
-
return null;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
// src/discover/next.ts
|
|
924
|
-
var DYNAMIC_SEGMENT = /\[[^\]]+\]/;
|
|
925
|
-
function isPublicRoute(route) {
|
|
926
|
-
if (DYNAMIC_SEGMENT.test(route)) return false;
|
|
927
|
-
if (route === "/api" || route.startsWith("/api/")) return false;
|
|
928
|
-
return true;
|
|
929
|
-
}
|
|
930
|
-
async function discoverFromNextManifest(cwd = process.cwd()) {
|
|
931
|
-
const nextDir = path.join(cwd, ".next");
|
|
932
|
-
if (!existsSync(nextDir)) return [];
|
|
933
|
-
const seen = /* @__PURE__ */ new Set();
|
|
934
|
-
const out = [];
|
|
935
|
-
const add = (url) => {
|
|
936
|
-
if (seen.has(url)) return;
|
|
937
|
-
seen.add(url);
|
|
938
|
-
out.push({ url, source: "next-manifest" });
|
|
939
|
-
};
|
|
940
|
-
const routes = await readJsonOrNull(
|
|
941
|
-
path.join(nextDir, "routes-manifest.json")
|
|
942
|
-
);
|
|
943
|
-
for (const r of routes?.staticRoutes ?? []) {
|
|
944
|
-
if (isPublicRoute(r.page)) add(r.page);
|
|
945
|
-
}
|
|
946
|
-
const appPaths = await readJsonOrNull(
|
|
947
|
-
path.join(nextDir, "server", "app-paths-manifest.json")
|
|
948
|
-
);
|
|
949
|
-
for (const route of Object.keys(appPaths ?? {})) {
|
|
950
|
-
const normalized = route.replace(/\/page$/, "") || "/";
|
|
951
|
-
if (isPublicRoute(normalized)) add(normalized);
|
|
952
|
-
}
|
|
953
|
-
return out;
|
|
954
|
-
}
|
|
955
911
|
|
|
956
|
-
// src/discover/
|
|
957
|
-
var
|
|
958
|
-
var
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
912
|
+
// src/discover/templates.ts
|
|
913
|
+
var DEFAULT_SAMPLE_THRESHOLD = 5;
|
|
914
|
+
var DEFAULT_SAMPLES_PER_TEMPLATE = 2;
|
|
915
|
+
var DEFAULT_SAMPLING = {
|
|
916
|
+
threshold: DEFAULT_SAMPLE_THRESHOLD,
|
|
917
|
+
samples: DEFAULT_SAMPLES_PER_TEMPLATE
|
|
918
|
+
};
|
|
919
|
+
function parentPath(path22) {
|
|
920
|
+
const [pathPart] = path22.split("?", 2);
|
|
921
|
+
const idx = pathPart.lastIndexOf("/");
|
|
922
|
+
return idx <= 0 ? "/" : pathPart.slice(0, idx);
|
|
923
|
+
}
|
|
924
|
+
function collapseTemplates(routes, { threshold, samples } = DEFAULT_SAMPLING) {
|
|
925
|
+
const groups = /* @__PURE__ */ new Map();
|
|
926
|
+
for (const route of routes) {
|
|
927
|
+
const parent = parentPath(route.url);
|
|
928
|
+
const group = groups.get(parent);
|
|
929
|
+
if (group) group.push(route);
|
|
930
|
+
else groups.set(parent, [route]);
|
|
931
|
+
}
|
|
932
|
+
const drop = /* @__PURE__ */ new Set();
|
|
933
|
+
const collapsed = [];
|
|
934
|
+
for (const [parent, group] of groups) {
|
|
935
|
+
if (parent === "/" || group.length < threshold) continue;
|
|
936
|
+
for (const route of group.slice(samples)) drop.add(route.url);
|
|
937
|
+
collapsed.push(`${parent}/* (${group.length} \u2192 ${samples})`);
|
|
973
938
|
}
|
|
974
|
-
return
|
|
939
|
+
return {
|
|
940
|
+
routes: drop.size ? routes.filter((r) => !drop.has(r.url)) : routes,
|
|
941
|
+
collapsed
|
|
942
|
+
};
|
|
975
943
|
}
|
|
976
944
|
|
|
977
945
|
// src/discover/index.ts
|
|
@@ -981,27 +949,23 @@ function normalizePath(url) {
|
|
|
981
949
|
const normalizedPath = trimmed === "" ? "/" : trimmed;
|
|
982
950
|
return query ? `${normalizedPath}?${query}` : normalizedPath;
|
|
983
951
|
}
|
|
984
|
-
function
|
|
952
|
+
function dedupe(routes) {
|
|
953
|
+
const merged = /* @__PURE__ */ new Map();
|
|
985
954
|
for (const r of routes) {
|
|
986
955
|
const key = normalizePath(r.url);
|
|
987
|
-
if (!
|
|
956
|
+
if (!merged.has(key)) merged.set(key, { ...r, url: key });
|
|
988
957
|
}
|
|
958
|
+
return Array.from(merged.values());
|
|
989
959
|
}
|
|
990
960
|
async function discover(opts) {
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
await crawlRoutes({ baseUrl: opts.baseUrl, maxRoutes: crawlMax }),
|
|
1000
|
-
merged
|
|
1001
|
-
);
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
return Array.from(merged.values()).sort((a, b) => a.url.localeCompare(b.url));
|
|
961
|
+
const crawled = await crawlRoutes({
|
|
962
|
+
baseUrl: opts.baseUrl,
|
|
963
|
+
maxRoutes: opts.maxRoutes ?? 50
|
|
964
|
+
});
|
|
965
|
+
const deduped = dedupe(crawled);
|
|
966
|
+
const sampling = opts.sampleTemplates ?? true;
|
|
967
|
+
const routes = sampling === false ? deduped : collapseTemplates(deduped, sampling === true ? void 0 : sampling).routes;
|
|
968
|
+
return routes.sort((a, b) => a.url.localeCompare(b.url));
|
|
1005
969
|
}
|
|
1006
970
|
function envFiles(cwd) {
|
|
1007
971
|
const root = paths(cwd).root;
|
|
@@ -1879,6 +1843,23 @@ var noneJudge = {
|
|
|
1879
1843
|
return { kind: "judged", verdict: input.heuristicVerdict };
|
|
1880
1844
|
}
|
|
1881
1845
|
};
|
|
1846
|
+
async function fileExists2(p) {
|
|
1847
|
+
try {
|
|
1848
|
+
await access(p);
|
|
1849
|
+
return true;
|
|
1850
|
+
} catch {
|
|
1851
|
+
return false;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
async function readJsonOrNull(file) {
|
|
1855
|
+
try {
|
|
1856
|
+
return JSON.parse(await readFile(file, "utf8"));
|
|
1857
|
+
} catch {
|
|
1858
|
+
return null;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
// src/report/json.ts
|
|
1882
1863
|
async function writeReport(report, cwd = process.cwd()) {
|
|
1883
1864
|
const file = paths(cwd).report;
|
|
1884
1865
|
await mkdir(path.dirname(file), { recursive: true });
|
|
@@ -1996,7 +1977,7 @@ async function reconstructFromDisk(cwd, dirs) {
|
|
|
1996
1977
|
const manifest = await loadManifest(cwd);
|
|
1997
1978
|
if (!manifest) {
|
|
1998
1979
|
throw new Error(
|
|
1999
|
-
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent
|
|
1980
|
+
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent onboard\` first.`
|
|
2000
1981
|
);
|
|
2001
1982
|
}
|
|
2002
1983
|
const dirById = new Map(dirs.map((d) => [d.id, d]));
|
|
@@ -2040,7 +2021,7 @@ async function applyJudgments(opts = {}) {
|
|
|
2040
2021
|
const manifest = await loadManifest(cwd);
|
|
2041
2022
|
if (!manifest) {
|
|
2042
2023
|
throw new Error(
|
|
2043
|
-
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent
|
|
2024
|
+
`no manifest at ${paths(cwd).manifest}. Run \`blazediff-agent onboard\` first.`
|
|
2044
2025
|
);
|
|
2045
2026
|
}
|
|
2046
2027
|
const dirs = await readJudgmentDirs(paths(cwd).judgments);
|
|
@@ -3016,7 +2997,7 @@ async function loadNode(state) {
|
|
|
3016
2997
|
const manifest = await loadManifest(state.options.cwd);
|
|
3017
2998
|
if (!manifest) {
|
|
3018
2999
|
throw new Error(
|
|
3019
|
-
`no manifest found at ${paths(state.options.cwd).manifest}. Run \`blazediff
|
|
3000
|
+
`no manifest found at ${paths(state.options.cwd).manifest}. Run \`blazediff-agent onboard\` then \`/blazediff\` (or capture manually) first.`
|
|
3020
3001
|
);
|
|
3021
3002
|
}
|
|
3022
3003
|
return { entries: manifest.entries, manifest };
|
package/package.json
CHANGED