@somewhere-cloud/cli 0.38.123 → 0.38.125

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.
@@ -36800,36 +36800,59 @@ function describeThisDevice() {
36800
36800
  arch: arch()
36801
36801
  };
36802
36802
  }
36803
- async function deviceLogin(callbacks) {
36803
+ async function deviceLogin(callbacks, temporaryToken) {
36804
36804
  const code = generateCode();
36805
36805
  const verifier = randomBytes(32).toString("base64url");
36806
36806
  const codeChallenge = createHash("sha256").update(verifier).digest("hex");
36807
36807
  const deviceName = getDeviceKeyName();
36808
36808
  const startRes = await fetchWithProxy(`${API_BASE}/v1/auth/device-code`, {
36809
36809
  method: "POST",
36810
- headers: { "Content-Type": "application/json" },
36811
- body: JSON.stringify({ code, code_challenge: codeChallenge, device_name: deviceName, client: describeThisDevice() })
36810
+ headers: {
36811
+ "Content-Type": "application/json",
36812
+ ...temporaryToken ? { Authorization: `Bearer ${temporaryToken}` } : {}
36813
+ },
36814
+ body: JSON.stringify({
36815
+ code,
36816
+ code_challenge: codeChallenge,
36817
+ device_name: deviceName,
36818
+ client: describeThisDevice(),
36819
+ ...temporaryToken ? { merge_temporary: true } : {}
36820
+ })
36812
36821
  });
36813
36822
  if (startRes.status === 404) {
36814
36823
  throw new DeviceCodeUnsupported();
36815
36824
  }
36816
36825
  if (!startRes.ok) {
36826
+ if (temporaryToken) {
36827
+ const reason = startRes.status === 401 ? "The temporary session is invalid or expired." : `The server refused the request (HTTP ${startRes.status}).`;
36828
+ throw new Error(`Could not start sign-in to save temporary projects. ${reason}`);
36829
+ }
36817
36830
  const text = await startRes.text();
36818
36831
  throw new Error(`Failed to start login: ${new URL(API_BASE).host} answered HTTP ${startRes.status} ${text.slice(0, 200)}. If this shell only allows listed sites (an agent sandbox), add ${new URL(API_BASE).host}, or run \`${cliInvocation()} login\` in your own terminal.`);
36819
36832
  }
36820
- const start = await startRes.json();
36833
+ const start = await startRes.json().catch(() => {
36834
+ throw new Error("The server returned an unreadable login registration. Start login again.");
36835
+ });
36821
36836
  if (start.data.verifier_bound !== true)
36822
36837
  throw new Error("This server does not support secure device redemption. Update the platform before login.");
36823
- callbacks.onPrompt({ code, approvalUrl: start.data.approval_url });
36838
+ const expiresIn = start.data.expires_in;
36839
+ if (!Number.isSafeInteger(expiresIn) || expiresIn <= 0) {
36840
+ throw new Error("The server did not say when the login code expires. Start login again.");
36841
+ }
36842
+ const deadline = performance.now() + expiresIn * 1e3;
36843
+ callbacks.onPrompt({ code, approvalUrl: start.data.approval_url, expiresIn });
36824
36844
  callbacks.onWaiting?.();
36825
- const startedAt = Date.now();
36826
- while (Date.now() - startedAt < TIMEOUT_MS) {
36827
- await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
36845
+ while (performance.now() < deadline) {
36846
+ await new Promise((r) => setTimeout(r, Math.min(POLL_INTERVAL_MS, Math.ceil(deadline - performance.now()))));
36847
+ if (performance.now() >= deadline)
36848
+ break;
36828
36849
  const pollRes = await fetchWithProxy(`${API_BASE}/v1/auth/device-code/status`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ code, verifier }) });
36829
36850
  if (!pollRes.ok) {
36830
36851
  throw new Error(`Login delivery could not be confirmed (HTTP ${pollRes.status}). Restart login; this redemption will not be retried.`);
36831
36852
  }
36832
- const status = await pollRes.json();
36853
+ const status = await pollRes.json().catch(() => {
36854
+ throw new Error("Login delivery could not be confirmed. Restart login; this redemption will not be retried.");
36855
+ });
36833
36856
  if (status.data.status === "expired") {
36834
36857
  throw new DeviceLoginTimeout();
36835
36858
  }
@@ -36837,6 +36860,9 @@ async function deviceLogin(callbacks) {
36837
36860
  throw new DeviceLoginDenied();
36838
36861
  }
36839
36862
  if (status.data.status === "approved") {
36863
+ if (typeof status.data.token !== "string" || !status.data.token || typeof status.data.email !== "string") {
36864
+ throw new Error("The server did not return a complete login session. Start login again.");
36865
+ }
36840
36866
  const config2 = {
36841
36867
  token: status.data.token,
36842
36868
  user: { email: status.data.email, username: "" }
@@ -36845,12 +36871,12 @@ async function deviceLogin(callbacks) {
36845
36871
  config2.refresh_token = status.data.refresh_token;
36846
36872
  if (status.data.expires_at)
36847
36873
  config2.access_expires_at = status.data.expires_at;
36848
- return { config: config2, scope: status.data.scope ?? null };
36874
+ return { config: config2, scope: status.data.scope ?? null, mergedProjectCount: status.data.merged_project_count };
36849
36875
  }
36850
36876
  }
36851
36877
  throw new DeviceLoginTimeout();
36852
36878
  }
36853
- var API_BASE, POLL_INTERVAL_MS, TIMEOUT_MS, ALPHABET, DeviceLoginTimeout, DeviceCodeUnsupported, DeviceLoginDenied;
36879
+ var API_BASE, POLL_INTERVAL_MS, ALPHABET, DeviceLoginTimeout, DeviceCodeUnsupported, DeviceLoginDenied;
36854
36880
  var init_device_login = __esm({
36855
36881
  "dist/lib/device-login.js"() {
36856
36882
  "use strict";
@@ -36861,7 +36887,6 @@ var init_device_login = __esm({
36861
36887
  init_http();
36862
36888
  API_BASE = API_BASE_URL.replace(/\/v1$/, "");
36863
36889
  POLL_INTERVAL_MS = 1e3;
36864
- TIMEOUT_MS = 5 * 60 * 1e3;
36865
36890
  ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
36866
36891
  __name(generateCode, "generateCode");
36867
36892
  DeviceLoginTimeout = class extends Error {
@@ -37132,7 +37157,8 @@ async function loginAction(opts) {
37132
37157
  await runBrowserCallbackLogin();
37133
37158
  return;
37134
37159
  }
37135
- await runDeviceLogin();
37160
+ const saved = loadConfig();
37161
+ await runDeviceLogin(saved?.temporary ? saved.token : void 0);
37136
37162
  }
37137
37163
  async function readPlanName(client, tierId) {
37138
37164
  try {
@@ -37479,21 +37505,27 @@ function installCancelHandler(getSpinner) {
37479
37505
  process.exit(130);
37480
37506
  });
37481
37507
  }
37482
- async function runDeviceLogin() {
37508
+ async function runDeviceLogin(temporaryToken) {
37483
37509
  for (const line of loginIntroLines())
37484
37510
  console.log(line);
37485
37511
  let spinner = null;
37486
37512
  installCancelHandler(() => spinner);
37487
37513
  try {
37488
- const { config: config2, scope } = await deviceLogin({
37489
- onPrompt: /* @__PURE__ */ __name(({ code, approvalUrl }) => {
37514
+ const { config: config2, scope, mergedProjectCount } = await deviceLogin({
37515
+ onPrompt: /* @__PURE__ */ __name(({ code, approvalUrl, expiresIn }) => {
37490
37516
  console.log(` Code: ${teal(code)}`);
37517
+ const minutes = expiresIn % 60 === 0 ? expiresIn / 60 : null;
37518
+ const duration3 = minutes === null ? `${expiresIn} second${expiresIn === 1 ? "" : "s"}` : `${minutes} minute${minutes === 1 ? "" : "s"}`;
37519
+ info(`Code expires in ${duration3}.`);
37491
37520
  console.log("");
37492
- console.log(" Opening your browser\u2026");
37493
- console.log(` If it doesn't open, visit: ${teal(approvalUrl)}`);
37521
+ const openBrowser = !process.env.SOMEWHERE_NO_BROWSER;
37522
+ if (openBrowser)
37523
+ console.log(" Opening your browser\u2026");
37524
+ console.log(` ${openBrowser ? "If it doesn't open, visit" : "Visit"}: ${teal(approvalUrl)}`);
37494
37525
  console.log("");
37495
- open(approvalUrl).catch(() => {
37496
- });
37526
+ if (openBrowser)
37527
+ open(approvalUrl).catch(() => {
37528
+ });
37497
37529
  }, "onPrompt"),
37498
37530
  onWaiting: /* @__PURE__ */ __name(() => {
37499
37531
  spinner = ora({
@@ -37501,11 +37533,14 @@ async function runDeviceLogin() {
37501
37533
  color: "cyan"
37502
37534
  }).start();
37503
37535
  }, "onWaiting")
37504
- });
37536
+ }, temporaryToken);
37505
37537
  spinner?.stop();
37506
37538
  saveConfig(config2);
37507
37539
  saveGlobalMcpConfig();
37508
37540
  success(`Logged in as ${teal(config2.user.email || "(unknown)")}`);
37541
+ if (mergedProjectCount && mergedProjectCount > 0) {
37542
+ info(`Added ${mergedProjectCount} temporary project${mergedProjectCount === 1 ? "" : "s"} to ${config2.user.email}.`);
37543
+ }
37509
37544
  success(`Device: ${getDeviceKeyName()}`);
37510
37545
  success(`Access: ${describeScope(scope)}`);
37511
37546
  success("Claude Code MCP configured");
@@ -37517,7 +37552,8 @@ async function runDeviceLogin() {
37517
37552
  error(err.message);
37518
37553
  process.exit(1);
37519
37554
  }
37520
- error(err instanceof Error ? err.message : String(err), err);
37555
+ const message3 = err instanceof Error ? err.message : String(err);
37556
+ error(message3, temporaryToken ? void 0 : err);
37521
37557
  process.exit(1);
37522
37558
  }
37523
37559
  }
@@ -37593,7 +37629,7 @@ import { spawn as spawn2 } from "node:child_process";
37593
37629
  function initInstallSpawnSpec(platform2) {
37594
37630
  return {
37595
37631
  command: platform2 === "win32" ? "npm.cmd" : "npm",
37596
- args: ["install", "--no-audit", "--no-fund", "--omit=optional"],
37632
+ args: ["install", "--no-audit", "--no-fund"],
37597
37633
  shell: platform2 === "win32"
37598
37634
  };
37599
37635
  }
@@ -37814,8 +37850,20 @@ var init_publish_surface = __esm({
37814
37850
  });
37815
37851
 
37816
37852
  // dist/lib/init-scaffold.js
37817
- import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync5, readdirSync, writeFileSync as writeFileSync5 } from "node:fs";
37853
+ import { existsSync as existsSync5, lstatSync, mkdirSync as mkdirSync5, readFileSync as readFileSync7, readdirSync, writeFileSync as writeFileSync5 } from "node:fs";
37818
37854
  import { dirname, relative, resolve as resolve3 } from "node:path";
37855
+ function starterNameSlug(name) {
37856
+ return name.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/[\s-]+/g, "-").replace(/^-|-$/g, "");
37857
+ }
37858
+ function readStarterProjectName(dir) {
37859
+ try {
37860
+ const pkg = JSON.parse(readFileSync7(resolve3(dir, "package.json"), "utf8"));
37861
+ const name = pkg?.somewhere?.project_name;
37862
+ return typeof name === "string" ? name.trim() || void 0 : void 0;
37863
+ } catch {
37864
+ return void 0;
37865
+ }
37866
+ }
37819
37867
  function canWriteInitScaffold(dir) {
37820
37868
  if (!existsSync5(dir))
37821
37869
  return true;
@@ -37890,6 +37938,8 @@ var init_init_scaffold = __esm({
37890
37938
  "use strict";
37891
37939
  init_publish_surface();
37892
37940
  PROJECT_LINK_README = "`.somewhere.json` records which Somewhere project this folder deploys to and is safe to commit.";
37941
+ __name(starterNameSlug, "starterNameSlug");
37942
+ __name(readStarterProjectName, "readStarterProjectName");
37893
37943
  INIT_METADATA = /* @__PURE__ */ new Set([
37894
37944
  ".DS_Store",
37895
37945
  ".git",
@@ -37906,7 +37956,7 @@ var init_init_scaffold = __esm({
37906
37956
 
37907
37957
  // dist/lib/skills-pack.js
37908
37958
  import { createHash as createHash2 } from "node:crypto";
37909
- import { existsSync as existsSync6, lstatSync as lstatSync2, mkdirSync as mkdirSync6, readFileSync as readFileSync7, readlinkSync, rmSync, rmdirSync, symlinkSync, writeFileSync as writeFileSync6 } from "node:fs";
37959
+ import { existsSync as existsSync6, lstatSync as lstatSync2, mkdirSync as mkdirSync6, readFileSync as readFileSync8, readlinkSync, rmSync, rmdirSync, symlinkSync, writeFileSync as writeFileSync6 } from "node:fs";
37910
37960
  import { join as join6 } from "node:path";
37911
37961
  function verifyPack(pack) {
37912
37962
  if (!pack || pack.schema !== 1 || pack.name !== "somewhere-skills" || typeof pack.version !== "string" || !Array.isArray(pack.files) || pack.files.length === 0) {
@@ -37940,7 +37990,7 @@ function readLock(dir) {
37940
37990
  return null;
37941
37991
  if (isSymlink(path3))
37942
37992
  throw new Error("Skills lock must not be a symlink.");
37943
- const lock = JSON.parse(readFileSync7(path3, "utf8"));
37993
+ const lock = JSON.parse(readFileSync8(path3, "utf8"));
37944
37994
  if (!lock || lock.pack !== "somewhere-skills" || typeof lock.version !== "string" || !lock.files || typeof lock.files !== "object" || Array.isArray(lock.files) || Object.entries(lock.files).some(([file2, hash2]) => !/^\.agents\/skills\/[a-z0-9][a-z0-9-]*\/SKILL\.md$/.test(file2) || typeof hash2 !== "string" || !/^[a-f0-9]{64}$/.test(hash2))) {
37945
37995
  throw new Error("Skills lock is malformed; nothing was changed.");
37946
37996
  }
@@ -37953,7 +38003,7 @@ function linkForClaude(dir, name) {
37953
38003
  if (existsSync6(at2) || isSymlink(at2)) {
37954
38004
  if (isSymlink(at2) && readlinkSync(at2) === target)
37955
38005
  return "link";
37956
- writeFileSync6(join6(at2, "SKILL.md"), readFileSync7(join6(dir, SKILLS_DIR, name, "SKILL.md")));
38006
+ writeFileSync6(join6(at2, "SKILL.md"), readFileSync8(join6(dir, SKILLS_DIR, name, "SKILL.md")));
37957
38007
  return "copy";
37958
38008
  }
37959
38009
  try {
@@ -37961,7 +38011,7 @@ function linkForClaude(dir, name) {
37961
38011
  return "link";
37962
38012
  } catch {
37963
38013
  mkdirSync6(at2, { recursive: true });
37964
- writeFileSync6(join6(at2, "SKILL.md"), readFileSync7(join6(dir, SKILLS_DIR, name, "SKILL.md")));
38014
+ writeFileSync6(join6(at2, "SKILL.md"), readFileSync8(join6(dir, SKILLS_DIR, name, "SKILL.md")));
37965
38015
  return "copy";
37966
38016
  }
37967
38017
  }
@@ -38047,7 +38097,7 @@ function preflightInstall(dir, pack, previous, state) {
38047
38097
  conflicts.push(claude);
38048
38098
  } else if (existsSync6(claude)) {
38049
38099
  const copy = join6(claude, "SKILL.md");
38050
- if (!owned || isSymlink(copy) || !existsSync6(copy) || sha256(readFileSync7(copy, "utf8")) !== owned)
38100
+ if (!owned || isSymlink(copy) || !existsSync6(copy) || sha256(readFileSync8(copy, "utf8")) !== owned)
38051
38101
  conflicts.push(claude);
38052
38102
  }
38053
38103
  }
@@ -38061,7 +38111,7 @@ function inspectFiles(dir, lock) {
38061
38111
  const full = join6(dir, path3);
38062
38112
  if (!existsSync6(full))
38063
38113
  missing.push(path3);
38064
- else if (sha256(readFileSync7(full, "utf8")) !== hash2)
38114
+ else if (sha256(readFileSync8(full, "utf8")) !== hash2)
38065
38115
  modified.push(path3);
38066
38116
  }
38067
38117
  return { missing, modified };
@@ -38322,7 +38372,7 @@ Keep each run short:
38322
38372
  text). Checks after a failure only wait out their timeouts. app.check() does both.
38323
38373
  - After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
38324
38374
  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.
38375
+ For a local Vite server, install the frontend tools with npm install -D --save-exact vite@7.2.2.
38326
38376
  The test helper, @somewhere-cloud/cli/script (import or require); these are all the calls a test needs:
38327
38377
  const app = await openAppTest(); // the live origin, release and data contract
38328
38378
  const ana = await app.signUp(page); // through your form: { id, email, password, verified }
@@ -38513,13 +38563,13 @@ declare module '*.${ext}' {
38513
38563
  });
38514
38564
 
38515
38565
  // dist/lib/init-green-template.js
38516
- function createGreenTemplate() {
38566
+ function createGreenTemplate(appName = "somewhere-starter") {
38517
38567
  return [
38518
38568
  { path: ".gitignore", content: buildScaffoldGitignore() },
38519
38569
  { path: "AGENTS.md", content: INIT_AGENTS_MD },
38520
38570
  { path: "CLAUDE.md", content: INIT_CLAUDE_MD },
38521
38571
  { path: "README.md", content: README },
38522
- { path: "package.json", content: PACKAGE_JSON },
38572
+ { path: "package.json", content: packageJson(appName) },
38523
38573
  { path: "tsconfig.json", content: TSCONFIG },
38524
38574
  {
38525
38575
  path: "index.html",
@@ -38536,7 +38586,7 @@ function createGreenTemplate() {
38536
38586
  ASSET_TYPES_FILE
38537
38587
  ];
38538
38588
  }
38539
- var PACKAGE_JSON, TSCONFIG, APP_TYPES, SCHEMA, API, SERVICE, APP, MAIN, STYLES, README;
38589
+ var packageJson, TSCONFIG, APP_TYPES, SCHEMA, API, SERVICE, APP, MAIN, STYLES, README;
38540
38590
  var init_init_green_template = __esm({
38541
38591
  "dist/lib/init-green-template.js"() {
38542
38592
  "use strict";
@@ -38545,20 +38595,18 @@ var init_init_green_template = __esm({
38545
38595
  init_init_scaffold();
38546
38596
  init_init_agent_guide();
38547
38597
  init_init_asset_types();
38548
- PACKAGE_JSON = `{
38549
- "name": "somewhere-starter",
38598
+ packageJson = /* @__PURE__ */ __name((appName) => `{
38599
+ "name": ${JSON.stringify(starterNameSlug(appName).slice(0, 214) || "somewhere-starter")},
38550
38600
  "private": true,
38551
38601
  "version": "0.1.0",
38552
38602
  "type": "module",
38553
- "somewhere": { "cli_version": "${CLI_VERSION}" },
38603
+ "somewhere": { "cli_version": "${CLI_VERSION}", "project_name": ${JSON.stringify(appName)} },
38554
38604
  "scripts": {
38555
38605
  "dev": "npx -y @somewhere-cloud/cli dev",
38556
38606
  "typecheck": "npx -y @somewhere-cloud/cli typecheck"
38557
38607
  },
38558
38608
  "dependencies": {
38559
- "@somewhere-cloud/sdk": "0.14.2"
38560
- },
38561
- "optionalDependencies": {
38609
+ "@somewhere-cloud/sdk": "0.14.2",
38562
38610
  "react": "19.2.7",
38563
38611
  "react-dom": "19.2.7"
38564
38612
  },
@@ -38570,7 +38618,7 @@ var init_init_green_template = __esm({
38570
38618
  "esbuild": true
38571
38619
  }
38572
38620
  }
38573
- `;
38621
+ `, "packageJson");
38574
38622
  TSCONFIG = `{
38575
38623
  "compilerOptions": {
38576
38624
  "target": "ES2022",
@@ -40782,13 +40830,13 @@ var require_semver2 = __commonJS({
40782
40830
  });
40783
40831
 
40784
40832
  // dist/lib/project-pin.js
40785
- import { existsSync as existsSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "node:fs";
40833
+ import { existsSync as existsSync7, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "node:fs";
40786
40834
  import { dirname as dirname2, join as join7 } from "node:path";
40787
40835
  function readJson(path3) {
40788
40836
  if (!existsSync7(path3))
40789
40837
  return null;
40790
40838
  try {
40791
- const value = JSON.parse(readFileSync8(path3, "utf8"));
40839
+ const value = JSON.parse(readFileSync9(path3, "utf8"));
40792
40840
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
40793
40841
  } catch {
40794
40842
  return null;
@@ -40860,6 +40908,8 @@ function decidePin(dir, running, argv, env) {
40860
40908
  const pin = readProjectPin(dir);
40861
40909
  if (!pin || pinSatisfied(pin, running))
40862
40910
  return none;
40911
+ if (argv[2] === "login" && loadConfig()?.temporary)
40912
+ return none;
40863
40913
  const installed = installedPinnedCli(dir, pin, running);
40864
40914
  if (pin.versionOnly) {
40865
40915
  if (installed)
@@ -40890,13 +40940,30 @@ function pinnedNpx(version2) {
40890
40940
  const entry = [besideNpm, besideNode].find((path3) => existsSync7(path3));
40891
40941
  return entry ? { command: process.execPath, args: [entry, ...args] } : null;
40892
40942
  }
40943
+ function repairStarterReact(json2, from) {
40944
+ if (from !== "0.38.123" && from !== "0.38.124")
40945
+ return false;
40946
+ const deps = json2.dependencies;
40947
+ const optional2 = json2.optionalDependencies;
40948
+ if (deps?.["@somewhere-cloud/sdk"] !== "0.14.2" || deps.react !== void 0 || deps["react-dom"] !== void 0 || optional2?.react !== "19.2.7" || optional2["react-dom"] !== "19.2.7")
40949
+ return false;
40950
+ deps.react = optional2.react;
40951
+ deps["react-dom"] = optional2["react-dom"];
40952
+ delete optional2.react;
40953
+ delete optional2["react-dom"];
40954
+ if (Object.keys(optional2).length === 0)
40955
+ delete json2.optionalDependencies;
40956
+ return true;
40957
+ }
40893
40958
  function writeProjectPins(dir, pins, version2) {
40894
- const written = [];
40959
+ const updated = [];
40960
+ let repairedStarter = false;
40895
40961
  for (const pin of pins) {
40896
40962
  const path3 = join7(dir, pin.source);
40897
- const raw = readFileSync8(path3, "utf8");
40963
+ const raw = readFileSync9(path3, "utf8");
40898
40964
  const json2 = JSON.parse(raw);
40899
40965
  if (pin.versionOnly) {
40966
+ repairedStarter = repairStarterReact(json2, pin.spec);
40900
40967
  json2.somewhere[PIN_FILE_KEY] = version2;
40901
40968
  } else if (pin.source === "package.json") {
40902
40969
  for (const section of ["devDependencies", "dependencies"]) {
@@ -40909,10 +40976,10 @@ function writeProjectPins(dir, pins, version2) {
40909
40976
  }
40910
40977
  const indent = /^\{\s*\n(\s+)/.exec(raw)?.[1] ?? " ";
40911
40978
  writeFileSync7(path3, JSON.stringify(json2, null, indent) + "\n");
40912
- if (!written.includes(pin.source))
40913
- written.push(pin.source);
40979
+ if (!updated.includes(pin.source))
40980
+ updated.push(pin.source);
40914
40981
  }
40915
- return written;
40982
+ return { updated, repairedStarter };
40916
40983
  }
40917
40984
  function recordPinIfMissing(dir, version2) {
40918
40985
  if (!import_semver.default.valid(version2) || readProjectPins(dir).length)
@@ -40926,7 +40993,7 @@ function recordPinIfMissing(dir, version2) {
40926
40993
  return true;
40927
40994
  }
40928
40995
  function readBundledChangelog() {
40929
- return readFileSync8(join7(CLI_PACKAGE_ROOT, "CHANGELOG.md"), "utf8");
40996
+ return readFileSync9(join7(CLI_PACKAGE_ROOT, "CHANGELOG.md"), "utf8");
40930
40997
  }
40931
40998
  function changelogBetween(markdown, from, to2) {
40932
40999
  const entries = [];
@@ -40948,6 +41015,7 @@ var init_project_pin = __esm({
40948
41015
  "use strict";
40949
41016
  init_package_root();
40950
41017
  init_cli_invocation();
41018
+ init_config();
40951
41019
  import_semver = __toESM(require_semver2(), 1);
40952
41020
  CLI_PACKAGE_NAME = "@somewhere-cloud/cli";
40953
41021
  PIN_FILE_KEY = "cli_version";
@@ -40962,6 +41030,7 @@ var init_project_pin = __esm({
40962
41030
  PINNED_CHILD_ENV = "SOMEWHERE_PINNED_CLI";
40963
41031
  __name(decidePin, "decidePin");
40964
41032
  __name(pinnedNpx, "pinnedNpx");
41033
+ __name(repairStarterReact, "repairStarterReact");
40965
41034
  __name(writeProjectPins, "writeProjectPins");
40966
41035
  __name(recordPinIfMissing, "recordPinIfMissing");
40967
41036
  __name(readBundledChangelog, "readBundledChangelog");
@@ -42852,7 +42921,7 @@ Rerun only to answer a question. A pass means the checks you wrote passed; say w
42852
42921
  After edits:`) },
42853
42922
  { path: "CLAUDE.md", content: INIT_CLAUDE_MD },
42854
42923
  { path: "README.md", content: readme(selection) },
42855
- { path: "package.json", content: PACKAGE_JSON2 },
42924
+ { path: "package.json", content: packageJson2(options2.appName) },
42856
42925
  { path: "tsconfig.json", content: TSCONFIG2 },
42857
42926
  { path: "index.html", content: indexHtml(options2.appName) },
42858
42927
  { path: "api/auth/[...path].ts", content: AUTH_API },
@@ -42903,7 +42972,7 @@ After edits:`) },
42903
42972
  }
42904
42973
  return files;
42905
42974
  }
42906
- var PACKAGE_JSON2, TSCONFIG2, AUTH_API, AUTH_TYPES, PROVIDER_SIGN_IN_HOOK, AUTH_CALLBACK_PAGE, AUTH_SERVICE, AUTH_HOOKS, ROUTES, APP2, SCHEMA2, NOTES_TYPES, NOTES_SERVICE, USE_NOTES, AGENT_TABLES, AGENT_SCHEMA_NOTE, CHAT_API, PROPOSALS_API, ASSISTANT_TYPES, ASSISTANT_SERVICE, USE_ASSISTANT, ASSISTANT_FIXTURES, ASSISTANT_FIXTURES_PAGE, ASSISTANT_FIXTURES_FLOW, STYLED_ASSISTANT_PANEL, PLAIN_ASSISTANT_PANEL, MFA_HOOK, MFA_VIEW, SIGN_IN_PAGE, SIGNED_IN_LAYOUT, NOTE_DETAIL_PAGE, DETAIL_PAGE, NOT_FOUND_PAGE, STYLED_FEEDBACK, STYLED_APP_SHELL, STYLED_NOTES_BOARD, PLAIN_FEEDBACK, PLAIN_APP_SHELL, PLAIN_NOTES_BOARD, NOTES_CSS, ASSISTANT_CSS, MAGIC_LINK_TYPES, MAGIC_LINK_HOOKS, CONNECTION_RETURN, MAGIC_LINK_PAGE, MAGIC_SIGN_IN_PAGE, STYLED_MAGIC_LINK, PLAIN_MAGIC_LINK, FORGOT_PASSWORD_API, RESET_PASSWORD_API, PASSWORD_RESET_PAGE, VERIFY_EMAIL_HOOK, PLAIN_VERIFY_EMAIL;
42975
+ var packageJson2, TSCONFIG2, AUTH_API, AUTH_TYPES, PROVIDER_SIGN_IN_HOOK, AUTH_CALLBACK_PAGE, AUTH_SERVICE, AUTH_HOOKS, ROUTES, APP2, SCHEMA2, NOTES_TYPES, NOTES_SERVICE, USE_NOTES, AGENT_TABLES, AGENT_SCHEMA_NOTE, CHAT_API, PROPOSALS_API, ASSISTANT_TYPES, ASSISTANT_SERVICE, USE_ASSISTANT, ASSISTANT_FIXTURES, ASSISTANT_FIXTURES_PAGE, ASSISTANT_FIXTURES_FLOW, STYLED_ASSISTANT_PANEL, PLAIN_ASSISTANT_PANEL, MFA_HOOK, MFA_VIEW, SIGN_IN_PAGE, SIGNED_IN_LAYOUT, NOTE_DETAIL_PAGE, DETAIL_PAGE, NOT_FOUND_PAGE, STYLED_FEEDBACK, STYLED_APP_SHELL, STYLED_NOTES_BOARD, PLAIN_FEEDBACK, PLAIN_APP_SHELL, PLAIN_NOTES_BOARD, NOTES_CSS, ASSISTANT_CSS, MAGIC_LINK_TYPES, MAGIC_LINK_HOOKS, CONNECTION_RETURN, MAGIC_LINK_PAGE, MAGIC_SIGN_IN_PAGE, STYLED_MAGIC_LINK, PLAIN_MAGIC_LINK, FORGOT_PASSWORD_API, RESET_PASSWORD_API, PASSWORD_RESET_PAGE, VERIFY_EMAIL_HOOK, PLAIN_VERIFY_EMAIL;
42907
42976
  var init_init_feature_template = __esm({
42908
42977
  "dist/lib/init-feature-template.js"() {
42909
42978
  "use strict";
@@ -42915,20 +42984,18 @@ var init_init_feature_template = __esm({
42915
42984
  init_init_scaffold();
42916
42985
  init_init_agent_guide();
42917
42986
  init_init_ui_kit();
42918
- PACKAGE_JSON2 = `{
42919
- "name": "somewhere-app",
42987
+ packageJson2 = /* @__PURE__ */ __name((appName) => `{
42988
+ "name": ${JSON.stringify(starterNameSlug(appName).slice(0, 214) || "somewhere-app")},
42920
42989
  "private": true,
42921
42990
  "version": "0.1.0",
42922
42991
  "type": "module",
42923
- "somewhere": { "cli_version": "${CLI_VERSION}" },
42992
+ "somewhere": { "cli_version": "${CLI_VERSION}", "project_name": ${JSON.stringify(appName)} },
42924
42993
  "scripts": {
42925
42994
  "dev": "npx -y @somewhere-cloud/cli dev",
42926
42995
  "typecheck": "npx -y @somewhere-cloud/cli typecheck"
42927
42996
  },
42928
42997
  "dependencies": {
42929
- "@somewhere-cloud/sdk": "0.14.2"
42930
- },
42931
- "optionalDependencies": {
42998
+ "@somewhere-cloud/sdk": "0.14.2",
42932
42999
  "react": "19.2.7",
42933
43000
  "react-dom": "19.2.7"
42934
43001
  },
@@ -42940,7 +43007,7 @@ var init_init_feature_template = __esm({
42940
43007
  "esbuild": true
42941
43008
  }
42942
43009
  }
42943
- `;
43010
+ `, "packageJson");
42944
43011
  TSCONFIG2 = `{
42945
43012
  "compilerOptions": {
42946
43013
  "target": "ES2022",
@@ -46002,7 +46069,7 @@ replaceable views in src/ui/ and styles in src/styles/, plus an AGENTS.md workfl
46002
46069
  (deploy, then test). Sign-in and invitation links (sw.auth.invite) open
46003
46070
  /auth/magic, which the starter routes before the sign-in gate.
46004
46071
  \`--template minimal\` includes the SDK and auth route without sign-in screens.
46005
- Init installs the SDK and editor types. The platform builds React when you deploy. Install the runtime for local development.
46072
+ Init installs React, the SDK and editor types. The platform builds your source when you deploy.
46006
46073
  TypeScript is fetched when first needed. Vite and Playwright are installed only if you choose to use them.
46007
46074
  New starters and --bare also install ${skillNames(BUNDLED_SKILLS_PACK).length} agent skills in .agents/skills, pinned by skills-lock.json.
46008
46075
 
@@ -46091,7 +46158,7 @@ async function runInit(opts, command) {
46091
46158
  process.exit(2);
46092
46159
  }
46093
46160
  }
46094
- const scaffoldFiles = /* @__PURE__ */ __name((projectName) => template === "minimal" && !plan ? createGreenTemplate() : createFeatureTemplate(plan?.selection ?? DEFAULT_AUTH_SELECTION, { appName: projectName }), "scaffoldFiles");
46161
+ const scaffoldFiles = /* @__PURE__ */ __name((projectName) => template === "minimal" && !plan ? createGreenTemplate(projectName) : createFeatureTemplate(plan?.selection ?? DEFAULT_AUTH_SELECTION, { appName: projectName }), "scaffoldFiles");
46095
46162
  const storedConfig = loadConfig();
46096
46163
  if (!hasUsableCredential(storedConfig) && !opts.link && !opts.bare) {
46097
46164
  const expiredTemporaryAt = temporaryConfigExpired(storedConfig) ? storedConfig.temp_expires_at : void 0;
@@ -72074,7 +72141,7 @@ var init_privacy = __esm({
72074
72141
  });
72075
72142
 
72076
72143
  // dist/lib/role-method-hints.js
72077
- import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync9 } from "node:fs";
72144
+ import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "node:fs";
72078
72145
  import { createRequire as createRequire2 } from "node:module";
72079
72146
  import { join as join9, relative as relative2, resolve as resolve4 } from "node:path";
72080
72147
  function roleMethodHints(projectDir, { removedOnly = false } = {}) {
@@ -72113,7 +72180,7 @@ function roleMethodHints(projectDir, { removedOnly = false } = {}) {
72113
72180
  }
72114
72181
  if (!entry.isFile() || !/\.[cm]?[jt]sx?$/.test(entry.name) || /\.d\.ts$/.test(entry.name))
72115
72182
  continue;
72116
- const file2 = ts2.createSourceFile(path3, readFileSync9(path3, "utf8"), ts2.ScriptTarget.Latest, true);
72183
+ const file2 = ts2.createSourceFile(path3, readFileSync10(path3, "utf8"), ts2.ScriptTarget.Latest, true);
72117
72184
  const exports = /* @__PURE__ */ new Set();
72118
72185
  let unknown2 = false;
72119
72186
  for (const statement of file2.statements) {
@@ -72171,7 +72238,7 @@ var init_role_method_hints = __esm({
72171
72238
  });
72172
72239
 
72173
72240
  // dist/lib/notify/providers/update.js
72174
- import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "node:fs";
72241
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
72175
72242
  import { dirname as dirname3, join as join10 } from "node:path";
72176
72243
  function isNewer(a, b2) {
72177
72244
  const parse3 = /* @__PURE__ */ __name((v2) => v2.split("-")[0].split(".").map((n) => Number(n)), "parse");
@@ -72187,7 +72254,7 @@ function isNewer(a, b2) {
72187
72254
  }
72188
72255
  function readCache(cachePath = CACHE_PATH) {
72189
72256
  try {
72190
- const c = JSON.parse(readFileSync10(cachePath, "utf8"));
72257
+ const c = JSON.parse(readFileSync11(cachePath, "utf8"));
72191
72258
  if (typeof c?.checkedAt !== "number")
72192
72259
  return null;
72193
72260
  return c;
@@ -72250,7 +72317,7 @@ async function getOutdatedWarning(currentVersion3, options2 = {}) {
72250
72317
  const warnedPath = options2.warnedPath ?? WARNED_PATH;
72251
72318
  const now2 = (options2.now ?? Date.now)();
72252
72319
  try {
72253
- const warned2 = JSON.parse(readFileSync10(warnedPath, "utf8"));
72320
+ const warned2 = JSON.parse(readFileSync11(warnedPath, "utf8"));
72254
72321
  if (typeof warned2.warnedAt === "number" && now2 - warned2.warnedAt < ONE_DAY && now2 >= warned2.warnedAt)
72255
72322
  return null;
72256
72323
  } catch {
@@ -72322,7 +72389,7 @@ var init_update = __esm({
72322
72389
  });
72323
72390
 
72324
72391
  // dist/lib/notify/index.js
72325
- import { readFileSync as readFileSync11 } from "node:fs";
72392
+ import { readFileSync as readFileSync12 } from "node:fs";
72326
72393
  import { join as join11 } from "node:path";
72327
72394
  function suppressExitNotices() {
72328
72395
  exitNoticesSuppressed = true;
@@ -72337,7 +72404,7 @@ function subcommandSuppressesNotifications(argv) {
72337
72404
  }
72338
72405
  function currentVersion() {
72339
72406
  try {
72340
- const pkg = JSON.parse(readFileSync11(join11(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
72407
+ const pkg = JSON.parse(readFileSync12(join11(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
72341
72408
  return pkg.version;
72342
72409
  } catch {
72343
72410
  return "0.0.0";
@@ -72399,11 +72466,11 @@ __export(declared_data_exports, {
72399
72466
  declaredDataPlugin: () => declaredDataPlugin,
72400
72467
  prepareDeclaredData: () => prepareDeclaredData
72401
72468
  });
72402
- import { existsSync as existsSync11, readFileSync as readFileSync12, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "node:fs";
72469
+ import { existsSync as existsSync11, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync9 } from "node:fs";
72403
72470
  import { createRequire as createRequire3 } from "node:module";
72404
72471
  import { join as join12, resolve as resolve5 } from "node:path";
72405
72472
  function generatedContents(path3) {
72406
- const previous = existsSync11(path3) ? readFileSync12(path3, "utf8") : void 0;
72473
+ const previous = existsSync11(path3) ? readFileSync13(path3, "utf8") : void 0;
72407
72474
  if (previous !== void 0 && !previous.startsWith(GENERATED_DATA_HEADER)) {
72408
72475
  throw new Error(`Cannot overwrite ${path3}; this path is reserved for a generated declaration.`);
72409
72476
  }
@@ -72414,8 +72481,8 @@ function prepareDeclaredData(projectDir) {
72414
72481
  const declarationDir = existsSync11(join12(projectDir, "src")) ? join12(projectDir, "src") : projectDir;
72415
72482
  const declarationPath = join12(declarationDir, DATA_DECLARATION_FILE);
72416
72483
  const filesPath = join12(declarationDir, FILES_DECLARATION_FILE);
72417
- const previous = existsSync11(declarationPath) ? readFileSync12(declarationPath, "utf8") : void 0;
72418
- const previousFiles = existsSync11(filesPath) ? readFileSync12(filesPath, "utf8") : void 0;
72484
+ const previous = existsSync11(declarationPath) ? readFileSync13(declarationPath, "utf8") : void 0;
72485
+ const previousFiles = existsSync11(filesPath) ? readFileSync13(filesPath, "utf8") : void 0;
72419
72486
  if (!existsSync11(schemaPath)) {
72420
72487
  if (previousFiles?.startsWith(GENERATED_DATA_HEADER))
72421
72488
  rmSync2(filesPath);
@@ -72436,7 +72503,7 @@ function prepareDeclaredData(projectDir) {
72436
72503
  let filesDeclaration;
72437
72504
  const generator = require3("./runtime/declared-data.cjs");
72438
72505
  try {
72439
- const files = { "db/schema.ts": readFileSync12(schemaPath, "utf8") };
72506
+ const files = { "db/schema.ts": readFileSync13(schemaPath, "utf8") };
72440
72507
  client = generator.generateFromFiles(files);
72441
72508
  localDeclaration = generator.localDeclarationFromFiles(files);
72442
72509
  tables = generator.declaredTablesFromFiles(files);
@@ -72566,7 +72633,7 @@ __export(typecheck_exports, {
72566
72633
  typecheckTimeoutMs: () => typecheckTimeoutMs
72567
72634
  });
72568
72635
  import { spawn as spawn3, spawnSync } from "node:child_process";
72569
- import { existsSync as existsSync12, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
72636
+ import { existsSync as existsSync12, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
72570
72637
  import { randomUUID as randomUUID4 } from "node:crypto";
72571
72638
  import { dirname as dirname4, join as join13, relative as relative3 } from "node:path";
72572
72639
  function isUnresolvedBareImport(e) {
@@ -72606,7 +72673,7 @@ function resolveTsc(projectDir) {
72606
72673
  function declaredDependencies(projectDir) {
72607
72674
  let manifest;
72608
72675
  try {
72609
- manifest = JSON.parse(readFileSync13(join13(projectDir, "package.json"), "utf8"));
72676
+ manifest = JSON.parse(readFileSync14(join13(projectDir, "package.json"), "utf8"));
72610
72677
  } catch {
72611
72678
  return {};
72612
72679
  }
@@ -74813,7 +74880,7 @@ __export(files_exports, {
74813
74880
  testExclusionReason: () => testExclusionReason,
74814
74881
  testFolderOf: () => testFolderOf
74815
74882
  });
74816
- import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as readFileSync14, statSync as statSync2 } from "node:fs";
74883
+ import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as readFileSync15, statSync as statSync2 } from "node:fs";
74817
74884
  import { extname as extname3, isAbsolute as isAbsolute2, join as join16, relative as relative6 } from "node:path";
74818
74885
  function isTestSourcePath(relPath) {
74819
74886
  return TEST_SOURCE_NAME.test(relPath.slice(relPath.lastIndexOf("/") + 1));
@@ -74883,7 +74950,7 @@ function collectFiles(baseDir, options2 = {}) {
74883
74950
  }
74884
74951
  const corpusFiles = /* @__PURE__ */ __name((paths) => paths.filter((relPath) => isReferenceCorpusPath(relPath) && (sizes.get(relPath) ?? 0) <= MAX_FILE_SIZE).map((relPath) => {
74885
74952
  try {
74886
- return [relPath, readFileSync14(join16(baseDir, relPath), "utf-8")];
74953
+ return [relPath, readFileSync15(join16(baseDir, relPath), "utf-8")];
74887
74954
  } catch {
74888
74955
  return [relPath, ""];
74889
74956
  }
@@ -74962,7 +75029,7 @@ function walk(baseDir, currentDir, out, ignore, candidates, sizes) {
74962
75029
  out.sensitive.push({ path: relPath, reason: SENSITIVE_FILE_REASON, referencedBy: [] });
74963
75030
  continue;
74964
75031
  }
74965
- if ((entry.name === DATA_DECLARATION_FILE || entry.name === FILES_DECLARATION_FILE) && readFileSync14(fullPath, "utf8").startsWith(GENERATED_DATA_HEADER))
75032
+ if ((entry.name === DATA_DECLARATION_FILE || entry.name === FILES_DECLARATION_FILE) && readFileSync15(fullPath, "utf8").startsWith(GENERATED_DATA_HEADER))
74966
75033
  continue;
74967
75034
  sizes.set(relPath, statSync2(fullPath).size);
74968
75035
  candidates.push(relPath);
@@ -74986,11 +75053,11 @@ function classifyInto(out, baseDir, relPath, readBinary = true) {
74986
75053
  const fullPath = join16(baseDir, relPath);
74987
75054
  const { kind, key } = classifyKey(relPath);
74988
75055
  if (kind === "function") {
74989
- out.functions[key] = readFileSync14(fullPath, "utf-8");
75056
+ out.functions[key] = readFileSync15(fullPath, "utf-8");
74990
75057
  } else if (kind === "binary") {
74991
- out.binaryFiles[key] = readBinary ? readFileSync14(fullPath).toString("base64") : "";
75058
+ out.binaryFiles[key] = readBinary ? readFileSync15(fullPath).toString("base64") : "";
74992
75059
  } else {
74993
- out.files[key] = readFileSync14(fullPath, "utf-8");
75060
+ out.files[key] = readFileSync15(fullPath, "utf-8");
74994
75061
  }
74995
75062
  }
74996
75063
  function formatBytes(bytes) {
@@ -75010,7 +75077,7 @@ function loadDeployIgnore(baseDir) {
75010
75077
  const path3 = join16(baseDir, fileName2);
75011
75078
  if (!existsSync13(path3))
75012
75079
  continue;
75013
- const lines = readFileSync14(path3, "utf8").split(/\r?\n/);
75080
+ const lines = readFileSync15(path3, "utf8").split(/\r?\n/);
75014
75081
  for (const raw of lines) {
75015
75082
  const rule = parseIgnoreRule(raw);
75016
75083
  if (!rule)
@@ -75266,12 +75333,12 @@ var init_files = __esm({
75266
75333
 
75267
75334
  // dist/lib/deploy-check.js
75268
75335
  import { randomUUID as randomUUID5 } from "node:crypto";
75269
- import { existsSync as existsSync14, mkdirSync as mkdirSync8, readFileSync as readFileSync15, realpathSync as realpathSync2, rmSync as rmSync4, writeFileSync as writeFileSync11 } from "node:fs";
75336
+ import { existsSync as existsSync14, mkdirSync as mkdirSync8, readFileSync as readFileSync16, realpathSync as realpathSync2, rmSync as rmSync4, writeFileSync as writeFileSync11 } from "node:fs";
75270
75337
  import { createRequire as createRequire4 } from "node:module";
75271
75338
  import { isAbsolute as isAbsolute3, join as join17, relative as relative7, resolve as resolve8 } from "node:path";
75272
75339
  function projectTypeScriptVersion(projectDir) {
75273
75340
  try {
75274
- const version2 = JSON.parse(readFileSync15(join17(projectDir, "node_modules", "typescript", "package.json"), "utf8")).version;
75341
+ const version2 = JSON.parse(readFileSync16(join17(projectDir, "node_modules", "typescript", "package.json"), "utf8")).version;
75275
75342
  return typeof version2 === "string" && version2 ? version2 : null;
75276
75343
  } catch {
75277
75344
  return null;
@@ -75285,7 +75352,7 @@ function announceDeployCheckFetch(projectDir) {
75285
75352
  function deployCheckTsc(projectDir, platform2 = process.platform) {
75286
75353
  try {
75287
75354
  const manifest = join17(projectDir, "node_modules", "typescript", "package.json");
75288
- if (JSON.parse(readFileSync15(manifest, "utf8")).version === DEPLOY_CHECK_TYPESCRIPT_VERSION) {
75355
+ if (JSON.parse(readFileSync16(manifest, "utf8")).version === DEPLOY_CHECK_TYPESCRIPT_VERSION) {
75289
75356
  return { command: process.execPath, args: [join17(projectDir, "node_modules", "typescript", "bin", "tsc")] };
75290
75357
  }
75291
75358
  } catch {
@@ -75390,7 +75457,7 @@ async function startDeployCheck(projectDir) {
75390
75457
  if (checked.length === 0)
75391
75458
  return { ok: true, findings: [], typescript, checkedFiles: 0 };
75392
75459
  const tsconfigPath = join17(projectDir, "tsconfig.json");
75393
- const own = projectCompilerOptions(existsSync14(tsconfigPath) ? readFileSync15(tsconfigPath, "utf8") : void 0);
75460
+ const own = projectCompilerOptions(existsSync14(tsconfigPath) ? readFileSync16(tsconfigPath, "utf8") : void 0);
75394
75461
  const id = randomUUID5();
75395
75462
  const config2 = join17(projectDir, `.__somewhere_deploy_check_${id}.json`);
75396
75463
  const declarationsDir = join17(projectDir, `.__somewhere_deploy_check_${id}`);
@@ -75460,7 +75527,7 @@ var init_deploy_check = __esm({
75460
75527
  });
75461
75528
 
75462
75529
  // dist/lib/agent-hooks.js
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";
75530
+ import { existsSync as existsSync15, lstatSync as lstatSync3, mkdirSync as mkdirSync9, readFileSync as readFileSync17, realpathSync as realpathSync3, statSync as statSync3, writeFileSync as writeFileSync12 } from "node:fs";
75464
75531
  import { homedir as homedir2 } from "node:os";
75465
75532
  import { delimiter, dirname as dirname7, isAbsolute as isAbsolute4, join as join18, relative as relative8, resolve as resolve9, sep } from "node:path";
75466
75533
  function isAgentHost(value) {
@@ -75498,7 +75565,7 @@ function readConfig(path3) {
75498
75565
  if (!existsSync15(path3))
75499
75566
  return {};
75500
75567
  try {
75501
- const parsed = JSON.parse(readFileSync16(path3, "utf8"));
75568
+ const parsed = JSON.parse(readFileSync17(path3, "utf8"));
75502
75569
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : new Error("is not a JSON object");
75503
75570
  } catch (error3) {
75504
75571
  return error3 instanceof Error ? error3 : new Error(String(error3));
@@ -75638,7 +75705,7 @@ function hookProjectRoot(host, payload, env = process.env, cwd = process.cwd())
75638
75705
  return null;
75639
75706
  for (let dir = resolve9(start); ; dir = dirname7(dir)) {
75640
75707
  const config2 = join18(dir, HOSTS[host].configPath);
75641
- if (existsSync15(config2) && HOOK_MARKER.test(readFileSync16(config2, "utf8")))
75708
+ if (existsSync15(config2) && HOOK_MARKER.test(readFileSync17(config2, "utf8")))
75642
75709
  return dir;
75643
75710
  if (dirname7(dir) === dir)
75644
75711
  return null;
@@ -75962,7 +76029,7 @@ var init_typecheck2 = __esm({
75962
76029
 
75963
76030
  // dist/lib/base-files.js
75964
76031
  import { createHash as createHash3 } from "node:crypto";
75965
- import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync17, rmSync as rmSync5, writeFileSync as writeFileSync13 } from "node:fs";
76032
+ import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync18, rmSync as rmSync5, writeFileSync as writeFileSync13 } from "node:fs";
75966
76033
  import { join as join20 } from "node:path";
75967
76034
  function sha2562(content) {
75968
76035
  return createHash3("sha256").update(content).digest("hex");
@@ -75970,7 +76037,7 @@ function sha2562(content) {
75970
76037
  function hashFiles(dir, paths) {
75971
76038
  const out = {};
75972
76039
  for (const path3 of paths)
75973
- out[path3] = sha2562(readFileSync17(join20(dir, path3)));
76040
+ out[path3] = sha2562(readFileSync18(join20(dir, path3)));
75974
76041
  return out;
75975
76042
  }
75976
76043
  function saveBaseFiles(dir, base) {
@@ -75985,7 +76052,7 @@ function loadBaseFiles(dir, projectId, releaseId) {
75985
76052
  if (!existsSync17(path3) || releaseId === void 0)
75986
76053
  return null;
75987
76054
  try {
75988
- const parsed = JSON.parse(readFileSync17(path3, "utf8"));
76055
+ const parsed = JSON.parse(readFileSync18(path3, "utf8"));
75989
76056
  if (parsed.project_id !== projectId || parsed.release_id !== releaseId || !parsed.files || typeof parsed.files !== "object")
75990
76057
  return null;
75991
76058
  return parsed;
@@ -76002,7 +76069,7 @@ function loadLastActivation(dir) {
76002
76069
  if (!existsSync17(path3))
76003
76070
  return null;
76004
76071
  try {
76005
- return JSON.parse(readFileSync17(path3, "utf8"));
76072
+ return JSON.parse(readFileSync18(path3, "utf8"));
76006
76073
  } catch {
76007
76074
  return null;
76008
76075
  }
@@ -76117,7 +76184,7 @@ var init_live_refusal = __esm({
76117
76184
  });
76118
76185
 
76119
76186
  // dist/lib/build-errors.js
76120
- import { existsSync as existsSync18, readFileSync as readFileSync18 } from "node:fs";
76187
+ import { existsSync as existsSync18, readFileSync as readFileSync19 } from "node:fs";
76121
76188
  import { isAbsolute as isAbsolute5, join as join21 } from "node:path";
76122
76189
  function parseBundleErrorText(text) {
76123
76190
  const out = [];
@@ -76151,7 +76218,7 @@ function frameFor(detail, baseDir, serverFrame) {
76151
76218
  const abs = isAbsolute5(detail.file) ? detail.file : join21(baseDir, detail.file);
76152
76219
  if (existsSync18(abs)) {
76153
76220
  try {
76154
- const frame = localCodeFrame(readFileSync18(abs, "utf-8"), detail.line, detail.column);
76221
+ const frame = localCodeFrame(readFileSync19(abs, "utf-8"), detail.line, detail.column);
76155
76222
  if (frame)
76156
76223
  return frame;
76157
76224
  } catch {
@@ -76268,13 +76335,20 @@ function solvePow(nonce, difficulty) {
76268
76335
  }
76269
76336
  }
76270
76337
  }
76271
- async function mintTempAccount(client = new ApiClient(null)) {
76272
- const challenge = await client.call("GET", "/auth/pow/challenge", void 0, void 0, { refresh: false });
76273
- if (!challenge || typeof challenge.nonce !== "string" || typeof challenge.difficulty !== "number") {
76274
- throw new CliApiError("INVALID_RESPONSE", "The proof-of-work challenge response had no nonce or difficulty.", 200);
76338
+ async function mintTempAccount(client = new ApiClient(null), onChallenge) {
76339
+ let data2;
76340
+ try {
76341
+ data2 = await client.call("POST", "/auth/temp-create", {}, void 0, { refresh: false });
76342
+ } catch (error3) {
76343
+ if (!(error3 instanceof CliApiError) || error3.code !== "POW_REQUIRED")
76344
+ throw error3;
76345
+ const challenge = error3.data?.challenge;
76346
+ if (typeof challenge?.nonce !== "string" || !challenge.nonce || typeof challenge.difficulty !== "number" || !Number.isInteger(challenge.difficulty) || challenge.difficulty < 0 || challenge.difficulty > 32)
76347
+ throw error3;
76348
+ onChallenge?.();
76349
+ const { suffix } = solvePow(challenge.nonce, challenge.difficulty);
76350
+ data2 = await client.call("POST", "/auth/temp-create", { nonce: challenge.nonce, suffix }, void 0, { refresh: false });
76275
76351
  }
76276
- const { suffix } = solvePow(challenge.nonce, challenge.difficulty);
76277
- const data2 = await client.call("POST", "/auth/temp-create", { nonce: challenge.nonce, suffix }, void 0, { refresh: false });
76278
76352
  const key = data2?.key ?? data2?.access_token;
76279
76353
  if (!key) {
76280
76354
  throw new CliApiError("INVALID_RESPONSE", "The temporary account response had neither `key` nor `access_token`.", 200);
@@ -76487,7 +76561,7 @@ var init_claim_handoff = __esm({
76487
76561
  });
76488
76562
 
76489
76563
  // dist/lib/project-notices.js
76490
- import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
76564
+ import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync14 } from "node:fs";
76491
76565
  import { dirname as dirname8, join as join22 } from "node:path";
76492
76566
  function localDay(now2) {
76493
76567
  const date5 = new Date(now2);
@@ -76497,7 +76571,7 @@ function readState(path3) {
76497
76571
  if (!existsSync19(path3))
76498
76572
  return { shown: {} };
76499
76573
  try {
76500
- const parsed = JSON.parse(readFileSync19(path3, "utf8"));
76574
+ const parsed = JSON.parse(readFileSync20(path3, "utf8"));
76501
76575
  return parsed.shown && typeof parsed.shown === "object" ? { shown: parsed.shown } : { shown: {} };
76502
76576
  } catch {
76503
76577
  return { shown: {} };
@@ -76549,7 +76623,7 @@ var init_project_notices = __esm({
76549
76623
  });
76550
76624
 
76551
76625
  // dist/lib/test-identities.js
76552
- import { chmodSync as chmodSync2, existsSync as existsSync20, mkdirSync as mkdirSync12, readFileSync as readFileSync20, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync15 } from "node:fs";
76626
+ import { chmodSync as chmodSync2, existsSync as existsSync20, mkdirSync as mkdirSync12, readFileSync as readFileSync21, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync15 } from "node:fs";
76553
76627
  import { join as join23 } from "node:path";
76554
76628
  import { randomBytes as randomBytes3 } from "node:crypto";
76555
76629
  function parseActorSpecs(values) {
@@ -76606,7 +76680,7 @@ ${TEST_STATE_GITIGNORE_LINE}
76606
76680
  `);
76607
76681
  return "created";
76608
76682
  }
76609
- const text = readFileSync20(path3, "utf8");
76683
+ const text = readFileSync21(path3, "utf8");
76610
76684
  const lines = text.split(/\r?\n/).map((line) => line.trim());
76611
76685
  if (lines.some((line) => [".somewhere/test/", ".somewhere/test", "/.somewhere/test/", "/.somewhere/test", ".somewhere/", ".somewhere", "/.somewhere/", "/.somewhere"].includes(line)))
76612
76686
  return "present";
@@ -76623,7 +76697,7 @@ function readManifest(root) {
76623
76697
  const invalid = /* @__PURE__ */ __name((why) => Object.assign(new Error(`${path3} is not a valid test-users manifest (${why}); nothing was changed.`), { code: "MANIFEST_INVALID" }), "invalid");
76624
76698
  let value;
76625
76699
  try {
76626
- value = JSON.parse(readFileSync20(path3, "utf8"));
76700
+ value = JSON.parse(readFileSync21(path3, "utf8"));
76627
76701
  } catch {
76628
76702
  throw invalid("not JSON");
76629
76703
  }
@@ -76793,7 +76867,7 @@ var init_test_identities = __esm({
76793
76867
  });
76794
76868
 
76795
76869
  // dist/lib/form-accounts.js
76796
- import { existsSync as existsSync21, readdirSync as readdirSync4, readFileSync as readFileSync21, rmSync as rmSync7 } from "node:fs";
76870
+ import { existsSync as existsSync21, readdirSync as readdirSync4, readFileSync as readFileSync22, rmSync as rmSync7 } from "node:fs";
76797
76871
  import { join as join24 } from "node:path";
76798
76872
  import { randomBytes as randomBytes4 } from "node:crypto";
76799
76873
  function readDeletionAnswer(ids, answer) {
@@ -76890,7 +76964,7 @@ function recordAttempt(control, root, email3) {
76890
76964
  return path3;
76891
76965
  }
76892
76966
  function recordId(path3, id) {
76893
- const record3 = JSON.parse(readFileSync21(path3, "utf8"));
76967
+ const record3 = JSON.parse(readFileSync22(path3, "utf8"));
76894
76968
  writePrivateFile(path3, JSON.stringify({ ...record3, id }) + "\n");
76895
76969
  }
76896
76970
  function forgetRecord(path3) {
@@ -76926,7 +77000,7 @@ async function sweepAccounts(control, root) {
76926
77000
  const path3 = join24(dir, name);
76927
77001
  let record3;
76928
77002
  try {
76929
- record3 = JSON.parse(readFileSync21(path3, "utf8"));
77003
+ record3 = JSON.parse(readFileSync22(path3, "utf8"));
76930
77004
  } catch {
76931
77005
  result.failed.push(name);
76932
77006
  continue;
@@ -77113,14 +77187,14 @@ var init_test_target = __esm({
77113
77187
  });
77114
77188
 
77115
77189
  // dist/lib/preview-credential.js
77116
- import { existsSync as existsSync22, readFileSync as readFileSync22, unlinkSync as unlinkSync4 } from "node:fs";
77190
+ import { existsSync as existsSync22, readFileSync as readFileSync23, unlinkSync as unlinkSync4 } from "node:fs";
77117
77191
  import { join as join25 } from "node:path";
77118
77192
  function loadPreviewCredential(projectId, previewSessionId) {
77119
77193
  const path3 = join25(cliConfigDir(), SUBDIR, fileName(projectId, previewSessionId));
77120
77194
  if (!existsSync22(path3))
77121
77195
  return null;
77122
77196
  try {
77123
- const stored = JSON.parse(readFileSync22(path3, "utf8"));
77197
+ const stored = JSON.parse(readFileSync23(path3, "utf8"));
77124
77198
  return stored.project_id === projectId && stored.preview_session_id === previewSessionId && typeof stored.credential === "string" ? stored.credential : null;
77125
77199
  } catch {
77126
77200
  return null;
@@ -77164,14 +77238,14 @@ var init_preview_credential = __esm({
77164
77238
  });
77165
77239
 
77166
77240
  // dist/lib/preview-record.js
77167
- import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync23, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "node:fs";
77241
+ import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync24, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "node:fs";
77168
77242
  import { join as join26 } from "node:path";
77169
77243
  function loadPreviewRecord(dir, projectId) {
77170
77244
  const path3 = join26(dir, PREVIEW_RECORD);
77171
77245
  if (!existsSync23(path3))
77172
77246
  return null;
77173
77247
  try {
77174
- const parsed = JSON.parse(readFileSync23(path3, "utf8"));
77248
+ const parsed = JSON.parse(readFileSync24(path3, "utf8"));
77175
77249
  if (parsed.project_id !== projectId || typeof parsed.preview_session_id !== "string" || typeof parsed.preview_id !== "string" || !isRecord(parsed.files))
77176
77250
  return null;
77177
77251
  return parsed;
@@ -77633,7 +77707,7 @@ import { createRequire as createRequire5 } from "node:module";
77633
77707
  import { pathToFileURL } from "node:url";
77634
77708
  import { join as join28, dirname as dirname9 } from "node:path";
77635
77709
  import { spawn as spawn4, spawnSync as spawnSync2 } from "node:child_process";
77636
- import { appendFileSync as appendFileSync2, existsSync as existsSync24, readFileSync as readFileSync24, readdirSync as readdirSync5, rmSync as rmSync9 } from "node:fs";
77710
+ import { appendFileSync as appendFileSync2, existsSync as existsSync24, readFileSync as readFileSync25, readdirSync as readdirSync5, rmSync as rmSync9 } from "node:fs";
77637
77711
  import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
77638
77712
  function testImportEnv(root, env) {
77639
77713
  if (!readProjectPin(root)?.versionOnly)
@@ -77680,7 +77754,7 @@ async function prepareRunner(root) {
77680
77754
  mark("browser-probe:end");
77681
77755
  let playwright = "unknown";
77682
77756
  try {
77683
- playwright = JSON.parse(readFileSync24(join28(dirname9(cli), "package.json"), "utf8")).version ?? "unknown";
77757
+ playwright = JSON.parse(readFileSync25(join28(dirname9(cli), "package.json"), "utf8")).version ?? "unknown";
77684
77758
  } catch {
77685
77759
  }
77686
77760
  return { cli, channel, version: version2, browserLaunchMs, playwright };
@@ -77712,7 +77786,7 @@ async function runTests(input) {
77712
77786
  const dir = join28(root, ".somewhere", "tests");
77713
77787
  ensurePrivateDir(dir);
77714
77788
  const ignorePath = join28(root, ".gitignore");
77715
- const ignored = existsSync24(ignorePath) ? readFileSync24(ignorePath, "utf8") : "";
77789
+ const ignored = existsSync24(ignorePath) ? readFileSync25(ignorePath, "utf8") : "";
77716
77790
  for (const line of [".somewhere/", "playwright-report/", "test-results/"])
77717
77791
  if (!ignored.split(/\r?\n/).includes(line))
77718
77792
  appendFileSync2(ignorePath, `
@@ -77726,7 +77800,7 @@ ${line}
77726
77800
  const artifacts = join28(dir, createHash6("sha256").update(projectId + origin + (target.environment === "preview" ? `${target.previewSessionId}:${target.releaseId}` : "")).digest("hex").slice(0, 16));
77727
77801
  if (failed) {
77728
77802
  const lastRun = join28(artifacts, ".last-run.json");
77729
- if (!existsSync24(lastRun) || !JSON.parse(readFileSync24(lastRun, "utf8")).failedTests?.length) {
77803
+ if (!existsSync24(lastRun) || !JSON.parse(readFileSync25(lastRun, "utf8")).failedTests?.length) {
77730
77804
  throw new Error("No failed tests are recorded from the last run here; run somewhere test.");
77731
77805
  }
77732
77806
  }
@@ -77773,7 +77847,7 @@ ${line}
77773
77847
  }, "cleanArtifacts");
77774
77848
  cleanArtifacts(artifacts);
77775
77849
  const exitCode = status === null ? 1 : status || (after === null || after.failed.length || after.unknownId.length ? 1 : 0);
77776
- const results = existsSync24(resultsPath) ? JSON.parse(readFileSync24(resultsPath, "utf8")) : null;
77850
+ const results = existsSync24(resultsPath) ? JSON.parse(readFileSync25(resultsPath, "utf8")) : null;
77777
77851
  return { exitCode, results, target };
77778
77852
  }
77779
77853
  var init_test_run = __esm({
@@ -78086,7 +78160,7 @@ var init_browser_refusal = __esm({
78086
78160
  });
78087
78161
 
78088
78162
  // dist/lib/browser-actions.js
78089
- import { readFileSync as readFileSync25, statSync as statSync4 } from "node:fs";
78163
+ import { readFileSync as readFileSync26, statSync as statSync4 } from "node:fs";
78090
78164
  import { basename as basename4, extname as extname4, resolve as resolve11 } from "node:path";
78091
78165
  function decodedBase64Bytes(base643) {
78092
78166
  if (!base643 || base643.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(base643))
@@ -78142,7 +78216,7 @@ function resolveBrowserUpload(raw, baseDir = process.cwd()) {
78142
78216
  }
78143
78217
  const name = basename4(absolute);
78144
78218
  const contentType = MIME_TYPES[extname4(name).toLowerCase()] ?? "application/octet-stream";
78145
- const bytes = readFileSync25(absolute);
78219
+ const bytes = readFileSync26(absolute);
78146
78220
  if (bytes.length > MAX_BROWSER_UPLOAD_BYTES) {
78147
78221
  throw new Error(`BROWSER_UPLOAD_TOO_LARGE: Upload file is ${bytes.length} bytes; the browser upload limit is ${MAX_BROWSER_UPLOAD_BYTES} bytes (10 MB).`);
78148
78222
  }
@@ -79275,7 +79349,7 @@ var init_verify_report = __esm({
79275
79349
 
79276
79350
  // dist/commands/browser.js
79277
79351
  import { dirname as dirname10, resolve as resolve13 } from "node:path";
79278
- import { readFileSync as readFileSync26 } from "node:fs";
79352
+ import { readFileSync as readFileSync27 } from "node:fs";
79279
79353
  function readBrowserIncomplete(r) {
79280
79354
  const raw = r.incomplete;
79281
79355
  if (!raw || typeof raw !== "object")
@@ -79644,7 +79718,7 @@ function registerBrowser(program2) {
79644
79718
  const collectActionsFile = /* @__PURE__ */ __name((file2) => {
79645
79719
  try {
79646
79720
  const absolute = resolve13(file2);
79647
- const raw = JSON.parse(readFileSync26(absolute, "utf8"));
79721
+ const raw = JSON.parse(readFileSync27(absolute, "utf8"));
79648
79722
  const normalized = normalizeBrowserActions(raw, dirname10(absolute));
79649
79723
  if (!normalized.ok)
79650
79724
  throw new InvalidArgumentError(normalized.error);
@@ -79798,7 +79872,7 @@ var init_browser = __esm({
79798
79872
 
79799
79873
  // dist/lib/verify-keep.js
79800
79874
  import { createHash as createHash7, randomBytes as randomBytes5 } from "node:crypto";
79801
- import { closeSync as closeSync4, existsSync as existsSync26, openSync as openSync4, readFileSync as readFileSync27, rmSync as rmSync11, statSync as statSync5, writeSync } from "node:fs";
79875
+ import { closeSync as closeSync4, existsSync as existsSync26, openSync as openSync4, readFileSync as readFileSync28, rmSync as rmSync11, statSync as statSync5, writeSync } from "node:fs";
79802
79876
  import { join as join32 } from "node:path";
79803
79877
  function path(root) {
79804
79878
  return join32(stateDir(root), KEEP_FILE);
@@ -79807,7 +79881,7 @@ function readFile(root) {
79807
79881
  if (!existsSync26(path(root)))
79808
79882
  return {};
79809
79883
  try {
79810
- const parsed = JSON.parse(readFileSync27(path(root), "utf-8"));
79884
+ const parsed = JSON.parse(readFileSync28(path(root), "utf-8"));
79811
79885
  return parsed && typeof parsed === "object" ? parsed : {};
79812
79886
  } catch {
79813
79887
  return {};
@@ -79879,7 +79953,7 @@ function lockKeep(root, key, now2 = Date.now()) {
79879
79953
  throw cause;
79880
79954
  let stale = true;
79881
79955
  try {
79882
- const held = JSON.parse(readFileSync27(lock, "utf-8"));
79956
+ const held = JSON.parse(readFileSync28(lock, "utf-8"));
79883
79957
  const alive2 = typeof held.pid === "number" && (() => {
79884
79958
  try {
79885
79959
  process.kill(held.pid, 0);
@@ -80001,7 +80075,7 @@ var init_verify_keep = __esm({
80001
80075
 
80002
80076
  // dist/commands/verify.js
80003
80077
  import { randomBytes as randomBytes6 } from "node:crypto";
80004
- import { existsSync as existsSync27, readFileSync as readFileSync28 } from "node:fs";
80078
+ import { existsSync as existsSync27, readFileSync as readFileSync29 } from "node:fs";
80005
80079
  import { dirname as dirname11, resolve as resolve14 } from "node:path";
80006
80080
  function navigationRetryNote(retries) {
80007
80081
  if (!retries.length)
@@ -80222,7 +80296,7 @@ function normalizeVerifyFlow(raw, baseDir = process.cwd()) {
80222
80296
  function readVerifyFlowFile(absolute, flag) {
80223
80297
  let source;
80224
80298
  try {
80225
- source = readFileSync28(absolute, "utf8");
80299
+ source = readFileSync29(absolute, "utf8");
80226
80300
  } catch (cause) {
80227
80301
  if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") {
80228
80302
  throw new Error(`Flow file not found. Pass ${flag} <path> with an existing JSON file. Run \`${cliInvocation()} verify --schema\` for the flow format.`);
@@ -81864,15 +81938,10 @@ function deriveNewProjectName(dirPath) {
81864
81938
  const base = slugify2(basename5(dirPath)) || "project";
81865
81939
  return `${base}-${randomSuffix()}`;
81866
81940
  }
81867
- function formatTtlHours(ttlSeconds) {
81868
- if (!ttlSeconds || !Number.isFinite(ttlSeconds))
81869
- return 3;
81870
- return Math.round(ttlSeconds / 3600) || 3;
81871
- }
81872
81941
  function formatTempExpiry(expiresAt, ttlSeconds, nowMs = Date.now()) {
81873
81942
  const remainingMs = expiresAt ? Date.parse(expiresAt) - nowMs : NaN;
81874
81943
  if (!Number.isFinite(remainingMs) || ttlSeconds !== void 0 && Number.isFinite(ttlSeconds) && (remainingMs > ttlSeconds * 1e3 + 6e4 || remainingMs < -6e4)) {
81875
- return `Temporary app. Expires about ${plural3(formatTtlHours(ttlSeconds), "hour")} after it was created.`;
81944
+ return "Temporary app.";
81876
81945
  }
81877
81946
  if (remainingMs <= 0)
81878
81947
  return "Temporary app. It has expired.";
@@ -82132,7 +82201,7 @@ No project yet? Signed in, deploy never creates one on its own:
82132
82201
  ${cliInvocation()} init --bare --name <name> create a project in your account and link this folder
82133
82202
  ${cliInvocation()} deploy then deploy it
82134
82203
  Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cliInvocation()} projects\`), or \`--project <ref>\` here.
82135
- `).option("--project <ref>", `Existing project to deploy to \u2014 accepts the project UUID, slug, or subdomain (all three resolve server-side). To create one, run \`${cliInvocation()} init --bare --name <name>\``).option("--scope <scope>", "Partial deploy: 'functions' (backend only, leaves the site untouched) or 'static' (site only, leaves functions untouched). Default deploys both.").option("--dry-run", "Show what would change (added / modified / removed files) in an already deployed project, without deploying. The files a deploy would publish are sent to Somewhere to compute the change; nothing is published. Never creates a project or a temporary workspace.").option("--replace-functions", "Delete deployed functions that are not in this directory. A full deploy already does; use it with --scope functions, which otherwise keeps them.").option("--prebuilt", "Deploy pre-built / bundled output (e.g. a dist/ folder) instead of raw source. Raw source is the default and recommended path: the platform compiles your TSX/JSX/TS on deploy, which keeps the app editable end-to-end. Choosing --prebuilt trades that away \u2014 pull/export round-trips, find/replace patches, and visual (source-map) editing are disabled for the bundled files. Use it only when you need full control of your own build.").option("--allow-bundled", "Alias for --prebuilt.").option("--new", "Publish to a new project and replace this folder\u2019s .somewhere.json link").option("--temporary", "Explicitly deploy to a temporary 3-hour workspace (automatic when logged out)").option("--force", "Overwrite remote changes even when this machine last deployed an older version").option("--include <paths>", 'Publish a file or folder the deploy would otherwise hold back, e.g. --include NOTES.md or --include tests (comma-separate several, or repeat the flag). A "!NOTES.md" or "!tests/" line in .somewhereignore does the same thing permanently.', (value, previous = []) => previous.concat(value.split(",").map((v2) => v2.trim()).filter(Boolean))).option("--yes", "Skip confirmation prompts (for --force)").option("--verify [flow.json]", "After the deploy is live, run one browser verification flow at desktop and phone size. Omit the file for the default health check.").addOption(new Option("--test", "After a successful deploy, run somewhere test once against the new release").hideHelp()).option("-m, --message <text>", "User-supplied note for this version (max 200 characters)").option("--json", "Print the deploy result and its uploaded file list as JSON on stdout. Stderr lists files left out locally by path and reason.").option("--list-unpublished", "List the local files deploy would keep on your machine, then exit").option("--allow-type-errors", "Upload even when the local TypeScript check fails").option("--timing", "Print deploy details and timings").action(async (dir, opts) => {
82204
+ `).option("--project <ref>", `Existing project to deploy to \u2014 accepts the project UUID, slug, or subdomain (all three resolve server-side). To create one, run \`${cliInvocation()} init --bare --name <name>\``).option("--scope <scope>", "Partial deploy: 'functions' (backend only, leaves the site untouched) or 'static' (site only, leaves functions untouched). Default deploys both.").option("--dry-run", "Show what would change (added / modified / removed files) in an already deployed project, without deploying. The files a deploy would publish are sent to Somewhere to compute the change; nothing is published. Never creates a project or a temporary workspace.").option("--replace-functions", "Delete deployed functions that are not in this directory. A full deploy already does; use it with --scope functions, which otherwise keeps them.").option("--prebuilt", "Deploy pre-built / bundled output (e.g. a dist/ folder) instead of raw source. Raw source is the default and recommended path: the platform compiles your TSX/JSX/TS on deploy, which keeps the app editable end-to-end. Choosing --prebuilt trades that away \u2014 pull/export round-trips, find/replace patches, and visual (source-map) editing are disabled for the bundled files. Use it only when you need full control of your own build.").option("--allow-bundled", "Alias for --prebuilt.").option("--new", "Publish to a new project and replace this folder\u2019s .somewhere.json link").option("--temporary", "Deploy to a temporary workspace and show when it expires (automatic when logged out)").option("--force", "Overwrite remote changes even when this machine last deployed an older version").option("--include <paths>", 'Publish a file or folder the deploy would otherwise hold back, e.g. --include NOTES.md or --include tests (comma-separate several, or repeat the flag). A "!NOTES.md" or "!tests/" line in .somewhereignore does the same thing permanently.', (value, previous = []) => previous.concat(value.split(",").map((v2) => v2.trim()).filter(Boolean))).option("--yes", "Skip confirmation prompts (for --force)").option("--verify [flow.json]", "After the deploy is live, run one browser verification flow at desktop and phone size. Omit the file for the default health check.").addOption(new Option("--test", "After a successful deploy, run somewhere test once against the new release").hideHelp()).option("-m, --message <text>", "User-supplied note for this version (max 200 characters)").option("--json", "Print the deploy result and its uploaded file list as JSON on stdout. Stderr lists files left out locally by path and reason.").option("--list-unpublished", "List the local files deploy would keep on your machine, then exit").option("--allow-type-errors", "Upload even when the local TypeScript check fails").option("--timing", "Print deploy details and timings").action(async (dir, opts) => {
82136
82205
  const startupMs = performance.now();
82137
82206
  const targetDir = resolveTargetDir(dir);
82138
82207
  if (opts.new && (opts.project || opts.dryRun || opts.temporary)) {
@@ -82168,10 +82237,16 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82168
82237
  const typecheckStartedAt = performance.now();
82169
82238
  const hasTsconfig = existsSync28(join33(targetDir, "tsconfig.json"));
82170
82239
  const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
82171
- if (hasTsconfig && !missingDependencies && typecheckCompilerSource(targetDir) === "npx") {
82240
+ const checkingTypes = hasTsconfig && !missingDependencies;
82241
+ if (checkingTypes && typecheckCompilerSource(targetDir) === "npx") {
82172
82242
  announceNpxTypeScriptFetch(TYPECHECK_TYPESCRIPT_VERSION);
82173
82243
  }
82174
- const typecheck = hasTsconfig && !missingDependencies ? runTypecheck(targetDir).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
82244
+ const typecheckHeartbeat = checkingTypes && !opts.json ? setInterval(() => {
82245
+ process.stderr.write(`Still checking types before upload after ${formatDeployElapsed(performance.now() - typecheckStartedAt)}...
82246
+ `);
82247
+ }, deployHeartbeatMs()).unref() : void 0;
82248
+ const typecheck = checkingTypes ? runTypecheck(targetDir).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
82249
+ clearInterval(typecheckHeartbeat);
82175
82250
  typecheckMs = performance.now() - typecheckStartedAt;
82176
82251
  }) : Promise.resolve(null);
82177
82252
  const verifyFlow = opts.verify && !opts.dryRun ? loadVerifyFlow(typeof opts.verify === "string" ? opts.verify : void 0, targetDir) : void 0;
@@ -82271,10 +82346,13 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82271
82346
  else
82272
82347
  info(note);
82273
82348
  }
82274
- const powSpinner = opts.json ? null : ora("Solving proof-of-work\u2026").start();
82349
+ const signupSpinner = opts.json ? null : ora("Starting a temporary session\u2026").start();
82275
82350
  try {
82276
- const account = await mintTempAccount();
82277
- powSpinner?.stop();
82351
+ const account = await mintTempAccount(void 0, () => {
82352
+ if (signupSpinner)
82353
+ signupSpinner.text = "Solving the proof-of-work requested by the server\u2026";
82354
+ });
82355
+ signupSpinner?.stop();
82278
82356
  if (besideRealLogin) {
82279
82357
  const minted = {
82280
82358
  token: account.key,
@@ -82304,7 +82382,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82304
82382
  };
82305
82383
  }
82306
82384
  } catch (err) {
82307
- powSpinner?.fail("Could not create a temporary session");
82385
+ signupSpinner?.fail("Could not create a temporary session");
82308
82386
  const status = err instanceof CliApiError ? ` ${dim(err.statusCode ? `[${err.code}, HTTP ${err.statusCode}]` : `[${err.code}]`)}` : "";
82309
82387
  error(`${err instanceof Error ? err.message : String(err)}${status}`, err);
82310
82388
  process.exit(1);
@@ -82336,13 +82414,18 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82336
82414
  } else if (tempSession || opts.new) {
82337
82415
  const createSpinner = opts.json ? null : ora(tempSession ? "Creating a temporary project..." : "Creating a new project...").start();
82338
82416
  try {
82339
- const name = deriveNewProjectName(targetDir);
82340
- const created = await client.call("POST", "/projects", { name, subdomain: name, cli_version: CLI_VERSION });
82417
+ const starterName = tempSession && !besideRealLogin && !opts.new ? readStarterProjectName(targetDir) : void 0;
82418
+ const name = starterName ?? deriveNewProjectName(targetDir);
82419
+ const subdomain = starterName ? `${starterNameSlug(starterName).slice(0, 35).replace(/-$/, "") || "project"}-${randomSuffix()}` : name;
82420
+ const created = await client.call("POST", "/projects", { name, subdomain, cli_version: CLI_VERSION });
82421
+ if (starterName && created.status && created.status !== "draft") {
82422
+ throw new Error("A temporary project already uses this name. Change somewhere.project_name in package.json or deploy from the linked folder.");
82423
+ }
82341
82424
  createSpinner?.stop();
82342
82425
  targetProjectConfig = {
82343
82426
  project_id: created.id,
82344
82427
  name: created.name,
82345
- subdomain: created.subdomain ?? name,
82428
+ subdomain: created.subdomain ?? subdomain,
82346
82429
  source_base: sourceBaseState(created.id, null)
82347
82430
  };
82348
82431
  if (besideRealLogin && sideCar) {
@@ -83254,6 +83337,7 @@ var init_deploy = __esm({
83254
83337
  "dist/commands/deploy.js"() {
83255
83338
  "use strict";
83256
83339
  init_first_cli_permission();
83340
+ init_init_scaffold();
83257
83341
  init_link_hint();
83258
83342
  init_role_method_hints();
83259
83343
  init_cli_invocation();
@@ -83298,7 +83382,7 @@ var init_deploy = __esm({
83298
83382
  "optionalDependencies"
83299
83383
  ];
83300
83384
  NEXT_APP_WARNING = `Next.js apps do not run here. Somewhere supports HTML responses from ordinary server functions. Port API routes to api/ handlers and HTML pages to root routes such as [...path].ts, or start from a Vite React app. Read ${cliInvocation()} docs functions; deploy raw JSX/TSX.`;
83301
- DEPLOY_HEARTBEAT_MS = 3e4;
83385
+ DEPLOY_HEARTBEAT_MS = 1e4;
83302
83386
  DEPLOY_MAX_ATTEMPTS = 2;
83303
83387
  RETRYABLE_DEPLOY_CODES = /* @__PURE__ */ new Set(["TIMEOUT", "SERVER_SLOW", "NETWORK_ERROR"]);
83304
83388
  DEPLOY_RETRY_MAX_WAIT_MS = 1e4;
@@ -83309,7 +83393,6 @@ var init_deploy = __esm({
83309
83393
  __name(slugify2, "slugify");
83310
83394
  __name(randomSuffix, "randomSuffix");
83311
83395
  __name(deriveNewProjectName, "deriveNewProjectName");
83312
- __name(formatTtlHours, "formatTtlHours");
83313
83396
  __name(formatTempExpiry, "formatTempExpiry");
83314
83397
  __name(plural3, "plural");
83315
83398
  __name(formatElapsed, "formatElapsed");
@@ -83460,7 +83543,7 @@ var init_deploys = __esm({
83460
83543
  });
83461
83544
 
83462
83545
  // dist/commands/pull.js
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";
83546
+ import { existsSync as existsSync29, lstatSync as lstatSync4, mkdirSync as mkdirSync15, readFileSync as readFileSync30, readdirSync as readdirSync7, rmSync as rmSync12, writeFileSync as writeFileSync19 } from "node:fs";
83464
83547
  import { basename as basename6, dirname as dirname12, join as join34, relative as relative10, resolve as resolve16 } from "node:path";
83465
83548
  function registerPull(program2) {
83466
83549
  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) => {
@@ -83545,7 +83628,7 @@ function registerPull(program2) {
83545
83628
  const target = join34(outDir, path3);
83546
83629
  if (!existsSync29(target))
83547
83630
  continue;
83548
- const local = readFileSync29(target);
83631
+ const local = readFileSync30(target);
83549
83632
  if (local.equals(contents))
83550
83633
  continue;
83551
83634
  if (opts.force) {
@@ -83679,7 +83762,7 @@ function reconcileRemovedFiles(outDir, expected, force, base = null) {
83679
83762
  const was = base?.files[relPath];
83680
83763
  if (base && was === void 0)
83681
83764
  continue;
83682
- const unedited = was !== void 0 && was === sha2562(readFileSync29(fullPath));
83765
+ const unedited = was !== void 0 && was === sha2562(readFileSync30(fullPath));
83683
83766
  if (!force && !unedited) {
83684
83767
  skipped.push(relPath);
83685
83768
  continue;
@@ -84832,7 +84915,7 @@ var init_db = __esm({
84832
84915
  });
84833
84916
 
84834
84917
  // dist/commands/postgres.js
84835
- import { readFileSync as readFileSync30 } from "node:fs";
84918
+ import { readFileSync as readFileSync31 } from "node:fs";
84836
84919
  function str(value) {
84837
84920
  return typeof value === "string" && value.length > 0 ? value : null;
84838
84921
  }
@@ -84841,7 +84924,7 @@ async function readNeonApiKey() {
84841
84924
  if (fromEnv)
84842
84925
  return fromEnv;
84843
84926
  if (!process.stdin.isTTY) {
84844
- return readFileSync30(0, "utf8").trim();
84927
+ return readFileSync31(0, "utf8").trim();
84845
84928
  }
84846
84929
  const response = await (0, import_prompts8.default)({
84847
84930
  type: "password",
@@ -85170,7 +85253,7 @@ var init_postgres = __esm({
85170
85253
  });
85171
85254
 
85172
85255
  // dist/lib/advisor-context.js
85173
- import { readFileSync as readFileSync31, statSync as statSync6 } from "node:fs";
85256
+ import { readFileSync as readFileSync32, statSync as statSync6 } from "node:fs";
85174
85257
  import { basename as basename7 } from "node:path";
85175
85258
  function tail(value, limit) {
85176
85259
  return value.length <= limit ? value : `\u2026${value.slice(-limit)}`;
@@ -85192,7 +85275,7 @@ function buildAdvisorContext(filePath) {
85192
85275
  const stat6 = statSync6(filePath);
85193
85276
  if (!stat6.isFile())
85194
85277
  throw new Error("--file must name a regular file.");
85195
- const content = readFileSync31(filePath, "utf8");
85278
+ const content = readFileSync32(filePath, "utf8");
85196
85279
  context.file = {
85197
85280
  path: filePath,
85198
85281
  content: tail(redactAdvisorText(content, isDotenvPath(filePath)), FILE_LIMIT)
@@ -85218,7 +85301,7 @@ var init_advisor_context = __esm({
85218
85301
 
85219
85302
  // dist/lib/advisor-runs.js
85220
85303
  import { randomBytes as randomBytes7, randomUUID as randomUUID7 } from "node:crypto";
85221
- import { chmodSync as chmodSync4, existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync32, renameSync as renameSync5, writeFileSync as writeFileSync21 } from "node:fs";
85304
+ import { chmodSync as chmodSync4, existsSync as existsSync31, mkdirSync as mkdirSync16, readFileSync as readFileSync33, renameSync as renameSync5, writeFileSync as writeFileSync21 } from "node:fs";
85222
85305
  import { join as join36 } from "node:path";
85223
85306
  function path2(id) {
85224
85307
  if (!/^[a-f0-9-]{36}$/i.test(id))
@@ -85255,7 +85338,7 @@ function expiredResult(record3) {
85255
85338
  function load(id) {
85256
85339
  if (!existsSync31(path2(id)))
85257
85340
  throw Error("Advisor request was not found in this CLI configuration.");
85258
- const record3 = JSON.parse(readFileSync32(path2(id), "utf8"));
85341
+ const record3 = JSON.parse(readFileSync33(path2(id), "utf8"));
85259
85342
  prune(record3);
85260
85343
  save(record3);
85261
85344
  return record3;
@@ -86630,7 +86713,7 @@ var init_envfile_write = __esm({
86630
86713
  });
86631
86714
 
86632
86715
  // dist/commands/env.js
86633
- import { existsSync as existsSync32, readFileSync as readFileSync33, writeFileSync as writeFileSync22 } from "node:fs";
86716
+ import { existsSync as existsSync32, readFileSync as readFileSync34, writeFileSync as writeFileSync22 } from "node:fs";
86634
86717
  import { resolve as resolve19 } from "node:path";
86635
86718
  function resolveProjectId(explicit) {
86636
86719
  if (explicit)
@@ -86700,7 +86783,7 @@ function registerEnv(program2) {
86700
86783
  process.exit(1);
86701
86784
  }
86702
86785
  if (existsSync32(outPath) && !opts.force) {
86703
- const existing = readFileSync33(outPath, "utf-8");
86786
+ const existing = readFileSync34(outPath, "utf-8");
86704
86787
  const hasValues = existing.split("\n").some((l) => /^[^#=]+=.+/.test(l.trim()));
86705
86788
  const { ok } = await (0, import_prompts9.default)({
86706
86789
  type: "confirm",
@@ -86753,7 +86836,7 @@ function registerEnv(program2) {
86753
86836
  if (inputNote && !opts.json)
86754
86837
  process.stderr.write(`Note: ${inputNote}
86755
86838
  `);
86756
- const value = opts.stdin ? readFileSync33(0, "utf8").replace(/\r?\n$/, "") : positionalValue;
86839
+ const value = opts.stdin ? readFileSync34(0, "utf8").replace(/\r?\n$/, "") : positionalValue;
86757
86840
  const client = new ApiClient(getToken());
86758
86841
  const pid = resolveProjectId(opts.project);
86759
86842
  try {
@@ -86822,7 +86905,7 @@ var init_env = __esm({
86822
86905
  });
86823
86906
 
86824
86907
  // dist/commands/run.js
86825
- import { existsSync as existsSync33, readFileSync as readFileSync34 } from "node:fs";
86908
+ import { existsSync as existsSync33, readFileSync as readFileSync35 } from "node:fs";
86826
86909
  import { isAbsolute as isAbsolute6, resolve as resolve20 } from "node:path";
86827
86910
  function parseArgs(values) {
86828
86911
  if (!values.length)
@@ -86872,7 +86955,7 @@ function registerRun(program2) {
86872
86955
  error(`File not found: ${script}`);
86873
86956
  process.exit(1);
86874
86957
  }
86875
- const code = readFileSync34(absPath, "utf-8");
86958
+ const code = readFileSync35(absPath, "utf-8");
86876
86959
  if (!code.trim()) {
86877
86960
  error(`${script} is empty \u2014 nothing to run.`);
86878
86961
  process.exit(1);
@@ -87398,7 +87481,7 @@ async function startFrontendDev(cwd, target, port = 8787, open3 = false) {
87398
87481
  vitePath = createRequire7(join37(cwd, "package.json")).resolve("vite");
87399
87482
  } catch {
87400
87483
  if (readProjectPin(cwd)?.versionOnly) {
87401
- throw new Error("Install the local frontend tools: npm install --include=optional -D --save-exact vite@7.2.2");
87484
+ throw new Error("Install the local frontend tools: npm install -D --save-exact vite@7.2.2");
87402
87485
  }
87403
87486
  throw new Error(`Install this frontend\u2019s Vite dependencies before running ${cliInvocation()} dev. Backend changes run through ${cliInvocation()} deploy or ${cliInvocation()} preview.`);
87404
87487
  }
@@ -87515,7 +87598,7 @@ var init_preview_jobs = __esm({
87515
87598
 
87516
87599
  // dist/commands/dev.js
87517
87600
  import { randomUUID as randomUUID8 } from "node:crypto";
87518
- import { existsSync as existsSync34, readFileSync as readFileSync35 } from "node:fs";
87601
+ import { existsSync as existsSync34, readFileSync as readFileSync36 } from "node:fs";
87519
87602
  import { join as join38, relative as relative11 } from "node:path";
87520
87603
  function previewFinishedReason(err) {
87521
87604
  if (!(err instanceof CliApiError) || err.code !== "DRAFT_SESSION_TERMINAL")
@@ -88504,11 +88587,11 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
88504
88587
  continue;
88505
88588
  const { kind, key } = classifyKey(rel);
88506
88589
  if (kind === "function")
88507
- updateFunctions[key] = readFileSync35(abs, "utf-8");
88590
+ updateFunctions[key] = readFileSync36(abs, "utf-8");
88508
88591
  else if (kind === "binary")
88509
- updateBinary[key] = readFileSync35(abs).toString("base64");
88592
+ updateBinary[key] = readFileSync36(abs).toString("base64");
88510
88593
  else
88511
- updateFiles[key] = readFileSync35(abs, "utf-8");
88594
+ updateFiles[key] = readFileSync36(abs, "utf-8");
88512
88595
  }
88513
88596
  for (const rel of deleted)
88514
88597
  deleteKeys.push(classifyKey(rel).key);
@@ -128649,7 +128732,7 @@ var require_dist15 = __commonJS({
128649
128732
 
128650
128733
  // dist/lib/update-security.js
128651
128734
  import { createHash as createHash8, timingSafeEqual } from "node:crypto";
128652
- import { mkdirSync as mkdirSync17, readFileSync as readFileSync36, statSync as statSync7 } from "node:fs";
128735
+ import { mkdirSync as mkdirSync17, readFileSync as readFileSync37, statSync as statSync7 } from "node:fs";
128653
128736
  import { join as join41 } from "node:path";
128654
128737
  import { Readable as Readable2 } from "node:stream";
128655
128738
  import { pipeline as pipeline3 } from "node:stream/promises";
@@ -129022,8 +129105,8 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
129022
129105
  try {
129023
129106
  if (statSync7(lockPath).size > MAX_LOCKFILE_BYTES)
129024
129107
  throw new Error("lockfile too large");
129025
- manifest = JSON.parse(readFileSync36(manifestPath, "utf8"));
129026
- lock = JSON.parse(readFileSync36(lockPath, "utf8"));
129108
+ manifest = JSON.parse(readFileSync37(manifestPath, "utf8"));
129109
+ lock = JSON.parse(readFileSync37(lockPath, "utf8"));
129027
129110
  } catch (cause) {
129028
129111
  throw new Error(`the verified artifact has no readable npm-shrinkwrap dependency lock: ${message(cause)}`);
129029
129112
  }
@@ -129061,7 +129144,7 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
129061
129144
  let bundledManifest;
129062
129145
  try {
129063
129146
  const bundledPath = join41(extractionDir, ...lockPath2.split("/"), "package.json");
129064
- bundledManifest = JSON.parse(readFileSync36(bundledPath, "utf8"));
129147
+ bundledManifest = JSON.parse(readFileSync37(bundledPath, "utf8"));
129065
129148
  } catch (cause) {
129066
129149
  throw new Error(`the verified artifact has an unreadable bundled dependency ${lockPath2}: ${message(cause)}`);
129067
129150
  }
@@ -129131,7 +129214,7 @@ ${GITHUB_REPOSITORY_ID}`,
129131
129214
  // dist/commands/update.js
129132
129215
  import { spawn as spawn6 } from "node:child_process";
129133
129216
  import { randomBytes as randomBytes8 } from "node:crypto";
129134
- import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync3, openSync as openSync5, readFileSync as readFileSync37, readSync, rmSync as rmSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync23 } from "node:fs";
129217
+ import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync3, openSync as openSync5, readFileSync as readFileSync38, readSync, rmSync as rmSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync23 } from "node:fs";
129135
129218
  import { createServer } from "node:http";
129136
129219
  import { tmpdir as tmpdir2 } from "node:os";
129137
129220
  import { join as join42 } from "node:path";
@@ -129142,7 +129225,7 @@ function refuse2(cause) {
129142
129225
  }
129143
129226
  function currentVersion2() {
129144
129227
  try {
129145
- const pkg = JSON.parse(readFileSync37(join42(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
129228
+ const pkg = JSON.parse(readFileSync38(join42(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
129146
129229
  return pkg.version;
129147
129230
  } catch {
129148
129231
  return "0.0.0";
@@ -129425,9 +129508,9 @@ function upgradeProject(dir, running, changelog = readBundledChangelog) {
129425
129508
  throw new Error(`This CLI (${running}) is older than the project's pin (${current}). Run the newer CLI's upgrade: \`npx -y ${CLI_PACKAGE_NAME}@latest upgrade\`.`);
129426
129509
  }
129427
129510
  const alreadyExact = pins.every((pin) => pin.spec === running);
129428
- const updated = alreadyExact ? [] : writeProjectPins(dir, pins, running);
129429
- const next = pins.some((pin) => pin.source === "package.json" && !pin.versionOnly && pin.spec !== running) ? ["npm install"] : [];
129430
- return { from, to: running, updated, changes: changelogBetween(changelog(), from, running), next };
129511
+ const { updated, repairedStarter } = alreadyExact ? { updated: [], repairedStarter: false } : writeProjectPins(dir, pins, running);
129512
+ const next = repairedStarter || pins.some((pin) => pin.source === "package.json" && !pin.versionOnly && pin.spec !== running) ? ["npm install"] : [];
129513
+ return { from, to: running, updated, changes: changelogBetween(changelog(), from, running), next, ...repairedStarter ? { repairedStarter } : {} };
129431
129514
  }
129432
129515
  function registerUpgrade(program2) {
129433
129516
  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", `
@@ -129467,7 +129550,9 @@ Agent skills are not changed; \`${cliInvocation()} skills update\` refreshes the
129467
129550
  console.log("");
129468
129551
  }
129469
129552
  }
129470
- if (result.next.includes("npm install"))
129553
+ if (result.repairedStarter)
129554
+ info(`Made React a required dependency for this starter. Run ${teal("npm install")} to refresh the lockfile before deploying.`);
129555
+ else if (result.next.includes("npm install"))
129471
129556
  info(`Run ${teal("npm install")} to install ${result.to} in node_modules and update the lockfile.`);
129472
129557
  info(`Agent skills were not changed; \`${cliInvocation()} skills status\` compares them with the latest pack.`);
129473
129558
  });
@@ -129487,7 +129572,7 @@ var init_upgrade = __esm({
129487
129572
  });
129488
129573
 
129489
129574
  // dist/commands/call.js
129490
- import { readFileSync as readFileSync38 } from "node:fs";
129575
+ import { readFileSync as readFileSync39 } from "node:fs";
129491
129576
  function parseArguments(value, file2) {
129492
129577
  if (value === void 0)
129493
129578
  return {};
@@ -129511,7 +129596,7 @@ function readCallArguments(jsonArgs, file2) {
129511
129596
  }
129512
129597
  let text;
129513
129598
  try {
129514
- text = readFileSync38(file2, "utf8");
129599
+ text = readFileSync39(file2, "utf8");
129515
129600
  } catch (err) {
129516
129601
  const code = err?.code;
129517
129602
  throw new Error(`Could not read --file ${file2}${code ? ` (${code})` : ""}. The requested tool was not called.`);
@@ -131081,7 +131166,7 @@ var init_reference_check_note = __esm({
131081
131166
 
131082
131167
  // dist/lib/test-scripts.js
131083
131168
  import { createRequire as createRequire8 } from "node:module";
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";
131169
+ import { existsSync as existsSync36, mkdirSync as mkdirSync18, readFileSync as readFileSync40, readdirSync as readdirSync8, rmSync as rmSync14, statSync as statSync8, writeFileSync as writeFileSync24 } from "node:fs";
131085
131170
  import { dirname as dirname14, join as join43, relative as relative12, resolve as resolve24 } from "node:path";
131086
131171
  import { spawn as spawn7, spawnSync as spawnSync5 } from "node:child_process";
131087
131172
  function hasSpecFiles(root) {
@@ -131181,7 +131266,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
131181
131266
  stderrLines("", true);
131182
131267
  let report2 = null;
131183
131268
  try {
131184
- report2 = existsSync36(handOver) ? JSON.parse(readFileSync39(handOver, "utf8")) : null;
131269
+ report2 = existsSync36(handOver) ? JSON.parse(readFileSync40(handOver, "utf8")) : null;
131185
131270
  } catch {
131186
131271
  report2 = null;
131187
131272
  }
@@ -131218,13 +131303,13 @@ function lastFailedScripts(root) {
131218
131303
  if (!existsSync36(path3))
131219
131304
  return [];
131220
131305
  try {
131221
- return (JSON.parse(readFileSync39(path3, "utf8")).results ?? []).filter((r) => !r.ok).map((r) => r.script);
131306
+ return (JSON.parse(readFileSync40(path3, "utf8")).results ?? []).filter((r) => !r.ok).map((r) => r.script);
131222
131307
  } catch {
131223
131308
  return [];
131224
131309
  }
131225
131310
  }
131226
131311
  function recordScriptResults(root, results, rerunOnly) {
131227
- const previous = rerunOnly && existsSync36(join43(root, LAST)) ? JSON.parse(readFileSync39(join43(root, LAST), "utf8")).results ?? [] : [];
131312
+ const previous = rerunOnly && existsSync36(join43(root, LAST)) ? JSON.parse(readFileSync40(join43(root, LAST), "utf8")).results ?? [] : [];
131228
131313
  const merged = [...previous.filter((p2) => !results.some((r) => r.script === p2.script)), ...results];
131229
131314
  mkdirSync18(join43(root, ".somewhere", "tests"), { recursive: true });
131230
131315
  writeFileSync24(join43(root, LAST), JSON.stringify({ finished: (/* @__PURE__ */ new Date()).toISOString(), results: merged }, null, 2) + "\n");
@@ -131308,7 +131393,7 @@ var init_test = __esm({
131308
131393
  });
131309
131394
 
131310
131395
  // dist/commands/test-users.js
131311
- import { existsSync as existsSync37, readFileSync as readFileSync40, rmSync as rmSync15 } from "node:fs";
131396
+ import { existsSync as existsSync37, readFileSync as readFileSync41, rmSync as rmSync15 } from "node:fs";
131312
131397
  import { basename as basename9, join as join44 } from "node:path";
131313
131398
  import { randomBytes as randomBytes9 } from "node:crypto";
131314
131399
  async function resolveTarget(projectOpt, originOpt) {
@@ -131823,7 +131908,7 @@ var init_skills = __esm({
131823
131908
  });
131824
131909
 
131825
131910
  // dist/commands/ai.js
131826
- import { readFileSync as readFileSync41 } from "node:fs";
131911
+ import { readFileSync as readFileSync42 } from "node:fs";
131827
131912
  function fail4(message3) {
131828
131913
  error(message3);
131829
131914
  process.exit(1);
@@ -131844,7 +131929,7 @@ async function readKey(stdin) {
131844
131929
  if (stdin) {
131845
131930
  if (process.stdin.isTTY)
131846
131931
  fail4("Pipe the key into --stdin, or leave out --stdin to type it into a hidden prompt.");
131847
- raw = readFileSync41(0, "utf8");
131932
+ raw = readFileSync42(0, "utf8");
131848
131933
  } else {
131849
131934
  if (!process.stdin.isTTY)
131850
131935
  fail4("Pass --stdin to read the key from a pipe. Nothing was sent.");
@@ -132074,7 +132159,7 @@ __export(dist_exports, {
132074
132159
  runCli: () => runCli
132075
132160
  });
132076
132161
  import { spawnSync as spawnSync6 } from "node:child_process";
132077
- import { readFileSync as readFileSync42 } from "node:fs";
132162
+ import { readFileSync as readFileSync43 } from "node:fs";
132078
132163
  import { join as join47 } from "node:path";
132079
132164
  async function runCli() {
132080
132165
  const pinned = decidePin(process.cwd(), CLI_VERSION, process.argv, process.env);
@@ -132103,7 +132188,7 @@ async function runCli() {
132103
132188
  process.exit(child.status ?? 1);
132104
132189
  }
132105
132190
  removeStaleRunRecord();
132106
- const pkg = JSON.parse(readFileSync42(join47(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
132191
+ const pkg = JSON.parse(readFileSync43(join47(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
132107
132192
  const program2 = new Command().name(cliInvocation()).description(`CLI for somewhere.cloud. Run ${cliInvocation()} init first, then read generated AGENTS.md: call shapes and access patterns for a typical app; docs are for exceptions.`).version(pkg.version);
132108
132193
  recordLastRun(pkg.version);
132109
132194
  const jsonOutputRequested = process.argv.includes("--json");
@@ -132892,7 +132977,7 @@ var init_form_auth = __esm({
132892
132977
  import { randomUUID as randomUUID10 } from "node:crypto";
132893
132978
  import { setDefaultResultOrder } from "node:dns";
132894
132979
  import { lookup } from "node:dns/promises";
132895
- import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync26 } from "node:fs";
132980
+ import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync44, writeFileSync as writeFileSync26 } from "node:fs";
132896
132981
  import { basename as basename10, dirname as dirname15, join as join48, relative as relative14, resolve as resolve25 } from "node:path";
132897
132982
  function launchOptions(extra = {}) {
132898
132983
  return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
@@ -132930,7 +133015,7 @@ function undeployedChanges(root, projectId, preview = false) {
132930
133015
  const path3 = join48(root, ".somewhere", "base-files.json");
132931
133016
  if (!existsSync38(path3))
132932
133017
  return null;
132933
- base = JSON.parse(readFileSync43(path3, "utf8"));
133018
+ base = JSON.parse(readFileSync44(path3, "utf8"));
132934
133019
  }
132935
133020
  if (base.project_id !== projectId || !base.files)
132936
133021
  return null;