@somewhere-cloud/cli 0.38.134 → 0.38.137

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,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.137
4
+
5
+ - `somewhere deploy` never waits for the after-deploy check: it prints the live address as soon as the app is live, then one line, `Checks: running in the background; somewhere test shows the result.` (`--json` carries the `checks` pointer). 0.38.136, which was never published, waited up to 120 s.
6
+ - `somewhere test` reads the result of the last deploy's check; while that check is still running it waits for it (up to 150 s). `--again` starts a fresh run.
7
+
8
+ ## 0.38.136
9
+
10
+ - `somewhere test` runs the live release's checks in Somewhere's browser: the saved `checks/*.json` journeys, the stranger and signed-out access probes and a page crawl. It prints one PASS or FAIL line per check, failures first, then the summary sentence, and exits 1 unless every check passed (also when the checks have not finished within 150 s). `--json` prints the record. Nothing is installed locally.
11
+ - `somewhere test <file>` still runs a `tests/*.mjs` or `*.cjs` script, and a project with `tests/**/*.spec.ts` (or `--preview`) still runs its Playwright specs.
12
+ - New starters save their journey as `checks/add-a-note.json` (signed in, desktop and phone) instead of `tests/app-check.mjs`, and the starter guide says how to save more. `somewhere deploy` publishes `checks/`.
13
+
14
+ ## 0.38.135
15
+
16
+ - somewhere typecheck knows sw.mail and sw.mail.project in functions: list, get, attachment, search, send and addresses, with their result types.
17
+
3
18
  ## 0.38.134
4
19
 
5
20
  - somewhere typecheck checks db/schema.ts with the platform's current rules.
package/README.md CHANGED
@@ -66,10 +66,12 @@ the project. The pinned version runs from npm’s cache when needed. `somewhere
66
66
  upgrade` moves the pin. Type checking uses the pinned compiler through npm
67
67
  when no compiler is installed in the project.
68
68
 
69
- `init` installs React, the SDK, and editor types. For a local Vite server, use
70
- `npm install -D --save-exact vite@7.2.2`
71
- for `somewhere dev` and `npm install -D --save-exact @playwright/test@1.65.0`
72
- for browser tests. `somewhere test` supplies its own helpers to the test files.
69
+ `init` installs React, the SDK, TypeScript, and editor types. For a local Vite server, use
70
+ `npm install -D --save-exact vite@7.2.2` for `somewhere dev`.
71
+ Save each journey you want re-checked after every deploy as `checks/<plain-name>.json`;
72
+ the platform runs them in its browser after each deploy and `somewhere test` runs them now
73
+ (nothing to install). A Playwright script or spec runs locally with
74
+ `somewhere test <file>` after `npm install -D --save-exact @playwright/test@1.65.0`.
73
75
  `init --template bare` is the same as `init --bare` and installs no dependencies.
74
76
 
75
77
  If you created the starter with CLI 0.38.123 or 0.38.124, run
@@ -38363,36 +38363,20 @@ headers: { 'content-type': 'application/json' }, body: JSON.stringify(values) })
38363
38363
  Access cookies refresh automatically. Cookie-auth POST/PATCH/DELETE from scripts
38364
38364
  need Origin equal to the app URL.
38365
38365
 
