@somewhere-cloud/cli 0.38.109 → 0.38.111

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 (168) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -8
  3. package/dist/commands/ai.js +3 -2
  4. package/dist/commands/ai.js.map +1 -1
  5. package/dist/commands/api.js +2 -1
  6. package/dist/commands/api.js.map +1 -1
  7. package/dist/commands/auth.js +16 -15
  8. package/dist/commands/auth.js.map +1 -1
  9. package/dist/commands/browser.js +4 -3
  10. package/dist/commands/browser.js.map +1 -1
  11. package/dist/commands/call.js +6 -5
  12. package/dist/commands/call.js.map +1 -1
  13. package/dist/commands/catalog.js +2 -1
  14. package/dist/commands/catalog.js.map +1 -1
  15. package/dist/commands/check.js +14 -13
  16. package/dist/commands/check.js.map +1 -1
  17. package/dist/commands/claim.js +5 -4
  18. package/dist/commands/claim.js.map +1 -1
  19. package/dist/commands/cron.js +10 -9
  20. package/dist/commands/cron.js.map +1 -1
  21. package/dist/commands/db.js +5 -4
  22. package/dist/commands/db.js.map +1 -1
  23. package/dist/commands/deploy.d.ts +1 -2
  24. package/dist/commands/deploy.js +140 -139
  25. package/dist/commands/deploy.js.map +1 -1
  26. package/dist/commands/dev.js +38 -37
  27. package/dist/commands/dev.js.map +1 -1
  28. package/dist/commands/docs.js +28 -27
  29. package/dist/commands/docs.js.map +1 -1
  30. package/dist/commands/email.js +3 -2
  31. package/dist/commands/email.js.map +1 -1
  32. package/dist/commands/env.js +3 -2
  33. package/dist/commands/env.js.map +1 -1
  34. package/dist/commands/errors.js +2 -1
  35. package/dist/commands/errors.js.map +1 -1
  36. package/dist/commands/feedback.js +2 -1
  37. package/dist/commands/feedback.js.map +1 -1
  38. package/dist/commands/fs.js +2 -1
  39. package/dist/commands/fs.js.map +1 -1
  40. package/dist/commands/git.js +3 -2
  41. package/dist/commands/git.js.map +1 -1
  42. package/dist/commands/hooks.js +2 -1
  43. package/dist/commands/hooks.js.map +1 -1
  44. package/dist/commands/init.js +27 -23
  45. package/dist/commands/init.js.map +1 -1
  46. package/dist/commands/mcp.js +15 -14
  47. package/dist/commands/mcp.js.map +1 -1
  48. package/dist/commands/postgres.js +13 -12
  49. package/dist/commands/postgres.js.map +1 -1
  50. package/dist/commands/project.js +5 -4
  51. package/dist/commands/project.js.map +1 -1
  52. package/dist/commands/promote.js +10 -9
  53. package/dist/commands/promote.js.map +1 -1
  54. package/dist/commands/pull.js +5 -4
  55. package/dist/commands/pull.js.map +1 -1
  56. package/dist/commands/restore.js +5 -4
  57. package/dist/commands/restore.js.map +1 -1
  58. package/dist/commands/rollback.js +7 -3
  59. package/dist/commands/rollback.js.map +1 -1
  60. package/dist/commands/run.js +3 -2
  61. package/dist/commands/run.js.map +1 -1
  62. package/dist/commands/skills.js +3 -2
  63. package/dist/commands/skills.js.map +1 -1
  64. package/dist/commands/support.js +2 -1
  65. package/dist/commands/support.js.map +1 -1
  66. package/dist/commands/tasks.js +4 -3
  67. package/dist/commands/tasks.js.map +1 -1
  68. package/dist/commands/typecheck.d.ts +1 -1
  69. package/dist/commands/typecheck.js +11 -10
  70. package/dist/commands/typecheck.js.map +1 -1
  71. package/dist/commands/update.js +3 -2
  72. package/dist/commands/update.js.map +1 -1
  73. package/dist/commands/upgrade.js +4 -3
  74. package/dist/commands/upgrade.js.map +1 -1
  75. package/dist/commands/verify.js +13 -12
  76. package/dist/commands/verify.js.map +1 -1
  77. package/dist/index.js +6 -5
  78. package/dist/index.js.map +1 -1
  79. package/dist/lib/advisor-runs.js +3 -2
  80. package/dist/lib/advisor-runs.js.map +1 -1
  81. package/dist/lib/agent-hooks.js +4 -3
  82. package/dist/lib/agent-hooks.js.map +1 -1
  83. package/dist/lib/app-test.d.ts +3 -2
  84. package/dist/lib/app-test.js +7 -3
  85. package/dist/lib/app-test.js.map +1 -1
  86. package/dist/lib/browser-run.js +3 -2
  87. package/dist/lib/browser-run.js.map +1 -1
  88. package/dist/lib/claim-handoff.js +3 -2
  89. package/dist/lib/claim-handoff.js.map +1 -1
  90. package/dist/lib/cli-invocation.d.ts +2 -0
  91. package/dist/lib/cli-invocation.js +5 -0
  92. package/dist/lib/cli-invocation.js.map +1 -0
  93. package/dist/lib/client.js +6 -5
  94. package/dist/lib/client.js.map +1 -1
  95. package/dist/lib/config.js +4 -3
  96. package/dist/lib/config.js.map +1 -1
  97. package/dist/lib/device-login.js +4 -3
  98. package/dist/lib/device-login.js.map +1 -1
  99. package/dist/lib/files.js +4 -3
  100. package/dist/lib/files.js.map +1 -1
  101. package/dist/lib/form-auth.d.ts +1 -1
  102. package/dist/lib/form-auth.js +2 -1
  103. package/dist/lib/form-auth.js.map +1 -1
  104. package/dist/lib/frontend-dev.js +6 -2
  105. package/dist/lib/frontend-dev.js.map +1 -1
  106. package/dist/lib/init-agent-guide.d.ts +2 -2
  107. package/dist/lib/init-agent-guide.js +1 -0
  108. package/dist/lib/init-agent-guide.js.map +1 -1
  109. package/dist/lib/init-feature-template.js +1 -0
  110. package/dist/lib/init-feature-template.js.map +1 -1
  111. package/dist/lib/init-features.js +9 -8
  112. package/dist/lib/init-features.js.map +1 -1
  113. package/dist/lib/init-test-template.js +55 -37
  114. package/dist/lib/init-test-template.js.map +1 -1
  115. package/dist/lib/link-hint.js +3 -2
  116. package/dist/lib/link-hint.js.map +1 -1
  117. package/dist/lib/next-actions.js +10 -20
  118. package/dist/lib/next-actions.js.map +1 -1
  119. package/dist/lib/notify/index.d.ts +3 -0
  120. package/dist/lib/notify/index.js +9 -0
  121. package/dist/lib/notify/index.js.map +1 -1
  122. package/dist/lib/notify/providers/update.d.ts +1 -1
  123. package/dist/lib/notify/providers/update.js +4 -3
  124. package/dist/lib/notify/providers/update.js.map +1 -1
  125. package/dist/lib/operational-files.js +2 -1
  126. package/dist/lib/operational-files.js.map +1 -1
  127. package/dist/lib/output.js +2 -1
  128. package/dist/lib/output.js.map +1 -1
  129. package/dist/lib/playwright-fixtures.js +14 -4
  130. package/dist/lib/playwright-fixtures.js.map +1 -1
  131. package/dist/lib/post-live-render.d.ts +1 -1
  132. package/dist/lib/post-live-render.js +2 -1
  133. package/dist/lib/post-live-render.js.map +1 -1
  134. package/dist/lib/preview-jobs.js +3 -2
  135. package/dist/lib/preview-jobs.js.map +1 -1
  136. package/dist/lib/project-pin.js +2 -1
  137. package/dist/lib/project-pin.js.map +1 -1
  138. package/dist/lib/promote-handoff.js +2 -1
  139. package/dist/lib/promote-handoff.js.map +1 -1
  140. package/dist/lib/publish-surface.js +2 -1
  141. package/dist/lib/publish-surface.js.map +1 -1
  142. package/dist/lib/skills-pack.generated.js +4 -4
  143. package/dist/lib/skills-pack.generated.js.map +1 -1
  144. package/dist/lib/skills-pack.js +4 -3
  145. package/dist/lib/skills-pack.js.map +1 -1
  146. package/dist/lib/surface-counts.js +2 -24
  147. package/dist/lib/surface-counts.js.map +1 -1
  148. package/dist/lib/test-control.d.ts +3 -0
  149. package/dist/lib/test-control.js +7 -1
  150. package/dist/lib/test-control.js.map +1 -1
  151. package/dist/lib/test-report.d.ts +3 -1
  152. package/dist/lib/test-report.js +10 -1
  153. package/dist/lib/test-report.js.map +1 -1
  154. package/dist/lib/test-reporter.js +9 -4
  155. package/dist/lib/test-reporter.js.map +1 -1
  156. package/dist/lib/test-run.d.ts +1 -0
  157. package/dist/lib/test-run.js +7 -1
  158. package/dist/lib/test-run.js.map +1 -1
  159. package/dist/lib/test-scripts.d.ts +1 -1
  160. package/dist/lib/test-scripts.js +7 -4
  161. package/dist/lib/test-scripts.js.map +1 -1
  162. package/dist/lib/typecheck.d.ts +3 -4
  163. package/dist/lib/typecheck.js +34 -15
  164. package/dist/lib/typecheck.js.map +1 -1
  165. package/dist/lib/update-security.js +2 -1
  166. package/dist/lib/update-security.js.map +1 -1
  167. package/npm-shrinkwrap.json +2 -2
  168. package/package.json +5 -4
