@tempo-ai/visual-review 0.0.136 → 0.0.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -7,7 +7,7 @@ async function main(argv = process.argv.slice(2)) {
7
7
  const [command, ...commandArgs] = argv;
8
8
  switch (command) {
9
9
  case "capture":
10
- return await (await import("./cli-UGQOXTPM.js")).main(commandArgs);
10
+ return await (await import("./cli-774NVTY7.js")).main(commandArgs);
11
11
  case "claim":
12
12
  return await (await import("./claim-WYI6X53C.js")).main(commandArgs);
13
13
  case "report":
@@ -40238,7 +40238,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
40238
40238
  // ../tempo-sdk/package.json
40239
40239
  var package_default = {
40240
40240
  name: "tempo-sdk",
40241
- version: "0.0.87",
40241
+ version: "0.0.89",
40242
40242
  publishConfig: {
40243
40243
  tag: "sdk-v2-latest"
40244
40244
  },
@@ -51551,6 +51551,26 @@ function waitForInstallBarrier(work, signal) {
51551
51551
  signal
51552
51552
  );
51553
51553
  }
51554
+ var projectInstalls = /* @__PURE__ */ new Map();
51555
+ async function runExclusiveProjectInstall(projectRoot, signal, install) {
51556
+ const key2 = path23.resolve(projectRoot);
51557
+ const ahead = projectInstalls.get(key2);
51558
+ let finished;
51559
+ const done = new Promise((resolve2) => {
51560
+ finished = resolve2;
51561
+ });
51562
+ const turn = ahead ? ahead.then(() => done) : done;
51563
+ projectInstalls.set(key2, turn);
51564
+ try {
51565
+ if (ahead) await waitForInstallBarrier(ahead, signal);
51566
+ return await install();
51567
+ } finally {
51568
+ finished();
51569
+ void turn.then(() => {
51570
+ if (projectInstalls.get(key2) === turn) projectInstalls.delete(key2);
51571
+ });
51572
+ }
51573
+ }
51554
51574
  function createSuffixedTempoNextDistDir() {
51555
51575
  const nonce = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
51556
51576
  return `${TEMPO_NEXT_STABLE_DIST_DIR}-${nonce}`;
@@ -52507,6 +52527,9 @@ var TempoDevServer = class _TempoDevServer {
52507
52527
  // after Next reports an observed lock conflict for that directory.
52508
52528
  this.nextDistDir = null;
52509
52529
  this.nextDistDirClaim = null;
52530
+ /** The dependency inputs (each package root's completion key) that the
52531
+ * last consecutive failed installs ran with. */
52532
+ this.installFailure = null;
52510
52533
  const paths = resolveRuntimePaths(config.tempoConfigPath);
52511
52534
  this.config = {
52512
52535
  ...config,
@@ -52598,9 +52621,6 @@ var TempoDevServer = class _TempoDevServer {
52598
52621
  }
52599
52622
  }
52600
52623
  }
52601
- static {
52602
- this.installBarriers = /* @__PURE__ */ new Map();
52603
- }
52604
52624
  getConfig() {
52605
52625
  return {
52606
52626
  ...this.config,
@@ -52736,6 +52756,7 @@ var TempoDevServer = class _TempoDevServer {
52736
52756
  updateSdkScript: this.config.scripts.updateSdk,
52737
52757
  startScript: this.config.scripts.start,
52738
52758
  forceInstall: options?.forceInstall ?? false,
52759
+ rerunInstall: options?.rerunInstall ?? false,
52739
52760
  dependenciesInstalled: this.state.dependenciesInstalled
52740
52761
  });
52741
52762
  if (!this.state.initialized) {
@@ -52935,9 +52956,9 @@ var TempoDevServer = class _TempoDevServer {
52935
52956
  }
52936
52957
  await this.selectNodeRuntimeForStart();
52937
52958
  throwIfLaunchAborted(options?.signal);
52938
- if (options?.forceInstall || !this.state.dependenciesInstalled) {
52959
+ if (options?.forceInstall || options?.rerunInstall || !this.state.dependenciesInstalled) {
52939
52960
  await this.installDependenciesForStart(
52940
- options?.forceInstall === true,
52961
+ options?.forceInstall ? "clean" : options?.rerunInstall ? "rerun" : "if-needed",
52941
52962
  options?.signal,
52942
52963
  options?.onInstallOutput,
52943
52964
  options?.onInstallStart
@@ -53346,7 +53367,55 @@ var TempoDevServer = class _TempoDevServer {
53346
53367
  });
53347
53368
  this.checkedLegacyDependencyLock = true;
53348
53369
  }
53349
- async installDependenciesForStart(forceInstall, signal, onOutput, onInstallStart) {
53370
+ /**
53371
+ * Install for packages missing from a folder the project's own install
53372
+ * covers. Runs that install once, whichever folders asked. After the first
53373
+ * install and one retry have failed on the same dependency inputs, this
53374
+ * reports the failure instead of running again; a new start still installs.
53375
+ * The inputs are the project root's and each asking package root's
53376
+ * manifest, so fixing any of them earns a fresh attempt.
53377
+ */
53378
+ async installWorkspacePackages(options = {}) {
53379
+ const inputs = await installInputs([
53380
+ this.projectRoot,
53381
+ ...options.packageRoots ?? []
53382
+ ]);
53383
+ const failure = this.installFailure;
53384
+ if (failure && failure.count >= MAX_WORKSPACE_INSTALL_ATTEMPTS && [...inputs].every(
53385
+ ([root2, key2]) => failure.inputs.has(root2) && failure.inputs.get(root2) === key2
53386
+ )) {
53387
+ throw failure.error;
53388
+ }
53389
+ await this.installDependenciesForStart(
53390
+ "if-needed",
53391
+ options.signal,
53392
+ options.onOutput,
53393
+ options.onInstallStart,
53394
+ () => this.buildWorkspaceInstallSteps(),
53395
+ options.onTransientLockFailure,
53396
+ inputs
53397
+ );
53398
+ }
53399
+ async buildWorkspaceInstallSteps() {
53400
+ if (!looksLikeGeneratedInstallScript(
53401
+ this.config.scripts.install.trim(),
53402
+ path23.relative(this.projectRoot, this.appRoot).split(path23.sep).join("/")
53403
+ )) {
53404
+ return this.buildInstallSteps("rerun");
53405
+ }
53406
+ const manager = await detectOwningPackageManager(this.projectRoot);
53407
+ if (!manager) return [];
53408
+ return filterProtectedInstallSteps([
53409
+ {
53410
+ cwd: this.projectRoot,
53411
+ command: await buildSafeInstallCommand(manager, this.projectRoot),
53412
+ label: "project root install",
53413
+ markerRoots: [this.projectRoot]
53414
+ }
53415
+ ]);
53416
+ }
53417
+ async installDependenciesForStart(mode, signal, onOutput, onInstallStart, buildSteps = () => this.buildInstallSteps(mode), onTransientLockFailure, inputs) {
53418
+ const attemptInputs = inputs ?? await installInputs([this.projectRoot]);
53350
53419
  const installTimer = devTimer("supervisor:install", {
53351
53420
  tempoRoot: this.tempoRoot,
53352
53421
  commandCwd: this.commandCwd,
@@ -53355,7 +53424,7 @@ var TempoDevServer = class _TempoDevServer {
53355
53424
  try {
53356
53425
  const installWork = async () => {
53357
53426
  throwIfLaunchAborted(signal);
53358
- const steps = await this.buildInstallSteps(forceInstall);
53427
+ const steps = await buildSteps();
53359
53428
  if (steps.length === 0) {
53360
53429
  return;
53361
53430
  }
@@ -53370,14 +53439,15 @@ var TempoDevServer = class _TempoDevServer {
53370
53439
  signal,
53371
53440
  onOutput,
53372
53441
  this.projectRoot,
53373
- await this.nuxtSidecarNodePathEnv()
53442
+ await this.nuxtSidecarNodePathEnv(),
53443
+ onTransientLockFailure
53374
53444
  );
53375
53445
  }
53376
53446
  } catch (error) {
53377
53447
  throwIfLaunchAborted(signal);
53378
53448
  if (!steps.some((step) => step.label === "custom tempo install") || !missingInstallEnvironment(error))
53379
53449
  throw error;
53380
- const localSteps = await this.buildInstallSteps(false, false);
53450
+ const localSteps = await this.buildInstallSteps("if-needed", false);
53381
53451
  if (!localSteps.length) throw error;
53382
53452
  console.warn(
53383
53453
  "[tempo-devserver] The configured installer needs unavailable local tooling; trying a local dependency install for this launch."
@@ -53394,34 +53464,36 @@ var TempoDevServer = class _TempoDevServer {
53394
53464
  }
53395
53465
  }
53396
53466
  };
53397
- while (_TempoDevServer.installBarriers.has(this.projectRoot)) {
53398
- await waitForInstallBarrier(
53399
- _TempoDevServer.installBarriers.get(this.projectRoot),
53400
- signal
53401
- );
53402
- }
53403
- const work = installWork();
53404
- _TempoDevServer.installBarriers.set(this.projectRoot, work);
53405
- try {
53406
- await work;
53407
- } finally {
53408
- if (_TempoDevServer.installBarriers.get(this.projectRoot) === work) {
53409
- _TempoDevServer.installBarriers.delete(this.projectRoot);
53410
- }
53411
- }
53467
+ await runExclusiveProjectInstall(this.projectRoot, signal, installWork);
53412
53468
  throwIfLaunchAborted(signal);
53413
53469
  this.state.dependenciesInstalled = true;
53414
53470
  await this.persistStatus();
53471
+ this.installFailure = null;
53415
53472
  installTimer.done({ ok: true });
53416
53473
  } catch (error) {
53417
53474
  installTimer.done({
53418
53475
  ok: false,
53419
53476
  message: error instanceof Error ? error.message : String(error)
53420
53477
  });
53478
+ if (!signal?.aborted) {
53479
+ const previous = this.installFailure;
53480
+ const continues = previous !== null && [...attemptInputs].every(
53481
+ ([root2, key2]) => !previous.inputs.has(root2) || previous.inputs.get(root2) === key2
53482
+ );
53483
+ this.installFailure = {
53484
+ count: continues ? previous.count + 1 : 1,
53485
+ error,
53486
+ inputs: new Map([
53487
+ ...continues ? previous.inputs : [],
53488
+ ...attemptInputs
53489
+ ])
53490
+ };
53491
+ }
53421
53492
  throw error;
53422
53493
  }
53423
53494
  }
53424
- async buildInstallSteps(forceInstall, useConfiguredScript = true) {
53495
+ async buildInstallSteps(mode, useConfiguredScript = true) {
53496
+ const forceInstall = mode !== "if-needed";
53425
53497
  const configuredInstall = this.config.scripts.install.trim();
53426
53498
  if (useConfiguredScript && !looksLikeGeneratedInstallScript(
53427
53499
  configuredInstall,
@@ -53502,7 +53574,7 @@ var TempoDevServer = class _TempoDevServer {
53502
53574
  // routine "not ready" after a COMPLETED install (deps changed) does an
53503
53575
  // ordinary incremental install — cheap when already satisfied, and npm
53504
53576
  // restores any missing optional-native binary. See TEM-820.
53505
- cleanBeforeInstall: forceInstall || await installWasInterrupted(this.tempoRoot),
53577
+ cleanBeforeInstall: mode === "clean" || await installWasInterrupted(this.tempoRoot),
53506
53578
  // Record completion only after `npm install` exits 0 so an interrupted
53507
53579
  // install is never mistaken for a finished one on the next start.
53508
53580
  markerRoots: [this.tempoRoot]
@@ -55102,6 +55174,15 @@ async function installWasInterrupted(packageRoot) {
55102
55174
  }
55103
55175
  var INSTALL_COMPLETION_MARKER_VERSION = "tempo-install-complete-v3";
55104
55176
  var EXTERNAL_LAYOUT_INSTALL_MARKER = ".tempo-external-install-complete";
55177
+ async function installInputs(roots) {
55178
+ return new Map(
55179
+ await Promise.all(
55180
+ [...new Set(roots.map((root2) => path23.resolve(root2)))].map(
55181
+ async (root2) => [root2, await computeInstallCompletionKey(root2)]
55182
+ )
55183
+ )
55184
+ );
55185
+ }
55105
55186
  async function computeInstallCompletionKey(packageRoot) {
55106
55187
  const packageJsonPath = path23.join(packageRoot, "package.json");
55107
55188
  const raw = await readTextFileOptional(packageJsonPath);
@@ -55587,7 +55668,8 @@ function isIgnoredBuildScriptsOnlyFailure(output) {
55587
55668
  return /ERR_PNPM_IGNORED_BUILDS/.test(output);
55588
55669
  }
55589
55670
  var INSTALL_LOCK_RETRY_DELAYS_MS = [1e3, 3e3, 6e3];
55590
- async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runShellCommand, retryDelaysMs = INSTALL_LOCK_RETRY_DELAYS_MS, signal) {
55671
+ var MAX_WORKSPACE_INSTALL_ATTEMPTS = 2;
55672
+ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runShellCommand, retryDelaysMs = INSTALL_LOCK_RETRY_DELAYS_MS, signal, onTransientLockFailure) {
55591
55673
  for (let attempt = 0; ; attempt += 1) {
55592
55674
  throwIfLaunchAborted(signal);
55593
55675
  try {
@@ -55599,11 +55681,12 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
55599
55681
  const delay2 = retryDelaysMs[attempt];
55600
55682
  if (delay2 === void 0 || !isTransientFsLockOutput(output)) throw error;
55601
55683
  devLog("supervisor:install_lock_retry", { command, attempt, delay: delay2 });
55684
+ if (attempt === 0) await onTransientLockFailure?.();
55602
55685
  await waitForLaunchDelay(delay2, signal);
55603
55686
  }
55604
55687
  }
55605
55688
  }
55606
- async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd, extraEnv = {}) {
55689
+ async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd, extraEnv = {}, onTransientLockFailure) {
55607
55690
  throwIfLaunchAborted(signal);
55608
55691
  await Promise.all(
55609
55692
  [
@@ -55633,7 +55716,8 @@ async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd, ex
55633
55716
  step.cwd,
55634
55717
  (command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput, projectRoot, extraEnv),
55635
55718
  INSTALL_LOCK_RETRY_DELAYS_MS,
55636
- signal
55719
+ signal,
55720
+ onTransientLockFailure
55637
55721
  );
55638
55722
  } catch (error) {
55639
55723
  throwIfLaunchAborted(signal);
@@ -63841,4 +63925,4 @@ export {
63841
63925
  buildBaselineCaptureArgs,
63842
63926
  main
63843
63927
  };
63844
- //# sourceMappingURL=chunk-74VMTZO5.js.map
63928
+ //# sourceMappingURL=chunk-V4U3XAR5.js.map