38366
- After every deploy, somewhere verify checks the page loads and looks right at desktop and phone size, with no
38367
- test to write. Journeys, several users and access rules go in tests/*.mjs with somewhere test.
38366
+ After every deploy the platform checks the live app in its own browser: pages load signed out and as a
38367
+ test user, a stranger and a signed-out visitor cannot read a person's data, and your saved checks pass.
38368
+ Save each journey you want re-checked after every deploy as checks/<plain-name>.json; the platform runs them
38369
+ in its browser after each deploy and \`somewhere test\` runs them now.
38368
38370
  ${FIRST_CLI_PERMISSION}
38369
- Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
38370
- It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first. Start from
38371
- tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
38372
- Keep each run short:
38373
- - Short waits: page.setDefaultTimeout(5_000) on every page; a deployed app answers in under
38374
- a second. Never sleep for a fixed time: wait for the thing itself (the text, the response).
38375
- - Keep independent checks running. For a dependent check, pass { requires: { name, passed } }
38376
- to app.check() using the earlier check's boolean result, so a skip explains what it needed.
38377
- - After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
38378
- The CLI supplies its test helpers when it runs your tests. For the first browser test, install Playwright with npm install -D --save-exact @playwright/test@1.65.0.
38379
- For a local Vite server, install the frontend tools with npm install -D --save-exact vite@7.2.2.
38380
- The test helper, @somewhere-cloud/cli/script (import or require); these are all the calls a test needs:
38381
- const app = await openAppTest(); // the live origin, release and data contract
38382
- const ana = await app.signUp(page); // through your form: { id, email, password, verified }
38383
- // { email: 'Ana@Staff.Example' } is used exactly as typed; or { domain: 'staff.example' };
38384
- // then app.verify(page, ana) if your app needs a verified address
38385
- const benPage = await browser.newPage(); const ben = await app.signUp(benPage); // a second user
38386
- await app.signOut(page); await app.signIn(page, ana);
38387
- const r = await app.data(page, { table, operation, id, values, where, limit }); // as that person
38388
- // r.kind: ok | empty | refused | missing-or-refused | malformed | stale-contract | error
38389
- // (also r.status, r.data, r.error); the contract and Origin are added for you
38390
- await app.expectRefused(benPage, { table, operation: 'get', id }, { allowed: page });
38391
- // 401/403 passes; an empty or 404 answer passes only with allowed: someone it succeeds for
38392
- const seen = captureResponses(benPage); await seen.find(secret); // where a secret appeared
38393
- await app.check('name', async () => { ... }); await app.finish(); // finish deletes the sign-ups
38394
- It finds your form by data-testid "auth-email", "auth-password", "auth-signup", "auth-signin",
38395
- "signout" (or data-sw-auth); otherwise pass app.signUp(page, { form: { email, password, signUp, signIn } }).
38371
+ Run them now: npx @somewhere-cloud/cli test (one PASS or FAIL line per check, failures first; exit 1 when one fails).
38372
+ A saved check is the somewhere verify --flow actions list; "signed_in": true runs it as a test user the platform
38373
+ creates and removes, and "viewports": ["desktop", "mobile"] runs it at both sizes:
38374
+ { "actions": [ { "fill": "[data-testid=note-title]", "value": "Lunch with Ana 42" },
38375
+ { "click": "[data-testid=note-save]" },
38376
+ { "expect": { "selector": "[data-testid=note-item]", "text": "Lunch with Ana 42" } } ],
38377
+ "signed_in": true, "viewports": ["desktop", "mobile"] }
38378
+ Find controls by data-testid so renaming a button does not break a check; keep the ids when you restyle.
38379
+ The notes starter ships this one as checks/add-a-note.json (note-title, note-save, note-item): start from it.
38396
38380
  Open a list item by clicking the item element itself (what a person clicks), not a link inside it.
38397
38381
  Deploy raw source, no frontend build; type errors stop upload.
38398
38382
  The complete team spec, with removal and leaving: somewhere docs sw.groups --section team-example.
@@ -41045,98 +41029,23 @@ var init_project_pin = __esm({
41045
41029
  });
41046
41030
 
41047
41031
  // dist/lib/init-test-template.js
41048
- function starterTests(options2 = {}) {
41049
- return [{ path: "tests/app-check.mjs", content: SCRIPT(Boolean(options2.privateData)) }];
41032
+ function starterChecks(options2 = {}) {
41033
+ return options2.privateData ? [{ path: "checks/add-a-note.json", content: JSON.stringify(ADD_A_NOTE, null, 2) + "\n" }] : [];
41050
41034
  }
41051
- var SCRIPT;
41035
+ var ADD_A_NOTE;
41052
41036
  var init_init_test_template = __esm({
41053
41037
  "dist/lib/init-test-template.js"() {
41054
41038
  "use strict";
41055
- init_first_cli_permission();
41056
- SCRIPT = /* @__PURE__ */ __name((privateData) => `// Change these Playwright checks to match your app. Run after a successful deploy.
41057
- // ${FIRST_CLI_PERMISSION}
41058
- // npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
41059
- // Results: .somewhere/app-check.json. Rerun failed scripts with npx @somewhere-cloud/cli test --failed.
41060
- import { chromium } from '@playwright/test';
41061
- import { openAppTest${privateData ? ", captureResponses, dataReady" : ""} } from '@somewhere-cloud/cli/script';
41062
- const app = await openAppTest(); // stops if this folder has changes the live release lacks
41063
- const browser = await chromium.launch(app.launchOptions());
41064
- const person = async () => {
41065
- const page = await browser.newPage({ baseURL: app.origin });
41066
- page.setDefaultTimeout(5_000); // a deployed app answers in well under a second; never sleep, wait for the thing itself
41067
- return { page, account: await app.signUp(page) };
41068
- };
41069
- try {
41070
- await app.check('the sign-in page loads', async (at) => {
41071
- const page = await browser.newPage({ baseURL: app.origin });
41072
- try {
41073
- await page.goto('/');
41074
- at('Wait for the signed-out page', '[data-app-state="signed-out"]');
41075
- await page.locator('[data-app-state="signed-out"]').waitFor({ timeout: 5_000 });
41076
- } finally { await page.close(); }
41077
- });
41078
- let ana, ben;
41079
- const needsSignup = { name: 'sign up through the app', passed: false };
41080
- needsSignup.passed = await app.check(needsSignup.name, async () => {
41081
- // Finish both attempts before cleanup, even if one fails.
41082
- const people = await Promise.allSettled([person(), person()]);
41083
- for (const result of people) if (result.status === 'rejected') throw result.reason;
41084
- [ana, ben] = people.map(result => result.value);
41085
- });
41086
- await app.check('the signed-in page shows the account', () => ana.page.getByText(ana.account.email).waitFor(), { requires: needsSignup });
41087
- const roundTrip = 'sign out, then sign back in';
41088
- const signedBackIn = await app.check(roundTrip, async (at) => {
41089
- await app.signOut(ana.page);
41090
- at('Sign back in');
41091
- await app.signIn(ana.page, ana.account);
41092
- }, { requires: needsSignup });
41093
- ${privateData ? ` await app.check('a note stays private to its owner', async (at) => {
41094
- const secret = 'private ' + crypto.randomUUID();
41095
- at('Create the first person\u2019s note'); // found by data-testid, not words: keep note-title, note-save and note-item when renaming
41096
- await ana.page.getByTestId('note-title').fill(secret);
41097
- await ana.page.getByTestId('note-save').click();
41098
- await ana.page.getByTestId('note-item').filter({ hasText: secret }).waitFor();
41099
- const seen = captureResponses(ben.page);
41100
- try {
41101
- await ben.page.reload();
41102
- // On the data view, set data-sw-data="loading" while fetching, "ready" once loaded, or "error" if fetching fails.
41103
- at('Wait for the second person\u2019s notes to load', '[data-sw-data]');
41104
- if (await dataReady(ben.page) === 'error') throw new Error('The second person\u2019s notes view reported a loading error.');
41105
- const [leak] = await seen.find(secret);
41106
- if (leak) {
41107
- at('Check the second person\u2019s responses for the note', leak.url);
41108
- throw new Error('The second person received the first person\u2019s note.');
41109
- }
41110
- } finally { seen.stop(); }
41111
- at('Read the note as its owner');
41112
- const owned = await app.data(ana.page, { table: 'notes', operation: 'list', where: { title: secret } });
41113
- const note = owned.data?.[0];
41114
- if (!note) throw new Error('The owner\u2019s request did not return the new note (HTTP ' + owned.status + ').');
41115
- at('Check that the second person cannot read, edit, or delete the note');
41116
- await app.expectRefused(ben.page, { table: 'notes', operation: 'get', id: note.id }, { allowed: ana.page });
41117
- await app.expectRefused(ben.page, { table: 'notes', operation: 'update', id: note.id, values: { title: 'changed' } }, { allowed: ana.page });
41118
- await app.expectRefused(ben.page, { table: 'notes', operation: 'delete', id: note.id }, { allowed: ana.page });
41119
- }, { requires: needsSignup.passed ? { name: roundTrip, passed: signedBackIn } : needsSignup });
41120
- ` : ` // After adding tables in db/schema.ts, test access with these helpers:
41121
- // const { data: [task] } = await app.data(ana.page, { table: 'tasks', operation: 'list' });
41122
- // await app.expectRefused(ben.page, { table: 'tasks', operation: 'get', id: task.id }, { allowed: ana.page });
41123
- `} await app.check('at phone width nothing scrolls sideways', async (at) => {
41124
- await ben.page.setViewportSize({ width: 390, height: 844 });
41125
- await ben.page.reload();
41126
- await ben.page.getByText(ben.account.email).waitFor();
41127
- at('Measure horizontal overflow', app.origin);
41128
- const wide = await ben.page.evaluate(() => [document.documentElement, ...document.querySelectorAll('body *')]
41129
- .filter((el) => el.scrollWidth > el.clientWidth + 1
41130
- && (el === document.documentElement || ['auto', 'scroll'].includes(getComputedStyle(el).overflowX)))
41131
- .map((el) => el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : '')));
41132
- if (wide.length) throw new Error('scrolls sideways at 390 px: ' + wide.join(', '));
41133
- }, { requires: needsSignup });
41134
- } finally {
41135
- await app.finish(); // confirms the release, deletes the accounts, writes the result once
41136
- await browser.close();
41137
- }
41138
- `, "SCRIPT");
41139
- __name(starterTests, "starterTests");
41039
+ ADD_A_NOTE = {
41040
+ actions: [
41041
+ { fill: "[data-testid=note-title]", value: "Lunch with Ana 42" },
41042
+ { click: "[data-testid=note-save]" },
41043
+ { expect: { selector: "[data-testid=note-item]", text: "Lunch with Ana 42" } }
41044
+ ],
41045
+ viewports: ["desktop", "mobile"],
41046
+ signed_in: true
41047
+ };
41048
+ __name(starterChecks, "starterChecks");
41140
41049
  }
