@somewhere-cloud/cli 0.38.128 → 0.38.130

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,13 @@
1
+ ## 0.38.130
2
+
3
+ - Signed out, a command that needs an account also says that `somewhere deploy` puts a folder live without one, with a claim link. `somewhere deploy --help` says the same under "No project yet?".
4
+
5
+ ## 0.38.129
6
+
7
+ - `somewhere test` runs the starter's full check on an unclaimed app: sign-up, sign-in and the privacy check.
8
+ - A skipped check no longer reads as a pass. The summary names each skipped check and why, and the run exits non-zero.
9
+ - Installing test tools such as Playwright no longer requires a redeploy before `somewhere test`. A changed package.json or lockfile prints a note instead.
10
+
1
11
  ## 0.38.128
2
12
 
3
13
  - A claim connection can work on saved apps and create new ones. It can work on other existing apps when the owner selects that option.
@@ -8642,7 +8642,7 @@ function getToken() {
8642
8642
  process.exit(1);
8643
8643
  }
8644
8644
  if (!config2?.token) {
8645
- error(`Not logged in. Run: ${cliInvocation()} login (it prints a code to approve in any browser). If you deployed signed out from another terminal on this computer, run this command there: its temporary credential is in that terminal's ~/.somewhere.`);
8645
+ error(`Not logged in. To put a folder live without an account, run ${cliInvocation()} deploy there: it creates a temporary app and prints its live URL and claim link. To sign in, run ${cliInvocation()} login (it prints a code to approve in any browser). If you deployed signed out from another terminal on this computer, run this command there: its temporary credential is in that terminal's ~/.somewhere.`);
8646
8646
  process.exit(1);
8647
8647
  }
8648
8648
  return config2.token;
