@somewhere-cloud/cli 0.38.84 → 0.38.86

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +176 -7
  2. package/dist/commands/deploy.js +25 -2
  3. package/dist/commands/deploy.js.map +1 -1
  4. package/dist/commands/test.js +13 -99
  5. package/dist/commands/test.js.map +1 -1
  6. package/dist/lib/deploy-tests.d.ts +27 -0
  7. package/dist/lib/deploy-tests.js +49 -0
  8. package/dist/lib/deploy-tests.js.map +1 -0
  9. package/dist/lib/form-accounts.d.ts +2 -2
  10. package/dist/lib/form-accounts.js +8 -5
  11. package/dist/lib/form-accounts.js.map +1 -1
  12. package/dist/lib/init-agent-guide.d.ts +2 -2
  13. package/dist/lib/init-agent-guide.js +6 -1
  14. package/dist/lib/init-agent-guide.js.map +1 -1
  15. package/dist/lib/init-feature-template.js +5 -5
  16. package/dist/lib/init-feature-template.js.map +1 -1
  17. package/dist/lib/init-green-template.js +3 -0
  18. package/dist/lib/init-green-template.js.map +1 -1
  19. package/dist/lib/init-test-template.d.ts +4 -1
  20. package/dist/lib/init-test-template.js +131 -42
  21. package/dist/lib/init-test-template.js.map +1 -1
  22. package/dist/lib/init-ui-kit.d.ts +1 -1
  23. package/dist/lib/init-ui-kit.js +21 -3
  24. package/dist/lib/init-ui-kit.js.map +1 -1
  25. package/dist/lib/playwright-fixtures.d.ts +8 -1
  26. package/dist/lib/playwright-fixtures.js +46 -29
  27. package/dist/lib/playwright-fixtures.js.map +1 -1
  28. package/dist/lib/test-diagnostics.js +2 -1
  29. package/dist/lib/test-diagnostics.js.map +1 -1
  30. package/dist/lib/test-ledger.d.ts +73 -0
  31. package/dist/lib/test-ledger.js +261 -0
  32. package/dist/lib/test-ledger.js.map +1 -0
  33. package/dist/lib/test-reporter.d.ts +2 -0
  34. package/dist/lib/test-reporter.js +74 -6
  35. package/dist/lib/test-reporter.js.map +1 -1
  36. package/dist/lib/test-run.d.ts +35 -0
  37. package/dist/lib/test-run.js +136 -0
  38. package/dist/lib/test-run.js.map +1 -0
  39. package/dist/lib/test-target.d.ts +4 -1
  40. package/dist/lib/test-target.js +12 -3
  41. package/dist/lib/test-target.js.map +1 -1
  42. package/dist/lib/test-timeline.d.ts +10 -0
  43. package/dist/lib/test-timeline.js +50 -0
  44. package/dist/lib/test-timeline.js.map +1 -0
  45. package/dist/testing.d.ts +1 -1
  46. package/dist/testing.js.map +1 -1
  47. package/npm-shrinkwrap.json +2 -2
  48. package/package.json +1 -1
  49. package/src/testing.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,16 @@
1
- ## 0.38.36
1
+ # Changelog
2
2
 
3
- Republish the platform contract 6 CLI after npm accepted earlier uploads without making their tarballs installable. Publication now checks the exact registry version and latest tag once.
3
+ ## 0.38.86
4
4
 
5
- ## 0.38.35
5
+ - Release notes list every change since the previous version.
6
+ - The starter's Table stacks rows on phones, and every release has notes, newest first.
6
7
 
7
- - Allow tasks delete to accept up to 200 IDs, returning a result for each task.
8
+ ## 0.38.85
8
9
 
9
- # Changelog
10
+ - somewhere init: the starters ship working journeys to adapt: tests/account (sign up, out, in), tests/phone (one 390 px pass) and tests/access (two people; a role-holder and a non-holder). People are made at once; newUser({ role }) grants a declared app role.
11
+ - somewhere test: after a failure it prints each failed test's file, line and assertion and the focused command; somewhere test --failed reruns only what failed and lists the passed results it keeps for the same release (by spec and test hash), never as a full run. A deploy, a changed shared test file or a changed test drops them and says why.
12
+ - somewhere deploy --test: runs the specs once against the new release after it is live and reports the deploy and the tests separately.
13
+ - somewhere test is faster: Chrome uses the system resolver, the release check uses the light URLs read, cleanup runs in parallel.
10
14
 
11
15
  ## 0.38.84
12
16
 
