refactor: dedupe browser cli readers

This commit is contained in:
Peter Steinberger
2026-04-07 05:34:57 +01:00
parent 8d05bdda43
commit 8c8c5fa635
10 changed files with 65 additions and 68 deletions

View File

@@ -84,7 +84,7 @@ export function registerBrowserDebugCommands(
query: resolveProfileQuery(profile),
body: {
ref: ref.trim(),
targetId: opts.targetId?.trim() || undefined,
targetId: normalizeOptionalString(opts.targetId),
},
});
if (printJsonResult(parent, result)) {
@@ -190,7 +190,7 @@ export function registerBrowserDebugCommands(
path: "/trace/start",
query: resolveProfileQuery(profile),
body: {
targetId: opts.targetId?.trim() || undefined,
targetId: normalizeOptionalString(opts.targetId),
screenshots: Boolean(opts.screenshots),
snapshots: Boolean(opts.snapshots),
sources: Boolean(opts.sources),
@@ -218,8 +218,8 @@ export function registerBrowserDebugCommands(
path: "/trace/stop",
query: resolveProfileQuery(profile),
body: {
targetId: opts.targetId?.trim() || undefined,
path: opts.out?.trim() || undefined,
targetId: normalizeOptionalString(opts.targetId),
path: normalizeOptionalString(opts.out),
},
});
if (printJsonResult(parent, result)) {