41141
41050
  });
41142
41051
 
@@ -42910,20 +42819,9 @@ function createFeatureTemplate(selection, options2) {
42910
42819
  const agent = selection.modules.includes("agent");
42911
42820
  const magicLink = selection.modules.includes("magic-link");
42912
42821
  const files = [
42913
- ...starterTests({ privateData }),
42822
+ ...starterChecks({ privateData }),
42914
42823
  { path: ".gitignore", content: buildScaffoldGitignore() },
42915
- { path: "AGENTS.md", content: INIT_AGENTS_MD.replace(/## Getting started[^]*?After edits:/, `## Testing
42916
- ${FIRST_CLI_PERMISSION}
42917
- Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
42918
- It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first.
42919
- Start from tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
42920
- Helpers from @somewhere-cloud/cli/script (import or require): signUp/signIn/signOut through your form,
42921
- data(page, { table, operation, id, values, where }) as that person, expectRefused with a positive control,
42922
- captureResponses, dataReady (the list has loaded), launchOptions. A rebuilt sign-in form keeps
42923
- data-sw-auth="email", "password", "sign-up", "sign-in" on its controls, or pass { form: { \u2026 } } selectors.
42924
- Rerun only to answer a question. A pass means the checks you wrote passed; say what they do not cover.
42925
-
42926
- After edits:`) },
42824
+ { path: "AGENTS.md", content: INIT_AGENTS_MD },
42927
42825
  { path: "CLAUDE.md", content: INIT_CLAUDE_MD },
42928
42826
  { path: "README.md", content: readme(selection) },
42929
42827
  { path: "package.json", content: packageJson2(options2.appName) },
@@ -42981,7 +42879,6 @@ var packageJson2, TSCONFIG2, AUTH_API, AUTH_TYPES, PROVIDER_SIGN_IN_HOOK, AUTH_C
42981
42879
  var init_init_feature_template = __esm({
42982
42880
  "dist/lib/init-feature-template.js"() {
42983
42881
  "use strict";
42984
- init_first_cli_permission();
42985
42882
  init_init_test_template();
42986
42883
  init_scaffold();
42987
42884
  init_version();
@@ -76268,7 +76165,7 @@ async function awaitDeployChecks(client, checks, opts = {}) {
76268
76165
  const now2 = opts.now ?? Date.now;
76269
76166
  const sleep3 = opts.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
76270
76167
  const pollMs = opts.pollMs ?? DEPLOY_CHECKS_POLL_MS;
76271
- const deadline = now2() + (opts.waitMs ?? DEPLOY_CHECKS_WAIT_MS);
76168
+ const deadline = now2() + (opts.waitMs ?? TEST_CHECKS_WAIT_MS);
76272
76169
  let last = null;
76273
76170
  for (; ; ) {
76274
76171
  try {
@@ -76284,22 +76181,45 @@ async function awaitDeployChecks(client, checks, opts = {}) {
76284
76181
  await sleep3(pollMs);
76285
76182
  }
76286
76183
  }
76287
- function formatDeployChecksLine(check2) {
76288
- if (!check2 || check2.status === "pending")
76289
- return DEPLOY_CHECKS_STILL_RUNNING;
76290
- return check2.sentence ? `Checks: ${check2.sentence}` : null;
76184
+ async function runChecksNow(client, projectId, opts = {}) {
76185
+ if (!opts.again) {
76186
+ const read = `GET /v1/deploy/log?project_id=${encodeURIComponent(projectId)}`;
76187
+ const stored = await awaitDeployChecks(client, { read }, { ...opts, waitMs: 0 });
76188
+ if (stored && stored.status !== "pending")
76189
+ return stored;
76190
+ if (stored)
76191
+ return awaitDeployChecks(client, { read }, { waitMs: TEST_CHECKS_WAIT_MS, ...opts });
76192
+ }
76193
+ const started = await client.call("POST", "/deploy/checks", { project_id: projectId });
76194
+ return awaitDeployChecks(client, { read: started?.read }, { waitMs: TEST_CHECKS_WAIT_MS, ...opts });
76291
76195
  }
76292
- var DEPLOY_CHECKS_WAIT_MS, DEPLOY_CHECKS_POLL_MS, DEPLOY_CHECKS_STILL_RUNNING;
76196
+ function formatChecksReport(check2) {
76197
+ if (!check2 || check2.status === "pending") {
76198
+ return [`The checks did not finish within ${TEST_CHECKS_WAIT_MS / 1e3} s; \`${cliInvocation()} call project_deploy_log '{}'\` shows the result when they do.`];
76199
+ }
76200
+ const lines = Array.isArray(check2.checks) ? check2.checks : [];
76201
+ return [
76202
+ ...lines.filter((line) => !line.pass).map((line) => `FAIL ${line.name}`),
76203
+ ...lines.filter((line) => line.pass).map((line) => `PASS ${line.name}`),
76204
+ ...check2.sentence ? [check2.sentence] : []
76205
+ ];
76206
+ }
76207
+ function checksExitCode(check2) {
76208
+ return check2?.passed === true ? 0 : 1;
76209
+ }
76210
+ var DEPLOY_CHECKS_POLL_MS, DEPLOY_CHECKS_RUNNING, TEST_CHECKS_WAIT_MS;
76293
76211
  var init_deploy_checks = __esm({
76294
76212
  "dist/lib/deploy-checks.js"() {
76295
76213
  "use strict";
76296
76214
  init_cli_invocation();
76297
- DEPLOY_CHECKS_WAIT_MS = 45e3;
76298
76215
  DEPLOY_CHECKS_POLL_MS = 3e3;
76299
76216
  __name(parseChecksRead, "parseChecksRead");
76300
76217
  __name(awaitDeployChecks, "awaitDeployChecks");
76301
- DEPLOY_CHECKS_STILL_RUNNING = `Checks: still running; \`${cliInvocation()} call project_deploy_log '{}'\` shows the result.`;
76302
- __name(formatDeployChecksLine, "formatDeployChecksLine");
76218
+ DEPLOY_CHECKS_RUNNING = `Checks: running in the background; \`${cliInvocation()} test\` shows the result.`;
76219
+ TEST_CHECKS_WAIT_MS = 15e4;
76220
+ __name(runChecksNow, "runChecksNow");
76221
+ __name(formatChecksReport, "formatChecksReport");
76222
+ __name(checksExitCode, "checksExitCode");
76303
76223
  }
76304
76224
  });
76305
76225
 
@@ -82824,8 +82744,6 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82824
82744
  if (postLive.kind === "timeout")
82825
82745
  output.post_live_render = { status: "pending", note: POST_LIVE_RENDER_STILL_RUNNING };
82826
82746
  const tests2 = await runReleaseTests();
82827
- if (result.checks)
82828
- output.access_check = await awaitDeployChecks(client, result.checks);
82829
82747
  printJson(verification || verificationError || tests2 ? {
82830
82748
  ...output,
82831
82749
  deployment_outcome: "live",
@@ -82973,11 +82891,8 @@ ${dim("Build")}`);
82973
82891
  info(`Open ${link} to save the app to your account, then run \`${cliInvocation()} login\` to connect this terminal.`);
82974
82892
  }
82975
82893
  }