@@ -41,11 +45,178 @@ Republish the platform contract 6 CLI after npm accepted earlier uploads without
41
45
  - The auth starter returns someone who signs in while connecting an MCP client (for example Claude) to the consent page, and refuses foreign or expired return values plainly.
42
46
  - The generated AGENTS.md points to the MCP tools recipe.
43
47
 
48
+ ## 0.38.78
49
+
50
+ - somewhere test shows the failing assertion and can run a single file.
51
+
52
+ ## 0.38.77
53
+
54
+ - Shorter agent guidance; somewhere deploy no longer prints the access notice for apps whose tables are all server-only.
55
+ - somewhere typecheck and lint match the platform's current rules.
56
+
44
57
  ## 0.38.76
45
58
 
46
59
  - Keep unreferenced operational scripts, fixtures and output local, with app-reference retention and explicit includes.
47
60
  - Read pending render results immediately, then use bounded polling without changing blank-page refusal or the wait budget.
48
61
 
62
+ ## 0.38.75
63
+
64
+ - AGENTS.md shows how to write a test where two people share data, and somewhere typecheck compiles it.
65
+
66
+ ## 0.38.74
67
+
68
+ - somewhere deploy type-checks while it prepares the upload, so deploys finish sooner, and reports the full time taken.
69
+ - somewhere deploy shows render checks that are still running and the final verification error.
70
+
71
+ ## 0.38.73
72
+
73
+ - A refusal because of a role says which method the role allows; a role granted only GET is pointed out.
74
+ - somewhere docs <topic> <words> searches within that topic.
75
+
76
+ ## 0.38.72
77
+
78
+ - somewhere browser and somewhere verify use the platform's current page checks.
79
+
80
+ ## 0.38.71
81
+
82
+ - somewhere typecheck and lint match the platform's current rules.
83
+
84
+ ## 0.38.70
85
+
86
+ - Starter: the access patterns in AGENTS.md show server roles.
87
+
88
+ ## 0.38.69
89
+
90
+ - Starter and AGENTS.md: how to declare team access, and what to read first when writing code.
91
+ - somewhere typecheck checks db/schema.ts with the platform's current rules.
92
+
93
+ ## 0.38.68
94
+
95
+ - somewhere typecheck and lint match the platform's current rules.
96
+
97
+ ## 0.38.67
98
+
99
+ - Lint checks match the platform's current rules.
100
+
101
+ ## 0.38.66
102
+
103
+ - somewhere typecheck and lint match the platform's current rules.
104
+
105
+ ## 0.38.65
106
+
107
+ - somewhere typecheck understands server roles and per-member restrictions in db/schema.ts.
108
+ - Lint checks match the platform's current rules.
109
+
110
+ ## 0.38.64
111
+
112
+ - Public files keep their paths so browsers and caches can keep them.
113
+ - Lint checks match the platform's current rules.
114
+
115
+ ## 0.38.63
116
+
117
+ - The agent guide's examples were corrected.
118
+
119
+ ## 0.38.62
120
+
121
+ - Starter: simpler file layout and a shorter core app contract.
122
+ - somewhere typecheck and lint match the platform's current rules.
123
+
124
+ ## 0.38.61
125
+
126
+ - Starter: clearer app contract and deployment guidance in AGENTS.md.
127
+ - somewhere typecheck and lint match the platform's current rules.
128
+
129
+ ## 0.38.60
130
+
131
+ - Maintenance release: commands work as in the previous version.
132
+
133
+ ## 0.38.59
134
+
135
+ - somewhere test (preview): fixes to choosing the app to test and to failure reports.
136
+ - The agent guide shows current browser data and sign-in examples.
137
+ - somewhere typecheck, lint, deploy file selection, error guidance and the browser page checks match the platform's current rules.
138
+
139
+ ## 0.38.57
140
+
141
+ - somewhere test (preview): the starter's sample test and the failure report were improved.
142
+
143
+ ## 0.38.56
144
+
145
+ - somewhere test (preview): checks the connection to the app before running and reports failures more clearly.
146
+ - somewhere deploy file selection and error guidance match the platform's current rules.
147
+
148
+ ## 0.38.54
149
+
150
+ - somewhere test (preview): fixes to the browser test fixtures.
151
+
152
+ ## 0.38.53
153
+
154
+ - somewhere test (preview): clearer results and failure details.
155
+ - somewhere deploy file selection and error guidance match the platform's current rules.
156
+
157
+ ## 0.38.51
158
+
159
+ - somewhere test (preview): run the project's Playwright tests in a browser against the live app.
160
+ - Lint, deploy file selection and error guidance match the platform's current rules.
161
+
162
+ ## 0.38.49
163
+
164
+ - The testing helper accepts a number as a list cursor.
165
+ - somewhere deploy file selection and error guidance match the platform's current rules.
166
+
167
+ ## 0.38.48
168
+
169
+ - somewhere init can always read the package details it needs to write a starter.
170
+
171
+ ## 0.38.47
172
+
173
+ - Testing helpers for signed-in users are exported, and the starter's example test runs on its own.
174
+ - somewhere deploy file selection and error guidance match the platform's current rules.
175
+
176
+ ## 0.38.45
177
+
178
+ - somewhere init --link in an empty folder writes the starter as well as linking the project.
179
+ - somewhere deploy file selection and error guidance match the platform's current rules.
180
+
181
+ ## 0.38.43
182
+
183
+ - Starter: the sign-in landing page refuses to send people to an address outside the app after sign-in.
184
+ - somewhere deploy file selection and error guidance match the platform's current rules.
185
+
186
+ ## 0.38.41
187
+
188
+ - Starter: a sign-in link opens a page with a Continue button, and the link is used only when the person presses it.
189
+ - somewhere deploy file selection and error guidance match the platform's current rules.
190
+
191
+ ## 0.38.39
192
+
193
+ - Database export uses the export path that matches how the project's database is run.
194
+ - somewhere deploy file selection and error guidance match the platform's current rules.
195
+
196
+ ## 0.38.38
197
+
198
+ - A CLI that is behind the platform's rules warns and keeps working instead of stopping the command.
199
+ - somewhere typecheck, lint, deploy file selection and error guidance match the platform's current rules.
200
+
201
+ ## 0.38.37
202
+
203
+ - somewhere browser --json keeps the platform's refusal (its code and reason) instead of a generic error.
204
+
205
+ ## 0.38.36
206
+
207
+ Republish the platform contract 6 CLI after npm accepted earlier uploads without making their tarballs installable. Publication now checks the exact registry version and latest tag once.
208
+
209
+ ## 0.38.35
210
+
211
+ - Allow tasks delete to accept up to 200 IDs, returning a result for each task.
212
+
213
+ ## 0.38.34
214
+
215
+ - somewhere typecheck checks db/schema.ts with the platform's current rules.
216
+ - Lint checks match the platform's current rules.
217
+ - somewhere deploy chooses the files to publish with the platform's current rules.
218
+ - Error guidance matches the platform's current messages.
219
+
49
220
  ## 0.38.33