@@ -1,3 +1,4 @@
1
+ import { cliInvocation } from '../lib/cli-invocation.js';
1
2
  import { safeCode, safeInvalid, safeStatus } from '../lib/repro-packet.js';
2
3
  import { preflightBrowserActions } from '../lib/browser-flow-preflight.js';
3
4
  import { randomBytes } from 'node:crypto';
@@ -125,7 +126,7 @@ function undeclaredStatusVerdict(first, all) {
125
126
  + 'Each viewport runs the whole flow as its own browser session against the same live app, at the same time. '
126
127
  + 'One possible cause is a step that creates something unique (an account, a slug) in each viewport, so it conflicts in all but one; '
127
128
  + `verify records failed requests only, so this is not established. If that is the cause, declaring ${first.status} would not fit, because ${others} would not see it: `
128
- + 'run the creating flow in one viewport ("viewports": ["desktop"]), then continue as the same actor with "viewport": "mobile" in a multi-user journey (somewhere verify --schema). '
129
+ + `run the creating flow in one viewport ("viewports": ["desktop"]), then continue as the same actor with "viewport": "mobile" in a multi-user journey (${cliInvocation()} verify --schema). `
129
130
  + `Otherwise the ${first.status} is an app failure to fix.`;
130
131
  }
131
132
  const who = first.initiator === 'eval'