82976
- if (result.checks) {
82977
- const checksLine = formatDeployChecksLine(await awaitDeployChecks(client, result.checks));
82978
- if (checksLine)
82979
- info(checksLine);
82980
- }
82894
+ if (result.checks)
82895
+ info(DEPLOY_CHECKS_RUNNING);
82981
82896
  if (hasFunctionErrors) {
82982
82897
  process.exit(1);
82983
82898
  }
@@ -131409,7 +131324,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
131409
131324
  }
131410
131325
  function describeScriptResults(results, options2 = {}) {
131411
131326
  if (!results.length)
131412
- return [`No tests found: add a Playwright script as tests/<name>.mjs or .cjs (somewhere init writes tests/app-check.mjs), then run ${TEST_COMMAND}.`];
131327
+ return [`No tests found: add a Playwright script as tests/<name>.mjs or .cjs, then run it with ${TEST_COMMAND} tests/<name>.mjs.`];
131413
131328
  const lines = describeReport(results.map((result) => {
131414
131329
  const checks = result.checks ?? [{ name: result.script, ok: result.ok, ...result.ok ? {} : { error: result.reason ?? `exit ${result.exitCode}` } }];
131415
131330
  const crashed = !result.ok && (result.browserCrashed || !checks.some((check2) => !check2.ok));
@@ -131461,7 +131376,7 @@ var init_test_scripts = __esm({
131461
131376
 
131462
131377
  // dist/commands/test.js
131463
131378
  function registerTest(program2) {
131464
- program2.command("test [files...]").description("Run this project's tests: every tests/*.mjs and tests/*.cjs script (such as tests/app-check.mjs), or, when the project has tests/**/*.spec.ts, its Playwright specs against the live release (--preview: this folder's open preview)").option("--preview", "Test this folder's open preview (its own users, data copy and captured mail), pinned to the version saved when the run starts. Production is never touched.").option("--workers <count>", "Parallel workers", "5").option("--failed", "Rerun what failed last time: each failed tests/*.mjs or *.cjs script, all its checks (specs: only the failed tests)").option("--fail-fast", "Stop app-check scripts at their first failed check").option("--grep <name>", "Filter test names (subset)").option("--url <url>", "Unsupported in phase 1").option("--phone", "Run every test again in a 390x844 phone viewport ([phone] in results)").option("--json", "Print structured results").option("--verbose", "Also print where the full result file is when everything passed").addHelpText("after", '\nFor the starter privacy check, mark the data view with data-sw-data="loading" while fetching, "ready" once data loads, or "error" if fetching fails.\n').action(async (files, opts) => {
131379
+ program2.command("test [files...]").description("Run the live release's checks now in Somewhere's browser: your saved checks/*.json journeys, the stranger and signed-out access probes and a page crawl (the same check that runs after every deploy). Exits 1 when one fails. With a file, runs that tests/*.mjs or *.cjs script; a project with tests/**/*.spec.ts runs its Playwright specs (--preview: this folder's open preview)").option("--preview", "Test this folder's open preview (its own users, data copy and captured mail), pinned to the version saved when the run starts. Production is never touched.").option("--workers <count>", "Parallel workers", "5").option("--again", "Start a fresh run of the checks on the live release instead of reading the result of the last deploy's run").option("--failed", "Rerun what failed last time: each failed tests/*.mjs or *.cjs script, all its checks (specs: only the failed tests)").option("--fail-fast", "Stop app-check scripts at their first failed check").option("--grep <name>", "Filter test names (subset)").option("--url <url>", "Unsupported in phase 1").option("--phone", "Run every test again in a 390x844 phone viewport ([phone] in results)").option("--json", "Print structured results").option("--verbose", "Also print where the full result file is when everything passed").addHelpText("after", "\nSave each journey you want re-checked after every deploy as checks/<plain-name>.json; the platform runs them in its browser after each deploy and `somewhere test` runs them now.\n").action(async (files, opts) => {
131465
131380
  markProcessStart("cli");
131466
131381
  mark("cli:action");
131467
131382
  if (opts.url)
@@ -131472,6 +131387,19 @@ function registerTest(program2) {
131472
131387
  const projectId = loadProjectConfig()?.project_id;
131473
131388
  if (!projectId)
131474
131389
  throw new Error("Run somewhere test from a linked project folder");
131390
+ if (!files.length && !opts.preview && !opts.failed && !hasSpecFiles(root)) {
131391
+ const unsupported = [opts.phone && "--phone", opts.grep && "--grep", opts.workers !== "5" && "--workers", opts.failFast && "--fail-fast"].filter(Boolean);
131392
+ if (unsupported.length)
131393
+ throw new Error(`${unsupported.join(", ")} apply to Playwright specs and scripts; the platform runs checks/*.json as saved.`);
131394
+ const check2 = await runChecksNow(new ApiClient(getToken()), projectId, { again: opts.again === true });
131395
+ mark("cli:exit");
131396
+ if (opts.json)
131397
+ process.stdout.write(JSON.stringify(check2, null, 2) + "\n");
131398
+ else
131399
+ process.stdout.write(formatChecksReport(check2).join("\n") + "\n");
131400
+ process.exitCode = checksExitCode(check2);
131401
+ return;
131402
+ }
131475
131403
  const note = (opts.preview ? Promise.resolve(null) : referenceCheckNote(() => new ApiClient(getToken()), projectId)).then((line) => {
131476
131404
  if (line)
131477
131405
  process.stderr.write(line + "\n");
@@ -131514,6 +131442,7 @@ var init_test = __esm({
131514
131442
  init_test_run();
131515
131443
  init_test_timeline();
131516
131444
  init_reference_check_note();
131445
+ init_deploy_checks();
131517
131446
  init_test_scripts();
131518
131447
  __name(registerTest, "registerTest");
131519
131448
  }