50
221
 
51
222
  ### Changed
@@ -896,7 +1067,6 @@ Republish the platform contract 6 CLI after npm accepted earlier uploads without
896
1067
  - `somewhere init` keeps AGENTS.md and useful skills without installing command-running agent hooks or MCP registration. Existing local and global agent configuration stays unchanged.
897
1068
  - The generated project guide asks agents to run `somewhere typecheck` after edits. Optional post-edit deploy-reference hooks remain available through explicit `somewhere hooks install --host <host>`; MCP setup remains explicit through `somewhere mcp install <host>`.
898
1069
 
899
-
900
1070
  ## 0.37.9
901
1071
 
902
1072
  ### Added
@@ -1524,7 +1694,6 @@ Republish the platform contract 6 CLI after npm accepted earlier uploads without
1524
1694
  projects, exact 64-bit integer fidelity on structured writes and batches, and
1525
1695
  the plan-derived local-database answer above.
1526
1696
 
1527
-
1528
1697
  ## 0.29.1
1529
1698
 
1530
1699
  ### Changed
@@ -20,6 +20,9 @@ import { recordPinIfMissing } from '../lib/project-pin.js';
20
20
  import { ensureClaimHandoff } from '../lib/claim-handoff.js';
21
21
  import { dim, error, green, info, platformErrorEnvelope, printJson, printJsonError, red, success, teal, warn, yellow } from '../lib/output.js';
22
22
  import { showProjectNotices } from '../lib/project-notices.js';
23
+ import { prepareRunner } from '../lib/test-run.js';
24
+ import { formatDeployTestsLine, prepareDeployTests, runDeployTests } from '../lib/deploy-tests.js';
25
+ import { mark as timelineMark, markProcessStart } from '../lib/test-timeline.js';
23
26
  import { formatNextActions, nextActions } from '../lib/next-actions.js';
24
27
  import { countFromResponse, countFunctionRoutes, formatPublishSurface, formatUploadInventory, uploadInventory } from '../lib/surface-counts.js';
25
28
  import { formatVerifyOutput, loadVerifyFlow, runVerification, } from './verify.js';
