@somewhere-cloud/cli 0.38.124 → 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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.38.125
2
+
3
+ - Restore React and React DOM as required dependencies in new starters so the platform can deploy their locked source.
4
+ - Upgrade repairs the React declarations in starters created by 0.38.123 and 0.38.124.
5
+ - Solve proof-of-work only when the server asks for it during temporary signup.
6
+
1
7
  ## 0.38.124
2
8
 
3
9
  - Keep the name from signed-out init when creating the temporary project.
package/README.md CHANGED
@@ -66,13 +66,16 @@ the project. The pinned version runs from npm’s cache when needed. `somewhere
66
66
  upgrade` moves the pin. Type checking uses the pinned compiler through npm
67
67
  when no compiler is installed in the project.
68
68
 
69
- `init` installs the SDK and editor types. Both starters declare React for the
70
- platform build. To install React and Vite locally, use
71
- `npm install --include=optional -D --save-exact vite@7.2.2`
69
+ `init` installs React, the SDK, and editor types. For a local Vite server, use
70
+ `npm install -D --save-exact vite@7.2.2`
72
71
  for `somewhere dev` and `npm install -D --save-exact @playwright/test@1.65.0`
73
72
  for browser tests. `somewhere test` supplies its own helpers to the test files.
74
73
  `init --template bare` is the same as `init --bare` and installs no dependencies.
75
74
 
75
+ If you created the starter with CLI 0.38.123 or 0.38.124, run
76
+ `npx -y @somewhere-cloud/cli@latest upgrade`, then `npm install` before deploying.
77
+ This makes React a required dependency and refreshes the project's lockfile.
78
+
76
79
  The CLI needs no MCP setup: every command works from the shell, and `somewhere run <script>` executes code against your live project. `somewhere init` keeps AGENTS.md and useful skills, but does not install agent hooks or command-running MCP configuration. Existing agent settings stay unchanged. Run `somewhere typecheck`, `somewhere typecheck --deploy`, or `somewhere typecheck --deploy --watch` explicitly when you want local checks. Use `somewhere mcp install <host>` when you explicitly want MCP tools connected to an agent host.
77
80
 
78
81
  For optional after-edit checking, explicitly run `somewhere hooks install --host claude-code` (or `--host codex` / `--host cursor`). It installs only the requested project-local deploy-reference typecheck hook, not MCP registration. Follow the reported host trust step. Shell writes do not trigger the hook; run `somewhere typecheck` after edits, or start `somewhere typecheck --deploy --watch`.
@@ -37629,7 +37629,7 @@ import { spawn as spawn2 } from "node:child_process";
37629
37629
  function initInstallSpawnSpec(platform2) {
37630
37630
  return {
37631
37631
  command: platform2 === "win32" ? "npm.cmd" : "npm",
37632
- args: ["install", "--no-audit", "--no-fund", "--omit=optional"],
37632
+ args: ["install", "--no-audit", "--no-fund"],
37633
37633
  shell: platform2 === "win32"
37634
37634
  };
37635
37635
  }
@@ -38372,7 +38372,7 @@ Keep each run short:
38372
38372
  text). Checks after a failure only wait out their timeouts. app.check() does both.
38373
38373
  - After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
38374
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.
38375
- 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.
38376
38376
  The test helper, @somewhere-cloud/cli/script (import or require); these are all the calls a test needs:
38377
38377
  const app = await openAppTest(); // the live origin, release and data contract
38378
38378
  const ana = await app.signUp(page); // through your form: { id, email, password, verified }