@@ -274,7 +275,7 @@ export function normalizeVerifyFlow(raw, baseDir = process.cwd()) {
274
275
  if (!isRecord(raw))
275
276
  throw new Error('flow must be a JSON object.');
276
277
  if (raw.actors !== undefined || raw.journey !== undefined) {
277
- throw new Error('This is a multi-user flow (actors + journey). Run it with `somewhere verify --project <project> --flow <file>`.');
278
+ throw new Error(`This is a multi-user flow (actors + journey). Run it with \`${cliInvocation()} verify --project <project> --flow <file>\`.`);
278
279
  }
279
280
  const supported = new Set(['actions', 'auth', 'local_storage', 'cookies', 'headers', 'expect_requests', 'visible_only', 'viewports']);
280
281
  const unknown = Object.keys(raw).filter((key) => !supported.has(key));
@@ -310,15 +311,15 @@ function readVerifyFlowFile(absolute, flag) {
310
311
  }
311
312
  catch (cause) {
312
313
  if (cause instanceof Error && 'code' in cause && cause.code === 'ENOENT') {
313
- throw new Error(`Flow file not found. Pass ${flag} <path> with an existing JSON file. Run \`somewhere verify --schema\` for the flow format.`);
314
+ throw new Error(`Flow file not found. Pass ${flag} <path> with an existing JSON file. Run \`${cliInvocation()} verify --schema\` for the flow format.`);
314
315
  }
315
- throw new Error(`Flow file could not be read. Pass ${flag} <path> with a readable JSON file; check its file permissions. Run \`somewhere verify --schema\` for the flow format.`);
316
+ throw new Error(`Flow file could not be read. Pass ${flag} <path> with a readable JSON file; check its file permissions. Run \`${cliInvocation()} verify --schema\` for the flow format.`);
316
317
  }
317
318
  try {
318
319
  return JSON.parse(source);
319
320
  }
320
321
  catch {
321
- throw new Error(`Flow file is not valid JSON. Fix the JSON in the file passed to ${flag}, then rerun. Run \`somewhere verify --schema\` for the flow format.`);
322
+ throw new Error(`Flow file is not valid JSON. Fix the JSON in the file passed to ${flag}, then rerun. Run \`${cliInvocation()} verify --schema\` for the flow format.`);
322
323
  }
323
324
  }
