@decocms/parity 0.33.49 → 0.33.51

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.
Files changed (2) hide show
  1. package/dist/cli.js +1064 -805
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -36924,7 +36924,7 @@ function releaseLlmSlot() {
36924
36924
  if (next)
36925
36925
  next();
36926
36926
  }
36927
- async function callTool(params) {
36927
+ async function callTool2(params) {
36928
36928
  const provider = getProvider();
36929
36929
  if (!provider)
36930
36930
  return null;
@@ -37364,7 +37364,7 @@ async function refineComponentsWithLlm(page, candidates) {
37364
37364
  "```"
37365
37365
  ].join(`
37366
37366
  `);
37367
- const result = await callTool({
37367
+ const result = await callTool2({
37368
37368
  feature: "component-detection",
37369
37369
  systemPrompt: SYSTEM_PROMPT5,
37370
37370
  userText,
@@ -37432,10 +37432,395 @@ order — never add, remove, merge, or split entries.
37432
37432
  import { DESCRIPTION, registerCommands } from "@decocms/vtex-cms";
37433
37433
  import { Command } from "commander";
37434
37434
 
37435
+ // src/commands/studio.ts
37436
+ import { execFileSync } from "node:child_process";
37437
+ import chalk from "chalk";
37438
+
37439
+ // src/board/studio.ts
37440
+ var TASK_STATUSES = [
37441
+ "triage",
37442
+ "todo",
37443
+ "in_progress",
37444
+ "in_review",
37445
+ "approved",
37446
+ "merged",
37447
+ "post_deploy_validation",
37448
+ "done",
37449
+ "archived"
37450
+ ];
37451
+ var LANE_TO_STUDIO = {
37452
+ triage: "triage",
37453
+ backlog: "todo",
37454
+ building: "in_progress",
37455
+ review: "in_review",
37456
+ done: "done",
37457
+ skipped: null
37458
+ };
37459
+ function studioConfigFromEnv(env = process.env) {
37460
+ const url = env.PARITY_STUDIO_URL;
37461
+ const token = env.PARITY_STUDIO_TOKEN;
37462
+ if (!url || !token)
37463
+ return null;
37464
+ return { url: mcpEndpoint(url), token };
37465
+ }
37466
+ function mcpEndpoint(url) {
37467
+ const trimmed = url.replace(/\/+$/, "");
37468
+ return /\/mcp(\/|$)/.test(trimmed) ? trimmed : `${trimmed}/mcp/self`;
37469
+ }
37470
+ function cardTitle(path) {
37471
+ return path;
37472
+ }
37473
+ var PARITY_COMMENT_PREFIX = "[parity]";
37474
+ function cardDescription(card) {
37475
+ const lines = [`kind: ${card.kind}`, `lane: ${card.column}`];
37476
+ if (card.blockers.length)
37477
+ lines.push(`blocked by: ${card.blockers.join(", ")}`);
37478
+ else if (card.column === "triage") {
37479
+ lines.push("scope not confirmed — no page/component edges yet");
37480
+ }
37481
+ return lines.join(`
37482
+ `);
37483
+ }
37484
+ function parseRpcBody(body) {
37485
+ const trimmed = body.trim();
37486
+ if (!trimmed.startsWith("event:") && !trimmed.startsWith("data:")) {
37487
+ return JSON.parse(trimmed);
37488
+ }
37489
+ const data = trimmed.split(`
37490
+ `).filter((l) => l.startsWith("data:")).map((l) => l.slice(5).trim()).filter(Boolean);
37491
+ const last = data[data.length - 1];
37492
+ if (!last)
37493
+ throw new Error("empty SSE response");
37494
+ return JSON.parse(last);
37495
+ }
37496
+ var callTool = async (cfg, name, args) => {
37497
+ const res = await fetch(cfg.url, {
37498
+ method: "POST",
37499
+ headers: {
37500
+ "content-type": "application/json",
37501
+ accept: "application/json, text/event-stream",
37502
+ authorization: `Bearer ${cfg.token}`
37503
+ },
37504
+ body: JSON.stringify({
37505
+ jsonrpc: "2.0",
37506
+ id: 1,
37507
+ method: "tools/call",
37508
+ params: { name, arguments: args }
37509
+ })
37510
+ });
37511
+ if (!res.ok) {
37512
+ throw new Error(`${name}: HTTP ${res.status} ${await res.text().catch(() => "")}`);
37513
+ }
37514
+ const payload = parseRpcBody(await res.text());
37515
+ if (payload.error)
37516
+ throw new Error(`${name}: ${payload.error.message ?? "unknown error"}`);
37517
+ const result = payload.result;
37518
+ if (result?.isError) {
37519
+ const text = result.content?.map((c) => c.text).join(" ") ?? "tool reported an error";
37520
+ throw new Error(`${name}: ${text}`);
37521
+ }
37522
+ return result?.structuredContent ?? {};
37523
+ };
37524
+ async function syncBoardToStudio(board, cfg, opts = {}, call = callTool) {
37525
+ const existing = await call(cfg, "TASK_BOARD_ITEM_LIST", {});
37526
+ const byTitle = new Map((existing.items ?? []).map((i) => [i.title, i]));
37527
+ const byId = new Map((existing.items ?? []).map((i) => [i.id, i]));
37528
+ const result = { created: 0, updated: 0, skipped: 0, ids: {} };
37529
+ const upsert = async (title, description, status, knownId) => {
37530
+ const found = (knownId ? byId.get(knownId) : undefined) ?? byTitle.get(title);
37531
+ if (found) {
37532
+ await call(cfg, "TASK_BOARD_ITEM_UPDATE", { id: found.id, title, status, description });
37533
+ result.updated += 1;
37534
+ return found.id;
37535
+ }
37536
+ const created = await call(cfg, "TASK_BOARD_ITEM_CREATE", {
37537
+ title,
37538
+ description,
37539
+ status,
37540
+ ...opts.repo ? { repo: opts.repo } : {}
37541
+ });
37542
+ result.created += 1;
37543
+ return created.item?.id;
37544
+ };
37545
+ for (const cards of Object.values(board.columns)) {
37546
+ for (const card of cards) {
37547
+ const status = LANE_TO_STUDIO[card.column];
37548
+ if (!status) {
37549
+ result.skipped += 1;
37550
+ continue;
37551
+ }
37552
+ const id = await upsert(cardTitle(card.path), cardDescription(card), status, card.boardItemId);
37553
+ if (id)
37554
+ result.ids[card.path] = id;
37555
+ }
37556
+ }
37557
+ for (const fix of opts.fixes ?? []) {
37558
+ await upsert(fix.title, fixDescription(fix), FIX_STATE_TO_STUDIO[fix.state]);
37559
+ }
37560
+ return result;
37561
+ }
37562
+ async function fetchClientNotes(pages, cfg, call = callTool) {
37563
+ const notes = [];
37564
+ for (const page of pages) {
37565
+ const res = await call(cfg, "TASK_BOARD_COMMENT_LIST", {
37566
+ taskBoardItemId: page.boardItemId
37567
+ });
37568
+ for (const c of res.comments ?? []) {
37569
+ if (c.body.trimStart().startsWith(PARITY_COMMENT_PREFIX))
37570
+ continue;
37571
+ if (c.resolved)
37572
+ continue;
37573
+ notes.push({
37574
+ path: page.path,
37575
+ boardItemId: page.boardItemId,
37576
+ commentId: c.id,
37577
+ body: c.body,
37578
+ createdAt: c.createdAt
37579
+ });
37580
+ }
37581
+ }
37582
+ return notes;
37583
+ }
37584
+ async function postParityComment(boardItemId, body, cfg, call = callTool) {
37585
+ await call(cfg, "TASK_BOARD_COMMENT_CREATE", {
37586
+ taskBoardItemId: boardItemId,
37587
+ body: `${PARITY_COMMENT_PREFIX} ${body}`
37588
+ });
37589
+ }
37590
+ var FIX_STATE_TO_STUDIO = {
37591
+ open: "todo",
37592
+ in_review: "in_review",
37593
+ closed: "done"
37594
+ };
37595
+ function fixDescription(fix) {
37596
+ const lines = [];
37597
+ if (fix.body)
37598
+ lines.push(fix.body);
37599
+ if (fix.prUrl)
37600
+ lines.push(`PR: ${fix.prUrl}`);
37601
+ return lines.join(`
37602
+ `);
37603
+ }
37604
+ async function listTasks(cfg, call = callTool) {
37605
+ const res = await call(cfg, "TASK_BOARD_ITEM_LIST", {});
37606
+ if (!Array.isArray(res.items))
37607
+ throw new Error("TASK_BOARD_ITEM_LIST: response has no items list");
37608
+ return { items: res.items, repos: res.repos ?? [], columns: res.columns ?? [] };
37609
+ }
37610
+ function findTask(items, ref) {
37611
+ const seq = ref.replace(/^#/, "");
37612
+ return items.find((t) => t.id === ref) ?? (/^\d+$/.test(seq) ? items.find((t) => String(t.keySeq) === seq) : undefined);
37613
+ }
37614
+ async function taskComments(cfg, taskId, call = callTool) {
37615
+ const res = await call(cfg, "TASK_BOARD_COMMENT_LIST", {
37616
+ taskBoardItemId: taskId
37617
+ });
37618
+ return res.comments ?? [];
37619
+ }
37620
+ async function taskPrs(cfg, taskId, call = callTool) {
37621
+ const res = await call(cfg, "TASK_BOARD_ITEM_PRS_GET", {
37622
+ taskBoardItemId: taskId
37623
+ });
37624
+ return res.prs ?? [];
37625
+ }
37626
+ async function automatedColumns(cfg, call = callTool) {
37627
+ const res = await call(cfg, "TASK_BOARD_AUTOMATION_LIST", {});
37628
+ return (res.automations ?? []).map((a) => a.columnKey).filter((k) => Boolean(k));
37629
+ }
37630
+ async function moveTask(cfg, taskId, status, call = callTool) {
37631
+ await call(cfg, "TASK_BOARD_ITEM_UPDATE", { id: taskId, status });
37632
+ }
37633
+
37634
+ // src/commands/studio.ts
37635
+ var CLOSED = new Set(["done", "archived", "merged"]);
37636
+ var PRIORITY_RANK = { urgent: 0, high: 1, medium: 2, low: 3, none: 4 };
37637
+ function config() {
37638
+ const cfg = studioConfigFromEnv();
37639
+ if (!cfg) {
37640
+ console.error(chalk.red("Studio not configured — set PARITY_STUDIO_URL (the org's …/api/<org>/mcp/self) and PARITY_STUDIO_TOKEN."));
37641
+ }
37642
+ return cfg;
37643
+ }
37644
+ function fail(err) {
37645
+ console.error(chalk.red(err instanceof Error ? err.message : String(err)));
37646
+ return 1;
37647
+ }
37648
+ function seq(t) {
37649
+ return t.keySeq != null ? `#${t.keySeq}` : t.id;
37650
+ }
37651
+ function line(t) {
37652
+ const tags = [t.type, t.priority && t.priority !== "none" ? t.priority : null].filter(Boolean).join("·");
37653
+ return `${chalk.bold(seq(t).padEnd(6))} ${t.status.padEnd(12)} ${chalk.dim(`[${tags}]`.padEnd(16))} ${t.title}${t.repo ? chalk.dim(` ${t.repo}`) : ""}`;
37654
+ }
37655
+ async function resolveTask(cfg, ref, call) {
37656
+ const board = await listTasks(cfg, call);
37657
+ const task = findTask(board.items, ref);
37658
+ if (!task)
37659
+ return new Error(`No task "${ref}" on this board. \`parity studio tasks\` lists them.`);
37660
+ return { task, columns: board.columns.map((c) => c.key) };
37661
+ }
37662
+ async function studioTasksCommand(opts, call = callTool) {
37663
+ const cfg = config();
37664
+ if (!cfg)
37665
+ return 1;
37666
+ try {
37667
+ const board = await listTasks(cfg, call);
37668
+ const statuses = opts.status?.split(",").map((s) => s.trim()).filter(Boolean);
37669
+ const q = opts.search?.toLowerCase();
37670
+ const shown = board.items.filter((t) => statuses ? statuses.includes(t.status) : opts.all || !CLOSED.has(t.status)).filter((t) => !opts.repo || t.repo === opts.repo).filter((t) => !opts.type || t.type === opts.type).filter((t) => !q || t.title.toLowerCase().includes(q) || (t.description ?? "").toLowerCase().includes(q)).sort((a, b) => (PRIORITY_RANK[a.priority ?? "none"] ?? 5) - (PRIORITY_RANK[b.priority ?? "none"] ?? 5) || Number(a.keySeq ?? 0) - Number(b.keySeq ?? 0));
37671
+ const limited = opts.limit ? shown.slice(0, opts.limit) : shown;
37672
+ if (opts.json) {
37673
+ console.log(JSON.stringify({ total: board.items.length, matched: shown.length, tasks: limited }, null, 2));
37674
+ return 0;
37675
+ }
37676
+ if (board.items.length === 0) {
37677
+ console.log(chalk.yellow("The board is empty."));
37678
+ return 0;
37679
+ }
37680
+ for (const t of limited)
37681
+ console.log(line(t));
37682
+ const hidden = board.items.length - shown.length;
37683
+ console.log(chalk.dim(` ${shown.length} of ${board.items.length} task(s)${limited.length < shown.length ? `, first ${limited.length} shown` : ""}${hidden > 0 && !statuses && !opts.all ? ` · ${hidden} done/archived/merged or filtered out (--all shows them)` : ""}`));
37684
+ return 0;
37685
+ } catch (err) {
37686
+ return fail(err);
37687
+ }
37688
+ }
37689
+ async function studioShowCommand(opts, call = callTool) {
37690
+ const cfg = config();
37691
+ if (!cfg)
37692
+ return 1;
37693
+ try {
37694
+ const found = await resolveTask(cfg, opts.task, call);
37695
+ if (found instanceof Error)
37696
+ return fail(found);
37697
+ const { task } = found;
37698
+ const [comments, prs] = await Promise.all([
37699
+ taskComments(cfg, task.id, call),
37700
+ taskPrs(cfg, task.id, call).catch(() => null)
37701
+ ]);
37702
+ if (opts.json) {
37703
+ console.log(JSON.stringify({ task, comments, prs }, null, 2));
37704
+ return 0;
37705
+ }
37706
+ console.log(line(task));
37707
+ console.log(chalk.dim(` id ${task.id}${task.statusSince ? ` · in ${task.status} since ${task.statusSince}` : ""}`));
37708
+ if (task.description)
37709
+ console.log(`
37710
+ ${task.description}
37711
+ `);
37712
+ if (prs === null)
37713
+ console.log(chalk.dim(" (could not read linked PRs)"));
37714
+ for (const pr of prs ?? []) {
37715
+ const state = pr.merged ? "merged" : pr.draft ? "draft" : pr.state ?? "?";
37716
+ console.log(` PR ${state.padEnd(7)} ${pr.url}${pr.title ? chalk.dim(` ${pr.title}`) : ""}`);
37717
+ }
37718
+ const open = comments.filter((c) => !c.resolved);
37719
+ if (open.length)
37720
+ console.log(chalk.bold(`
37721
+ Comments (${open.length} open)`));
37722
+ for (const c of open)
37723
+ console.log(` ${chalk.dim(c.createdAt)} ${c.body.replace(/\n/g, `
37724
+ `)}`);
37725
+ return 0;
37726
+ } catch (err) {
37727
+ return fail(err);
37728
+ }
37729
+ }
37730
+ function whoAmI() {
37731
+ try {
37732
+ return execFileSync("git", ["config", "user.name"], { encoding: "utf8" }).trim() || "parity";
37733
+ } catch {
37734
+ return "parity";
37735
+ }
37736
+ }
37737
+ async function guardedMove(cfg, task, columns, to, opts, call) {
37738
+ const valid = columns.length ? columns : [...TASK_STATUSES];
37739
+ if (!valid.includes(to))
37740
+ return fail(new Error(`"${to}" is not a column of this board: ${valid.join(", ")}.`));
37741
+ if (task.status === to) {
37742
+ console.log(chalk.dim(`${seq(task)} is already in ${to}.`));
37743
+ return 0;
37744
+ }
37745
+ const automated = await automatedColumns(cfg, call);
37746
+ if (automated.includes(to) && !opts.allowAutomation) {
37747
+ return fail(new Error(`The "${to}" column has an automation: landing ${seq(task)} there starts the board's agent on it. Pass --allow-automation if that is the point.`));
37748
+ }
37749
+ if (!opts.yes) {
37750
+ console.log(chalk.yellow("dry run — nothing changed. Pass --yes."));
37751
+ console.log(` ${seq(task)} ${task.status} → ${to} ${task.title}`);
37752
+ if (opts.comment)
37753
+ console.log(chalk.dim(` and comment: ${PARITY_COMMENT_PREFIX} ${opts.comment}`));
37754
+ return 0;
37755
+ }
37756
+ await moveTask(cfg, task.id, to, call);
37757
+ if (opts.comment)
37758
+ await postParityComment(task.id, opts.comment, cfg, call);
37759
+ console.log(`${chalk.green("✓")} ${seq(task)} ${task.status} → ${to} ${task.title}`);
37760
+ return 0;
37761
+ }
37762
+ async function studioTakeCommand(opts, call = callTool) {
37763
+ const cfg = config();
37764
+ if (!cfg)
37765
+ return 1;
37766
+ try {
37767
+ const found = await resolveTask(cfg, opts.task, call);
37768
+ if (found instanceof Error)
37769
+ return fail(found);
37770
+ const { task, columns } = found;
37771
+ if (!["triage", "todo"].includes(task.status) && !opts.force) {
37772
+ return fail(new Error(`${seq(task)} is in ${task.status}, not triage/todo — someone may already be on it. Pass --force to take it anyway.`));
37773
+ }
37774
+ return await guardedMove(cfg, task, columns, "in_progress", {
37775
+ yes: opts.yes,
37776
+ allowAutomation: opts.allowAutomation,
37777
+ comment: `taken by ${opts.by ?? whoAmI()}`
37778
+ }, call);
37779
+ } catch (err) {
37780
+ return fail(err);
37781
+ }
37782
+ }
37783
+ async function studioMoveCommand(opts, call = callTool) {
37784
+ const cfg = config();
37785
+ if (!cfg)
37786
+ return 1;
37787
+ try {
37788
+ const found = await resolveTask(cfg, opts.task, call);
37789
+ if (found instanceof Error)
37790
+ return fail(found);
37791
+ return await guardedMove(cfg, found.task, found.columns, opts.to, opts, call);
37792
+ } catch (err) {
37793
+ return fail(err);
37794
+ }
37795
+ }
37796
+ async function studioCommentCommand(opts, call = callTool) {
37797
+ const cfg = config();
37798
+ if (!cfg)
37799
+ return 1;
37800
+ const body = opts.body.trim();
37801
+ if (!body)
37802
+ return fail(new Error("Comment body cannot be empty."));
37803
+ try {
37804
+ const found = await resolveTask(cfg, opts.task, call);
37805
+ if (found instanceof Error)
37806
+ return fail(found);
37807
+ if (!opts.yes) {
37808
+ console.log(chalk.yellow("dry run — nothing posted. Pass --yes."));
37809
+ console.log(` on ${seq(found.task)}: ${PARITY_COMMENT_PREFIX} ${body}`);
37810
+ return 0;
37811
+ }
37812
+ await postParityComment(found.task.id, body, cfg, call);
37813
+ console.log(`${chalk.green("✓")} commented on ${seq(found.task)}`);
37814
+ return 0;
37815
+ } catch (err) {
37816
+ return fail(err);
37817
+ }
37818
+ }
37819
+
37435
37820
  // src/commands/audit.ts
37436
37821
  import { writeFileSync as writeFileSync2 } from "node:fs";
37437
37822
  import { join as join2 } from "node:path";
37438
- import chalk2 from "chalk";
37823
+ import chalk3 from "chalk";
37439
37824
  import ora from "ora";
37440
37825
 
37441
37826
  // src/diff/console.ts
@@ -41977,7 +42362,7 @@ function listRuns(outputDir) {
41977
42362
  }
41978
42363
 
41979
42364
  // src/util/pages.ts
41980
- import chalk from "chalk";
42365
+ import chalk2 from "chalk";
41981
42366
  var COUNT_LIKE = /^\d+$/;
41982
42367
  var PLP_PDP_AUTO_TOKENS = ["category-auto", "pdp-auto"];
41983
42368
  function parsePageList(raw, options = {}) {
@@ -42004,7 +42389,7 @@ function validatePageEntry(entry, tokens = [], allowPairs = false) {
42004
42389
  }
42005
42390
  function resolveDeprecatedPagesLimit(opts, defaultValue) {
42006
42391
  if (opts.pages !== undefined) {
42007
- console.warn(chalk.yellow(" ⚠ --pages <n> is deprecated here — use --limit <n> instead. " + "(--pages now always means a list of paths, everywhere else in parity.)"));
42392
+ console.warn(chalk2.yellow(" ⚠ --pages <n> is deprecated here — use --limit <n> instead. " + "(--pages now always means a list of paths, everywhere else in parity.)"));
42008
42393
  return opts.pages;
42009
42394
  }
42010
42395
  return opts.limit ?? defaultValue;
@@ -42020,21 +42405,21 @@ var SEVERITY_RANK2 = {
42020
42405
  async function auditCommand(opts) {
42021
42406
  const viewport = parseViewport(opts.viewport);
42022
42407
  if (!viewport) {
42023
- console.error(chalk2.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
42408
+ console.error(chalk3.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
42024
42409
  return 2;
42025
42410
  }
42026
42411
  let baseUrl;
42027
42412
  try {
42028
42413
  baseUrl = new URL(opts.url);
42029
42414
  } catch {
42030
- console.error(chalk2.red(`--url inválido: ${opts.url}`));
42415
+ console.error(chalk3.red(`--url inválido: ${opts.url}`));
42031
42416
  return 2;
42032
42417
  }
42033
42418
  let pages;
42034
42419
  try {
42035
42420
  pages = parsePageList(opts.pages, { fallback: ["/"] });
42036
42421
  } catch (err) {
42037
- console.error(chalk2.red(err.message));
42422
+ console.error(chalk3.red(err.message));
42038
42423
  return 2;
42039
42424
  }
42040
42425
  const failOn = (opts.failOn || "critical,high").split(",").map((s) => s.trim()).filter(Boolean);
@@ -42042,11 +42427,11 @@ async function auditCommand(opts) {
42042
42427
  const paths = createRunDir(opts.output, runId);
42043
42428
  const startedAt = Date.now();
42044
42429
  if (!opts.json) {
42045
- console.log(chalk2.bold(`
42430
+ console.log(chalk3.bold(`
42046
42431
  parity audit ${runId}`));
42047
- console.log(chalk2.dim(` url: ${opts.url}`));
42048
- console.log(chalk2.dim(` viewport: ${viewport}`));
42049
- console.log(chalk2.dim(` páginas: ${pages.join(", ")}
42432
+ console.log(chalk3.dim(` url: ${opts.url}`));
42433
+ console.log(chalk3.dim(` viewport: ${viewport}`));
42434
+ console.log(chalk3.dim(` páginas: ${pages.join(", ")}
42050
42435
  `));
42051
42436
  }
42052
42437
  const spinner = opts.json ? null : ora("Lançando browser…").start();
@@ -42095,7 +42480,7 @@ async function auditCommand(opts) {
42095
42480
  });
42096
42481
  }
42097
42482
  if (captures.length === 0) {
42098
- console.error(chalk2.red(`
42483
+ console.error(chalk3.red(`
42099
42484
  ✖ nenhuma captura completada`));
42100
42485
  return 2;
42101
42486
  }
@@ -42159,17 +42544,17 @@ function safePath(path) {
42159
42544
  }
42160
42545
  function printSummary(result, pages, reportPath) {
42161
42546
  const { totals } = result;
42162
- const verdict = totals.critical > 0 ? chalk2.red.bold("✖ FAIL") : totals.high > 0 ? chalk2.red("✖ FAIL") : totals.issues > 0 ? chalk2.yellow("⚠ WARN") : chalk2.green.bold("✓ PASS");
42547
+ const verdict = totals.critical > 0 ? chalk3.red.bold("✖ FAIL") : totals.high > 0 ? chalk3.red("✖ FAIL") : totals.issues > 0 ? chalk3.yellow("⚠ WARN") : chalk3.green.bold("✓ PASS");
42163
42548
  console.log(`
42164
42549
  ${verdict}`);
42165
42550
  console.log(` ${totals.pages} página(s) · ${totals.issues} issue(s)`);
42166
- console.log(` ${chalk2.red(`${totals.critical} critical`)} · ${chalk2.red(`${totals.high} high`)} · ${chalk2.yellow(`${totals.medium} medium`)} · ${chalk2.dim(`${totals.low} low`)}`);
42551
+ console.log(` ${chalk3.red(`${totals.critical} critical`)} · ${chalk3.red(`${totals.high} high`)} · ${chalk3.yellow(`${totals.medium} medium`)} · ${chalk3.dim(`${totals.low} low`)}`);
42167
42552
  const top = result.allIssues.slice(0, 5);
42168
42553
  if (top.length > 0) {
42169
42554
  console.log(`
42170
42555
  Top issues:`);
42171
42556
  for (const issue of top) {
42172
- const sevTag = issue.severity === "critical" ? chalk2.red.bold("[critical]") : issue.severity === "high" ? chalk2.red("[high] ") : issue.severity === "medium" ? chalk2.yellow("[medium] ") : chalk2.dim("[low] ");
42557
+ const sevTag = issue.severity === "critical" ? chalk3.red.bold("[critical]") : issue.severity === "high" ? chalk3.red("[high] ") : issue.severity === "medium" ? chalk3.yellow("[medium] ") : chalk3.dim("[low] ");
42173
42558
  console.log(` ${sevTag} ${issue.summary.slice(0, 200)}`);
42174
42559
  }
42175
42560
  }
@@ -42184,7 +42569,7 @@ async function openReport(path) {
42184
42569
  }
42185
42570
 
42186
42571
  // src/commands/baseline.ts
42187
- import chalk3 from "chalk";
42572
+ import chalk4 from "chalk";
42188
42573
 
42189
42574
  // src/storage/baselines.ts
42190
42575
  import {
@@ -42273,32 +42658,32 @@ async function baselineSet(runId, opts) {
42273
42658
  try {
42274
42659
  const run = loadRun(opts.output, runId);
42275
42660
  const path = saveBaseline(opts.name, run);
42276
- console.log(chalk3.green(`✔ Baseline "${opts.name}" criada a partir de ${runId}`));
42277
- console.log(chalk3.dim(` → ${path}`));
42661
+ console.log(chalk4.green(`✔ Baseline "${opts.name}" criada a partir de ${runId}`));
42662
+ console.log(chalk4.dim(` → ${path}`));
42278
42663
  return 0;
42279
42664
  } catch (err) {
42280
- console.error(chalk3.red(`✖ ${err.message}`));
42665
+ console.error(chalk4.red(`✖ ${err.message}`));
42281
42666
  return 1;
42282
42667
  }
42283
42668
  }
42284
42669
  function baselineList() {
42285
42670
  const items = listBaselines();
42286
42671
  if (items.length === 0) {
42287
- console.log(chalk3.dim("Nenhuma baseline salva."));
42672
+ console.log(chalk4.dim("Nenhuma baseline salva."));
42288
42673
  return 0;
42289
42674
  }
42290
42675
  for (const b of items) {
42291
- console.log(` ${chalk3.bold(b.name)} ${chalk3.dim(b.createdAt)} ${chalk3.dim(b.path)}`);
42676
+ console.log(` ${chalk4.bold(b.name)} ${chalk4.dim(b.createdAt)} ${chalk4.dim(b.path)}`);
42292
42677
  }
42293
42678
  return 0;
42294
42679
  }
42295
42680
  function baselineUnset(name) {
42296
42681
  try {
42297
42682
  deleteBaseline(name);
42298
- console.log(chalk3.green(`✔ Baseline "${name}" removida`));
42683
+ console.log(chalk4.green(`✔ Baseline "${name}" removida`));
42299
42684
  return 0;
42300
42685
  } catch (err) {
42301
- console.error(chalk3.red(`✖ ${err.message}`));
42686
+ console.error(chalk4.red(`✖ ${err.message}`));
42302
42687
  return 1;
42303
42688
  }
42304
42689
  }
@@ -42306,7 +42691,7 @@ function baselineUnset(name) {
42306
42691
  // src/commands/benchmark.ts
42307
42692
  import { writeFileSync as writeFileSync8 } from "node:fs";
42308
42693
  import { join as join10 } from "node:path";
42309
- import chalk4 from "chalk";
42694
+ import chalk5 from "chalk";
42310
42695
  import ora2 from "ora";
42311
42696
 
42312
42697
  // src/engine/benchmark.ts
@@ -42639,7 +43024,7 @@ Responda SEMPRE via tool_use suggest_recovery.
42639
43024
  `.trim();
42640
43025
  async function suggestRecovery(input) {
42641
43026
  const compacted = compactHtmlForRecovery(input.html);
42642
- const inp = await callTool({
43027
+ const inp = await callTool2({
42643
43028
  feature: "step-recovery",
42644
43029
  systemPrompt: RECOVERY_SYSTEM_PROMPT,
42645
43030
  userText: `Step: ${input.stepName}
@@ -42831,7 +43216,7 @@ function isBlocked(href) {
42831
43216
  }
42832
43217
  }
42833
43218
  async function llmPick(candidates) {
42834
- const input = await callTool({
43219
+ const input = await callTool2({
42835
43220
  feature: "plp-matching",
42836
43221
  systemPrompt: "Você escolhe links de categoria reais em sites de e-commerce. Categoria real = página que lista produtos à venda. Evite: institucional, atendimento, blog, vale-presente, lojas físicas. Prefira URLs com /c/, /category/, /collections/ ou claramente vinculadas a tipos de produto.",
42837
43222
  userText: `Candidatos:
@@ -47809,7 +48194,7 @@ ${compactHtmlForSelectors(html.plp, PLP_MAX_CHARS)}
47809
48194
  ${compactHtmlForSelectors(html.pdp, PDP_MAX_CHARS)}
47810
48195
  \`\`\``);
47811
48196
  }
47812
- const input = await callTool({
48197
+ const input = await callTool2({
47813
48198
  feature: "selector-discovery",
47814
48199
  systemPrompt: SYSTEM_PROMPT,
47815
48200
  userText: sections.join(`
@@ -48501,7 +48886,7 @@ function num(v, fallback) {
48501
48886
  async function benchmarkCommand(opts) {
48502
48887
  const viewports = opts.viewports.split(",").map((s) => s.trim()).filter((s) => s === "mobile" || s === "desktop");
48503
48888
  if (viewports.length === 0) {
48504
- console.error(chalk4.red("Nenhum viewport válido (use mobile,desktop)"));
48889
+ console.error(chalk5.red("Nenhum viewport válido (use mobile,desktop)"));
48505
48890
  return 2;
48506
48891
  }
48507
48892
  const warmupRuns = num(opts.warmupRuns, 2);
@@ -48516,13 +48901,13 @@ async function benchmarkCommand(opts) {
48516
48901
  const learned = loadLearned();
48517
48902
  const runId = newRunId();
48518
48903
  const paths = createRunDir(opts.output, runId);
48519
- console.log(chalk4.bold(`
48904
+ console.log(chalk5.bold(`
48520
48905
  parity benchmark ${runId}`));
48521
- console.log(chalk4.dim(` prod (Fresh): ${opts.prod}`));
48522
- console.log(chalk4.dim(` cand (TanStack): ${opts.cand}`));
48523
- console.log(chalk4.dim(` viewports: ${viewports.join(", ")} · warmup: ${warmupRuns} · medido: ${measuredRuns} · paginações: ${paginations} · vitals: ${runVitals ? "sim" : "não"}`));
48906
+ console.log(chalk5.dim(` prod (Fresh): ${opts.prod}`));
48907
+ console.log(chalk5.dim(` cand (TanStack): ${opts.cand}`));
48908
+ console.log(chalk5.dim(` viewports: ${viewports.join(", ")} · warmup: ${warmupRuns} · medido: ${measuredRuns} · paginações: ${paginations} · vitals: ${runVitals ? "sim" : "não"}`));
48524
48909
  if (isLlmAvailable())
48525
- console.log(chalk4.dim(` llm: ${providerLabel()}`));
48910
+ console.log(chalk5.dim(` llm: ${providerLabel()}`));
48526
48911
  console.log("");
48527
48912
  let platform = "custom";
48528
48913
  let prodHomeHtml;
@@ -48542,7 +48927,7 @@ async function benchmarkCommand(opts) {
48542
48927
  }
48543
48928
  } catch {}
48544
48929
  const journey = opts.journey === "content" || opts.journey === "commerce" ? opts.journey : detectSiteProfile({ url: opts.prod, html: prodHomeHtml }) === "content" ? "content" : "commerce";
48545
- console.log(chalk4.dim(` journey: ${journey}${opts.journey ? "" : " (auto)"}`));
48930
+ console.log(chalk5.dim(` journey: ${journey}${opts.journey ? "" : " (auto)"}`));
48546
48931
  const spinner = ora2("Lançando browser…").start();
48547
48932
  const sides = [];
48548
48933
  let favicon = null;
@@ -48551,9 +48936,9 @@ async function benchmarkCommand(opts) {
48551
48936
  spinner.succeed("Browser pronto");
48552
48937
  try {
48553
48938
  for (const viewport of viewports) {
48554
- console.log(chalk4.bold(`
48939
+ console.log(chalk5.bold(`
48555
48940
  ── ${viewport} ─────────────────────────────`));
48556
- const onEvent = (m) => console.log(chalk4.dim(` ${m}`));
48941
+ const onEvent = (m) => console.log(chalk5.dim(` ${m}`));
48557
48942
  const common = (side, base) => ({
48558
48943
  browser,
48559
48944
  base,
@@ -48586,7 +48971,7 @@ async function benchmarkCommand(opts) {
48586
48971
  onEvent
48587
48972
  });
48588
48973
  if (!contentPaths) {
48589
- console.error(chalk4.red(`
48974
+ console.error(chalk5.red(`
48590
48975
  ✗ batedor não achou 2 rotas de conteúdo que funcionem nos dois sites (${viewport}).
48591
48976
  Verifique se as URLs batem, ou rode com --journey commerce se o site tiver PLP/PDP.`));
48592
48977
  return 2;
@@ -48609,7 +48994,7 @@ async function benchmarkCommand(opts) {
48609
48994
  onEvent
48610
48995
  });
48611
48996
  if (!targetPaths) {
48612
- console.error(chalk4.red(`
48997
+ console.error(chalk5.red(`
48613
48998
  ✗ batedor não achou uma PLP + PDP que funcionem nos dois sites (${viewport}).
48614
48999
  Verifique se as URLs batem e/ou passe --plp com uma categoria que exista nos DOIS.`));
48615
49000
  return 2;
@@ -48648,8 +49033,8 @@ async function benchmarkCommand(opts) {
48648
49033
  const html = renderBenchmarkHtml(report, { lang });
48649
49034
  writeFileSync8(paths.reportHtml, html, "utf8");
48650
49035
  printSummary2(report);
48651
- console.log(chalk4.dim(` → ${paths.reportHtml}`));
48652
- console.log(chalk4.dim(` → HAR: ${paths.harDir}/user-navigation-benchmark-*.har`));
49036
+ console.log(chalk5.dim(` → ${paths.reportHtml}`));
49037
+ console.log(chalk5.dim(` → HAR: ${paths.harDir}/user-navigation-benchmark-*.har`));
48653
49038
  console.log("");
48654
49039
  if (opts.open) {
48655
49040
  const { default: open } = await import("open");
@@ -48669,20 +49054,20 @@ function printSummary2(report) {
48669
49054
  if (!prod || !cand)
48670
49055
  continue;
48671
49056
  console.log("");
48672
- console.log(chalk4.bold(` [${viewport}] tempo total da jornada`));
49057
+ console.log(chalk5.bold(` [${viewport}] tempo total da jornada`));
48673
49058
  const head = speedupHeadline(prod, cand);
48674
- const speedupText = !head.reliable ? chalk4.yellow("inconclusivo — passo(s) capado(s)/com erro, ver abaixo") : head.value >= 1 ? chalk4.green(`${head.value.toFixed(1)}× mais rápido`) : chalk4.yellow(`${head.value.toFixed(2)}×`);
48675
- console.log(` Fresh ${chalk4.cyan(fmt(prod.totalMs))} → TanStack ${chalk4.magenta(fmt(cand.totalMs))} ${speedupText}`);
49059
+ const speedupText = !head.reliable ? chalk5.yellow("inconclusivo — passo(s) capado(s)/com erro, ver abaixo") : head.value >= 1 ? chalk5.green(`${head.value.toFixed(1)}× mais rápido`) : chalk5.yellow(`${head.value.toFixed(2)}×`);
49060
+ console.log(` Fresh ${chalk5.cyan(fmt(prod.totalMs))} → TanStack ${chalk5.magenta(fmt(cand.totalMs))} ${speedupText}`);
48676
49061
  for (const cs of cand.steps) {
48677
49062
  const ps = prod.steps.find((s) => s.step === cs.step);
48678
- const flag = ps?.ok === false || cs.ok === false ? chalk4.red(` ✗ ERRO: ${cs.ok === false ? "cand" : "prod"} ${cs.note ?? ""}`) : "";
49063
+ const flag = ps?.ok === false || cs.ok === false ? chalk5.red(` ✗ ERRO: ${cs.ok === false ? "cand" : "prod"} ${cs.note ?? ""}`) : "";
48679
49064
  console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)} cand ${fmt(cs.ms).padStart(8)}${flag}`);
48680
49065
  }
48681
49066
  }
48682
49067
  const failed = report.sides.flatMap((s) => s.steps.filter((st) => st.ok === false).map((st) => `${s.side}/${st.step}`));
48683
49068
  if (failed.length > 0) {
48684
49069
  console.log("");
48685
- console.log(chalk4.red(` ⚠ ${failed.length} passo(s) com erro (${failed.join(", ")}) — tempos não confiáveis nesses passos. Veja o report.`));
49070
+ console.log(chalk5.red(` ⚠ ${failed.length} passo(s) com erro (${failed.join(", ")}) — tempos não confiáveis nesses passos. Veja o report.`));
48686
49071
  }
48687
49072
  }
48688
49073
 
@@ -48704,7 +49089,7 @@ async function runWithConcurrency(items, workers, fn) {
48704
49089
 
48705
49090
  // src/commands/cache.ts
48706
49091
  import { join as join13 } from "node:path";
48707
- import chalk5 from "chalk";
49092
+ import chalk6 from "chalk";
48708
49093
  import ora3 from "ora";
48709
49094
 
48710
49095
  // src/diff/cache.ts
@@ -53758,7 +54143,7 @@ async function visualSemanticDiff(input) {
53758
54143
  if (heatmapB64) {
53759
54144
  userImages.push({ base64: heatmapB64, mediaType: "image/png" });
53760
54145
  }
53761
- const result = await callTool({
54146
+ const result = await callTool2({
53762
54147
  feature: "visual-diff",
53763
54148
  systemPrompt: SYSTEM_PROMPT2,
53764
54149
  userText,
@@ -56625,10 +57010,10 @@ async function cacheCommand(opts) {
56625
57010
  const t0 = Date.now();
56626
57011
  const runId = newRunId();
56627
57012
  const paths = createRunDir(opts.output, runId);
56628
- console.log(chalk5.bold(`
57013
+ console.log(chalk6.bold(`
56629
57014
  parity cache ${runId}`));
56630
- console.log(chalk5.dim(` prod: ${opts.prod}`));
56631
- console.log(chalk5.dim(` cand: ${opts.cand}${candOnly ? " (cand-only)" : ""}`));
57015
+ console.log(chalk6.dim(` prod: ${opts.prod}`));
57016
+ console.log(chalk6.dim(` cand: ${opts.cand}${candOnly ? " (cand-only)" : ""}`));
56632
57017
  const discoverSpinner = ora3("Descobrindo páginas (sitemap)…").start();
56633
57018
  const pagePaths = await discoverPagePaths(opts.prod, opts, limit);
56634
57019
  if (pagePaths.length === 0) {
@@ -56661,7 +57046,7 @@ async function cacheCommand(opts) {
56661
57046
  completed++;
56662
57047
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
56663
57048
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
56664
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk5.cyan("prod") : chalk5.magenta("cand")} ${task.path} (${task.viewport})`;
57049
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk6.cyan("prod") : chalk6.magenta("cand")} ${task.path} (${task.viewport})`;
56665
57050
  }
56666
57051
  });
56667
57052
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -56731,8 +57116,8 @@ async function cacheCommand(opts) {
56731
57116
  `, "utf8");
56732
57117
  printSummary3(cacheResult);
56733
57118
  console.log("");
56734
- console.log(chalk5.dim(` → ${paths.reportHtml}`));
56735
- console.log(chalk5.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview com iframe proxy ativo`));
57119
+ console.log(chalk6.dim(` → ${paths.reportHtml}`));
57120
+ console.log(chalk6.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview com iframe proxy ativo`));
56736
57121
  console.log("");
56737
57122
  if (opts.open) {
56738
57123
  const { default: open } = await import("open");
@@ -56823,16 +57208,16 @@ async function discoverPagePaths(prodUrl, opts, limit) {
56823
57208
  function printSummary3(check) {
56824
57209
  const data = check.data ?? {};
56825
57210
  console.log("");
56826
- console.log(chalk5.bold(" Summary:"));
56827
- console.log(` ${chalk5.green(`${((data.hitRate ?? 0) * 100).toFixed(0)}%`)} cache hit rate (cand)${data.prodHitRate != null ? ` ${chalk5.dim(`(prod: ${(data.prodHitRate * 100).toFixed(0)}%)`)}` : ""}`);
56828
- console.log(` ${chalk5.red(data.opportunityCount ?? 0)} oportunidades — ${((data.opportunityBytes ?? 0) / 1024).toFixed(0)} KB`);
56829
- console.log(` ${chalk5.dim(check.issues.length)} issue(s) gerada(s)`);
57211
+ console.log(chalk6.bold(" Summary:"));
57212
+ console.log(` ${chalk6.green(`${((data.hitRate ?? 0) * 100).toFixed(0)}%`)} cache hit rate (cand)${data.prodHitRate != null ? ` ${chalk6.dim(`(prod: ${(data.prodHitRate * 100).toFixed(0)}%)`)}` : ""}`);
57213
+ console.log(` ${chalk6.red(data.opportunityCount ?? 0)} oportunidades — ${((data.opportunityBytes ?? 0) / 1024).toFixed(0)} KB`);
57214
+ console.log(` ${chalk6.dim(check.issues.length)} issue(s) gerada(s)`);
56830
57215
  }
56831
57216
 
56832
57217
  // src/commands/cache-gap.ts
56833
57218
  import { existsSync as existsSync11, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "node:fs";
56834
57219
  import { join as join14 } from "node:path";
56835
- import chalk6 from "chalk";
57220
+ import chalk7 from "chalk";
56836
57221
  import ora4 from "ora";
56837
57222
 
56838
57223
  // src/diff/cache-probe.ts
@@ -57270,7 +57655,7 @@ async function cacheGapCommand(opts, probe = httpProbe) {
57270
57655
  const wanted = (opts.decorations ?? "utm,gclid,srsltid,skuId,nonce").split(",").map((x) => x.trim()).filter((x) => {
57271
57656
  if (x in table)
57272
57657
  return true;
57273
- console.log(chalk6.yellow(` ⚠ decoração desconhecida ignorada: "${x}"`));
57658
+ console.log(chalk7.yellow(` ⚠ decoração desconhecida ignorada: "${x}"`));
57274
57659
  return false;
57275
57660
  });
57276
57661
  progress.start(`fase 2 — ${wanted.length} decorações × ${chosen.length} rotas`);
@@ -57313,7 +57698,7 @@ async function cacheGapCommand(opts, probe = httpProbe) {
57313
57698
  if (wantLoaders) {
57314
57699
  const probes = loadProbes(opts);
57315
57700
  if (probes.length === 0) {
57316
- console.log(chalk6.yellow(" fase 3 pulada — sem --dir, nada de blocks.gen.json"));
57701
+ console.log(chalk7.yellow(" fase 3 pulada — sem --dir, nada de blocks.gen.json"));
57317
57702
  } else {
57318
57703
  progress.start(`fase 3 — ${probes.length} loaders (serial + fanned)`);
57319
57704
  const lSamples = Math.max(2, opts.loaderSamples ?? 8);
@@ -57327,10 +57712,10 @@ async function cacheGapCommand(opts, probe = httpProbe) {
57327
57712
  progress.stop();
57328
57713
  if (err instanceof RequestBudgetExceeded) {
57329
57714
  truncated = true;
57330
- console.log(chalk6.yellow(` ⚠ ${err.message} — relatório parcial`));
57715
+ console.log(chalk7.yellow(` ⚠ ${err.message} — relatório parcial`));
57331
57716
  } else if (err instanceof DeployDetected) {
57332
57717
  deployChangedMidRun = true;
57333
- console.log(chalk6.red(` ✖ ${err.message}`));
57718
+ console.log(chalk7.red(` ✖ ${err.message}`));
57334
57719
  } else {
57335
57720
  console.error(err);
57336
57721
  return 2;
@@ -57379,7 +57764,7 @@ async function cacheGapCommand(opts, probe = httpProbe) {
57379
57764
  printSummary4(artifact);
57380
57765
  if (opts.json)
57381
57766
  console.log(JSON.stringify({ runId, ...summaryNumbers(artifact) }));
57382
- console.log(chalk6.dim(` → ${paths.reportHtml}`));
57767
+ console.log(chalk7.dim(` → ${paths.reportHtml}`));
57383
57768
  if (opts.open) {
57384
57769
  const { default: open } = await import("open");
57385
57770
  await open(paths.reportHtml).catch(() => {
@@ -57507,7 +57892,7 @@ function loadProbes(opts) {
57507
57892
  return [];
57508
57893
  const file = join14(opts.dir, ".deco", "blocks.gen.json");
57509
57894
  if (!existsSync11(file)) {
57510
- console.log(chalk6.yellow(` fase 3 pulada — ${file} não existe`));
57895
+ console.log(chalk7.yellow(` fase 3 pulada — ${file} não existe`));
57511
57896
  return [];
57512
57897
  }
57513
57898
  return extractLoaderProps(JSON.parse(readFileSync13(file, "utf8")), opts.loaderLimit ?? 25);
@@ -57629,10 +58014,10 @@ function buildChecks(args) {
57629
58014
  function printSummary4(a) {
57630
58015
  const n = summaryNumbers(a);
57631
58016
  console.log("");
57632
- console.log(chalk6.bold(" cache-gap"));
58017
+ console.log(chalk7.bold(" cache-gap"));
57633
58018
  console.log(` HTML hit rate: ${n.htmlHitRate == null ? "n/a" : `${Math.round(n.htmlHitRate * 100)}%`} rotas degradadas: ${n.degradedRoutes} requests: ${n.requestCount}`);
57634
58019
  for (const d of a.decorations) {
57635
- const mark = d.verdict === "leak" ? chalk6.red("LEAK") : d.verdict === "ok" ? chalk6.green("ok") : d.verdict === "expected-fragmentation" ? chalk6.cyan("segmenta") : chalk6.yellow("?");
58020
+ const mark = d.verdict === "leak" ? chalk7.red("LEAK") : d.verdict === "ok" ? chalk7.green("ok") : d.verdict === "expected-fragmentation" ? chalk7.cyan("segmenta") : chalk7.yellow("?");
57636
58021
  console.log(` ${mark.padEnd(16)} ${String(d.param ?? d.id).padEnd(24)} ${d.why}`);
57637
58022
  }
57638
58023
  console.log(` segmentação: ${a.segmentation.verdict} — ${a.segmentation.why}`);
@@ -57644,7 +58029,7 @@ function printSummary4(a) {
57644
58029
  }
57645
58030
  const skipped = a.loaders.length - usable.length;
57646
58031
  if (skipped > 0)
57647
- console.log(chalk6.dim(` (${skipped} loader(s) não invocáveis isoladamente)`));
58032
+ console.log(chalk7.dim(` (${skipped} loader(s) não invocáveis isoladamente)`));
57648
58033
  console.log("");
57649
58034
  }
57650
58035
 
@@ -57652,7 +58037,7 @@ function printSummary4(a) {
57652
58037
  import { mkdtempSync } from "node:fs";
57653
58038
  import { tmpdir } from "node:os";
57654
58039
  import { join as join15 } from "node:path";
57655
- import chalk7 from "chalk";
58040
+ import chalk8 from "chalk";
57656
58041
  var SEVERITY_RANK4 = {
57657
58042
  critical: 0,
57658
58043
  high: 1,
@@ -57663,19 +58048,19 @@ var VALID_VIEWPORTS = new Set(["mobile", "desktop", "tablet"]);
57663
58048
  async function checkCommand(opts) {
57664
58049
  const check = getCheckByName(opts.name);
57665
58050
  if (!check) {
57666
- console.error(chalk7.red(`check '${opts.name}' não existe.
58051
+ console.error(chalk8.red(`check '${opts.name}' não existe.
57667
58052
  `));
57668
- console.error(chalk7.dim("Checks disponíveis:"));
58053
+ console.error(chalk8.dim("Checks disponíveis:"));
57669
58054
  for (const name of Object.keys(ALL_CHECKS_BY_NAME).sort()) {
57670
- console.error(chalk7.dim(` - ${name}`));
58055
+ console.error(chalk8.dim(` - ${name}`));
57671
58056
  }
57672
58057
  return 2;
57673
58058
  }
57674
58059
  if (FLOW_DEPENDENT_CHECKS.has(opts.name)) {
57675
- console.error(chalk7.red(`check '${opts.name}' depende de captura de purchase-journey (steps),
58060
+ console.error(chalk8.red(`check '${opts.name}' depende de captura de purchase-journey (steps),
57676
58061
  que o 'parity check' não roda.
57677
58062
  `));
57678
- console.error(chalk7.dim(`Use:
58063
+ console.error(chalk8.dim(`Use:
57679
58064
  parity journey --prod ... --cand ...
57680
58065
  ou
57681
58066
  parity run --flows purchase-journey --prod ... --cand ...`));
@@ -57684,11 +58069,11 @@ que o 'parity check' não roda.
57684
58069
  const rawViewports = opts.viewports.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
57685
58070
  const invalid = rawViewports.filter((v) => !VALID_VIEWPORTS.has(v));
57686
58071
  if (invalid.length > 0) {
57687
- console.error(chalk7.red(`viewport(s) inválido(s): ${invalid.join(", ")} (use mobile, desktop ou tablet)`));
58072
+ console.error(chalk8.red(`viewport(s) inválido(s): ${invalid.join(", ")} (use mobile, desktop ou tablet)`));
57688
58073
  return 2;
57689
58074
  }
57690
58075
  if (rawViewports.length === 0) {
57691
- console.error(chalk7.red(`viewports inválido: '${opts.viewports}'`));
58076
+ console.error(chalk8.red(`viewports inválido: '${opts.viewports}'`));
57692
58077
  return 2;
57693
58078
  }
57694
58079
  const viewports = rawViewports;
@@ -57698,12 +58083,12 @@ que o 'parity check' não roda.
57698
58083
  prodUrl = new URL(opts.prod);
57699
58084
  candUrl = new URL(opts.cand);
57700
58085
  } catch {
57701
- console.error(chalk7.red("--prod ou --cand inválido"));
58086
+ console.error(chalk8.red("--prod ou --cand inválido"));
57702
58087
  return 2;
57703
58088
  }
57704
58089
  const pagePath = (opts.page || "/").trim();
57705
58090
  if (/^[a-z][a-z0-9+.-]*:/i.test(pagePath)) {
57706
- console.error(chalk7.red(`--page deve ser um caminho relativo (e.g. "/bota-tudao-2025"), recebido: ${pagePath}`));
58091
+ console.error(chalk8.red(`--page deve ser um caminho relativo (e.g. "/bota-tudao-2025"), recebido: ${pagePath}`));
57707
58092
  return 2;
57708
58093
  }
57709
58094
  const rc = loadParityRc();
@@ -57756,10 +58141,10 @@ que o 'parity check' não roda.
57756
58141
  });
57757
58142
  }
57758
58143
  if (prodPages.length === 0 && candPages.length === 0) {
57759
- console.error(chalk7.red(`
58144
+ console.error(chalk8.red(`
57760
58145
  ✖ todas as capturas falharam — não há nada pra rodar o check`));
57761
58146
  for (const e of captureErrors) {
57762
- console.error(chalk7.red(` - ${e.viewport}/${e.side}: ${e.message}`));
58147
+ console.error(chalk8.red(` - ${e.viewport}/${e.side}: ${e.message}`));
57763
58148
  }
57764
58149
  return 2;
57765
58150
  }
@@ -57802,73 +58187,73 @@ function printResult(result, meta) {
57802
58187
  console.log(JSON.stringify({ ...meta, result }));
57803
58188
  return;
57804
58189
  }
57805
- const statusColor = result.status === "pass" ? chalk7.green : result.status === "warn" ? chalk7.yellow : result.status === "skipped" ? chalk7.dim : chalk7.red;
57806
- console.log(chalk7.bold(`
58190
+ const statusColor = result.status === "pass" ? chalk8.green : result.status === "warn" ? chalk8.yellow : result.status === "skipped" ? chalk8.dim : chalk8.red;
58191
+ console.log(chalk8.bold(`
57807
58192
  ${result.name}`));
57808
- console.log(chalk7.dim(` ${meta.viewports.join(", ")} · ${meta.page}`));
57809
- console.log(chalk7.dim(` ${meta.prod} ↔ ${meta.cand}
58193
+ console.log(chalk8.dim(` ${meta.viewports.join(", ")} · ${meta.page}`));
58194
+ console.log(chalk8.dim(` ${meta.prod} ↔ ${meta.cand}
57810
58195
  `));
57811
58196
  if (meta.captureErrors.length > 0) {
57812
58197
  for (const e of meta.captureErrors) {
57813
- console.log(chalk7.yellow(` ⚠ captura falhou em ${e.viewport}/${e.side}: ${e.message}`));
58198
+ console.log(chalk8.yellow(` ⚠ captura falhou em ${e.viewport}/${e.side}: ${e.message}`));
57814
58199
  }
57815
58200
  console.log("");
57816
58201
  }
57817
58202
  console.log(` status: ${statusColor(result.status)} · ${result.summary}`);
57818
58203
  if (result.issues.length === 0) {
57819
- console.log(chalk7.dim(" (sem issues)"));
58204
+ console.log(chalk8.dim(" (sem issues)"));
57820
58205
  return;
57821
58206
  }
57822
58207
  const sorted = [...result.issues].sort((a, b) => SEVERITY_RANK4[a.severity] - SEVERITY_RANK4[b.severity]);
57823
58208
  console.log("");
57824
58209
  for (const issue of sorted) {
57825
- const tag = issue.severity === "critical" ? chalk7.red.bold("[critical]") : issue.severity === "high" ? chalk7.red("[high] ") : issue.severity === "medium" ? chalk7.yellow("[medium] ") : chalk7.dim("[low] ");
58210
+ const tag = issue.severity === "critical" ? chalk8.red.bold("[critical]") : issue.severity === "high" ? chalk8.red("[high] ") : issue.severity === "medium" ? chalk8.yellow("[medium] ") : chalk8.dim("[low] ");
57826
58211
  console.log(` ${tag} ${issue.summary}`);
57827
58212
  }
57828
58213
  }
57829
58214
 
57830
58215
  // src/commands/compare.ts
57831
- import chalk8 from "chalk";
58216
+ import chalk9 from "chalk";
57832
58217
  function compareCommand(runId, baselineName, output) {
57833
58218
  try {
57834
58219
  const run = loadRun(output, runId);
57835
58220
  const baseline = loadBaseline(baselineName);
57836
58221
  const delta = compareToBaseline(run, baseline);
57837
- console.log(chalk8.bold(`
58222
+ console.log(chalk9.bold(`
57838
58223
  Delta ${runId} vs baseline "${baselineName}"`));
57839
- console.log(` ${chalk8.green("✓ resolved")}: ${delta.resolved.length}`);
57840
- console.log(` ${chalk8.yellow("+ new")}: ${delta.new.length}`);
57841
- console.log(` ${chalk8.red("⚠ regressed")}: ${delta.regressions.length}`);
58224
+ console.log(` ${chalk9.green("✓ resolved")}: ${delta.resolved.length}`);
58225
+ console.log(` ${chalk9.yellow("+ new")}: ${delta.new.length}`);
58226
+ console.log(` ${chalk9.red("⚠ regressed")}: ${delta.regressions.length}`);
57842
58227
  if (delta.new.length > 0) {
57843
- console.log(chalk8.bold(`
58228
+ console.log(chalk9.bold(`
57844
58229
  Novos issue ids:`));
57845
58230
  for (const id of delta.new)
57846
58231
  console.log(` - ${id}`);
57847
58232
  }
57848
58233
  if (delta.regressions.length > 0) {
57849
- console.log(chalk8.bold(`
58234
+ console.log(chalk9.bold(`
57850
58235
  Regressões (severity piorou):`));
57851
58236
  for (const id of delta.regressions)
57852
58237
  console.log(` - ${id}`);
57853
58238
  }
57854
58239
  return 0;
57855
58240
  } catch (err) {
57856
- console.error(chalk8.red(`✖ ${err.message}`));
58241
+ console.error(chalk9.red(`✖ ${err.message}`));
57857
58242
  return 1;
57858
58243
  }
57859
58244
  }
57860
58245
 
57861
58246
  // src/commands/console.ts
57862
- import chalk9 from "chalk";
58247
+ import chalk10 from "chalk";
57863
58248
  async function consoleCommand(opts) {
57864
58249
  const viewport = parseViewport2(opts.viewport);
57865
58250
  if (!viewport) {
57866
- console.error(chalk9.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
58251
+ console.error(chalk10.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
57867
58252
  return 2;
57868
58253
  }
57869
58254
  const waitMs = Number.parseInt(opts.wait, 10);
57870
58255
  if (!Number.isFinite(waitMs) || waitMs < 0) {
57871
- console.error(chalk9.red(`--wait inválido: ${opts.wait}`));
58256
+ console.error(chalk10.red(`--wait inválido: ${opts.wait}`));
57872
58257
  return 2;
57873
58258
  }
57874
58259
  const filter = parseFilter(opts.filter);
@@ -57876,7 +58261,7 @@ async function consoleCommand(opts) {
57876
58261
  try {
57877
58262
  url = new URL(opts.url);
57878
58263
  } catch {
57879
- console.error(chalk9.red(`--url inválido: ${opts.url}`));
58264
+ console.error(chalk10.red(`--url inválido: ${opts.url}`));
57880
58265
  return 2;
57881
58266
  }
57882
58267
  const browser = await launchBrowser({ headless: true });
@@ -57925,24 +58310,24 @@ function printResults(entries, meta) {
57925
58310
  return;
57926
58311
  }
57927
58312
  if (entries.length === 0) {
57928
- console.log(chalk9.dim(` ${meta.viewport} · ${meta.url}
58313
+ console.log(chalk10.dim(` ${meta.viewport} · ${meta.url}
57929
58314
  nenhuma entrada de console nos filtros pedidos`));
57930
58315
  return;
57931
58316
  }
57932
- console.log(chalk9.bold(`
58317
+ console.log(chalk10.bold(`
57933
58318
  ${meta.viewport} · ${meta.url}`));
57934
- console.log(chalk9.dim(` ${entries.length} entrada(s)
58319
+ console.log(chalk10.dim(` ${entries.length} entrada(s)
57935
58320
  `));
57936
58321
  for (const e of entries) {
57937
- const tag = e.type === "error" ? chalk9.red("[error ]") : e.type === "warning" ? chalk9.yellow("[warn ]") : chalk9.dim(`[${e.type.padEnd(7)}]`);
57938
- const loc = e.location ? chalk9.dim(` ← ${e.location}`) : "";
58322
+ const tag = e.type === "error" ? chalk10.red("[error ]") : e.type === "warning" ? chalk10.yellow("[warn ]") : chalk10.dim(`[${e.type.padEnd(7)}]`);
58323
+ const loc = e.location ? chalk10.dim(` ← ${e.location}`) : "";
57939
58324
  const text = e.text.length > 400 ? `${e.text.slice(0, 397)}...` : e.text;
57940
58325
  console.log(` ${tag} ${text}${loc}`);
57941
58326
  }
57942
58327
  }
57943
58328
 
57944
58329
  // src/commands/css-trace.ts
57945
- import chalk10 from "chalk";
58330
+ import chalk11 from "chalk";
57946
58331
  async function tracePage(page, url, selector, settleMs) {
57947
58332
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
57948
58333
  await page.waitForLoadState("load", { timeout: 12000 }).catch(() => {
@@ -58053,35 +58438,35 @@ function applyFilter(result, filter) {
58053
58438
  return { ...result, computed, rules };
58054
58439
  }
58055
58440
  function printResult2(result, header) {
58056
- console.log(chalk10.bold(`
58441
+ console.log(chalk11.bold(`
58057
58442
  ${header}`));
58058
- console.log(chalk10.dim(`URL: ${result.url}`));
58059
- console.log(chalk10.dim(`Selector: ${result.selector}`));
58443
+ console.log(chalk11.dim(`URL: ${result.url}`));
58444
+ console.log(chalk11.dim(`Selector: ${result.selector}`));
58060
58445
  if (!result.found) {
58061
- console.log(chalk10.red("✖ Element not found"));
58446
+ console.log(chalk11.red("✖ Element not found"));
58062
58447
  return;
58063
58448
  }
58064
58449
  const computedKeys = Object.keys(result.computed);
58065
58450
  if (computedKeys.length > 0) {
58066
- console.log(chalk10.bold(`
58451
+ console.log(chalk11.bold(`
58067
58452
  Computed:`));
58068
58453
  for (const k of computedKeys) {
58069
- console.log(` ${chalk10.cyan(k)}: ${result.computed[k]}`);
58454
+ console.log(` ${chalk11.cyan(k)}: ${result.computed[k]}`);
58070
58455
  }
58071
58456
  }
58072
58457
  if (result.rules.length === 0) {
58073
- console.log(chalk10.yellow(`
58458
+ console.log(chalk11.yellow(`
58074
58459
  No matching rules after filter.`));
58075
58460
  return;
58076
58461
  }
58077
- console.log(chalk10.bold(`
58462
+ console.log(chalk11.bold(`
58078
58463
  Rules (ordered by CDP — most specific last):`));
58079
58464
  for (const r of result.rules) {
58080
- const inheritLabel = r.inheritedFromDistance !== undefined ? chalk10.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
58081
- console.log(` ${chalk10.magenta(r.source)}${inheritLabel}`);
58082
- console.log(` ${chalk10.green(r.selector)} {`);
58465
+ const inheritLabel = r.inheritedFromDistance !== undefined ? chalk11.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
58466
+ console.log(` ${chalk11.magenta(r.source)}${inheritLabel}`);
58467
+ console.log(` ${chalk11.green(r.selector)} {`);
58083
58468
  for (const p of r.properties) {
58084
- const bang = p.important ? chalk10.red(" !important") : "";
58469
+ const bang = p.important ? chalk11.red(" !important") : "";
58085
58470
  console.log(` ${p.name}: ${p.value}${bang};`);
58086
58471
  }
58087
58472
  console.log(" }");
@@ -58102,38 +58487,38 @@ function printComparison(prod, cand) {
58102
58487
  printResult2(prod, "── PROD ──────────────────────────────────────────────");
58103
58488
  printResult2(cand, "── CAND ──────────────────────────────────────────────");
58104
58489
  const diffs = diffComputed(prod, cand);
58105
- console.log(chalk10.bold(`
58490
+ console.log(chalk11.bold(`
58106
58491
  ── DIFF (computed) ───────────────────────────────────`));
58107
58492
  if (diffs.length === 0) {
58108
- console.log(chalk10.green(" No computed-style differences in the filtered set."));
58493
+ console.log(chalk11.green(" No computed-style differences in the filtered set."));
58109
58494
  return;
58110
58495
  }
58111
58496
  for (const d of diffs) {
58112
- console.log(` ${chalk10.cyan(d.property)}`);
58113
- console.log(` prod: ${chalk10.green(d.prod ?? "(unset)")}`);
58114
- console.log(` cand: ${chalk10.red(d.cand ?? "(unset)")}`);
58497
+ console.log(` ${chalk11.cyan(d.property)}`);
58498
+ console.log(` prod: ${chalk11.green(d.prod ?? "(unset)")}`);
58499
+ console.log(` cand: ${chalk11.red(d.cand ?? "(unset)")}`);
58115
58500
  }
58116
58501
  }
58117
58502
  async function cssTraceCommand(opts) {
58118
58503
  const viewport = opts.viewport ?? "desktop";
58119
58504
  const settleMs = opts.settleMs ?? 1500;
58120
58505
  if (!opts.selector) {
58121
- console.error(chalk10.red("--selector is required"));
58506
+ console.error(chalk11.red("--selector is required"));
58122
58507
  return 1;
58123
58508
  }
58124
58509
  const hasUrl = !!opts.url;
58125
58510
  const hasProd = !!opts.prod;
58126
58511
  const hasCand = !!opts.cand;
58127
58512
  if (hasUrl && (hasProd || hasCand)) {
58128
- console.error(chalk10.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
58513
+ console.error(chalk11.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
58129
58514
  return 1;
58130
58515
  }
58131
58516
  if (hasProd && !hasCand || !hasProd && hasCand) {
58132
- console.error(chalk10.red("Comparison mode needs both --prod and --cand (got only one)."));
58517
+ console.error(chalk11.red("Comparison mode needs both --prod and --cand (got only one)."));
58133
58518
  return 1;
58134
58519
  }
58135
58520
  if (!hasUrl && !hasProd && !hasCand) {
58136
- console.error(chalk10.red("Provide either --url or both --prod and --cand."));
58521
+ console.error(chalk11.red("Provide either --url or both --prod and --cand."));
58137
58522
  return 1;
58138
58523
  }
58139
58524
  const isCompare = hasProd && hasCand;
@@ -58184,7 +58569,7 @@ async function cssTraceCommand(opts) {
58184
58569
  }
58185
58570
  return 0;
58186
58571
  } catch (err) {
58187
- console.error(chalk10.red(`Error: ${err.message}`));
58572
+ console.error(chalk11.red(`Error: ${err.message}`));
58188
58573
  return 1;
58189
58574
  } finally {
58190
58575
  await browser?.close().catch(() => {
@@ -58196,7 +58581,7 @@ async function cssTraceCommand(opts) {
58196
58581
  // src/commands/e2e.ts
58197
58582
  import { writeFileSync as writeFileSync14 } from "node:fs";
58198
58583
  import { spawn as spawn2 } from "node:child_process";
58199
- import chalk11 from "chalk";
58584
+ import chalk12 from "chalk";
58200
58585
  import ora6 from "ora";
58201
58586
 
58202
58587
  // src/engine/flows/cart-interactions.ts
@@ -59197,7 +59582,7 @@ async function suggestTermViaLlm(url, html) {
59197
59582
  if (!isLlmAvailable())
59198
59583
  return null;
59199
59584
  const compacted = compactHtmlForSelectors(html, 18000);
59200
- const input = await callTool({
59585
+ const input = await callTool2({
59201
59586
  feature: "search-terms",
59202
59587
  systemPrompt: SYSTEM_PROMPT3,
59203
59588
  userText: `URL: ${url}
@@ -60265,19 +60650,19 @@ function formatWatchdogMessage(timeoutMs, graceMs) {
60265
60650
  async function e2eCommand(opts) {
60266
60651
  const viewports = parseViewports(opts.viewports);
60267
60652
  if (viewports.length === 0) {
60268
- console.error(chalk11.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
60653
+ console.error(chalk12.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
60269
60654
  return 2;
60270
60655
  }
60271
60656
  let baseUrl;
60272
60657
  try {
60273
60658
  baseUrl = new URL(opts.url);
60274
60659
  } catch {
60275
- console.error(chalk11.red(`--url inválido: ${opts.url}`));
60660
+ console.error(chalk12.red(`--url inválido: ${opts.url}`));
60276
60661
  return 2;
60277
60662
  }
60278
60663
  const flows = parseFlows(opts.flows);
60279
60664
  if (flows.length === 0) {
60280
- console.error(chalk11.red(`--flows inválido: ${opts.flows}`));
60665
+ console.error(chalk12.red(`--flows inválido: ${opts.flows}`));
60281
60666
  return 2;
60282
60667
  }
60283
60668
  const rc = loadParityRc();
@@ -60308,12 +60693,12 @@ async function e2eCommand(opts) {
60308
60693
  const paths = createRunDir(opts.output, runId);
60309
60694
  const startedAt = Date.now();
60310
60695
  if (!opts.json) {
60311
- console.log(chalk11.bold(`
60696
+ console.log(chalk12.bold(`
60312
60697
  parity e2e ${runId}`));
60313
- console.log(chalk11.dim(` url: ${opts.url}`));
60314
- console.log(chalk11.dim(` flows: ${flows.join(", ")}`));
60315
- console.log(chalk11.dim(` viewports: ${viewports.join(", ")}`));
60316
- console.log(chalk11.dim(` cep: ${rc.cep}
60698
+ console.log(chalk12.dim(` url: ${opts.url}`));
60699
+ console.log(chalk12.dim(` flows: ${flows.join(", ")}`));
60700
+ console.log(chalk12.dim(` viewports: ${viewports.join(", ")}`));
60701
+ console.log(chalk12.dim(` cep: ${rc.cep}
60317
60702
  `));
60318
60703
  }
60319
60704
  let platform = "custom";
@@ -60321,7 +60706,7 @@ async function e2eCommand(opts) {
60321
60706
  if (homeHtml) {
60322
60707
  platform = detectPlatform({ url: opts.url, html: homeHtml });
60323
60708
  if (platform !== "custom" && !opts.json) {
60324
- console.log(chalk11.dim(` Detected platform: ${platform}`));
60709
+ console.log(chalk12.dim(` Detected platform: ${platform}`));
60325
60710
  }
60326
60711
  }
60327
60712
  const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable();
@@ -60361,7 +60746,7 @@ async function e2eCommand(opts) {
60361
60746
  watchdogTimedOut = true;
60362
60747
  if (spinner)
60363
60748
  spinner.stop();
60364
- console.error(chalk11.red(`
60749
+ console.error(chalk12.red(`
60365
60750
  ${formatWatchdogMessage(E2E_TIMEOUT_MS, WATCHDOG_GRACE_MS)}`));
60366
60751
  };
60367
60752
  process.once("SIGUSR2", onWatchdogFired);
@@ -60429,14 +60814,14 @@ async function e2eCommand(opts) {
60429
60814
  });
60430
60815
  }
60431
60816
  if (watchdogTimedOut && !opts.json) {
60432
- console.log(chalk11.yellow(`
60817
+ console.log(chalk12.yellow(`
60433
60818
  ⚠ relatório parcial — o watchdog encerrou o run antes de todos os fluxos/viewports terminarem.`));
60434
60819
  }
60435
60820
  if (opts.learn !== false && JSON.stringify(learned) !== learnedBefore) {
60436
60821
  saveLearned(learned);
60437
60822
  }
60438
60823
  if (allPages.length === 0) {
60439
- console.error(chalk11.red(`
60824
+ console.error(chalk12.red(`
60440
60825
  ✖ nenhuma captura completada`));
60441
60826
  return 2;
60442
60827
  }
@@ -60559,17 +60944,17 @@ function parseFlows(raw) {
60559
60944
  }
60560
60945
  function printSummary5(result, reportPath) {
60561
60946
  const { totals } = result;
60562
- const verdict = totals.critical > 0 ? chalk11.red.bold("✖ FAIL") : totals.high > 0 ? chalk11.red("✖ FAIL") : totals.issues > 0 ? chalk11.yellow("⚠ WARN") : chalk11.green.bold("✓ PASS");
60947
+ const verdict = totals.critical > 0 ? chalk12.red.bold("✖ FAIL") : totals.high > 0 ? chalk12.red("✖ FAIL") : totals.issues > 0 ? chalk12.yellow("⚠ WARN") : chalk12.green.bold("✓ PASS");
60563
60948
  console.log(`
60564
60949
  ${verdict}`);
60565
60950
  console.log(` ${totals.pages} página(s) · ${totals.issues} issue(s)`);
60566
- console.log(` ${chalk11.red(`${totals.critical} critical`)} · ${chalk11.red(`${totals.high} high`)} · ${chalk11.yellow(`${totals.medium} medium`)} · ${chalk11.dim(`${totals.low} low`)}`);
60951
+ console.log(` ${chalk12.red(`${totals.critical} critical`)} · ${chalk12.red(`${totals.high} high`)} · ${chalk12.yellow(`${totals.medium} medium`)} · ${chalk12.dim(`${totals.low} low`)}`);
60567
60952
  const top = result.allIssues.slice(0, 5);
60568
60953
  if (top.length > 0) {
60569
60954
  console.log(`
60570
60955
  Top issues:`);
60571
60956
  for (const issue of top) {
60572
- const sevTag = issue.severity === "critical" ? chalk11.red.bold("[critical]") : issue.severity === "high" ? chalk11.red("[high] ") : issue.severity === "medium" ? chalk11.yellow("[medium] ") : chalk11.dim("[low] ");
60957
+ const sevTag = issue.severity === "critical" ? chalk12.red.bold("[critical]") : issue.severity === "high" ? chalk12.red("[high] ") : issue.severity === "medium" ? chalk12.yellow("[medium] ") : chalk12.dim("[low] ");
60573
60958
  console.log(` ${sevTag} ${issue.summary.slice(0, 200)}`);
60574
60959
  }
60575
60960
  }
@@ -60585,7 +60970,7 @@ async function openReport2(path) {
60585
60970
 
60586
60971
  // src/commands/explain.ts
60587
60972
  init_client();
60588
- import chalk12 from "chalk";
60973
+ import chalk13 from "chalk";
60589
60974
 
60590
60975
  // src/llm/system-prompt.ts
60591
60976
  var ISSUE_AGGREGATOR_SYSTEM_PROMPT = `
@@ -60670,17 +61055,17 @@ Cada issue tem:
60670
61055
  // src/commands/explain.ts
60671
61056
  async function explainCommand(runId, issueId, output) {
60672
61057
  if (!isLlmAvailable()) {
60673
- console.error(chalk12.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
61058
+ console.error(chalk13.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
60674
61059
  return 1;
60675
61060
  }
60676
61061
  const run = loadRun(output, runId);
60677
61062
  const issue = run.issues.find((i) => i.id === issueId) || run.topIssues.find((i) => i.id === issueId);
60678
61063
  if (!issue) {
60679
- console.error(chalk12.red(`Issue não encontrada: ${issueId}`));
61064
+ console.error(chalk13.red(`Issue não encontrada: ${issueId}`));
60680
61065
  return 1;
60681
61066
  }
60682
61067
  const checks = run.checks.filter((c) => c.issues.some((i) => i.id === issueId || i.check === issue.check));
60683
- console.log(chalk12.dim(`Consultando LLM…
61068
+ console.log(chalk13.dim(`Consultando LLM…
60684
61069
  `));
60685
61070
  const text = await callMessage({
60686
61071
  feature: "explain",
@@ -60702,7 +61087,7 @@ ${JSON.stringify(checks.map((c) => ({ name: c.name, status: c.status, summary: c
60702
61087
  // src/commands/extract.ts
60703
61088
  import { mkdirSync as mkdirSync13 } from "node:fs";
60704
61089
  import { resolve as resolve4 } from "node:path";
60705
- import chalk14 from "chalk";
61090
+ import chalk15 from "chalk";
60706
61091
 
60707
61092
  // src/llm/section-understanding.ts
60708
61093
  init_client();
@@ -60760,7 +61145,7 @@ async function invokeUnderstandingSummary(input) {
60760
61145
  console.error(`[section-understanding] skipping image ${p}: ${err.message}`);
60761
61146
  }
60762
61147
  }
60763
- const result = await callTool({
61148
+ const result = await callTool2({
60764
61149
  feature: "section-understanding",
60765
61150
  systemPrompt: SYSTEM_PROMPT4,
60766
61151
  userText: markdown,
@@ -61865,7 +62250,7 @@ function compactComponentHtml(html, maxChars = COMPONENT_HTML_MAX_CHARS) {
61865
62250
  // src/commands/section.ts
61866
62251
  import { mkdirSync as mkdirSync12 } from "node:fs";
61867
62252
  import { resolve as resolve3 } from "node:path";
61868
- import chalk13 from "chalk";
62253
+ import chalk14 from "chalk";
61869
62254
  import * as diff from "diff";
61870
62255
  import prettier from "prettier";
61871
62256
 
@@ -63244,20 +63629,20 @@ async function readBoxTree(page, selector, opts = {}) {
63244
63629
  async function sectionCommand(opts) {
63245
63630
  const viewport = parseViewport3(opts.viewport);
63246
63631
  if (!viewport) {
63247
- console.error(chalk13.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
63632
+ console.error(chalk14.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
63248
63633
  return 2;
63249
63634
  }
63250
63635
  const waitMs = Number.parseInt(opts.wait, 10);
63251
63636
  if (!Number.isFinite(waitMs) || waitMs < 0) {
63252
- console.error(chalk13.red(`--wait inválido: ${opts.wait}`));
63637
+ console.error(chalk14.red(`--wait inválido: ${opts.wait}`));
63253
63638
  return 2;
63254
63639
  }
63255
63640
  if (!opts.selector || opts.selector.trim().length === 0) {
63256
- console.error(chalk13.red("--selector é obrigatório"));
63641
+ console.error(chalk14.red("--selector é obrigatório"));
63257
63642
  return 2;
63258
63643
  }
63259
63644
  if (!isValidUrl(opts.prod) || !isValidUrl(opts.cand)) {
63260
- console.error(chalk13.red("--prod ou --cand inválido"));
63645
+ console.error(chalk14.red("--prod ou --cand inválido"));
63261
63646
  return 2;
63262
63647
  }
63263
63648
  const candSelector = opts.candSelector?.trim() || opts.selector;
@@ -63284,7 +63669,7 @@ async function sectionCommand(opts) {
63284
63669
  const heatmapPath = resolve3(opts.outDir, `${filePrefix}-heatmap.png`);
63285
63670
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
63286
63671
  if (aliasNote)
63287
- console.log(chalk13.dim(` ${aliasNote}`));
63672
+ console.log(chalk14.dim(` ${aliasNote}`));
63288
63673
  const browser = await launchBrowser({ headless: true });
63289
63674
  try {
63290
63675
  const [prodSide, candSide] = await Promise.all([
@@ -63363,7 +63748,7 @@ async function sectionCommand(opts) {
63363
63748
  ]) {
63364
63749
  const caveat = data.settle && formatSettleCaveat(side, data.settle);
63365
63750
  if (caveat)
63366
- console.log(chalk13.yellow(` ${caveat}`));
63751
+ console.log(chalk14.yellow(` ${caveat}`));
63367
63752
  }
63368
63753
  if (heatmap)
63369
63754
  printHeatmap(heatmap, heatmapPath);
@@ -63391,9 +63776,9 @@ function computeBoxTreeDiff(prodSide, candSide, aliases) {
63391
63776
  }
63392
63777
  function printBoxTree(result) {
63393
63778
  console.log("");
63394
- console.log(chalk13.bold(" Box tree"));
63779
+ console.log(chalk14.bold(" Box tree"));
63395
63780
  if ("error" in result) {
63396
- console.log(chalk13.yellow(` não foi possível comparar — ${result.error}`));
63781
+ console.log(chalk14.yellow(` não foi possível comparar — ${result.error}`));
63397
63782
  return;
63398
63783
  }
63399
63784
  for (const line of formatBoxTreeDiff(result).split(`
@@ -63504,17 +63889,17 @@ function verdict(prod, cand) {
63504
63889
  async function printResults2(args) {
63505
63890
  const { opts, viewport, candSelector, prodSide, candSide, screenshotPaths, want } = args;
63506
63891
  const crossSelector = candSelector !== opts.selector;
63507
- console.log(chalk13.bold(`
63892
+ console.log(chalk14.bold(`
63508
63893
  parity section`));
63509
63894
  if (crossSelector) {
63510
- console.log(chalk13.dim(` selector: ${opts.selector} (prod)`));
63511
- console.log(chalk13.dim(` ${candSelector} (cand)`));
63895
+ console.log(chalk14.dim(` selector: ${opts.selector} (prod)`));
63896
+ console.log(chalk14.dim(` ${candSelector} (cand)`));
63512
63897
  } else {
63513
- console.log(chalk13.dim(` selector: ${opts.selector}`));
63898
+ console.log(chalk14.dim(` selector: ${opts.selector}`));
63514
63899
  }
63515
- console.log(chalk13.dim(` viewport: ${viewport}`));
63516
- console.log(chalk13.dim(` prod: ${opts.prod}`));
63517
- console.log(chalk13.dim(` cand: ${opts.cand}`));
63900
+ console.log(chalk14.dim(` viewport: ${viewport}`));
63901
+ console.log(chalk14.dim(` prod: ${opts.prod}`));
63902
+ console.log(chalk14.dim(` cand: ${opts.cand}`));
63518
63903
  console.log("");
63519
63904
  if (want.html) {
63520
63905
  await printHtmlDiff(prodSide, candSide, crossSelector ? `${opts.selector} → ${candSelector}` : opts.selector);
@@ -63525,22 +63910,22 @@ async function printResults2(args) {
63525
63910
  printScreenshotPaths(prodSide, candSide, screenshotPaths);
63526
63911
  }
63527
63912
  async function printHtmlDiff(prod, cand, selector) {
63528
- console.log(chalk13.bold(" HTML diff"));
63913
+ console.log(chalk14.bold(" HTML diff"));
63529
63914
  if (prod.htmlError) {
63530
- console.log(chalk13.red(` prod: ${prod.htmlError}`));
63915
+ console.log(chalk14.red(` prod: ${prod.htmlError}`));
63531
63916
  return;
63532
63917
  }
63533
63918
  if (cand.htmlError) {
63534
- console.log(chalk13.red(` cand: ${cand.htmlError}`));
63919
+ console.log(chalk14.red(` cand: ${cand.htmlError}`));
63535
63920
  return;
63536
63921
  }
63537
63922
  if (!prod.html || !cand.html) {
63538
- console.log(chalk13.dim(" (nenhum lado tem HTML disponível)"));
63923
+ console.log(chalk14.dim(" (nenhum lado tem HTML disponível)"));
63539
63924
  return;
63540
63925
  }
63541
63926
  const [prodFmt, candFmt] = await Promise.all([formatHtml(prod.html), formatHtml(cand.html)]);
63542
63927
  if (prodFmt === candFmt) {
63543
- console.log(chalk13.green(" ✓ idêntico após pretty-print"));
63928
+ console.log(chalk14.green(" ✓ idêntico após pretty-print"));
63544
63929
  console.log("");
63545
63930
  return;
63546
63931
  }
@@ -63549,17 +63934,17 @@ async function printHtmlDiff(prod, cand, selector) {
63549
63934
  console.log("");
63550
63935
  }
63551
63936
  function printStylesDiff(prod, cand) {
63552
- console.log(chalk13.bold(" Computed styles diff"));
63937
+ console.log(chalk14.bold(" Computed styles diff"));
63553
63938
  if (!prod.styles || !cand.styles) {
63554
- console.log(chalk13.dim(" (styles não foram coletados)"));
63939
+ console.log(chalk14.dim(" (styles não foram coletados)"));
63555
63940
  return;
63556
63941
  }
63557
63942
  if (!prod.styles.found) {
63558
- console.log(chalk13.red(` prod: ${prod.styles.error}`));
63943
+ console.log(chalk14.red(` prod: ${prod.styles.error}`));
63559
63944
  return;
63560
63945
  }
63561
63946
  if (!cand.styles.found) {
63562
- console.log(chalk13.red(` cand: ${cand.styles.error}`));
63947
+ console.log(chalk14.red(` cand: ${cand.styles.error}`));
63563
63948
  return;
63564
63949
  }
63565
63950
  const rows = [];
@@ -63586,27 +63971,27 @@ function printStylesDiff(prod, cand) {
63586
63971
  });
63587
63972
  }
63588
63973
  if (rows.length === 0) {
63589
- console.log(chalk13.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
63974
+ console.log(chalk14.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
63590
63975
  console.log("");
63591
63976
  return;
63592
63977
  }
63593
63978
  const keyWidth = Math.max(...rows.map((r) => r.key.length));
63594
63979
  for (const r of rows) {
63595
- console.log(` ${chalk13.cyan(r.key.padEnd(keyWidth))} ${chalk13.red(`prod=${r.prod || "(vazio)"}`)} ${chalk13.green(`cand=${r.cand || "(vazio)"}`)}`);
63980
+ console.log(` ${chalk14.cyan(r.key.padEnd(keyWidth))} ${chalk14.red(`prod=${r.prod || "(vazio)"}`)} ${chalk14.green(`cand=${r.cand || "(vazio)"}`)}`);
63596
63981
  }
63597
63982
  console.log("");
63598
63983
  }
63599
63984
  function printScreenshotPaths(prod, cand, paths) {
63600
- console.log(chalk13.bold(" Screenshots"));
63985
+ console.log(chalk14.bold(" Screenshots"));
63601
63986
  if (prod.screenshotError) {
63602
- console.log(chalk13.red(` prod: ${prod.screenshotError}`));
63987
+ console.log(chalk14.red(` prod: ${prod.screenshotError}`));
63603
63988
  } else if (prod.screenshotTaken) {
63604
- console.log(` prod: ${chalk13.dim(paths.prod)}`);
63989
+ console.log(` prod: ${chalk14.dim(paths.prod)}`);
63605
63990
  }
63606
63991
  if (cand.screenshotError) {
63607
- console.log(chalk13.red(` cand: ${cand.screenshotError}`));
63992
+ console.log(chalk14.red(` cand: ${cand.screenshotError}`));
63608
63993
  } else if (cand.screenshotTaken) {
63609
- console.log(` cand: ${chalk13.dim(paths.cand)}`);
63994
+ console.log(` cand: ${chalk14.dim(paths.cand)}`);
63610
63995
  }
63611
63996
  console.log("");
63612
63997
  }
@@ -63629,13 +64014,13 @@ function colorPatch(patch) {
63629
64014
  if (line.startsWith("Index:") || line.startsWith("==="))
63630
64015
  continue;
63631
64016
  if (line.startsWith("---") || line.startsWith("+++"))
63632
- out.push(chalk13.dim(line));
64017
+ out.push(chalk14.dim(line));
63633
64018
  else if (line.startsWith("@@"))
63634
- out.push(chalk13.cyan(line));
64019
+ out.push(chalk14.cyan(line));
63635
64020
  else if (line.startsWith("+"))
63636
- out.push(chalk13.green(line));
64021
+ out.push(chalk14.green(line));
63637
64022
  else if (line.startsWith("-"))
63638
- out.push(chalk13.red(line));
64023
+ out.push(chalk14.red(line));
63639
64024
  else
63640
64025
  out.push(line);
63641
64026
  }
@@ -63704,7 +64089,7 @@ async function buildPromptBundle(args) {
63704
64089
  }
63705
64090
  async function maybeRunLlmSummary(args) {
63706
64091
  if (!isUnderstandingAvailable()) {
63707
- console.warn(chalk13.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
64092
+ console.warn(chalk14.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
63708
64093
  return null;
63709
64094
  }
63710
64095
  const result = await invokeUnderstandingSummary({
@@ -63716,42 +64101,42 @@ async function maybeRunLlmSummary(args) {
63716
64101
  return result?.summary ?? null;
63717
64102
  }
63718
64103
  function printHeatmap(state, heatmapPath) {
63719
- console.log(chalk13.bold(" Heatmap"));
64104
+ console.log(chalk14.bold(" Heatmap"));
63720
64105
  if (state.error) {
63721
- console.log(chalk13.yellow(` ${state.error}`));
64106
+ console.log(chalk14.yellow(` ${state.error}`));
63722
64107
  console.log("");
63723
64108
  return;
63724
64109
  }
63725
64110
  if (!state.analysis) {
63726
- console.log(chalk13.dim(" (sem dados de heatmap)"));
64111
+ console.log(chalk14.dim(" (sem dados de heatmap)"));
63727
64112
  console.log("");
63728
64113
  return;
63729
64114
  }
63730
64115
  const a = state.analysis;
63731
64116
  const pct = (a.pctDiff * 100).toFixed(2);
63732
- console.log(` ${chalk13.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
64117
+ console.log(` ${chalk14.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
63733
64118
  if (a.boundingBox) {
63734
64119
  const bb = a.boundingBox;
63735
- console.log(` ${chalk13.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
64120
+ console.log(` ${chalk14.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
63736
64121
  }
63737
64122
  if (a.hotspots.length > 0) {
63738
- console.log(` ${chalk13.cyan("hotspots")}:`);
64123
+ console.log(` ${chalk14.cyan("hotspots")}:`);
63739
64124
  for (const h of a.hotspots.slice(0, 5)) {
63740
64125
  console.log(` (${h.x}, ${h.y}) ${h.width}×${h.height} — ${h.pixelCount} px`);
63741
64126
  }
63742
64127
  }
63743
- console.log(` ${chalk13.dim(`heatmap: ${heatmapPath}`)}`);
64128
+ console.log(` ${chalk14.dim(`heatmap: ${heatmapPath}`)}`);
63744
64129
  console.log("");
63745
64130
  }
63746
64131
  function printBundlePaths(b) {
63747
- console.log(chalk13.bold(" Bundle"));
63748
- console.log(` ${chalk13.cyan("summary")}: ${b.summary}`);
63749
- console.log(` ${chalk13.cyan("json")}: ${chalk13.dim(b.jsonPath)}`);
63750
- console.log(` ${chalk13.cyan("prompt")}: ${chalk13.dim(b.markdownPath)}`);
64132
+ console.log(chalk14.bold(" Bundle"));
64133
+ console.log(` ${chalk14.cyan("summary")}: ${b.summary}`);
64134
+ console.log(` ${chalk14.cyan("json")}: ${chalk14.dim(b.jsonPath)}`);
64135
+ console.log(` ${chalk14.cyan("prompt")}: ${chalk14.dim(b.markdownPath)}`);
63751
64136
  console.log("");
63752
64137
  }
63753
64138
  function printLlmSummary(summary) {
63754
- console.log(chalk13.bold(" What the LLM understood"));
64139
+ console.log(chalk14.bold(" What the LLM understood"));
63755
64140
  console.log(` ${summary.split(`
63756
64141
  `).join(`
63757
64142
  `)}`);
@@ -63766,16 +64151,16 @@ function planExtractComponents(detected, signatures) {
63766
64151
  async function extractCommand(opts) {
63767
64152
  const viewport = parseViewport3(opts.viewport);
63768
64153
  if (!viewport) {
63769
- console.error(chalk14.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64154
+ console.error(chalk15.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
63770
64155
  return 2;
63771
64156
  }
63772
64157
  if (!isValidUrl2(opts.url)) {
63773
- console.error(chalk14.red(`--url inválido: ${opts.url}`));
64158
+ console.error(chalk15.red(`--url inválido: ${opts.url}`));
63774
64159
  return 2;
63775
64160
  }
63776
64161
  const format = normalizeFormat(opts.format);
63777
64162
  if (!format) {
63778
- console.error(chalk14.red(`--format inválido: ${opts.format} (use md|json|both)`));
64163
+ console.error(chalk15.red(`--format inválido: ${opts.format} (use md|json|both)`));
63779
64164
  return 2;
63780
64165
  }
63781
64166
  const allowlist = parseAllowlist(opts.components);
@@ -63788,14 +64173,14 @@ async function extractCommand(opts) {
63788
64173
  try {
63789
64174
  pageTokens = parsePageList(opts.pages, { tokens: PLP_PDP_AUTO_TOKENS, fallback: ["/"] });
63790
64175
  } catch (err) {
63791
- console.error(chalk14.red(err.message));
64176
+ console.error(chalk15.red(err.message));
63792
64177
  return 2;
63793
64178
  }
63794
64179
  const browser = await launchBrowser({ headless: true });
63795
64180
  try {
63796
64181
  const resolvedPages = await resolvePages(opts.url, pageTokens);
63797
64182
  if (resolvedPages.length === 0) {
63798
- console.error(chalk14.red("nenhuma página resolvida a partir de --pages"));
64183
+ console.error(chalk15.red("nenhuma página resolvida a partir de --pages"));
63799
64184
  return 1;
63800
64185
  }
63801
64186
  let globalIndex = 0;
@@ -63889,17 +64274,17 @@ async function extractCommand(opts) {
63889
64274
  }
63890
64275
  }
63891
64276
  function printResults3(runDir, bundle) {
63892
- console.log(chalk14.bold(`
64277
+ console.log(chalk15.bold(`
63893
64278
  parity extract`));
63894
- console.log(chalk14.dim(` url: ${bundle.url}`));
63895
- console.log(chalk14.dim(` viewport: ${bundle.viewport}`));
63896
- console.log(chalk14.dim(` pages: ${bundle.pages?.length ?? 0}`));
63897
- console.log(chalk14.dim(` out: ${runDir}`));
64279
+ console.log(chalk15.dim(` url: ${bundle.url}`));
64280
+ console.log(chalk15.dim(` viewport: ${bundle.viewport}`));
64281
+ console.log(chalk15.dim(` pages: ${bundle.pages?.length ?? 0}`));
64282
+ console.log(chalk15.dim(` out: ${runDir}`));
63898
64283
  console.log("");
63899
- console.log(chalk14.bold(` ${bundle.components.length} component(s) detected:`));
64284
+ console.log(chalk15.bold(` ${bundle.components.length} component(s) detected:`));
63900
64285
  for (const c of bundle.components) {
63901
- const repeated = c.repeated && c.repeated > 1 ? chalk14.dim(` ×${c.repeated}`) : "";
63902
- console.log(` ${chalk14.cyan(c.role.padEnd(24))} ${chalk14.dim(c.selector)}${repeated}`);
64286
+ const repeated = c.repeated && c.repeated > 1 ? chalk15.dim(` ×${c.repeated}`) : "";
64287
+ console.log(` ${chalk15.cyan(c.role.padEnd(24))} ${chalk15.dim(c.selector)}${repeated}`);
63903
64288
  }
63904
64289
  console.log("");
63905
64290
  }
@@ -64011,23 +64396,23 @@ async function fixCommand(opts) {
64011
64396
 
64012
64397
  // src/commands/html.ts
64013
64398
  init_esm10();
64014
- import chalk15 from "chalk";
64399
+ import chalk16 from "chalk";
64015
64400
  import * as diff2 from "diff";
64016
64401
  import prettier2 from "prettier";
64017
64402
  async function htmlCommand(opts) {
64018
64403
  const viewport = parseViewport4(opts.viewport);
64019
64404
  if (!viewport) {
64020
- console.error(chalk15.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64405
+ console.error(chalk16.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64021
64406
  return 2;
64022
64407
  }
64023
64408
  const waitMs = parseWaitMs(opts.wait);
64024
64409
  if (waitMs === null) {
64025
- console.error(chalk15.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
64410
+ console.error(chalk16.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
64026
64411
  return 2;
64027
64412
  }
64028
64413
  const mode = resolveMode(opts);
64029
64414
  if (mode.kind === "error") {
64030
- console.error(chalk15.red(mode.message));
64415
+ console.error(chalk16.red(mode.message));
64031
64416
  return 2;
64032
64417
  }
64033
64418
  const browser = await launchBrowser({ headless: true });
@@ -64036,11 +64421,11 @@ async function htmlCommand(opts) {
64036
64421
  const html = await fetchSnapshot(browser, mode.url, viewport, waitMs);
64037
64422
  const piece = extractSelector(html, opts.selector);
64038
64423
  if (piece.error) {
64039
- console.error(chalk15.red(piece.error));
64424
+ console.error(chalk16.red(piece.error));
64040
64425
  return 2;
64041
64426
  }
64042
64427
  if (piece.warning)
64043
- console.error(chalk15.yellow(` ⚠ ${piece.warning}`));
64428
+ console.error(chalk16.yellow(` ⚠ ${piece.warning}`));
64044
64429
  const finalText = await maybePretty(piece.html, opts.pretty === true);
64045
64430
  if (opts.json) {
64046
64431
  console.log(JSON.stringify({
@@ -64061,17 +64446,17 @@ async function htmlCommand(opts) {
64061
64446
  const prodPiece = extractSelector(prodHtml, opts.selector);
64062
64447
  const candPiece = extractSelector(candHtml, opts.selector);
64063
64448
  if (prodPiece.error) {
64064
- console.error(chalk15.red(`prod: ${prodPiece.error}`));
64449
+ console.error(chalk16.red(`prod: ${prodPiece.error}`));
64065
64450
  return 2;
64066
64451
  }
64067
64452
  if (candPiece.error) {
64068
- console.error(chalk15.red(`cand: ${candPiece.error}`));
64453
+ console.error(chalk16.red(`cand: ${candPiece.error}`));
64069
64454
  return 2;
64070
64455
  }
64071
64456
  if (prodPiece.warning)
64072
- console.error(chalk15.yellow(` ⚠ prod: ${prodPiece.warning}`));
64457
+ console.error(chalk16.yellow(` ⚠ prod: ${prodPiece.warning}`));
64073
64458
  if (candPiece.warning)
64074
- console.error(chalk15.yellow(` ⚠ cand: ${candPiece.warning}`));
64459
+ console.error(chalk16.yellow(` ⚠ cand: ${candPiece.warning}`));
64075
64460
  const [prodFmt, candFmt] = await Promise.all([
64076
64461
  maybePretty(prodPiece.html, opts.pretty !== false),
64077
64462
  maybePretty(candPiece.html, opts.pretty !== false)
@@ -64219,19 +64604,19 @@ function formatPatch(patch) {
64219
64604
  if (line.startsWith("Index:") || line.startsWith("==="))
64220
64605
  continue;
64221
64606
  if (line.startsWith("---") || line.startsWith("+++")) {
64222
- out.push(chalk15.dim(line));
64607
+ out.push(chalk16.dim(line));
64223
64608
  continue;
64224
64609
  }
64225
64610
  if (line.startsWith("@@")) {
64226
- out.push(chalk15.cyan(line));
64611
+ out.push(chalk16.cyan(line));
64227
64612
  continue;
64228
64613
  }
64229
64614
  if (line.startsWith("+")) {
64230
- out.push(chalk15.green(line));
64615
+ out.push(chalk16.green(line));
64231
64616
  continue;
64232
64617
  }
64233
64618
  if (line.startsWith("-")) {
64234
- out.push(chalk15.red(line));
64619
+ out.push(chalk16.red(line));
64235
64620
  continue;
64236
64621
  }
64237
64622
  out.push(line);
@@ -64243,13 +64628,13 @@ function formatPatch(patch) {
64243
64628
  // src/commands/journey.ts
64244
64629
  import { writeFileSync as writeFileSync20 } from "node:fs";
64245
64630
  import { join as join21 } from "node:path";
64246
- import chalk16 from "chalk";
64631
+ import chalk17 from "chalk";
64247
64632
  import ora7 from "ora";
64248
64633
  init_client();
64249
64634
  async function journeyCommand(opts) {
64250
64635
  const viewports = opts.viewports.split(",").map((s) => s.trim()).filter((s) => s === "mobile" || s === "desktop");
64251
64636
  if (viewports.length === 0) {
64252
- console.error(chalk16.red("Nenhum viewport válido (use mobile,desktop)"));
64637
+ console.error(chalk17.red("Nenhum viewport válido (use mobile,desktop)"));
64253
64638
  return 2;
64254
64639
  }
64255
64640
  const rc = loadParityRc();
@@ -64259,13 +64644,13 @@ async function journeyCommand(opts) {
64259
64644
  const runId = newRunId();
64260
64645
  const paths = createRunDir(opts.output, runId);
64261
64646
  if (!opts.json) {
64262
- console.log(chalk16.bold(`
64647
+ console.log(chalk17.bold(`
64263
64648
  parity journey ${runId}`));
64264
- console.log(chalk16.dim(` prod: ${opts.prod}`));
64265
- console.log(chalk16.dim(` cand: ${opts.cand}`));
64266
- console.log(chalk16.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
64649
+ console.log(chalk17.dim(` prod: ${opts.prod}`));
64650
+ console.log(chalk17.dim(` cand: ${opts.cand}`));
64651
+ console.log(chalk17.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
64267
64652
  if (isLlmAvailable())
64268
- console.log(chalk16.dim(` llm: ${providerLabel()}`));
64653
+ console.log(chalk17.dim(` llm: ${providerLabel()}`));
64269
64654
  console.log("");
64270
64655
  }
64271
64656
  let platform = "custom";
@@ -64299,15 +64684,15 @@ async function journeyCommand(opts) {
64299
64684
  const onStepFor = (viewport, side) => (event) => {
64300
64685
  if (opts.json)
64301
64686
  return;
64302
- const sideTag = side === "prod" ? chalk16.cyan("prod") : chalk16.magenta("cand");
64303
- const prefix = ` ${chalk16.dim(`[${viewport}/`)}${sideTag}${chalk16.dim("]")}`;
64687
+ const sideTag = side === "prod" ? chalk17.cyan("prod") : chalk17.magenta("cand");
64688
+ const prefix = ` ${chalk17.dim(`[${viewport}/`)}${sideTag}${chalk17.dim("]")}`;
64304
64689
  if (event.phase === "start") {
64305
- console.log(`${prefix} ${chalk16.dim(`${event.index}/${event.total}`)} ▶ ${chalk16.bold(stepLabel(event.name))}`);
64690
+ console.log(`${prefix} ${chalk17.dim(`${event.index}/${event.total}`)} ▶ ${chalk17.bold(stepLabel(event.name))}`);
64306
64691
  } else {
64307
- const glyph = event.status === "ok" ? chalk16.green("✓") : event.status === "skipped" ? chalk16.yellow("○") : chalk16.red("✗");
64308
- const noteText = event.note ? chalk16.dim(` (${event.note})`) : "";
64309
- const time = chalk16.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
64310
- console.log(`${prefix} ${chalk16.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
64692
+ const glyph = event.status === "ok" ? chalk17.green("✓") : event.status === "skipped" ? chalk17.yellow("○") : chalk17.red("✗");
64693
+ const noteText = event.note ? chalk17.dim(` (${event.note})`) : "";
64694
+ const time = chalk17.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
64695
+ console.log(`${prefix} ${chalk17.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
64311
64696
  }
64312
64697
  };
64313
64698
  async function runOneSide(browserInstance, viewport, side) {
@@ -64346,7 +64731,7 @@ async function journeyCommand(opts) {
64346
64731
  spinner?.succeed("Browser pronto");
64347
64732
  for (const viewport of viewports) {
64348
64733
  if (!opts.json)
64349
- console.log(chalk16.bold(`
64734
+ console.log(chalk17.bold(`
64350
64735
  ── ${viewport} ─────────────────────────────────────────────`));
64351
64736
  const [prodCap, candCap] = await Promise.all([
64352
64737
  runOneSide(browser, viewport, "prod"),
@@ -64381,11 +64766,11 @@ async function journeyCommand(opts) {
64381
64766
  if (totalDeprecated > 0)
64382
64767
  bits.push(`${totalDeprecated} depreciado(s)`);
64383
64768
  if (bits.length > 0)
64384
- console.log(chalk16.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
64769
+ console.log(chalk17.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
64385
64770
  }
64386
64771
  } catch (err) {
64387
64772
  if (!opts.json) {
64388
- console.warn(chalk16.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
64773
+ console.warn(chalk17.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
64389
64774
  }
64390
64775
  }
64391
64776
  }
@@ -64406,7 +64791,7 @@ async function journeyCommand(opts) {
64406
64791
  if (opts.junit) {
64407
64792
  writeFileSync20(opts.junit, buildJUnit(rows, failures), "utf8");
64408
64793
  if (!opts.json)
64409
- console.log(chalk16.dim(` → JUnit XML: ${opts.junit}`));
64794
+ console.log(chalk17.dim(` → JUnit XML: ${opts.junit}`));
64410
64795
  }
64411
64796
  return failures.some((f) => f.critical) ? 1 : 0;
64412
64797
  } catch (err) {
@@ -64471,14 +64856,14 @@ function collectFailures(rows) {
64471
64856
  function printTable(viewports, rows) {
64472
64857
  console.log("");
64473
64858
  for (const viewport of viewports) {
64474
- console.log(chalk16.bold(` [${viewport}]`));
64859
+ console.log(chalk17.bold(` [${viewport}]`));
64475
64860
  const vrows = rows.filter((r) => r.viewport === viewport);
64476
64861
  for (const r of vrows) {
64477
64862
  const label = PJ_STEP_LABELS_NUMBERED[r.name] ?? r.name;
64478
64863
  const p = statusGlyph(r.prod?.status);
64479
64864
  const c = statusGlyph(r.cand?.status);
64480
- const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk16.red("FAILED") : "";
64481
- const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk16.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
64865
+ const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk17.red("FAILED") : "";
64866
+ const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk17.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
64482
64867
  console.log(` ${label.padEnd(24)} prod ${p} cand ${c} ${status} ${note}`);
64483
64868
  }
64484
64869
  console.log("");
@@ -64486,12 +64871,12 @@ function printTable(viewports, rows) {
64486
64871
  }
64487
64872
  function statusGlyph(status) {
64488
64873
  if (!status)
64489
- return chalk16.dim("—");
64874
+ return chalk17.dim("—");
64490
64875
  if (status === "ok")
64491
- return chalk16.green("✓");
64876
+ return chalk17.green("✓");
64492
64877
  if (status === "skipped")
64493
- return chalk16.yellow("○");
64494
- return chalk16.red("✗");
64878
+ return chalk17.yellow("○");
64879
+ return chalk17.red("✗");
64495
64880
  }
64496
64881
  function printSummary6(rows, failures, htmlPath) {
64497
64882
  const byViewport = new Map;
@@ -64502,25 +64887,25 @@ function printSummary6(rows, failures, htmlPath) {
64502
64887
  v.passed++;
64503
64888
  byViewport.set(r.viewport, v);
64504
64889
  }
64505
- console.log(chalk16.bold(" Summary:"));
64890
+ console.log(chalk17.bold(" Summary:"));
64506
64891
  for (const [vp, { passed, total }] of byViewport) {
64507
- const stat = passed === total ? chalk16.green("✓") : chalk16.yellow(`${passed}/${total}`);
64892
+ const stat = passed === total ? chalk17.green("✓") : chalk17.yellow(`${passed}/${total}`);
64508
64893
  console.log(` ${vp.padEnd(8)} ${stat} steps em cand`);
64509
64894
  }
64510
64895
  if (failures.length > 0) {
64511
64896
  const crit = failures.filter((f) => f.critical).length;
64512
64897
  console.log("");
64513
- console.log(chalk16.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
64898
+ console.log(chalk17.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
64514
64899
  for (const f of failures) {
64515
- const tag = f.critical ? chalk16.red("[critical]") : chalk16.yellow("[warn]");
64900
+ const tag = f.critical ? chalk17.red("[critical]") : chalk17.yellow("[warn]");
64516
64901
  console.log(` ${tag} [${f.viewport}] ${f.step}: ${f.reason}`);
64517
64902
  }
64518
64903
  } else {
64519
64904
  console.log("");
64520
- console.log(chalk16.green(" ✓ jornada completa em cand"));
64905
+ console.log(chalk17.green(" ✓ jornada completa em cand"));
64521
64906
  }
64522
64907
  console.log("");
64523
- console.log(chalk16.dim(` → ${htmlPath}`));
64908
+ console.log(chalk17.dim(` → ${htmlPath}`));
64524
64909
  console.log("");
64525
64910
  }
64526
64911
  function emitGithubAnnotations(failures) {
@@ -64755,26 +65140,26 @@ function safeHost5(url) {
64755
65140
  }
64756
65141
 
64757
65142
  // src/commands/learned.ts
64758
- import chalk17 from "chalk";
65143
+ import chalk18 from "chalk";
64759
65144
  init_client();
64760
65145
  function learnedStats() {
64761
65146
  const lib = loadLearned();
64762
65147
  const stats = statsFromLib(lib);
64763
65148
  if (stats.platforms.length === 0) {
64764
- console.log(chalk17.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
64765
- console.log(chalk17.dim("Rode `parity run ...` em algum site para começar a popular."));
65149
+ console.log(chalk18.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
65150
+ console.log(chalk18.dim("Rode `parity run ...` em algum site para começar a popular."));
64766
65151
  return 0;
64767
65152
  }
64768
- console.log(chalk17.bold(`
65153
+ console.log(chalk18.bold(`
64769
65154
  learned-selectors stats (${LEARNED_PATH})
64770
65155
  `));
64771
65156
  for (const p of stats.platforms) {
64772
- const staleNote = p.staleSelectors > 0 ? ` · ${chalk17.yellow(`${p.staleSelectors} stale`)}` : "";
64773
- console.log(`${chalk17.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk17.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
65157
+ const staleNote = p.staleSelectors > 0 ? ` · ${chalk18.yellow(`${p.staleSelectors} stale`)}` : "";
65158
+ console.log(`${chalk18.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk18.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
64774
65159
  for (const top of p.topByKey) {
64775
65160
  const sr = `${(top.successRate * 100).toFixed(0)}%`;
64776
- const originTag = top.origin === "llm-guess" ? chalk17.yellow(" [guess]") : "";
64777
- console.log(` ${chalk17.dim(top.key.padEnd(18))} ${chalk17.green(sr.padStart(4))} ${chalk17.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
65161
+ const originTag = top.origin === "llm-guess" ? chalk18.yellow(" [guess]") : "";
65162
+ console.log(` ${chalk18.dim(top.key.padEnd(18))} ${chalk18.green(sr.padStart(4))} ${chalk18.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
64778
65163
  }
64779
65164
  console.log("");
64780
65165
  }
@@ -64782,10 +65167,10 @@ learned-selectors stats (${LEARNED_PATH})
64782
65167
  }
64783
65168
  async function learnedValidate(url) {
64784
65169
  if (!isLlmAvailable()) {
64785
- console.error(chalk17.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
65170
+ console.error(chalk18.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
64786
65171
  return 2;
64787
65172
  }
64788
- console.log(chalk17.dim(` Baixando home de ${url}…`));
65173
+ console.log(chalk18.dim(` Baixando home de ${url}…`));
64789
65174
  let html;
64790
65175
  try {
64791
65176
  const res = await fetch(url, {
@@ -64794,20 +65179,20 @@ async function learnedValidate(url) {
64794
65179
  });
64795
65180
  html = res.ok ? await res.text() : null;
64796
65181
  } catch (err) {
64797
- console.error(chalk17.red(` ✖ falha ao baixar ${url}: ${err.message}`));
65182
+ console.error(chalk18.red(` ✖ falha ao baixar ${url}: ${err.message}`));
64798
65183
  return 2;
64799
65184
  }
64800
65185
  if (!html) {
64801
- console.error(chalk17.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
65186
+ console.error(chalk18.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
64802
65187
  return 2;
64803
65188
  }
64804
- console.log(chalk17.dim(" Descobrindo seletores via LLM…"));
65189
+ console.log(chalk18.dim(" Descobrindo seletores via LLM…"));
64805
65190
  const discovered = await discoverSelectorsFromUrl(url, html, { noCache: true });
64806
65191
  if (!discovered) {
64807
- console.error(chalk17.red(" ✖ LLM não retornou seletores"));
65192
+ console.error(chalk18.red(" ✖ LLM não retornou seletores"));
64808
65193
  return 2;
64809
65194
  }
64810
- console.log(chalk17.dim(" Validando ao vivo (browser headless)…"));
65195
+ console.log(chalk18.dim(" Validando ao vivo (browser headless)…"));
64811
65196
  let browser = null;
64812
65197
  try {
64813
65198
  browser = await launchBrowser({ headless: true });
@@ -64817,7 +65202,7 @@ async function learnedValidate(url) {
64817
65202
  const { validated } = await validateSelectors(page, discovered);
64818
65203
  await ctx.close();
64819
65204
  const lowConfidence = new Set(discovered.lowConfidenceKeys ?? []);
64820
- console.log(chalk17.bold(`
65205
+ console.log(chalk18.bold(`
64821
65206
  learned validate — ${url}
64822
65207
  `));
64823
65208
  for (const key of Object.keys(discovered)) {
@@ -64825,17 +65210,17 @@ learned validate — ${url}
64825
65210
  continue;
64826
65211
  const selector = discovered[key];
64827
65212
  if (!selector) {
64828
- console.log(` ${chalk17.dim(key.padEnd(20))} ${chalk17.dim("(vazio — LLM não detectou)")}`);
65213
+ console.log(` ${chalk18.dim(key.padEnd(20))} ${chalk18.dim("(vazio — LLM não detectou)")}`);
64829
65214
  continue;
64830
65215
  }
64831
- const state = validated[key] === true ? chalk17.green("validated") : validated[key] === false ? chalk17.red("not-validated") : chalk17.yellow("not-checked");
64832
- const guessTag = lowConfidence.has(key) ? chalk17.yellow(" [low-confidence]") : "";
65216
+ const state = validated[key] === true ? chalk18.green("validated") : validated[key] === false ? chalk18.red("not-validated") : chalk18.yellow("not-checked");
65217
+ const guessTag = lowConfidence.has(key) ? chalk18.yellow(" [low-confidence]") : "";
64833
65218
  console.log(` ${key.padEnd(20)} ${state.padEnd(22)} ${selector}${guessTag}`);
64834
65219
  }
64835
65220
  console.log("");
64836
65221
  return 0;
64837
65222
  } catch (err) {
64838
- console.error(chalk17.red(` ✖ validação ao vivo falhou: ${err.message}`));
65223
+ console.error(chalk18.red(` ✖ validação ao vivo falhou: ${err.message}`));
64839
65224
  return 2;
64840
65225
  } finally {
64841
65226
  if (browser)
@@ -64844,20 +65229,20 @@ learned validate — ${url}
64844
65229
  }
64845
65230
 
64846
65231
  // src/commands/list.ts
64847
- import chalk18 from "chalk";
65232
+ import chalk19 from "chalk";
64848
65233
  function listModulesCommand(json) {
64849
65234
  if (json) {
64850
65235
  console.log(JSON.stringify(MODULES, null, 2));
64851
65236
  return 0;
64852
65237
  }
64853
65238
  for (const mod of Object.values(MODULES)) {
64854
- console.log(` ${chalk18.bold(mod.name)} ${chalk18.dim(mod.description)}`);
65239
+ console.log(` ${chalk19.bold(mod.name)} ${chalk19.dim(mod.description)}`);
64855
65240
  console.log(` checks: ${mod.checks.join(", ")}`);
64856
65241
  console.log(` flows: ${mod.flows.join(", ")}`);
64857
65242
  if (mod.needsSitemapPages)
64858
- console.log(chalk18.dim(" needs sitemap-page crawling"));
65243
+ console.log(chalk19.dim(" needs sitemap-page crawling"));
64859
65244
  if (mod.needsLlm)
64860
- console.log(chalk18.dim(" needs an LLM pass for full value"));
65245
+ console.log(chalk19.dim(" needs an LLM pass for full value"));
64861
65246
  console.log("");
64862
65247
  }
64863
65248
  return 0;
@@ -64865,18 +65250,18 @@ function listModulesCommand(json) {
64865
65250
  function listCommand(output) {
64866
65251
  const runs = listRuns(output);
64867
65252
  if (runs.length === 0) {
64868
- console.log(chalk18.dim(`Nenhum run salvo em ${output}`));
65253
+ console.log(chalk19.dim(`Nenhum run salvo em ${output}`));
64869
65254
  return 0;
64870
65255
  }
64871
65256
  for (const r of runs) {
64872
65257
  try {
64873
65258
  const run = loadRun(output, r.id);
64874
65259
  const v = run.verdict;
64875
- const status = v.status === "inconclusive" ? chalk18.dim(v.status) : v.status === "pass" ? chalk18.green(v.status) : v.status === "warn" ? chalk18.yellow(v.status) : chalk18.red(v.status);
65260
+ const status = v.status === "inconclusive" ? chalk19.dim(v.status) : v.status === "pass" ? chalk19.green(v.status) : v.status === "warn" ? chalk19.yellow(v.status) : chalk19.red(v.status);
64876
65261
  const score = v.status === "inconclusive" ? "—" : v.score;
64877
- console.log(` ${chalk18.bold(r.id)} ${status} score=${score} critical=${v.critical} high=${v.high} ${chalk18.dim(r.timestamp)}`);
65262
+ console.log(` ${chalk19.bold(r.id)} ${status} score=${score} critical=${v.critical} high=${v.high} ${chalk19.dim(r.timestamp)}`);
64878
65263
  } catch {
64879
- console.log(` ${chalk18.bold(r.id)} ${chalk18.dim("(report.json ausente)")}`);
65264
+ console.log(` ${chalk19.bold(r.id)} ${chalk19.dim("(report.json ausente)")}`);
64880
65265
  }
64881
65266
  }
64882
65267
  return 0;
@@ -64885,7 +65270,7 @@ function listCommand(output) {
64885
65270
  // src/commands/migrate.ts
64886
65271
  import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync22, writeFileSync as writeFileSync25 } from "node:fs";
64887
65272
  import { resolve as resolve6 } from "node:path";
64888
- import chalk19 from "chalk";
65273
+ import chalk20 from "chalk";
64889
65274
  import open from "open";
64890
65275
 
64891
65276
  // src/migrate/pdp-discovery.ts
@@ -66888,22 +67273,22 @@ async function captureInteractions(page, selector) {
66888
67273
  async function migrateCommand(opts) {
66889
67274
  const viewport = parseViewport3(opts.viewport);
66890
67275
  if (!viewport) {
66891
- console.error(chalk19.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67276
+ console.error(chalk20.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
66892
67277
  return 2;
66893
67278
  }
66894
67279
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
66895
67280
  if (viewports.length === 0) {
66896
- console.error(chalk19.red(`--viewports inválido: ${opts.viewports}`));
67281
+ console.error(chalk20.red(`--viewports inválido: ${opts.viewports}`));
66897
67282
  return 2;
66898
67283
  }
66899
67284
  const primaryViewport = viewports[0];
66900
67285
  if (!isValidUrl4(opts.url)) {
66901
- console.error(chalk19.red(`--url inválido: ${opts.url}`));
67286
+ console.error(chalk20.red(`--url inválido: ${opts.url}`));
66902
67287
  return 2;
66903
67288
  }
66904
67289
  const format = normalizeFormat2(opts.format);
66905
67290
  if (!format) {
66906
- console.error(chalk19.red(`--format inválido: ${opts.format} (use md|json|both)`));
67291
+ console.error(chalk20.red(`--format inválido: ${opts.format} (use md|json|both)`));
66907
67292
  return 2;
66908
67293
  }
66909
67294
  let pageTokens;
@@ -66913,14 +67298,14 @@ async function migrateCommand(opts) {
66913
67298
  fallback: ["/", "category-auto", "pdp-auto"]
66914
67299
  });
66915
67300
  } catch (err) {
66916
- console.error(chalk19.red(err.message));
67301
+ console.error(chalk20.red(err.message));
66917
67302
  return 2;
66918
67303
  }
66919
67304
  let playbook;
66920
67305
  if (opts.target) {
66921
67306
  playbook = getTargetPlaybook(opts.target);
66922
67307
  if (!playbook) {
66923
- console.error(chalk19.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67308
+ console.error(chalk20.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
66924
67309
  return 2;
66925
67310
  }
66926
67311
  }
@@ -66930,7 +67315,7 @@ async function migrateCommand(opts) {
66930
67315
  if (opts.sourceKind) {
66931
67316
  const s = getSource(opts.sourceKind);
66932
67317
  if (!s) {
66933
- console.error(chalk19.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67318
+ console.error(chalk20.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
66934
67319
  return 2;
66935
67320
  }
66936
67321
  source = s;
@@ -66939,23 +67324,23 @@ async function migrateCommand(opts) {
66939
67324
  let sourceProject = null;
66940
67325
  if (opts.source) {
66941
67326
  if (!existsSync18(opts.source)) {
66942
- console.error(chalk19.red(`--source não encontrado: ${opts.source}`));
67327
+ console.error(chalk20.red(`--source não encontrado: ${opts.source}`));
66943
67328
  return 2;
66944
67329
  }
66945
67330
  if (!opts.sourceKind)
66946
67331
  source = detectSource(opts.source);
66947
67332
  sourceInventory = source.inventory(opts.source);
66948
- console.log(chalk19.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67333
+ console.log(chalk20.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
66949
67334
  sourceProject = readSourceProject(opts.source, sourceInventory.components);
66950
67335
  for (const note of sourceProject.notes)
66951
- console.log(chalk19.dim(` ${note}`));
67336
+ console.log(chalk20.dim(` ${note}`));
66952
67337
  } else if (!opts.noSourceHunt) {
66953
67338
  sourceHunt = findSourceCandidates({
66954
67339
  url: opts.url,
66955
67340
  roots: defaultSearchRoots()
66956
67341
  });
66957
67342
  const message = formatSourceHunt(sourceHunt);
66958
- console.log(sourceHunt.candidates.length > 0 ? chalk19.yellow(message) : chalk19.dim(message));
67343
+ console.log(sourceHunt.candidates.length > 0 ? chalk20.yellow(message) : chalk20.dim(message));
66959
67344
  }
66960
67345
  const host = safeHost6(opts.url);
66961
67346
  const runDir = resolve6(opts.outDir, host);
@@ -66979,9 +67364,9 @@ async function migrateCommand(opts) {
66979
67364
  stack = meta.stack ?? null;
66980
67365
  assets = meta.assets;
66981
67366
  screenshots = meta.screenshots ?? [];
66982
- console.log(chalk19.dim(" phase 1 theme+assets: cached"));
67367
+ console.log(chalk20.dim(" phase 1 theme+assets: cached"));
66983
67368
  } else {
66984
- console.log(chalk19.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67369
+ console.log(chalk20.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
66985
67370
  mkdirSync16(resolve6(runDir, "screenshots"), { recursive: true });
66986
67371
  const samples = [];
66987
67372
  screenshots = [];
@@ -67006,9 +67391,9 @@ async function migrateCommand(opts) {
67006
67391
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
67007
67392
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
67008
67393
  stack = classifyLiveStack(pageHtml, cookieNames);
67009
- console.log(chalk19.dim(` stack: ${describeStack(stack)}`));
67394
+ console.log(chalk20.dim(` stack: ${describeStack(stack)}`));
67010
67395
  if (!opts.source && stack.frontend !== "unknown") {
67011
- console.warn(chalk19.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67396
+ console.warn(chalk20.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67012
67397
  Re-run with --source <repo> for structural porting (real class strings, not measured pixels).`));
67013
67398
  }
67014
67399
  const rawAssets = await collectSiteAssets(page);
@@ -67044,9 +67429,9 @@ async function migrateCommand(opts) {
67044
67429
  let resolvedPages;
67045
67430
  if (!opts.refresh && existsSync18(sitemapPath)) {
67046
67431
  resolvedPages = readJson(sitemapPath).pages;
67047
- console.log(chalk19.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67432
+ console.log(chalk20.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67048
67433
  } else {
67049
- console.log(chalk19.dim(" phase 2 sitemap: resolving pages…"));
67434
+ console.log(chalk20.dim(" phase 2 sitemap: resolving pages…"));
67050
67435
  const ctx = await newContext(browser, { viewport: primaryViewport });
67051
67436
  const page = await ctx.newPage();
67052
67437
  let sitemapUrls = [];
@@ -67074,13 +67459,13 @@ async function migrateCommand(opts) {
67074
67459
  a[p.kind] = (a[p.kind] ?? 0) + 1;
67075
67460
  return a;
67076
67461
  }, {});
67077
- console.log(chalk19.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67462
+ console.log(chalk20.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67078
67463
  }
67079
67464
  writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
67080
67465
  `, "utf8");
67081
67466
  }
67082
67467
  if (resolvedPages.length === 0) {
67083
- console.error(chalk19.red("nenhuma página resolvida a partir de --pages"));
67468
+ console.error(chalk20.red("nenhuma página resolvida a partir de --pages"));
67084
67469
  return 1;
67085
67470
  }
67086
67471
  const capturePath = resolve6(runDir, "capture.json");
@@ -67092,9 +67477,9 @@ async function migrateCommand(opts) {
67092
67477
  components = cached.components;
67093
67478
  vtexBlocks = cached.vtexBlocks ?? null;
67094
67479
  contentMap = cached.contentMap ?? {};
67095
- console.log(chalk19.dim(` phase 3 components: cached (${components.length})`));
67480
+ console.log(chalk20.dim(` phase 3 components: cached (${components.length})`));
67096
67481
  } else {
67097
- console.log(chalk19.dim(" phase 3 components: capturing…"));
67482
+ console.log(chalk20.dim(" phase 3 components: capturing…"));
67098
67483
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
67099
67484
  allowlist,
67100
67485
  llm: !opts.noLlm,
@@ -67157,13 +67542,13 @@ async function migrateCommand(opts) {
67157
67542
  const projectPath = resolve6(runDir, "source-project.json");
67158
67543
  writeFileSync25(projectPath, `${JSON.stringify(sourceProject, null, 2)}
67159
67544
  `, "utf8");
67160
- console.log(chalk19.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
67545
+ console.log(chalk20.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
67161
67546
  }
67162
67547
  if (merged.carried.length) {
67163
- console.log(chalk19.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67548
+ console.log(chalk20.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67164
67549
  }
67165
67550
  if (merged.keptUncaptured.length) {
67166
- console.log(chalk19.yellow(` plan: ${merged.keptUncaptured.length} row(s) kept although this capture no longer sees them — ${merged.keptUncaptured.join(", ")}. They carry a decision or were added by hand; the capture owns the captured row set, not rows it cannot see.`));
67551
+ console.log(chalk20.yellow(` plan: ${merged.keptUncaptured.length} row(s) kept although this capture no longer sees them — ${merged.keptUncaptured.join(", ")}. They carry a decision or were added by hand; the capture owns the captured row set, not rows it cannot see.`));
67167
67552
  }
67168
67553
  bundle.components.push(...syntheticSourceComponents(plan));
67169
67554
  if (format === "json" || format === "both")
@@ -67287,12 +67672,12 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67287
67672
  if (plp)
67288
67673
  out.push({ path: token, url: plp, kind: "plp" });
67289
67674
  else
67290
- console.warn(chalk19.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67675
+ console.warn(chalk20.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67291
67676
  continue;
67292
67677
  }
67293
67678
  if (token === "pdp-auto") {
67294
67679
  if (!plp) {
67295
- console.warn(chalk19.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67680
+ console.warn(chalk20.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67296
67681
  continue;
67297
67682
  }
67298
67683
  let html = null;
@@ -67309,7 +67694,7 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67309
67694
  if (pdp)
67310
67695
  out.push({ path: token, url: pdp, kind: "pdp" });
67311
67696
  else
67312
- console.warn(chalk19.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67697
+ console.warn(chalk20.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67313
67698
  continue;
67314
67699
  }
67315
67700
  try {
@@ -67403,25 +67788,25 @@ function kindOf(url) {
67403
67788
  }
67404
67789
  }
67405
67790
  function printResults4(runDir, bundle) {
67406
- console.log(chalk19.bold(`
67791
+ console.log(chalk20.bold(`
67407
67792
  parity migrate`));
67408
- console.log(chalk19.dim(` url: ${bundle.url}`));
67409
- console.log(chalk19.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67410
- console.log(chalk19.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67411
- console.log(chalk19.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67412
- console.log(chalk19.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
67793
+ console.log(chalk20.dim(` url: ${bundle.url}`));
67794
+ console.log(chalk20.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67795
+ console.log(chalk20.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67796
+ console.log(chalk20.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67797
+ console.log(chalk20.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
67413
67798
  if (bundle.vtex) {
67414
67799
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
67415
67800
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
67416
67801
  const contentImgs = countContentImages(bundle.vtex.blocks);
67417
- console.log(chalk19.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
67802
+ console.log(chalk20.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
67418
67803
  }
67419
- console.log(chalk19.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
67420
- console.log(chalk19.dim(` out: ${runDir}`));
67804
+ console.log(chalk20.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
67805
+ console.log(chalk20.dim(` out: ${runDir}`));
67421
67806
  console.log("");
67422
- console.log(chalk19.bold(` ${bundle.components.length} component(s):`));
67807
+ console.log(chalk20.bold(` ${bundle.components.length} component(s):`));
67423
67808
  for (const c of bundle.components) {
67424
- console.log(` ${chalk19.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk19.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
67809
+ console.log(` ${chalk20.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk20.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
67425
67810
  }
67426
67811
  console.log("");
67427
67812
  }
@@ -67471,223 +67856,66 @@ function isValidUrl4(s) {
67471
67856
 
67472
67857
  // src/commands/plan.ts
67473
67858
  import { readFileSync as readFileSync23 } from "node:fs";
67474
- import chalk20 from "chalk";
67475
-
67476
- // src/board/studio.ts
67477
- var LANE_TO_STUDIO = {
67478
- triage: "triage",
67479
- backlog: "todo",
67480
- building: "in_progress",
67481
- review: "in_review",
67482
- done: "done",
67483
- skipped: null
67484
- };
67485
- function studioConfigFromEnv(env = process.env) {
67486
- const url = env.PARITY_STUDIO_URL;
67487
- const token = env.PARITY_STUDIO_TOKEN;
67488
- if (!url || !token)
67489
- return null;
67490
- return { url: mcpEndpoint(url), token };
67491
- }
67492
- function mcpEndpoint(url) {
67493
- const trimmed = url.replace(/\/+$/, "");
67494
- return /\/mcp(\/|$)/.test(trimmed) ? trimmed : `${trimmed}/mcp/self`;
67495
- }
67496
- function cardTitle(path) {
67497
- return path;
67498
- }
67499
- var PARITY_COMMENT_PREFIX = "[parity]";
67500
- function cardDescription(card) {
67501
- const lines = [`kind: ${card.kind}`, `lane: ${card.column}`];
67502
- if (card.blockers.length)
67503
- lines.push(`blocked by: ${card.blockers.join(", ")}`);
67504
- else if (card.column === "triage") {
67505
- lines.push("scope not confirmed — no page/component edges yet");
67506
- }
67507
- return lines.join(`
67508
- `);
67509
- }
67510
- function parseRpcBody(body) {
67511
- const trimmed = body.trim();
67512
- if (!trimmed.startsWith("event:") && !trimmed.startsWith("data:")) {
67513
- return JSON.parse(trimmed);
67514
- }
67515
- const data = trimmed.split(`
67516
- `).filter((l) => l.startsWith("data:")).map((l) => l.slice(5).trim()).filter(Boolean);
67517
- const last = data[data.length - 1];
67518
- if (!last)
67519
- throw new Error("empty SSE response");
67520
- return JSON.parse(last);
67521
- }
67522
- var callTool2 = async (cfg, name, args) => {
67523
- const res = await fetch(cfg.url, {
67524
- method: "POST",
67525
- headers: {
67526
- "content-type": "application/json",
67527
- accept: "application/json, text/event-stream",
67528
- authorization: `Bearer ${cfg.token}`
67529
- },
67530
- body: JSON.stringify({
67531
- jsonrpc: "2.0",
67532
- id: 1,
67533
- method: "tools/call",
67534
- params: { name, arguments: args }
67535
- })
67536
- });
67537
- if (!res.ok) {
67538
- throw new Error(`${name}: HTTP ${res.status} ${await res.text().catch(() => "")}`);
67539
- }
67540
- const payload = parseRpcBody(await res.text());
67541
- if (payload.error)
67542
- throw new Error(`${name}: ${payload.error.message ?? "unknown error"}`);
67543
- const result = payload.result;
67544
- if (result?.isError) {
67545
- const text = result.content?.map((c) => c.text).join(" ") ?? "tool reported an error";
67546
- throw new Error(`${name}: ${text}`);
67547
- }
67548
- return result?.structuredContent ?? {};
67549
- };
67550
- async function syncBoardToStudio(board, cfg, opts = {}, call = callTool2) {
67551
- const existing = await call(cfg, "TASK_BOARD_ITEM_LIST", {});
67552
- const byTitle = new Map((existing.items ?? []).map((i) => [i.title, i]));
67553
- const byId = new Map((existing.items ?? []).map((i) => [i.id, i]));
67554
- const result = { created: 0, updated: 0, skipped: 0, ids: {} };
67555
- const upsert = async (title, description, status, knownId) => {
67556
- const found = (knownId ? byId.get(knownId) : undefined) ?? byTitle.get(title);
67557
- if (found) {
67558
- await call(cfg, "TASK_BOARD_ITEM_UPDATE", { id: found.id, title, status, description });
67559
- result.updated += 1;
67560
- return found.id;
67561
- }
67562
- const created = await call(cfg, "TASK_BOARD_ITEM_CREATE", {
67563
- title,
67564
- description,
67565
- status,
67566
- ...opts.repo ? { repo: opts.repo } : {}
67567
- });
67568
- result.created += 1;
67569
- return created.item?.id;
67570
- };
67571
- for (const cards of Object.values(board.columns)) {
67572
- for (const card of cards) {
67573
- const status = LANE_TO_STUDIO[card.column];
67574
- if (!status) {
67575
- result.skipped += 1;
67576
- continue;
67577
- }
67578
- const id = await upsert(cardTitle(card.path), cardDescription(card), status, card.boardItemId);
67579
- if (id)
67580
- result.ids[card.path] = id;
67581
- }
67582
- }
67583
- for (const fix of opts.fixes ?? []) {
67584
- await upsert(fix.title, fixDescription(fix), FIX_STATE_TO_STUDIO[fix.state]);
67585
- }
67586
- return result;
67587
- }
67588
- async function fetchClientNotes(pages, cfg, call = callTool2) {
67589
- const notes = [];
67590
- for (const page of pages) {
67591
- const res = await call(cfg, "TASK_BOARD_COMMENT_LIST", {
67592
- taskBoardItemId: page.boardItemId
67593
- });
67594
- for (const c of res.comments ?? []) {
67595
- if (c.body.trimStart().startsWith(PARITY_COMMENT_PREFIX))
67596
- continue;
67597
- if (c.resolved)
67598
- continue;
67599
- notes.push({
67600
- path: page.path,
67601
- boardItemId: page.boardItemId,
67602
- commentId: c.id,
67603
- body: c.body,
67604
- createdAt: c.createdAt
67605
- });
67606
- }
67607
- }
67608
- return notes;
67609
- }
67610
- async function postParityComment(boardItemId, body, cfg, call = callTool2) {
67611
- await call(cfg, "TASK_BOARD_COMMENT_CREATE", {
67612
- taskBoardItemId: boardItemId,
67613
- body: `${PARITY_COMMENT_PREFIX} ${body}`
67614
- });
67615
- }
67616
- var FIX_STATE_TO_STUDIO = {
67617
- open: "todo",
67618
- in_review: "in_review",
67619
- closed: "done"
67620
- };
67621
- function fixDescription(fix) {
67622
- const lines = [];
67623
- if (fix.body)
67624
- lines.push(fix.body);
67625
- if (fix.prUrl)
67626
- lines.push(`PR: ${fix.prUrl}`);
67627
- return lines.join(`
67628
- `);
67629
- }
67630
-
67631
- // src/commands/plan.ts
67859
+ import chalk21 from "chalk";
67632
67860
  var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
67633
67861
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
67634
67862
  function planSetStatusCommand(dir, name, status, opts = {}) {
67635
67863
  if (!STATUSES.includes(status)) {
67636
- console.error(chalk20.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
67864
+ console.error(chalk21.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
67637
67865
  return 1;
67638
67866
  }
67639
67867
  const plan = loadPlan(dir);
67640
67868
  if (!plan) {
67641
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67869
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67642
67870
  return 1;
67643
67871
  }
67644
67872
  const existed = plan.components.length;
67645
67873
  const component = setComponentStatus(plan, name, status, opts.create ? { create: { scope: opts.create } } : {});
67646
67874
  if (!component) {
67647
- console.error(chalk20.red(`No component matching "${name}" in the plan`));
67648
- console.error(chalk20.yellow("A capture can miss a component that exists — a zero-height overlay header, a portal-rendered panel. Add it with --create global|page if this is one of those, so the plan can hold a decision about it."));
67875
+ console.error(chalk21.red(`No component matching "${name}" in the plan`));
67876
+ console.error(chalk21.yellow("A capture can miss a component that exists — a zero-height overlay header, a portal-rendered panel. Add it with --create global|page if this is one of those, so the plan can hold a decision about it."));
67649
67877
  return 1;
67650
67878
  }
67651
67879
  if (plan.components.length > existed) {
67652
- console.log(chalk20.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
67880
+ console.log(chalk21.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
67653
67881
  }
67654
67882
  savePlan(dir, plan);
67655
- console.log(`${chalk20.green("✓")} ${component.name} → ${status}`);
67883
+ console.log(`${chalk21.green("✓")} ${component.name} → ${status}`);
67656
67884
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
67657
- console.log(chalk20.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
67885
+ console.log(chalk21.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
67658
67886
  }
67659
67887
  return 0;
67660
67888
  }
67661
67889
  function planSetPageStatusCommand(dir, path, status) {
67662
67890
  if (!PAGE_STATUSES.includes(status)) {
67663
- console.error(chalk20.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
67891
+ console.error(chalk21.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
67664
67892
  return 1;
67665
67893
  }
67666
67894
  const plan = loadPlan(dir);
67667
67895
  if (!plan) {
67668
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67896
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67669
67897
  return 1;
67670
67898
  }
67671
67899
  const page = setPageStatus(plan, path, status);
67672
67900
  if (!page) {
67673
- console.error(chalk20.red(`No page matching "${path}" in the plan`));
67901
+ console.error(chalk21.red(`No page matching "${path}" in the plan`));
67674
67902
  return 1;
67675
67903
  }
67676
67904
  savePlan(dir, plan);
67677
- console.log(`${chalk20.green("✓")} ${page.path} → ${status}`);
67905
+ console.log(`${chalk21.green("✓")} ${page.path} → ${status}`);
67678
67906
  return 0;
67679
67907
  }
67680
67908
  var DISPOSITION_STYLE = {
67681
- build: chalk20.red,
67682
- validate: chalk20.yellow,
67683
- upgrade: chalk20.cyan,
67684
- "as-is": chalk20.gray,
67685
- settled: chalk20.green
67909
+ build: chalk21.red,
67910
+ validate: chalk21.yellow,
67911
+ upgrade: chalk21.cyan,
67912
+ "as-is": chalk21.gray,
67913
+ settled: chalk21.green
67686
67914
  };
67687
67915
  function planSetReferenceCommand(dir, name, opts) {
67688
67916
  const plan = loadPlan(dir);
67689
67917
  if (!plan) {
67690
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67918
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67691
67919
  return 1;
67692
67920
  }
67693
67921
  const component = setComponentReference(plan, name, {
@@ -67696,76 +67924,76 @@ function planSetReferenceCommand(dir, name, opts) {
67696
67924
  note: opts.note
67697
67925
  });
67698
67926
  if (!component) {
67699
- console.error(chalk20.red(`No component matching "${name}" in the plan`));
67927
+ console.error(chalk21.red(`No component matching "${name}" in the plan`));
67700
67928
  return 1;
67701
67929
  }
67702
67930
  savePlan(dir, plan);
67703
- console.log(`${chalk20.green("✓")} ${component.name} → reference ${component.reference?.url}`);
67931
+ console.log(`${chalk21.green("✓")} ${component.name} → reference ${component.reference?.url}`);
67704
67932
  return 0;
67705
67933
  }
67706
67934
  function planVerifyCommand(dir, name, verdict, opts) {
67707
67935
  if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
67708
- console.error(chalk20.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
67936
+ console.error(chalk21.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
67709
67937
  return 1;
67710
67938
  }
67711
67939
  const plan = loadPlan(dir);
67712
67940
  if (!plan) {
67713
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67941
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67714
67942
  return 1;
67715
67943
  }
67716
67944
  const component = setComponentVerified(plan, name, verdict, opts.at ?? new Date().toISOString(), opts.note);
67717
67945
  if (!component) {
67718
- console.error(chalk20.red(`No component matching "${name}" in the plan`));
67946
+ console.error(chalk21.red(`No component matching "${name}" in the plan`));
67719
67947
  return 1;
67720
67948
  }
67721
67949
  savePlan(dir, plan);
67722
- const mark = verdict === "pass" ? chalk20.green("✓") : verdict === "inconclusive" ? chalk20.yellow("?") : chalk20.red("✗");
67950
+ const mark = verdict === "pass" ? chalk21.green("✓") : verdict === "inconclusive" ? chalk21.yellow("?") : chalk21.red("✗");
67723
67951
  console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
67724
67952
  return 0;
67725
67953
  }
67726
67954
  function planMergeCommand(dir, sourceDir) {
67727
67955
  const fresh = loadPlan(sourceDir);
67728
67956
  if (!fresh) {
67729
- console.error(chalk20.red(`No migration-plan.json found in ${sourceDir}`));
67957
+ console.error(chalk21.red(`No migration-plan.json found in ${sourceDir}`));
67730
67958
  return 1;
67731
67959
  }
67732
67960
  const existing = loadPlan(dir);
67733
67961
  const { plan, carried, keptUncaptured } = mergePlanDecisions(fresh, existing);
67734
67962
  savePlan(dir, plan);
67735
67963
  if (!existing) {
67736
- console.log(`${chalk20.green("✓")} plan written to ${dir} (nothing to merge)`);
67964
+ console.log(`${chalk21.green("✓")} plan written to ${dir} (nothing to merge)`);
67737
67965
  return 0;
67738
67966
  }
67739
- console.log(`${chalk20.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
67967
+ console.log(`${chalk21.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
67740
67968
  if (keptUncaptured.length) {
67741
- console.log(chalk20.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
67969
+ console.log(chalk21.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
67742
67970
  }
67743
67971
  return 0;
67744
67972
  }
67745
67973
  function planPageCommand(dir, path, opts) {
67746
67974
  const plan = loadPlan(dir);
67747
67975
  if (!plan) {
67748
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67976
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67749
67977
  return 1;
67750
67978
  }
67751
67979
  const page = pagePlan(plan, path, opts.cand);
67752
67980
  if (!page) {
67753
- console.error(chalk20.red(`No page matching "${path}" in the plan`));
67754
- console.error(chalk20.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
67981
+ console.error(chalk21.red(`No page matching "${path}" in the plan`));
67982
+ console.error(chalk21.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
67755
67983
  return 1;
67756
67984
  }
67757
67985
  if (opts.json) {
67758
67986
  console.log(JSON.stringify(page, null, 2));
67759
67987
  return 0;
67760
67988
  }
67761
- console.log(chalk20.bold(`
67762
- ${page.path} ${chalk20.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk20.green(" ready") : ""));
67989
+ console.log(chalk21.bold(`
67990
+ ${page.path} ${chalk21.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk21.green(" ready") : ""));
67763
67991
  if (page.tasks === null) {
67764
- console.log(chalk20.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
67992
+ console.log(chalk21.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
67765
67993
  return 0;
67766
67994
  }
67767
67995
  if (page.tasks.length === 0) {
67768
- console.log(chalk20.gray(`
67996
+ console.log(chalk21.gray(`
67769
67997
  The capture saw no components on this page.
67770
67998
  `));
67771
67999
  return 0;
@@ -67776,20 +68004,20 @@ ${page.path} ${chalk20.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
67776
68004
  if (!rows.length)
67777
68005
  continue;
67778
68006
  console.log(`
67779
- ${DISPOSITION_STYLE[d](chalk20.bold(d))} (${rows.length})`);
68007
+ ${DISPOSITION_STYLE[d](chalk21.bold(d))} (${rows.length})`);
67780
68008
  for (const t of rows) {
67781
- console.log(` ${t.name} ${chalk20.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68009
+ console.log(` ${t.name} ${chalk21.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
67782
68010
  if (t.note)
67783
- console.log(chalk20.gray(` why: ${t.note}`));
68011
+ console.log(chalk21.gray(` why: ${t.note}`));
67784
68012
  if (t.against?.kind === "reference") {
67785
- console.log(chalk20.cyan(` reference: ${t.against.url}`));
68013
+ console.log(chalk21.cyan(` reference: ${t.against.url}`));
67786
68014
  }
67787
68015
  if (t.command)
67788
- console.log(chalk20.gray(` $ ${t.command}`));
68016
+ console.log(chalk21.gray(` $ ${t.command}`));
67789
68017
  }
67790
68018
  }
67791
68019
  if (page.counts.validate > 0 && !opts.cand) {
67792
- console.log(chalk20.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68020
+ console.log(chalk21.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
67793
68021
  }
67794
68022
  console.log("");
67795
68023
  return 0;
@@ -67797,8 +68025,8 @@ ${DISPOSITION_STYLE[d](chalk20.bold(d))} (${rows.length})`);
67797
68025
  function planStatusCommand(dir, asJson) {
67798
68026
  const plan = loadPlan(dir);
67799
68027
  if (!plan) {
67800
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67801
- console.error(chalk20.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68028
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68029
+ console.error(chalk21.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
67802
68030
  return 1;
67803
68031
  }
67804
68032
  const p = planProgress(plan);
@@ -67809,59 +68037,59 @@ function planStatusCommand(dir, asJson) {
67809
68037
  return 0;
67810
68038
  }
67811
68039
  const c = p.components;
67812
- console.log(chalk20.bold(`
68040
+ console.log(chalk21.bold(`
67813
68041
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
67814
68042
  console.log(`
67815
- ${chalk20.bold("Components")} (${c.total}): ` + `${chalk20.green(`${c.byStatus.done} done`)}, ` + `${chalk20.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk20.red(`${c.byStatus.pending} pending`)}, ` + `${chalk20.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk20.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk20.gray(`${c.byStatus.skipped} skipped`)}`);
68043
+ ${chalk21.bold("Components")} (${c.total}): ` + `${chalk21.green(`${c.byStatus.done} done`)}, ` + `${chalk21.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk21.red(`${c.byStatus.pending} pending`)}, ` + `${chalk21.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk21.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk21.gray(`${c.byStatus.skipped} skipped`)}`);
67816
68044
  if (c.accepted.upgrade.length) {
67817
- console.log(chalk20.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68045
+ console.log(chalk21.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
67818
68046
  }
67819
68047
  if (c.accepted.asIs.length) {
67820
- console.log(chalk20.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68048
+ console.log(chalk21.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
67821
68049
  }
67822
68050
  if (provenance.library > 0 || provenance.built > 0) {
67823
- const unrecorded = provenance.unrecorded > 0 ? chalk20.dim(`, ${provenance.unrecorded} unrecorded`) : "";
67824
- console.log(` reuse: ${chalk20.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68051
+ const unrecorded = provenance.unrecorded > 0 ? chalk21.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68052
+ console.log(` reuse: ${chalk21.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
67825
68053
  }
67826
68054
  if (touches > 0) {
67827
- console.log(chalk20.dim(` human touches: ${touches} across this migration`));
68055
+ console.log(chalk21.dim(` human touches: ${touches} across this migration`));
67828
68056
  }
67829
68057
  if (c.settledByStatus.done.length) {
67830
- console.log(chalk20.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68058
+ console.log(chalk21.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
67831
68059
  }
67832
68060
  if (c.settledByStatus.skipped.length) {
67833
- console.log(chalk20.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68061
+ console.log(chalk21.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
67834
68062
  }
67835
68063
  for (const r of c.remaining) {
67836
- const tag = r.status === "partial" ? chalk20.yellow("partial") : chalk20.red("pending");
67837
- console.log(` ${tag} ${r.name} ${chalk20.gray(`(${r.scope}, ${r.origin})`)}`);
68064
+ const tag = r.status === "partial" ? chalk21.yellow("partial") : chalk21.red("pending");
68065
+ console.log(` ${tag} ${r.name} ${chalk21.gray(`(${r.scope}, ${r.origin})`)}`);
67838
68066
  }
67839
68067
  const pg = p.pages;
67840
68068
  console.log(`
67841
- ${chalk20.bold("Pages")} (${pg.total}): ` + `${chalk20.green(`${pg.byStatus.done} done`)}, ` + `${chalk20.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk20.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk20.gray(`${pg.byStatus.skipped} skipped`)}`);
68069
+ ${chalk21.bold("Pages")} (${pg.total}): ` + `${chalk21.green(`${pg.byStatus.done} done`)}, ` + `${chalk21.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk21.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk21.gray(`${pg.byStatus.skipped} skipped`)}`);
67842
68070
  if (pg.awaitingContent.length) {
67843
- console.log(chalk20.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68071
+ console.log(chalk21.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
67844
68072
  }
67845
68073
  for (const r of pg.remaining.filter((r) => r.status === "pending")) {
67846
- console.log(` ${chalk20.red("pending")} ${r.path} ${chalk20.gray(`(${r.kind})`)}`);
68074
+ console.log(` ${chalk21.red("pending")} ${r.path} ${chalk21.gray(`(${r.kind})`)}`);
67847
68075
  }
67848
68076
  console.log("");
67849
68077
  return 0;
67850
68078
  }
67851
68079
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
67852
68080
  var COLUMN_STYLE = {
67853
- triage: chalk20.magenta,
67854
- backlog: chalk20.red,
67855
- building: chalk20.yellow,
67856
- review: chalk20.cyan,
67857
- done: chalk20.green,
67858
- skipped: chalk20.gray
68081
+ triage: chalk21.magenta,
68082
+ backlog: chalk21.red,
68083
+ building: chalk21.yellow,
68084
+ review: chalk21.cyan,
68085
+ done: chalk21.green,
68086
+ skipped: chalk21.gray
67859
68087
  };
67860
68088
  async function planBoardCommand(dir, opts) {
67861
68089
  const plan = loadPlan(dir);
67862
68090
  if (!plan) {
67863
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
67864
- console.error(chalk20.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68091
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68092
+ console.error(chalk21.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
67865
68093
  return 1;
67866
68094
  }
67867
68095
  const board = planBoard(plan, opts.cand);
@@ -67869,41 +68097,41 @@ async function planBoardCommand(dir, opts) {
67869
68097
  console.log(JSON.stringify(board, null, 2));
67870
68098
  return 0;
67871
68099
  }
67872
- console.log(chalk20.bold(`
68100
+ console.log(chalk21.bold(`
67873
68101
  Board — ${board.url}`));
67874
- console.log(chalk20.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68102
+ console.log(chalk21.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
67875
68103
  if (board.shell.length) {
67876
68104
  console.log(`
67877
- ${chalk20.bold("shell")} ${chalk20.gray("(global — blocks every page)")}: ${chalk20.yellow(board.shell.join(", "))}`);
68105
+ ${chalk21.bold("shell")} ${chalk21.gray("(global — blocks every page)")}: ${chalk21.yellow(board.shell.join(", "))}`);
67878
68106
  }
67879
68107
  for (const column of COLUMN_ORDER) {
67880
68108
  const cards = board.columns[column];
67881
68109
  if (!cards.length)
67882
68110
  continue;
67883
68111
  console.log(`
67884
- ${COLUMN_STYLE[column](chalk20.bold(column))} (${cards.length})`);
68112
+ ${COLUMN_STYLE[column](chalk21.bold(column))} (${cards.length})`);
67885
68113
  for (const card of cards) {
67886
- console.log(` ${card.path} ${chalk20.gray(`(${card.kind})`)}`);
68114
+ console.log(` ${card.path} ${chalk21.gray(`(${card.kind})`)}`);
67887
68115
  if (card.blockers.length) {
67888
- console.log(chalk20.gray(` blocked by: ${card.blockers.join(", ")}`));
68116
+ console.log(chalk21.gray(` blocked by: ${card.blockers.join(", ")}`));
67889
68117
  }
67890
68118
  }
67891
68119
  }
67892
68120
  const skipped = board.columns.skipped;
67893
68121
  if (skipped.length) {
67894
68122
  console.log(`
67895
- ${chalk20.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68123
+ ${chalk21.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
67896
68124
  }
67897
68125
  if (board.unassigned.length) {
67898
68126
  console.log(`
67899
- ${chalk20.bold("no page")} ${chalk20.gray("(in the code, not seen on any sampled page)")}
67900
- ${chalk20.gray(board.unassigned.join(", "))}`);
68127
+ ${chalk21.bold("no page")} ${chalk21.gray("(in the code, not seen on any sampled page)")}
68128
+ ${chalk21.gray(board.unassigned.join(", "))}`);
67901
68129
  }
67902
68130
  console.log("");
67903
68131
  if (opts.board === "studio") {
67904
68132
  const cfg = studioConfigFromEnv();
67905
68133
  if (!cfg) {
67906
- console.log(chalk20.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
68134
+ console.log(chalk21.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
67907
68135
  `));
67908
68136
  return 0;
67909
68137
  }
@@ -67917,10 +68145,10 @@ ${chalk20.bold("no page")} ${chalk20.gray("(in the code, not seen on any sampled
67917
68145
  }
67918
68146
  if (stored)
67919
68147
  savePlan(dir, plan);
67920
- console.log(chalk20.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68148
+ console.log(chalk21.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
67921
68149
  `));
67922
68150
  } catch (err) {
67923
- console.log(chalk20.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68151
+ console.log(chalk21.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
67924
68152
  `));
67925
68153
  }
67926
68154
  }
@@ -67929,27 +68157,27 @@ ${chalk20.bold("no page")} ${chalk20.gray("(in the code, not seen on any sampled
67929
68157
  async function planNotesCommand(dir, opts) {
67930
68158
  const plan = loadPlan(dir);
67931
68159
  if (!plan) {
67932
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
68160
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67933
68161
  return 1;
67934
68162
  }
67935
68163
  const cfg = studioConfigFromEnv();
67936
68164
  if (!cfg) {
67937
- console.error(chalk20.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
68165
+ console.error(chalk21.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
67938
68166
  return 1;
67939
68167
  }
67940
68168
  if (opts.post) {
67941
68169
  const page = plan.pages.find((p) => p.path === opts.page);
67942
68170
  if (!page?.boardItemId) {
67943
- console.error(chalk20.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68171
+ console.error(chalk21.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
67944
68172
  return 1;
67945
68173
  }
67946
68174
  await postParityComment(page.boardItemId, opts.post, cfg);
67947
- console.log(`${chalk20.green("✓")} comment posted on ${page.path}`);
68175
+ console.log(`${chalk21.green("✓")} comment posted on ${page.path}`);
67948
68176
  return 0;
67949
68177
  }
67950
68178
  const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
67951
68179
  if (!pages.length) {
67952
- console.error(chalk20.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68180
+ console.error(chalk21.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
67953
68181
  return 1;
67954
68182
  }
67955
68183
  const notes = await fetchClientNotes(pages, cfg);
@@ -67958,47 +68186,47 @@ async function planNotesCommand(dir, opts) {
67958
68186
  return 0;
67959
68187
  }
67960
68188
  if (!notes.length) {
67961
- console.log(chalk20.gray(`
68189
+ console.log(chalk21.gray(`
67962
68190
  No open client notes.
67963
68191
  `));
67964
68192
  return 0;
67965
68193
  }
67966
- console.log(chalk20.bold(`
68194
+ console.log(chalk21.bold(`
67967
68195
  Client notes (${notes.length})`));
67968
68196
  for (const n of notes) {
67969
68197
  console.log(`
67970
- ${chalk20.cyan(n.path)} ${chalk20.gray(n.createdAt)}`);
68198
+ ${chalk21.cyan(n.path)} ${chalk21.gray(n.createdAt)}`);
67971
68199
  for (const line of n.body.split(`
67972
68200
  `))
67973
68201
  console.log(` ${line}`);
67974
68202
  }
67975
- console.log(chalk20.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
68203
+ console.log(chalk21.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
67976
68204
  return 0;
67977
68205
  }
67978
68206
  var PROVENANCES = ["library", "built"];
67979
68207
  function planSetProvenanceCommand(dir, name, provenance) {
67980
68208
  if (!PROVENANCES.includes(provenance)) {
67981
- console.error(chalk20.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68209
+ console.error(chalk21.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
67982
68210
  return 1;
67983
68211
  }
67984
68212
  const plan = loadPlan(dir);
67985
68213
  if (!plan) {
67986
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
68214
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
67987
68215
  return 1;
67988
68216
  }
67989
68217
  const component = setComponentProvenance(plan, name, provenance);
67990
68218
  if (!component) {
67991
- console.error(chalk20.red(`No component matching "${name}" in the plan`));
68219
+ console.error(chalk21.red(`No component matching "${name}" in the plan`));
67992
68220
  return 1;
67993
68221
  }
67994
68222
  savePlan(dir, plan);
67995
- console.log(`${chalk20.green("✓")} ${component.name} → ${provenance}`);
68223
+ console.log(`${chalk21.green("✓")} ${component.name} → ${provenance}`);
67996
68224
  return 0;
67997
68225
  }
67998
68226
  function planTouchCommand(dir, page, opts) {
67999
68227
  const plan = loadPlan(dir);
68000
68228
  if (!plan) {
68001
- console.error(chalk20.red(`No migration-plan.json found in ${dir}`));
68229
+ console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68002
68230
  return 1;
68003
68231
  }
68004
68232
  const count = recordTouch(plan, page);
@@ -68006,7 +68234,7 @@ function planTouchCommand(dir, page, opts) {
68006
68234
  if (opts.json) {
68007
68235
  console.log(JSON.stringify({ page, touches: count, total: totalTouches(plan) }));
68008
68236
  } else {
68009
- console.log(`${chalk20.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68237
+ console.log(`${chalk21.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68010
68238
  }
68011
68239
  return 0;
68012
68240
  }
@@ -68014,12 +68242,12 @@ function planTouchCommand(dir, page, opts) {
68014
68242
  // src/commands/pr.ts
68015
68243
  import { existsSync as existsSync22, readFileSync as readFileSync26, writeFileSync as writeFileSync26 } from "node:fs";
68016
68244
  import { join as join33 } from "node:path";
68017
- import chalk23 from "chalk";
68245
+ import chalk24 from "chalk";
68018
68246
 
68019
68247
  // src/commands/run.ts
68020
68248
  import { existsSync as existsSync21, readFileSync as readFileSync25, unlinkSync as unlinkSync3 } from "node:fs";
68021
68249
  import { join as join32 } from "node:path";
68022
- import chalk22 from "chalk";
68250
+ import chalk23 from "chalk";
68023
68251
  import ora8 from "ora";
68024
68252
 
68025
68253
  // src/diff/score-band.ts
@@ -68182,7 +68410,7 @@ async function aggregateIssues(input) {
68182
68410
  details: i.details
68183
68411
  }))
68184
68412
  }, null, 2);
68185
- const parsed = await callTool({
68413
+ const parsed = await callTool2({
68186
68414
  feature: "issue-aggregation",
68187
68415
  systemPrompt: ISSUE_AGGREGATOR_SYSTEM_PROMPT,
68188
68416
  userText: `Analise os resultados abaixo e produza issues priorizadas via report_issues.
@@ -68310,7 +68538,7 @@ function levenshtein(a, b) {
68310
68538
  return dp[n];
68311
68539
  }
68312
68540
  async function llmMatch(prod, cand) {
68313
- const input = await callTool({
68541
+ const input = await callTool2({
68314
68542
  feature: "pdp-matching",
68315
68543
  systemPrompt: "Você classifica se duas páginas de produto (PDPs) mostram o mesmo produto. 'same' = mesmo SKU/produto idêntico. 'similar' = variação (mesma família, cor diferente, embalagem diferente). 'different' = produtos distintos.",
68316
68544
  userText: `prod: ${JSON.stringify(prod)}
@@ -68608,7 +68836,7 @@ function formatMs(ms) {
68608
68836
 
68609
68837
  // src/commands/serve.ts
68610
68838
  import { existsSync as existsSync20 } from "node:fs";
68611
- import chalk21 from "chalk";
68839
+ import chalk22 from "chalk";
68612
68840
 
68613
68841
  // src/server/proxy-server.ts
68614
68842
  import { existsSync as existsSync19, readFileSync as readFileSync24, statSync as statSync2 } from "node:fs";
@@ -68881,16 +69109,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
68881
69109
  try {
68882
69110
  handle = await startProxyServer(runDir, { port: opts.port });
68883
69111
  } catch (err) {
68884
- console.error(chalk21.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69112
+ console.error(chalk22.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
68885
69113
  return 2;
68886
69114
  }
68887
69115
  const label = opts.label ?? "parity serve";
68888
69116
  console.log("");
68889
- console.log(chalk21.bold(` ${label}`));
68890
- console.log(` ${chalk21.green("●")} ${handle.url}`);
68891
- console.log(chalk21.dim(` Servindo: ${runDir}`));
68892
- console.log(chalk21.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
68893
- console.log(chalk21.dim(` Ctrl+C pra parar (2x pra forçar saída).
69117
+ console.log(chalk22.bold(` ${label}`));
69118
+ console.log(` ${chalk22.green("●")} ${handle.url}`);
69119
+ console.log(chalk22.dim(` Servindo: ${runDir}`));
69120
+ console.log(chalk22.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69121
+ console.log(chalk22.dim(` Ctrl+C pra parar (2x pra forçar saída).
68894
69122
  `));
68895
69123
  if (opts.open !== false) {
68896
69124
  const { default: open } = await import("open");
@@ -68923,11 +69151,11 @@ async function serveRunAndBlock(runDir, opts = {}) {
68923
69151
  async function serveCommand(runId, opts) {
68924
69152
  const paths = getRunPaths(opts.output, runId);
68925
69153
  if (!existsSync20(paths.runDir)) {
68926
- console.error(chalk21.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69154
+ console.error(chalk22.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
68927
69155
  return 1;
68928
69156
  }
68929
69157
  if (!existsSync20(paths.reportHtml)) {
68930
- console.error(chalk21.red(`✖ report.html não existe em ${paths.runDir}`));
69158
+ console.error(chalk22.red(`✖ report.html não existe em ${paths.runDir}`));
68931
69159
  return 1;
68932
69160
  }
68933
69161
  return serveRunAndBlock(paths.runDir, {
@@ -69086,14 +69314,14 @@ function readRunChecks(reportPath) {
69086
69314
  async function runCommand(rawOpts) {
69087
69315
  if (!rawOpts.prod) {
69088
69316
  const target = rawOpts.cand ?? "<url>";
69089
- console.error(`${chalk22.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69090
- For one site, use: ${chalk22.cyan(`parity e2e --url ${target}`)}
69317
+ console.error(`${chalk23.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69318
+ For one site, use: ${chalk23.cyan(`parity e2e --url ${target}`)}
69091
69319
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
69092
69320
  return 2;
69093
69321
  }
69094
69322
  let opts = applyPreset(rawOpts);
69095
69323
  if (rawOpts.preset) {
69096
- console.log(chalk22.dim(` preset: ${rawOpts.preset}`));
69324
+ console.log(chalk23.dim(` preset: ${rawOpts.preset}`));
69097
69325
  }
69098
69326
  if (opts.pt)
69099
69327
  setLlmLanguage("pt");
@@ -69101,14 +69329,14 @@ async function runCommand(rawOpts) {
69101
69329
  disableInteractive();
69102
69330
  const llmCfgErr = applyLlmOptions(opts);
69103
69331
  if (llmCfgErr) {
69104
- console.error(chalk22.red(` ${llmCfgErr}`));
69332
+ console.error(chalk23.red(` ${llmCfgErr}`));
69105
69333
  return 2;
69106
69334
  }
69107
69335
  const llmStillAvailable = isLlmAvailable();
69108
69336
  const preSmart = opts;
69109
69337
  opts = applySmartDefaults(opts, llmStillAvailable);
69110
69338
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
69111
- console.log(chalk22.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69339
+ console.log(chalk23.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69112
69340
  }
69113
69341
  let interactivePromptShown = false;
69114
69342
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -69134,14 +69362,14 @@ async function runCommand(rawOpts) {
69134
69362
  if (isContentProfile && !opts.only && !opts.skip) {
69135
69363
  opts.only = "seo,visual,vitals,cache,console,html,network";
69136
69364
  moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
69137
- console.log(chalk22.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69365
+ console.log(chalk23.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69138
69366
  }
69139
69367
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
69140
69368
  if (selection.errors.length > 0) {
69141
- console.error(chalk22.red(" --only/--skip: invalid value(s):"));
69369
+ console.error(chalk23.red(" --only/--skip: invalid value(s):"));
69142
69370
  for (const e of selection.errors)
69143
- console.error(chalk22.red(` - ${e}`));
69144
- console.error(chalk22.dim(`
69371
+ console.error(chalk23.red(` - ${e}`));
69372
+ console.error(chalk23.dim(`
69145
69373
  valid modules: ${Object.keys(MODULES).join(", ")}`));
69146
69374
  return 2;
69147
69375
  }
@@ -69153,14 +69381,14 @@ async function runCommand(rawOpts) {
69153
69381
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
69154
69382
  const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
69155
69383
  flows = scoped.flows;
69156
- console.log(chalk22.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69384
+ console.log(chalk23.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69157
69385
  if (scoped.starved.length > 0) {
69158
- console.log(chalk22.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69386
+ console.log(chalk23.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69159
69387
  }
69160
69388
  } else {
69161
69389
  flows = opts.flows.split(",").map((s) => s.trim());
69162
69390
  if (!interactivePromptShown) {
69163
- console.log(chalk22.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69391
+ console.log(chalk23.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69164
69392
  }
69165
69393
  }
69166
69394
  if (isContentProfile) {
@@ -69169,12 +69397,12 @@ async function runCommand(rawOpts) {
69169
69397
  if (!flows.includes("homepage"))
69170
69398
  flows.unshift("homepage");
69171
69399
  if (before !== flows.join(",")) {
69172
- console.log(chalk22.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69400
+ console.log(chalk23.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69173
69401
  }
69174
69402
  }
69175
69403
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
69176
69404
  if (pagesScopeWarning) {
69177
- console.log(chalk22.dim(` ${pagesScopeWarning}`));
69405
+ console.log(chalk23.dim(` ${pagesScopeWarning}`));
69178
69406
  }
69179
69407
  if (hasSelection) {
69180
69408
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -69183,12 +69411,12 @@ async function runCommand(rawOpts) {
69183
69411
  const VISUAL_PAGES_DEFAULT = 5;
69184
69412
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
69185
69413
  opts.vitalsPages = 0;
69186
- console.log(chalk22.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69414
+ console.log(chalk23.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69187
69415
  }
69188
69416
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
69189
69417
  opts.visualPages = 0;
69190
69418
  opts.noVisualDiff = true;
69191
- console.log(chalk22.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69419
+ console.log(chalk23.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69192
69420
  }
69193
69421
  }
69194
69422
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -69205,34 +69433,34 @@ async function runCommand(rawOpts) {
69205
69433
  if (existsSync21(cacheFile)) {
69206
69434
  try {
69207
69435
  unlinkSync3(cacheFile);
69208
- console.log(chalk22.dim(` cache wiped: ${cacheFile}`));
69436
+ console.log(chalk23.dim(` cache wiped: ${cacheFile}`));
69209
69437
  } catch (err) {
69210
- console.log(chalk22.yellow(` cache wipe falhou: ${err.message}`));
69438
+ console.log(chalk23.yellow(` cache wipe falhou: ${err.message}`));
69211
69439
  }
69212
69440
  }
69213
69441
  }
69214
69442
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
69215
69443
  if (!Number.isFinite(llmTimeoutRaw)) {
69216
- console.error(chalk22.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69444
+ console.error(chalk23.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69217
69445
  return 2;
69218
69446
  }
69219
69447
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
69220
69448
  if (isLlmAvailable()) {
69221
- console.log(chalk22.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69449
+ console.log(chalk23.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69222
69450
  } else {
69223
- console.log(chalk22.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69451
+ console.log(chalk23.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69224
69452
  }
69225
69453
  if (isInteractiveMode()) {
69226
- console.log(chalk22.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69454
+ console.log(chalk23.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69227
69455
  }
69228
69456
  const primaryViewport = viewports[0] ?? "mobile";
69229
69457
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
69230
69458
  if (!preflight.ok) {
69231
- console.error(chalk22.red(`
69459
+ console.error(chalk23.red(`
69232
69460
  ✖ pre-flight falhou:`));
69233
69461
  for (const err of preflight.errors)
69234
- console.error(chalk22.red(` - ${err}`));
69235
- console.error(chalk22.dim(`
69462
+ console.error(chalk23.red(` - ${err}`));
69463
+ console.error(chalk23.dim(`
69236
69464
  dica: verifique se as URLs estão corretas e acessíveis`));
69237
69465
  return 2;
69238
69466
  }
@@ -69243,7 +69471,7 @@ async function runCommand(rawOpts) {
69243
69471
  if (prodHomeHtml) {
69244
69472
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
69245
69473
  if (platform !== "custom") {
69246
- console.log(chalk22.dim(` Detected platform: ${platform}`));
69474
+ console.log(chalk23.dim(` Detected platform: ${platform}`));
69247
69475
  }
69248
69476
  }
69249
69477
  const prodHost = hostOf3(opts.prod);
@@ -69278,11 +69506,11 @@ async function runCommand(rawOpts) {
69278
69506
  viewports,
69279
69507
  timestamp
69280
69508
  });
69281
- console.log(chalk22.bold(`
69509
+ console.log(chalk23.bold(`
69282
69510
  parity run ${runId}`));
69283
- console.log(chalk22.dim(` prod: ${opts.prod}`));
69284
- console.log(chalk22.dim(` cand: ${opts.cand}`));
69285
- console.log(chalk22.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69511
+ console.log(chalk23.dim(` prod: ${opts.prod}`));
69512
+ console.log(chalk23.dim(` cand: ${opts.cand}`));
69513
+ console.log(chalk23.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69286
69514
  `));
69287
69515
  const spinner = ora8("Launching browser…").start();
69288
69516
  let browser = null;
@@ -69294,7 +69522,7 @@ async function runCommand(rawOpts) {
69294
69522
  const min = Math.floor(elapsedSec / 60);
69295
69523
  const sec = elapsedSec % 60;
69296
69524
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
69297
- spinner.text = `${chalk22.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69525
+ spinner.text = `${chalk23.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69298
69526
  };
69299
69527
  const setSpinnerLabel = (label) => {
69300
69528
  currentSpinnerLabel = label;
@@ -69414,8 +69642,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69414
69642
  for (const flow of flows) {
69415
69643
  const flowStart = Date.now();
69416
69644
  let lastStepTotal = 0;
69417
- const sideTag = side === "prod" ? chalk22.cyan("prod") : chalk22.magenta("cand");
69418
- const prefix = `${chalk22.dim(`[${viewport}/`)}${sideTag}${chalk22.dim("]")}`;
69645
+ const sideTag = side === "prod" ? chalk23.cyan("prod") : chalk23.magenta("cand");
69646
+ const prefix = `${chalk23.dim(`[${viewport}/`)}${sideTag}${chalk23.dim("]")}`;
69419
69647
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
69420
69648
  const cap = await runFlow(flow, {
69421
69649
  baseUrl,
@@ -69432,7 +69660,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69432
69660
  onStep: (event) => {
69433
69661
  if (event.phase === "start") {
69434
69662
  lastStepTotal = event.total;
69435
- setSpinnerLabel(`${prefix} ${flow} ${chalk22.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69663
+ setSpinnerLabel(`${prefix} ${flow} ${chalk23.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69436
69664
  }
69437
69665
  }
69438
69666
  });
@@ -69441,18 +69669,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69441
69669
  const target = lastStepTotal || recorded;
69442
69670
  const failed = cap.steps?.find((s) => s.status === "failed");
69443
69671
  const lastStep = cap.steps?.[cap.steps.length - 1];
69444
- const elapsedDim = chalk22.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69445
- const counts = target > 0 ? chalk22.dim(`${okSteps}/${target}`) : "";
69672
+ const elapsedDim = chalk23.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69673
+ const counts = target > 0 ? chalk23.dim(`${okSteps}/${target}`) : "";
69446
69674
  let glyph;
69447
69675
  let detail;
69448
69676
  if (failed) {
69449
- glyph = chalk22.red("✗");
69450
- detail = `stopped at ${chalk22.yellow(failed.name)}`;
69677
+ glyph = chalk23.red("✗");
69678
+ detail = `stopped at ${chalk23.yellow(failed.name)}`;
69451
69679
  } else if (target > 0 && okSteps < target) {
69452
- glyph = chalk22.yellow("▴");
69453
- detail = lastStep ? `ended at ${chalk22.dim(lastStep.name)}` : "incomplete";
69680
+ glyph = chalk23.yellow("▴");
69681
+ detail = lastStep ? `ended at ${chalk23.dim(lastStep.name)}` : "incomplete";
69454
69682
  } else {
69455
- glyph = chalk22.green("✓");
69683
+ glyph = chalk23.green("✓");
69456
69684
  detail = "";
69457
69685
  }
69458
69686
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -69514,7 +69742,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69514
69742
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
69515
69743
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
69516
69744
  if (candIsDevServer && vitalsPagesLimit > 0) {
69517
- console.log(chalk22.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69745
+ console.log(chalk23.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69518
69746
  }
69519
69747
  if (browser && vitalsPagesLimit > 0) {
69520
69748
  currentPhase = "vitals-pages";
@@ -69866,7 +70094,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69866
70094
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
69867
70095
  const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
69868
70096
  if (failOnGate.exitCode === 1) {
69869
- console.log(chalk22.red(failOnGate.message));
70097
+ console.log(chalk23.red(failOnGate.message));
69870
70098
  return 1;
69871
70099
  }
69872
70100
  if (opts.open) {
@@ -70093,60 +70321,60 @@ function hostOf3(url) {
70093
70321
  function printSummary7(run, htmlPath, meta) {
70094
70322
  const { verdict } = run;
70095
70323
  const inconclusive = verdict.status === "inconclusive";
70096
- const emoji = inconclusive ? chalk22.dim("○") : verdict.status === "pass" ? chalk22.green("✔") : verdict.status === "warn" ? chalk22.yellow("⚠") : chalk22.red("✖");
70097
- const score = inconclusive ? chalk22.dim("—") : verdict.status === "pass" ? chalk22.green(verdict.score) : verdict.status === "warn" ? chalk22.yellow(verdict.score) : chalk22.red(verdict.score);
70324
+ const emoji = inconclusive ? chalk23.dim("○") : verdict.status === "pass" ? chalk23.green("✔") : verdict.status === "warn" ? chalk23.yellow("⚠") : chalk23.red("✖");
70325
+ const score = inconclusive ? chalk23.dim("—") : verdict.status === "pass" ? chalk23.green(verdict.score) : verdict.status === "warn" ? chalk23.yellow(verdict.score) : chalk23.red(verdict.score);
70098
70326
  const prev = run.previousRun;
70099
- const scoreDelta = !prev ? chalk22.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk22.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk22.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk22.dim(` (= run anterior: ${prev.score})`);
70327
+ const scoreDelta = !prev ? chalk23.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk23.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk23.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk23.dim(` (= run anterior: ${prev.score})`);
70100
70328
  console.log("");
70101
70329
  if (inconclusive) {
70102
70330
  console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
70103
70331
  } else {
70104
70332
  console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
70105
70333
  }
70106
- console.log(` checks: ${chalk22.green(verdict.checksPassed)} pass · ${chalk22.red(verdict.checksFailed)} fail · ${chalk22.dim(`${verdict.checksSkipped} skipped`)}`);
70107
- console.log(` issues: ${chalk22.red(verdict.critical)} critical · ${chalk22.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk22.dim(`${verdict.low} low`)}`);
70334
+ console.log(` checks: ${chalk23.green(verdict.checksPassed)} pass · ${chalk23.red(verdict.checksFailed)} fail · ${chalk23.dim(`${verdict.checksSkipped} skipped`)}`);
70335
+ console.log(` issues: ${chalk23.red(verdict.critical)} critical · ${chalk23.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk23.dim(`${verdict.low} low`)}`);
70108
70336
  const band = run.scoreBand;
70109
70337
  const bandLine = band ? formatScoreBand(band) : null;
70110
70338
  if (band && bandLine) {
70111
- console.log(` ${chalk22.dim(bandLine)}`);
70339
+ console.log(` ${chalk23.dim(bandLine)}`);
70112
70340
  const caveat = scoreBandCaveat(band);
70113
70341
  if (caveat)
70114
- console.log(` ${chalk22.yellow("⚠")} ${caveat}`);
70342
+ console.log(` ${chalk23.yellow("⚠")} ${caveat}`);
70115
70343
  }
70116
70344
  for (const c of run.caveats ?? []) {
70117
- const mark = c.level === "warn" ? chalk22.yellow("⚠") : chalk22.dim("ℹ");
70345
+ const mark = c.level === "warn" ? chalk23.yellow("⚠") : chalk23.dim("ℹ");
70118
70346
  console.log(` ${mark} ${c.summary}`);
70119
70347
  }
70120
70348
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
70121
70349
  const perModule = run.moduleVerdicts.map((mv) => {
70122
- const colored = mv.status === "pass" ? chalk22.green(mv.score) : mv.status === "warn" ? chalk22.yellow(mv.score) : chalk22.red(mv.score);
70350
+ const colored = mv.status === "pass" ? chalk23.green(mv.score) : mv.status === "warn" ? chalk23.yellow(mv.score) : chalk23.red(mv.score);
70123
70351
  return `${mv.module} ${colored}`;
70124
70352
  }).join(" · ");
70125
70353
  console.log(` modules: ${perModule} → composite ${score}`);
70126
70354
  }
70127
70355
  if (run.visualDiff) {
70128
70356
  const vd = run.visualDiff;
70129
- const parityIcon = vd.parityOk ? chalk22.green("✔") : chalk22.red("✖");
70130
- const parityLabel = vd.parityOk ? chalk22.green("OK") : chalk22.red("DIFFS");
70131
- const cacheNote = vd.pagesFromCache > 0 ? chalk22.dim(` · ${vd.pagesFromCache} cached`) : "";
70132
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk22.red(vd.pagesWithDiffs)} diffs · ${chalk22.green(vd.pagesPassed)} pass${cacheNote}`);
70357
+ const parityIcon = vd.parityOk ? chalk23.green("✔") : chalk23.red("✖");
70358
+ const parityLabel = vd.parityOk ? chalk23.green("OK") : chalk23.red("DIFFS");
70359
+ const cacheNote = vd.pagesFromCache > 0 ? chalk23.dim(` · ${vd.pagesFromCache} cached`) : "";
70360
+ console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk23.red(vd.pagesWithDiffs)} diffs · ${chalk23.green(vd.pagesPassed)} pass${cacheNote}`);
70133
70361
  }
70134
70362
  if (run.topIssues.length > 0) {
70135
70363
  console.log("");
70136
- console.log(chalk22.bold(" Top issues:"));
70364
+ console.log(chalk23.bold(" Top issues:"));
70137
70365
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
70138
70366
  const i = g.sample;
70139
- const sev = i.severity === "critical" ? chalk22.red(`[${i.severity}]`) : i.severity === "high" ? chalk22.yellow(`[${i.severity}]`) : chalk22.dim(`[${i.severity}]`);
70140
- const pagesNote = g.pages.length > 1 ? chalk22.dim(` (${g.pages.length} páginas)`) : "";
70367
+ const sev = i.severity === "critical" ? chalk23.red(`[${i.severity}]`) : i.severity === "high" ? chalk23.yellow(`[${i.severity}]`) : chalk23.dim(`[${i.severity}]`);
70368
+ const pagesNote = g.pages.length > 1 ? chalk23.dim(` (${g.pages.length} páginas)`) : "";
70141
70369
  console.log(` ${sev} ${i.summary}${pagesNote}`);
70142
70370
  }
70143
70371
  }
70144
70372
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
70145
70373
  console.log("");
70146
- console.log(chalk22.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk22.green(`+${meta.promotedCount}`)} promoted · ${chalk22.yellow(meta.deprecatedCount)} deprecated`));
70374
+ console.log(chalk23.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk23.green(`+${meta.promotedCount}`)} promoted · ${chalk23.yellow(meta.deprecatedCount)} deprecated`));
70147
70375
  }
70148
70376
  console.log("");
70149
- console.log(chalk22.dim(` → ${htmlPath}`));
70377
+ console.log(chalk23.dim(` → ${htmlPath}`));
70150
70378
  console.log("");
70151
70379
  }
70152
70380
 
@@ -70170,26 +70398,26 @@ async function prCommand(opts) {
70170
70398
  preset: opts.preset ?? "ci",
70171
70399
  open: false
70172
70400
  };
70173
- console.log(chalk23.dim(` prod : ${opts.prod}`));
70174
- console.log(chalk23.dim(` preview : ${opts.preview}`));
70401
+ console.log(chalk24.dim(` prod : ${opts.prod}`));
70402
+ console.log(chalk24.dim(` preview : ${opts.preview}`));
70175
70403
  console.log("");
70176
70404
  const runCode = await runCommand(runOpts);
70177
70405
  const runs = listRuns(opts.output);
70178
70406
  if (runs.length === 0) {
70179
- console.error(chalk23.red("no run was produced — cannot build PR comment"));
70407
+ console.error(chalk24.red("no run was produced — cannot build PR comment"));
70180
70408
  return runCode || 1;
70181
70409
  }
70182
70410
  const latest = runs[0];
70183
70411
  const reportJsonPath = join33(opts.output, "runs", latest.id, "report.json");
70184
70412
  if (!existsSync22(reportJsonPath)) {
70185
- console.error(chalk23.red(`report.json not found at ${reportJsonPath}`));
70413
+ console.error(chalk24.red(`report.json not found at ${reportJsonPath}`));
70186
70414
  return runCode || 1;
70187
70415
  }
70188
70416
  const run = JSON.parse(readFileSync26(reportJsonPath, "utf8"));
70189
70417
  const markdown = buildPrComment(run, opts);
70190
70418
  if (opts.out) {
70191
70419
  writeFileSync26(opts.out, markdown, "utf8");
70192
- console.log(chalk23.dim(` wrote PR comment: ${opts.out}`));
70420
+ console.log(chalk24.dim(` wrote PR comment: ${opts.out}`));
70193
70421
  } else {
70194
70422
  process.stdout.write(`
70195
70423
  ${markdown}
@@ -70199,7 +70427,7 @@ ${markdown}
70199
70427
  try {
70200
70428
  writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
70201
70429
  } catch (err) {
70202
- console.error(chalk23.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70430
+ console.error(chalk24.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70203
70431
  }
70204
70432
  }
70205
70433
  return runCode;
@@ -70260,13 +70488,13 @@ function buildPrComment(run, opts) {
70260
70488
 
70261
70489
  // src/commands/prompt.ts
70262
70490
  import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
70263
- import chalk24 from "chalk";
70491
+ import chalk25 from "chalk";
70264
70492
  function promptCommand(runId, opts) {
70265
70493
  let run;
70266
70494
  try {
70267
70495
  run = loadRun(opts.output, runId);
70268
70496
  } catch (err) {
70269
- console.error(chalk24.red(`✖ ${err.message}`));
70497
+ console.error(chalk25.red(`✖ ${err.message}`));
70270
70498
  return 1;
70271
70499
  }
70272
70500
  const md = buildLlmPrompt(run, {
@@ -70275,10 +70503,10 @@ function promptCommand(runId, opts) {
70275
70503
  });
70276
70504
  if (opts.out) {
70277
70505
  writeFileSync27(opts.out, md, "utf8");
70278
- console.log(chalk24.green(`✔ prompt salvo em ${opts.out}`));
70506
+ console.log(chalk25.green(`✔ prompt salvo em ${opts.out}`));
70279
70507
  if (existsSync23(opts.out)) {
70280
70508
  const sizeKb = (md.length / 1024).toFixed(1);
70281
- console.log(chalk24.dim(` ${md.length} chars (${sizeKb} KB)`));
70509
+ console.log(chalk25.dim(` ${md.length} chars (${sizeKb} KB)`));
70282
70510
  }
70283
70511
  } else {
70284
70512
  process.stdout.write(md);
@@ -70289,7 +70517,7 @@ function promptCommand(runId, opts) {
70289
70517
  // src/commands/report.ts
70290
70518
  import { existsSync as existsSync24, readFileSync as readFileSync27, writeFileSync as writeFileSync28 } from "node:fs";
70291
70519
  import { join as join34 } from "node:path";
70292
- import chalk25 from "chalk";
70520
+ import chalk26 from "chalk";
70293
70521
  import open2 from "open";
70294
70522
 
70295
70523
  // src/report/deck-template.ts
@@ -70881,24 +71109,24 @@ async function reportCommand(runId, opts) {
70881
71109
  try {
70882
71110
  run = loadRun(opts.output, runId);
70883
71111
  } catch (err) {
70884
- console.error(chalk25.red(`failed to load run: ${err.message}`));
71112
+ console.error(chalk26.red(`failed to load run: ${err.message}`));
70885
71113
  return 1;
70886
71114
  }
70887
71115
  const html = renderDeckHtml(buildDeckModel(run), opts.lang ?? "en");
70888
71116
  const dest = opts.out ?? join34(paths.runDir, "deck.html");
70889
71117
  writeFileSync28(dest, html, "utf8");
70890
- console.log(`${chalk25.green("✓")} deck → ${dest}`);
71118
+ console.log(`${chalk26.green("✓")} deck → ${dest}`);
70891
71119
  if (opts.open) {
70892
71120
  await open2(dest).catch((err) => {
70893
- console.error(chalk25.red(`failed to open: ${err.message}`));
71121
+ console.error(chalk26.red(`failed to open: ${err.message}`));
70894
71122
  });
70895
71123
  }
70896
71124
  return 0;
70897
71125
  }
70898
71126
  if (opts.section) {
70899
71127
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
70900
- console.error(chalk25.red(`unknown section "${opts.section}"`));
70901
- console.error(chalk25.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71128
+ console.error(chalk26.red(`unknown section "${opts.section}"`));
71129
+ console.error(chalk26.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
70902
71130
  return 1;
70903
71131
  }
70904
71132
  if (opts.json) {
@@ -70906,40 +71134,40 @@ async function reportCommand(runId, opts) {
70906
71134
  const run = loadRun(opts.output, runId);
70907
71135
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
70908
71136
  if (payload === null) {
70909
- console.error(chalk25.red(`section "${opts.section}" not present in this run`));
71137
+ console.error(chalk26.red(`section "${opts.section}" not present in this run`));
70910
71138
  return 1;
70911
71139
  }
70912
71140
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
70913
71141
  `);
70914
71142
  return 0;
70915
71143
  } catch (err) {
70916
- console.error(chalk25.red(`failed to load run: ${err.message}`));
71144
+ console.error(chalk26.red(`failed to load run: ${err.message}`));
70917
71145
  return 1;
70918
71146
  }
70919
71147
  }
70920
71148
  if (!existsSync24(paths.reportHtml)) {
70921
- console.error(chalk25.red(`report.html not found at ${paths.reportHtml}`));
71149
+ console.error(chalk26.red(`report.html not found at ${paths.reportHtml}`));
70922
71150
  return 1;
70923
71151
  }
70924
71152
  const html = readFileSync27(paths.reportHtml, "utf8");
70925
71153
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
70926
71154
  if (slice === null) {
70927
- console.error(chalk25.red(`section "${opts.section}" not present in this report`));
71155
+ console.error(chalk26.red(`section "${opts.section}" not present in this report`));
70928
71156
  return 1;
70929
71157
  }
70930
71158
  process.stdout.write(slice);
70931
71159
  return 0;
70932
71160
  }
70933
- console.log(chalk25.dim(`opening ${paths.reportHtml}`));
71161
+ console.log(chalk26.dim(`opening ${paths.reportHtml}`));
70934
71162
  await open2(paths.reportHtml).catch((err) => {
70935
- console.error(chalk25.red(`failed to open: ${err.message}`));
71163
+ console.error(chalk26.red(`failed to open: ${err.message}`));
70936
71164
  });
70937
71165
  return 0;
70938
71166
  }
70939
71167
 
70940
71168
  // src/commands/event.ts
70941
71169
  import { resolve as resolve8 } from "node:path";
70942
- import chalk26 from "chalk";
71170
+ import chalk27 from "chalk";
70943
71171
 
70944
71172
  // src/events.ts
70945
71173
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
@@ -70963,24 +71191,24 @@ function eventCommand(type, opts) {
70963
71191
  if (parsed && typeof parsed === "object")
70964
71192
  data = parsed;
70965
71193
  else {
70966
- console.error(chalk26.red("--data must be a JSON object"));
71194
+ console.error(chalk27.red("--data must be a JSON object"));
70967
71195
  return 1;
70968
71196
  }
70969
71197
  } catch {
70970
- console.error(chalk26.red(`--data is not valid JSON: ${opts.data}`));
71198
+ console.error(chalk27.red(`--data is not valid JSON: ${opts.data}`));
70971
71199
  return 1;
70972
71200
  }
70973
71201
  }
70974
71202
  const dir = resolve8(opts.dir);
70975
71203
  emitEvent(dir, type, data);
70976
- console.log(`${chalk26.green("✓")} ${type} → ${dir}/events.jsonl`);
71204
+ console.log(`${chalk27.green("✓")} ${type} → ${dir}/events.jsonl`);
70977
71205
  return 0;
70978
71206
  }
70979
71207
 
70980
71208
  // src/commands/bench.ts
70981
71209
  import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync28, writeFileSync as writeFileSync29 } from "node:fs";
70982
71210
  import { resolve as resolve9 } from "node:path";
70983
- import chalk27 from "chalk";
71211
+ import chalk28 from "chalk";
70984
71212
 
70985
71213
  // src/diff/motion.ts
70986
71214
  var WEIGHT = {
@@ -71408,20 +71636,20 @@ async function gatherBenchSide(browser, opts) {
71408
71636
  async function benchCommand(opts) {
71409
71637
  const viewport = parseViewport3(opts.viewport);
71410
71638
  if (!viewport) {
71411
- console.error(chalk27.red(`--viewport inválido: ${opts.viewport}`));
71639
+ console.error(chalk28.red(`--viewport inválido: ${opts.viewport}`));
71412
71640
  return 2;
71413
71641
  }
71414
71642
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
71415
71643
  let props;
71416
71644
  if (opts.props) {
71417
71645
  if (!existsSync25(opts.props)) {
71418
- console.error(chalk27.red(`--props não encontrado: ${opts.props}`));
71646
+ console.error(chalk28.red(`--props não encontrado: ${opts.props}`));
71419
71647
  return 2;
71420
71648
  }
71421
71649
  try {
71422
71650
  props = JSON.parse(readFileSync28(opts.props, "utf8"));
71423
71651
  } catch (err) {
71424
- console.error(chalk27.red(`--props não é JSON válido: ${err.message}`));
71652
+ console.error(chalk28.red(`--props não é JSON válido: ${err.message}`));
71425
71653
  return 2;
71426
71654
  }
71427
71655
  }
@@ -71436,7 +71664,7 @@ async function benchCommand(opts) {
71436
71664
  const prefix = `bench-${slug}-${viewport}`;
71437
71665
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
71438
71666
  if (aliasNote)
71439
- console.log(chalk27.dim(` ${aliasNote}`));
71667
+ console.log(chalk28.dim(` ${aliasNote}`));
71440
71668
  const browser = await launchBrowser({ headless: true });
71441
71669
  try {
71442
71670
  const [prodSide, candSide] = await Promise.all([
@@ -71461,7 +71689,7 @@ async function benchCommand(opts) {
71461
71689
  if (opts.json)
71462
71690
  console.log(JSON.stringify(payload));
71463
71691
  else
71464
- console.error(chalk27.red(` bench falhou — ${readErr}`));
71692
+ console.error(chalk28.red(` bench falhou — ${readErr}`));
71465
71693
  return 2;
71466
71694
  }
71467
71695
  const geometry = diffBoxTrees(prodSide.boxNodes.nodes, candSide.boxNodes.nodes, {
@@ -71491,9 +71719,9 @@ async function benchCommand(opts) {
71491
71719
  console.log(JSON.stringify(result));
71492
71720
  } else {
71493
71721
  console.log("");
71494
- console.log(chalk27.bold(` ${opts.component} — isolated (${viewport})`));
71495
- console.log(chalk27.dim(` prod ${prodUrl}`));
71496
- console.log(chalk27.dim(` cand ${candUrl}`));
71722
+ console.log(chalk28.bold(` ${opts.component} — isolated (${viewport})`));
71723
+ console.log(chalk28.dim(` prod ${prodUrl}`));
71724
+ console.log(chalk28.dim(` cand ${candUrl}`));
71497
71725
  console.log("");
71498
71726
  for (const line of formatBoxTreeDiff(geometry).split(`
71499
71727
  `))
@@ -71504,7 +71732,7 @@ async function benchCommand(opts) {
71504
71732
  ]) {
71505
71733
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
71506
71734
  if (caveat)
71507
- console.log(chalk27.yellow(` ${caveat}`));
71735
+ console.log(chalk28.yellow(` ${caveat}`));
71508
71736
  }
71509
71737
  if (motion) {
71510
71738
  console.log("");
@@ -71513,7 +71741,7 @@ async function benchCommand(opts) {
71513
71741
  console.log(` ${line}`);
71514
71742
  }
71515
71743
  console.log("");
71516
- console.log(chalk27.dim(` ${resultPath}`));
71744
+ console.log(chalk28.dim(` ${resultPath}`));
71517
71745
  }
71518
71746
  return clean || !opts.failOnDiff ? 0 : 1;
71519
71747
  } finally {
@@ -71524,7 +71752,7 @@ async function benchCommand(opts) {
71524
71752
  }
71525
71753
 
71526
71754
  // src/commands/locate.ts
71527
- import chalk28 from "chalk";
71755
+ import chalk29 from "chalk";
71528
71756
  var hitOf = (n, nodes) => ({
71529
71757
  key: n.key,
71530
71758
  label: n.label,
@@ -71649,22 +71877,22 @@ function printResult3(r) {
71649
71877
  const side = (name, a) => {
71650
71878
  if (a.found) {
71651
71879
  console.log(` ${name.padEnd(5)} ${a.hit.tag.padEnd(8)} ${formatHit(a.hit)}`);
71652
- console.log(chalk28.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
71880
+ console.log(chalk29.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
71653
71881
  return;
71654
71882
  }
71655
- console.log(chalk28.yellow(` ${name.padEnd(5)} ${a.reason}`));
71883
+ console.log(chalk29.yellow(` ${name.padEnd(5)} ${a.reason}`));
71656
71884
  for (const c of a.candidates ?? [])
71657
- console.log(chalk28.dim(` candidate: ${c}`));
71885
+ console.log(chalk29.dim(` candidate: ${c}`));
71658
71886
  };
71659
71887
  console.log("");
71660
- console.log(chalk28.bold(` ${r.label} — ${r.viewport}`));
71888
+ console.log(chalk29.bold(` ${r.label} — ${r.viewport}`));
71661
71889
  side("prod", r.prod);
71662
71890
  side("cand", r.cand);
71663
71891
  if (r.prod.found && r.cand.found) {
71664
71892
  const delta = formatDelta(r.prod.hit, r.cand.hit);
71665
71893
  console.log(` ${"diff".padEnd(5)} ${delta ?? "identical box and type"}`);
71666
71894
  for (const note of pairingNotes(r.prod.hit, r.cand.hit)) {
71667
- console.log(chalk28.yellow(` note ${note}`));
71895
+ console.log(chalk29.yellow(` note ${note}`));
71668
71896
  }
71669
71897
  }
71670
71898
  }
@@ -71672,22 +71900,22 @@ async function locateCommand(opts) {
71672
71900
  const selector = opts.selector ?? "body";
71673
71901
  const waitMs = Number.parseInt(opts.wait, 10);
71674
71902
  if (!Number.isFinite(waitMs) || waitMs < 0) {
71675
- console.error(chalk28.red(`--wait inválido: ${opts.wait}`));
71903
+ console.error(chalk29.red(`--wait inválido: ${opts.wait}`));
71676
71904
  return 2;
71677
71905
  }
71678
71906
  if (opts.labels.length === 0) {
71679
- console.error(chalk28.red("nenhum --label passado — o comando procura por label, não por seletor"));
71907
+ console.error(chalk29.red("nenhum --label passado — o comando procura por label, não por seletor"));
71680
71908
  return 2;
71681
71909
  }
71682
71910
  const viewports = opts.viewports.split(",").map((v) => v.trim());
71683
71911
  const bad = viewports.find((v) => parseViewport3(v) === null);
71684
71912
  if (bad) {
71685
- console.error(chalk28.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
71913
+ console.error(chalk29.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
71686
71914
  return 2;
71687
71915
  }
71688
71916
  const { aliases, note } = resolveAliases(opts.planDir);
71689
71917
  if (note && !opts.json)
71690
- console.log(chalk28.dim(` ${note}`));
71918
+ console.log(chalk29.dim(` ${note}`));
71691
71919
  const results = [];
71692
71920
  const caveats = [];
71693
71921
  const browser = await launchBrowser({ headless: true });
@@ -71742,19 +71970,19 @@ async function locateCommand(opts) {
71742
71970
  for (const r of results)
71743
71971
  printResult3(r);
71744
71972
  for (const c of caveats)
71745
- console.log(chalk28.yellow(` ${c}`));
71973
+ console.log(chalk29.yellow(` ${c}`));
71746
71974
  console.log("");
71747
71975
  if (unresolved.length > 0) {
71748
- console.log(chalk28.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
71976
+ console.log(chalk29.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
71749
71977
  } else {
71750
- console.log(chalk28.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
71978
+ console.log(chalk29.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
71751
71979
  }
71752
71980
  return unresolved.length > 0 ? 1 : 0;
71753
71981
  }
71754
71982
 
71755
71983
  // src/commands/cockpit.ts
71756
71984
  import { resolve as resolve14 } from "node:path";
71757
- import chalk29 from "chalk";
71985
+ import chalk30 from "chalk";
71758
71986
 
71759
71987
  // src/server/cockpit.ts
71760
71988
  import { readFileSync as readFileSync33 } from "node:fs";
@@ -71767,7 +71995,7 @@ import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as r
71767
71995
  import { join as join37, resolve as resolve11 } from "node:path";
71768
71996
 
71769
71997
  // src/server/cockpit-settings.ts
71770
- import { execFileSync } from "node:child_process";
71998
+ import { execFileSync as execFileSync2 } from "node:child_process";
71771
71999
  import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync29, writeFileSync as writeFileSync30 } from "node:fs";
71772
72000
  import { homedir as homedir2 } from "node:os";
71773
72001
  import { join as join36, resolve as resolve10 } from "node:path";
@@ -71802,7 +72030,7 @@ function saveSettings(planDir, next) {
71802
72030
  }
71803
72031
  var run = (cmd, args, env) => {
71804
72032
  try {
71805
- return execFileSync(cmd, args, {
72033
+ return execFileSync2(cmd, args, {
71806
72034
  encoding: "utf8",
71807
72035
  timeout: 20000,
71808
72036
  stdio: ["ignore", "pipe", "pipe"],
@@ -72792,7 +73020,7 @@ async function loadRun() {
72792
73020
  `;
72793
73021
 
72794
73022
  // src/server/cockpit-tasks.ts
72795
- import { execFileSync as execFileSync2, spawn as spawn4 } from "node:child_process";
73023
+ import { execFileSync as execFileSync3, spawn as spawn4 } from "node:child_process";
72796
73024
  import { randomUUID } from "node:crypto";
72797
73025
  import {
72798
73026
  appendFileSync as appendFileSync2,
@@ -73101,7 +73329,7 @@ function prompt(task, planDir, dir) {
73101
73329
  }
73102
73330
  function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73103
73331
  const repo = targetDir(planDir);
73104
- const git = (...a) => execFileSync2("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 90000 }).trim();
73332
+ const git = (...a) => execFileSync3("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 90000 }).trim();
73105
73333
  try {
73106
73334
  try {
73107
73335
  git("fetch", "origin", "--quiet");
@@ -73120,7 +73348,7 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73120
73348
  const locks = ["package.json", "yarn.lock", "bun.lock", "package-lock.json", "pnpm-lock.yaml"];
73121
73349
  const sameDeps = (() => {
73122
73350
  try {
73123
- execFileSync2("git", ["-C", repo, "diff", "--quiet", "HEAD", sha, "--", ...locks], {
73351
+ execFileSync3("git", ["-C", repo, "diff", "--quiet", "HEAD", sha, "--", ...locks], {
73124
73352
  timeout: 1e4
73125
73353
  });
73126
73354
  return true;
@@ -73273,7 +73501,7 @@ function taskProcesses(worktree) {
73273
73501
  return hit.list;
73274
73502
  const pids = [];
73275
73503
  try {
73276
- const out = execFileSync2("lsof", ["-d", "cwd", "-Fpn"], {
73504
+ const out = execFileSync3("lsof", ["-d", "cwd", "-Fpn"], {
73277
73505
  encoding: "utf8",
73278
73506
  timeout: 5000,
73279
73507
  maxBuffer: 33554432
@@ -73290,7 +73518,7 @@ function taskProcesses(worktree) {
73290
73518
  const list = [];
73291
73519
  for (const pid of [...new Set(pids)]) {
73292
73520
  try {
73293
- const [rss, ...cmd] = execFileSync2("ps", ["-o", "rss=,command=", "-p", String(pid)], {
73521
+ const [rss, ...cmd] = execFileSync3("ps", ["-o", "rss=,command=", "-p", String(pid)], {
73294
73522
  encoding: "utf8"
73295
73523
  }).trim().split(/\s+/);
73296
73524
  list.push({
@@ -73388,7 +73616,7 @@ function prPlan(planDir, id, baseOverride) {
73388
73616
  const cut = task.base?.sha ?? null;
73389
73617
  const git = (...a) => {
73390
73618
  try {
73391
- return execFileSync2("git", ["-C", task.worktree, ...a], {
73619
+ return execFileSync3("git", ["-C", task.worktree, ...a], {
73392
73620
  encoding: "utf8",
73393
73621
  timeout: 1e4
73394
73622
  }).trim();
@@ -73423,7 +73651,7 @@ function openPr(planDir, id, baseOverride) {
73423
73651
  const task = JSON.parse(readFileSync32(join39(dir, "task.json"), "utf8"));
73424
73652
  const wt = task.worktree;
73425
73653
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73426
- const git = (...a) => execFileSync2("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
73654
+ const git = (...a) => execFileSync3("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
73427
73655
  git("fetch", "origin", plan.base);
73428
73656
  if (task.base?.sha && plan.rebase) {
73429
73657
  try {
@@ -73457,7 +73685,7 @@ function openPr(planDir, id, baseOverride) {
73457
73685
  `);
73458
73686
  const bodyFile = join39(dir, "pr-body.md");
73459
73687
  writeFileSync32(bodyFile, body);
73460
- const out = execFileSync2("gh", [
73688
+ const out = execFileSync3("gh", [
73461
73689
  "pr",
73462
73690
  "create",
73463
73691
  "--repo",
@@ -73477,7 +73705,7 @@ function openPr(planDir, id, baseOverride) {
73477
73705
  return { url, created: true };
73478
73706
  }
73479
73707
  function autoOpenPrs(planDir) {
73480
- for (const t of listTasks(planDir)) {
73708
+ for (const t of listTasks2(planDir)) {
73481
73709
  if (t.status !== "done" || t.prUrl)
73482
73710
  continue;
73483
73711
  const mark = join39(taskDir(planDir, t.id), "pr-auto.json");
@@ -73537,7 +73765,7 @@ function failingSpecsFromLog(log) {
73537
73765
  function baselineWaiver(repo, prNumber, base, check, env) {
73538
73766
  const gh = (...a) => {
73539
73767
  try {
73540
- return execFileSync2("gh", a, {
73768
+ return execFileSync3("gh", a, {
73541
73769
  encoding: "utf8",
73542
73770
  timeout: 60000,
73543
73771
  env,
@@ -73574,7 +73802,7 @@ function baselineWaiver(repo, prNumber, base, check, env) {
73574
73802
  };
73575
73803
  }
73576
73804
  function autoMergePrs(planDir) {
73577
- for (const t of listTasks(planDir)) {
73805
+ for (const t of listTasks2(planDir)) {
73578
73806
  if (t.status !== "done")
73579
73807
  continue;
73580
73808
  const dir = taskDir(planDir, t.id);
@@ -73604,14 +73832,14 @@ function autoMergePrs(planDir) {
73604
73832
  ...waivers.map((w) => `- ${w.why}`)
73605
73833
  ].join(`
73606
73834
  `);
73607
- execFileSync2("gh", ["pr", "comment", String(pr.number), "--body", body], {
73835
+ execFileSync3("gh", ["pr", "comment", String(pr.number), "--body", body], {
73608
73836
  cwd: wt,
73609
73837
  encoding: "utf8",
73610
73838
  timeout: 60000,
73611
73839
  env
73612
73840
  });
73613
73841
  }
73614
- execFileSync2("gh", ["pr", "merge", String(pr.number), `--${s.mergeMethod ?? "merge"}`], {
73842
+ execFileSync3("gh", ["pr", "merge", String(pr.number), `--${s.mergeMethod ?? "merge"}`], {
73615
73843
  cwd: wt,
73616
73844
  encoding: "utf8",
73617
73845
  timeout: 60000,
@@ -73640,7 +73868,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
73640
73868
  } catch {}
73641
73869
  let info = null;
73642
73870
  try {
73643
- const out = execFileSync2("gh", ["pr", "view", branch, "--json", "url,number,state,mergeable,statusCheckRollup"], {
73871
+ const out = execFileSync3("gh", ["pr", "view", branch, "--json", "url,number,state,mergeable,statusCheckRollup"], {
73644
73872
  cwd: repo,
73645
73873
  encoding: "utf8",
73646
73874
  timeout: 1e4,
@@ -73843,7 +74071,7 @@ function readTask(planDir, id) {
73843
74071
  const baseSha = task.base?.sha ?? fr.base;
73844
74072
  const git = (...a) => {
73845
74073
  try {
73846
- return execFileSync2("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 3000 }).trim();
74074
+ return execFileSync3("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 3000 }).trim();
73847
74075
  } catch {
73848
74076
  return "";
73849
74077
  }
@@ -73888,7 +74116,7 @@ function readTask(planDir, id) {
73888
74116
  context: read("context.json") ? JSON.parse(read("context.json")) : null
73889
74117
  };
73890
74118
  }
73891
- function listTasks(planDir) {
74119
+ function listTasks2(planDir) {
73892
74120
  const dir = tasksDir(planDir);
73893
74121
  if (!existsSync29(dir))
73894
74122
  return [];
@@ -74073,7 +74301,7 @@ async function tasks(req, res, path, ctx) {
74073
74301
  return json(res, 201, await createTask(ctx.planDir, note));
74074
74302
  }
74075
74303
  if (path === "/api/tasks")
74076
- return json(res, 200, listTasks(ctx.planDir));
74304
+ return json(res, 200, listTasks2(ctx.planDir));
74077
74305
  const shot = path.match(/^\/api\/tasks\/([\w-]+)\/(prod|cand)\.png$/);
74078
74306
  if (shot) {
74079
74307
  const buf = taskShot(ctx.planDir, shot[1], shot[2]);
@@ -74213,19 +74441,19 @@ async function cockpitCommand(opts) {
74213
74441
  host: opts.host
74214
74442
  });
74215
74443
  } catch (err) {
74216
- console.error(chalk29.red(` ✖ could not start the cockpit: ${err.message}`));
74444
+ console.error(chalk30.red(` ✖ could not start the cockpit: ${err.message}`));
74217
74445
  return 2;
74218
74446
  }
74219
74447
  console.log("");
74220
- console.log(chalk29.bold(" parity cockpit"));
74221
- console.log(` ${chalk29.green("●")} ${handle.url}`);
74222
- console.log(chalk29.dim(` plan ${ctx.planDir}`));
74223
- console.log(chalk29.dim(` runs ${ctx.output}`));
74224
- console.log(chalk29.dim(` bench ${ctx.benchDir}`));
74448
+ console.log(chalk30.bold(" parity cockpit"));
74449
+ console.log(` ${chalk30.green("●")} ${handle.url}`);
74450
+ console.log(chalk30.dim(` plan ${ctx.planDir}`));
74451
+ console.log(chalk30.dim(` runs ${ctx.output}`));
74452
+ console.log(chalk30.dim(` bench ${ctx.benchDir}`));
74225
74453
  if (opts.host && opts.host !== "127.0.0.1" && opts.host !== "localhost") {
74226
- console.log(chalk29.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74454
+ console.log(chalk30.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74227
74455
  }
74228
- console.log(chalk29.dim(` Ctrl+C to stop.
74456
+ console.log(chalk30.dim(` Ctrl+C to stop.
74229
74457
  `));
74230
74458
  if (opts.open !== false) {
74231
74459
  const { default: openUrl } = await import("open");
@@ -74244,16 +74472,16 @@ async function cockpitCommand(opts) {
74244
74472
  }
74245
74473
 
74246
74474
  // src/commands/ios.ts
74247
- import { execFileSync as execFileSync3 } from "node:child_process";
74475
+ import { execFileSync as execFileSync4 } from "node:child_process";
74248
74476
  import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync35, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
74249
74477
  import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
74250
74478
  import { join as join42, resolve as resolve15 } from "node:path";
74251
- import chalk31 from "chalk";
74479
+ import chalk32 from "chalk";
74252
74480
 
74253
74481
  // src/commands/pair.ts
74254
74482
  import { existsSync as existsSync30, readFileSync as readFileSync34 } from "node:fs";
74255
74483
  import { join as join41 } from "node:path";
74256
- import chalk30 from "chalk";
74484
+ import chalk31 from "chalk";
74257
74485
 
74258
74486
  // src/engine/pair.ts
74259
74487
  function signatureOf(target, doc = document) {
@@ -74453,7 +74681,7 @@ async function open3(browser, url, viewport, waitMs) {
74453
74681
  async function pairCommand(opts) {
74454
74682
  const viewport = parseViewport3(opts.viewport);
74455
74683
  if (!viewport) {
74456
- console.error(chalk30.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74684
+ console.error(chalk31.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74457
74685
  return 2;
74458
74686
  }
74459
74687
  const from = opts.side;
@@ -74495,16 +74723,16 @@ function report(opts, from, source, match, problem) {
74495
74723
  ambiguous: match?.ambiguous ?? 0
74496
74724
  }));
74497
74725
  } else {
74498
- const box = (s) => s ? chalk30.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
74726
+ const box = (s) => s ? chalk31.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
74499
74727
  if (source)
74500
74728
  console.log(`${from} ${source.selector} ${box(source)}`);
74501
74729
  if (match) {
74502
- console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk30.dim(`by ${match.by}`)}`);
74730
+ console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk31.dim(`by ${match.by}`)}`);
74503
74731
  }
74504
74732
  if (problem)
74505
- console.log(chalk30.yellow(problem));
74733
+ console.log(chalk31.yellow(problem));
74506
74734
  else if (match?.by === "position") {
74507
- console.log(chalk30.yellow("matched by position only — verify it is the same element"));
74735
+ console.log(chalk31.yellow("matched by position only — verify it is the same element"));
74508
74736
  }
74509
74737
  }
74510
74738
  return problem ? 2 : 0;
@@ -74536,7 +74764,7 @@ function sectionArgsFromTask(taskDir) {
74536
74764
  // src/commands/ios.ts
74537
74765
  var LOCK = join42(homedir3(), ".parity", "ios.lock");
74538
74766
  function simctl(...args) {
74539
- return execFileSync3("xcrun", ["simctl", ...args], { encoding: "utf8", timeout: 180000 }).trim();
74767
+ return execFileSync4("xcrun", ["simctl", ...args], { encoding: "utf8", timeout: 180000 }).trim();
74540
74768
  }
74541
74769
  function alive2(pid) {
74542
74770
  try {
@@ -74569,9 +74797,9 @@ function findDevice(name) {
74569
74797
  }
74570
74798
  async function iosCommand(opts) {
74571
74799
  try {
74572
- execFileSync3("xcrun", ["simctl", "help"], { stdio: "ignore" });
74800
+ execFileSync4("xcrun", ["simctl", "help"], { stdio: "ignore" });
74573
74801
  } catch {
74574
- console.error(chalk31.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
74802
+ console.error(chalk32.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
74575
74803
  return 2;
74576
74804
  }
74577
74805
  let { prod, cand, selector, candSelector } = opts;
@@ -74646,11 +74874,11 @@ async function iosCommand(opts) {
74646
74874
  if (opts.json)
74647
74875
  console.log(JSON.stringify(report));
74648
74876
  else {
74649
- console.log(`${chalk31.bold("iOS Safari")} · ${device.name}`);
74877
+ console.log(`${chalk32.bold("iOS Safari")} · ${device.name}`);
74650
74878
  for (const [k, v] of Object.entries(shots))
74651
74879
  console.log(` ${k.padEnd(5)} ${v}`);
74652
74880
  for (const side of missing) {
74653
- console.log(chalk31.yellow(` ${side}: the element was ${found[side] === false ? "not found" : "not reported"} in Safari — no diff (pass a selector that holds, e.g. from \`parity pair\`)`));
74881
+ console.log(chalk32.yellow(` ${side}: the element was ${found[side] === false ? "not found" : "not reported"} in Safari — no diff (pass a selector that holds, e.g. from \`parity pair\`)`));
74654
74882
  }
74655
74883
  if (diff)
74656
74884
  console.log(` diff ${(diff.pctDiff * 100).toFixed(2)}% (${diff.diffPixels} px) → ${diff.heatmapPath}`);
@@ -74693,7 +74921,7 @@ var RpcError = {
74693
74921
  internal: -32603
74694
74922
  };
74695
74923
  var ok = (text) => ({ content: [{ type: "text", text }] });
74696
- var fail = (text) => ({
74924
+ var fail2 = (text) => ({
74697
74925
  content: [{ type: "text", text }],
74698
74926
  isError: true
74699
74927
  });
@@ -74731,13 +74959,13 @@ async function dispatch(req, opts) {
74731
74959
  if (!tool)
74732
74960
  return error(RpcError.invalidParams, `unknown tool: ${name}`);
74733
74961
  if (tool.writes && !opts.allowWrites) {
74734
- return reply(fail(`${name} mutates the migration plan and this server is read-only. Restart it with --allow-writes.`));
74962
+ return reply(fail2(`${name} mutates the migration plan and this server is read-only. Restart it with --allow-writes.`));
74735
74963
  }
74736
74964
  const args = typeof req.params?.arguments === "object" && req.params.arguments !== null ? req.params.arguments : {};
74737
74965
  try {
74738
74966
  return reply(await tool.handler(args));
74739
74967
  } catch (err) {
74740
- return reply(fail(`${name} failed: ${err.message}`));
74968
+ return reply(fail2(`${name} failed: ${err.message}`));
74741
74969
  }
74742
74970
  }
74743
74971
  default:
@@ -74799,16 +75027,16 @@ function withPlan2(ctx, fn) {
74799
75027
  var planOrFail = (ctx, fn) => {
74800
75028
  const out = withPlan2(ctx, fn);
74801
75029
  if (out && typeof out === "object" && "missing" in out)
74802
- return fail(String(out.missing));
75030
+ return fail2(String(out.missing));
74803
75031
  return json2(out);
74804
75032
  };
74805
75033
  function mutate(ctx, fn) {
74806
75034
  const plan = loadPlan(ctx.planDir);
74807
75035
  if (!plan)
74808
- return fail(`no migration-plan.json in ${ctx.planDir}`);
75036
+ return fail2(`no migration-plan.json in ${ctx.planDir}`);
74809
75037
  const message = fn(plan);
74810
75038
  if (message === null)
74811
- return fail("no matching row in the plan");
75039
+ return fail2("no matching row in the plan");
74812
75040
  savePlan(ctx.planDir, plan);
74813
75041
  return ok(message);
74814
75042
  }
@@ -74822,12 +75050,12 @@ function createTools(ctx) {
74822
75050
  handler: () => {
74823
75051
  const p = join43(ctx.planDir, "migration.json");
74824
75052
  if (!existsSync32(p)) {
74825
- return fail(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75053
+ return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
74826
75054
  }
74827
75055
  try {
74828
75056
  return json2(JSON.parse(readFileSync37(p, "utf8")));
74829
75057
  } catch (err) {
74830
- return fail(`migration.json is not valid JSON: ${err.message}`);
75058
+ return fail2(`migration.json is not valid JSON: ${err.message}`);
74831
75059
  }
74832
75060
  }
74833
75061
  },
@@ -74865,12 +75093,12 @@ function createTools(ctx) {
74865
75093
  handler: (args) => {
74866
75094
  const path = str(args, "path");
74867
75095
  if (!path)
74868
- return fail("path is required");
75096
+ return fail2("path is required");
74869
75097
  const out = withPlan2(ctx, (plan) => pagePlan(plan, path, str(args, "candUrl") ?? ctx.candUrl));
74870
75098
  if (out && typeof out === "object" && "missing" in out)
74871
- return fail(String(out.missing));
75099
+ return fail2(String(out.missing));
74872
75100
  if (out === null)
74873
- return fail(`the plan has no page at ${path}`);
75101
+ return fail2(`the plan has no page at ${path}`);
74874
75102
  return json2(out);
74875
75103
  }
74876
75104
  },
@@ -74898,7 +75126,7 @@ function createTools(ctx) {
74898
75126
  handler: (args) => {
74899
75127
  const id = str(args, "runId") ?? listRuns(ctx.output)[0]?.id;
74900
75128
  if (!id)
74901
- return fail(`no runs found under ${ctx.output}`);
75129
+ return fail2(`no runs found under ${ctx.output}`);
74902
75130
  try {
74903
75131
  const run = loadRun(ctx.output, id);
74904
75132
  return json2({
@@ -74918,7 +75146,7 @@ function createTools(ctx) {
74918
75146
  }))
74919
75147
  });
74920
75148
  } catch (err) {
74921
- return fail(err.message);
75149
+ return fail2(err.message);
74922
75150
  }
74923
75151
  }
74924
75152
  },
@@ -74936,10 +75164,10 @@ function createTools(ctx) {
74936
75164
  const name = str(args, "name");
74937
75165
  const status = str(args, "status");
74938
75166
  if (!name || !status)
74939
- return fail("name and status are required");
75167
+ return fail2("name and status are required");
74940
75168
  const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
74941
75169
  if (!allowed.includes(status)) {
74942
- return fail(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
75170
+ return fail2(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
74943
75171
  }
74944
75172
  return mutate(ctx, (plan) => {
74945
75173
  const c = setComponentStatus(plan, name, status);
@@ -74961,10 +75189,10 @@ function createTools(ctx) {
74961
75189
  const path = str(args, "path");
74962
75190
  const status = str(args, "status");
74963
75191
  if (!path || !status)
74964
- return fail("path and status are required");
75192
+ return fail2("path and status are required");
74965
75193
  const allowed = ["pending", "code", "done", "skipped"];
74966
75194
  if (!allowed.includes(status)) {
74967
- return fail(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
75195
+ return fail2(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
74968
75196
  }
74969
75197
  return mutate(ctx, (plan) => {
74970
75198
  const p = setPageStatus(plan, path, status);
@@ -74986,7 +75214,7 @@ function createTools(ctx) {
74986
75214
  const name = str(args, "name");
74987
75215
  const provenance = str(args, "provenance");
74988
75216
  if (!name || provenance !== "library" && provenance !== "built") {
74989
- return fail("name is required and provenance must be `library` or `built`");
75217
+ return fail2("name is required and provenance must be `library` or `built`");
74990
75218
  }
74991
75219
  return mutate(ctx, (plan) => {
74992
75220
  const c = setComponentProvenance(plan, name, provenance);
@@ -75007,7 +75235,7 @@ function createTools(ctx) {
75007
75235
  handler: (args) => {
75008
75236
  const page = str(args, "page");
75009
75237
  if (!page)
75010
- return fail("page is required");
75238
+ return fail2("page is required");
75011
75239
  return mutate(ctx, (plan) => {
75012
75240
  const n = recordTouch(plan, page);
75013
75241
  return `${page} → ${n} human touch(es); ${totalTouches(plan)} in this migration`;
@@ -75057,7 +75285,7 @@ async function mcpCommand(opts) {
75057
75285
  // src/commands/heatmap.ts
75058
75286
  import { mkdirSync as mkdirSync23 } from "node:fs";
75059
75287
  import { resolve as resolve18 } from "node:path";
75060
- import chalk32 from "chalk";
75288
+ import chalk33 from "chalk";
75061
75289
 
75062
75290
  // src/diff/hotspot-findings.ts
75063
75291
  var TYPOGRAPHY_PROPS = /^(font-family|font-weight|font-size|font-style|line-height|letter-spacing|text-transform)$/;
@@ -75471,16 +75699,16 @@ function exitCodeFor(verdict) {
75471
75699
  async function heatmapCommand(opts) {
75472
75700
  const specs = parseViewports2(opts.viewports);
75473
75701
  if (typeof specs === "string") {
75474
- console.error(chalk32.red(specs));
75702
+ console.error(chalk33.red(specs));
75475
75703
  return EXIT_INCONCLUSIVE;
75476
75704
  }
75477
75705
  const waitMs = Number.parseInt(opts.wait, 10);
75478
75706
  if (!Number.isFinite(waitMs) || waitMs < 0) {
75479
- console.error(chalk32.red(`--wait inválido: ${opts.wait}`));
75707
+ console.error(chalk33.red(`--wait inválido: ${opts.wait}`));
75480
75708
  return EXIT_INCONCLUSIVE;
75481
75709
  }
75482
75710
  if (!isValidUrl5(opts.prod) || !isValidUrl5(opts.cand)) {
75483
- console.error(chalk32.red("--prod ou --cand inválido"));
75711
+ console.error(chalk33.red("--prod ou --cand inválido"));
75484
75712
  return EXIT_INCONCLUSIVE;
75485
75713
  }
75486
75714
  const selector = opts.selector?.trim() || null;
@@ -75519,7 +75747,7 @@ async function heatmapCommand(opts) {
75519
75747
  };
75520
75748
  if (opts.pr) {
75521
75749
  await postQaComment({ report, pr: opts.pr, repo: opts.repo }).catch((err) => {
75522
- console.error(chalk32.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
75750
+ console.error(chalk33.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
75523
75751
  });
75524
75752
  }
75525
75753
  if (opts.json)
@@ -75943,35 +76171,35 @@ function isValidUrl5(s) {
75943
76171
  }
75944
76172
  }
75945
76173
  var MARK = {
75946
- identical: chalk32.green("✓"),
75947
- differs: chalk32.red("✗"),
75948
- inconclusive: chalk32.yellow("?")
76174
+ identical: chalk33.green("✓"),
76175
+ differs: chalk33.red("✗"),
76176
+ inconclusive: chalk33.yellow("?")
75949
76177
  };
75950
76178
  function printReport(report) {
75951
76179
  console.log("");
75952
- console.log(chalk32.bold(` parity heatmap — ${report.mode}`));
75953
- console.log(chalk32.dim(` prod: ${report.prodUrl}`));
75954
- console.log(chalk32.dim(` cand: ${report.candUrl}`));
76180
+ console.log(chalk33.bold(` parity heatmap — ${report.mode}`));
76181
+ console.log(chalk33.dim(` prod: ${report.prodUrl}`));
76182
+ console.log(chalk33.dim(` cand: ${report.candUrl}`));
75955
76183
  console.log("");
75956
76184
  for (const v of report.viewports) {
75957
- const detail = v.verdict === "identical" ? chalk32.dim("0 pixels") : v.reason ?? chalk32.dim("no detail");
76185
+ const detail = v.verdict === "identical" ? chalk33.dim("0 pixels") : v.reason ?? chalk33.dim("no detail");
75958
76186
  console.log(` ${MARK[v.verdict]} ${v.label.padEnd(12)} ${detail}`);
75959
76187
  if (v.maskedCoverage != null && v.maskedCoverage > 0) {
75960
- console.log(chalk32.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
76188
+ console.log(chalk33.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
75961
76189
  }
75962
76190
  for (const f of v.findings.slice(0, 5)) {
75963
- console.log(chalk32.dim(` [${f.type}] ${f.summary}`));
76191
+ console.log(chalk33.dim(` [${f.type}] ${f.summary}`));
75964
76192
  }
75965
76193
  if (v.heatmapPath && v.verdict === "differs") {
75966
- console.log(chalk32.dim(` ${v.heatmapPath}`));
76194
+ console.log(chalk33.dim(` ${v.heatmapPath}`));
75967
76195
  }
75968
76196
  const hosts = imageHostDelta(v.prod.imageHosts, v.cand.imageHosts);
75969
76197
  if (hosts.onlyProd.length > 0 || hosts.onlyCand.length > 0) {
75970
- console.log(chalk32.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76198
+ console.log(chalk33.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
75971
76199
  }
75972
76200
  }
75973
76201
  console.log("");
75974
- console.log(` ${MARK[report.verdict]} ${chalk32.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
76202
+ console.log(` ${MARK[report.verdict]} ${chalk33.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
75975
76203
  console.log("");
75976
76204
  }
75977
76205
  function imageHostDelta(prod, cand) {
@@ -75992,7 +76220,7 @@ function formatHostDelta(d) {
75992
76220
  }
75993
76221
 
75994
76222
  // src/commands/states.ts
75995
- import chalk33 from "chalk";
76223
+ import chalk34 from "chalk";
75996
76224
  var HOVERABLE = "a,button,summary,[role='button'],[role='menuitem'],label";
75997
76225
  var SETTLE_RETRY_FACTOR = 4;
75998
76226
  async function readStateEffects(page, opts) {
@@ -76204,7 +76432,7 @@ function statesVerdict(counts) {
76204
76432
  async function statesCommand(opts) {
76205
76433
  const viewport = parseViewport3(opts.viewport);
76206
76434
  if (!viewport) {
76207
- console.error(chalk33.red(`--viewport inválido: ${opts.viewport}`));
76435
+ console.error(chalk34.red(`--viewport inválido: ${opts.viewport}`));
76208
76436
  return 2;
76209
76437
  }
76210
76438
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -76213,12 +76441,12 @@ async function statesCommand(opts) {
76213
76441
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
76214
76442
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
76215
76443
  if (!prodSelector || !candSelector) {
76216
- console.error(chalk33.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76444
+ console.error(chalk34.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76217
76445
  return 2;
76218
76446
  }
76219
76447
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
76220
76448
  if (aliasNote)
76221
- console.log(chalk33.dim(` ${aliasNote}`));
76449
+ console.log(chalk34.dim(` ${aliasNote}`));
76222
76450
  const browser = await launchBrowser({ headless: true });
76223
76451
  try {
76224
76452
  const [prodSide, candSide] = await Promise.all([
@@ -76241,7 +76469,7 @@ async function statesCommand(opts) {
76241
76469
  ]);
76242
76470
  if (prodSide.baseError || candSide.baseError) {
76243
76471
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
76244
- console.error(chalk33.red(` não foi possível ler o componente — ${which}`));
76472
+ console.error(chalk34.red(` não foi possível ler o componente — ${which}`));
76245
76473
  return 2;
76246
76474
  }
76247
76475
  const motion = prodSide.motion.found && candSide.motion.found ? diffMotion(prodSide.motion, candSide.motion, {
@@ -76278,58 +76506,58 @@ async function statesCommand(opts) {
76278
76506
  ]) {
76279
76507
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
76280
76508
  if (caveat)
76281
- console.log(chalk33.yellow(` ${caveat}`));
76509
+ console.log(chalk34.yellow(` ${caveat}`));
76282
76510
  }
76283
76511
  console.log("");
76284
- console.log(chalk33.bold(" Declared motion"));
76512
+ console.log(chalk34.bold(" Declared motion"));
76285
76513
  if (!motion) {
76286
76514
  const err = prodSide.motion.found ? candSide.motion : prodSide.motion;
76287
- console.log(chalk33.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76515
+ console.log(chalk34.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76288
76516
  } else {
76289
76517
  for (const line of formatMotionDiff(motion).split(`
76290
76518
  `))
76291
76519
  console.log(` ${line}`);
76292
76520
  }
76293
76521
  console.log("");
76294
- console.log(chalk33.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76522
+ console.log(chalk34.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76295
76523
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
76296
76524
  if (nothing && !exercised) {
76297
- console.log(chalk33.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76525
+ console.log(chalk34.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76298
76526
  } else if (nothing) {
76299
76527
  console.log(" clean — every hover that changes something in prod changes the same in cand");
76300
76528
  }
76301
76529
  for (const e of effects.lost) {
76302
- console.log(chalk33.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76530
+ console.log(chalk34.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76303
76531
  }
76304
76532
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
76305
76533
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
76306
76534
  if (onElement.length) {
76307
- console.log(chalk33.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76535
+ console.log(chalk34.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76308
76536
  }
76309
76537
  if (extra.length)
76310
76538
  console.log(` cand also moves [${extra.join(", ")}]`);
76311
76539
  if (notComparable.length) {
76312
- console.log(chalk33.dim(` not comparable: [${notComparable.join(", ")}] — prod's hover renumbered ${prod.renumberedNodes} of the changed paths, so these were read on elements that are not the same ones before and after. Bench the component, or pick a selector whose subtree the hover does not restructure.`));
76540
+ console.log(chalk34.dim(` not comparable: [${notComparable.join(", ")}] — prod's hover renumbered ${prod.renumberedNodes} of the changed paths, so these were read on elements that are not the same ones before and after. Bench the component, or pick a selector whose subtree the hover does not restructure.`));
76313
76541
  }
76314
76542
  if (onElement.length === 0 && extra.length === 0) {
76315
- console.log(chalk33.dim(" nothing comparable differs."));
76543
+ console.log(chalk34.dim(" nothing comparable differs."));
76316
76544
  }
76317
76545
  }
76318
76546
  for (const e of effects.unpaired) {
76319
- console.log(chalk33.dim(` UNPAIRED ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; no matching element found on the cand side (not a defect — the port may have changed the element, or it is outside --selector)`));
76547
+ console.log(chalk34.dim(` UNPAIRED ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; no matching element found on the cand side (not a defect — the port may have changed the element, or it is outside --selector)`));
76320
76548
  }
76321
76549
  for (const e of effects.added) {
76322
76550
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
76323
76551
  }
76324
76552
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
76325
76553
  console.log("");
76326
- console.log(chalk33.yellow(` ${effects.unpaired.length} prod effect(s) had no counterpart and NOTHING paired. That is a pairing failure, not a set of defects — check --selector contains the same component on both sides, and that ported roots carry data-section.`));
76554
+ console.log(chalk34.yellow(` ${effects.unpaired.length} prod effect(s) had no counterpart and NOTHING paired. That is a pairing failure, not a set of defects — check --selector contains the same component on both sides, and that ported roots carry data-section.`));
76327
76555
  }
76328
76556
  if (prodSide.ambient > 0 || candSide.ambient > 0) {
76329
- console.log(chalk33.dim(` ${prodSide.ambient} prod / ${candSide.ambient} cand node+property pair(s) were moving with no interaction (carousel, autoplaying video, anything on a timer) and were subtracted. A large count means --selector contains something animating on its own; narrow it.`));
76557
+ console.log(chalk34.dim(` ${prodSide.ambient} prod / ${candSide.ambient} cand node+property pair(s) were moving with no interaction (carousel, autoplaying video, anything on a timer) and were subtracted. A large count means --selector contains something animating on its own; narrow it.`));
76330
76558
  }
76331
76559
  if (prodSide.truncated || candSide.truncated) {
76332
- console.log(chalk33.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76560
+ console.log(chalk34.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76333
76561
  }
76334
76562
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
76335
76563
  } finally {
@@ -76340,7 +76568,7 @@ async function statesCommand(opts) {
76340
76568
  }
76341
76569
 
76342
76570
  // src/commands/variance.ts
76343
- import chalk34 from "chalk";
76571
+ import chalk35 from "chalk";
76344
76572
 
76345
76573
  // src/diff/variance.ts
76346
76574
  var uniq2 = (xs) => [...new Set(xs)];
@@ -76444,7 +76672,7 @@ function formatVariance(report, opts = {}) {
76444
76672
  // src/commands/variance.ts
76445
76673
  function varianceCommand(opts) {
76446
76674
  if (opts.runIds.length < 2) {
76447
- console.error(chalk34.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76675
+ console.error(chalk35.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76448
76676
  return 2;
76449
76677
  }
76450
76678
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -76453,7 +76681,7 @@ function varianceCommand(opts) {
76453
76681
  try {
76454
76682
  runs.push(loadRun(opts.output, id));
76455
76683
  } catch (err) {
76456
- console.error(chalk34.red(` ✖ ${err.message}`));
76684
+ console.error(chalk35.red(` ✖ ${err.message}`));
76457
76685
  return 2;
76458
76686
  }
76459
76687
  }
@@ -76462,7 +76690,7 @@ function varianceCommand(opts) {
76462
76690
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
76463
76691
  } else {
76464
76692
  console.log("");
76465
- console.log(chalk34.bold(" Score variance"));
76693
+ console.log(chalk35.bold(" Score variance"));
76466
76694
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
76467
76695
  `)) {
76468
76696
  console.log(` ${line}`);
@@ -76477,7 +76705,7 @@ function varianceCommand(opts) {
76477
76705
  import { existsSync as existsSync33, readFileSync as readFileSync39, writeFileSync as writeFileSync35 } from "node:fs";
76478
76706
  import { availableParallelism } from "node:os";
76479
76707
  import { join as join44 } from "node:path";
76480
- import chalk35 from "chalk";
76708
+ import chalk36 from "chalk";
76481
76709
  import ora9 from "ora";
76482
76710
 
76483
76711
  // src/checks/agentic-nav.ts
@@ -76775,10 +77003,10 @@ async function vitalsCommand(opts) {
76775
77003
  const runId = newRunId();
76776
77004
  const paths = createRunDir(opts.output, runId);
76777
77005
  const t0 = Date.now();
76778
- console.log(chalk35.bold(`
77006
+ console.log(chalk36.bold(`
76779
77007
  parity vitals ${runId}`));
76780
- console.log(chalk35.dim(` prod: ${opts.prod}`));
76781
- console.log(chalk35.dim(` cand: ${opts.cand}`));
77008
+ console.log(chalk36.dim(` prod: ${opts.prod}`));
77009
+ console.log(chalk36.dim(` cand: ${opts.cand}`));
76782
77010
  const discoverSpinner = ora9("Descobrindo páginas…").start();
76783
77011
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
76784
77012
  if (pagePaths.length === 0) {
@@ -76810,7 +77038,7 @@ async function vitalsCommand(opts) {
76810
77038
  completed++;
76811
77039
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
76812
77040
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
76813
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk35.cyan("prod") : chalk35.magenta("cand")} ${task.path} (${task.viewport})`;
77041
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk36.cyan("prod") : chalk36.magenta("cand")} ${task.path} (${task.viewport})`;
76814
77042
  }
76815
77043
  });
76816
77044
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -76839,7 +77067,7 @@ async function vitalsCommand(opts) {
76839
77067
  }
76840
77068
  lhCompleted++;
76841
77069
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
76842
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk35.cyan("prod") : chalk35.magenta("cand")} ${task.path} (${task.viewport})`;
77070
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk36.cyan("prod") : chalk36.magenta("cand")} ${task.path} (${task.viewport})`;
76843
77071
  });
76844
77072
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
76845
77073
  }
@@ -76917,8 +77145,8 @@ async function vitalsCommand(opts) {
76917
77145
  `, "utf8");
76918
77146
  printSummary8(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
76919
77147
  console.log("");
76920
- console.log(chalk35.dim(` → ${paths.reportHtml}`));
76921
- console.log(chalk35.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
77148
+ console.log(chalk36.dim(` → ${paths.reportHtml}`));
77149
+ console.log(chalk36.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
76922
77150
  console.log("");
76923
77151
  if (opts.open) {
76924
77152
  const { default: open } = await import("open");
@@ -77016,7 +77244,7 @@ function parseUrlList(input) {
77016
77244
  }
77017
77245
  function printSummary8(vitals, cache, scores, opportunities, agentic) {
77018
77246
  console.log("");
77019
- console.log(chalk35.bold(" Summary:"));
77247
+ console.log(chalk36.bold(" Summary:"));
77020
77248
  console.log(` ${vitals.summary}`);
77021
77249
  console.log(` ${cache.summary}`);
77022
77250
  if (scores.status !== "skipped")
@@ -77118,6 +77346,37 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
77118
77346
  })).addCommand(new Command("verify").description("Record that a component was actually compared against its reference. A `done` row with no verification only means the code exists.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<verdict>", "pass | fail | inconclusive. `inconclusive` means the comparison could not be made (wrong element count, different sizes, an unstable reference) — the row stays open rather than settling, because nothing was measured.").option("--note <text>", "What was seen").option("--at <iso>", "Timestamp (default: now)").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, verdict, opts) => {
77119
77347
  process.exit(planVerifyCommand(opts.dir, name, verdict, { note: opts.note, at: opts.at }));
77120
77348
  }));
77349
+ program.command("studio").description("Work the deco Studio task board: list tasks, read one, take one, move it, comment. Needs PARITY_STUDIO_URL (…/api/<org>/mcp/self) + PARITY_STUDIO_TOKEN. Writes are dry runs unless --yes.").addCommand(new Command("tasks").description("List the board's tasks, most urgent first. Done, archived and merged cards are hidden unless --all or --status asks for them.").option("--status <list>", "Only these columns, comma-separated (e.g. todo,in_review)").option("--repo <owner/name>", "Only tasks on this repository").option("--type <type>", "bug | feature | chore | spike | security").option("--search <text>", "Match title or description").option("--all", "Include done, archived and merged cards", false).option("--limit <n>", "Show at most n", (v) => Number(v)).option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
77350
+ process.exit(await studioTasksCommand({
77351
+ status: opts.status,
77352
+ repo: opts.repo,
77353
+ type: opts.type,
77354
+ search: opts.search,
77355
+ all: Boolean(opts.all),
77356
+ limit: opts.limit,
77357
+ json: Boolean(opts.json)
77358
+ }));
77359
+ })).addCommand(new Command("show").description("One task in full: description, linked PRs and open comments.").argument("<task>", "Task number (#471 or 471) or id (board_…)").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (task, opts) => {
77360
+ process.exit(await studioShowCommand({ task, json: Boolean(opts.json) }));
77361
+ })).addCommand(new Command("take").description("Take a task: move it to in_progress and comment who took it, so nobody starts it twice. Only from triage/todo unless --force; refuses a column with an automation unless --allow-automation. Dry run unless --yes.").argument("<task>", "Task number (#471 or 471) or id (board_…)").option("--by <name>", "Name for the comment (default: git user.name)").option("--force", "Take it even if it is past todo", false).option("--allow-automation", "Allow landing it in a column that starts the board's agent", false).option("--yes", "Actually move it. Without it, this is a dry run.", false).action(async (task, opts) => {
77362
+ process.exit(await studioTakeCommand({
77363
+ task,
77364
+ by: opts.by,
77365
+ force: Boolean(opts.force),
77366
+ allowAutomation: Boolean(opts.allowAutomation),
77367
+ yes: Boolean(opts.yes)
77368
+ }));
77369
+ })).addCommand(new Command("move").description("Move a task to another column (triage, todo, in_progress, in_review, approved, merged, post_deploy_validation, done, archived — whatever this board has). Refuses a column with an automation unless --allow-automation. Dry run unless --yes.").argument("<task>", "Task number (#471 or 471) or id (board_…)").argument("<column>", "Target column key").option("--comment <text>", "Also leave a comment saying why").option("--allow-automation", "Allow landing it in a column that starts the board's agent", false).option("--yes", "Actually move it. Without it, this is a dry run.", false).action(async (task, column, opts) => {
77370
+ process.exit(await studioMoveCommand({
77371
+ task,
77372
+ to: column,
77373
+ comment: opts.comment,
77374
+ allowAutomation: Boolean(opts.allowAutomation),
77375
+ yes: Boolean(opts.yes)
77376
+ }));
77377
+ })).addCommand(new Command("comment").description("Comment on a task, prefixed [parity] so `plan notes` never reads it back as client input. Dry run unless --yes.").argument("<task>", "Task number (#471 or 471) or id (board_…)").argument("<body>", "Comment text").option("--yes", "Actually post it. Without it, this is a dry run.", false).action(async (task, body, opts) => {
77378
+ process.exit(await studioCommentCommand({ task, body, yes: Boolean(opts.yes) }));
77379
+ }));
77121
77380
  registerCommands(program.command("cms").description(`${DESCRIPTION} Same as the standalone \`vtex-cms\` bin.`));
77122
77381
  program.command("serve").argument("<runId>", "Run ID to serve").description("Spawns a local HTTP server that serves the report and proxies external iframes (strips X-Frame-Options/CSP), making the Side-by-side tab functional for any site.").option("--output <dir>", "Output directory where runs live", "./parity-output").option("--port <n>", "Fixed port (default: auto-pick free port)", (v) => Number(v)).option("--no-open", "Don't open the browser automatically").action(async (runId, opts) => {
77123
77382
  process.exit(await serveCommand(runId, opts));