@@ -569,6 +572,7 @@ export function registerDeploy(program) {
569
572
  '(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((v) => v.trim()).filter(Boolean)))
570
573
  .option('--yes', 'Skip confirmation prompts (for --force)')
571
574
  .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.')
575
+ .option('--test', 'After the deploy is live, run the project tests (tests/*.spec.ts) once against the new release and report their results with the deploy')
572
576
  .option('--json', 'Print the raw deploy response as JSON on stdout; files left out locally are listed on stderr by path and reason')
573
577
  .option('--allow-type-errors', 'Upload even when the local TypeScript check fails')
574
578
  .option('--timing', 'Print collection, upload, release, activation, and verification timings')
@@ -577,6 +581,10 @@ export function registerDeploy(program) {
577
581
  // start-up cost (runtime boot + module load) before the command ran.
578
582
  const startupMs = performance.now();
579
583
  const targetDir = resolveTargetDir(dir);
584
+ markProcessStart('cli');
585
+ timelineMark('cli:action');
586
+ // --test: the runner is prepared (local only: Playwright, browser check) while the deploy runs.
587
+ const testRunner = opts.test && !opts.dryRun ? prepareDeployTests(() => prepareRunner(targetDir)) : undefined;
580
588
  let typecheckMs = 0;
581
589
  const typecheckStartedAt = performance.now();
582
590
  // Collection, authentication and packaging can proceed while tsc runs.
@@ -1294,6 +1302,10 @@ export function registerDeploy(program) {
1294
1302
  }
1295
1303
  }
1296
1304
  const verificationFailed = verification?.passed === false || Boolean(verificationError);
1305
+ // --test runs only once the release is live and confirmed: never before, never on a failed deploy.
1306
+ const runReleaseTests = () => testRunner && !hasFunctionErrors && !verificationFailed
1307
+ ? runDeployTests({ client, root: deployStateEntry?.dir ?? targetDir, projectId: result.project_id ?? projectId ?? undefined, temporary: Boolean(tempSession), json: Boolean(opts.json), release: result.active_release_id ?? result.release_id, renderPending: postLive.kind === 'timeout', prepared: testRunner })
1308
+ : Promise.resolve(undefined);
1297
1309
  const verificationNextSteps = besideRealLogin ? [
1298
1310
  'Inspect the live URL; keep this project and its claim URL.',
1299
1311
  'After claiming and connecting this project, run: somewhere verify --project <PROJECT>',
@@ -1319,14 +1331,16 @@ export function registerDeploy(program) {
1319
1331
  output.uploaded = inventory;
1320
1332
  if (postLive.kind === 'timeout')
1321
1333
  output.post_live_render = { status: 'pending', note: POST_LIVE_RENDER_STILL_RUNNING };
1322
- printJson(verification || verificationError ? {
1334
+ const tests = await runReleaseTests();
1335
+ printJson(verification || verificationError || tests ? {
1323
1336
  ...output,
1324
1337
  deployment_outcome: 'live',
1325
1338
  ...(verification ? { verification } : {}),
1326
1339
  ...(verificationError ? { verification_error: verificationError } : {}),
1327
1340
  ...(verificationFailed ? { next_steps: verificationNextSteps } : {}),
1341
+ ...(tests ? { tests: { status: tests.status, release: tests.release, ...(tests.reason ? { reason: tests.reason } : {}), summary: formatDeployTestsLine(tests), results: tests.results ?? null } } : {}),
1328
1342
  } : output);
1329
- if (hasFunctionErrors || verificationFailed) {
1343
+ if (hasFunctionErrors || verificationFailed || (tests && tests.status !== 'passed')) {
1330
1344
  process.exit(1);
1331
1345
  }
1332
1346
  return;
@@ -1467,11 +1481,20 @@ export function registerDeploy(program) {
1467
1481
  for (const line of formatVerifyOutput(verification))
1468
1482
  console.log(line);
1469
1483
  }
1484
+ const tests = await runReleaseTests();
1485
+ if (tests) {
1486
+ if (tests.status === 'passed')
1487
+ success(formatDeployTestsLine(tests));
1488
+ else
1489
+ error(formatDeployTestsLine(tests));
1490
+ }
1470
1491
  // Exit non-zero if any function failed to deploy — a CI step that
1471
1492
  // shells out to `somewhere deploy` should fail, not pass green.
1472
1493
  if (hasFunctionErrors) {
1473
1494
  process.exit(1);
1474
1495
  }
1496
+ if (tests && tests.status !== 'passed')
1497
+ process.exit(1);
1475
1498
  if (verificationFailed) {
1476
1499
  warn(verificationError
1477
1500
  ? `The deploy is live, but verification could not finish: ${verificationError.message} [${verificationError.code}]`