@@ -38367,7 +38367,6 @@ After every deploy, somewhere verify checks the page loads and looks right at de
38367
38367
  test to write. Journeys, several users and access rules go in tests/*.mjs with somewhere test.
38368
38368
  ${FIRST_CLI_PERMISSION}
38369
38369
  Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
38370
- Tests that need the email inbox work after you claim the app.
38371
38370
  It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first. Start from
38372
38371
  tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
38373
38372
  Keep each run short:
@@ -38780,8 +38779,8 @@ var init_skills_pack_generated = __esm({
38780
38779
  BUNDLED_SKILLS_PACK = {
38781
38780
  "schema": 1,
38782
38781
  "name": "somewhere-skills",
38783
- "version": "1+27a07555a794",
38784
- "sha256": "27a07555a79411e5bb286b5fbd2162f002219e133d244ed9984ba0ee77ecc181",
38782
+ "version": "1+8aec0eae1728",
38783
+ "sha256": "8aec0eae1728bbe4d51fb8de104d1547e79c45a47800de7f4d9750d81f9e72c6",
38785
38784
  "files": [
38786
38785
  {
38787
38786
  "path": "adopt/SKILL.md",
@@ -38790,8 +38789,8 @@ var init_skills_pack_generated = __esm({
38790
38789
  },
38791
38790
  {
38792
38791
  "path": "deploy-verify-loop/SKILL.md",
38793
- "sha256": "a4c44a9c77503863c3b6b7da32552c58872c36761198f42b6e6f507692a979bd",
38794
- "content": '---\nname: deploy-verify-loop\ndescription: After edits, typecheck and run focused tests; verify the final deployed journey and rerun after relevant fixes.\n---\n\n# Deploy, verify, read the failure\n\n## The loop\n\n```bash\nsomewhere typecheck\nsomewhere deploy\n```\n\nDon\'t bundle the source yourself; the platform runs the frontend build.\n\nRun `somewhere claim` and open its link to keep a temporary app. Tests that need the email inbox work after you claim the app.\n\n```bash\nsomewhere deploy-check --run /api/hello -X POST -d \'{"name":"Ada"}\'\n```\n\n| Step | Command | What it tells you |\n|---|---|---|\n| Verify | `somewhere verify [--flow flow.json]` | Runs the live app at desktop and phone sizes: named steps, console/network health, both screenshots. |\n| Inspect | `somewhere browser [target]` | One page: screenshot, snapshot, DOM, network, or an evaluated expression. |\n| Diagnose | `somewhere logs --tail 10`, `somewhere errors` | Recent function output, then failures split into refused and exception. `errors` also works on a temporary project. |\n\n## A flow for verify --flow\n\n```json\n{ "actions": [{ "fill": "#title", "value": "Verify entry" }, { "fill": "#from_email", "value": "v@example.com" },\n { "click": "#send" }, { "expect": { "selector": "#status", "text": "Received" } }], "viewports": ["desktop"] }\n```\n\n`passed` requires successful steps and request expectations, no page errors, and no unexpected failed requests. It can be false even when every step succeeded.\n\n## Failure 1: the live site still shows the old version\n\nBrowser or CDN cache. Hard-reload (Cmd-Shift-R), or check with `curl -sI https://{subdomain}.somewhere.site`.\n\n## Failure 2: a route fails\n\nShow recent failures with a `kind` column: **refused** for a 4xx your own handler returned on purpose, **exception** for an uncaught throw or a 5xx.\n\nThe `stack` field is the single most useful field for debugging \u2014 it tells you the exact file + line in your code where the throw originated.\n\n| `somewhere rollback [project]` | `-y, --yes`, `--json` | Select the previous retained production release. By default this changes code without restoring data. |\n\nSources (`somewhere docs <topic>`): browser, cli, common-mistakes, deploy, getting-started, recipe-signed-in-app, troubleshooting.\n'
38792
+ "sha256": "b394c2944cd64a48517dff6c80917b0e9332758f429e96600587ca91e4e951f8",
38793
+ "content": '---\nname: deploy-verify-loop\ndescription: After edits, typecheck and run focused tests; verify the final deployed journey and rerun after relevant fixes.\n---\n\n# Deploy, verify, read the failure\n\n## The loop\n\nBefore your first Somewhere command for a user, ask their permission and say where it will run, either as an npm package in your own cloud workspace (nothing installs on their computer) or as an npm package on their machine. Approval in their first message covers this.\n\n```bash\nsomewhere typecheck\nsomewhere deploy\n```\n\nDon\'t bundle the source yourself; the platform runs the frontend build.\n\nRun `somewhere claim` and open its link to keep a temporary app.\n\n```bash\nsomewhere deploy-check --run /api/hello -X POST -d \'{"name":"Ada"}\'\n```\n\n| Step | Command | What it tells you |\n|---|---|---|\n| Verify | `somewhere verify [--flow flow.json]` | Runs the live app at desktop and phone sizes: named steps, console/network health, both screenshots. |\n| Inspect | `somewhere browser [target]` | One page: screenshot, snapshot, DOM, network, or an evaluated expression. |\n| Diagnose | `somewhere logs --tail 10`, `somewhere errors` | Recent function output, then failures split into refused and exception. `errors` also works on a temporary project. |\n\n## A flow for verify --flow\n\n```json\n{ "actions": [{ "fill": "#title", "value": "Verify entry" }, { "fill": "#from_email", "value": "v@example.com" },\n { "click": "#send" }, { "expect": { "selector": "#status", "text": "Received" } }], "viewports": ["desktop"] }\n```\n\n`passed` requires successful steps and request expectations, no page errors, and no unexpected failed requests. It can be false even when every step succeeded.\n\n## Failure 1: the live site still shows the old version\n\nBrowser or CDN cache. Hard-reload (Cmd-Shift-R), or check with `curl -sI https://{subdomain}.somewhere.site`.\n\n## Failure 2: a route fails\n\nShow recent failures with a `kind` column: **refused** for a 4xx your own handler returned on purpose, **exception** for an uncaught throw or a 5xx.\n\nThe `stack` field is the single most useful field for debugging \u2014 it tells you the exact file + line in your code where the throw originated.\n\n| `somewhere rollback [project]` | `-y, --yes`, `--json` | Select the previous retained production release. By default this changes code without restoring data. |\n\nSources (`somewhere docs <topic>`): browser, cli, common-mistakes, deploy, getting-started, recipe-signed-in-app, troubleshooting.\n'
38795
38794
  },
38796
38795
  {
38797
38796
  "path": "schema-changes/SKILL.md",
@@ -38815,8 +38814,8 @@ var init_skills_pack_generated = __esm({
38815
38814
  },
38816
38815
  {
38817
38816
  "path": "email-and-test-inbox/SKILL.md",
38818
- "sha256": "27174b0d8109fa3089a53082192502ac3992e2c933d1a61e0fbdee58c9168b78",
38819
- "content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts \u2014 call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email the project's owner and users who have verified their email address with this project; a pending sign-in or an unverified sign-up does not count.\n\n## Test inbox\n\nAddresses `<anything>@<project-subdomain>.test.somewhere.site` never reach a real mailbox. Read it with `somewhere email test-inbox <address>` (or `sw.email.inbox(address)`) \u2192 `{ address, messages: [{ id, to, subject, text, html, magic_link, verification_code, created_at }] }`. `verification_code` is the code an auth message carries (the 6-digit email verification or sign-in code), or `null`.\n\n## Failure 1: MANAGED_SENDER_RECIPIENT_NOT_A_USER\n\nOther recipients return `MANAGED_SENDER_RECIPIENT_NOT_A_USER`; verify your own sender domain for outreach.\n\n## Failure 2: gating on status 'sent'\n\nDo not gate follow-up work on `status === 'sent'` alone: a captured test send and a replay of a delivered message are both successful sends.\n\nSources (`somewhere docs <topic>`): sw.email.\n"
38817
+ "sha256": "9406a949a35f929f6b90616d757670f81eb85333f13c7d5b83cf44aed2b8174a",
38818
+ "content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts \u2014 call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email the project's owner and app users who have verified their email address with this project and signed in at least once; a pending sign-in or an unverified sign-up does not count. The platform adds a one-line unsubscribe footer and one-click unsubscribe headers; after a user unsubscribes, sends to them return `RECIPIENT_UNSUBSCRIBED`. Replies to the app's address are recorded in your project mailbox; read them with `sw.mail.project.list()`.\n\n## Test inbox\n\nAddresses `<anything>@<project-subdomain>.test.somewhere.site` never reach a real mailbox. Read it with `somewhere email test-inbox <address>` (or `sw.email.inbox(address)`) \u2192 `{ address, messages: [{ id, to, subject, text, html, magic_link, verification_code, created_at }] }`. `verification_code` is the code an auth message carries (the 6-digit email verification or sign-in code), or `null`.\n\n## Failure 1: MANAGED_SENDER_RECIPIENT_NOT_A_USER\n\nOther recipients return `MANAGED_SENDER_RECIPIENT_NOT_A_USER`; verify your own sender domain for outreach.\n\n## Failure 2: gating on status 'sent'\n\nDo not gate follow-up work on `status === 'sent'` alone: a captured test send and a replay of a delivered message are both successful sends.\n\nSources (`somewhere docs <topic>`): sw.email.\n"
38820
38819
  },
38821
38820
  {
38822
38821
  "path": "design/SKILL.md",
@@ -42914,7 +42913,6 @@ function createFeatureTemplate(selection, options2) {
42914
42913
  { path: "AGENTS.md", content: INIT_AGENTS_MD.replace(/## Getting started[^]*?After edits:/, `## Testing
42915
42914
  ${FIRST_CLI_PERMISSION}
42916
42915
  Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
42917
- Tests that need the email inbox work after you claim the app.
42918
42916
  It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first.
42919
42917
  Start from tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
42920
42918
  Helpers from @somewhere-cloud/cli/script (import or require): signUp/signIn/signOut through your form,
@@ -77361,70 +77359,6 @@ var init_preview_record = __esm({
77361
77359
  }
77362
77360
  });
77363
77361
 
77364
- // dist/lib/test-report.js
77365
- function describeReport(groups, options2 = {}) {
77366
- const many = groups.length > 1;
77367
- const checks = groups.flatMap((group) => group.checks.map((check2) => ({ ...check2, script: many && check2.name !== group.script ? group.script : null })));
77368
- const note = /* @__PURE__ */ __name((script, extra) => {
77369
- const parts = [script, extra].filter(Boolean);
77370
- return parts.length ? ` (${parts.join(", ")})` : "";
77371
- }, "note");
77372
- const failed = checks.filter((check2) => !check2.ok && !check2.skipped);
77373
- const notRun = checks.filter((check2) => check2.skipped === "after-failure");
77374
- const skipped = checks.filter((check2) => check2.skipped && check2.skipped !== "after-failure");
77375
- const lines = [
77376
- ...failed.flatMap((check2) => {
77377
- const name = `FAIL ${check2.name}${note(check2.script)}`;
77378
- const failure = check2.failure;
77379
- if (!failure)
77380
- return [`${name}: ${firstLine(check2.error) || "failed"}`];
77381
- return [
77382
- name,
77383
- ` Expected: ${failure.expected}`,
77384
- ` Happened: ${failure.happened}`,
77385
- ` Step: ${failure.step}`,
77386
- ...failure.evidence ? [` Evidence: ${failure.evidence}`] : []
77387
- ];
77388
- }),
77389
- ...checks.filter((check2) => check2.ok).map((check2) => `PASS ${check2.name}${note(check2.script)}`),
77390
- ...skipped.map((check2) => `SKIPPED ${check2.name}${note(check2.script)}: ${firstLine(check2.error)}`),
77391
- ...notRun.map((check2) => `NOT RUN ${check2.name}${note(check2.script, "after the first failure")}`)
77392
- ];
77393
- const scripts = plural(groups.length, "script");
77394
- if (!checks.length)
77395
- lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
77396
- else if (failed.length) {
77397
- const omitted = [skipped.length && `${skipped.length} skipped`, notRun.length && `${notRun.length} not run`].filter(Boolean);
77398
- lines.push(`FAILED: ${failed.length} of ${plural(checks.length, "check")} in ${scripts}${omitted.length ? ` (${omitted.join(", ")})` : ""}`);
77399
- } else if (skipped.length)
77400
- lines.push(`${checks.length - skipped.length} passed, ${skipped.length} skipped in ${scripts}`);
77401
- else
77402
- lines.push(`PASSED: ${plural(checks.length, "check")} in ${scripts}`);
77403
- if (!checks.length)
77404
- lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
77405
- else if (failed.length)
77406
- lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
77407
- if (skipped.some((check2) => check2.skipped === "needs-claim"))
77408
- lines.push(TEST_INBOX_CLAIM_NEXT);
77409
- const files = [...new Set(groups.map((group) => group.resultFile).filter((file2) => Boolean(file2)))];
77410
- if (files.length && (failed.length || !checks.length || options2.verbose))
77411
- lines.push(`Full result: ${files.join(", ")}`);
77412
- return lines;
77413
- }
77414
- var DEPLOY_COMMAND, TEST_COMMAND, TEST_INBOX_CLAIM_REASON, TEST_INBOX_CLAIM_NEXT, firstLine, plural;
77415
- var init_test_report = __esm({
77416
- "dist/lib/test-report.js"() {
77417
- "use strict";
77418
- DEPLOY_COMMAND = "npx @somewhere-cloud/cli deploy";
77419
- TEST_COMMAND = "npx @somewhere-cloud/cli test";
77420
- TEST_INBOX_CLAIM_REASON = "needs a claimed app: run somewhere claim";
77421
- TEST_INBOX_CLAIM_NEXT = "Next: run somewhere claim, open its link, then run somewhere test again.";
77422
- firstLine = /* @__PURE__ */ __name((text) => (text ?? "").split("\n").map((line) => line.trim()).find((line) => line && !/^(?:hint:|Usage details:|Platform bug reports:)/i.test(line)) ?? "", "firstLine");
77423
- plural = /* @__PURE__ */ __name((n, word) => `${n} ${word}${n === 1 ? "" : "s"}`, "plural");
77424
- __name(describeReport, "describeReport");
77425
- }
77426
- });
77427
-
77428
77362
  // dist/lib/test-diagnostics.js