324
325
  export function loadVerifyFlow(path, cwd = process.cwd()) {
@@ -1125,7 +1126,7 @@ export function createVerifyJourneyRun(target, journey, client, opts = {}) {
1125
1126
  throw new Error('Multi-user verification needs --project <project>: every actor signs in to that project, and its browsers stay on its addresses.');
1126
1127
  }
1127
1128
  if (target.url && isLoopbackUrl(target.url)) {
1128
- throw new Error('Multi-user journeys run on the deployed app. Deploy first, then run somewhere verify --project <project> --flow <file>.');
1129
+ throw new Error(`Multi-user journeys run on the deployed app. Deploy first, then run ${cliInvocation()} verify --project <project> --flow <file>.`);
1129
1130
  }
1130
1131
  const createStartedAt = now();
1131
1132
  await createTestUsers();
@@ -1319,7 +1320,7 @@ export function createVerifyJourneyRun(target, journey, client, opts = {}) {
1319
1320
  ...(report.session_expires_at ? { session_expires_at: report.session_expires_at } : {}),
1320
1321
  ...(report.idle_expires_at ? { idle_expires_at: report.idle_expires_at } : {}),
1321
1322
  ...(report.absolute_expires_at ? { absolute_expires_at: report.absolute_expires_at } : {}),
1322
- close: `somewhere call browser '${JSON.stringify({ project_id: target.project_id, session_id: sessionId, close: true })}'`,
1323
+ close: `${cliInvocation()} call browser '${JSON.stringify({ project_id: target.project_id, session_id: sessionId, close: true })}'`,
1323
1324
  });
1324
1325
  }
1325
1326
  segments.push({ ...base, ...timing, ran: true, passed: false, incomplete: capped, ...(report.session_closed === true ? { session_closed: true } : {}), ...(report.final_url ? { final_url: reportUrl(report.final_url) } : {}) });
@@ -1356,7 +1357,7 @@ export function createVerifyJourneyRun(target, journey, client, opts = {}) {
1356
1357
  ...(report.session_expires_at ? { session_expires_at: report.session_expires_at } : {}),
1357
1358
  ...(report.idle_expires_at ? { idle_expires_at: report.idle_expires_at } : {}),
1358
1359
  ...(report.absolute_expires_at ? { absolute_expires_at: report.absolute_expires_at } : {}),
1359
- close: 'somewhere verify --flow <this flow> --close-actors',
1360
+ close: `${cliInvocation()} verify --flow <this flow> --close-actors`,
1360
1361
  });
1361
1362
  }
1362
1363
  }
@@ -1480,7 +1481,7 @@ export function verifyFlowSchema() {
1480
1481
  };
1481
1482
  return {
1482
1483
  $schema: 'https://json-schema.org/draft/2020-12/schema',
1483
- title: 'somewhere verify --flow',
1484
+ title: `${cliInvocation()} verify --flow`,
1484
1485
  oneOf: [
1485
1486
  {
1486
1487
  title: 'One user',
@@ -1739,7 +1740,7 @@ Save that object as flow.json, then pass --flow flow.json.
1739
1740
  Each viewport runs every action as its own browser session, at the same time,
1740
1741
  against the same live app, so a step that signs up or creates a unique record
1741
1742
  runs once per viewport. Create it in one viewport, or use the journey below.
1742
- For the complete flow and action schema, run: somewhere docs browser
1743
+ For the complete flow and action schema, run: ${cliInvocation()} docs browser
1743
1744
 
1744
1745
  Several users in one run (--project required; each actor is its own browser):
1745
1746
  {
@@ -1762,7 +1763,7 @@ every actor browser is closed within ${VERIFY_JOURNEY_LIMITS.cleanup_budget_ms /
1762
1763
  confirmed is reported, and the platform closes idle browsers within 5 minutes.
1763
1764
  Several users need a claimed account and a CLI login approved for all your
1764
1765
  projects: a login approved for "Only these projects" cannot open named browsers
1765
- (SESSION_SCOPE_FORBIDDEN). Print the full flow schema with: somewhere verify --schema
1766
+ (SESSION_SCOPE_FORBIDDEN). Print the full flow schema with: ${cliInvocation()} verify --schema
1766
1767
  `)
1767
1768
  .action(async (target, opts) => {
1768
1769
  if (opts.schema) {
@@ -1995,7 +1996,7 @@ projects: a login approved for "Only these projects" cannot open named browsers
1995
1996
  }
1996
1997
  if (cause instanceof CliApiError) {
1997
1998
  if (cause.code === 'BROWSER_ORIGIN_NOT_AUTHORIZED') {
1998
- error(`${cause.message} ${dim(`[${cause.code}${cause.statusCode ? `, HTTP ${cause.statusCode}` : ''}]`)} To drive an app you own, rerun with --project <your-project-id> (for example: somewhere verify --project <your-project-id> --url <your-app-url> --flow flow.json).`, cause);
1999
+ error(`${cause.message} ${dim(`[${cause.code}${cause.statusCode ? `, HTTP ${cause.statusCode}` : ''}]`)} To drive an app you own, rerun with --project <your-project-id> (for example: ${cliInvocation()} verify --project <your-project-id> --url <your-app-url> --flow flow.json).`, cause);
1999
2000
  }
2000
2001
  else {
2001
2002
  error(`${cause.message} ${dim(`[${cause.code}${cause.statusCode ? `, HTTP ${cause.statusCode}` : ''}]`)}`, cause);