@somewhere-cloud/cli 0.38.125 → 0.38.126

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.126
2
+
3
+ - A claim link connects the CLI only to the claimed project. Use `somewhere login` for account access.
4
+ - Point deploy guidance to `api/` and simplify help and progress messages.
5
+ - Build the packed test suite in a private directory so another build cannot interrupt it.
6
+
1
7
  ## 0.38.125
2
8
 
3
9
  - Restore React and React DOM as required dependencies in new starters so the platform can deploy their locked source.
package/README.md CHANGED
@@ -94,7 +94,7 @@ For optional after-edit checking, explicitly run `somewhere hooks install --host
94
94
  | `somewhere projects` | List all projects with status |
95
95
  | `somewhere project create <name>` | Create a new project |
96
96
  | `somewhere project view [name]` | Show project details |
97
- | `somewhere project delete <name>` | Delete a project and all its data. The first call returns a confirmation code (valid 10 minutes); run again with `--confirm-code <code>`, or type the project name when asked |
97
+ | `somewhere project delete <name>` | Delete a project and all its data. The first call returns a confirmation code. Run again with `--confirm-code <code>`, or type the project name when asked. |
98
98
  | `somewhere dev` | Frontend hot reload on localhost with your project's own Vite; API requests go to your deployed project |
99
99
  | `somewhere preview` | Run your whole app on the platform — every save goes to a private URL, and production is untouched until you promote |
100
100
  | `somewhere deploy` | Deploy current directory to linked project |
@@ -192,7 +192,7 @@ deploys but does not undeploy the current site.
192
192
  | `--dry-run` | Upload source and show what would change without publishing |
193
193
  | `--replace-functions` | Drop deployed functions not present locally. A full deploy already does this and names each removed function; use it with `--scope functions`, which otherwise keeps them |
194
194
  | `--project <id>` | Deploy to a specific project instead of the linked one |
195
- | `-m, --message <text>` | Optional user-supplied version note (max 200 characters after controls are stripped) |
195
+ | `-m, --message <text>` | Add a note for this version |
196
196
  | `--force` | Overwrite remote changes even when this machine has an older deployed version |
197
197
  | `--yes` | Skip the `--force` confirmation prompt |
198
198
 
@@ -38281,7 +38281,7 @@ not enough. So tickets lists create: ['staff']; without it every staff reply is
38281
38281
  Publish pages in an owner-checked endpoint. Share with caller-scoped
38282
38282
  sw.db.insert('note_shares', { grantee_id, note_id }); it checks row ownership.
38283
38283
  Browser calls THROW, not { error }; catch below.
38284
- Browser list: max 100, paginate after; no order (sort locally or in an endpoint).
38284
+ Browser list: paginate with after. Sort locally or in an endpoint.
38285
38285
 
38286
38286
  \`\`\`ts
38287
38287
  import { data } from 'somewhere:data';
@@ -76386,7 +76386,6 @@ function decodeCredentials(state, response) {
76386
76386
  if (!state.handoff_id || response.project_id !== state.project_id) {
76387
76387
  throw new Error("Claim continuation returned a different project. No credential was installed.");
76388
76388
  }
76389
- const account = response.approved_scope === "account";
76390
76389
  const key = createHash5("sha256").update(`claim-cli-handoff:v1:${state.verifier}`, "utf8").digest();
76391
76390
  const combined = Buffer.from(response.ciphertext, "base64");
76392
76391
  if (combined.length <= 16)
@@ -76394,11 +76393,11 @@ function decodeCredentials(state, response) {
76394
76393
  const encrypted = combined.subarray(0, -16);
76395
76394
  const tag = combined.subarray(-16);
76396
76395
  const decipher = createDecipheriv("aes-256-gcm", key, Buffer.from(response.iv, "base64"));
76397
- decipher.setAAD(Buffer.from(`${state.handoff_id}:${state.project_id}${account ? ":account" : ""}`, "utf8"));
76396
+ decipher.setAAD(Buffer.from(`${state.handoff_id}:${state.project_id}`, "utf8"));
76398
76397
  decipher.setAuthTag(tag);
76399
76398
  const plaintext = Buffer.concat([decipher.update(encrypted), decipher.final()]).toString("utf8");
76400
76399
  const parsed = JSON.parse(plaintext);
76401
- if (typeof parsed.token !== "string" || typeof parsed.refresh_token !== "string" || typeof parsed.expires_at !== "string" || typeof parsed.email !== "string" || parsed.project_id !== state.project_id || (account ? parsed.scope !== null || parsed.approved_scope !== "account" : parsed.scope?.projects?.length !== 1 || parsed.scope.projects[0] !== state.project_id)) {
76400
+ if (typeof parsed.token !== "string" || typeof parsed.refresh_token !== "string" || typeof parsed.expires_at !== "string" || typeof parsed.email !== "string" || parsed.project_id !== state.project_id || parsed.approved_scope !== void 0 && parsed.approved_scope !== "project" || parsed.scope?.projects?.length !== 1 || parsed.scope.projects[0] !== state.project_id) {
76402
76401
  throw new Error("Claim continuation credential did not match the approved project. Nothing was installed.");
76403
76402
  }
76404
76403
  return parsed;
@@ -76431,8 +76430,7 @@ async function ensureClaimHandoff(projectId) {
76431
76430
  project_id: projectId,
76432
76431
  verifier_hash: verifierHash(state.verifier),
76433
76432
  device_name: getDeviceKeyName(),
76434
- client: describeThisDevice(),
76435
- capabilities: CAPABILITIES
76433
+ client: describeThisDevice()
76436
76434
  }, config2.token);
76437
76435
  if (!response.ok || !envelope.ok || !envelope.data) {
76438
76436
  throw new Error(envelope.message || envelope.error || `CLI continuation registration failed (HTTP ${response.status}).`);
@@ -76497,6 +76495,12 @@ async function recoverClaimHandoff() {
76497
76495
  } catch {
76498
76496
  return { kind: "none" };
76499
76497
  }
76498
+ if (envelope.error === "CLAIM_CLI_ACCOUNT_SCOPE_FORBIDDEN" || envelope.data?.approved_scope !== void 0 && envelope.data.approved_scope !== "project") {
76499
+ return {
76500
+ kind: "manual",
76501
+ message: `A claim link connects this CLI only to the claimed project. Run \`${cliInvocation()} login\` for account access.`
76502
+ };
76503
+ }
76500
76504
  if (!response.ok || !envelope.ok || !envelope.data) {
76501
76505
  if (["CLAIM_CLI_HANDOFF_PENDING", "CLAIM_CLI_HANDOFF_IN_PROGRESS"].includes(envelope.error || "")) {
76502
76506
  return { kind: "none" };
@@ -76534,10 +76538,9 @@ async function recoverClaimHandoff() {
76534
76538
  }
76535
76539
  return {
76536
76540
  kind: "recovered",
76537
- message: delivered.scope === null ? `Connected to ${delivered.email} with access to all its projects. The existing project link was kept.` : `Connected to ${delivered.email} for this project only. The existing project link was kept.`
76541
+ message: `Connected to ${delivered.email} for this project only. The existing project link was kept. Run \`${cliInvocation()} login\` for account access.`
76538
76542
  };
76539
76543
  }
76540
- var CAPABILITIES;
76541
76544
  var init_claim_handoff = __esm({
76542
76545
  "dist/lib/claim-handoff.js"() {
76543
76546
  "use strict";
@@ -76547,7 +76550,6 @@ var init_claim_handoff = __esm({
76547
76550
  init_device_login();
76548
76551
  init_client();
76549
76552
  init_http();
76550
- CAPABILITIES = ["account_scope"];
76551
76553
  __name(verifierHash, "verifierHash");
76552
76554
  __name(newVerifier, "newVerifier");
76553
76555
  __name(decodeCredentials, "decodeCredentials");
@@ -80015,7 +80017,7 @@ async function closeKept(client, entry) {
80015
80017
  const removed = await client.call("DELETE", "/auth/test-users", { project_id: entry.project_id, ids });
80016
80018
  return { browsers, identities: { status: "deleted", ...typeof removed?.deleted === "number" ? { deleted: removed.deleted } : {} } };
80017
80019
  } catch (cause) {
80018
- return { browsers, identities: { status: `unconfirmed (${cause instanceof CliApiError ? cause.code : "delete failed"}); they expire 24 hours after creation` } };
80020
+ return { browsers, identities: { status: `unconfirmed (${cause instanceof CliApiError ? cause.code : "delete failed"}); the platform removes them when they expire` } };
80019
80021
  }
80020
80022
  }
80021
80023
  function keepStartNote(entry, otherFlowsKept) {
@@ -80231,7 +80233,7 @@ function assertSessionSeedSize(flow) {
80231
80233
  headers: flow.headers ?? {}
80232
80234
  }));
80233
80235
  if (bytes > 8 * 1024)
80234
- throw new Error(`Verification session seed is ${bytes} bytes; the platform limit is 8192 bytes (8 KB).`);
80236
+ throw new Error("The verification session data is too large. Remove unused local storage entries, cookies, or headers and run again.");
80235
80237
  }
80236
80238
  function normalizeViewports(raw) {
80237
80239
  if (raw === void 0)
@@ -80895,7 +80897,7 @@ function createVerifyJourneyRun(target, journey, client, opts = {}) {
80895
80897
  }, "createTestUsers");
80896
80898
  const removeTestUsers = /* @__PURE__ */ __name(async () => {
80897
80899
  if (opts.keepTestUsers)
80898
- return { status: "kept", reason: "kept on request; they expire 24 hours after creation" };
80900
+ return { status: "kept", reason: "kept on request until they expire" };
80899
80901
  if (keep && keptForReuse.size > 0 && testActors.every((name) => keptForReuse.has(name)))
80900
80902
  return { status: "kept", reason: "kept with their browsers for the next --keep-actors run; remove them with --close-actors" };
80901
80903
  try {
@@ -80903,7 +80905,7 @@ function createVerifyJourneyRun(target, journey, client, opts = {}) {
80903
80905
  return { status: "deleted", deleted: typeof removed?.deleted === "number" ? removed.deleted : void 0 };
80904
80906
  } catch (cause) {
80905
80907
  const code = cause instanceof CliApiError ? cause.code : cause instanceof Error ? cause.message : String(cause);
80906
- return { status: "unconfirmed", reason: `delete failed (${code}); the platform removes test users 24 hours after creation` };
80908
+ return { status: "unconfirmed", reason: `delete failed (${code}); the platform removes test users when they expire` };
80907
80909
  }
80908
80910
  }, "removeTestUsers");
80909
80911
  const stop = /* @__PURE__ */ __name((code, message3) => {
@@ -81130,7 +81132,7 @@ function createVerifyJourneyRun(target, journey, client, opts = {}) {
81130
81132
  continue;
81131
81133
  }
81132
81134
  if (!first && report2.session_note) {
81133
- const message3 = `${segment.as}'s browser ended between segments (${report2.session_note}), so ${segment.as} is no longer the same signed-in user. Keep each actor's gap between segments under 5 minutes and run the journey again.`;
81135
+ const message3 = `${segment.as}'s browser ended between segments (${report2.session_note}), so ${segment.as} is no longer the same signed-in user. Shorten the gaps between that actor's segments and run the journey again.`;
81134
81136
  itemStop ??= stopAt("error", "VERIFY_ACTOR_SESSION_ENDED", message3);
81135
81137
  segments.push({ ...base, ...timing, ran: true, final_url: report2.final_url === void 0 ? void 0 : reportUrl(report2.final_url), error: { code: "VERIFY_ACTOR_SESSION_ENDED", message: message3 } });
81136
81138
  continue;
@@ -81490,7 +81492,7 @@ function registerVerify(program2) {
81490
81492
  cliCookies.push({ name: value.slice(0, at2), value: value.slice(at2 + 1) });
81491
81493
  return value;
81492
81494
  }, "collectCookie");
81493
- program2.command("verify [target]").description("Run one browser flow at desktop and phone size, report every step and health signal, and capture both screenshots.").option("--project <ref>", "Project to verify. With --url, use this when the directory is unlinked or points to another project.").option("--url <url>", "Live or local URL to verify.").option("--path <path>", "Path relative to the linked or selected project app, e.g. /settings. Cannot be combined with --url.").option("--flow <file.json>", "Flow JSON with actions, session seeds, expect_requests, visible_only, and viewports. Omit for the default health check.").option("--session <session-id>", "Existing app session value to seed as localStorage sw_auth in every viewport.").option("--cookie <name=value>", "Existing app cookie to seed in every viewport. Repeatable.", collectCookie).option("--json", "Print the structured verification report as JSON.").option("--out <file>", "Write the full report to a new private file; print a bounded summary (JSON with --json).").option("--keep-actors", "Multi-user flows: after a fully passed run, keep each actor's signed-in browser and test user, and reconnect to them on the next run of the same flow file in this project folder. Each run navigates every actor to its starting path and runs the same checks, but cookies, storage and app data the actors created carry over, so checks must not assume an empty account. One run per kept flow at a time. Close with --close-actors; otherwise the platform closes a kept browser after 5 minutes idle, and at most 10 minutes after it started.").option("--resume-page", "With --keep-actors: an explicit stateful warm continuation. An actor whose first segment starts at exactly the page path the last passed run left it on keeps that page as it was last observed (no reload, like reusing a Playwright page); if the app moved it afterwards, the run continues from there. A different actor, flow, project or start path, or a page told apart only by its query or fragment, reloads normally. The kept page may run code from before the latest deploy, so a resumed run is not fresh-release evidence; the report lists resumed actors.").option("--close-actors", "Close every browser and delete every test user that --keep-actors kept for this project in this folder, then exit.").option("--keep-test-users", 'Multi-user flows: keep the test users created for "test_user" actors instead of deleting them when the run ends (they expire 24 hours after creation).').option("--schema", "Print the JSON Schema for --flow files (one user, or several users) and exit.").addHelpText("after", `
81495
+ program2.command("verify [target]").description("Run one browser flow at desktop and phone size, report every step and health signal, and capture both screenshots.").option("--project <ref>", "Project to verify. With --url, use this when the directory is unlinked or points to another project.").option("--url <url>", "Live or local URL to verify.").option("--path <path>", "Path relative to the linked or selected project app, e.g. /settings. Cannot be combined with --url.").option("--flow <file.json>", "Flow JSON with actions, session seeds, expect_requests, visible_only, and viewports. Omit for the default health check.").option("--session <session-id>", "Existing app session value to seed as localStorage sw_auth in every viewport.").option("--cookie <name=value>", "Existing app cookie to seed in every viewport. Repeatable.", collectCookie).option("--json", "Print the structured verification report as JSON.").option("--out <file>", "Write the full report to a new private file; print a bounded summary (JSON with --json).").option("--keep-actors", "Multi-user flows: after a fully passed run, keep each actor's signed-in browser and test user, and reconnect to them on the next run of the same flow file in this project folder. Each run starts at the same paths and runs the same checks. Cookies, storage and app data carry over. One run per kept flow at a time. Use --close-actors to close the kept browsers, or let them expire.").option("--resume-page", "With --keep-actors: an explicit stateful warm continuation. An actor whose first segment starts at exactly the page path the last passed run left it on keeps that page as it was last observed (no reload, like reusing a Playwright page); if the app moved it afterwards, the run continues from there. A different actor, flow, project or start path, or a page told apart only by its query or fragment, reloads normally. The kept page may run code from before the latest deploy, so a resumed run is not fresh-release evidence; the report lists resumed actors.").option("--close-actors", "Close every browser and delete every test user that --keep-actors kept for this project in this folder, then exit.").option("--keep-test-users", 'Multi-user flows: keep the users created for "test_user" actors until they expire.').option("--schema", "Print the JSON Schema for --flow files (one user, or several users) and exit.").addHelpText("after", `
81494
81496
  Minimal --flow JSON:
81495
81497
  {
81496
81498
  "actions": [
@@ -81532,15 +81534,12 @@ Several users in one run (--project required; each actor is its own browser):
81532
81534
  }
81533
81535
  Segments run in order; a later segment for the same actor continues in that
81534
81536
  actor's browser (path becomes a goto). For realtime checks, an item
81535
- { "parallel": [segment, segment] } runs 2-${VERIFY_JOURNEY_LIMITS.parallel_segments} segments by different actors at the
81536
- same time (alice waits for a message while bob sends it). Limits: ${VERIFY_JOURNEY_LIMITS.actors} actors, ${VERIFY_JOURNEY_LIMITS.segments} segments,
81537
- ${VERIFY_JOURNEY_LIMITS.actions_per_segment} actions per segment, ${VERIFY_JOURNEY_LIMITS.total_actions} in total, ${VERIFY_JOURNEY_LIMITS.deadline_ms / 6e4} minutes. Each segment is one browser
81538
- run against your plan's browser limits. When the run ends or is interrupted,
81539
- every actor browser is closed within ${VERIFY_JOURNEY_LIMITS.cleanup_budget_ms / 1e3} seconds; any close that cannot be
81540
- confirmed is reported, and the platform closes idle browsers within 5 minutes.
81541
- Several users need a claimed account and a CLI login approved for all your
81542
- projects: a login approved for "Only these projects" cannot open named browsers
81543
- (SESSION_SCOPE_FORBIDDEN). Print the full flow schema with: ${cliInvocation()} verify --schema
81537
+ { "parallel": [segment, segment] } runs segments by different actors at the
81538
+ same time (alice waits for a message while bob sends it). When the run ends or is
81539
+ interrupted, verification closes each actor's browser and reports any close it
81540
+ could not confirm. The platform closes idle browsers when they expire.
81541
+ For named browsers in a multi-user run, claim the project and use ${cliInvocation()} login
81542
+ with account access. Print the full flow schema with ${cliInvocation()} verify --schema.
81544
81543
  `).action(async (target, opts) => {
81545
81544
  if (opts.schema) {
81546
81545
  console.log(JSON.stringify(verifyFlowSchema(), null, 2));
@@ -81853,7 +81852,7 @@ var init_verify = __esm({
81853
81852
  __name(isVerifyJourneyInput, "isVerifyJourneyInput");
81854
81853
  __name(normalizeVerifyJourney, "normalizeVerifyJourney");
81855
81854
  __name(loadVerifyInput, "loadVerifyInput");
81856
- UNCONFIRMED_BACKSTOP = "the platform closes an idle browser within 5 minutes";
81855
+ UNCONFIRMED_BACKSTOP = "the platform closes idle browsers when they expire";
81857
81856
  RECLOSE_AFTER_ABANDONED_MS = 5e3;
81858
81857
  __name(settleWithin, "settleWithin");
81859
81858
  __name(createVerifyJourneyRun, "createVerifyJourneyRun");
@@ -82201,7 +82200,7 @@ No project yet? Signed in, deploy never creates one on its own:
82201
82200
  ${cliInvocation()} init --bare --name <name> create a project in your account and link this folder
82202
82201
  ${cliInvocation()} deploy then deploy it
82203
82202
  Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cliInvocation()} projects\`), or \`--project <ref>\` here.
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) => {
82203
+ `).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>", "Add a note for this version").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) => {
82205
82204
  const startupMs = performance.now();
82206
82205
  const targetDir = resolveTargetDir(dir);
82207
82206
  if (opts.new && (opts.project || opts.dryRun || opts.temporary)) {
@@ -82275,7 +82274,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82275
82274
  process.exit(1);
82276
82275
  }
82277
82276
  if (Object.keys(files).length === 0 && Object.keys(binaryFiles).length === 0 && Object.keys(functions).length === 0) {
82278
- const message3 = `No deployable source found. Create an index.html or add raw app source files, or add serverless handlers under functions/, then run \`${cliInvocation()} deploy\` again.`;
82277
+ const message3 = `No deployable source found. Create an index.html or add raw app source files, or add API handlers under api/, then run \`${cliInvocation()} deploy\` again.`;
82279
82278
  if (opts.json)
82280
82279
  printJsonError("NO_DEPLOYABLE_SOURCE", message3);
82281
82280
  else
@@ -82350,7 +82349,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82350
82349
  try {
82351
82350
  const account = await mintTempAccount(void 0, () => {
82352
82351
  if (signupSpinner)
82353
- signupSpinner.text = "Solving the proof-of-work requested by the server\u2026";
82352
+ signupSpinner.text = "Completing the temporary session check\u2026";
82354
82353
  });
82355
82354
  signupSpinner?.stop();
82356
82355
  if (besideRealLogin) {
@@ -82384,7 +82383,18 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82384
82383
  } catch (err) {
82385
82384
  signupSpinner?.fail("Could not create a temporary session");
82386
82385
  const status = err instanceof CliApiError ? ` ${dim(err.statusCode ? `[${err.code}, HTTP ${err.statusCode}]` : `[${err.code}]`)}` : "";
82387
- error(`${err instanceof Error ? err.message : String(err)}${status}`, err);
82386
+ const envelope = platformErrorEnvelope(err);
82387
+ if (envelope?.code === "INVALID_POW" || envelope?.code === "POW_REQUIRED") {
82388
+ const message3 = `The temporary session check failed. Run \`${cliInvocation()} deploy\` to try again.`;
82389
+ if (opts.json) {
82390
+ noteFailure(err);
82391
+ printJsonError(envelope.code, message3, envelope.extra);
82392
+ } else {
82393
+ error(`${message3}${status}`, err);
82394
+ }
82395
+ } else {
82396
+ error(`${err instanceof Error ? err.message : String(err)}${status}`, err);
82397
+ }
82388
82398
  process.exit(1);
82389
82399
  }
82390
82400
  }
@@ -82558,7 +82568,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82558
82568
  warn(`This looks like a Node server app (${serverSignal}) \u2014 somewhere.cloud does not run server processes.`);
82559
82569
  warn("It will deploy as static files only: your routes will NOT run, and the");
82560
82570
  warn("server source will be publicly readable at its file path.");
82561
- warn("The platform shape: static files at the root + API handlers under functions/");
82571
+ warn("The platform accepts static files at the root and API handlers under api/.");
82562
82572
  warn("(each default-exports async (req, sw) and becomes a route).");
82563
82573
  warn(`Full quickstart: ${cliInvocation()} docs start`);
82564
82574
  }
@@ -82566,18 +82576,15 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82566
82576
  spinner?.start();
82567
82577
  }
82568
82578
  const totalFiles = Object.keys(files).length + Object.keys(binaryFiles).length + Object.keys(functions).length;
82569
- const textBytes = Object.values(files).concat(Object.values(functions)).reduce((sum, c) => sum + c.length, 0);
82570
- const binaryBytes = Object.values(binaryFiles).reduce((sum, b64) => sum + Math.floor(b64.length * 3 / 4), 0);
82571
- const totalBytes = textBytes + binaryBytes;
82572
82579
  const inventory = uploadInventory(files, binaryFiles, functions, scope);
82573
82580
  if (opts.dryRun && !opts.json) {
82574
82581
  spinner?.stop();
82575
- info(dim(`Dry run: sending ${totalFiles} files (${formatBytes(totalBytes)}) to Somewhere to compute the change. Nothing is published.`));
82582
+ info(dim(`Dry run: sending ${totalFiles} files to Somewhere to check what would change. Nothing is published.`));
82576
82583
  if (process.stderr.isTTY)
82577
82584
  spinner?.start();
82578
82585
  }
82579
82586
  if (spinner) {
82580
- spinner.text = opts.dryRun ? `Checking ${totalFiles} files (${formatBytes(totalBytes)})...` : `Deploying ${totalFiles} files (${formatBytes(totalBytes)})...`;
82587
+ spinner.text = opts.dryRun ? `Checking ${totalFiles} files...` : `Deploying ${totalFiles} files...`;
82581
82588
  }
82582
82589
  let deployAnswered = false;
82583
82590
  let deployRequestStartedAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -82724,7 +82731,6 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82724
82731
  scope,
82725
82732
  functionCount: countFunctionRoutes(functions),
82726
82733
  staticFileCount: inventory.static_files.length,
82727
- totalBytes,
82728
82734
  linkedProject: await linkedProjectWithSubdomain(client, result, targetProjectConfig)
82729
82735
  });
82730
82736
  if (opts.timing && !opts.json) {
@@ -82918,7 +82924,7 @@ ${dim("Build")}`);
82918
82924
  info(formatTempExpiry(tempSession.expiresAt, tempSession.ttlSeconds));
82919
82925
  const link = teal(tempSession.claimUrl);
82920
82926
  if (tempSession.handoffReady) {
82921
- info(`Open ${link} and select "Save project and connect agent" to save the project to your account and connect this terminal automatically.`);
82927
+ info(`Open ${link} and select "Save and connect agent" to save the project and connect this terminal to it only. Run \`${cliInvocation()} login\` for account access.`);
82922
82928
  } else if (besideRealLogin) {
82923
82929
  info(`Open ${link} to save the project to your account, then run \`${cliInvocation()} init --link --project ${projectId}\` in an unlinked folder to work on it.`);
82924
82930
  } else {
@@ -83096,13 +83102,13 @@ function formatDeploySuccess(result, options2) {
83096
83102
  if (options2.scope === "functions") {
83097
83103
  headline = `${formatPublishSurface({ staticFiles: null, functions: options2.functionCount })} deployed \u2014 site left untouched`;
83098
83104
  } else if (options2.scope === "static") {
83099
- headline = `${staticLabel} uploaded (${formatBytes(options2.totalBytes)}) \u2014 functions left untouched`;
83105
+ headline = `${staticLabel} uploaded \u2014 functions left untouched`;
83100
83106
  } else {
83101
83107
  const both = formatPublishSurface({
83102
83108
  staticFiles: staticFileCount,
83103
83109
  functions: options2.functionCount
83104
83110
  });
83105
- headline = `${staticFileCount === null && options2.functionCount === 0 ? staticLabel : both} uploaded (${formatBytes(options2.totalBytes)})`;
83111
+ headline = `${staticFileCount === null && options2.functionCount === 0 ? staticLabel : both} uploaded`;
83106
83112
  }
83107
83113
  const responseUrl = typeof result.url === "string" && result.url.trim() ? result.url.trim() : null;
83108
83114
  const linkedSubdomain = typeof options2.linkedProject?.subdomain === "string" ? options2.linkedProject.subdomain.trim() : "";
@@ -86803,7 +86809,7 @@ function registerEnv(program2) {
86803
86809
  }
86804
86810
  success(`Wrote ${keys.length} key${keys.length === 1 ? "" : "s"} to ${teal(opts.out)} (values blank \u2014 fill them in for local runs)`);
86805
86811
  });
86806
- env.command("set <key> [value]").description("Set an environment value; use --stdin to keep it out of shell history").option("--project <id>", "Project ID").option("--stdin", "Read the value from stdin (removes one final line ending)").option("--public", "Explicitly allow browser exposure for a VITE_/REACT_APP_ name").option("--private", "Keep this value server-only").option("--scope <scope>", "Environment: all, dev, or prod (default: all)").option("--provider <name>", "Optional provider label (max 64 characters)").option("--purpose <text>", "Optional purpose description (max 240 characters)").option("--json", "Print the raw env response as JSON").action(async (key, positionalValue, opts) => {
86812
+ env.command("set <key> [value]").description("Set an environment value; use --stdin to keep it out of shell history").option("--project <id>", "Project ID").option("--stdin", "Read the value from stdin (removes one final line ending)").option("--public", "Explicitly allow browser exposure for a VITE_/REACT_APP_ name").option("--private", "Keep this value server-only").option("--scope <scope>", "Environment: all, dev, or prod (default: all)").option("--provider <name>", "Optional provider label").option("--purpose <text>", "Optional purpose description").option("--json", "Print the raw env response as JSON").action(async (key, positionalValue, opts) => {
86807
86813
  if (opts.public && opts.private) {
86808
86814
  error("--public and --private cannot be used together.");
86809
86815
  process.exit(1);
@@ -87342,7 +87348,7 @@ function registerClaim(program2) {
87342
87348
  program2.command("claim").description("Print the claim URL that keeps this computer's temporary (signed-out) projects").option("--json", "Print { claim_url, expires_at } as JSON").action((opts) => {
87343
87349
  const config2 = loadConfig();
87344
87350
  if (!config2?.temporary || !config2.claim_url) {
87345
- const message3 = config2?.token ? `This computer is signed in to an account, so there is nothing to claim: its projects are already yours (\`${cliInvocation()} projects\`).` : `This computer has no temporary workspace (nothing in ${cliConfigPathForDisplay()}). If you deployed signed out from another terminal, run \`${cliInvocation()} claim\` there; or run \`${cliInvocation()} deploy\` here to start one.`;
87351
+ const message3 = config2?.token ? `This terminal has no temporary workspace to claim. Run \`${cliInvocation()} projects\` to see the projects it can access.` : `This terminal has no temporary workspace. If you deployed signed out from another terminal, run \`${cliInvocation()} claim\` there. Run \`${cliInvocation()} deploy\` here to start one.`;
87346
87352
  if (opts.json)
87347
87353
  printJson({ ok: false, error: config2?.token ? "NOT_TEMPORARY" : "NO_TEMPORARY_WORKSPACE", message: message3 });
87348
87354
  else
@@ -87363,7 +87369,11 @@ function registerClaim(program2) {
87363
87369
  info(`Claim URL: ${teal(config2.claim_url)}`);
87364
87370
  if (config2.temp_expires_at)
87365
87371
  info(`Expires at: ${config2.temp_expires_at} (UTC)`);
87366
- info(`Open it in a browser and sign in (or create an account) to keep these projects. Choose "Save project and connect agent" to sign this CLI in as well; otherwise run \`${cliInvocation()} login\` here afterwards.`);
87372
+ info("Open it in a browser and sign in or create an account to keep these projects.");
87373
+ if (config2.claim_handoff?.handoff_id) {
87374
+ info('Choose "Save and connect agent" to connect this terminal to the claimed project only.');
87375
+ }
87376
+ info(`Run \`${cliInvocation()} login\` for account access.`);
87367
87377
  });
87368
87378
  }
87369
87379
  var init_claim = __esm({
@@ -87799,7 +87809,7 @@ function registerPreview(program2) {
87799
87809
  row.promotable ? "yes" : "no: production changed",
87800
87810
  row.this_folder ? "this folder" : ""
87801
87811
  ]));
87802
- console.log(dim("Each open preview holds a copy of production data until it is promoted, closed, or unused for 24 h (7 days at most)."));
87812
+ console.log(dim("Each open preview holds a copy of production data until it is promoted, closed, or expires."));
87803
87813
  console.log(dim(`Close one: ${cliInvocation()} preview close <preview_session_id>. Promote one: ${cliInvocation()} promote <preview_session_id> <preview_id>.`));
87804
87814
  } catch (err) {
87805
87815
  if (opts.json)
@@ -87877,9 +87887,9 @@ function registerPreview(program2) {
87877
87887
  previewToolFailed(err, opts.json, "PREVIEW_USER_REMOVE_FAILED", target);
87878
87888
  }
87879
87889
  });
87880
- preview.command("run-job <handler-path>").description("Run one handler path once in this folder's open preview, as one signed job delivery, and wait for its result (a scheduled task is a handler path plus a payload)").option("--payload <json>", "JSON payload the handler receives (default: none)").option("--no-wait", "Return as soon as the run is queued instead of waiting for its result").option("--timeout <seconds>", "How long to wait for the result (default 300; a preview run is capped at 270 s)").option("--project <id>", "Override project ID").option("--preview-session <id>", "Which preview (its preview_session_id); default: this folder's").option("--json", "Print the run (and its result) as JSON").addHelpText("after", `
87890
+ preview.command("run-job <handler-path>").description("Run one handler path once in this folder's open preview, as one signed job delivery, and wait for its result (a scheduled task is a handler path plus a payload)").option("--payload <json>", "JSON payload the handler receives (default: none)").option("--no-wait", "Return as soon as the run is queued instead of waiting for its result").option("--timeout <seconds>", "How long to wait for the result (default 300)").option("--project <id>", "Override project ID").option("--preview-session <id>", "Which preview (its preview_session_id); default: this folder's").option("--json", "Print the run (and its result) as JSON").addHelpText("after", `
87881
87891
  The run uses the preview's own code, data, files, users and mail; it has no signed-in user (like a scheduled
87882
- run in production), one attempt and at most 270 seconds. Nothing in your live app runs or changes.
87892
+ run in production). It runs once. Nothing in your live app runs or changes.
87883
87893
  To run a production schedule's handler and payload this way: ${cliInvocation()} cron run <name> --preview
87884
87894
  `).action(async (handlerPath, _opts, cmd) => {
87885
87895
  const opts = cmd.optsWithGlobals();
@@ -129846,7 +129856,7 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
129846
129856
  }
129847
129857
  await runTaskTool("tasks_update", args, opts.json, printTaskMutation);
129848
129858
  });
129849
- tasks.command("delete <task-ids...>").description("Delete a task that should never have existed; restorable for 30 days (board owner only)").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").requiredOption("--reason <text>", "Why this task should never have existed").option("--json", "Print the complete response as JSON").action(async (taskIds, opts) => {
129859
+ tasks.command("delete <task-ids...>").description("Delete a task that should never have existed (board owner only)").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").requiredOption("--reason <text>", "Why this task should never have existed").option("--json", "Print the complete response as JSON").action(async (taskIds, opts) => {
129850
129860
  if (taskIds.length > 200)
129851
129861
  throw new Error("At most 200 task IDs may be deleted per call.");
129852
129862
  await runTaskTool("tasks_delete", compactRecord([
@@ -129859,9 +129869,10 @@ Shared organization board (requires access): ${cliInvocation()} tasks list -p de
129859
129869
  printJson(value);
129860
129870
  return;
129861
129871
  }
129862
- const purgeAt = typeof data2.purge_at === "number" ? new Date(data2.purge_at).toISOString() : "in 30 days";
129863
129872
  console.log(`${teal(data2.id)} ${data2.already_deleted ? "was already deleted" : "deleted"}`);
129864
- console.log(dim(`Restorable until ${purgeAt}: ${cliInvocation()} tasks restore ${data2.id}`));
129873
+ const restore = `\`${cliInvocation()} tasks restore ${data2.id}\``;
129874
+ const deadline = typeof data2.purge_at === "number" ? ` until ${new Date(data2.purge_at).toISOString()}` : "";
129875
+ console.log(dim(`Restore${deadline} with ${restore}.`));
129865
129876
  });
129866
129877
  });
129867
129878
  tasks.command("restore <task-id>").description("Restore a deleted task with its comments and links (board owner only)").option("-p, --project <project>", "Project slug or ID; defaults to the linked project").option("--reason <text>", "Why it is being restored").option("--json", "Print the complete response as JSON").action(async (taskId, opts) => {
@@ -130144,7 +130155,7 @@ async function waitForChoices(client, repoName, quiet) {
130144
130155
  }
130145
130156
  await sleep2(2e3);
130146
130157
  }
130147
- throw new Error(`GitHub authorization was not completed within 5 minutes. Run \`${cliInvocation()} git connect\` again.`);
130158
+ throw new Error(`The wait for GitHub authorization ended. Run \`${cliInvocation()} git connect\` again.`);
130148
130159
  }
130149
130160
  async function chooseRepo(client, requestedRepo, quiet) {
130150
130161
  const app = await listInstallations(client);
@@ -130193,7 +130204,7 @@ async function waitForDeploy(client, projectId, commitSha) {
130193
130204
  }
130194
130205
  await sleep2(DEPLOY_POLL_MS);
130195
130206
  }
130196
- throw new Error(`Deploy of ${commitSha.slice(0, 7)} is still running after 10 minutes. Check the project logs.`);
130207
+ throw new Error(`The wait ended before deploy of ${commitSha.slice(0, 7)} finished. Check the project logs.`);
130197
130208
  }
130198
130209
  function urls(projectId, servingUrl) {
130199
130210
  return {
@@ -130815,7 +130826,7 @@ zone each trigger is stored in, and \`cron update --schedule\` keeps that zone u
130815
130826
  printTypedCronError(code, message3, opts.json, extra);
130816
130827
  }
130817
130828
  });
130818
- cron.command("runs <cron-id-or-name>").description("Show recent runs of a scheduled task, scheduled and manual, with its next run").option("-p, --project <project>", "Project slug or ID used to resolve a task name; defaults to the linked project").option("--limit <n>", "How many recent runs to show, 1-100 (default 20)").option("--wait-next", "Observe a natural scheduled occurrence after command start and wait for that job to finish").option("--timeout <seconds>", `With --wait-next, total observation time (default ${DEFAULT_WAIT_TIMEOUT_SECONDS}s)`).option("--json", "Print the trigger and its runs as JSON").addHelpText("after", '\nTRIGGER is "scheduled" for a run the schedule started (SCHEDULED FOR is the occurrence it\nserved) and "manual" for `cron run`. Times are UTC. A scheduled run is recorded shortly after\nits scheduled time, not exactly on it; until the schedule advances, the next run shows as\noverdue, and this command says whether a run for that occurrence appears in the recent\nhistory shown.\n\n--wait-next is read-only: it ignores manual runs and older scheduled slots, pins one job,\nand waits within --timeout. Changes to schedule settings or a disabled schedule stop the wait.\nThe observation uses at most --limit recent rows per read (default 100 while waiting).\nA timeout reports what was not observed; it does not mean the timer never fired.\nAn already-started login renewal finishes with its existing 10-second request budgets before\nthe command exits, so credential persistence can add grace beyond the observation deadline.\n').action(async (target, opts) => {
130829
+ cron.command("runs <cron-id-or-name>").description("Show recent runs of a scheduled task, scheduled and manual, with its next run").option("-p, --project <project>", "Project slug or ID used to resolve a task name; defaults to the linked project").option("--limit <n>", "How many recent runs to show, 1-100 (default 20)").option("--wait-next", "Observe a natural scheduled occurrence after command start and wait for that job to finish").option("--timeout <seconds>", `With --wait-next, total observation time (default ${DEFAULT_WAIT_TIMEOUT_SECONDS}s)`).option("--json", "Print the trigger and its runs as JSON").addHelpText("after", '\nTRIGGER is "scheduled" for a run the schedule started (SCHEDULED FOR is the occurrence it\nserved) and "manual" for `cron run`. Times are UTC. A scheduled run is recorded shortly after\nits scheduled time, not exactly on it; until the schedule advances, the next run shows as\noverdue, and this command says whether a run for that occurrence appears in the recent\nhistory shown.\n\n--wait-next is read-only: it ignores manual runs and older scheduled slots, pins one job,\nand waits within --timeout. Changes to schedule settings or a disabled schedule stop the wait.\nThe observation uses at most --limit recent rows per read (default 100 while waiting).\nA timeout reports what was not observed; it does not mean the timer never fired.\nIf a login renewal is already underway, it can finish after the observation deadline.\n').action(async (target, opts) => {
130819
130830
  try {
130820
130831
  const limit = parseRunsLimit(opts.limit);
130821
130832
  if (opts.timeout !== void 0 && !opts.waitNext)
@@ -131534,7 +131545,7 @@ function registerTestUsers(program2) {
131534
131545
  info(RETAINED_NOTE);
131535
131546
  if (failure) {
131536
131547
  fail2(opts, failure);
131537
- warn(`Prepared ${manifest.actors.length} of ${specs.length} actors; the ones created are recorded in ${TEST_STATE_DIR}/${MANIFEST_FILE}. Run \`somewhere test-users cleanup\` to remove them. If the platform may have created more than were returned, they expire 24 hours after creation.`);
131548
+ warn(`Prepared ${manifest.actors.length} of ${specs.length} actors; the ones created are recorded in ${TEST_STATE_DIR}/${MANIFEST_FILE}. Run \`somewhere test-users cleanup\` to remove them. The platform removes any remaining test users when they expire.`);
131538
131549
  } else {
131539
131550
  success(`Prepared ${manifest.actors.length} signed-in test user${manifest.actors.length === 1 ? "" : "s"} for ${target.origin}.`);
131540
131551
  }
@@ -132716,7 +132727,7 @@ async function freshCodes(run, address, mark2, what) {
132716
132727
  if (codes.length)
132717
132728
  return codes;
132718
132729
  if (Date.now() > deadline)
132719
- throw new Error(`${what}: no code reached the project's test inbox for ${address} within 25 s. The test inbox holds at most a limited number of messages for 7 days; when it is full, new mail is not stored.`);
132730
+ throw new Error(`${what}: no code reached the project's test inbox for ${address}. Check whether the app sent the message, then try again.`);
132720
132731
  }
132721
132732
  }
132722
132733
  async function registerMailedCodes(run, address, submitted) {