@decocms/parity 0.33.52 → 0.33.53

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 +386 -349
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -36705,10 +36705,10 @@ var init_models = __esm(() => {
36705
36705
 
36706
36706
  // src/llm/providers/claude-agent-sdk.ts
36707
36707
  import { existsSync as existsSync3 } from "node:fs";
36708
- import { homedir } from "node:os";
36709
- import { join as join4 } from "node:path";
36708
+ import { homedir as homedir2 } from "node:os";
36709
+ import { join as join5 } from "node:path";
36710
36710
  function isClaudeAgentSdkAvailable() {
36711
- const dir = join4(homedir(), ".claude");
36711
+ const dir = join5(homedir2(), ".claude");
36712
36712
  return existsSync3(dir);
36713
36713
  }
36714
36714
  async function loadSdk() {
@@ -37433,10 +37433,14 @@ import { DESCRIPTION, registerCommands } from "@decocms/vtex-cms";
37433
37433
  import { Command } from "commander";
37434
37434
 
37435
37435
  // src/commands/studio.ts
37436
- import { execFileSync } from "node:child_process";
37436
+ import { execFileSync as execFileSync2 } from "node:child_process";
37437
37437
  import chalk from "chalk";
37438
37438
 
37439
37439
  // src/board/studio.ts
37440
+ import { execFileSync } from "node:child_process";
37441
+ import { readFileSync } from "node:fs";
37442
+ import { homedir } from "node:os";
37443
+ import { join } from "node:path";
37440
37444
  var TASK_STATUSES = [
37441
37445
  "triage",
37442
37446
  "todo",
@@ -37456,12 +37460,45 @@ var LANE_TO_STUDIO = {
37456
37460
  done: "done",
37457
37461
  skipped: null
37458
37462
  };
37459
- function studioConfigFromEnv(env = process.env) {
37463
+ var STUDIO_LOGIN_HINT = "run `bunx decocms auth login` once (or set PARITY_STUDIO_URL + PARITY_STUDIO_TOKEN)";
37464
+ function studioConfigFromEnv(env = process.env, deps = {}) {
37460
37465
  const url = env.PARITY_STUDIO_URL;
37461
37466
  const token = env.PARITY_STUDIO_TOKEN;
37462
- if (!url || !token)
37467
+ if (url && token)
37468
+ return { url: mcpEndpoint(url), token };
37469
+ const host = url ? new URL(mcpEndpoint(url)).host : "studio.decocms.com";
37470
+ const home = env.DECOCMS_HOME || join(env.HOME || homedir(), "deco");
37471
+ const file = join(home, `session.${host}.json`);
37472
+ const read = deps.readSession ?? readSessionFile;
37473
+ const now = (deps.now ?? (() => Date.now() / 1000))();
37474
+ let session = read(file);
37475
+ if (!session?.accessToken)
37463
37476
  return null;
37464
- return { url: mcpEndpoint(url), token };
37477
+ if (session.expiresAt && session.expiresAt - 60 < now) {
37478
+ (deps.refresh ?? refreshSession)(home);
37479
+ session = read(file);
37480
+ if (!session?.accessToken || session.expiresAt && session.expiresAt - 60 < now)
37481
+ return null;
37482
+ }
37483
+ const origin = session.target?.replace(/\/+$/, "") || `https://${host}`;
37484
+ const endpoint = url ? mcpEndpoint(url) : env.PARITY_STUDIO_ORG ? `${origin}/api/${env.PARITY_STUDIO_ORG}/mcp/self` : `${origin}/mcp/self`;
37485
+ return { url: endpoint, token: session.accessToken };
37486
+ }
37487
+ function readSessionFile(file) {
37488
+ try {
37489
+ return JSON.parse(readFileSync(file, "utf8"));
37490
+ } catch {
37491
+ return null;
37492
+ }
37493
+ }
37494
+ function refreshSession(home) {
37495
+ try {
37496
+ execFileSync("bunx", ["decocms", "auth", "whoami"], {
37497
+ env: { ...process.env, DECOCMS_HOME: home },
37498
+ stdio: "ignore",
37499
+ timeout: 30000
37500
+ });
37501
+ } catch {}
37465
37502
  }
37466
37503
  function mcpEndpoint(url) {
37467
37504
  const trimmed = url.replace(/\/+$/, "");
@@ -37637,7 +37674,7 @@ var PRIORITY_RANK = { urgent: 0, high: 1, medium: 2, low: 3, none: 4 };
37637
37674
  function config() {
37638
37675
  const cfg = studioConfigFromEnv();
37639
37676
  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."));
37677
+ console.error(chalk.red(`Studio not configured — ${STUDIO_LOGIN_HINT}. The org comes from PARITY_STUDIO_URL (…/api/<org>/mcp/self) or PARITY_STUDIO_ORG.`));
37641
37678
  }
37642
37679
  return cfg;
37643
37680
  }
@@ -37729,7 +37766,7 @@ Comments (${open.length} open)`));
37729
37766
  }
37730
37767
  function whoAmI() {
37731
37768
  try {
37732
- return execFileSync("git", ["config", "user.name"], { encoding: "utf8" }).trim() || "parity";
37769
+ return execFileSync2("git", ["config", "user.name"], { encoding: "utf8" }).trim() || "parity";
37733
37770
  } catch {
37734
37771
  return "parity";
37735
37772
  }
@@ -37819,7 +37856,7 @@ async function studioCommentCommand(opts, call = callTool) {
37819
37856
 
37820
37857
  // src/commands/audit.ts
37821
37858
  import { writeFileSync as writeFileSync2 } from "node:fs";
37822
- import { join as join2 } from "node:path";
37859
+ import { join as join3 } from "node:path";
37823
37860
  import chalk3 from "chalk";
37824
37861
  import ora from "ora";
37825
37862
 
@@ -41722,8 +41759,8 @@ function pathOf(url) {
41722
41759
  }
41723
41760
 
41724
41761
  // src/storage/fs.ts
41725
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
41726
- import { join } from "node:path";
41762
+ import { existsSync, mkdirSync, readFileSync as readFileSync2, readdirSync, writeFileSync } from "node:fs";
41763
+ import { join as join2 } from "node:path";
41727
41764
 
41728
41765
  // src/types/schema.ts
41729
41766
  import { z } from "zod";
@@ -42231,15 +42268,15 @@ function newRunId() {
42231
42268
  return new Date().toISOString().replace(/[:.]/g, "-").replace("T", "T");
42232
42269
  }
42233
42270
  function createRunDir(outputDir, runId) {
42234
- const runDir = join(outputDir, "runs", runId);
42271
+ const runDir = join2(outputDir, "runs", runId);
42235
42272
  const paths = {
42236
42273
  runDir,
42237
- reportJson: join(runDir, "report.json"),
42238
- reportHtml: join(runDir, "report.html"),
42239
- screenshotsDir: join(runDir, "screenshots"),
42240
- harDir: join(runDir, "har"),
42241
- tracesDir: join(runDir, "traces"),
42242
- runLog: join(runDir, "run.log")
42274
+ reportJson: join2(runDir, "report.json"),
42275
+ reportHtml: join2(runDir, "report.html"),
42276
+ screenshotsDir: join2(runDir, "screenshots"),
42277
+ harDir: join2(runDir, "har"),
42278
+ tracesDir: join2(runDir, "traces"),
42279
+ runLog: join2(runDir, "run.log")
42243
42280
  };
42244
42281
  for (const dir of [paths.runDir, paths.screenshotsDir, paths.harDir, paths.tracesDir]) {
42245
42282
  mkdirSync(dir, { recursive: true });
@@ -42247,15 +42284,15 @@ function createRunDir(outputDir, runId) {
42247
42284
  return paths;
42248
42285
  }
42249
42286
  function getRunPaths(outputDir, runId) {
42250
- const runDir = join(outputDir, "runs", runId);
42287
+ const runDir = join2(outputDir, "runs", runId);
42251
42288
  return {
42252
42289
  runDir,
42253
- reportJson: join(runDir, "report.json"),
42254
- reportHtml: join(runDir, "report.html"),
42255
- screenshotsDir: join(runDir, "screenshots"),
42256
- harDir: join(runDir, "har"),
42257
- tracesDir: join(runDir, "traces"),
42258
- runLog: join(runDir, "run.log")
42290
+ reportJson: join2(runDir, "report.json"),
42291
+ reportHtml: join2(runDir, "report.html"),
42292
+ screenshotsDir: join2(runDir, "screenshots"),
42293
+ harDir: join2(runDir, "har"),
42294
+ tracesDir: join2(runDir, "traces"),
42295
+ runLog: join2(runDir, "run.log")
42259
42296
  };
42260
42297
  }
42261
42298
  function stripCaptureHtml(run) {
@@ -42270,22 +42307,22 @@ function stripCaptureHtml(run) {
42270
42307
  };
42271
42308
  }
42272
42309
  function writeRunReportJson(runDir, run) {
42273
- const path = join(runDir, "report.json");
42310
+ const path = join2(runDir, "report.json");
42274
42311
  writeFileSync(path, `${JSON.stringify(stripCaptureHtml(run), null, 2)}
42275
42312
  `, "utf8");
42276
42313
  return path;
42277
42314
  }
42278
42315
  function writeRunReportHtml(runDir, html) {
42279
- const path = join(runDir, "report.html");
42316
+ const path = join2(runDir, "report.html");
42280
42317
  writeFileSync(path, html, "utf8");
42281
42318
  return path;
42282
42319
  }
42283
42320
  function loadRun(outputDir, runId) {
42284
- const reportJson = join(outputDir, "runs", runId, "report.json");
42321
+ const reportJson = join2(outputDir, "runs", runId, "report.json");
42285
42322
  if (!existsSync(reportJson)) {
42286
42323
  throw new Error(`Run not found: ${runId}`);
42287
42324
  }
42288
- const raw = JSON.parse(readFileSync(reportJson, "utf8"));
42325
+ const raw = JSON.parse(readFileSync2(reportJson, "utf8"));
42289
42326
  return Run.parse(raw);
42290
42327
  }
42291
42328
  function sameModuleSet(a, b) {
@@ -42318,7 +42355,7 @@ function findComparableRuns(outputDir, opts, limit) {
42318
42355
  if (entry.id === opts.excludeRunId)
42319
42356
  continue;
42320
42357
  try {
42321
- const raw = JSON.parse(readFileSync(entry.reportPath, "utf8"));
42358
+ const raw = JSON.parse(readFileSync2(entry.reportPath, "utf8"));
42322
42359
  if (raw.partial)
42323
42360
  continue;
42324
42361
  if (typeof raw.verdict?.score !== "number")
@@ -42343,15 +42380,15 @@ function findComparableRuns(outputDir, opts, limit) {
42343
42380
  return out;
42344
42381
  }
42345
42382
  function listRuns(outputDir) {
42346
- const runsDir = join(outputDir, "runs");
42383
+ const runsDir = join2(outputDir, "runs");
42347
42384
  if (!existsSync(runsDir))
42348
42385
  return [];
42349
42386
  const entries = readdirSync(runsDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => {
42350
- const reportPath = join(runsDir, e.name, "report.json");
42387
+ const reportPath = join2(runsDir, e.name, "report.json");
42351
42388
  let timestamp = e.name;
42352
42389
  try {
42353
42390
  if (existsSync(reportPath)) {
42354
- const r = JSON.parse(readFileSync(reportPath, "utf8"));
42391
+ const r = JSON.parse(readFileSync2(reportPath, "utf8"));
42355
42392
  if (r.timestamp)
42356
42393
  timestamp = r.timestamp;
42357
42394
  }
@@ -42452,7 +42489,7 @@ async function auditCommand(opts) {
42452
42489
  url: fullUrl,
42453
42490
  side: "cand",
42454
42491
  viewport,
42455
- screenshotPath: join2(paths.screenshotsDir, `audit-${safePath(path)}-${viewport}.png`),
42492
+ screenshotPath: join3(paths.screenshotsDir, `audit-${safePath(path)}-${viewport}.png`),
42456
42493
  settleMs: 1500,
42457
42494
  timeoutMs: 30000,
42458
42495
  fast: false,
@@ -42575,12 +42612,12 @@ import chalk4 from "chalk";
42575
42612
  import {
42576
42613
  existsSync as existsSync2,
42577
42614
  mkdirSync as mkdirSync2,
42578
- readFileSync as readFileSync2,
42615
+ readFileSync as readFileSync3,
42579
42616
  readdirSync as readdirSync2,
42580
42617
  unlinkSync,
42581
42618
  writeFileSync as writeFileSync3
42582
42619
  } from "node:fs";
42583
- import { join as join3 } from "node:path";
42620
+ import { join as join4 } from "node:path";
42584
42621
  var DEFAULT_DIR = "./parity-baselines";
42585
42622
  function safeName(name) {
42586
42623
  if (!/^[a-z0-9_-]+$/i.test(name)) {
@@ -42593,7 +42630,7 @@ function ensureDir(dir) {
42593
42630
  mkdirSync2(dir, { recursive: true });
42594
42631
  }
42595
42632
  function baselinePath(name, dir = DEFAULT_DIR) {
42596
- return join3(dir, `${safeName(name)}.json`);
42633
+ return join4(dir, `${safeName(name)}.json`);
42597
42634
  }
42598
42635
  function saveBaseline(name, run, dir = DEFAULT_DIR) {
42599
42636
  ensureDir(dir);
@@ -42616,16 +42653,16 @@ function loadBaseline(name, dir = DEFAULT_DIR) {
42616
42653
  if (!existsSync2(path)) {
42617
42654
  throw new Error(`Baseline not found: ${name}`);
42618
42655
  }
42619
- const raw = JSON.parse(readFileSync2(path, "utf8"));
42656
+ const raw = JSON.parse(readFileSync3(path, "utf8"));
42620
42657
  return Baseline.parse(raw);
42621
42658
  }
42622
42659
  function listBaselines(dir = DEFAULT_DIR) {
42623
42660
  if (!existsSync2(dir))
42624
42661
  return [];
42625
42662
  return readdirSync2(dir).filter((f) => f.endsWith(".json")).map((f) => {
42626
- const path = join3(dir, f);
42663
+ const path = join4(dir, f);
42627
42664
  try {
42628
- const raw = JSON.parse(readFileSync2(path, "utf8"));
42665
+ const raw = JSON.parse(readFileSync3(path, "utf8"));
42629
42666
  return { name: raw.name, path, createdAt: raw.createdAt };
42630
42667
  } catch {
42631
42668
  return { name: f.replace(/\.json$/, ""), path, createdAt: "" };
@@ -42690,7 +42727,7 @@ function baselineUnset(name) {
42690
42727
 
42691
42728
  // src/commands/benchmark.ts
42692
42729
  import { writeFileSync as writeFileSync8 } from "node:fs";
42693
- import { join as join10 } from "node:path";
42730
+ import { join as join11 } from "node:path";
42694
42731
  import chalk5 from "chalk";
42695
42732
  import ora2 from "ora";
42696
42733
 
@@ -42699,7 +42736,7 @@ init_client();
42699
42736
 
42700
42737
  // src/migrate/assets.ts
42701
42738
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "node:fs";
42702
- import { join as join5 } from "node:path";
42739
+ import { join as join6 } from "node:path";
42703
42740
  function aggregateIcons(icons) {
42704
42741
  const byKey = new Map;
42705
42742
  for (const icon of icons) {
@@ -42839,7 +42876,7 @@ async function downloadTo(url, dir, name, fetchBytes) {
42839
42876
  return null;
42840
42877
  const ext = extFromUrlOrType(url, got.contentType);
42841
42878
  const file = `${name}${ext}`;
42842
- writeFileSync4(join5(dir, file), got.buf);
42879
+ writeFileSync4(join6(dir, file), got.buf);
42843
42880
  return `assets/${file}`;
42844
42881
  }
42845
42882
  function extFromUrlOrType(url, contentType) {
@@ -42861,7 +42898,7 @@ function extFromUrlOrType(url, contentType) {
42861
42898
  return "";
42862
42899
  }
42863
42900
  async function downloadSiteAssets(raw, runDir, fetchBytes) {
42864
- const dir = join5(runDir, "assets");
42901
+ const dir = join6(runDir, "assets");
42865
42902
  mkdirSync3(dir, { recursive: true });
42866
42903
  let logo = null;
42867
42904
  let logoSource = null;
@@ -42869,7 +42906,7 @@ async function downloadSiteAssets(raw, runDir, fetchBytes) {
42869
42906
  logoSource = raw.logo.url;
42870
42907
  logo = await downloadTo(raw.logo.url, dir, "logo", fetchBytes);
42871
42908
  } else if (raw.logo?.type === "svg") {
42872
- writeFileSync4(join5(dir, "logo.svg"), raw.logo.markup, "utf8");
42909
+ writeFileSync4(join6(dir, "logo.svg"), raw.logo.markup, "utf8");
42873
42910
  logo = "assets/logo.svg";
42874
42911
  logoSource = "inline-svg";
42875
42912
  }
@@ -42878,7 +42915,7 @@ async function downloadSiteAssets(raw, runDir, fetchBytes) {
42878
42915
  raw.appleTouchIcon ? downloadTo(raw.appleTouchIcon, dir, "apple-touch-icon", fetchBytes) : Promise.resolve(null),
42879
42916
  raw.ogImage ? downloadTo(raw.ogImage, dir, "og-image", fetchBytes) : Promise.resolve(null)
42880
42917
  ]);
42881
- const fontsDir = join5(dir, "fonts");
42918
+ const fontsDir = join6(dir, "fonts");
42882
42919
  mkdirSync3(fontsDir, { recursive: true });
42883
42920
  const fontFiles = [];
42884
42921
  for (const [i, url] of raw.fonts.entries()) {
@@ -42886,7 +42923,7 @@ async function downloadSiteAssets(raw, runDir, fetchBytes) {
42886
42923
  if (!got)
42887
42924
  continue;
42888
42925
  const base = safeFontName(url, i);
42889
- writeFileSync4(join5(fontsDir, base), got.buf);
42926
+ writeFileSync4(join6(fontsDir, base), got.buf);
42890
42927
  fontFiles.push(`assets/fonts/${base}`);
42891
42928
  }
42892
42929
  return {
@@ -43068,7 +43105,7 @@ function isLocalhost(rawUrl) {
43068
43105
  // src/engine/interactive-selector-prompt.ts
43069
43106
  init_client();
43070
43107
  import { execSync } from "node:child_process";
43071
- import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync5 } from "node:fs";
43108
+ import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync5 } from "node:fs";
43072
43109
  import { resolve } from "node:path";
43073
43110
  import { createInterface } from "node:readline";
43074
43111
  var forceDisabled = false;
@@ -43150,7 +43187,7 @@ function writeSelectorOverride(rcPath, key, value) {
43150
43187
  let current = {};
43151
43188
  if (existsSync4(rcPath)) {
43152
43189
  try {
43153
- const parsed = JSON.parse(readFileSync3(rcPath, "utf8"));
43190
+ const parsed = JSON.parse(readFileSync4(rcPath, "utf8"));
43154
43191
  if (parsed && typeof parsed === "object")
43155
43192
  current = parsed;
43156
43193
  } catch {
@@ -43244,7 +43281,7 @@ ${candidates.map((c, i) => `${i}. "${c.text}" → ${c.href}`).join(`
43244
43281
  }
43245
43282
 
43246
43283
  // src/learned/repo.ts
43247
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync4, renameSync, writeFileSync as writeFileSync6 } from "node:fs";
43284
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync6 } from "node:fs";
43248
43285
  import { dirname as dirname2 } from "node:path";
43249
43286
  import { z as z2 } from "zod";
43250
43287
  var SelectorKey = z2.enum([
@@ -43320,7 +43357,7 @@ function loadLearned(path = DEFAULT_PATH) {
43320
43357
  if (!existsSync5(path))
43321
43358
  return emptyLib();
43322
43359
  try {
43323
- const raw = JSON.parse(readFileSync4(path, "utf8"));
43360
+ const raw = JSON.parse(readFileSync5(path, "utf8"));
43324
43361
  return LearnedSelectors.parse(raw);
43325
43362
  } catch (err) {
43326
43363
  console.warn(`[learned] failed to parse ${path}: ${err.message}, starting fresh`);
@@ -46347,8 +46384,8 @@ async function validateAddToCart(page, ctx, cartCountBefore, beforeUrl) {
46347
46384
 
46348
46385
  // src/engine/lighthouse.ts
46349
46386
  import { spawn } from "node:child_process";
46350
- import { mkdirSync as mkdirSync5, readFileSync as readFileSync5 } from "node:fs";
46351
- import { join as join7, resolve as resolve2 } from "node:path";
46387
+ import { mkdirSync as mkdirSync5, readFileSync as readFileSync6 } from "node:fs";
46388
+ import { join as join8, resolve as resolve2 } from "node:path";
46352
46389
  var AGENT_A11Y_AUDIT_IDS = [
46353
46390
  "button-name",
46354
46391
  "link-name",
@@ -46436,7 +46473,7 @@ async function measureLighthouse(url, opts) {
46436
46473
  async function measureLighthouseOnce(url, opts, attempt) {
46437
46474
  const formFactor = opts.formFactor ?? "mobile";
46438
46475
  mkdirSync5(opts.outDir, { recursive: true });
46439
- const outPath = join7(opts.outDir, `${opts.id}-a${attempt}.json`);
46476
+ const outPath = join8(opts.outDir, `${opts.id}-a${attempt}.json`);
46440
46477
  const runTemp = resolve2(opts.outDir, `.tmp-${opts.id}-a${attempt}`);
46441
46478
  mkdirSync5(runTemp, { recursive: true });
46442
46479
  const args = [
@@ -46473,7 +46510,7 @@ async function measureLighthouseOnce(url, opts, attempt) {
46473
46510
  });
46474
46511
  let report;
46475
46512
  try {
46476
- report = JSON.parse(readFileSync5(outPath, "utf-8"));
46513
+ report = JSON.parse(readFileSync6(outPath, "utf-8"));
46477
46514
  } catch (err) {
46478
46515
  return {
46479
46516
  error: code !== 0 ? `lighthouse exit ${code}: ${stderr.slice(0, 200)}` : `parse failed: ${err.message}`
@@ -47706,14 +47743,14 @@ async function runSideBenchmarkContent(opts) {
47706
47743
  }
47707
47744
 
47708
47745
  // src/ignore/parser.ts
47709
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
47710
- import { join as join8 } from "node:path";
47746
+ import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
47747
+ import { join as join9 } from "node:path";
47711
47748
  function loadParityRc(cwd = process.cwd()) {
47712
- const path = join8(cwd, ".parityrc.json");
47749
+ const path = join9(cwd, ".parityrc.json");
47713
47750
  if (!existsSync6(path))
47714
47751
  return ParityRc.parse({});
47715
47752
  try {
47716
- const raw = JSON.parse(readFileSync6(path, "utf8"));
47753
+ const raw = JSON.parse(readFileSync7(path, "utf8"));
47717
47754
  return ParityRc.parse(raw);
47718
47755
  } catch (err) {
47719
47756
  console.warn(`[parity] failed to parse ${path}: ${err.message}`);
@@ -47721,11 +47758,11 @@ function loadParityRc(cwd = process.cwd()) {
47721
47758
  }
47722
47759
  }
47723
47760
  function loadParityIgnore(cwd = process.cwd()) {
47724
- const path = join8(cwd, ".parityignore");
47761
+ const path = join9(cwd, ".parityignore");
47725
47762
  if (!existsSync6(path))
47726
47763
  return ParityIgnore.parse({});
47727
47764
  try {
47728
- const raw = JSON.parse(readFileSync6(path, "utf8"));
47765
+ const raw = JSON.parse(readFileSync7(path, "utf8"));
47729
47766
  return ParityIgnore.parse(raw);
47730
47767
  } catch (err) {
47731
47768
  console.warn(`[parity] failed to parse ${path}: ${err.message}`);
@@ -47902,8 +47939,8 @@ init_client();
47902
47939
  init_client();
47903
47940
  init_html_compact();
47904
47941
  init_html_compact();
47905
- import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync7, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "node:fs";
47906
- import { join as join9 } from "node:path";
47942
+ import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync8, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "node:fs";
47943
+ import { join as join10 } from "node:path";
47907
47944
  import { z as z3 } from "zod";
47908
47945
  var CACHE_DIR = ".parity-cache";
47909
47946
  var CACHE_SCHEMA_VERSION = 1;
@@ -48170,7 +48207,7 @@ var PDP_MAX_CHARS = 9000;
48170
48207
  async function discoverSelectors(urls, html, opts = {}) {
48171
48208
  const host = safeHost(urls.home);
48172
48209
  const cacheDir = opts.cacheDir ?? CACHE_DIR;
48173
- const cachePath = join9(cacheDir, `selectors-${host}.json`);
48210
+ const cachePath = join10(cacheDir, `selectors-${host}.json`);
48174
48211
  const fingerprint = computeHtmlFingerprint(html.home);
48175
48212
  if (!opts.noCache && existsSync7(cachePath)) {
48176
48213
  const cached = readCacheEntry(cachePath, fingerprint);
@@ -48243,7 +48280,7 @@ function cacheTtlMs() {
48243
48280
  function readCacheEntry(cachePath, currentFingerprint) {
48244
48281
  let parsed;
48245
48282
  try {
48246
- parsed = JSON.parse(readFileSync7(cachePath, "utf8"));
48283
+ parsed = JSON.parse(readFileSync8(cachePath, "utf8"));
48247
48284
  } catch {
48248
48285
  console.warn(`[discover-selectors] cache corrompido em ${cachePath}; redescubrindo`);
48249
48286
  try {
@@ -48269,11 +48306,11 @@ function readCacheEntry(cachePath, currentFingerprint) {
48269
48306
  }
48270
48307
  function persistSelectorValidation(homeUrl, validated, cacheDir = CACHE_DIR) {
48271
48308
  const host = safeHost(homeUrl);
48272
- const cachePath = join9(cacheDir, `selectors-${host}.json`);
48309
+ const cachePath = join10(cacheDir, `selectors-${host}.json`);
48273
48310
  if (!existsSync7(cachePath))
48274
48311
  return;
48275
48312
  try {
48276
- const parsed = SelectorCacheEntrySchema.safeParse(JSON.parse(readFileSync7(cachePath, "utf8")));
48313
+ const parsed = SelectorCacheEntrySchema.safeParse(JSON.parse(readFileSync8(cachePath, "utf8")));
48277
48314
  if (!parsed.success)
48278
48315
  return;
48279
48316
  const entry = { ...parsed.data, validated };
@@ -48314,7 +48351,7 @@ function safeHost(url) {
48314
48351
  }
48315
48352
 
48316
48353
  // src/report/benchmark-html.ts
48317
- import { readFileSync as readFileSync8 } from "node:fs";
48354
+ import { readFileSync as readFileSync9 } from "node:fs";
48318
48355
  var MIME = {
48319
48356
  ".png": "image/png",
48320
48357
  ".jpg": "image/jpeg",
@@ -48329,7 +48366,7 @@ function dataUri(absPath) {
48329
48366
  const mime = MIME[ext];
48330
48367
  if (!mime)
48331
48368
  return null;
48332
- return `data:${mime};base64,${readFileSync8(absPath).toString("base64")}`;
48369
+ return `data:${mime};base64,${readFileSync9(absPath).toString("base64")}`;
48333
48370
  } catch {
48334
48371
  return null;
48335
48372
  }
@@ -48948,8 +48985,8 @@ async function benchmarkCommand(opts) {
48948
48985
  learned,
48949
48986
  platform,
48950
48987
  outDir: paths.screenshotsDir,
48951
- harPath: join10(paths.harDir, `user-navigation-benchmark-${viewport}-${side}.har`),
48952
- lighthouseDir: join10(paths.runDir, "lighthouse"),
48988
+ harPath: join11(paths.harDir, `user-navigation-benchmark-${viewport}-${side}.har`),
48989
+ lighthouseDir: join11(paths.runDir, "lighthouse"),
48953
48990
  warmupRuns,
48954
48991
  measuredRuns,
48955
48992
  paginations,
@@ -49072,7 +49109,7 @@ function printSummary2(report) {
49072
49109
  }
49073
49110
 
49074
49111
  // src/commands/cache.ts
49075
- import { existsSync as existsSync10, readFileSync as readFileSync12, writeFileSync as writeFileSync11 } from "node:fs";
49112
+ import { existsSync as existsSync10, readFileSync as readFileSync13, writeFileSync as writeFileSync11 } from "node:fs";
49076
49113
 
49077
49114
  // src/util/concurrency.ts
49078
49115
  async function runWithConcurrency(items, workers, fn) {
@@ -49088,7 +49125,7 @@ async function runWithConcurrency(items, workers, fn) {
49088
49125
  }
49089
49126
 
49090
49127
  // src/commands/cache.ts
49091
- import { join as join13 } from "node:path";
49128
+ import { join as join14 } from "node:path";
49092
49129
  import chalk6 from "chalk";
49093
49130
  import ora3 from "ora";
49094
49131
 
@@ -53838,10 +53875,10 @@ function skip6(start, summary) {
53838
53875
 
53839
53876
  // src/checks/visual-regression.ts
53840
53877
  import { existsSync as existsSync9, mkdirSync as mkdirSync8 } from "node:fs";
53841
- import { basename, join as join12 } from "node:path";
53878
+ import { basename, join as join13 } from "node:path";
53842
53879
 
53843
53880
  // src/diff/visual.ts
53844
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync9 } from "node:fs";
53881
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
53845
53882
  import pixelmatch from "pixelmatch";
53846
53883
  import { PNG } from "pngjs";
53847
53884
  var DEFAULTS = {
@@ -53850,8 +53887,8 @@ var DEFAULTS = {
53850
53887
  };
53851
53888
  function diffScreenshots(prodPath, candPath, heatmapPath, opts = {}) {
53852
53889
  const cfg = { ...DEFAULTS, ...opts };
53853
- const prod = PNG.sync.read(readFileSync9(prodPath));
53854
- const cand = PNG.sync.read(readFileSync9(candPath));
53890
+ const prod = PNG.sync.read(readFileSync10(prodPath));
53891
+ const cand = PNG.sync.read(readFileSync10(candPath));
53855
53892
  const width = Math.min(prod.width, cand.width);
53856
53893
  const height = Math.min(prod.height, cand.height);
53857
53894
  const prodCropped = cropPng(prod, width, height);
@@ -53895,7 +53932,7 @@ init_client();
53895
53932
 
53896
53933
  // src/llm/visual-semantic-diff.ts
53897
53934
  init_client();
53898
- import { readFileSync as readFileSync10 } from "node:fs";
53935
+ import { readFileSync as readFileSync11 } from "node:fs";
53899
53936
  import { PNG as PNG2 } from "pngjs";
53900
53937
  var MAX_HEIGHT = 8000;
53901
53938
  var LLM_PROMPT_VERSION = "v4-text-caution";
@@ -54074,7 +54111,7 @@ function pickSharedDownscaleFactor(images, maxBytes) {
54074
54111
  return MAX_DOWNSCALE_FACTOR;
54075
54112
  }
54076
54113
  function loadAndCropHeight(path, maxHeight = MAX_HEIGHT) {
54077
- const png = PNG2.sync.read(readFileSync10(path));
54114
+ const png = PNG2.sync.read(readFileSync11(path));
54078
54115
  return png.height <= maxHeight ? png : cropHeight(png, maxHeight);
54079
54116
  }
54080
54117
  function buildContextBlock(input) {
@@ -54201,26 +54238,26 @@ function partitionExpectedSections(sections, expected) {
54201
54238
 
54202
54239
  // src/checks/lib/parity-cache.ts
54203
54240
  import { createHash as createHash2 } from "node:crypto";
54204
- import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "node:fs";
54205
- import { dirname as dirname3, join as join11 } from "node:path";
54241
+ import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync12, writeFileSync as writeFileSync10 } from "node:fs";
54242
+ import { dirname as dirname3, join as join12 } from "node:path";
54206
54243
  function hashScreenshotPair(prodPath, candPath, promptVersion) {
54207
54244
  const h = createHash2("sha256");
54208
- h.update(readFileSync11(prodPath));
54245
+ h.update(readFileSync12(prodPath));
54209
54246
  h.update("|");
54210
- h.update(readFileSync11(candPath));
54247
+ h.update(readFileSync12(candPath));
54211
54248
  h.update("|");
54212
54249
  h.update(promptVersion);
54213
54250
  return h.digest("hex");
54214
54251
  }
54215
54252
  function cacheFilePath(cacheDir) {
54216
- return join11(cacheDir, "verdicts.json");
54253
+ return join12(cacheDir, "verdicts.json");
54217
54254
  }
54218
54255
  function readCache(cacheDir) {
54219
54256
  const file = cacheFilePath(cacheDir);
54220
54257
  if (!existsSync8(file))
54221
54258
  return {};
54222
54259
  try {
54223
- const raw = readFileSync11(file, "utf-8");
54260
+ const raw = readFileSync12(file, "utf-8");
54224
54261
  const parsed = JSON.parse(raw);
54225
54262
  if (parsed && typeof parsed === "object")
54226
54263
  return parsed;
@@ -54344,7 +54381,7 @@ async function visualRegressionKeyframes(ctx) {
54344
54381
  const start = Date.now();
54345
54382
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
54346
54383
  const issues = [];
54347
- const diffDir = join12(ctx.outDir, "screenshots");
54384
+ const diffDir = join13(ctx.outDir, "screenshots");
54348
54385
  if (!existsSync9(diffDir))
54349
54386
  mkdirSync8(diffDir, { recursive: true });
54350
54387
  const expectedDivergences = ctx.ignore.expectedDivergences ?? [];
@@ -54358,7 +54395,7 @@ async function visualRegressionKeyframes(ctx) {
54358
54395
  continue;
54359
54396
  }
54360
54397
  const heatmapName = `diff-${pair.viewport}-${basename(pair.key.replace(/[/:]/g, "_"))}.png`;
54361
- const heatmapPath = join12(diffDir, heatmapName);
54398
+ const heatmapPath = join13(diffDir, heatmapName);
54362
54399
  const preflightIssues = [];
54363
54400
  let pctDiff = 0;
54364
54401
  let heatmapWritten = false;
@@ -57106,7 +57143,7 @@ async function cacheCommand(opts) {
57106
57143
  writeRunReportJson(paths.runDir, run);
57107
57144
  const html = renderHtmlReport(run, paths.runDir);
57108
57145
  writeRunReportHtml(paths.runDir, html);
57109
- writeFileSync11(join13(paths.runDir, "cache.json"), `${JSON.stringify({
57146
+ writeFileSync11(join14(paths.runDir, "cache.json"), `${JSON.stringify({
57110
57147
  schemaVersion: "0.1",
57111
57148
  prodUrl: opts.prod,
57112
57149
  candUrl: opts.cand,
@@ -57167,7 +57204,7 @@ async function discoverPagePaths(prodUrl, opts, limit) {
57167
57204
  if (opts.urls.endsWith(".txt") || opts.urls.endsWith(".list") || opts.urls.startsWith("file:")) {
57168
57205
  const path = opts.urls.replace(/^file:\/\//, "");
57169
57206
  if (existsSync10(path)) {
57170
- return readFileSync12(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
57207
+ return readFileSync13(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
57171
57208
  }
57172
57209
  }
57173
57210
  return opts.urls.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
@@ -57215,8 +57252,8 @@ function printSummary3(check) {
57215
57252
  }
57216
57253
 
57217
57254
  // src/commands/cache-gap.ts
57218
- import { existsSync as existsSync11, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "node:fs";
57219
- import { join as join14 } from "node:path";
57255
+ import { existsSync as existsSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "node:fs";
57256
+ import { join as join15 } from "node:path";
57220
57257
  import chalk7 from "chalk";
57221
57258
  import ora4 from "ora";
57222
57259
 
@@ -57759,7 +57796,7 @@ async function cacheGapCommand(opts, probe = httpProbe) {
57759
57796
  segmentation,
57760
57797
  loaders: loadersOut
57761
57798
  };
57762
- writeFileSync12(join14(paths.runDir, "cache-probe.json"), `${JSON.stringify(artifact, null, 2)}
57799
+ writeFileSync12(join15(paths.runDir, "cache-probe.json"), `${JSON.stringify(artifact, null, 2)}
57763
57800
  `, "utf8");
57764
57801
  printSummary4(artifact);
57765
57802
  if (opts.json)
@@ -57783,7 +57820,7 @@ async function selectRoutes(opts) {
57783
57820
  if (max === 0)
57784
57821
  return [];
57785
57822
  if (opts.urls) {
57786
- const raw = existsSync11(opts.urls) ? readFileSync13(opts.urls, "utf8").split(`
57823
+ const raw = existsSync11(opts.urls) ? readFileSync14(opts.urls, "utf8").split(`
57787
57824
  `) : opts.urls.split(",");
57788
57825
  return raw.map((s) => s.trim()).filter(Boolean).slice(0, max);
57789
57826
  }
@@ -57890,12 +57927,12 @@ async function measureCell(urls, hit, concurrency, samples, settleMs) {
57890
57927
  function loadProbes(opts) {
57891
57928
  if (!opts.dir)
57892
57929
  return [];
57893
- const file = join14(opts.dir, ".deco", "blocks.gen.json");
57930
+ const file = join15(opts.dir, ".deco", "blocks.gen.json");
57894
57931
  if (!existsSync11(file)) {
57895
57932
  console.log(chalk7.yellow(` fase 3 pulada — ${file} não existe`));
57896
57933
  return [];
57897
57934
  }
57898
- return extractLoaderProps(JSON.parse(readFileSync13(file, "utf8")), opts.loaderLimit ?? 25);
57935
+ return extractLoaderProps(JSON.parse(readFileSync14(file, "utf8")), opts.loaderLimit ?? 25);
57899
57936
  }
57900
57937
  async function probeLoader(lp, base, hit, samples, concurrency, capBytes) {
57901
57938
  const url = new URL(`/deco/invoke/${lp.loaderKey}`, base).toString();
@@ -58036,7 +58073,7 @@ function printSummary4(a) {
58036
58073
  // src/commands/check.ts
58037
58074
  import { mkdtempSync } from "node:fs";
58038
58075
  import { tmpdir } from "node:os";
58039
- import { join as join15 } from "node:path";
58076
+ import { join as join16 } from "node:path";
58040
58077
  import chalk8 from "chalk";
58041
58078
  var SEVERITY_RANK4 = {
58042
58079
  critical: 0,
@@ -58093,7 +58130,7 @@ que o 'parity check' não roda.
58093
58130
  }
58094
58131
  const rc = loadParityRc();
58095
58132
  const ignore = loadParityIgnore();
58096
- const runDir = mkdtempSync(join15(tmpdir(), "parity-check-"));
58133
+ const runDir = mkdtempSync(join16(tmpdir(), "parity-check-"));
58097
58134
  const browser = await launchBrowser({ headless: true });
58098
58135
  const prodPages = [];
58099
58136
  const candPages = [];
@@ -58111,7 +58148,7 @@ que o 'parity check' não roda.
58111
58148
  url: fullUrl,
58112
58149
  side,
58113
58150
  viewport,
58114
- screenshotPath: join15(runDir, `${opts.name}-${viewport}-${side}.png`),
58151
+ screenshotPath: join16(runDir, `${opts.name}-${viewport}-${side}.png`),
58115
58152
  settleMs: 1200,
58116
58153
  timeoutMs: 25000,
58117
58154
  fast: true,
@@ -59531,8 +59568,8 @@ async function flowLogin(ctx) {
59531
59568
 
59532
59569
  // src/llm/resolve-search-terms.ts
59533
59570
  init_client();
59534
- import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "node:fs";
59535
- import { join as join16 } from "node:path";
59571
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync13 } from "node:fs";
59572
+ import { join as join17 } from "node:path";
59536
59573
  var CACHE_DIR2 = ".parity-cache";
59537
59574
  var FALLBACK_TERMS = ["produto", "preto", "promocao"];
59538
59575
  function makeNoResults(runId) {
@@ -59612,10 +59649,10 @@ async function resolveSearchTerms(url, html, opts = {}) {
59612
59649
  }
59613
59650
  const host = safeHost3(url);
59614
59651
  const cacheDir = opts.cacheDir ?? CACHE_DIR2;
59615
- const cachePath = join16(cacheDir, `search-terms-${host}.json`);
59652
+ const cachePath = join17(cacheDir, `search-terms-${host}.json`);
59616
59653
  if (!opts.noCache && existsSync12(cachePath)) {
59617
59654
  try {
59618
- const cached = JSON.parse(readFileSync14(cachePath, "utf8"));
59655
+ const cached = JSON.parse(readFileSync15(cachePath, "utf8"));
59619
59656
  if (cached.withResults?.trim()) {
59620
59657
  return { withResults: cached.withResults.trim(), noResults };
59621
59658
  }
@@ -61091,7 +61128,7 @@ import chalk15 from "chalk";
61091
61128
 
61092
61129
  // src/llm/section-understanding.ts
61093
61130
  init_client();
61094
- import { readFileSync as readFileSync15 } from "node:fs";
61131
+ import { readFileSync as readFileSync16 } from "node:fs";
61095
61132
  var SUMMARIZE_TOOL = {
61096
61133
  name: "summarize_understanding",
61097
61134
  description: "Return a single paragraph describing what you understood from the section diff signals. NO code — only diagnosis.",
@@ -61129,7 +61166,7 @@ async function invokeUnderstandingSummary(input) {
61129
61166
  return null;
61130
61167
  let markdown;
61131
61168
  try {
61132
- markdown = readFileSync15(input.markdownPath, "utf8");
61169
+ markdown = readFileSync16(input.markdownPath, "utf8");
61133
61170
  } catch (err) {
61134
61171
  console.error(`[section-understanding] failed to read markdown: ${err.message}`);
61135
61172
  return null;
@@ -61139,7 +61176,7 @@ async function invokeUnderstandingSummary(input) {
61139
61176
  if (!p)
61140
61177
  continue;
61141
61178
  try {
61142
- const buf = readFileSync15(p);
61179
+ const buf = readFileSync16(p);
61143
61180
  images.push({ base64: buf.toString("base64"), mediaType: "image/png" });
61144
61181
  } catch (err) {
61145
61182
  console.error(`[section-understanding] skipping image ${p}: ${err.message}`);
@@ -61418,11 +61455,11 @@ function collectCandidatesInPage() {
61418
61455
 
61419
61456
  // src/extract/exporters/json.ts
61420
61457
  import { writeFileSync as writeFileSync15 } from "node:fs";
61421
- import { join as join17 } from "node:path";
61458
+ import { join as join18 } from "node:path";
61422
61459
  var jsonExporter = {
61423
61460
  name: "json",
61424
61461
  async export(bundle, outDir) {
61425
- const path = join17(outDir, "manifest.json");
61462
+ const path = join18(outDir, "manifest.json");
61426
61463
  writeFileSync15(path, `${JSON.stringify(bundle, null, 2)}
61427
61464
  `, "utf8");
61428
61465
  }
@@ -61430,7 +61467,7 @@ var jsonExporter = {
61430
61467
 
61431
61468
  // src/extract/exporters/markdown.ts
61432
61469
  import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync16 } from "node:fs";
61433
- import { join as join18 } from "node:path";
61470
+ import { join as join19 } from "node:path";
61434
61471
 
61435
61472
  // src/extract/naming.ts
61436
61473
  function componentDirName(role, index) {
@@ -61444,13 +61481,13 @@ var markdownExporter = {
61444
61481
  async export(bundle, outDir) {
61445
61482
  const dirNames = bundle.components.map((c, i) => componentDirName(c.role, i + 1));
61446
61483
  const indexMd = renderIndex(bundle, dirNames);
61447
- writeFileSync16(join18(outDir, "index.md"), indexMd, "utf8");
61484
+ writeFileSync16(join19(outDir, "index.md"), indexMd, "utf8");
61448
61485
  bundle.components.forEach((component, i) => {
61449
61486
  const dirName = dirNames[i];
61450
- const componentDir = join18(outDir, "components", dirName);
61487
+ const componentDir = join19(outDir, "components", dirName);
61451
61488
  mkdirSync10(componentDir, { recursive: true });
61452
61489
  const readme = renderComponentReadme(bundle, component);
61453
- writeFileSync16(join18(componentDir, "README.md"), readme, "utf8");
61490
+ writeFileSync16(join19(componentDir, "README.md"), readme, "utf8");
61454
61491
  });
61455
61492
  }
61456
61493
  };
@@ -62255,12 +62292,12 @@ import * as diff from "diff";
62255
62292
  import prettier from "prettier";
62256
62293
 
62257
62294
  // src/diff/heatmap-regions.ts
62258
- import { readFileSync as readFileSync16 } from "node:fs";
62295
+ import { readFileSync as readFileSync17 } from "node:fs";
62259
62296
  import { PNG as PNG4 } from "pngjs";
62260
62297
  var DEFAULT_MAX_HOTSPOTS = 5;
62261
62298
  var DEFAULT_MIN_COMPONENT_PIXELS = 50;
62262
62299
  function analyzeHeatmapRegions(pngPath, opts = {}) {
62263
- const png = PNG4.sync.read(readFileSync16(pngPath));
62300
+ const png = PNG4.sync.read(readFileSync17(pngPath));
62264
62301
  return analyzeHeatmapBuffer(png.data, png.width, png.height, opts);
62265
62302
  }
62266
62303
  function analyzeHeatmapBuffer(data, width, height, opts = {}) {
@@ -62374,7 +62411,7 @@ function analyzeHeatmapBuffer(data, width, height, opts = {}) {
62374
62411
 
62375
62412
  // src/diff/section-bundle.ts
62376
62413
  import { writeFileSync as writeFileSync18 } from "node:fs";
62377
- import { basename as basename2, dirname as dirname4, join as join19, relative as relative3 } from "node:path";
62414
+ import { basename as basename2, dirname as dirname4, join as join20, relative as relative3 } from "node:path";
62378
62415
  function buildStyleDeltas(input) {
62379
62416
  const cs = input.computedStyles;
62380
62417
  if (!cs)
@@ -62418,11 +62455,11 @@ function assembleSectionDiffBundle(input) {
62418
62455
  boundingRects: styleResultsToRects(input.computedStyles),
62419
62456
  styleDeltas
62420
62457
  };
62421
- const jsonPath = join19(input.outDir, `${input.filePrefix}-bundle.json`);
62458
+ const jsonPath = join20(input.outDir, `${input.filePrefix}-bundle.json`);
62422
62459
  writeFileSync18(jsonPath, `${JSON.stringify(json, mapReplacer, 2)}
62423
62460
  `, "utf8");
62424
62461
  const markdown = renderMarkdownBundle(input, styleDeltas);
62425
- const markdownPath = join19(input.outDir, `${input.filePrefix}-prompt.md`);
62462
+ const markdownPath = join20(input.outDir, `${input.filePrefix}-prompt.md`);
62426
62463
  writeFileSync18(markdownPath, markdown, "utf8");
62427
62464
  const summary = oneLineSummary(input, styleDeltas);
62428
62465
  return { jsonPath, markdownPath, summary };
@@ -62603,8 +62640,8 @@ function capDiff(diff, maxLines) {
62603
62640
  }
62604
62641
 
62605
62642
  // src/migrate/plan.ts
62606
- import { existsSync as existsSync13, readFileSync as readFileSync17, writeFileSync as writeFileSync19 } from "node:fs";
62607
- import { join as join20 } from "node:path";
62643
+ import { existsSync as existsSync13, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "node:fs";
62644
+ import { join as join21 } from "node:path";
62608
62645
  function dedupe(names) {
62609
62646
  return [...new Set(names)];
62610
62647
  }
@@ -62729,13 +62766,13 @@ function mergePlanDecisions(fresh, previous) {
62729
62766
  var PLAN_FILE = "migration-plan.json";
62730
62767
  var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
62731
62768
  function loadPlan(dir) {
62732
- const p = join20(dir, PLAN_FILE);
62769
+ const p = join21(dir, PLAN_FILE);
62733
62770
  if (!existsSync13(p))
62734
62771
  return null;
62735
- return JSON.parse(readFileSync17(p, "utf8"));
62772
+ return JSON.parse(readFileSync18(p, "utf8"));
62736
62773
  }
62737
62774
  function savePlan(dir, plan) {
62738
- writeFileSync19(join20(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
62775
+ writeFileSync19(join21(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
62739
62776
  `, "utf8");
62740
62777
  }
62741
62778
  function setComponentStatus(plan, name, status, opts = {}) {
@@ -64627,7 +64664,7 @@ function formatPatch(patch) {
64627
64664
 
64628
64665
  // src/commands/journey.ts
64629
64666
  import { writeFileSync as writeFileSync20 } from "node:fs";
64630
- import { join as join21 } from "node:path";
64667
+ import { join as join22 } from "node:path";
64631
64668
  import chalk17 from "chalk";
64632
64669
  import ora7 from "ora";
64633
64670
  init_client();
@@ -64697,7 +64734,7 @@ async function journeyCommand(opts) {
64697
64734
  };
64698
64735
  async function runOneSide(browserInstance, viewport, side) {
64699
64736
  const baseUrl = side === "prod" ? opts.prod : opts.cand;
64700
- const tracePath = join21(paths.tracesDir, `${viewport}-${side}.zip`);
64737
+ const tracePath = join22(paths.tracesDir, `${viewport}-${side}.zip`);
64701
64738
  const ctx = await newContext(browserInstance, {
64702
64739
  viewport,
64703
64740
  tracesDir: paths.tracesDir,
@@ -65268,7 +65305,7 @@ function listCommand(output) {
65268
65305
  }
65269
65306
 
65270
65307
  // src/commands/migrate.ts
65271
- import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync22, writeFileSync as writeFileSync25 } from "node:fs";
65308
+ import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync23, writeFileSync as writeFileSync25 } from "node:fs";
65272
65309
  import { resolve as resolve6 } from "node:path";
65273
65310
  import chalk20 from "chalk";
65274
65311
  import open from "open";
@@ -65338,22 +65375,22 @@ async function nodeFetchText(url) {
65338
65375
 
65339
65376
  // src/migrate/exporters/json.ts
65340
65377
  import { writeFileSync as writeFileSync21 } from "node:fs";
65341
- import { join as join22 } from "node:path";
65378
+ import { join as join23 } from "node:path";
65342
65379
  var jsonExporter2 = {
65343
65380
  name: "json",
65344
65381
  async export(bundle, outDir) {
65345
- writeFileSync21(join22(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
65382
+ writeFileSync21(join23(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
65346
65383
  `, "utf8");
65347
65384
  }
65348
65385
  };
65349
65386
 
65350
65387
  // src/migrate/exporters/markdown.ts
65351
65388
  import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync23 } from "node:fs";
65352
- import { join as join24 } from "node:path";
65389
+ import { join as join25 } from "node:path";
65353
65390
 
65354
65391
  // src/migrate/vtex/content-assets.ts
65355
65392
  import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync22 } from "node:fs";
65356
- import { join as join23 } from "node:path";
65393
+ import { join as join24 } from "node:path";
65357
65394
  var MAX_IMAGES = 150;
65358
65395
  var IMG_EXT = /\.(jpe?g|png|webp|gif|svg|avif)(\?|#|$)/i;
65359
65396
  var VTEX_ASSET = /vtexassets\.com|vteximg\.com\.br|\/arquivos\/(ids|assets)\//i;
@@ -65462,7 +65499,7 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
65462
65499
  const map = {};
65463
65500
  if (urls.length === 0)
65464
65501
  return { map, downloaded: 0, skipped: 0 };
65465
- const dir = join23(runDir, "assets", "content");
65502
+ const dir = join24(runDir, "assets", "content");
65466
65503
  mkdirSync14(dir, { recursive: true });
65467
65504
  const used = new Set;
65468
65505
  const take = urls.slice(0, MAX_IMAGES);
@@ -65472,7 +65509,7 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
65472
65509
  if (!got)
65473
65510
  continue;
65474
65511
  const name = contentImageName(url, i, used);
65475
- writeFileSync22(join23(dir, name), got.buf);
65512
+ writeFileSync22(join24(dir, name), got.buf);
65476
65513
  map[url] = `assets/content/${name}`;
65477
65514
  downloaded++;
65478
65515
  }
@@ -65487,16 +65524,16 @@ var markdownExporter2 = {
65487
65524
  const notes = [];
65488
65525
  bundle.components.forEach((component, i) => {
65489
65526
  const dirName = dirNames[i];
65490
- const componentDir = join24(outDir, "components", dirName);
65527
+ const componentDir = join25(outDir, "components", dirName);
65491
65528
  mkdirSync15(componentDir, { recursive: true });
65492
65529
  const compact = compactComponentHtml(component.html);
65493
65530
  if (compact.collapsed > 0)
65494
65531
  notes.push(`\`${dirName}\`: collapsed ${compact.collapsed} repeated child element(s)`);
65495
65532
  if (compact.truncated)
65496
65533
  notes.push(`\`${dirName}\`: HTML truncated to fit the per-component token ceiling`);
65497
- writeFileSync23(join24(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
65534
+ writeFileSync23(join25(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
65498
65535
  });
65499
- writeFileSync23(join24(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
65536
+ writeFileSync23(join25(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
65500
65537
  }
65501
65538
  };
65502
65539
  function renderIndex2(bundle, notes) {
@@ -65698,8 +65735,8 @@ function escapePipes2(s) {
65698
65735
  }
65699
65736
 
65700
65737
  // src/migrate/exporters/html.ts
65701
- import { readFileSync as readFileSync18, writeFileSync as writeFileSync24 } from "node:fs";
65702
- import { join as join25 } from "node:path";
65738
+ import { readFileSync as readFileSync19, writeFileSync as writeFileSync24 } from "node:fs";
65739
+ import { join as join26 } from "node:path";
65703
65740
 
65704
65741
  // src/migrate/targets/faststore-v4.ts
65705
65742
  function pickBreakpointTiers(breakpoints) {
@@ -66020,9 +66057,9 @@ var TARGET_NAMES = Object.keys(TARGETS);
66020
66057
  var htmlExporter = {
66021
66058
  name: "html",
66022
66059
  async export(bundle, outDir) {
66023
- writeFileSync24(join25(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
66024
- const inline = (p) => p ? dataUri2(join25(outDir, p)) ?? p : null;
66025
- writeFileSync24(join25(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
66060
+ writeFileSync24(join26(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
66061
+ const inline = (p) => p ? dataUri2(join26(outDir, p)) ?? p : null;
66062
+ writeFileSync24(join26(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
66026
66063
  }
66027
66064
  };
66028
66065
  var MIME2 = {
@@ -66040,7 +66077,7 @@ function dataUri2(absPath) {
66040
66077
  const mime = MIME2[ext];
66041
66078
  if (!mime)
66042
66079
  return null;
66043
- return `data:${mime};base64,${readFileSync18(absPath).toString("base64")}`;
66080
+ return `data:${mime};base64,${readFileSync19(absPath).toString("base64")}`;
66044
66081
  } catch {
66045
66082
  return null;
66046
66083
  }
@@ -66289,12 +66326,12 @@ function buildMigrationPrompt(bundle, playbook, source) {
66289
66326
  }
66290
66327
 
66291
66328
  // src/migrate/sources/deco-fresh.ts
66292
- import { existsSync as existsSync14, readFileSync as readFileSync19 } from "node:fs";
66293
- import { join as join27 } from "node:path";
66329
+ import { existsSync as existsSync14, readFileSync as readFileSync20 } from "node:fs";
66330
+ import { join as join28 } from "node:path";
66294
66331
 
66295
66332
  // src/migrate/sources/walk.ts
66296
66333
  import { readdirSync as readdirSync3 } from "node:fs";
66297
- import { join as join26 } from "node:path";
66334
+ import { join as join27 } from "node:path";
66298
66335
  var SKIP = new Set([
66299
66336
  "node_modules",
66300
66337
  ".git",
@@ -66321,7 +66358,7 @@ function walkFiles(dir, exts) {
66321
66358
  continue;
66322
66359
  const childRel = rel ? `${rel}/${e.name}` : e.name;
66323
66360
  if (e.isDirectory()) {
66324
- recurse(join26(abs, e.name), childRel);
66361
+ recurse(join27(abs, e.name), childRel);
66325
66362
  } else if (exts.some((ext) => e.name.endsWith(ext))) {
66326
66363
  out.push(childRel);
66327
66364
  }
@@ -66333,15 +66370,15 @@ function walkFiles(dir, exts) {
66333
66370
 
66334
66371
  // src/migrate/sources/deco-fresh.ts
66335
66372
  function isDecoFresh(repoDir) {
66336
- const denoJson = join27(repoDir, "deno.json");
66337
- const denoJsonc = join27(repoDir, "deno.jsonc");
66373
+ const denoJson = join28(repoDir, "deno.json");
66374
+ const denoJsonc = join28(repoDir, "deno.jsonc");
66338
66375
  const file = existsSync14(denoJson) ? denoJson : existsSync14(denoJsonc) ? denoJsonc : null;
66339
66376
  if (!file)
66340
66377
  return false;
66341
- if (!existsSync14(join27(repoDir, "fresh.gen.ts")))
66378
+ if (!existsSync14(join28(repoDir, "fresh.gen.ts")))
66342
66379
  return false;
66343
66380
  try {
66344
- return readFileSync19(file, "utf8").includes("@deco/deco");
66381
+ return readFileSync20(file, "utf8").includes("@deco/deco");
66345
66382
  } catch {
66346
66383
  return false;
66347
66384
  }
@@ -66349,13 +66386,13 @@ function isDecoFresh(repoDir) {
66349
66386
  var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
66350
66387
  function inventory(repoDir) {
66351
66388
  const components = [];
66352
- const sectionsDir = join27(repoDir, "sections");
66389
+ const sectionsDir = join28(repoDir, "sections");
66353
66390
  if (existsSync14(sectionsDir)) {
66354
66391
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
66355
66392
  const key = rel.replace(/\.tsx$/, "");
66356
66393
  components.push({
66357
66394
  name: key,
66358
- file: join27("sections", rel),
66395
+ file: join28("sections", rel),
66359
66396
  role: "section",
66360
66397
  scope: GLOBAL_HINT.test(key) ? "global" : "page"
66361
66398
  });
@@ -66364,9 +66401,9 @@ function inventory(repoDir) {
66364
66401
  const notes = [
66365
66402
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
66366
66403
  ];
66367
- if (existsSync14(join27(repoDir, "islands")))
66404
+ if (existsSync14(join28(repoDir, "islands")))
66368
66405
  notes.push("Has islands/ — client-interactive components.");
66369
- if (existsSync14(join27(repoDir, "loaders")))
66406
+ if (existsSync14(join28(repoDir, "loaders")))
66370
66407
  notes.push("Has loaders/ — server data functions to port.");
66371
66408
  return { components, notes };
66372
66409
  }
@@ -66406,14 +66443,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
66406
66443
  };
66407
66444
 
66408
66445
  // src/migrate/sources/vtex-io.ts
66409
- import { existsSync as existsSync15, readFileSync as readFileSync20 } from "node:fs";
66410
- import { join as join28 } from "node:path";
66446
+ import { existsSync as existsSync15, readFileSync as readFileSync21 } from "node:fs";
66447
+ import { join as join29 } from "node:path";
66411
66448
  function readManifest(repoDir) {
66412
- const file = join28(repoDir, "manifest.json");
66449
+ const file = join29(repoDir, "manifest.json");
66413
66450
  if (!existsSync15(file))
66414
66451
  return null;
66415
66452
  try {
66416
- return JSON.parse(readFileSync20(file, "utf8"));
66453
+ return JSON.parse(readFileSync21(file, "utf8"));
66417
66454
  } catch {
66418
66455
  return null;
66419
66456
  }
@@ -66434,14 +66471,14 @@ function blockName(id) {
66434
66471
  }
66435
66472
  var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
66436
66473
  function inventory2(repoDir) {
66437
- const blocksDir = join28(repoDir, "store", "blocks");
66474
+ const blocksDir = join29(repoDir, "store", "blocks");
66438
66475
  const seen = new Map;
66439
66476
  if (existsSync15(blocksDir)) {
66440
66477
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
66441
- const abs = join28(blocksDir, rel);
66478
+ const abs = join29(blocksDir, rel);
66442
66479
  let parsed;
66443
66480
  try {
66444
- parsed = JSON.parse(stripJsonc(readFileSync20(abs, "utf8")));
66481
+ parsed = JSON.parse(stripJsonc(readFileSync21(abs, "utf8")));
66445
66482
  } catch {
66446
66483
  continue;
66447
66484
  }
@@ -66451,7 +66488,7 @@ function inventory2(repoDir) {
66451
66488
  continue;
66452
66489
  seen.set(name, {
66453
66490
  name,
66454
- file: join28("store", "blocks", rel),
66491
+ file: join29("store", "blocks", rel),
66455
66492
  role: "section",
66456
66493
  scope: GLOBAL_HINT2.test(name) ? "global" : "page"
66457
66494
  });
@@ -66486,7 +66523,7 @@ CMS placeholders.`
66486
66523
 
66487
66524
  // src/migrate/sources/find.ts
66488
66525
  import { existsSync as existsSync16, readdirSync as readdirSync4, statSync } from "node:fs";
66489
- import { basename as basename3, join as join29, resolve as resolve5 } from "node:path";
66526
+ import { basename as basename3, join as join30, resolve as resolve5 } from "node:path";
66490
66527
  var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
66491
66528
  var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
66492
66529
  var IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", ".next", "_archive"]);
@@ -66559,7 +66596,7 @@ function findSourceCandidates(opts) {
66559
66596
  for (const entry of entries) {
66560
66597
  if (IGNORED_DIRS.has(entry) || entry.startsWith("."))
66561
66598
  continue;
66562
- const dir = join29(root, entry);
66599
+ const dir = join30(root, entry);
66563
66600
  if (seen.has(dir) || excluded.has(dir) || !isDir(dir))
66564
66601
  continue;
66565
66602
  seen.add(dir);
@@ -66573,9 +66610,9 @@ function findSourceCandidates(opts) {
66573
66610
  }
66574
66611
  function defaultSearchRoots(opts = {}) {
66575
66612
  const cwd = opts.cwd ?? process.cwd();
66576
- const roots = [join29(cwd, ".."), join29(cwd, "..", "..")];
66613
+ const roots = [join30(cwd, ".."), join30(cwd, "..", "..")];
66577
66614
  if (opts.targetDir)
66578
- roots.push(join29(opts.targetDir, ".."), join29(opts.targetDir, "..", ".."));
66615
+ roots.push(join30(opts.targetDir, ".."), join30(opts.targetDir, "..", ".."));
66579
66616
  return [...new Set(roots.map((r) => resolve5(r)))];
66580
66617
  }
66581
66618
  function formatSourceHunt(result) {
@@ -66607,8 +66644,8 @@ function formatSourceHunt(result) {
66607
66644
  `);
66608
66645
  }
66609
66646
  // src/migrate/sources/project.ts
66610
- import { existsSync as existsSync17, readFileSync as readFileSync21, readdirSync as readdirSync5 } from "node:fs";
66611
- import { join as join30 } from "node:path";
66647
+ import { existsSync as existsSync17, readFileSync as readFileSync22, readdirSync as readdirSync5 } from "node:fs";
66648
+ import { join as join31 } from "node:path";
66612
66649
  var MAX_PROPS_CHARS = 4000;
66613
66650
  var MAX_PAGES = 60;
66614
66651
  var MAX_SECTIONS_PER_PAGE = 40;
@@ -66679,10 +66716,10 @@ function classifyImports(source, fromFile) {
66679
66716
  };
66680
66717
  }
66681
66718
  function readComponentDetail(repoDir, file) {
66682
- const abs = join30(repoDir, file);
66719
+ const abs = join31(repoDir, file);
66683
66720
  let source;
66684
66721
  try {
66685
- source = readFileSync21(abs, "utf8");
66722
+ source = readFileSync22(abs, "utf8");
66686
66723
  } catch {
66687
66724
  return null;
66688
66725
  }
@@ -66705,10 +66742,10 @@ var TOKEN_CANDIDATES = [
66705
66742
  "styles/configs/color.json"
66706
66743
  ];
66707
66744
  function findTokenFiles(repoDir) {
66708
- return TOKEN_CANDIDATES.filter((f) => existsSync17(join30(repoDir, f)));
66745
+ return TOKEN_CANDIDATES.filter((f) => existsSync17(join31(repoDir, f)));
66709
66746
  }
66710
66747
  function readDecoPages(repoDir) {
66711
- const blocksDir = join30(repoDir, ".deco", "blocks");
66748
+ const blocksDir = join31(repoDir, ".deco", "blocks");
66712
66749
  if (!existsSync17(blocksDir))
66713
66750
  return { pages: [], total: 0 };
66714
66751
  let files;
@@ -66723,7 +66760,7 @@ function readDecoPages(repoDir) {
66723
66760
  break;
66724
66761
  let parsed;
66725
66762
  try {
66726
- parsed = JSON.parse(readFileSync21(join30(blocksDir, file), "utf8"));
66763
+ parsed = JSON.parse(readFileSync22(join31(blocksDir, file), "utf8"));
66727
66764
  } catch {
66728
66765
  continue;
66729
66766
  }
@@ -67812,7 +67849,7 @@ function printResults4(runDir, bundle) {
67812
67849
  }
67813
67850
  function readJson(path) {
67814
67851
  try {
67815
- return JSON.parse(readFileSync22(path, "utf8"));
67852
+ return JSON.parse(readFileSync23(path, "utf8"));
67816
67853
  } catch {
67817
67854
  return null;
67818
67855
  }
@@ -67855,7 +67892,7 @@ function isValidUrl4(s) {
67855
67892
  }
67856
67893
 
67857
67894
  // src/commands/plan.ts
67858
- import { readFileSync as readFileSync23 } from "node:fs";
67895
+ import { readFileSync as readFileSync24 } from "node:fs";
67859
67896
  import chalk21 from "chalk";
67860
67897
  var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
67861
67898
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
@@ -68131,12 +68168,12 @@ ${chalk21.bold("no page")} ${chalk21.gray("(in the code, not seen on any sampled
68131
68168
  if (opts.board === "studio") {
68132
68169
  const cfg = studioConfigFromEnv();
68133
68170
  if (!cfg) {
68134
- console.log(chalk21.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
68171
+ console.log(chalk21.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68135
68172
  `));
68136
68173
  return 0;
68137
68174
  }
68138
68175
  try {
68139
- const fixes = opts.fixes ? JSON.parse(readFileSync23(opts.fixes, "utf8")) : undefined;
68176
+ const fixes = opts.fixes ? JSON.parse(readFileSync24(opts.fixes, "utf8")) : undefined;
68140
68177
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
68141
68178
  let stored = 0;
68142
68179
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -68162,7 +68199,7 @@ async function planNotesCommand(dir, opts) {
68162
68199
  }
68163
68200
  const cfg = studioConfigFromEnv();
68164
68201
  if (!cfg) {
68165
- console.error(chalk21.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
68202
+ console.error(chalk21.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68166
68203
  return 1;
68167
68204
  }
68168
68205
  if (opts.post) {
@@ -68240,13 +68277,13 @@ function planTouchCommand(dir, page, opts) {
68240
68277
  }
68241
68278
 
68242
68279
  // src/commands/pr.ts
68243
- import { existsSync as existsSync22, readFileSync as readFileSync26, writeFileSync as writeFileSync26 } from "node:fs";
68244
- import { join as join33 } from "node:path";
68280
+ import { existsSync as existsSync22, readFileSync as readFileSync27, writeFileSync as writeFileSync26 } from "node:fs";
68281
+ import { join as join34 } from "node:path";
68245
68282
  import chalk24 from "chalk";
68246
68283
 
68247
68284
  // src/commands/run.ts
68248
- import { existsSync as existsSync21, readFileSync as readFileSync25, unlinkSync as unlinkSync3 } from "node:fs";
68249
- import { join as join32 } from "node:path";
68285
+ import { existsSync as existsSync21, readFileSync as readFileSync26, unlinkSync as unlinkSync3 } from "node:fs";
68286
+ import { join as join33 } from "node:path";
68250
68287
  import chalk23 from "chalk";
68251
68288
  import ora8 from "ora";
68252
68289
 
@@ -68839,9 +68876,9 @@ import { existsSync as existsSync20 } from "node:fs";
68839
68876
  import chalk22 from "chalk";
68840
68877
 
68841
68878
  // src/server/proxy-server.ts
68842
- import { existsSync as existsSync19, readFileSync as readFileSync24, statSync as statSync2 } from "node:fs";
68879
+ import { existsSync as existsSync19, readFileSync as readFileSync25, statSync as statSync2 } from "node:fs";
68843
68880
  import { createServer } from "node:http";
68844
- import { extname, join as join31, normalize as normalize3, resolve as resolve7, sep } from "node:path";
68881
+ import { extname, join as join32, normalize as normalize3, resolve as resolve7, sep } from "node:path";
68845
68882
  var MIME3 = {
68846
68883
  ".html": "text/html; charset=utf-8",
68847
68884
  ".css": "text/css; charset=utf-8",
@@ -68949,13 +68986,13 @@ async function handleRequest(req, res, runDir) {
68949
68986
  return serveStatic(res, runDir, path);
68950
68987
  }
68951
68988
  function serveReportHtml(res, runDir) {
68952
- const filePath = join31(runDir, "report.html");
68989
+ const filePath = join32(runDir, "report.html");
68953
68990
  if (!existsSync19(filePath)) {
68954
68991
  res.statusCode = 404;
68955
68992
  res.end("report.html not found");
68956
68993
  return;
68957
68994
  }
68958
- const html = readFileSync24(filePath, "utf8");
68995
+ const html = readFileSync25(filePath, "utf8");
68959
68996
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
68960
68997
  const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
68961
68998
  res.statusCode = 200;
@@ -68986,7 +69023,7 @@ function serveStatic(res, runDir, path) {
68986
69023
  res.statusCode = 200;
68987
69024
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
68988
69025
  res.setHeader("cache-control", "no-store");
68989
- res.end(readFileSync24(filePath));
69026
+ res.end(readFileSync25(filePath));
68990
69027
  }
68991
69028
  async function proxyRequest(req, res, targetUrl, opts = {}) {
68992
69029
  let target;
@@ -69305,7 +69342,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
69305
69342
  var SCORE_BAND_RUNS = 4;
69306
69343
  function readRunChecks(reportPath) {
69307
69344
  try {
69308
- const raw = JSON.parse(readFileSync25(reportPath, "utf8"));
69345
+ const raw = JSON.parse(readFileSync26(reportPath, "utf8"));
69309
69346
  return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
69310
69347
  } catch {
69311
69348
  return [];
@@ -69429,7 +69466,7 @@ async function runCommand(rawOpts) {
69429
69466
  }
69430
69467
  const ignore = loadParityIgnore();
69431
69468
  if (opts.clearCache) {
69432
- const cacheFile = join32(opts.output, "cache", "verdicts.json");
69469
+ const cacheFile = join33(opts.output, "cache", "verdicts.json");
69433
69470
  if (existsSync21(cacheFile)) {
69434
69471
  try {
69435
69472
  unlinkSync3(cacheFile);
@@ -69626,8 +69663,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69626
69663
  const traceEnabled = process.env.PARITY_TRACE === "1";
69627
69664
  const runOneSide = async (viewport, side) => {
69628
69665
  const baseUrl = side === "prod" ? opts.prod : opts.cand;
69629
- const harPath = join32(paths.harDir, `${viewport}-${side}.har`);
69630
- const tracePath = traceEnabled ? join32(paths.tracesDir, `${viewport}-${side}.zip`) : null;
69666
+ const harPath = join33(paths.harDir, `${viewport}-${side}.har`);
69667
+ const tracePath = traceEnabled ? join33(paths.tracesDir, `${viewport}-${side}.zip`) : null;
69631
69668
  const ctx = await newContext(browser, {
69632
69669
  viewport,
69633
69670
  harPath,
@@ -69949,7 +69986,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69949
69986
  setSpinnerLabel("Rodando checks…");
69950
69987
  spinner.start();
69951
69988
  const checksHb = attachSpinnerHeartbeat(spinner, { baseText: "Rodando checks…" });
69952
- const cacheDir = join32(opts.output, "cache");
69989
+ const cacheDir = join33(opts.output, "cache");
69953
69990
  const checkCtx = {
69954
69991
  prodPages: allPageCaptures.filter((p) => p.side === "prod"),
69955
69992
  candPages: allPageCaptures.filter((p) => p.side === "cand"),
@@ -70167,7 +70204,7 @@ function resolveExplicitPages(pagesFile, pagesList) {
70167
70204
  if (!existsSync21(pagesFile)) {
70168
70205
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
70169
70206
  }
70170
- const raw = readFileSync25(pagesFile, "utf-8");
70207
+ const raw = readFileSync26(pagesFile, "utf-8");
70171
70208
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
70172
70209
  for (const line of lines)
70173
70210
  validatePageEntry(line, [], true);
@@ -70408,12 +70445,12 @@ async function prCommand(opts) {
70408
70445
  return runCode || 1;
70409
70446
  }
70410
70447
  const latest = runs[0];
70411
- const reportJsonPath = join33(opts.output, "runs", latest.id, "report.json");
70448
+ const reportJsonPath = join34(opts.output, "runs", latest.id, "report.json");
70412
70449
  if (!existsSync22(reportJsonPath)) {
70413
70450
  console.error(chalk24.red(`report.json not found at ${reportJsonPath}`));
70414
70451
  return runCode || 1;
70415
70452
  }
70416
- const run = JSON.parse(readFileSync26(reportJsonPath, "utf8"));
70453
+ const run = JSON.parse(readFileSync27(reportJsonPath, "utf8"));
70417
70454
  const markdown = buildPrComment(run, opts);
70418
70455
  if (opts.out) {
70419
70456
  writeFileSync26(opts.out, markdown, "utf8");
@@ -70515,8 +70552,8 @@ function promptCommand(runId, opts) {
70515
70552
  }
70516
70553
 
70517
70554
  // src/commands/report.ts
70518
- import { existsSync as existsSync24, readFileSync as readFileSync27, writeFileSync as writeFileSync28 } from "node:fs";
70519
- import { join as join34 } from "node:path";
70555
+ import { existsSync as existsSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync28 } from "node:fs";
70556
+ import { join as join35 } from "node:path";
70520
70557
  import chalk26 from "chalk";
70521
70558
  import open2 from "open";
70522
70559
 
@@ -71113,7 +71150,7 @@ async function reportCommand(runId, opts) {
71113
71150
  return 1;
71114
71151
  }
71115
71152
  const html = renderDeckHtml(buildDeckModel(run), opts.lang ?? "en");
71116
- const dest = opts.out ?? join34(paths.runDir, "deck.html");
71153
+ const dest = opts.out ?? join35(paths.runDir, "deck.html");
71117
71154
  writeFileSync28(dest, html, "utf8");
71118
71155
  console.log(`${chalk26.green("✓")} deck → ${dest}`);
71119
71156
  if (opts.open) {
@@ -71149,7 +71186,7 @@ async function reportCommand(runId, opts) {
71149
71186
  console.error(chalk26.red(`report.html not found at ${paths.reportHtml}`));
71150
71187
  return 1;
71151
71188
  }
71152
- const html = readFileSync27(paths.reportHtml, "utf8");
71189
+ const html = readFileSync28(paths.reportHtml, "utf8");
71153
71190
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
71154
71191
  if (slice === null) {
71155
71192
  console.error(chalk26.red(`section "${opts.section}" not present in this report`));
@@ -71171,10 +71208,10 @@ import chalk27 from "chalk";
71171
71208
 
71172
71209
  // src/events.ts
71173
71210
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
71174
- import { dirname as dirname5, join as join35 } from "node:path";
71211
+ import { dirname as dirname5, join as join36 } from "node:path";
71175
71212
  function emitEvent(dir, type, data = {}) {
71176
71213
  try {
71177
- const file = join35(dir, "events.jsonl");
71214
+ const file = join36(dir, "events.jsonl");
71178
71215
  mkdirSync17(dirname5(file), { recursive: true });
71179
71216
  const event = { ts: new Date().toISOString(), type, ...data };
71180
71217
  appendFileSync(file, `${JSON.stringify(event)}
@@ -71206,7 +71243,7 @@ function eventCommand(type, opts) {
71206
71243
  }
71207
71244
 
71208
71245
  // src/commands/bench.ts
71209
- import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync28, writeFileSync as writeFileSync29 } from "node:fs";
71246
+ import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync29, writeFileSync as writeFileSync29 } from "node:fs";
71210
71247
  import { resolve as resolve9 } from "node:path";
71211
71248
  import chalk28 from "chalk";
71212
71249
 
@@ -71647,7 +71684,7 @@ async function benchCommand(opts) {
71647
71684
  return 2;
71648
71685
  }
71649
71686
  try {
71650
- props = JSON.parse(readFileSync28(opts.props, "utf8"));
71687
+ props = JSON.parse(readFileSync29(opts.props, "utf8"));
71651
71688
  } catch (err) {
71652
71689
  console.error(chalk28.red(`--props não é JSON válido: ${err.message}`));
71653
71690
  return 2;
@@ -71985,24 +72022,24 @@ import { resolve as resolve14 } from "node:path";
71985
72022
  import chalk30 from "chalk";
71986
72023
 
71987
72024
  // src/server/cockpit.ts
71988
- import { readFileSync as readFileSync33 } from "node:fs";
72025
+ import { readFileSync as readFileSync34 } from "node:fs";
71989
72026
  import { createServer as createServer2 } from "node:http";
71990
- import { dirname as dirname7, join as join40, resolve as resolve13 } from "node:path";
72027
+ import { dirname as dirname7, join as join41, resolve as resolve13 } from "node:path";
71991
72028
 
71992
72029
  // src/server/cockpit-actions.ts
71993
72030
  import { spawn as spawn3 } from "node:child_process";
71994
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync30, readdirSync as readdirSync6, writeFileSync as writeFileSync31 } from "node:fs";
71995
- import { join as join37, resolve as resolve11 } from "node:path";
72031
+ import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync31, readdirSync as readdirSync6, writeFileSync as writeFileSync31 } from "node:fs";
72032
+ import { join as join38, resolve as resolve11 } from "node:path";
71996
72033
 
71997
72034
  // src/server/cockpit-settings.ts
71998
- import { execFileSync as execFileSync2 } from "node:child_process";
71999
- import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync29, writeFileSync as writeFileSync30 } from "node:fs";
72000
- import { homedir as homedir2 } from "node:os";
72001
- import { join as join36, resolve as resolve10 } from "node:path";
72002
- var FILE = () => join36(process.env.PARITY_HOME ?? join36(homedir2(), ".parity"), "config.json");
72035
+ import { execFileSync as execFileSync3 } from "node:child_process";
72036
+ import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync30, writeFileSync as writeFileSync30 } from "node:fs";
72037
+ import { homedir as homedir3 } from "node:os";
72038
+ import { join as join37, resolve as resolve10 } from "node:path";
72039
+ var FILE = () => join37(process.env.PARITY_HOME ?? join37(homedir3(), ".parity"), "config.json");
72003
72040
  function readAll() {
72004
72041
  try {
72005
- return JSON.parse(readFileSync29(FILE(), "utf8"));
72042
+ return JSON.parse(readFileSync30(FILE(), "utf8"));
72006
72043
  } catch {
72007
72044
  return {};
72008
72045
  }
@@ -72023,14 +72060,14 @@ function saveSettings(planDir, next) {
72023
72060
  ...all.migrations ?? {},
72024
72061
  [resolve10(planDir)]: { ...getSettings(planDir), ...next }
72025
72062
  };
72026
- mkdirSync19(join36(FILE(), ".."), { recursive: true });
72063
+ mkdirSync19(join37(FILE(), ".."), { recursive: true });
72027
72064
  writeFileSync30(FILE(), JSON.stringify(all, null, 2));
72028
72065
  chmodSync(FILE(), 384);
72029
72066
  return getSettings(planDir);
72030
72067
  }
72031
72068
  var run = (cmd, args, env) => {
72032
72069
  try {
72033
- return execFileSync2(cmd, args, {
72070
+ return execFileSync3(cmd, args, {
72034
72071
  encoding: "utf8",
72035
72072
  timeout: 20000,
72036
72073
  stdio: ["ignore", "pipe", "pipe"],
@@ -72160,7 +72197,7 @@ var COMPONENT_STATUSES = [
72160
72197
  var PAGE_STATUSES2 = ["pending", "code", "done", "skipped"];
72161
72198
  function readState(planDir) {
72162
72199
  try {
72163
- return JSON.parse(readFileSync30(join37(planDir, "migration.json"), "utf8"));
72200
+ return JSON.parse(readFileSync31(join38(planDir, "migration.json"), "utf8"));
72164
72201
  } catch {
72165
72202
  return null;
72166
72203
  }
@@ -72265,11 +72302,11 @@ function setComponentSelector(planDir, name, selector) {
72265
72302
  return c;
72266
72303
  }
72267
72304
  function captured(planDir, host, name) {
72268
- const file = join37(planDir, host, "capture.json");
72305
+ const file = join38(planDir, host, "capture.json");
72269
72306
  if (!existsSync27(file))
72270
72307
  return null;
72271
72308
  try {
72272
- const cap = JSON.parse(readFileSync30(file, "utf8"));
72309
+ const cap = JSON.parse(readFileSync31(file, "utf8"));
72273
72310
  const rows = Array.isArray(cap.components) ? cap.components : [];
72274
72311
  return rows.find((r) => r.role === name || r.name === name) ?? null;
72275
72312
  } catch {
@@ -72318,9 +72355,9 @@ function componentShot(planDir, name) {
72318
72355
  }
72319
72356
  const cap = captured(planDir, host, name);
72320
72357
  const p = typeof cap?.screenshotPath === "string" ? cap.screenshotPath : null;
72321
- if (!p || !resolve11(p).startsWith(resolve11(join37(planDir, host))))
72358
+ if (!p || !resolve11(p).startsWith(resolve11(join38(planDir, host))))
72322
72359
  return null;
72323
- return existsSync27(p) ? readFileSync30(p) : null;
72360
+ return existsSync27(p) ? readFileSync31(p) : null;
72324
72361
  }
72325
72362
  function setPage(planDir, path, status) {
72326
72363
  if (!PAGE_STATUSES2.includes(status)) {
@@ -72335,7 +72372,7 @@ function setPage(planDir, path, status) {
72335
72372
  savePlan(planDir, plan);
72336
72373
  return p;
72337
72374
  }
72338
- var jobsDir = (planDir) => join37(planDir, "jobs");
72375
+ var jobsDir = (planDir) => join38(planDir, "jobs");
72339
72376
  function lastJob(planDir, kind) {
72340
72377
  const dir = jobsDir(planDir);
72341
72378
  if (!existsSync27(dir))
@@ -72343,8 +72380,8 @@ function lastJob(planDir, kind) {
72343
72380
  const id = readdirSync6(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72344
72381
  if (!id)
72345
72382
  return null;
72346
- const j = join37(dir, id);
72347
- const read = (f) => existsSync27(join37(j, f)) ? readFileSync30(join37(j, f), "utf8") : null;
72383
+ const j = join38(dir, id);
72384
+ const read = (f) => existsSync27(join38(j, f)) ? readFileSync31(join38(j, f), "utf8") : null;
72348
72385
  const exit = read("exit");
72349
72386
  const pid = Number(read("pid") ?? 0);
72350
72387
  let alive = false;
@@ -72376,25 +72413,25 @@ function startReindex(planDir) {
72376
72413
  throw new Error("no prod URL in migration.json or the plan");
72377
72414
  const target = state?.target?.name ?? plan?.target?.name;
72378
72415
  const id = `reindex-${new Date().toISOString().replace(/[-:T]/g, "").slice(0, 14)}`;
72379
- const dir = join37(jobsDir(planDir), id);
72416
+ const dir = join38(jobsDir(planDir), id);
72380
72417
  mkdirSync20(dir, { recursive: true });
72381
- writeFileSync31(join37(jobsDir(planDir), ".gitignore"), `*
72418
+ writeFileSync31(join38(jobsDir(planDir), ".gitignore"), `*
72382
72419
  `);
72383
- writeFileSync31(join37(dir, "started"), new Date().toISOString());
72420
+ writeFileSync31(join38(dir, "started"), new Date().toISOString());
72384
72421
  const host = new URL(url).host;
72385
72422
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
72386
72423
  const cli = `${q(process.execPath)} ${q(resolve11(process.argv[1] ?? ""))}`;
72387
- const out = join37(dir, "capture");
72424
+ const out = join38(dir, "capture");
72388
72425
  const sh = [
72389
72426
  `${cli} capture --url ${q(url)}${target ? ` --target ${q(target)}` : ""} --out ${q(out)} --refresh`,
72390
- `${cli} plan merge ${q(join37(out, host))} --dir ${q(resolve11(planDir))}`
72427
+ `${cli} plan merge ${q(join38(out, host))} --dir ${q(resolve11(planDir))}`
72391
72428
  ].join(" && ");
72392
- const child = spawn3("sh", ["-c", `(${sh}) > ${q(join37(dir, "log"))} 2>&1; echo $? > ${q(join37(dir, "exit"))}`], {
72429
+ const child = spawn3("sh", ["-c", `(${sh}) > ${q(join38(dir, "log"))} 2>&1; echo $? > ${q(join38(dir, "exit"))}`], {
72393
72430
  detached: true,
72394
72431
  stdio: "ignore"
72395
72432
  });
72396
72433
  child.unref();
72397
- writeFileSync31(join37(dir, "pid"), String(child.pid ?? ""));
72434
+ writeFileSync31(join38(dir, "pid"), String(child.pid ?? ""));
72398
72435
  return lastJob(planDir, "reindex");
72399
72436
  }
72400
72437
  function remoteUrl(dir) {
@@ -72403,14 +72440,14 @@ function remoteUrl(dir) {
72403
72440
  }
72404
72441
 
72405
72442
  // src/server/cockpit-api.ts
72406
- import { existsSync as existsSync28, readFileSync as readFileSync31, readdirSync as readdirSync7 } from "node:fs";
72407
- import { join as join38 } from "node:path";
72443
+ import { existsSync as existsSync28, readFileSync as readFileSync32, readdirSync as readdirSync7 } from "node:fs";
72444
+ import { join as join39 } from "node:path";
72408
72445
  var notFound = (what) => ({ status: 404, body: { error: what } });
72409
72446
  function readJson2(path) {
72410
72447
  if (!existsSync28(path))
72411
72448
  return null;
72412
72449
  try {
72413
- return JSON.parse(readFileSync31(path, "utf8"));
72450
+ return JSON.parse(readFileSync32(path, "utf8"));
72414
72451
  } catch {
72415
72452
  return null;
72416
72453
  }
@@ -72429,7 +72466,7 @@ function listBenchResults(benchDir) {
72429
72466
  }
72430
72467
  const out = [];
72431
72468
  for (const file of files) {
72432
- const raw = readJson2(join38(benchDir, file));
72469
+ const raw = readJson2(join39(benchDir, file));
72433
72470
  if (!raw?.component)
72434
72471
  continue;
72435
72472
  out.push({
@@ -72454,11 +72491,11 @@ function cockpitApi(path, params, ctx) {
72454
72491
  benchDir: ctx.benchDir,
72455
72492
  prodUrl: ctx.prodUrl ?? null,
72456
72493
  candUrl: ctx.candUrl ?? null,
72457
- hasPlan: existsSync28(join38(ctx.planDir, "migration-plan.json"))
72494
+ hasPlan: existsSync28(join39(ctx.planDir, "migration-plan.json"))
72458
72495
  }
72459
72496
  };
72460
72497
  case "/api/state": {
72461
- const state = readJson2(join38(ctx.planDir, "migration.json"));
72498
+ const state = readJson2(join39(ctx.planDir, "migration.json"));
72462
72499
  return state ? { status: 200, body: state } : notFound("no migration.json — no migration has been started here");
72463
72500
  }
72464
72501
  case "/api/plan": {
@@ -72533,7 +72570,7 @@ function cockpitApi(path, params, ctx) {
72533
72570
  if (file.includes("/") || file.includes("\\") || !/^bench-[\w.-]+\.json$/.test(file)) {
72534
72571
  return { status: 400, body: { error: "bad file name" } };
72535
72572
  }
72536
- const raw = readJson2(join38(ctx.benchDir, file));
72573
+ const raw = readJson2(join39(ctx.benchDir, file));
72537
72574
  return raw ? { status: 200, body: raw } : notFound(`no bench result ${file}`);
72538
72575
  }
72539
72576
  default:
@@ -73020,13 +73057,13 @@ async function loadRun() {
73020
73057
  `;
73021
73058
 
73022
73059
  // src/server/cockpit-tasks.ts
73023
- import { execFileSync as execFileSync3, spawn as spawn4 } from "node:child_process";
73060
+ import { execFileSync as execFileSync4, spawn as spawn4 } from "node:child_process";
73024
73061
  import { randomUUID } from "node:crypto";
73025
73062
  import {
73026
73063
  appendFileSync as appendFileSync2,
73027
73064
  existsSync as existsSync29,
73028
73065
  mkdirSync as mkdirSync21,
73029
- readFileSync as readFileSync32,
73066
+ readFileSync as readFileSync33,
73030
73067
  readdirSync as readdirSync8,
73031
73068
  realpathSync,
73032
73069
  renameSync as renameSync2,
@@ -73036,7 +73073,7 @@ import {
73036
73073
  unlinkSync as unlinkSync4,
73037
73074
  writeFileSync as writeFileSync32
73038
73075
  } from "node:fs";
73039
- import { dirname as dirname6, join as join39, resolve as resolve12 } from "node:path";
73076
+ import { dirname as dirname6, join as join40, resolve as resolve12 } from "node:path";
73040
73077
  import { fileURLToPath } from "node:url";
73041
73078
  var VIEWPORT = {
73042
73079
  mobile: { width: 412, height: 839 },
@@ -73045,18 +73082,18 @@ var VIEWPORT = {
73045
73082
  };
73046
73083
  var MOBILE_UA2 = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1";
73047
73084
  var STALL_MS = Number(process.env.PARITY_STALL_MS ?? 10 * 60000);
73048
- var tasksDir = (planDir) => join39(planDir, "tasks");
73049
- var taskDir = (planDir, id) => join39(tasksDir(planDir), id);
73085
+ var tasksDir = (planDir) => join40(planDir, "tasks");
73086
+ var taskDir = (planDir, id) => join40(tasksDir(planDir), id);
73050
73087
  function validTaskId(id) {
73051
73088
  return /^[\w-]{6,64}$/.test(id);
73052
73089
  }
73053
73090
  function pluginDir() {
73054
73091
  const root = resolve12(dirname6(fileURLToPath(import.meta.url)), "../../../..");
73055
- return existsSync29(join39(root, ".claude-plugin", "plugin.json")) ? root : null;
73092
+ return existsSync29(join40(root, ".claude-plugin", "plugin.json")) ? root : null;
73056
73093
  }
73057
73094
  function targetDir(planDir) {
73058
73095
  try {
73059
- const state = JSON.parse(readFileSync32(join39(planDir, "migration.json"), "utf8"));
73096
+ const state = JSON.parse(readFileSync33(join40(planDir, "migration.json"), "utf8"));
73060
73097
  if (typeof state?.target?.dir === "string" && existsSync29(state.target.dir))
73061
73098
  return state.target.dir;
73062
73099
  } catch {}
@@ -73096,7 +73133,7 @@ async function capture(task, dir) {
73096
73133
  await page.waitForTimeout(2500);
73097
73134
  const el = page.locator(selector).first();
73098
73135
  await el.scrollIntoViewIfNeeded({ timeout: 8000 });
73099
- const file = join39(dir, `${side}.png`);
73136
+ const file = join40(dir, `${side}.png`);
73100
73137
  await el.screenshot({ path: file, timeout: 1e4 });
73101
73138
  shots[side] = file;
73102
73139
  } catch (err) {
@@ -73146,15 +73183,15 @@ function locateSource(html, root) {
73146
73183
  for (const e of entries) {
73147
73184
  if (e.isDirectory()) {
73148
73185
  if (!SKIP_DIRS.has(e.name) && !e.name.startsWith("."))
73149
- walk(join39(dir, e.name), depth + 1);
73186
+ walk(join40(dir, e.name), depth + 1);
73150
73187
  continue;
73151
73188
  }
73152
73189
  const stem = e.name.split(".")[0] ?? "";
73153
73190
  if (!mods.has(stem))
73154
73191
  continue;
73155
- const file = join39(dir, e.name);
73192
+ const file = join40(dir, e.name);
73156
73193
  if (/\.(s?css|less)$/.test(e.name)) {
73157
- const lines = readFileSync32(file, "utf8").split(`
73194
+ const lines = readFileSync33(file, "utf8").split(`
73158
73195
  `);
73159
73196
  for (const local of mods.get(stem) ?? []) {
73160
73197
  const leaf = local.split("__").pop() ?? local;
@@ -73166,7 +73203,7 @@ function locateSource(html, root) {
73166
73203
  }
73167
73204
  }
73168
73205
  };
73169
- walk(existsSync29(join39(root, "src")) ? join39(root, "src") : root, 0);
73206
+ walk(existsSync29(join40(root, "src")) ? join40(root, "src") : root, 0);
73170
73207
  return hits;
73171
73208
  }
73172
73209
  function grid(s) {
@@ -73268,7 +73305,7 @@ function contextLines(task, dir) {
73268
73305
  ${diff.map((k) => ` ${k}: ${prod.styles[k]} → ${cand.styles[k]}`).join(`
73269
73306
  `)}` : "- Computed styles: no difference in the tracked properties (the difference is in children or content).");
73270
73307
  }
73271
- out.push(`- Full measurements (styles, children, HTML of both sides): ${join39(dir, "context.json")}`);
73308
+ out.push(`- Full measurements (styles, children, HTML of both sides): ${join40(dir, "context.json")}`);
73272
73309
  return out;
73273
73310
  }
73274
73311
  function deliveryRule(planDir, task) {
@@ -73300,7 +73337,7 @@ function prompt(task, planDir, dir) {
73300
73337
  const other = task.side === "prod" ? "cand" : "prod";
73301
73338
  return [
73302
73339
  "You are the parity migration orchestrator. Load the `parity:migration-orchestrator` skill and follow its rules (dispatch, never work inline; shell goes through `runner`).",
73303
- `The migration state is in ${join39(resolve12(planDir), "migration.json")}.`,
73340
+ `The migration state is in ${join40(resolve12(planDir), "migration.json")}.`,
73304
73341
  "",
73305
73342
  "A reviewer left this note in the parity cockpit. Treat it as ONE scoped fix round for this element only — not a full migration pass.",
73306
73343
  `- Note: ${JSON.stringify(task.text)}`,
@@ -73316,7 +73353,7 @@ function prompt(task, planDir, dir) {
73316
73353
  "",
73317
73354
  "Steps:",
73318
73355
  `0. Reproduce first, against the DEPLOYED cand (no build needed): have \`runner\` run \`parity section --task '${dir}' --box-tree --computed-styles --screenshot --json\`. If it shows no difference in what the note is about, STOP: report ok:false, qa:"not-run", summary "does not reproduce" plus what was measured — do not dispatch a fixer. Chromium is not Safari: when the note could be engine- or device-specific (icons, SVG sprites, vh, a phone or tablet), also reproduce with \`parity ios --prod … --cand … --selector … --cand-selector … --device "iPad Pro 13-inch (M5)"\` (or an iPhone) before concluding it does not reproduce.`,
73319
- existsSync29(join39(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join39(dir, "sizes.md")} (prod = target, cand = now, plus the source file and CSS rule). Dispatch \`fixer\` DIRECTLY with the note, sizes.md, context.json, the screenshots, and the TARGET repo's conventions.rules + gates from migration.json. Do not dispatch \`briefer\` — sizes.md is the brief.` : `1. Nothing was measured. Dispatch \`briefer\` first (note, screenshots, target dir; out: ${join39(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
73356
+ existsSync29(join40(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join40(dir, "sizes.md")} (prod = target, cand = now, plus the source file and CSS rule). Dispatch \`fixer\` DIRECTLY with the note, sizes.md, context.json, the screenshots, and the TARGET repo's conventions.rules + gates from migration.json. Do not dispatch \`briefer\` — sizes.md is the brief.` : `1. Nothing was measured. Dispatch \`briefer\` first (note, screenshots, target dir; out: ${join40(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
73320
73357
  " Tell the fixer, verbatim: (a) hit the prod column's numbers at this viewport; do not re-measure from the screenshots; (b) do not start dev servers or browsers — qa verifies the render; (c) if dependencies are missing run the target's install once in the worktree, never look in other directories; (d) run only the configured gates.",
73321
73358
  `2. ONE preview server for the whole task, at http://localhost:${previewPort(task.id)}: after the fixer commits, have \`runner\` build the worktree once and start it there with the target's own build/start (see its AGENTS.md). Reuse it for every QA round; after a new commit, rebuild and restart that same one — never a second server, never on another port. Each agent building and starting its own cost dozens of commands per round.`,
73322
73359
  "3. Dispatch `qa` to verify this element against prod at the same viewport, using sizes.md (or brief.md) as the acceptance criteria. Hand it the pair and the command — do not let it rediscover selectors or start servers:",
@@ -73329,7 +73366,7 @@ function prompt(task, planDir, dir) {
73329
73366
  }
73330
73367
  function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73331
73368
  const repo = targetDir(planDir);
73332
- const git = (...a) => execFileSync3("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 90000 }).trim();
73369
+ const git = (...a) => execFileSync4("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 90000 }).trim();
73333
73370
  try {
73334
73371
  try {
73335
73372
  git("fetch", "origin", "--quiet");
@@ -73343,12 +73380,12 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73343
73380
  }
73344
73381
  }
73345
73382
  const sha = git("rev-parse", ref);
73346
- const wt = join39(dir, "wt");
73383
+ const wt = join40(dir, "wt");
73347
73384
  git("worktree", "add", "-b", branch, wt, sha);
73348
73385
  const locks = ["package.json", "yarn.lock", "bun.lock", "package-lock.json", "pnpm-lock.yaml"];
73349
73386
  const sameDeps = (() => {
73350
73387
  try {
73351
- execFileSync3("git", ["-C", repo, "diff", "--quiet", "HEAD", sha, "--", ...locks], {
73388
+ execFileSync4("git", ["-C", repo, "diff", "--quiet", "HEAD", sha, "--", ...locks], {
73352
73389
  timeout: 1e4
73353
73390
  });
73354
73391
  return true;
@@ -73356,8 +73393,8 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73356
73393
  return false;
73357
73394
  }
73358
73395
  })();
73359
- if (sameDeps && existsSync29(join39(repo, "node_modules")) && !existsSync29(join39(wt, "node_modules"))) {
73360
- symlinkSync(join39(repo, "node_modules"), join39(wt, "node_modules"));
73396
+ if (sameDeps && existsSync29(join40(repo, "node_modules")) && !existsSync29(join40(wt, "node_modules"))) {
73397
+ symlinkSync(join40(repo, "node_modules"), join40(wt, "node_modules"));
73361
73398
  }
73362
73399
  return { worktree: wt, branch, base: { ref, sha } };
73363
73400
  } catch (err) {
@@ -73370,7 +73407,7 @@ function sweepShell(worktree) {
73370
73407
  return `d=$(cd ${q(worktree)} 2>/dev/null && pwd -P); if [ -n "$d" ] && [ "$d" != "/" ]; then lsof -d cwd -Fpn 2>/dev/null | awk -v d="$d/" '/^p/{p=substr($0,2)} /^n/{n=substr($0,2)"/"; if(index(n,d)==1) print p}' | while read p; do kill "$p" 2>/dev/null; done; fi`;
73371
73408
  }
73372
73409
  function launch(task, planDir, dir, resume) {
73373
- const promptFile = resume?.promptFile ?? join39(dir, "prompt.md");
73410
+ const promptFile = resume?.promptFile ?? join40(dir, "prompt.md");
73374
73411
  if (!resume)
73375
73412
  writeFileSync32(promptFile, prompt(task, planDir, dir));
73376
73413
  const plugin = pluginDir();
@@ -73389,7 +73426,7 @@ function launch(task, planDir, dir, resume) {
73389
73426
  ].filter(Boolean);
73390
73427
  const out = resume ? ">>" : ">";
73391
73428
  const sweep = task.worktree ? `; ${sweepShell(task.worktree)}` : "";
73392
- const sh = `${args.join(" ")} ${out} ${q(join39(dir, "stream.jsonl"))} 2> ${q(join39(dir, "stderr.log"))}; code=$?${sweep}; echo $code > ${q(join39(dir, "exit"))}`;
73429
+ const sh = `${args.join(" ")} ${out} ${q(join40(dir, "stream.jsonl"))} 2> ${q(join40(dir, "stderr.log"))}; code=$?${sweep}; echo $code > ${q(join40(dir, "exit"))}`;
73393
73430
  task.cwd ??= task.worktree ?? targetDir(planDir);
73394
73431
  const child = spawn4("sh", ["-c", sh], {
73395
73432
  env: { ...process.env, ...ghEnv(effectiveSettings(planDir, targetDir(planDir)).githubUser) },
@@ -73430,39 +73467,39 @@ function retryTask(planDir, id, note) {
73430
73467
  note ? `The reviewer adds: ${JSON.stringify(note)}` : "",
73431
73468
  `Preview: ONE server for this task at http://localhost:${previewPort(task.id)} — reuse it if it is already up, rebuild and restart it only after a new commit; never a second one. QA: ${qaCommand(task, dir)}`,
73432
73469
  "Before any new fix, if it was never shown that the difference reproduces on the deployed cand, reproduce it first with `parity section --task` (no build); if it does not, stop and say so.",
73433
- `Same rules as ${join39(dir, "prompt.md")}, and this delivery rule:`,
73470
+ `Same rules as ${join40(dir, "prompt.md")}, and this delivery rule:`,
73434
73471
  deliveryRule(planDir, task)
73435
73472
  ].filter(Boolean);
73436
- const promptFile = join39(dir, `prompt-${n}.md`);
73473
+ const promptFile = join40(dir, `prompt-${n}.md`);
73437
73474
  writeFileSync32(promptFile, lines.join(`
73438
73475
  `));
73439
- if (existsSync29(join39(dir, "stderr.log")))
73440
- renameSync2(join39(dir, "stderr.log"), join39(dir, `stderr-${n - 1}.log`));
73441
- if (existsSync29(join39(dir, "exit")))
73442
- unlinkSync4(join39(dir, "exit"));
73443
- if (existsSync29(join39(dir, "stopped")))
73444
- unlinkSync4(join39(dir, "stopped"));
73476
+ if (existsSync29(join40(dir, "stderr.log")))
73477
+ renameSync2(join40(dir, "stderr.log"), join40(dir, `stderr-${n - 1}.log`));
73478
+ if (existsSync29(join40(dir, "exit")))
73479
+ unlinkSync4(join40(dir, "exit"));
73480
+ if (existsSync29(join40(dir, "stopped")))
73481
+ unlinkSync4(join40(dir, "stopped"));
73445
73482
  task.attempts = [
73446
73483
  ...task.attempts ?? [],
73447
73484
  { at: new Date().toISOString(), reason: d.reason ?? d.status, ...note ? { note } : {} }
73448
73485
  ];
73449
73486
  task.cwd ??= targetDir(planDir);
73450
- appendFileSync2(join39(dir, "stream.jsonl"), `${JSON.stringify({ type: "parity", subtype: "attempt", n, at: new Date().toISOString() })}
73487
+ appendFileSync2(join40(dir, "stream.jsonl"), `${JSON.stringify({ type: "parity", subtype: "attempt", n, at: new Date().toISOString() })}
73451
73488
  `);
73452
73489
  task.pid = launch(task, planDir, dir, { promptFile });
73453
- writeFileSync32(join39(dir, "task.json"), JSON.stringify(task, null, 2));
73490
+ writeFileSync32(join40(dir, "task.json"), JSON.stringify(task, null, 2));
73454
73491
  return task;
73455
73492
  }
73456
73493
  async function createTask(planDir, note) {
73457
73494
  const id = `${new Date().toISOString().replace(/[-:T]/g, "").slice(0, 14)}-${randomUUID().slice(0, 6)}`;
73458
73495
  const dir = taskDir(planDir, id);
73459
73496
  mkdirSync21(dir, { recursive: true });
73460
- writeFileSync32(join39(tasksDir(planDir), ".gitignore"), `*
73497
+ writeFileSync32(join40(tasksDir(planDir), ".gitignore"), `*
73461
73498
  `);
73462
73499
  if (note.context) {
73463
- writeFileSync32(join39(dir, "context.json"), JSON.stringify(note.context, null, 2));
73500
+ writeFileSync32(join40(dir, "context.json"), JSON.stringify(note.context, null, 2));
73464
73501
  const sources = note.context.cand ? locateSource(note.context.cand.html, targetDir(planDir)) : [];
73465
- writeFileSync32(join39(dir, "sizes.md"), sizesMarkdown(note, sources));
73502
+ writeFileSync32(join40(dir, "sizes.md"), sizesMarkdown(note, sources));
73466
73503
  }
73467
73504
  const task = {
73468
73505
  ...note,
@@ -73471,7 +73508,7 @@ async function createTask(planDir, note) {
73471
73508
  sessionId: randomUUID(),
73472
73509
  shots: { prod: null, cand: null }
73473
73510
  };
73474
- const save = () => writeFileSync32(join39(dir, "task.json"), JSON.stringify(task, null, 2));
73511
+ const save = () => writeFileSync32(join40(dir, "task.json"), JSON.stringify(task, null, 2));
73475
73512
  save();
73476
73513
  (async () => {
73477
73514
  try {
@@ -73501,7 +73538,7 @@ function taskProcesses(worktree) {
73501
73538
  return hit.list;
73502
73539
  const pids = [];
73503
73540
  try {
73504
- const out = execFileSync3("lsof", ["-d", "cwd", "-Fpn"], {
73541
+ const out = execFileSync4("lsof", ["-d", "cwd", "-Fpn"], {
73505
73542
  encoding: "utf8",
73506
73543
  timeout: 5000,
73507
73544
  maxBuffer: 33554432
@@ -73518,7 +73555,7 @@ function taskProcesses(worktree) {
73518
73555
  const list = [];
73519
73556
  for (const pid of [...new Set(pids)]) {
73520
73557
  try {
73521
- const [rss, ...cmd] = execFileSync3("ps", ["-o", "rss=,command=", "-p", String(pid)], {
73558
+ const [rss, ...cmd] = execFileSync4("ps", ["-o", "rss=,command=", "-p", String(pid)], {
73522
73559
  encoding: "utf8"
73523
73560
  }).trim().split(/\s+/);
73524
73561
  list.push({
@@ -73533,18 +73570,18 @@ function taskProcesses(worktree) {
73533
73570
  }
73534
73571
  function stopTask(planDir, id) {
73535
73572
  const dir = taskDir(planDir, id);
73536
- const file = join39(dir, "task.json");
73573
+ const file = join40(dir, "task.json");
73537
73574
  if (!existsSync29(file))
73538
73575
  throw new Error("no such task");
73539
- const task = JSON.parse(readFileSync32(file, "utf8"));
73576
+ const task = JSON.parse(readFileSync33(file, "utf8"));
73540
73577
  let stopped = 0;
73541
- if (task.pid && alive(task.pid) && !existsSync29(join39(dir, "exit"))) {
73578
+ if (task.pid && alive(task.pid) && !existsSync29(join40(dir, "exit"))) {
73542
73579
  try {
73543
73580
  process.kill(-task.pid, "SIGTERM");
73544
73581
  stopped += 1;
73545
73582
  } catch {}
73546
- writeFileSync32(join39(dir, "stopped"), new Date().toISOString());
73547
- writeFileSync32(join39(dir, "exit"), `143
73583
+ writeFileSync32(join40(dir, "stopped"), new Date().toISOString());
73584
+ writeFileSync32(join40(dir, "exit"), `143
73548
73585
  `);
73549
73586
  }
73550
73587
  procCache.delete(task.worktree ?? "");
@@ -73616,7 +73653,7 @@ function prPlan(planDir, id, baseOverride) {
73616
73653
  const cut = task.base?.sha ?? null;
73617
73654
  const git = (...a) => {
73618
73655
  try {
73619
- return execFileSync3("git", ["-C", task.worktree, ...a], {
73656
+ return execFileSync4("git", ["-C", task.worktree, ...a], {
73620
73657
  encoding: "utf8",
73621
73658
  timeout: 1e4
73622
73659
  }).trim();
@@ -73648,10 +73685,10 @@ function openPr(planDir, id, baseOverride) {
73648
73685
  if (!plan.commits.length)
73649
73686
  throw new Error("the branch has no commits of its own");
73650
73687
  const dir = taskDir(planDir, id);
73651
- const task = JSON.parse(readFileSync32(join39(dir, "task.json"), "utf8"));
73688
+ const task = JSON.parse(readFileSync33(join40(dir, "task.json"), "utf8"));
73652
73689
  const wt = task.worktree;
73653
73690
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73654
- const git = (...a) => execFileSync3("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
73691
+ const git = (...a) => execFileSync4("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
73655
73692
  git("fetch", "origin", plan.base);
73656
73693
  if (task.base?.sha && plan.rebase) {
73657
73694
  try {
@@ -73683,9 +73720,9 @@ function openPr(planDir, id, baseOverride) {
73683
73720
  ...plan.commits.map((c) => `- ${c}`)
73684
73721
  ].join(`
73685
73722
  `);
73686
- const bodyFile = join39(dir, "pr-body.md");
73723
+ const bodyFile = join40(dir, "pr-body.md");
73687
73724
  writeFileSync32(bodyFile, body);
73688
- const out = execFileSync3("gh", [
73725
+ const out = execFileSync4("gh", [
73689
73726
  "pr",
73690
73727
  "create",
73691
73728
  "--repo",
@@ -73701,14 +73738,14 @@ function openPr(planDir, id, baseOverride) {
73701
73738
  ], { encoding: "utf8", timeout: 60000, env, cwd: wt }).trim();
73702
73739
  const url = out.split(`
73703
73740
  `).find((l) => l.startsWith("https://")) ?? out;
73704
- writeFileSync32(join39(dir, "pr.json"), JSON.stringify({ checkedAt: Date.now(), url }));
73741
+ writeFileSync32(join40(dir, "pr.json"), JSON.stringify({ checkedAt: Date.now(), url }));
73705
73742
  return { url, created: true };
73706
73743
  }
73707
73744
  function autoOpenPrs(planDir) {
73708
73745
  for (const t of listTasks2(planDir)) {
73709
73746
  if (t.status !== "done" || t.prUrl)
73710
73747
  continue;
73711
- const mark = join39(taskDir(planDir, t.id), "pr-auto.json");
73748
+ const mark = join40(taskDir(planDir, t.id), "pr-auto.json");
73712
73749
  if (existsSync29(mark))
73713
73750
  continue;
73714
73751
  const at = new Date().toISOString();
@@ -73765,7 +73802,7 @@ function failingSpecsFromLog(log) {
73765
73802
  function baselineWaiver(repo, prNumber, base, check, env) {
73766
73803
  const gh = (...a) => {
73767
73804
  try {
73768
- return execFileSync3("gh", a, {
73805
+ return execFileSync4("gh", a, {
73769
73806
  encoding: "utf8",
73770
73807
  timeout: 60000,
73771
73808
  env,
@@ -73806,7 +73843,7 @@ function autoMergePrs(planDir) {
73806
73843
  if (t.status !== "done")
73807
73844
  continue;
73808
73845
  const dir = taskDir(planDir, t.id);
73809
- if (existsSync29(join39(dir, "pr-merge.json")))
73846
+ if (existsSync29(join40(dir, "pr-merge.json")))
73810
73847
  continue;
73811
73848
  const d = readTask(planDir, t.id);
73812
73849
  const branch = d?.delivery?.branch;
@@ -73832,27 +73869,27 @@ function autoMergePrs(planDir) {
73832
73869
  ...waivers.map((w) => `- ${w.why}`)
73833
73870
  ].join(`
73834
73871
  `);
73835
- execFileSync3("gh", ["pr", "comment", String(pr.number), "--body", body], {
73872
+ execFileSync4("gh", ["pr", "comment", String(pr.number), "--body", body], {
73836
73873
  cwd: wt,
73837
73874
  encoding: "utf8",
73838
73875
  timeout: 60000,
73839
73876
  env
73840
73877
  });
73841
73878
  }
73842
- execFileSync3("gh", ["pr", "merge", String(pr.number), `--${s.mergeMethod ?? "merge"}`], {
73879
+ execFileSync4("gh", ["pr", "merge", String(pr.number), `--${s.mergeMethod ?? "merge"}`], {
73843
73880
  cwd: wt,
73844
73881
  encoding: "utf8",
73845
73882
  timeout: 60000,
73846
73883
  env
73847
73884
  });
73848
- writeFileSync32(join39(dir, "pr-merge.json"), JSON.stringify({ at, ok: true, number: pr.number, waived: waivers }));
73885
+ writeFileSync32(join40(dir, "pr-merge.json"), JSON.stringify({ at, ok: true, number: pr.number, waived: waivers }));
73849
73886
  } catch (err) {
73850
- writeFileSync32(join39(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
73887
+ writeFileSync32(join40(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
73851
73888
  `)[0] }));
73852
73889
  }
73853
- rmSync(join39(dir, "pr.json"), { force: true });
73854
- } else if (pr.checks.failed > 0 && !existsSync29(join39(dir, "ci-retry.json"))) {
73855
- writeFileSync32(join39(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
73890
+ rmSync(join40(dir, "pr.json"), { force: true });
73891
+ } else if (pr.checks.failed > 0 && !existsSync29(join40(dir, "ci-retry.json"))) {
73892
+ writeFileSync32(join40(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
73856
73893
  retryTask(planDir, t.id, `CI failed on PR #${pr.number}: ${pr.checks.failing.join(", ")}.${waivers.length ? ` Not waivable: ${waivers.filter((w) => !w.waived).map((w) => w.why).join("; ")}.` : ""} Read the failing job logs, fix on the same branch, push, wait for every check, then merge.`);
73857
73894
  }
73858
73895
  }
@@ -73860,15 +73897,15 @@ function autoMergePrs(planDir) {
73860
73897
  function prInfo(branch, repo, dir, ended, fresh = false) {
73861
73898
  if (!ended)
73862
73899
  return null;
73863
- const cache = join39(dir, "pr.json");
73900
+ const cache = join40(dir, "pr.json");
73864
73901
  try {
73865
- const c = JSON.parse(readFileSync32(cache, "utf8"));
73902
+ const c = JSON.parse(readFileSync33(cache, "utf8"));
73866
73903
  if (!fresh && Date.now() - c.checkedAt < 60000)
73867
73904
  return c.info ?? (c.url ? { url: c.url } : null);
73868
73905
  } catch {}
73869
73906
  let info = null;
73870
73907
  try {
73871
- const out = execFileSync3("gh", ["pr", "view", branch, "--json", "url,number,state,mergeable,statusCheckRollup"], {
73908
+ const out = execFileSync4("gh", ["pr", "view", branch, "--json", "url,number,state,mergeable,statusCheckRollup"], {
73872
73909
  cwd: repo,
73873
73910
  encoding: "utf8",
73874
73911
  timeout: 1e4,
@@ -73891,12 +73928,12 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
73891
73928
  }
73892
73929
  function readTask(planDir, id) {
73893
73930
  const dir = taskDir(planDir, id);
73894
- const file = join39(dir, "task.json");
73931
+ const file = join40(dir, "task.json");
73895
73932
  if (!existsSync29(file))
73896
73933
  return null;
73897
- const task = JSON.parse(readFileSync32(file, "utf8"));
73898
- const streamFile = join39(dir, "stream.jsonl");
73899
- const exitFile = join39(dir, "exit");
73934
+ const task = JSON.parse(readFileSync33(file, "utf8"));
73935
+ const streamFile = join40(dir, "stream.jsonl");
73936
+ const exitFile = join40(dir, "exit");
73900
73937
  const steps = [];
73901
73938
  const agents = new Map;
73902
73939
  let result = null;
@@ -73905,7 +73942,7 @@ function readTask(planDir, id) {
73905
73942
  let lastTs;
73906
73943
  let rawResult = "";
73907
73944
  const actorOf = (parent) => parent && agents.get(parent)?.type || "orchestrator";
73908
- const lines = existsSync29(streamFile) ? readFileSync32(streamFile, "utf8").split(`
73945
+ const lines = existsSync29(streamFile) ? readFileSync33(streamFile, "utf8").split(`
73909
73946
  `) : [];
73910
73947
  for (const line of lines) {
73911
73948
  if (!line.trim())
@@ -74000,7 +74037,7 @@ function readTask(planDir, id) {
74000
74037
  const scan = (t) => [...t.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74001
74038
  let res = scan(String(m.summary ?? ""));
74002
74039
  if (!res && typeof m.output_file === "string" && existsSync29(m.output_file)) {
74003
- res = scan(agentText(readFileSync32(m.output_file, "utf8")));
74040
+ res = scan(agentText(readFileSync33(m.output_file, "utf8")));
74004
74041
  }
74005
74042
  if (res) {
74006
74043
  try {
@@ -74025,8 +74062,8 @@ function readTask(planDir, id) {
74025
74062
  steps.push({ actor: "orchestrator", kind: "result", text: result.text, isError: !result.ok });
74026
74063
  }
74027
74064
  }
74028
- const exit = existsSync29(exitFile) ? Number(readFileSync32(exitFile, "utf8").trim()) : null;
74029
- const stderrRaw = existsSync29(join39(dir, "stderr.log")) ? readFileSync32(join39(dir, "stderr.log"), "utf8") : "";
74065
+ const exit = existsSync29(exitFile) ? Number(readFileSync33(exitFile, "utf8").trim()) : null;
74066
+ const stderrRaw = existsSync29(join40(dir, "stderr.log")) ? readFileSync33(join40(dir, "stderr.log"), "utf8") : "";
74030
74067
  const finalLine = [...rawResult.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74031
74068
  let verdict = null;
74032
74069
  try {
@@ -74038,7 +74075,7 @@ function readTask(planDir, id) {
74038
74075
  let reason;
74039
74076
  let status;
74040
74077
  if (exit !== null) {
74041
- if (existsSync29(join39(dir, "stopped"))) {
74078
+ if (existsSync29(join40(dir, "stopped"))) {
74042
74079
  reason = "stopped from the cockpit";
74043
74080
  } else if (/Background tasks still running .* terminating/.test(stderrRaw)) {
74044
74081
  reason = `claude stopped waiting for background agents (${unfinished.join(", ") || "?"}) and terminated them`;
@@ -74060,7 +74097,7 @@ function readTask(planDir, id) {
74060
74097
  const last = existsSync29(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74061
74098
  status = Date.now() - last > STALL_MS ? "stalled" : "running";
74062
74099
  }
74063
- const read = (f) => existsSync29(join39(dir, f)) ? readFileSync32(join39(dir, f), "utf8") : null;
74100
+ const read = (f) => existsSync29(join40(dir, f)) ? readFileSync33(join40(dir, f), "utf8") : null;
74064
74101
  const stderr = clip(stderrRaw, 1500);
74065
74102
  const fixer = [...agents.values()].reverse().find((a) => a.type === "fixer" && a.result);
74066
74103
  const fr = fixer?.result ?? {};
@@ -74071,7 +74108,7 @@ function readTask(planDir, id) {
74071
74108
  const baseSha = task.base?.sha ?? fr.base;
74072
74109
  const git = (...a) => {
74073
74110
  try {
74074
- return execFileSync3("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 3000 }).trim();
74111
+ return execFileSync4("git", ["-C", repo, ...a], { encoding: "utf8", timeout: 3000 }).trim();
74075
74112
  } catch {
74076
74113
  return "";
74077
74114
  }
@@ -74098,7 +74135,7 @@ function readTask(planDir, id) {
74098
74135
  model,
74099
74136
  prError: (() => {
74100
74137
  try {
74101
- const m = JSON.parse(readFileSync32(join39(dir, "pr-auto.json"), "utf8"));
74138
+ const m = JSON.parse(readFileSync33(join40(dir, "pr-auto.json"), "utf8"));
74102
74139
  return m.ok ? null : String(m.error);
74103
74140
  } catch {
74104
74141
  return null;
@@ -74132,8 +74169,8 @@ function listTasks2(planDir) {
74132
74169
  function taskShot(planDir, id, side) {
74133
74170
  if (!validTaskId(id) || side !== "prod" && side !== "cand")
74134
74171
  return null;
74135
- const file = join39(taskDir(planDir, id), `${side}.png`);
74136
- return existsSync29(file) ? readFileSync32(file) : null;
74172
+ const file = join40(taskDir(planDir, id), `${side}.png`);
74173
+ return existsSync29(file) ? readFileSync33(file) : null;
74137
74174
  }
74138
74175
 
74139
74176
  // src/server/cockpit.ts
@@ -74418,7 +74455,7 @@ async function actions(req, res, path, ctx) {
74418
74455
  }
74419
74456
  function targetDirOf(planDir) {
74420
74457
  try {
74421
- const st = JSON.parse(readFileSync33(join40(planDir, "migration.json"), "utf8"));
74458
+ const st = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
74422
74459
  if (typeof st?.target?.dir === "string")
74423
74460
  return st.target.dir;
74424
74461
  } catch {}
@@ -74472,15 +74509,15 @@ async function cockpitCommand(opts) {
74472
74509
  }
74473
74510
 
74474
74511
  // src/commands/ios.ts
74475
- import { execFileSync as execFileSync4 } from "node:child_process";
74476
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync35, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
74477
- import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
74478
- import { join as join42, resolve as resolve15 } from "node:path";
74512
+ import { execFileSync as execFileSync5 } from "node:child_process";
74513
+ import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync36, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
74514
+ import { homedir as homedir4, tmpdir as tmpdir2 } from "node:os";
74515
+ import { join as join43, resolve as resolve15 } from "node:path";
74479
74516
  import chalk32 from "chalk";
74480
74517
 
74481
74518
  // src/commands/pair.ts
74482
- import { existsSync as existsSync30, readFileSync as readFileSync34 } from "node:fs";
74483
- import { join as join41 } from "node:path";
74519
+ import { existsSync as existsSync30, readFileSync as readFileSync35 } from "node:fs";
74520
+ import { join as join42 } from "node:path";
74484
74521
  import chalk31 from "chalk";
74485
74522
 
74486
74523
  // src/engine/pair.ts
@@ -74738,12 +74775,12 @@ function report(opts, from, source, match, problem) {
74738
74775
  return problem ? 2 : 0;
74739
74776
  }
74740
74777
  function sectionArgsFromTask(taskDir) {
74741
- const file = join41(taskDir, "task.json");
74778
+ const file = join42(taskDir, "task.json");
74742
74779
  if (!existsSync30(file))
74743
74780
  throw new Error(`no task.json in ${taskDir}`);
74744
- const task = JSON.parse(readFileSync34(file, "utf8"));
74745
- const ctxFile = join41(taskDir, "context.json");
74746
- const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync34(ctxFile, "utf8")) : {};
74781
+ const task = JSON.parse(readFileSync35(file, "utf8"));
74782
+ const ctxFile = join42(taskDir, "context.json");
74783
+ const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync35(ctxFile, "utf8")) : {};
74747
74784
  const prodSel = task.side === "prod" ? task.selector : ctx.prod?.selector ?? task.counterpart;
74748
74785
  const candSel = task.side === "cand" ? task.selector : ctx.cand?.selector ?? task.counterpart;
74749
74786
  if (!prodSel || !candSel) {
@@ -74762,9 +74799,9 @@ function sectionArgsFromTask(taskDir) {
74762
74799
  }
74763
74800
 
74764
74801
  // src/commands/ios.ts
74765
- var LOCK = join42(homedir3(), ".parity", "ios.lock");
74802
+ var LOCK = join43(homedir4(), ".parity", "ios.lock");
74766
74803
  function simctl(...args) {
74767
- return execFileSync4("xcrun", ["simctl", ...args], { encoding: "utf8", timeout: 180000 }).trim();
74804
+ return execFileSync5("xcrun", ["simctl", ...args], { encoding: "utf8", timeout: 180000 }).trim();
74768
74805
  }
74769
74806
  function alive2(pid) {
74770
74807
  try {
@@ -74775,10 +74812,10 @@ function alive2(pid) {
74775
74812
  }
74776
74813
  }
74777
74814
  async function takeLock() {
74778
- mkdirSync22(join42(homedir3(), ".parity"), { recursive: true });
74815
+ mkdirSync22(join43(homedir4(), ".parity"), { recursive: true });
74779
74816
  const until = Date.now() + 5 * 60000;
74780
74817
  for (;; ) {
74781
- const holder = existsSync31(LOCK) ? Number(readFileSync35(LOCK, "utf8")) : 0;
74818
+ const holder = existsSync31(LOCK) ? Number(readFileSync36(LOCK, "utf8")) : 0;
74782
74819
  if (!holder || !alive2(holder) || holder === process.pid)
74783
74820
  break;
74784
74821
  if (Date.now() > until)
@@ -74797,7 +74834,7 @@ function findDevice(name) {
74797
74834
  }
74798
74835
  async function iosCommand(opts) {
74799
74836
  try {
74800
- execFileSync4("xcrun", ["simctl", "help"], { stdio: "ignore" });
74837
+ execFileSync5("xcrun", ["simctl", "help"], { stdio: "ignore" });
74801
74838
  } catch {
74802
74839
  console.error(chalk32.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
74803
74840
  return 2;
@@ -74821,7 +74858,7 @@ async function iosCommand(opts) {
74821
74858
  await takeLock();
74822
74859
  const out = resolve15(opts.outDir);
74823
74860
  mkdirSync22(out, { recursive: true });
74824
- const scratch = join42(tmpdir2(), `parity-ios-${process.pid}`);
74861
+ const scratch = join43(tmpdir2(), `parity-ios-${process.pid}`);
74825
74862
  mkdirSync22(scratch, { recursive: true });
74826
74863
  let bootedHere = false;
74827
74864
  const device = findDevice(opts.device);
@@ -74841,7 +74878,7 @@ async function iosCommand(opts) {
74841
74878
  const via = `${proxy.url}proxy?url=${encodeURIComponent(s.url)}${s.sel ? `&scrollTo=${encodeURIComponent(s.sel)}` : ""}`;
74842
74879
  simctl("openurl", device.udid, via);
74843
74880
  await new Promise((r) => setTimeout(r, Number(opts.wait)));
74844
- const file = join42(out, `ios-${s.side}.png`);
74881
+ const file = join43(out, `ios-${s.side}.png`);
74845
74882
  simctl("io", device.udid, "screenshot", "--type=png", file);
74846
74883
  shots[s.side] = file;
74847
74884
  if (s.sel) {
@@ -74857,13 +74894,13 @@ async function iosCommand(opts) {
74857
74894
  } catch {}
74858
74895
  }
74859
74896
  rmSync2(scratch, { recursive: true, force: true });
74860
- if (existsSync31(LOCK) && Number(readFileSync35(LOCK, "utf8")) === process.pid)
74897
+ if (existsSync31(LOCK) && Number(readFileSync36(LOCK, "utf8")) === process.pid)
74861
74898
  rmSync2(LOCK);
74862
74899
  }
74863
74900
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
74864
74901
  let diff = null;
74865
74902
  if (shots.prod && shots.cand && !missing.length)
74866
- diff = diffScreenshots(shots.prod, shots.cand, join42(out, "ios-diff.png"));
74903
+ diff = diffScreenshots(shots.prod, shots.cand, join43(out, "ios-diff.png"));
74867
74904
  const report = {
74868
74905
  device: device.name,
74869
74906
  shots,
@@ -74891,7 +74928,7 @@ import { createInterface as createInterface3 } from "node:readline";
74891
74928
  import { resolve as resolve17 } from "node:path";
74892
74929
 
74893
74930
  // src/util/version.ts
74894
- import { readFileSync as readFileSync36 } from "node:fs";
74931
+ import { readFileSync as readFileSync37 } from "node:fs";
74895
74932
  import { dirname as dirname8, resolve as resolve16 } from "node:path";
74896
74933
  import { fileURLToPath as fileURLToPath2 } from "node:url";
74897
74934
  function getPackageVersion() {
@@ -74900,7 +74937,7 @@ function getPackageVersion() {
74900
74937
  for (const up of ["..", "../..", "../../.."]) {
74901
74938
  try {
74902
74939
  const pkgPath = resolve16(here, up, "package.json");
74903
- const raw = readFileSync36(pkgPath, "utf8");
74940
+ const raw = readFileSync37(pkgPath, "utf8");
74904
74941
  const parsed = JSON.parse(raw);
74905
74942
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
74906
74943
  return parsed.version;
@@ -75011,8 +75048,8 @@ function parseLine(line) {
75011
75048
  }
75012
75049
 
75013
75050
  // src/mcp/tools.ts
75014
- import { existsSync as existsSync32, readFileSync as readFileSync37 } from "node:fs";
75015
- import { join as join43 } from "node:path";
75051
+ import { existsSync as existsSync32, readFileSync as readFileSync38 } from "node:fs";
75052
+ import { join as join44 } from "node:path";
75016
75053
  var STR = { type: "string" };
75017
75054
  var NONE = { type: "object", properties: {}, additionalProperties: false };
75018
75055
  function withPlan2(ctx, fn) {
@@ -75048,12 +75085,12 @@ function createTools(ctx) {
75048
75085
  description: "The orchestrator's own state: phase, stage, round, current page, score and trend, budget. Read this first — it says what the run is doing and what it is allowed to care about.",
75049
75086
  inputSchema: NONE,
75050
75087
  handler: () => {
75051
- const p = join43(ctx.planDir, "migration.json");
75088
+ const p = join44(ctx.planDir, "migration.json");
75052
75089
  if (!existsSync32(p)) {
75053
75090
  return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75054
75091
  }
75055
75092
  try {
75056
- return json2(JSON.parse(readFileSync37(p, "utf8")));
75093
+ return json2(JSON.parse(readFileSync38(p, "utf8")));
75057
75094
  } catch (err) {
75058
75095
  return fail2(`migration.json is not valid JSON: ${err.message}`);
75059
75096
  }
@@ -75384,13 +75421,13 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
75384
75421
  }
75385
75422
 
75386
75423
  // src/diff/noise-mask.ts
75387
- import { readFileSync as readFileSync38, writeFileSync as writeFileSync34 } from "node:fs";
75424
+ import { readFileSync as readFileSync39, writeFileSync as writeFileSync34 } from "node:fs";
75388
75425
  import { PNG as PNG5 } from "pngjs";
75389
75426
  var DEFAULT_DILATE = 2;
75390
75427
  var MAX_MASK_COVERAGE = 0.2;
75391
75428
  function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
75392
- const a = PNG5.sync.read(readFileSync38(firstPng));
75393
- const b = PNG5.sync.read(readFileSync38(secondPng));
75429
+ const a = PNG5.sync.read(readFileSync39(firstPng));
75430
+ const b = PNG5.sync.read(readFileSync39(secondPng));
75394
75431
  if (a.width !== b.width || a.height !== b.height)
75395
75432
  return null;
75396
75433
  const { width, height } = a;
@@ -75430,7 +75467,7 @@ function dilateMask(src, width, height, radius) {
75430
75467
  return pass(pass(src, true), false);
75431
75468
  }
75432
75469
  function applyMask(pngPath, mask, outPath) {
75433
- const png = PNG5.sync.read(readFileSync38(pngPath));
75470
+ const png = PNG5.sync.read(readFileSync39(pngPath));
75434
75471
  if (png.width !== mask.width || png.height !== mask.height) {
75435
75472
  throw new Error(`applyMask: image is ${png.width}x${png.height} but the mask is ${mask.width}x${mask.height}`);
75436
75473
  }
@@ -75447,7 +75484,7 @@ function applyMask(pngPath, mask, outPath) {
75447
75484
  }
75448
75485
  function readPngSize(pngPath) {
75449
75486
  try {
75450
- const head = readFileSync38(pngPath).subarray(0, 24);
75487
+ const head = readFileSync39(pngPath).subarray(0, 24);
75451
75488
  if (head.length < 24)
75452
75489
  return null;
75453
75490
  return { width: head.readUInt32BE(16), height: head.readUInt32BE(20) };
@@ -76702,9 +76739,9 @@ function varianceCommand(opts) {
76702
76739
  }
76703
76740
 
76704
76741
  // src/commands/vitals.ts
76705
- import { existsSync as existsSync33, readFileSync as readFileSync39, writeFileSync as writeFileSync35 } from "node:fs";
76742
+ import { existsSync as existsSync33, readFileSync as readFileSync40, writeFileSync as writeFileSync35 } from "node:fs";
76706
76743
  import { availableParallelism } from "node:os";
76707
- import { join as join44 } from "node:path";
76744
+ import { join as join45 } from "node:path";
76708
76745
  import chalk36 from "chalk";
76709
76746
  import ora9 from "ora";
76710
76747
 
@@ -77043,7 +77080,7 @@ async function vitalsCommand(opts) {
77043
77080
  });
77044
77081
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
77045
77082
  if (opts.lighthouse !== false) {
77046
- const lhDir = join44(paths.runDir, "lighthouse");
77083
+ const lhDir = join45(paths.runDir, "lighthouse");
77047
77084
  const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
77048
77085
  const done = tasks.filter((t) => !!t.capture);
77049
77086
  const lhT0 = Date.now();
@@ -77132,7 +77169,7 @@ async function vitalsCommand(opts) {
77132
77169
  writeRunReportJson(paths.runDir, run);
77133
77170
  const html = renderHtmlReport(run, paths.runDir);
77134
77171
  writeRunReportHtml(paths.runDir, html);
77135
- writeFileSync35(join44(paths.runDir, "vitals.json"), `${JSON.stringify({
77172
+ writeFileSync35(join45(paths.runDir, "vitals.json"), `${JSON.stringify({
77136
77173
  schemaVersion: "0.1",
77137
77174
  prodUrl: opts.prod,
77138
77175
  candUrl: opts.cand,
@@ -77237,7 +77274,7 @@ function parseUrlList(input) {
77237
77274
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
77238
77275
  const path = input.replace(/^file:\/\//, "");
77239
77276
  if (existsSync33(path)) {
77240
- return readFileSync39(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77277
+ return readFileSync40(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77241
77278
  }
77242
77279
  }
77243
77280
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
@@ -77321,7 +77358,7 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
77321
77358
  process.exit(planStatusCommand(opts.dir, Boolean(opts.json)));
77322
77359
  })).addCommand(new Command("page").description("Per-page worksheet: every component the capture saw on this page, what to do about it (build | validate | upgrade | as-is | settled), and a runnable `parity section` command for the checkable ones. The unit of work a migration closes is a page, not a global queue.").argument("<path>", "Page path, e.g. / or /refrigeracion").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--cand <url>", "Candidate base URL — required for runnable validation commands").option("--json", "Emit structured JSON instead of human-readable text", false).action((path, opts) => {
77323
77360
  process.exit(planPageCommand(opts.dir, path, { cand: opts.cand, json: Boolean(opts.json) }));
77324
- })).addCommand(new Command("board").description("Per-page kanban: every sampled page in a derived lane (triage | backlog | building | review | done) with what blocks it. Lanes come from each page's components, so a page cannot read as done while a component it needs is missing.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--cand <url>", "Candidate base URL — enriches cards with validation state").option("--board <where>", "terminal (default) | studio — push one card per page to the deco Studio task board (needs PARITY_STUDIO_URL + PARITY_STUDIO_TOKEN; falls back to terminal when unset or unreachable)", "terminal").option("--repo <owner/name>", "Repository stored on each card, so the board knows where the work lives").option("--fixes <path>", "JSON file of client-legible fixes to mirror as cards: [{title, body?, prUrl?, state: open|in_review|closed}]").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
77361
+ })).addCommand(new Command("board").description("Per-page kanban: every sampled page in a derived lane (triage | backlog | building | review | done) with what blocks it. Lanes come from each page's components, so a page cannot read as done while a component it needs is missing.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").option("--cand <url>", "Candidate base URL — enriches cards with validation state").option("--board <where>", "terminal (default) | studio — push one card per page to the deco Studio task board (uses the `bunx decocms auth login` session, or PARITY_STUDIO_URL + PARITY_STUDIO_TOKEN; falls back to terminal when unset or unreachable)", "terminal").option("--repo <owner/name>", "Repository stored on each card, so the board knows where the work lives").option("--fixes <path>", "JSON file of client-legible fixes to mirror as cards: [{title, body?, prUrl?, state: open|in_review|closed}]").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
77325
77362
  process.exit(await planBoardCommand(opts.dir, {
77326
77363
  cand: opts.cand,
77327
77364
  json: Boolean(opts.json),
@@ -77346,7 +77383,7 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
77346
77383
  })).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) => {
77347
77384
  process.exit(planVerifyCommand(opts.dir, name, verdict, { note: opts.note, at: opts.at }));
77348
77385
  }));
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) => {
77386
+ program.command("studio").description("Work the deco Studio task board: list tasks, read one, take one, move it, comment. Auth: the `bunx decocms auth login` session (org via PARITY_STUDIO_ORG), or 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
77387
  process.exit(await studioTasksCommand({
77351
77388
  status: opts.status,
77352
77389
  repo: opts.repo,