@@ -38606,9 +38606,7 @@ var init_init_green_template = __esm({
38606
38606
  "typecheck": "npx -y @somewhere-cloud/cli typecheck"
38607
38607
  },
38608
38608
  "dependencies": {
38609
- "@somewhere-cloud/sdk": "0.14.2"
38610
- },
38611
- "optionalDependencies": {
38609
+ "@somewhere-cloud/sdk": "0.14.2",
38612
38610
  "react": "19.2.7",
38613
38611
  "react-dom": "19.2.7"
38614
38612
  },
@@ -40942,13 +40940,30 @@ function pinnedNpx(version2) {
40942
40940
  const entry = [besideNpm, besideNode].find((path3) => existsSync7(path3));
40943
40941
  return entry ? { command: process.execPath, args: [entry, ...args] } : null;
40944
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
+ }
40945
40958
  function writeProjectPins(dir, pins, version2) {
40946
- const written = [];
40959
+ const updated = [];
40960
+ let repairedStarter = false;
40947
40961
  for (const pin of pins) {
40948
40962
  const path3 = join7(dir, pin.source);
40949
40963
  const raw = readFileSync9(path3, "utf8");
40950
40964
  const json2 = JSON.parse(raw);
40951
40965
  if (pin.versionOnly) {
40966
+ repairedStarter = repairStarterReact(json2, pin.spec);
40952
40967
  json2.somewhere[PIN_FILE_KEY] = version2;
40953
40968
  } else if (pin.source === "package.json") {
40954
40969
  for (const section of ["devDependencies", "dependencies"]) {
@@ -40961,10 +40976,10 @@ function writeProjectPins(dir, pins, version2) {
40961
40976
  }
40962
40977
  const indent = /^\{\s*\n(\s+)/.exec(raw)?.[1] ?? " ";
40963
40978
  writeFileSync7(path3, JSON.stringify(json2, null, indent) + "\n");
40964
- if (!written.includes(pin.source))
40965
- written.push(pin.source);
40979
+ if (!updated.includes(pin.source))
40980
+ updated.push(pin.source);
40966
40981
  }
40967
- return written;
40982
+ return { updated, repairedStarter };
40968
40983
  }
40969
40984
  function recordPinIfMissing(dir, version2) {
40970
40985
  if (!import_semver.default.valid(version2) || readProjectPins(dir).length)
@@ -41015,6 +41030,7 @@ var init_project_pin = __esm({
41015
41030
  PINNED_CHILD_ENV = "SOMEWHERE_PINNED_CLI";
41016
41031
  __name(decidePin, "decidePin");
41017
41032
  __name(pinnedNpx, "pinnedNpx");
41033
+ __name(repairStarterReact, "repairStarterReact");
41018
41034
  __name(writeProjectPins, "writeProjectPins");
41019
41035
  __name(recordPinIfMissing, "recordPinIfMissing");
41020
41036
  __name(readBundledChangelog, "readBundledChangelog");
@@ -42979,9 +42995,7 @@ var init_init_feature_template = __esm({
42979
42995
  "typecheck": "npx -y @somewhere-cloud/cli typecheck"
42980
42996
  },
42981
42997
  "dependencies": {
42982
- "@somewhere-cloud/sdk": "0.14.2"
42983
- },
42984
- "optionalDependencies": {
42998
+ "@somewhere-cloud/sdk": "0.14.2",
42985
42999
  "react": "19.2.7",
42986
43000
  "react-dom": "19.2.7"
42987
43001
  },
@@ -46055,7 +46069,7 @@ replaceable views in src/ui/ and styles in src/styles/, plus an AGENTS.md workfl
46055
46069
  (deploy, then test). Sign-in and invitation links (sw.auth.invite) open
46056
46070
  /auth/magic, which the starter routes before the sign-in gate.
46057
46071
  \`--template minimal\` includes the SDK and auth route without sign-in screens.
46058
- 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.
46059
46073
  TypeScript is fetched when first needed. Vite and Playwright are installed only if you choose to use them.
46060
46074
  New starters and --bare also install ${skillNames(BUNDLED_SKILLS_PACK).length} agent skills in .agents/skills, pinned by skills-lock.json.
46061
46075
 
@@ -76321,13 +76335,20 @@ function solvePow(nonce, difficulty) {
76321
76335
  }
76322
76336
  }
76323
76337
  }
76324
- async function mintTempAccount(client = new ApiClient(null)) {
76325
- const challenge = await client.call("GET", "/auth/pow/challenge", void 0, void 0, { refresh: false });
76326
- if (!challenge || typeof challenge.nonce !== "string" || typeof challenge.difficulty !== "number") {
76327
- 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 });
76328
76351
  }
76329
- const { suffix } = solvePow(challenge.nonce, challenge.difficulty);
76330
- const data2 = await client.call("POST", "/auth/temp-create", { nonce: challenge.nonce, suffix }, void 0, { refresh: false });
76331
76352
  const key = data2?.key ?? data2?.access_token;
76332
76353
  if (!key) {
76333
76354
  throw new CliApiError("INVALID_RESPONSE", "The temporary account response had neither `key` nor `access_token`.", 200);
@@ -82216,10 +82237,16 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82216
82237
  const typecheckStartedAt = performance.now();
82217
82238
  const hasTsconfig = existsSync28(join33(targetDir, "tsconfig.json"));
82218
82239
  const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
82219
- if (hasTsconfig && !missingDependencies && typecheckCompilerSource(targetDir) === "npx") {
82240
+ const checkingTypes = hasTsconfig && !missingDependencies;
82241
+ if (checkingTypes && typecheckCompilerSource(targetDir) === "npx") {
82220
82242
  announceNpxTypeScriptFetch(TYPECHECK_TYPESCRIPT_VERSION);
82221
82243
  }
82222
- 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);
82223
82250
  typecheckMs = performance.now() - typecheckStartedAt;
82224
82251
  }) : Promise.resolve(null);
82225
82252
  const verifyFlow = opts.verify && !opts.dryRun ? loadVerifyFlow(typeof opts.verify === "string" ? opts.verify : void 0, targetDir) : void 0;
@@ -82319,10 +82346,13 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82319
82346
  else
82320
82347
  info(note);
82321
82348
  }
82322
- 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();
82323
82350
  try {
82324
- const account = await mintTempAccount();
82325
- 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();
82326
82356
  if (besideRealLogin) {
82327
82357
  const minted = {
82328
82358
  token: account.key,
@@ -82352,7 +82382,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82352
82382
  };
82353
82383
  }
82354
82384
  } catch (err) {
82355
- powSpinner?.fail("Could not create a temporary session");
82385
+ signupSpinner?.fail("Could not create a temporary session");
82356
82386
  const status = err instanceof CliApiError ? ` ${dim(err.statusCode ? `[${err.code}, HTTP ${err.statusCode}]` : `[${err.code}]`)}` : "";
82357
82387
  error(`${err instanceof Error ? err.message : String(err)}${status}`, err);
82358
82388
  process.exit(1);
@@ -83352,7 +83382,7 @@ var init_deploy = __esm({
83352
83382
  "optionalDependencies"
83353
83383
  ];
83354
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.`;
83355
- DEPLOY_HEARTBEAT_MS = 3e4;
83385
+ DEPLOY_HEARTBEAT_MS = 1e4;
83356
83386
  DEPLOY_MAX_ATTEMPTS = 2;
83357
83387
  RETRYABLE_DEPLOY_CODES = /* @__PURE__ */ new Set(["TIMEOUT", "SERVER_SLOW", "NETWORK_ERROR"]);
83358
83388
  DEPLOY_RETRY_MAX_WAIT_MS = 1e4;
@@ -87451,7 +87481,7 @@ async function startFrontendDev(cwd, target, port = 8787, open3 = false) {
87451
87481
  vitePath = createRequire7(join37(cwd, "package.json")).resolve("vite");
87452
87482
  } catch {
87453
87483
  if (readProjectPin(cwd)?.versionOnly) {
87454
- 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");
87455
87485
  }
87456
87486
  throw new Error(`Install this frontend\u2019s Vite dependencies before running ${cliInvocation()} dev. Backend changes run through ${cliInvocation()} deploy or ${cliInvocation()} preview.`);
87457
87487
  }
@@ -129478,9 +129508,9 @@ function upgradeProject(dir, running, changelog = readBundledChangelog) {
129478
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\`.`);
129479
129509
  }
129480
129510
  const alreadyExact = pins.every((pin) => pin.spec === running);
129481
- const updated = alreadyExact ? [] : writeProjectPins(dir, pins, running);
129482
- const next = pins.some((pin) => pin.source === "package.json" && !pin.versionOnly && pin.spec !== running) ? ["npm install"] : [];
129483
- 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 } : {} };
129484
129514
  }
129485
129515
  function registerUpgrade(program2) {
129486
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", `
@@ -129520,7 +129550,9 @@ Agent skills are not changed; \`${cliInvocation()} skills update\` refreshes the
129520
129550
  console.log("");
129521
129551
  }
129522
129552
  }
129523
- 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"))
129524
129556
  info(`Run ${teal("npm install")} to install ${result.to} in node_modules and update the lockfile.`);
129525
129557
  info(`Agent skills were not changed; \`${cliInvocation()} skills status\` compares them with the latest pack.`);
129526
129558
  });