@somewhere-cloud/cli 0.38.121 → 0.38.123

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.
@@ -24502,7 +24502,7 @@ var require_snapshot_recorder = __commonJS({
24502
24502
  "node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
24503
24503
  "use strict";
24504
24504
  var { writeFile: writeFile2, readFile: readFile2, mkdir } = __require("node:fs/promises");
24505
- var { dirname: dirname15, resolve: resolve26 } = __require("node:path");
24505
+ var { dirname: dirname16, resolve: resolve26 } = __require("node:path");
24506
24506
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
24507
24507
  var { InvalidArgumentError: InvalidArgumentError2, UndiciError } = require_errors();
24508
24508
  var { hashId, isUrlExcludedFactory, normalizeHeaders: normalizeHeaders2, createHeaderFilters } = require_snapshot_utils();
@@ -24757,7 +24757,7 @@ var require_snapshot_recorder = __commonJS({
24757
24757
  throw new InvalidArgumentError2("Snapshot path is required");
24758
24758
  }
24759
24759
  const resolvedPath = resolve26(path3);
24760
- await mkdir(dirname15(resolvedPath), { recursive: true });
24760
+ await mkdir(dirname16(resolvedPath), { recursive: true });
24761
24761
  const data2 = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
24762
24762
  hash: hash2,
24763
24763
  snapshot
@@ -37593,7 +37593,7 @@ import { spawn as spawn2 } from "node:child_process";
37593
37593
  function initInstallSpawnSpec(platform2) {
37594
37594
  return {
37595
37595
  command: platform2 === "win32" ? "npm.cmd" : "npm",
37596
- args: ["install", "--no-audit", "--no-fund"],
37596
+ args: ["install", "--no-audit", "--no-fund", "--omit=optional"],
37597
37597
  shell: platform2 === "win32"
37598
37598
  };
37599
37599
  }
@@ -38321,6 +38321,8 @@ Keep each run short:
38321
38321
  - Stop at the first failure and print what the page showed (page.url(), the visible error
38322
38322
  text). Checks after a failure only wait out their timeouts. app.check() does both.
38323
38323
  - After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
38324
+ The CLI supplies its test helpers when it runs your tests. For the first browser test, install Playwright with npm install -D --save-exact @playwright/test@1.65.0.
38325
+ For a local Vite server, install the frontend tools with npm install --include=optional -D --save-exact vite@7.2.2.
38324
38326
  The test helper, @somewhere-cloud/cli/script (import or require); these are all the calls a test needs:
38325
38327
  const app = await openAppTest(); // the live origin, release and data contract
38326
38328
  const ana = await app.signUp(page); // through your form: { id, email, password, verified }
@@ -38548,21 +38550,21 @@ var init_init_green_template = __esm({
38548
38550
  "private": true,
38549
38551
  "version": "0.1.0",
38550
38552
  "type": "module",
38553
+ "somewhere": { "cli_version": "${CLI_VERSION}" },
38551
38554
  "scripts": {
38552
- "dev": "somewhere dev",
38553
- "typecheck": "somewhere typecheck"
38555
+ "dev": "npx -y @somewhere-cloud/cli dev",
38556
+ "typecheck": "npx -y @somewhere-cloud/cli typecheck"
38554
38557
  },
38555
38558
  "dependencies": {
38556
- "@somewhere-cloud/sdk": "0.14.2",
38559
+ "@somewhere-cloud/sdk": "0.14.2"
38560
+ },
38561
+ "optionalDependencies": {
38557
38562
  "react": "19.2.7",
38558
38563
  "react-dom": "19.2.7"
38559
38564
  },
38560
38565
  "devDependencies": {
38561
- "@somewhere-cloud/cli": "${CLI_VERSION}",
38562
38566
  "@types/react": "19.2.2",
38563
- "@types/react-dom": "19.2.2",
38564
- "typescript": "5.9.3",
38565
- "vite": "7.2.2"
38567
+ "@types/react-dom": "19.2.2"
38566
38568
  },
38567
38569
  "allowScripts": {
38568
38570
  "esbuild": true
@@ -40781,7 +40783,7 @@ var require_semver2 = __commonJS({
40781
40783
 
40782
40784
  // dist/lib/project-pin.js
40783
40785
  import { existsSync as existsSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "node:fs";
40784
- import { join as join7 } from "node:path";
40786
+ import { dirname as dirname2, join as join7 } from "node:path";
40785
40787
  function readJson(path3) {
40786
40788
  if (!existsSync7(path3))
40787
40789
  return null;
@@ -40805,7 +40807,13 @@ function packageJsonSpec(pkg) {
40805
40807
  }
40806
40808
  function readProjectPins(dir) {
40807
40809
  const pins = [];
40808
- const fromPackage = packageJsonSpec(readJson(join7(dir, "package.json")));
40810
+ const pkg = readJson(join7(dir, "package.json"));
40811
+ const settings = pkg?.somewhere;
40812
+ const fromSettings = settings && typeof settings === "object" && !Array.isArray(settings) ? settings[PIN_FILE_KEY] : void 0;
40813
+ if (typeof fromSettings === "string" && fromSettings.trim()) {
40814
+ pins.push({ spec: fromSettings.trim(), source: "package.json", versionOnly: true });
40815
+ }
40816
+ const fromPackage = packageJsonSpec(pkg);
40809
40817
  if (fromPackage)
40810
40818
  pins.push({ spec: fromPackage, source: "package.json" });
40811
40819
  const recorded = readJson(join7(dir, ".somewhere.json"))?.[PIN_FILE_KEY];
@@ -40843,7 +40851,7 @@ function pinNotice(pin, running, delegatedTo) {
40843
40851
  if (newer)
40844
40852
  return `${head}; you are running ${running}. ${move}`;
40845
40853
  const exact = import_semver.default.valid(pin.spec) ? pin.spec : import_semver.default.minVersion(pin.spec)?.version ?? pin.spec;
40846
- return `${head}; you are running ${running}, which is older. ` + (pin.source === "package.json" ? "Run `npm install` here, or use " : "Use ") + `\`npx -y ${CLI_PACKAGE_NAME}@${exact} <command>\`.`;
40854
+ return `${head}; you are running ${running}, which is older. ` + (pin.source === "package.json" && !pin.versionOnly ? "Run `npm install` here, or use " : "Use ") + `\`npx -y ${CLI_PACKAGE_NAME}@${exact} <command>\`.`;
40847
40855
  }
40848
40856
  function decidePin(dir, running, argv, env) {
40849
40857
  const none = { notice: null, delegate: null };
@@ -40853,6 +40861,18 @@ function decidePin(dir, running, argv, env) {
40853
40861
  if (!pin || pinSatisfied(pin, running))
40854
40862
  return none;
40855
40863
  const installed = installedPinnedCli(dir, pin, running);
40864
+ if (pin.versionOnly) {
40865
+ if (installed)
40866
+ return { notice: pinNotice(pin, running, installed.version), delegate: installed.bin };
40867
+ const version2 = import_semver.default.valid(pin.spec);
40868
+ if (version2) {
40869
+ return {
40870
+ notice: `This project is pinned to somewhere CLI ${version2}. Running it through npm\u2019s cache. Run \`${cliInvocation()} upgrade\` to move the pin.`,
40871
+ delegate: null,
40872
+ delegateVersion: version2
40873
+ };
40874
+ }
40875
+ }
40856
40876
  if (argv[2] === "deploy" && installed && import_semver.default.valid(running) && import_semver.default.lt(installed.version, running)) {
40857
40877
  return {
40858
40878
  notice: `This project is pinned to somewhere CLI ${pin.spec} (${pin.source}); deploy is using the running CLI ${running}.`,
@@ -40861,13 +40881,24 @@ function decidePin(dir, running, argv, env) {
40861
40881
  }
40862
40882
  return { notice: pinNotice(pin, running, installed?.version ?? null), delegate: installed?.bin ?? null };
40863
40883
  }
40884
+ function pinnedNpx(version2) {
40885
+ const args = ["--yes", "--prefer-offline", "--ignore-scripts", `${CLI_PACKAGE_NAME}@${version2}`];
40886
+ if (process.platform !== "win32")
40887
+ return { command: "npx", args };
40888
+ const besideNode = join7(dirname2(process.execPath), "node_modules", "npm", "bin", "npx-cli.js");
40889
+ const besideNpm = process.env.npm_execpath?.endsWith("npm-cli.js") ? join7(dirname2(process.env.npm_execpath), "npx-cli.js") : besideNode;
40890
+ const entry = [besideNpm, besideNode].find((path3) => existsSync7(path3));
40891
+ return entry ? { command: process.execPath, args: [entry, ...args] } : null;
40892
+ }
40864
40893
  function writeProjectPins(dir, pins, version2) {
40865
40894
  const written = [];
40866
40895
  for (const pin of pins) {
40867
40896
  const path3 = join7(dir, pin.source);
40868
40897
  const raw = readFileSync8(path3, "utf8");
40869
40898
  const json2 = JSON.parse(raw);
40870
- if (pin.source === "package.json") {
40899
+ if (pin.versionOnly) {
40900
+ json2.somewhere[PIN_FILE_KEY] = version2;
40901
+ } else if (pin.source === "package.json") {
40871
40902
  for (const section of ["devDependencies", "dependencies"]) {
40872
40903
  const deps = json2[section];
40873
40904
  if (deps && typeof deps === "object" && typeof deps[CLI_PACKAGE_NAME] === "string")
@@ -40878,7 +40909,8 @@ function writeProjectPins(dir, pins, version2) {
40878
40909
  }
40879
40910
  const indent = /^\{\s*\n(\s+)/.exec(raw)?.[1] ?? " ";
40880
40911
  writeFileSync7(path3, JSON.stringify(json2, null, indent) + "\n");
40881
- written.push(pin.source);
40912
+ if (!written.includes(pin.source))
40913
+ written.push(pin.source);
40882
40914
  }
40883
40915
  return written;
40884
40916
  }
@@ -40929,6 +40961,7 @@ var init_project_pin = __esm({
40929
40961
  PIN_EXEMPT = /* @__PURE__ */ new Set(["upgrade", "update", "init", "--version", "-V"]);
40930
40962
  PINNED_CHILD_ENV = "SOMEWHERE_PINNED_CLI";
40931
40963
  __name(decidePin, "decidePin");
40964
+ __name(pinnedNpx, "pinnedNpx");
40932
40965
  __name(writeProjectPins, "writeProjectPins");
40933
40966
  __name(recordPinIfMissing, "recordPinIfMissing");
40934
40967
  __name(readBundledChangelog, "readBundledChangelog");
@@ -42887,22 +42920,21 @@ var init_init_feature_template = __esm({
42887
42920
  "private": true,
42888
42921
  "version": "0.1.0",
42889
42922
  "type": "module",
42923
+ "somewhere": { "cli_version": "${CLI_VERSION}" },
42890
42924
  "scripts": {
42891
- "dev": "somewhere dev",
42892
- "typecheck": "somewhere typecheck"
42925
+ "dev": "npx -y @somewhere-cloud/cli dev",
42926
+ "typecheck": "npx -y @somewhere-cloud/cli typecheck"
42893
42927
  },
42894
42928
  "dependencies": {
42895
- "@somewhere-cloud/sdk": "0.14.2",
42929
+ "@somewhere-cloud/sdk": "0.14.2"
42930
+ },
42931
+ "optionalDependencies": {
42896
42932
  "react": "19.2.7",
42897
42933
  "react-dom": "19.2.7"
42898
42934
  },
42899
42935
  "devDependencies": {
42900
- "@somewhere-cloud/cli": "${CLI_VERSION}",
42901
- "@playwright/test": "1.65.0",
42902
42936
  "@types/react": "19.2.2",
42903
- "@types/react-dom": "19.2.2",
42904
- "typescript": "5.9.3",
42905
- "vite": "7.2.2"
42937
+ "@types/react-dom": "19.2.2"
42906
42938
  },
42907
42939
  "allowScripts": {
42908
42940
  "esbuild": true
@@ -45959,7 +45991,7 @@ __export(init_exports, {
45959
45991
  import { basename, join as join8 } from "node:path";
45960
45992
  import { existsSync as existsSync8 } from "node:fs";
45961
45993
  function registerInit(program2) {
45962
- program2.command("init").description("Write a starter app with a generated AGENTS.md guide").option("--name <name>", "Project name (skip prompt); sign-in and invitation emails show it").option("--subdomain <slug>", "Subdomain for the new project; default: derived from --name").option("--link", "Scaffold an empty directory and link an existing project; non-empty directories are link-only").option("--project <ref>", "Existing project ID, name, slug, or subdomain (requires --link)").option("--bare", "Create and link only: no starter source or dependencies (AGENTS.md/CLAUDE.md are still added when absent)").option("--template <name>", "Starter to write: auth (default, cookie sign-in) or minimal (auth route, no sign-in UI)", "auth").option("--features <ids>", "Generate selected modules into an empty directory, comma-separated: auth, magic-link, private-data, agent (see --catalog)").option("--ui <mode>", "With --features: styled (default; src/ui + design tokens) or headless (hooks and plain markup)").option("--catalog", "Print the module catalog for --features and exit; no login, project or files").option("--dry-run", "With --features: validate the selection and print the file plan; nothing is created").option("--json", "Print the created or linked project as JSON").addHelpText("after", `
45994
+ program2.command("init").description("Write a starter app with a generated AGENTS.md guide").option("--name <name>", "Project name (skip prompt); sign-in and invitation emails show it").option("--subdomain <slug>", "Subdomain for the new project; default: derived from --name").option("--link", "Scaffold an empty directory and link an existing project; non-empty directories are link-only").option("--project <ref>", "Existing project ID, name, slug, or subdomain (requires --link)").option("--bare", "Create and link only: no starter source or dependencies (AGENTS.md/CLAUDE.md are still added when absent)").option("--template <name>", "Starter to write: auth (default), minimal (auth route, no sign-in UI), or bare (link only)", "auth").option("--features <ids>", "Generate selected modules into an empty directory, comma-separated: auth, magic-link, private-data, agent (see --catalog)").option("--ui <mode>", "With --features: styled (default; src/ui + design tokens) or headless (hooks and plain markup)").option("--catalog", "Print the module catalog for --features and exit; no login, project or files").option("--dry-run", "With --features: validate the selection and print the file plan; nothing is created").option("--json", "Print the created or linked project as JSON").addHelpText("after", `
45963
45995
  ${FIRST_CLI_PERMISSION}
45964
45996
 
45965
45997
  Recommended for a new app: run \`${cliInvocation()} init\` in an empty directory.
@@ -45970,7 +46002,8 @@ replaceable views in src/ui/ and styles in src/styles/, plus an AGENTS.md workfl
45970
46002
  (deploy, then test). Sign-in and invitation links (sw.auth.invite) open
45971
46003
  /auth/magic, which the starter routes before the sign-in gate.
45972
46004
  \`--template minimal\` includes the SDK and auth route without sign-in screens.
45973
- Init installs the starter's pinned dependencies with npm install (downloads from npm and runs package install scripts).
46005
+ Init installs the SDK and editor types. The platform builds React when you deploy. Install the runtime for local development.
46006
+ TypeScript is fetched when first needed. Vite and Playwright are installed only if you choose to use them.
45974
46007
  New starters and --bare also install ${skillNames(BUNDLED_SKILLS_PACK).length} agent skills in .agents/skills, pinned by skills-lock.json.
45975
46008
 
45976
46009
  A directory that already holds an app (package.json, index.html, src/, \u2026) is
@@ -45989,6 +46022,8 @@ writes into an empty directory and is checked before the project is created.
45989
46022
  }
45990
46023
  async function runInit(opts, command) {
45991
46024
  const dir = process.cwd();
46025
+ if (opts.template === "bare")
46026
+ opts = { ...opts, bare: true };
45992
46027
  let plan;
45993
46028
  try {
45994
46029
  if (opts.catalog) {
@@ -46421,7 +46456,7 @@ var init_init = __esm({
46421
46456
  init_next_actions();
46422
46457
  init_output();
46423
46458
  INSTALL_STARTER_MESSAGE = "Installing the starter's pinned dependencies with `npm install` (downloads from npm and runs package install scripts)\u2026";
46424
- INIT_TEMPLATES = ["auth", "minimal"];
46459
+ INIT_TEMPLATES = ["auth", "minimal", "bare"];
46425
46460
  DEFAULT_AUTH_SELECTION = { requested: ["auth", "private-data"], added: [], modules: ["auth", "private-data"], ui: "styled" };
46426
46461
  __name(registerInit, "registerInit");
46427
46462
  __name(runInit, "runInit");
@@ -72137,7 +72172,7 @@ var init_role_method_hints = __esm({
72137
72172
 
72138
72173
  // dist/lib/notify/providers/update.js
72139
72174
  import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "node:fs";
72140
- import { dirname as dirname2, join as join10 } from "node:path";
72175
+ import { dirname as dirname3, join as join10 } from "node:path";
72141
72176
  function isNewer(a, b2) {
72142
72177
  const parse3 = /* @__PURE__ */ __name((v2) => v2.split("-")[0].split(".").map((n) => Number(n)), "parse");
72143
72178
  const pa = parse3(a);
@@ -72162,7 +72197,7 @@ function readCache(cachePath = CACHE_PATH) {
72162
72197
  }
72163
72198
  function writeCache(latest, checkedAt, cachePath = CACHE_PATH) {
72164
72199
  try {
72165
- const dir = dirname2(cachePath);
72200
+ const dir = dirname3(cachePath);
72166
72201
  if (!existsSync10(dir))
72167
72202
  mkdirSync7(dir, { recursive: true });
72168
72203
  writeFileSync8(cachePath, JSON.stringify({ checkedAt, latest }) + "\n", { mode: 384 });
@@ -72224,7 +72259,7 @@ async function getOutdatedWarning(currentVersion3, options2 = {}) {
72224
72259
  if (!latest || !isMinorBehind(currentVersion3, latest))
72225
72260
  return null;
72226
72261
  try {
72227
- const dir = dirname2(warnedPath);
72262
+ const dir = dirname3(warnedPath);
72228
72263
  if (!existsSync10(dir))
72229
72264
  mkdirSync7(dir, { recursive: true });
72230
72265
  writeFileSync8(warnedPath, JSON.stringify({ warnedAt: now2 }) + "\n", { mode: 384 });
@@ -72533,7 +72568,7 @@ __export(typecheck_exports, {
72533
72568
  import { spawn as spawn3, spawnSync } from "node:child_process";
72534
72569
  import { existsSync as existsSync12, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
72535
72570
  import { randomUUID as randomUUID4 } from "node:crypto";
72536
- import { dirname as dirname3, join as join13, relative as relative3 } from "node:path";
72571
+ import { dirname as dirname4, join as join13, relative as relative3 } from "node:path";
72537
72572
  function isUnresolvedBareImport(e) {
72538
72573
  if (!UNRESOLVED_DEP_CODES.has(e.code))
72539
72574
  return false;
@@ -72596,10 +72631,10 @@ function declaredDependencies(projectDir) {
72596
72631
  return declared;
72597
72632
  }
72598
72633
  function dependencyInstalled(projectDir, name) {
72599
- for (let dir = projectDir; ; dir = dirname3(dir)) {
72634
+ for (let dir = projectDir; ; dir = dirname4(dir)) {
72600
72635
  if (existsSync12(join13(dir, "node_modules", name, "package.json")))
72601
72636
  return true;
72602
- if (dirname3(dir) === dir)
72637
+ if (dirname4(dir) === dir)
72603
72638
  return false;
72604
72639
  }
72605
72640
  }
@@ -73675,9 +73710,9 @@ var init_handler = __esm({
73675
73710
  if (this.fsw.closed) {
73676
73711
  return;
73677
73712
  }
73678
- const dirname15 = sysPath.dirname(file2);
73713
+ const dirname16 = sysPath.dirname(file2);
73679
73714
  const basename11 = sysPath.basename(file2);
73680
- const parent = this.fsw._getWatchedDir(dirname15);
73715
+ const parent = this.fsw._getWatchedDir(dirname16);
73681
73716
  let prevStats = stats;
73682
73717
  if (parent.has(basename11))
73683
73718
  return;
@@ -73704,7 +73739,7 @@ var init_handler = __esm({
73704
73739
  prevStats = newStats2;
73705
73740
  }
73706
73741
  } catch (error3) {
73707
- this.fsw._remove(dirname15, basename11);
73742
+ this.fsw._remove(dirname16, basename11);
73708
73743
  }
73709
73744
  } else if (parent.has(basename11)) {
73710
73745
  const at2 = newStats.atimeMs;
@@ -75427,7 +75462,7 @@ var init_deploy_check = __esm({
75427
75462
  // dist/lib/agent-hooks.js
75428
75463
  import { existsSync as existsSync15, lstatSync as lstatSync3, mkdirSync as mkdirSync9, readFileSync as readFileSync16, realpathSync as realpathSync3, statSync as statSync3, writeFileSync as writeFileSync12 } from "node:fs";
75429
75464
  import { homedir as homedir2 } from "node:os";
75430
- import { delimiter, dirname as dirname6, isAbsolute as isAbsolute4, join as join18, relative as relative8, resolve as resolve9, sep } from "node:path";
75465
+ import { delimiter, dirname as dirname7, isAbsolute as isAbsolute4, join as join18, relative as relative8, resolve as resolve9, sep } from "node:path";
75431
75466
  function isAgentHost(value) {
75432
75467
  return AGENT_HOSTS.includes(value);
75433
75468
  }
@@ -75556,7 +75591,7 @@ function installAgentHooks(options2) {
75556
75591
  status = "added";
75557
75592
  }
75558
75593
  if (status !== "unchanged") {
75559
- mkdirSync9(dirname6(path3), { recursive: true });
75594
+ mkdirSync9(dirname7(path3), { recursive: true });
75560
75595
  writeFileSync12(path3, JSON.stringify(config2, null, 2) + "\n");
75561
75596
  }
75562
75597
  return { host, path: path3, status, activation: spec.activation };
@@ -75601,11 +75636,11 @@ function hookProjectRoot(host, payload, env = process.env, cwd = process.cwd())
75601
75636
  ].find((dir) => typeof dir === "string" && isAbsolute4(dir) && existsSync15(dir));
75602
75637
  if (!start)
75603
75638
  return null;
75604
- for (let dir = resolve9(start); ; dir = dirname6(dir)) {
75639
+ for (let dir = resolve9(start); ; dir = dirname7(dir)) {
75605
75640
  const config2 = join18(dir, HOSTS[host].configPath);
75606
75641
  if (existsSync15(config2) && HOOK_MARKER.test(readFileSync16(config2, "utf8")))
75607
75642
  return dir;
75608
- if (dirname6(dir) === dir)
75643
+ if (dirname7(dir) === dir)
75609
75644
  return null;
75610
75645
  }
75611
75646
  }
@@ -76453,7 +76488,7 @@ var init_claim_handoff = __esm({
76453
76488
 
76454
76489
  // dist/lib/project-notices.js
76455
76490
  import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
76456
- import { dirname as dirname7, join as join22 } from "node:path";
76491
+ import { dirname as dirname8, join as join22 } from "node:path";
76457
76492
  function localDay(now2) {
76458
76493
  const date5 = new Date(now2);
76459
76494
  return [date5.getFullYear(), date5.getMonth() + 1, date5.getDate()].map((part) => String(part).padStart(2, "0")).join("-");
@@ -76492,7 +76527,7 @@ async function showProjectNotices(client, projectRef3, options2 = {}) {
76492
76527
  const shown = Object.fromEntries(Object.entries(state.shown).filter(([, shownDay]) => shownDay === day));
76493
76528
  for (const notice of unseen)
76494
76529
  shown[`${response.project_id}:${notice.id}`] = day;
76495
- mkdirSync11(dirname7(statePath), { recursive: true });
76530
+ mkdirSync11(dirname8(statePath), { recursive: true });
76496
76531
  writeFileSync14(statePath, JSON.stringify({ shown }, null, 2) + "\n", { mode: 384 });
76497
76532
  return unseen;
76498
76533
  } catch {
@@ -77595,11 +77630,21 @@ var init_test_connectivity = __esm({
77595
77630
 
77596
77631
  // dist/lib/test-run.js
77597
77632
  import { createRequire as createRequire5 } from "node:module";
77598
- import { join as join28, dirname as dirname8 } from "node:path";
77633
+ import { pathToFileURL } from "node:url";
77634
+ import { join as join28, dirname as dirname9 } from "node:path";
77599
77635
  import { spawn as spawn4, spawnSync as spawnSync2 } from "node:child_process";
77600
77636
  import { appendFileSync as appendFileSync2, existsSync as existsSync24, readFileSync as readFileSync24, readdirSync as readdirSync5, rmSync as rmSync9 } from "node:fs";
77601
77637
  import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
77638
+ function testImportEnv(root, env) {
77639
+ if (!readProjectPin(root)?.versionOnly)
77640
+ return env;
77641
+ const hook2 = pathToFileURL(join28(CLI_PACKAGE_ROOT, "bin", "starter-test-imports.mjs"));
77642
+ return { ...env, NODE_OPTIONS: [env.NODE_OPTIONS, "--import=" + hook2.href].filter(Boolean).join(" ") };
77643
+ }
77602
77644
  function testDependencyError(root) {
77645
+ if (readProjectPin(root)?.versionOnly) {
77646
+ return new Error("Install Playwright for this project: npm install -D --save-exact @playwright/test@1.65.0");
77647
+ }
77603
77648
  return new Error(missingProjectDependencies(root).includes("@playwright/test") ? INSTALL_PROJECT_DEPENDENCIES : "Install project test dependencies: npm install -D @playwright/test @somewhere-cloud/cli");
77604
77649
  }
77605
77650
  async function prepareRunner(root) {
@@ -77635,7 +77680,7 @@ async function prepareRunner(root) {
77635
77680
  mark("browser-probe:end");
77636
77681
  let playwright = "unknown";
77637
77682
  try {
77638
- playwright = JSON.parse(readFileSync24(join28(dirname8(cli), "package.json"), "utf8")).version ?? "unknown";
77683
+ playwright = JSON.parse(readFileSync24(join28(dirname9(cli), "package.json"), "utf8")).version ?? "unknown";
77639
77684
  } catch {
77640
77685
  }
77641
77686
  return { cli, channel, version: version2, browserLaunchMs, playwright };
@@ -77674,7 +77719,7 @@ async function runTests(input) {
77674
77719
  ${line}
77675
77720
  `);
77676
77721
  const ipv4First = await span("address-probe", {}, () => addressOrder ?? testAddressOrder(origin));
77677
- const runnerEnv = { ...process.env, ...ipv4First ? { NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ""} --dns-result-order=ipv4first` } : {} };
77722
+ const runnerEnv = testImportEnv(root, { ...process.env, ...ipv4First ? { NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ""} --dns-result-order=ipv4first` } : {} });
77678
77723
  const files = options2.files ?? [];
77679
77724
  const failed = Boolean(options2.failed);
77680
77725
  const browser = `${prepared.channel ?? "chromium"} ${prepared.version}`;
@@ -77735,6 +77780,7 @@ var init_test_run = __esm({
77735
77780
  "dist/lib/test-run.js"() {
77736
77781
  "use strict";
77737
77782
  init_package_root();
77783
+ init_project_pin();
77738
77784
  init_config();
77739
77785
  init_test_identities();
77740
77786
  init_form_accounts();
@@ -77743,6 +77789,7 @@ var init_test_run = __esm({
77743
77789
  init_test_connectivity();
77744
77790
  init_typecheck();
77745
77791
  init_test_timeline();
77792
+ __name(testImportEnv, "testImportEnv");
77746
77793
  __name(testDependencyError, "testDependencyError");
77747
77794
  __name(prepareRunner, "prepareRunner");
77748
77795
  __name(runTests, "runTests");
@@ -78681,7 +78728,7 @@ var init_chrome = __esm({
78681
78728
  // dist/lib/browser-run.js
78682
78729
  import { writeFileSync as writeFileSync17 } from "node:fs";
78683
78730
  import { join as join30, resolve as resolve12 } from "node:path";
78684
- import { pathToFileURL } from "node:url";
78731
+ import { pathToFileURL as pathToFileURL2 } from "node:url";
78685
78732
  function isLoopbackUrl(raw) {
78686
78733
  let url3;
78687
78734
  try {
@@ -78698,7 +78745,7 @@ function isLoopbackUrl(raw) {
78698
78745
  }
78699
78746
  async function domOutlineScript() {
78700
78747
  const path3 = join30(CLI_PACKAGE_ROOT, "runtime", "browser-probes.mjs");
78701
- const probes = await import(pathToFileURL(path3).href);
78748
+ const probes = await import(pathToFileURL2(path3).href);
78702
78749
  return probes.DOM_OUTLINE_SCRIPT;
78703
78750
  }
78704
78751
  function isBrowserOwnFaviconRequest(url3, initiatorType) {
@@ -79227,7 +79274,7 @@ var init_verify_report = __esm({
79227
79274
  });
79228
79275
 
79229
79276
  // dist/commands/browser.js
79230
- import { dirname as dirname9, resolve as resolve13 } from "node:path";
79277
+ import { dirname as dirname10, resolve as resolve13 } from "node:path";
79231
79278
  import { readFileSync as readFileSync26 } from "node:fs";
79232
79279
  function readBrowserIncomplete(r) {
79233
79280
  const raw = r.incomplete;
@@ -79598,7 +79645,7 @@ function registerBrowser(program2) {
79598
79645
  try {
79599
79646
  const absolute = resolve13(file2);
79600
79647
  const raw = JSON.parse(readFileSync26(absolute, "utf8"));
79601
- const normalized = normalizeBrowserActions(raw, dirname9(absolute));
79648
+ const normalized = normalizeBrowserActions(raw, dirname10(absolute));
79602
79649
  if (!normalized.ok)
79603
79650
  throw new InvalidArgumentError(normalized.error);
79604
79651
  actionSequence.push(...normalized.actions);
@@ -79955,7 +80002,7 @@ var init_verify_keep = __esm({
79955
80002
  // dist/commands/verify.js
79956
80003
  import { randomBytes as randomBytes6 } from "node:crypto";
79957
80004
  import { existsSync as existsSync27, readFileSync as readFileSync28 } from "node:fs";
79958
- import { dirname as dirname10, resolve as resolve14 } from "node:path";
80005
+ import { dirname as dirname11, resolve as resolve14 } from "node:path";
79959
80006
  function navigationRetryNote(retries) {
79960
80007
  if (!retries.length)
79961
80008
  return "";
@@ -80193,7 +80240,7 @@ function loadVerifyFlow(path3, cwd = process.cwd()) {
80193
80240
  return normalizeVerifyFlow(void 0);
80194
80241
  const absolute = resolve14(cwd, path3);
80195
80242
  const parsed = readVerifyFlowFile(absolute, "--verify");
80196
- return normalizeVerifyFlow(parsed, dirname10(absolute));
80243
+ return normalizeVerifyFlow(parsed, dirname11(absolute));
80197
80244
  }
80198
80245
  function resolveViewport(input) {
80199
80246
  if (input === "desktop")
@@ -80710,7 +80757,7 @@ function loadVerifyInput(path3, cwd = process.cwd()) {
80710
80757
  return { kind: "single", flow: normalizeVerifyFlow(void 0) };
80711
80758
  const absolute = resolve14(cwd, path3);
80712
80759
  const parsed = readVerifyFlowFile(absolute, "--flow");
80713
- return isVerifyJourneyInput(parsed) ? { kind: "journey", journey: normalizeVerifyJourney(parsed, dirname10(absolute)) } : { kind: "single", flow: normalizeVerifyFlow(parsed, dirname10(absolute)) };
80760
+ return isVerifyJourneyInput(parsed) ? { kind: "journey", journey: normalizeVerifyJourney(parsed, dirname11(absolute)) } : { kind: "single", flow: normalizeVerifyFlow(parsed, dirname11(absolute)) };
80714
80761
  }
80715
80762
  function settleWithin(promise2, ms2) {
80716
80763
  if (ms2 <= 0)
@@ -83414,7 +83461,7 @@ var init_deploys = __esm({
83414
83461
 
83415
83462
  // dist/commands/pull.js
83416
83463
  import { existsSync as existsSync29, lstatSync as lstatSync4, mkdirSync as mkdirSync15, readFileSync as readFileSync29, readdirSync as readdirSync7, rmSync as rmSync12, writeFileSync as writeFileSync19 } from "node:fs";
83417
- import { basename as basename6, dirname as dirname11, join as join34, relative as relative10, resolve as resolve16 } from "node:path";
83464
+ import { basename as basename6, dirname as dirname12, join as join34, relative as relative10, resolve as resolve16 } from "node:path";
83418
83465
  function registerPull(program2) {
83419
83466
  program2.command("pull [project]").description(`Download a project's deployed source files to the current directory. Scaffolds a tsconfig.json + package.json (only if absent) so \`${cliInvocation()} typecheck\` can catch undefined symbols locally before you deploy. In a linked folder, plain pull is the safe update when live is newer: files you have not edited move to the live version, your local edits and local-only files (AGENTS.md, notes, tests) are kept, and it stops without writing anything if a file changed both here and live.`).option("--env <env>", "Environment to pull from (dev or prod)", "prod").option("--out <dir>", "Output directory", ".").option("--force", "Also replace files you edited here with live, and delete published files you edited that live no longer has. Never deletes a file a deploy would not upload (AGENTS.md, CLAUDE.md, README.md, tests, dotfiles, .somewhereignore matches)").option("--json", "Print the raw source response as JSON").action(async (projectArg, opts) => {
83420
83467
  const token = getToken();
@@ -83527,7 +83574,7 @@ function registerPull(program2) {
83527
83574
  if (existsSync29(target) && !overwrite.has(relPath)) {
83528
83575
  return;
83529
83576
  }
83530
- mkdirSync15(dirname11(target), { recursive: true });
83577
+ mkdirSync15(dirname12(target), { recursive: true });
83531
83578
  writeFileSync19(target, contents);
83532
83579
  written.push(relPath);
83533
83580
  }, "writeOne");
@@ -87251,7 +87298,7 @@ import { createRequire as createRequire7 } from "node:module";
87251
87298
  import { realpathSync as realpathSync4 } from "node:fs";
87252
87299
  import { createConnection, createServer as createNetServer } from "node:net";
87253
87300
  import { join as join37 } from "node:path";
87254
- import { pathToFileURL as pathToFileURL2 } from "node:url";
87301
+ import { pathToFileURL as pathToFileURL3 } from "node:url";
87255
87302
  function deployedOrigin(value) {
87256
87303
  const url3 = new URL(value);
87257
87304
  if (url3.protocol !== "https:" || url3.username || url3.password || url3.port || url3.pathname !== "/" || url3.search || url3.hash) {
@@ -87350,9 +87397,12 @@ async function startFrontendDev(cwd, target, port = 8787, open3 = false) {
87350
87397
  try {
87351
87398
  vitePath = createRequire7(join37(cwd, "package.json")).resolve("vite");
87352
87399
  } catch {
87400
+ if (readProjectPin(cwd)?.versionOnly) {
87401
+ throw new Error("Install the local frontend tools: npm install --include=optional -D --save-exact vite@7.2.2");
87402
+ }
87353
87403
  throw new Error(`Install this frontend\u2019s Vite dependencies before running ${cliInvocation()} dev. Backend changes run through ${cliInvocation()} deploy or ${cliInvocation()} preview.`);
87354
87404
  }
87355
- const vite = await import(pathToFileURL2(vitePath).href);
87405
+ const vite = await import(pathToFileURL3(vitePath).href);
87356
87406
  const localOrigin = `http://localhost:${port}`;
87357
87407
  const proxy = frontendProxy(origin, localOrigin);
87358
87408
  const server = await vite.createServer({
@@ -87407,6 +87457,7 @@ var FRONTEND_API_PATH, FRONTEND_DATA_PATH;
87407
87457
  var init_frontend_dev = __esm({
87408
87458
  "dist/lib/frontend-dev.js"() {
87409
87459
  "use strict";
87460
+ init_project_pin();
87410
87461
  init_cli_invocation();
87411
87462
  init_typecheck();
87412
87463
  init_declared_data();
@@ -89238,7 +89289,7 @@ var init_api2 = __esm({
89238
89289
  import { createReadStream as createReadStream2, createWriteStream as createWriteStream2 } from "node:fs";
89239
89290
  import { stat as stat5, rename, unlink } from "node:fs/promises";
89240
89291
  import { randomUUID as randomUUID9 } from "node:crypto";
89241
- import { basename as basename8, dirname as dirname12, extname as extname6, join as join40, resolve as resolve23 } from "node:path";
89292
+ import { basename as basename8, dirname as dirname13, extname as extname6, join as join40, resolve as resolve23 } from "node:path";
89242
89293
  import { pipeline as pipeline2 } from "node:stream/promises";
89243
89294
  function registerFs(program2) {
89244
89295
  const fs2 = program2.command("fs").description("Manage project file storage");
@@ -89282,7 +89333,7 @@ function registerFs(program2) {
89282
89333
  if (!response.body)
89283
89334
  throw new Error("The server returned an empty file response.");
89284
89335
  const destination = resolve23(local);
89285
- tempPath = join40(dirname12(destination), `.${basename8(destination)}.${randomUUID9()}.tmp`);
89336
+ tempPath = join40(dirname13(destination), `.${basename8(destination)}.${randomUUID9()}.tmp`);
89286
89337
  await pipeline2(response.body, createWriteStream2(tempPath, { flags: "wx" }));
89287
89338
  await rename(tempPath, destination);
89288
89339
  tempPath = void 0;
@@ -107048,7 +107099,7 @@ var require_polyfill = __commonJS({
107048
107099
  utimes
107049
107100
  } = __require("fs/promises");
107050
107101
  var {
107051
- dirname: dirname15,
107102
+ dirname: dirname16,
107052
107103
  isAbsolute: isAbsolute7,
107053
107104
  join: join50,
107054
107105
  parse: parse3,
@@ -107152,7 +107203,7 @@ var require_polyfill = __commonJS({
107152
107203
  }
107153
107204
  __name(getStats, "getStats");
107154
107205
  async function checkParentDir(destStat, src, dest, opts) {
107155
- const destParent = dirname15(dest);
107206
+ const destParent = dirname16(dest);
107156
107207
  const dirExists = await pathExists(destParent);
107157
107208
  if (dirExists) {
107158
107209
  return getStatsForCopy(destStat, src, dest, opts);
@@ -107170,8 +107221,8 @@ var require_polyfill = __commonJS({
107170
107221
  }
107171
107222
  __name(pathExists, "pathExists");
107172
107223
  async function checkParentPaths(src, srcStat, dest) {
107173
- const srcParent = resolve26(dirname15(src));
107174
- const destParent = resolve26(dirname15(dest));
107224
+ const srcParent = resolve26(dirname16(src));
107225
+ const destParent = resolve26(dirname16(dest));
107175
107226
  if (destParent === srcParent || destParent === parse3(destParent).root) {
107176
107227
  return;
107177
107228
  }
@@ -107341,7 +107392,7 @@ var require_polyfill = __commonJS({
107341
107392
  async function onLink(destStat, src, dest) {
107342
107393
  let resolvedSrc = await readlink(src);
107343
107394
  if (!isAbsolute7(resolvedSrc)) {
107344
- resolvedSrc = resolve26(dirname15(src), resolvedSrc);
107395
+ resolvedSrc = resolve26(dirname16(src), resolvedSrc);
107345
107396
  }
107346
107397
  if (!destStat) {
107347
107398
  return symlink(resolvedSrc, dest);
@@ -107356,7 +107407,7 @@ var require_polyfill = __commonJS({
107356
107407
  throw err;
107357
107408
  }
107358
107409
  if (!isAbsolute7(resolvedDest)) {
107359
- resolvedDest = resolve26(dirname15(dest), resolvedDest);
107410
+ resolvedDest = resolve26(dirname16(dest), resolvedDest);
107360
107411
  }
107361
107412
  if (isSrcSubdir(resolvedSrc, resolvedDest)) {
107362
107413
  throw new ERR_FS_CP_EINVAL({
@@ -107462,7 +107513,7 @@ var require_readdir_scoped = __commonJS({
107462
107513
  // node_modules/@npmcli/fs/lib/move-file.js
107463
107514
  var require_move_file = __commonJS({
107464
107515
  "node_modules/@npmcli/fs/lib/move-file.js"(exports, module) {
107465
- var { dirname: dirname15, join: join50, resolve: resolve26, relative: relative15, isAbsolute: isAbsolute7 } = __require("path");
107516
+ var { dirname: dirname16, join: join50, resolve: resolve26, relative: relative15, isAbsolute: isAbsolute7 } = __require("path");
107466
107517
  var fs2 = __require("fs/promises");
107467
107518
  var pathExists = /* @__PURE__ */ __name(async (path3) => {
107468
107519
  try {
@@ -107483,7 +107534,7 @@ var require_move_file = __commonJS({
107483
107534
  if (!options2.overwrite && await pathExists(destination)) {
107484
107535
  throw new Error(`The destination file exists: ${destination}`);
107485
107536
  }
107486
- await fs2.mkdir(dirname15(destination), { recursive: true });
107537
+ await fs2.mkdir(dirname16(destination), { recursive: true });
107487
107538
  try {
107488
107539
  await fs2.rename(source, destination);
107489
107540
  } catch (error3) {
@@ -107511,7 +107562,7 @@ var require_move_file = __commonJS({
107511
107562
  }
107512
107563
  let targetStat = "file";
107513
107564
  try {
107514
- targetStat = await fs2.stat(resolve26(dirname15(symSource), target));
107565
+ targetStat = await fs2.stat(resolve26(dirname16(symSource), target));
107515
107566
  if (targetStat.isDirectory()) {
107516
107567
  targetStat = "junction";
107517
107568
  }
@@ -129375,15 +129426,14 @@ function upgradeProject(dir, running, changelog = readBundledChangelog) {
129375
129426
  }
129376
129427
  const alreadyExact = pins.every((pin) => pin.spec === running);
129377
129428
  const updated = alreadyExact ? [] : writeProjectPins(dir, pins, running);
129378
- const next = updated.includes("package.json") ? ["npm install"] : [];
129429
+ const next = pins.some((pin) => pin.source === "package.json" && !pin.versionOnly && pin.spec !== running) ? ["npm install"] : [];
129379
129430
  return { from, to: running, updated, changes: changelogBetween(changelog(), from, running), next };
129380
129431
  }
129381
129432
  function registerUpgrade(program2) {
129382
129433
  program2.command("upgrade").description("Move this project to the CLI you are running: rewrite its recorded CLI version and print the changes in between").option("--json", "Print the result as JSON").addHelpText("after", `
129383
- A project records the CLI version it was built with (package.json devDependency
129384
- "${CLI_PACKAGE_NAME}", or "cli_version" in .somewhere.json). Commands run in a
129385
- project pinned to another version print one line saying so, and hand off to the
129386
- pinned version when it is installed in node_modules. To move to the newest release:
129434
+ New starters record somewhere.cli_version in package.json. The CLI uses the exact
129435
+ version from npm\u2019s cache when needed. Existing package dependencies and .somewhere.json
129436
+ pins still work. To move to the newest release:
129387
129437
  npx -y ${CLI_PACKAGE_NAME}@latest upgrade
129388
129438
  Agent skills are not changed; \`${cliInvocation()} skills update\` refreshes them.
129389
129439
  `).action((opts) => {
@@ -130480,7 +130530,7 @@ async function findNamedCronRow(target, explicit, signal) {
130480
130530
  throw new Error("cron_list returned a scheduled task without a cron_id.");
130481
130531
  return { ...matches[0], cron_id: id };
130482
130532
  }
130483
- async function resolveCronRunId(target, explicit) {
130533
+ async function resolveCronId(target, explicit) {
130484
130534
  if (target.startsWith("cron_"))
130485
130535
  return target;
130486
130536
  return (await findNamedCronRow(target, explicit)).cron_id;
@@ -130634,7 +130684,7 @@ zone each trigger is stored in, and \`cron update --schedule\` keeps that zone u
130634
130684
  if (opts.timeout !== void 0 && !opts.wait) {
130635
130685
  throw new Error("USAGE_ERROR: --timeout only applies with --wait.");
130636
130686
  }
130637
- const cronId = await resolveCronRunId(target, opts.project);
130687
+ const cronId = await resolveCronId(target, opts.project);
130638
130688
  if (opts.preview) {
130639
130689
  await runCronInPreview(cronId, opts, timeoutSeconds);
130640
130690
  return;
@@ -130753,12 +130803,11 @@ zone each trigger is stored in, and \`cron update --schedule\` keeps that zone u
130753
130803
  process.exitCode = 1;
130754
130804
  }
130755
130805
  });
130756
- cron.command("update <cron-id>").description("Update a scheduled trigger").option("--schedule <expression>", "New 5-field cron expression, read in the trigger's stored time zone (shown by cron list) unless --timezone changes it").option("--timezone <iana>", "New IANA time zone the schedule is read in, e.g. America/Los_Angeles; omit to keep the stored zone").option("--handler <path-or-url>", "New project-relative /api path or https URL").option("--name <name>", "New display name").option("--payload <json>", "New JSON object sent to the handler").option("--enable", "Resume future runs").option("--disable", "Pause future runs").option("--json", "Print the complete response as JSON").action(async (cronId, opts) => {
130806
+ cron.command("update <cron-id-or-name>").description("Update a scheduled trigger").option("-p, --project <project>", "Project slug or ID used to resolve a task name; defaults to the linked project").option("--schedule <expression>", "New 5-field cron expression, read in the trigger's stored time zone (shown by cron list) unless --timezone changes it").option("--timezone <iana>", "New IANA time zone the schedule is read in, e.g. America/Los_Angeles; omit to keep the stored zone").option("--handler <path-or-url>", "New project-relative /api path or https URL").option("--name <name>", "New display name").option("--payload <json>", "New JSON object sent to the handler").option("--enable", "Resume future runs").option("--disable", "Pause future runs").option("--json", "Print the complete response as JSON").action(async (target, opts) => {
130757
130807
  try {
130758
130808
  if (opts.enable && opts.disable)
130759
130809
  throw new Error("Pass --enable or --disable, not both.");
130760
130810
  const args = compactRecord([
130761
- ["cron_id", cronId],
130762
130811
  ["schedule", opts.schedule],
130763
130812
  ["timezone", opts.timezone],
130764
130813
  ["handler", opts.handler],
@@ -130766,19 +130815,26 @@ zone each trigger is stored in, and \`cron update --schedule\` keeps that zone u
130766
130815
  ["payload", parsePayload(opts.payload)],
130767
130816
  ["enabled", opts.enable ? true : opts.disable ? false : void 0]
130768
130817
  ]);
130769
- if (Object.keys(args).length === 1) {
130818
+ if (Object.keys(args).length === 0) {
130770
130819
  throw new Error("No update supplied. Pass a field such as --schedule, --timezone, --handler, --enable, or --disable.");
130771
130820
  }
130772
- await runCronTool("cron_update", args, opts.json, (value) => printCronMutation("Scheduled trigger updated", value));
130821
+ const cronId = await resolveCronId(target, opts.project);
130822
+ await runCronTool("cron_update", { cron_id: cronId, ...args }, opts.json, (value) => printCronMutation("Scheduled trigger updated", value));
130773
130823
  } catch (err) {
130774
- error(err instanceof Error ? err.message : String(err), err);
130775
- process.exitCode = 1;
130824
+ const { code, message: message3, extra } = platformErrorParts(err);
130825
+ printTypedCronError(code, message3, opts.json, extra);
130776
130826
  }
130777
130827
  });
130778
- cron.command("delete <cron-id>").alias("rm").description("Delete a scheduled trigger").option("--json", "Print the complete response as JSON").action(async (cronId, opts) => {
130779
- await runCronTool("cron_delete", { cron_id: cronId }, opts.json, (value) => {
130780
- printCronMutation("Scheduled trigger deleted", value);
130781
- });
130828
+ cron.command("delete <cron-id-or-name>").alias("rm").description("Delete a scheduled trigger").option("-p, --project <project>", "Project slug or ID used to resolve a task name; defaults to the linked project").option("--json", "Print the complete response as JSON").action(async (target, opts) => {
130829
+ try {
130830
+ const cronId = await resolveCronId(target, opts.project);
130831
+ await runCronTool("cron_delete", { cron_id: cronId }, opts.json, (value) => {
130832
+ printCronMutation("Scheduled trigger deleted", value);
130833
+ });
130834
+ } catch (err) {
130835
+ const { code, message: message3, extra } = platformErrorParts(err);
130836
+ printTypedCronError(code, message3, opts.json, extra);
130837
+ }
130782
130838
  });
130783
130839
  }
130784
130840
  var DEFAULT_WAIT_TIMEOUT_SECONDS, WAIT_POLL_INTERVAL_MS, JOB_SUCCESS_STATUS, JOB_FAILURE_STATUSES, CRON_RUN_UNAVAILABLE;
@@ -130817,7 +130873,7 @@ var init_cron = __esm({
130817
130873
  __name(printTypedCronError, "printTypedCronError");
130818
130874
  __name(cronProjectScope, "cronProjectScope");
130819
130875
  __name(findNamedCronRow, "findNamedCronRow");
130820
- __name(resolveCronRunId, "resolveCronRunId");
130876
+ __name(resolveCronId, "resolveCronId");
130821
130877
  __name(findCronRow, "findCronRow");
130822
130878
  __name(nextRunLabel, "nextRunLabel");
130823
130879
  __name(isOverdue, "isOverdue");
@@ -131026,7 +131082,7 @@ var init_reference_check_note = __esm({
131026
131082
  // dist/lib/test-scripts.js
131027
131083
  import { createRequire as createRequire8 } from "node:module";
131028
131084
  import { existsSync as existsSync36, mkdirSync as mkdirSync18, readFileSync as readFileSync39, readdirSync as readdirSync8, rmSync as rmSync14, statSync as statSync8, writeFileSync as writeFileSync24 } from "node:fs";
131029
- import { dirname as dirname13, join as join43, relative as relative12, resolve as resolve24 } from "node:path";
131085
+ import { dirname as dirname14, join as join43, relative as relative12, resolve as resolve24 } from "node:path";
131030
131086
  import { spawn as spawn7, spawnSync as spawnSync5 } from "node:child_process";
131031
131087
  function hasSpecFiles(root) {
131032
131088
  const walk2 = /* @__PURE__ */ __name((dir) => {
@@ -131083,6 +131139,7 @@ function failureReason(output) {
131083
131139
  return (error3 ?? detail.at(-1) ?? null)?.trim().slice(0, 300) ?? null;
131084
131140
  }
131085
131141
  async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)) {
131142
+ env = testImportEnv(root, env);
131086
131143
  const results = [];
131087
131144
  for (const script of scripts) {
131088
131145
  if (!existsSync36(join43(root, script))) {
@@ -131095,7 +131152,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
131095
131152
  const started = performance.now();
131096
131153
  let output = "";
131097
131154
  const handOver = join43(root, ".somewhere", "tests", `report-${results.length}.json`);
131098
- mkdirSync18(dirname13(handOver), { recursive: true });
131155
+ mkdirSync18(dirname14(handOver), { recursive: true });
131099
131156
  rmSync14(handOver, { force: true });
131100
131157
  const askedForBrowserLog = /(^|,)\s*(pw:browser|pw:\*|\*)\s*(,|$)/.test(env.DEBUG ?? "");
131101
131158
  const childEnv = { ...env, SW_TEST_REPORT: handOver, DEBUG: askedForBrowserLog ? env.DEBUG : [env.DEBUG, "pw:browser"].filter(Boolean).join(",") };
@@ -132023,13 +132080,24 @@ async function runCli() {
132023
132080
  const pinned = decidePin(process.cwd(), CLI_VERSION, process.argv, process.env);
132024
132081
  if (pinned.notice)
132025
132082
  process.stderr.write(pinned.notice + "\n");
132026
- if (pinned.delegate) {
132027
- const child = spawnSync6(process.execPath, [pinned.delegate, ...process.argv.slice(2)], {
132083
+ const invocation2 = pinned.delegate ? { command: process.execPath, args: [pinned.delegate] } : pinned.delegateVersion && pinnedNpx(pinned.delegateVersion);
132084
+ if (!invocation2 && pinned.delegateVersion) {
132085
+ process.stderr.write(`Could not find npx. Run npx -y @somewhere-cloud/cli@${pinned.delegateVersion} with this command.
132086
+ `);
132087
+ process.exitCode = 1;
132088
+ return;
132089
+ }
132090
+ if (invocation2) {
132091
+ const child = spawnSync6(invocation2.command, [...invocation2.args, ...process.argv.slice(2)], {
132028
132092
  stdio: "inherit",
132029
132093
  env: { ...process.env, [PINNED_CHILD_ENV]: "1" }
132030
132094
  });
132031
- if (child.error)
132032
- throw child.error;
132095
+ if (child.error) {
132096
+ process.stderr.write(`Could not start the pinned CLI: ${child.error.message}
132097
+ `);
132098
+ process.exitCode = 1;
132099
+ return;
132100
+ }
132033
132101
  if (child.signal)
132034
132102
  process.kill(process.pid, child.signal);
132035
132103
  process.exit(child.status ?? 1);
@@ -132825,7 +132893,7 @@ import { randomUUID as randomUUID10 } from "node:crypto";
132825
132893
  import { setDefaultResultOrder } from "node:dns";
132826
132894
  import { lookup } from "node:dns/promises";
132827
132895
  import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync26 } from "node:fs";
132828
- import { basename as basename10, dirname as dirname14, join as join48, relative as relative14, resolve as resolve25 } from "node:path";
132896
+ import { basename as basename10, dirname as dirname15, join as join48, relative as relative14, resolve as resolve25 } from "node:path";
132829
132897
  function launchOptions(extra = {}) {
132830
132898
  return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
132831
132899
  }
@@ -133188,7 +133256,7 @@ Stopping here: later checks are skipped. After a fix, rerun the scripts that fai
133188
133256
  this.checks.push({ name: "cleanup of sign-up accounts", ok: false, ms: 0, error: cleanup.join("; ") });
133189
133257
  const passed = this.checks.filter((check2) => check2.ok).length;
133190
133258
  const failed = this.checks.filter((check2) => !check2.ok && !check2.skipped).length;
133191
- mkdirSync20(dirname14(this.resultsPath), { recursive: true });
133259
+ mkdirSync20(dirname15(this.resultsPath), { recursive: true });
133192
133260
  writeFileSync26(this.resultsPath, JSON.stringify({
133193
133261
  identity: this.identity(),
133194
133262
  origin: this.origin,