77429
77363
  function rememberSecrets(...values) {
77430
77364
  for (const value of values)
@@ -77536,8 +77470,6 @@ function productionControl(client, target) {
77536
77470
  projectId,
77537
77471
  target,
77538
77472
  async inbox(address, wait) {
77539
- if (loadConfig()?.temporary)
77540
- throw new TestInboxNeedsClaim();
77541
77473
  const body = await client.call("GET", "/email/test-inbox", void 0, { project_id: projectId, address, limit: 20, ...wait ? { wait_ms: wait.ms ?? 1e4, since: wait.since } : {} });
77542
77474
  return messagesAfter(body.messages, address, 0);
77543
77475
  },
@@ -77688,7 +77620,7 @@ async function deletePreviewManagedUser(tool, id) {
77688
77620
  return isDeadPreviewCredential(error3) ? "the preview is closed, promoted or expired, or its credential was revoked" : String(error3 instanceof Error ? error3.message : error3).slice(0, 200);
77689
77621
  }
77690
77622
  }
77691
- var TestInboxNeedsClaim, PREVIEW_CLOSED_MESSAGE, PreviewRunError;
77623
+ var PREVIEW_CLOSED_MESSAGE, PreviewRunError;
77692
77624
  var init_test_control = __esm({
77693
77625
  "dist/lib/test-control.js"() {
77694
77626
  "use strict";
@@ -77699,16 +77631,7 @@ var init_test_control = __esm({
77699
77631
  init_test_target();
77700
77632
  init_test_identities();
77701
77633
  init_form_accounts();
77702
- init_test_report();
77703
77634
  init_test_diagnostics();
77704
- TestInboxNeedsClaim = class extends Error {
77705
- static {
77706
- __name(this, "TestInboxNeedsClaim");
77707
- }
77708
- constructor() {
77709
- super(TEST_INBOX_CLAIM_REASON);
77710
- }
77711
- };
77712
77635
  __name(productionControl, "productionControl");
77713
77636
  __name(openProductionControl, "openProductionControl");
77714
77637
  PREVIEW_CLOSED_MESSAGE = "The preview is closed, promoted or expired, or its credential was revoked. Open or continue one with `somewhere preview`, then run the tests again.";
@@ -77928,8 +77851,6 @@ function prepareDeployTests(start) {
77928
77851
  async function runDeployTests(input) {
77929
77852
  const release2 = input.release ?? null;
77930
77853
  const notRun = /* @__PURE__ */ __name((reason) => ({ status: "not_run", release: release2, reason }), "notRun");
77931
- if (input.temporary)
77932
- return notRun("a temporary project cannot run tests; claim it, link this folder and run somewhere test");
77933
77854
  if (!input.projectId || !input.release)
77934
77855
  return notRun("the deploy did not name its project and release");
77935
77856
  if (input.renderPending) {
@@ -77966,6 +77887,8 @@ function formatDeployTestsLine(tests) {
77966
77887
  const skipped = r?.skipped ? `, ${r.skipped} skipped (a skipped test proves nothing)` : "";
77967
77888
  if (tests.status === "passed")
77968
77889
  return `The deploy is live and its tests passed: ${r?.passed ?? 0} passed${skipped} on ${tests.release}.`;
77890
+ if (tests.status === "failed" && !r?.failed && r?.skipped && !r?.setupErrors && !tests.reason)
77891
+ return `The deploy is live. Its tests did NOT all run: ${r.skipped} skipped (a skipped test proves nothing), ${r.passed ?? 0} passed on ${tests.release}. Each SKIPPED line above says why.`;
77969
77892
  if (tests.status === "failed")
77970
77893
  return `The deploy is live. Its tests FAILED: ${r?.failed ?? 0} failed, ${r?.passed ?? 0} passed${skipped}${r?.setupErrors ? `, ${r.setupErrors} setup errors` : ""}${tests.reason ? ` (${tests.reason})` : ""} on ${tests.release}. After fixing a test: somewhere test --failed. After fixing the app: somewhere deploy --test.`;
77971
77894
  return `The deploy is live. Its tests did NOT run: ${tests.reason}.`;
@@ -77984,19 +77907,19 @@ var init_deploy_tests = __esm({
77984
77907
  });
77985
77908
 
77986
77909
  // dist/lib/surface-counts.js
77987
- function plural2(count2, one, many) {
77910
+ function plural(count2, one, many) {
77988
77911
  return `${count2} ${count2 === 1 ? one : many}`;
77989
77912
  }
77990
77913
  function formatPublishSurface(counts) {
77991
77914
  const parts = [];
77992
77915
  if (counts.staticFiles !== null) {
77993
- parts.push(plural2(counts.staticFiles, "static file", "static files"));
77916
+ parts.push(plural(counts.staticFiles, "static file", "static files"));
77994
77917
  }
77995
77918
  if (counts.functions === "some") {
77996
77919
  parts.push("functions");
77997
77920
  } else if (typeof counts.functions === "number") {
77998
77921
  if (counts.functions > 0 || parts.length === 0) {
77999
- parts.push(plural2(counts.functions, "function", "functions"));
77922
+ parts.push(plural(counts.functions, "function", "functions"));
78000
77923
  }
78001
77924
  }
78002
77925
  if (parts.length === 0)
@@ -78039,7 +77962,7 @@ var init_surface_counts = __esm({
78039
77962
  "dist/lib/surface-counts.js"() {
78040
77963
  "use strict";
78041
77964
  init_cli_invocation();
78042
- __name(plural2, "plural");
77965
+ __name(plural, "plural");
78043
77966
  __name(formatPublishSurface, "formatPublishSurface");
78044
77967
  __name(countPublishSurface, "countPublishSurface");
78045
77968
  __name(countFunctionRoutes, "countFunctionRoutes");
@@ -81994,10 +81917,10 @@ function formatTempExpiry(expiresAt, ttlSeconds, nowMs = Date.now()) {
81994
81917
  if (remainingMs <= 0)
81995
81918
  return "Temporary app. It has expired.";
81996
81919
  const minutes = Math.ceil(remainingMs / 6e4);
81997
- const remaining = minutes >= 60 ? plural3(Math.round(minutes / 60), "hour") : plural3(minutes < 5 ? minutes : Math.min(55, Math.round(minutes / 5) * 5), "minute");
81920
+ const remaining = minutes >= 60 ? plural2(Math.round(minutes / 60), "hour") : plural2(minutes < 5 ? minutes : Math.min(55, Math.round(minutes / 5) * 5), "minute");
81998
81921
  return `Temporary app. Expires in about ${remaining}.`;
81999
81922
  }
82000
- function plural3(count2, singular, pluralWord = `${singular}s`) {
81923
+ function plural2(count2, singular, pluralWord = `${singular}s`) {
82001
81924
  return `${count2} ${count2 === 1 ? singular : pluralWord}`;
82002
81925
  }
82003
81926
  function formatElapsed(at2, nowMs = Date.now()) {
@@ -82010,15 +81933,15 @@ function formatElapsed(at2, nowMs = Date.now()) {
82010
81933
  if (minutes < 1)
82011
81934
  return " just now";
82012
81935
  if (minutes < 60)
82013
- return ` ${plural3(minutes, "minute")} ago`;
81936
+ return ` ${plural2(minutes, "minute")} ago`;
82014
81937
  const hours = Math.floor(minutes / 60);
82015
81938
  if (hours < 24)
82016
- return ` ${plural3(hours, "hour")} ago`;
81939
+ return ` ${plural2(hours, "hour")} ago`;
82017
81940
  const days = Math.floor(hours / 24);
82018
81941
  if (days < 30)
82019
- return ` ${plural3(days, "day")} ago`;
81942
+ return ` ${plural2(days, "day")} ago`;
82020
81943
  const months = Math.floor(days / 30);
82021
- return ` ${plural3(months, "month")} ago`;
81944
+ return ` ${plural2(months, "month")} ago`;
82022
81945
  }
82023
81946
  function formatChangeSource(source) {
82024
81947
  const normalized = source?.trim().toLowerCase();
@@ -82061,7 +81984,7 @@ function formatStaleBaseExplanation(details, nowMs = Date.now()) {
82061
81984
  const elapsed = formatElapsed(details.last_change_at, nowMs);
82062
81985
  const fileList = files.slice(0, 10).join(", ");
82063
81986
  const more = files.length > 10 ? `, and ${files.length - 10} more` : "";
82064
- const changeSummary = files.length > 0 ? `${plural3(files.length, "file")} edited${source}${elapsed}: ${fileList}${more}` : `remote edits${source}${elapsed}`;
81987
+ const changeSummary = files.length > 0 ? `${plural2(files.length, "file")} edited${source}${elapsed}: ${fileList}${more}` : `remote edits${source}${elapsed}`;
82065
81988
  const versionSummary = details.current_version !== void 0 && details.base_version !== void 0 ? `Remote is now v${details.current_version}; this machine last deployed v${details.base_version}.` : null;
82066
81989
  return [
82067
81990
  `This project changed since your last deploy from this machine \u2014 ${changeSummary}. Your deploy was NOT applied.`,
@@ -82245,7 +82168,8 @@ Functions missing from the directory: a full \`${cliInvocation()} deploy\` REMOV
82245
82168
  are not in this directory (each one is named in the output). \`--scope functions\` keeps them unless
82246
82169
  --replace-functions. \`${cliInvocation()} promote\` is the opposite: it keeps them unless --prune.
82247
82170
 
82248
- No project yet? Signed in, deploy never creates one on its own:
82171
+ No project yet? Signed out, deploy creates a temporary app and prints its claim link; no other step.
82172
+ Signed in, deploy never creates one on its own:
82249
82173
  ${cliInvocation()} init --bare --name <name> create a project in your account and link this folder
82250
82174
  ${cliInvocation()} deploy then deploy it
82251
82175
  Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cliInvocation()} projects\`), or \`--project <ref>\` here.
@@ -82810,7 +82734,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82810
82734
  return { status: "not_run", release: release2, reason: "functions failed to deploy" };
82811
82735
  if (verificationFailed)
82812
82736
  return { status: "not_run", release: release2, reason: "the deploy verification did not pass" };
82813
- return runDeployTests({ client, root: deployStateEntry?.dir ?? targetDir, projectId: result.project_id ?? projectId ?? void 0, temporary: Boolean(tempSession), json: Boolean(opts.json), release: release2 ?? void 0, renderPending: postLive.kind === "timeout", prepared: prepareDeployTests(() => prepareRunner(deployStateEntry?.dir ?? targetDir)) });
82737
+ return runDeployTests({ client, root: deployStateEntry?.dir ?? targetDir, projectId: result.project_id ?? projectId ?? void 0, json: Boolean(opts.json), release: release2 ?? void 0, renderPending: postLive.kind === "timeout", prepared: prepareDeployTests(() => prepareRunner(deployStateEntry?.dir ?? targetDir)) });
82814
82738
  }, "runReleaseTests");
82815
82739
  const verificationNextSteps = besideRealLogin ? [
82816
82740
  "Inspect the live URL; keep this project and its claim URL.",
@@ -83449,7 +83373,7 @@ var init_deploy = __esm({
83449
83373
  __name(randomSuffix, "randomSuffix");
83450
83374
  __name(deriveNewProjectName, "deriveNewProjectName");
83451
83375
  __name(formatTempExpiry, "formatTempExpiry");
83452
- __name(plural3, "plural");
83376
+ __name(plural2, "plural");
83453
83377
  __name(formatElapsed, "formatElapsed");
83454
83378
  __name(formatChangeSource, "formatChangeSource");
83455
83379
  __name(readString, "readString");
@@ -131227,6 +131151,66 @@ var init_reference_check_note = __esm({
131227
131151
  }
131228
131152
  });
131229
131153
 
131154
+ // dist/lib/test-report.js
131155
+ function describeReport(groups, options2 = {}) {
131156
+ const many = groups.length > 1;
131157
+ const checks = groups.flatMap((group) => group.checks.map((check2) => ({ ...check2, script: many && check2.name !== group.script ? group.script : null })));
131158
+ const note = /* @__PURE__ */ __name((script, extra) => {
131159
+ const parts = [script, extra].filter(Boolean);
131160
+ return parts.length ? ` (${parts.join(", ")})` : "";
131161
+ }, "note");
131162
+ const failed = checks.filter((check2) => !check2.ok && !check2.skipped);
131163
+ const notRun = checks.filter((check2) => check2.skipped === "after-failure");
131164
+ const skipped = checks.filter((check2) => check2.skipped && check2.skipped !== "after-failure");
131165
+ const lines = [
131166
+ ...failed.flatMap((check2) => {
131167
+ const name = `FAIL ${check2.name}${note(check2.script)}`;
131168
+ const failure = check2.failure;
131169
+ if (!failure)
131170
+ return [`${name}: ${firstLine(check2.error) || "failed"}`];
131171
+ return [
131172
+ name,
131173
+ ` Expected: ${failure.expected}`,
131174
+ ` Happened: ${failure.happened}`,
131175
+ ` Step: ${failure.step}`,
131176
+ ...failure.evidence ? [` Evidence: ${failure.evidence}`] : []
131177
+ ];
131178
+ }),
131179
+ ...checks.filter((check2) => check2.ok).map((check2) => `PASS ${check2.name}${note(check2.script)}`),
131180
+ ...skipped.map((check2) => `SKIPPED ${check2.name}${note(check2.script)}: ${firstLine(check2.error)}`),
131181
+ ...notRun.map((check2) => `NOT RUN ${check2.name}${note(check2.script, "after the first failure")}`)
131182
+ ];
131183
+ const scripts = plural3(groups.length, "script");
131184
+ if (!checks.length)
131185
+ lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
131186
+ else if (failed.length) {
131187
+ const omitted = [skipped.length && `${skipped.length} skipped`, notRun.length && `${notRun.length} not run`].filter(Boolean);
131188
+ lines.push(`FAILED: ${failed.length} of ${plural3(checks.length, "check")} in ${scripts}${omitted.length ? ` (${omitted.join(", ")})` : ""}`);
131189
+ } else if (skipped.length)
131190
+ lines.push(`NOT ALL CHECKED: ${checks.length - skipped.length} passed, ${skipped.length} skipped in ${scripts}. A skipped check proves nothing: ${skipped.map((check2) => `\u201C${check2.name}\u201D (${firstLine(check2.error).replace(/\.$/, "") || "skipped"})`).join("; ")}.`);
131191
+ else
131192
+ lines.push(`PASSED: ${plural3(checks.length, "check")} in ${scripts}`);
131193
+ if (!checks.length)
131194
+ lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
131195
+ else if (failed.length)
131196
+ lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
131197
+ const files = [...new Set(groups.map((group) => group.resultFile).filter((file2) => Boolean(file2)))];
131198
+ if (files.length && (failed.length || !checks.length || options2.verbose))
131199
+ lines.push(`Full result: ${files.join(", ")}`);
131200
+ return lines;
131201
+ }
131202
+ var DEPLOY_COMMAND, TEST_COMMAND, firstLine, plural3;
131203
+ var init_test_report = __esm({
131204
+ "dist/lib/test-report.js"() {
131205
+ "use strict";
131206
+ DEPLOY_COMMAND = "npx @somewhere-cloud/cli deploy";
131207
+ TEST_COMMAND = "npx @somewhere-cloud/cli test";
131208
+ firstLine = /* @__PURE__ */ __name((text) => (text ?? "").split("\n").map((line) => line.trim()).find((line) => line && !/^(?:hint:|Usage details:|Platform bug reports:)/i.test(line)) ?? "", "firstLine");
131209
+ plural3 = /* @__PURE__ */ __name((n, word) => `${n} ${word}${n === 1 ? "" : "s"}`, "plural");
131210
+ __name(describeReport, "describeReport");
131211
+ }
131212
+ });
131213
+
131230
131214
  // dist/lib/test-scripts.js
131231
131215
  import { createRequire as createRequire8 } from "node:module";
131232
131216
  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";
@@ -132480,7 +132464,6 @@ var init_test_reporter = __esm({
132480
132464
  init_test_control();
132481
132465
  init_test_identities();
132482
132466
  init_test_diagnostics();
132483
- init_test_report();
132484
132467
  init_test_timeline();
132485
132468
  markProcessStart("playwright");
132486
132469
  firstLine2 = /* @__PURE__ */ __name((message3) => message3.replace(/^[^:\n]+:\d+: /, "").split("\n").find((line) => line.trim())?.trim().slice(0, 240) ?? "", "firstLine");
@@ -132517,11 +132500,11 @@ var init_test_reporter = __esm({
132517
132500
  return location2 ? describeError({ message: "", location: location2 }).replace(/: $/, "") + ": " + message3 : message3;
132518
132501
  }) : result.errors.map((error3) => describeError(error3));
132519
132502
  const file2 = relative13(process.cwd(), test2.location.file);
132520
- const claimSkip = result.status === "skipped" && result.annotations.some(({ type, description }) => type === "skip" && description === TEST_INBOX_CLAIM_REASON);
132521
- const entry = { ...details, ...claimSkip ? { skipReason: TEST_INBOX_CLAIM_REASON } : {}, status: result.status, outcome: test2.outcome(), title: scrub(details.title).slice(0, 200), errors, step: result.steps.find((step2) => step2.error)?.category ?? "test body", file: file2, line: test2.location.line };
132503
+ const skipReason = result.status === "skipped" ? scrub(result.annotations.find(({ type, description }) => type === "skip" && description)?.description ?? "no reason given").slice(0, 200) : void 0;
132504
+ const entry = { ...details, ...skipReason ? { skipReason } : {}, status: result.status, outcome: test2.outcome(), title: scrub(details.title).slice(0, 200), errors, step: result.steps.find((step2) => step2.error)?.category ?? "test body", file: file2, line: test2.location.line };
132522
132505
  this.entries.push(entry);
132523
132506
  if (process.env.SW_TEST_JSON !== "true") {
132524
- console.log(claimSkip ? `SKIPPED ${entry.title}: ${TEST_INBOX_CLAIM_REASON}` : `${result.status}: ${entry.title}`);
132507
+ console.log(skipReason ? `SKIPPED ${entry.title}: ${skipReason}` : `${result.status}: ${entry.title}`);
132525
132508
  for (const note of entry.notes ?? [])
132526
132509
  console.log(` note: ${scrub(note)}`);
132527
132510
  if (result.status !== "passed" && result.status !== "skipped")
@@ -132540,7 +132523,6 @@ ${entry.errors.map((error3) => " " + error3.replaceAll("\n", "\n ")).join("\n"
132540
132523
  async onEnd(result) {
132541
132524
  const passed = this.entries.filter((entry) => entry.status === "passed" && entry.outcome === "expected").length;
132542
132525
  const skipped = this.entries.filter((entry) => entry.status === "skipped").length;
132543
- const needsClaim = this.entries.some((entry) => entry.skipReason === TEST_INBOX_CLAIM_REASON);
132544
132526
  const expectedFailures = this.entries.filter((entry) => entry.status === "failed" && entry.outcome === "expected").length;
132545
132527
  const failed = this.entries.filter((entry) => entry.outcome === "unexpected").length;
132546
132528
  const startRelease = process.env.SW_TEST_RELEASE;
@@ -132608,12 +132590,10 @@ ${entry.errors.map((error3) => " " + error3.replaceAll("\n", "\n ")).join("\n"
132608
132590
  if (versionLost) {
132609
132591
  console.log(preview ? "The preview changed or closed during this run. Save it again with `somewhere preview` (or open a new one if it closed), then run all the tests again: somewhere test --preview" : "The live release changed during this run. Run all the tests again: somewhere test");
132610
132592
  }
132611
- if (needsClaim)
132612
- console.log(TEST_INBOX_CLAIM_NEXT);
132613
132593
  if (skipped)
132614
- console.log(`${skipped} skipped: a skipped test proves nothing until it runs.`);
132594
+ console.log(`NOT ALL RAN: ${skipped} skipped (each SKIPPED line above says why). A skipped test proves nothing until it runs.`);
132615
132595
  }
132616
- const status = result.status === "passed" && failed === 0 && this.errors === 0 && (passed > 0 || needsClaim) ? "passed" : "failed";
132596
+ const status = result.status === "passed" && failed === 0 && this.errors === 0 && skipped === 0 && passed > 0 ? "passed" : "failed";
132617
132597
  if (status === "passed" && passed > 0 && process.env.SW_TEST_JSON !== "true")
132618
132598
  console.log("The checks you wrote passed; say which requirements they do not cover.");
132619
132599
  return { status };
@@ -132720,7 +132700,7 @@ async function step(page, name, work, beforeReport) {
132720
132700
  } catch (error3) {
132721
132701
  await beforeReport?.().catch(() => {
132722
132702
  });
132723
- if (error3 instanceof StepError || error3 instanceof TestInboxNeedsClaim)
132703
+ if (error3 instanceof StepError)
132724
132704
  throw error3;
132725
132705
  const stopped = browserStoppedMessage(page, error3);
132726
132706
  if (stopped)
@@ -132989,7 +132969,6 @@ var secretScreens, FIND_MS, DEFAULT_FORM, pick2, describe3, marks, lastSignInCod
132989
132969
  var init_form_auth = __esm({
132990
132970
  "dist/lib/form-auth.js"() {
132991
132971
  "use strict";
132992
- init_test_control();
132993
132972
  init_test_diagnostics();
132994
132973
  init_test_timeline();
132995
132974
  init_form_accounts();
@@ -133088,6 +133067,9 @@ function clientOf(who) {
133088
133067
  return who.request;
133089
133068
  return who;
133090
133069
  }
133070
+ function splitManifests(changed) {
133071
+ return { app: changed.filter((file2) => !PACKAGE_MANIFESTS.has(file2)), manifests: changed.filter((file2) => PACKAGE_MANIFESTS.has(file2)) };
133072
+ }
133091
133073
  function undeployedChanges(root, projectId, preview = false) {
133092
133074
  let base;
133093
133075
  if (preview) {
@@ -133160,7 +133142,7 @@ async function dataReady(scope, timeout = 5e3) {
133160
133142
  });
133161
133143
  return await root.locator('[data-sw-data="error"]').count() ? "error" : "ready";
133162
133144
  }
133163
- var AppTest;
133145
+ var PACKAGE_MANIFESTS, AppTest;
133164
133146
  var init_app_test = __esm({
133165
133147
  "dist/lib/app-test.js"() {
133166
133148
  "use strict";
@@ -133179,6 +133161,8 @@ var init_app_test = __esm({
133179
133161
  __name(describeCheckFailure, "describeCheckFailure");
133180
133162
  __name(pageState, "pageState");
133181
133163
  __name(clientOf, "clientOf");
133164
+ PACKAGE_MANIFESTS = /* @__PURE__ */ new Set(["package.json", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb"]);
133165
+ __name(splitManifests, "splitManifests");
133182
133166
  __name(undeployedChanges, "undeployedChanges");
133183
133167
  __name(classifyData, "classifyData");
133184
133168
  AppTest = class _AppTest {
@@ -133243,6 +133227,12 @@ var init_app_test = __esm({
133243
133227
  const target = control.target;
133244
133228
  if ((options2.undeployed ?? "refuse") === "refuse") {
133245
133229
  const local = undeployedChanges(root, projectId, preview);
133230
+ const { app: changedApp, manifests } = splitManifests(local?.changed ?? []);
133231
+ if (local && manifests.length) {
133232
+ local.changed = changedApp;
133233
+ process.stderr.write(`Note: ${manifests.join(", ")} changed since the last ${preview ? "preview save" : "deploy"}. Installing test tools changes only these, so the tests run; if you changed the app's dependencies, ${preview ? "save the preview" : "deploy"} first.
133234
+ `);
133235
+ }
133246
133236
  if (local?.changed.length) {
133247
133237
  throw new Error(preview ? `This folder has changes its preview does not have (${local.changed.slice(0, 8).join(", ")}${local.changed.length > 8 ? ", \u2026" : ""}). Save them with \`somewhere preview\`, then run this script.` : `This folder has changes the live release does not have (${local.changed.slice(0, 8).join(", ")}${local.changed.length > 8 ? ", \u2026" : ""}). The last deploy did not publish them (it failed, was refused, or has not run), so testing now would test an old release. Deploy, check that it succeeded, then run this script.`);
133248
133238
  }
@@ -133373,10 +133363,6 @@ var init_app_test = __esm({
133373
133363
  this.checks.push({ name, ok: true, ms: Math.round(performance.now() - start) });
133374
133364
  return true;
133375
133365
  } catch (error3) {
133376
- if (error3 instanceof TestInboxNeedsClaim) {
133377
- this.checks.push({ name, ok: false, ms: 0, skipped: "needs-claim", error: error3.message });
133378
- return false;
133379
- }
133380
133366
  await this.rememberPageSecrets();
133381
133367
  const pages = await Promise.all([...this.host.pages].map(pageState));
133382
133368
  const stopped = [...this.host.pages].map((page) => browserStoppedMessage(page, error3)).find(Boolean);
@@ -133390,7 +133376,7 @@ page ${i + 1}: ${state}`).join("");
133390
133376
  }
133391
133377
  }
133392
133378
  /** Confirm the release did not change, delete this script's sign-up accounts by exact id, write
133393
- * the result once, print one summary, and set a non-zero exit code if anything failed. */
133379
+ * the result once, print one summary, and set a non-zero exit code if anything failed or was skipped. */
133394
133380
  async finish() {
133395
133381
  if (this.finished)
133396
133382
  throw new Error("finish() already ran");
@@ -133473,7 +133459,7 @@ page ${i + 1}: ${state}`).join("");
133473
133459
  if (live !== this.release) {
133474
133460
  process.stdout.write(preview ? "The preview changed or closed during this script. Save it again with `somewhere preview` (or open a new one if it closed), then run the whole script again.\n" : "The live release changed during this script. Run the whole script again.\n");
133475
133461
  }
133476
- if (failed || !this.checks.length)
133462
+ if (failed || !this.checks.length || this.checks.some((check2) => check2.skipped))
133477
133463
  process.exitCode = 1;
133478
133464
  return { passed, failed, file: this.resultsPath };
133479
133465
  }
@@ -133565,15 +133551,6 @@ function runner() {
133565
133551
  } catch {
133566
133552
  throw new Error("Install project test dependencies: npm install -D @playwright/test @somewhere-cloud/cli");
133567
133553
  }
133568
- const withInboxSkip = /* @__PURE__ */ __name(async (work) => {
133569
- try {
133570
- return await work();
133571
- } catch (error3) {
133572
- if (error3 instanceof TestInboxNeedsClaim)
133573
- pw.test.skip(true, error3.message);
133574
- throw error3;
133575
- }
133576
- }, "withInboxSkip");
133577
133554
  const test2 = pw.test.extend({
133578
133555
  _preview: [async ({}, use) => {
133579
133556
  const control = await previewControlForWorker();
@@ -133755,13 +133732,13 @@ function runner() {
133755
133732
  }
133756
133733
  }, "_forms"),
133757
133734
  signUp: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
133758
- await use((page, options2) => span("signUp", { test: titled(info2.project.name, info2.title) }, () => withInboxSkip(() => signUp(_forms, page, options2 ?? {}))));
133735
+ await use((page, options2) => span("signUp", { test: titled(info2.project.name, info2.title) }, () => signUp(_forms, page, options2 ?? {})));
133759
133736
  }, "signUp"),
133760
133737
  verify: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
133761
- await use((page, person) => span("verify", { test: titled(info2.project.name, info2.title) }, () => withInboxSkip(() => verify(_forms, page, person))));
133738
+ await use((page, person) => span("verify", { test: titled(info2.project.name, info2.title) }, () => verify(_forms, page, person)));
133762
133739
  }, "verify"),
133763
133740
  signIn: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
133764
- await use((page, person, options2) => span("signIn", { test: titled(info2.project.name, info2.title) }, () => withInboxSkip(() => signIn(_forms, page, person, options2 ?? {}))));
133741
+ await use((page, person, options2) => span("signIn", { test: titled(info2.project.name, info2.title) }, () => signIn(_forms, page, person, options2 ?? {})));
133765
133742
  }, "signIn"),
133766
133743
  signOut: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
133767
133744
  await use((page, options2) => span("signOut", { test: titled(info2.project.name, info2.title) }, () => signOut(_forms, page, options2 ?? {})));