@somewhere-cloud/cli 0.38.165 → 0.38.167

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.167
4
+
5
+ - Updates local checks for public settings to match the platform.
6
+
7
+ ## 0.38.166
8
+
9
+ - New projects include a signed-in check list. Run it with `somewhere test --only checks/signed-in.json`.
10
+ - `somewhere db tables` shows how to declare tables when an app has no schema.
11
+ - `somewhere deploy` lists missing project settings and points to matching entries in your local `.env` file without printing their values.
12
+
3
13
  ## 0.38.165
4
14
 
5
15
  - `somewhere deploy --project <app>` from a folder that never deployed or pulled that app no longer replaces it when it is live. The deploy stops, and the message says to run `somewhere pull <app>`, or `--force --yes` to replace the app on purpose. The first deploy of a new or unpublished app, redeploys from the folder that deployed it, deploys after `somewhere pull`, and clones that include `.somewhere.json` work as before.
@@ -42934,7 +42934,7 @@ function nextActions(ctx) {
42934
42934
  }
42935
42935
  ];
42936
42936
  case "deploy": {
42937
- const test2 = { command: `${cliInvocation()} test`, why: "journeys, several users and access rules: your tests/*.mjs" };
42937
+ const test2 = { command: `${cliInvocation()} test`, why: "runs your checks/*.json check lists as test users, plus the platform checks" };
42938
42938
  if (ctx.temporary)
42939
42939
  return ctx.liveUrl ? [seeItByUrl(ctx.liveUrl)] : [];
42940
42940
  if (ctx.projectLinked)
@@ -44271,18 +44271,28 @@ Use \`client.intake\` for public submissions to a private parent row. See
44271
44271
 
44272
44272
  ### Run and verify
44273
44273
 
44274
- On a test app, run \`somewhere test-users prepare <name>\`. Pass multiple
44275
- names in the same command to prepare several actors. Use
44276
- \`somewhere data list <table> --as <name>\` and
44277
- \`somewhere data create <table> --as <name> --values '<json>'\` to check
44278
- the table's client access. Run \`somewhere cron run <name> --wait\` for a
44279
- schedule, \`somewhere db rows <table>\` to inspect the stored rows, and
44280
- \`somewhere errors\` to see recent failures. Finish with
44281
- \`somewhere test-users cleanup\`.
44274
+ Prove the brief with a check list in \`checks/<name>.json\` and run \`somewhere test\`. The platform makes the named users itself (no sign-up form, browser or contract digest), runs each step on the live app as that user, prints PASS or FAIL per step with the expected and actual answer and the request ID, then deletes the users and the rows it can prove it created, naming anything it leaves. The list reruns after every deploy if it only reads, or if it sets \`"rerun_after_deploy": true\`.
44275
+
44276
+ \`\`\`json
44277
+ {
44278
+ "users": ["owner", "member", { "name": "carol", "roles": ["staff"] }],
44279
+ "steps": [
44280
+ { "as": "owner", "post": "/api/teams", "body": { "name": "T" }, "expect": 201, "save": { "team": "id" } },
44281
+ { "as": "owner", "post": "/api/teams/{team}/members", "body": { "email": "{member.email}" } },
44282
+ { "as": "member", "data": { "table": "tasks", "operation": "create", "values": { "team_id": "{team}", "title": "x" } }, "save": { "task": "id" } },
44283
+ { "as": "carol", "delete": "/api/tasks/{task}", "expect": [403, 404] },
44284
+ { "as": "signed_out", "get": "/api/teams/{team}/tasks", "expect": 401, "lacks": "{member.email}" },
44285
+ { "run": "daily-summary" }
44286
+ ],
44287
+ "cleanup": [{ "as": "owner", "delete": "/api/teams/{team}" }]
44288
+ }
44289
+ \`\`\`
44282
44290
 
44283
- Run \`somewhere typecheck\` and focused tests. \`somewhere deploy-check\` checks compilation and schema without publishing. \`somewhere deploy\` uploads raw source directly to production. When testing changes with real users or data, use \`somewhere preview\`, test with \`somewhere test --preview\`, then promote. See \`somewhere docs dev-environments\`.
44291
+ - A step is \`as\` (a name from \`users\`, or \`signed_out\`) and one of: \`get\`, \`post\`, \`put\`, \`patch\` or \`delete\` with a path (and \`body\`); \`data\` with the data endpoint's request (\`table\`, \`operation\`, \`values\`, \`id\`, \`where\`); or \`run\` with a schedule name, which runs it now and waits for its job.
44292
+ - \`expect\` is a status or a list of them (default: any 2xx). \`has\` and \`lacks\` take text; \`has_fields\` and \`lacks_fields\` take JSON field names. \`save\` keeps a field of the answer (of the row, for \`data\`) as \`{name}\` for later steps. \`wait: 10\` retries the step for up to 10 seconds.
44293
+ - \`{alice.email}\` and \`{alice.id}\` are each user's address and ID. \`roles\` gives roles your schema declares \`assignedBy: 'server'\`. Up to 6 users and 60 steps per list. \`cleanup\` steps run last, even after a failure. \`wait\` retries only reads. A failing step's output from a run you start can show data from the app; stored results keep only the step, status, request ID and failed expectation.
44284
44294
 
44285
- Save journeys in \`checks/<name>.json\`, using \`checks/add-a-note.json\` from the notes starter as a model. Keep test IDs when restyling and click the item a person would use. Set \`"signed_in": true\` for a test user and \`"viewports": ["desktop", "mobile"]\` to check both sizes. Saved checks run after deploy. Use \`somewhere test\` to rerun them and \`somewhere verify --flow flow.json\` for a focused journey. For shared access, test the owner, a recipient and an unrelated user separately. The team fixture is in \`somewhere docs sw.groups --section team-example\`. For schedules, trigger \`somewhere cron run <id> --wait\` before asserting its effects. Inspect failures with \`somewhere errors\` and \`somewhere logs\`.
44295
+ Run \`somewhere typecheck\` before deploying. \`somewhere deploy-check\` checks compilation and schema without publishing. \`somewhere deploy\` uploads raw source directly to production. When testing changes with real users or data, use \`somewhere preview\`, test with \`somewhere test --preview\`, then promote. See \`somewhere docs dev-environments\`. Inspect failures with \`somewhere errors\` and \`somewhere logs\`. For a check that needs a rendered page, save a browser flow with \`actions\` in \`checks/<name>.json\`, using \`checks/add-a-note.json\` from the notes starter as a model. Keep test IDs when restyling. See \`somewhere docs test\`.
44286
44296
 
44287
44297
  Use \`somewhere docs <topic> --section <id>\` for one section or \`--full\` for all examples. Ask before destructive or paid actions unless the user already authorized them.
44288
44298
  `;
@@ -44322,7 +44332,7 @@ ${PREVIEW_POINTER}
44322
44332
  function starterChecks(options2 = {}) {
44323
44333
  return options2.privateData ? [{ path: "checks/add-a-note.json", content: JSON.stringify(ADD_A_NOTE, null, 2) + "\n" }] : [];
44324
44334
  }
44325
- var ADD_A_NOTE, STARTER_AUTH_TEST;
44335
+ var ADD_A_NOTE, STARTER_CHECK_LIST, STARTER_AUTH_TEST;
44326
44336
  var init_init_test_template = __esm({
44327
44337
  "dist/lib/init-test-template.js"() {
44328
44338
  "use strict";
@@ -44336,6 +44346,17 @@ var init_init_test_template = __esm({
44336
44346
  signed_in: true
44337
44347
  };
44338
44348
  __name(starterChecks, "starterChecks");
44349
+ STARTER_CHECK_LIST = {
44350
+ path: "checks/signed-in.json",
44351
+ content: `{
44352
+ "users": ["ana"],
44353
+ "steps": [
44354
+ { "as": "ana", "get": "/api/auth/me", "has": "{ana.email}" },
44355
+ { "as": "signed_out", "get": "/api/auth/me", "lacks": "{ana.email}" }
44356
+ ]
44357
+ }
44358
+ `
44359
+ };
44339
44360
  STARTER_AUTH_TEST = {
44340
44361
  path: "tests/starter.mjs",
44341
44362
  content: `import assert from 'node:assert/strict';
@@ -44488,6 +44509,7 @@ declare module '*.${ext}' {
44488
44509
  function createGreenTemplate(appName = "somewhere-starter") {
44489
44510
  return [
44490
44511
  { path: ".gitignore", content: buildScaffoldGitignore() },
44512
+ STARTER_CHECK_LIST,
44491
44513
  STARTER_AUTH_TEST,
44492
44514
  { path: "AGENTS.md", content: INIT_AGENTS_MD },
44493
44515
  { path: "CLAUDE.md", content: INIT_CLAUDE_MD },
@@ -48737,6 +48759,7 @@ function createFeatureTemplate(selection, options2) {
48737
48759
  const files = [
48738
48760
  ...starterChecks({ privateData }),
48739
48761
  { path: ".gitignore", content: buildScaffoldGitignore() },
48762
+ STARTER_CHECK_LIST,
48740
48763
  STARTER_AUTH_TEST,
48741
48764
  { path: "AGENTS.md", content: INIT_AGENTS_MD },
48742
48765
  { path: "CLAUDE.md", content: INIT_CLAUDE_MD },
@@ -74903,7 +74926,7 @@ function runTypecheck(projectDir, options2 = {}) {
74903
74926
  ensureDeclaredTypePackages(projectDir, options2.installTypePackages);
74904
74927
  }
74905
74928
  const { command, args, via } = resolveTsc(projectDir);
74906
- return runTypecheckWith(projectDir, command, args, via, declaredData).then(withContract);
74929
+ return runTypecheckWith(projectDir, command, args, via, declaredData, options2.deploy === true).then(withContract);
74907
74930
  }
74908
74931
  function announceNpxTypeScriptFetch(version2) {
74909
74932
  process.stderr.write(`TypeScript is not installed in this project; fetching typescript@${version2} with npx (needs the npm registry; npm keeps it in its cache). Nothing is installed into the project. To skip this fetch on every check: npm install -D typescript@${version2}
@@ -74912,10 +74935,13 @@ function announceNpxTypeScriptFetch(version2) {
74912
74935
  function typecheckCompilerSource(projectDir) {
74913
74936
  return resolveTsc(projectDir).via;
74914
74937
  }
74915
- async function runTypecheckWith(projectDir, command, args, via, declaredData) {
74938
+ async function runTypecheckWith(projectDir, command, args, via, declaredData, deploy) {
74916
74939
  const fullArgs = typecheckArgs(args);
74917
74940
  let overlay;
74918
- if (declaredData) {
74941
+ const foreignDirectories = deploy ? ["supabase/functions/", "netlify/functions/", ".netlify/functions/", ".vercel/"].filter((path3) => existsSync12(join13(projectDir, path3))) : [];
74942
+ const viteClient = "node_modules/vite/client.d.ts";
74943
+ const viteTypes = deploy && existsSync12(join13(projectDir, viteClient)) ? [viteClient] : [];
74944
+ if (declaredData || foreignDirectories.length || viteTypes.length) {
74919
74945
  const config2 = await runBounded(command, [...args, "--project", SCAFFOLD_TSCONFIG_FILENAME, "--showConfig"], projectDir);
74920
74946
  if (config2.timedOut)
74921
74947
  return { ok: false, errors: [], via, raw: config2.out, spawnError: timedOutMessage(via, config2) };
@@ -74937,10 +74963,11 @@ async function runTypecheckWith(projectDir, command, args, via, declaredData) {
74937
74963
  writeFileSync10(overlay, JSON.stringify({
74938
74964
  extends: "./" + SCAFFOLD_TSCONFIG_FILENAME,
74939
74965
  files: [.../* @__PURE__ */ new Set([
74940
- ...parsed.files,
74941
- relative3(projectDir, declaredData.declarationPath),
74942
- ...declaredData.filesDeclarationPath ? [relative3(projectDir, declaredData.filesDeclarationPath)] : [],
74943
- ...declaredData.schemaPath ? [relative3(projectDir, declaredData.schemaPath)] : []
74966
+ ...parsed.files.filter((file) => !foreignDirectories.some((dir) => file.replaceAll("\\", "/").replace(/^\.\//, "").startsWith(dir))),
74967
+ ...viteTypes,
74968
+ ...declaredData ? [relative3(projectDir, declaredData.declarationPath)] : [],
74969
+ ...declaredData?.filesDeclarationPath ? [relative3(projectDir, declaredData.filesDeclarationPath)] : [],
74970
+ ...declaredData?.schemaPath ? [relative3(projectDir, declaredData.schemaPath)] : []
74944
74971
  ])],
74945
74972
  include: [],
74946
74973
  exclude: []
@@ -78256,7 +78283,7 @@ async function runChecksNow(client, projectId, opts = {}) {
78256
78283
  if (!opts.again && opts.only === void 0) {
78257
78284
  const read = `GET /v1/deploy/log?project_id=${encodeURIComponent(projectId)}`;
78258
78285
  const stored = await awaitDeployChecks(client, { read }, { ...opts, readStored: true });
78259
- if (stored)
78286
+ if (stored && !stored.not_checked?.lists_not_rerun?.length)
78260
78287
  return stored;
78261
78288
  }
78262
78289
  let firstDelayMs = 0;
@@ -78396,7 +78423,7 @@ function formatChecksReport(check) {
78396
78423
  } else {
78397
78424
  lines.push("Coverage details are unavailable for this run.");
78398
78425
  }
78399
- lines.push("For your own app tests, use @somewhere-cloud/cli/testing. See somewhere docs test.");
78426
+ lines.push("Prove the brief with a check list in checks/<name>.json (users and steps). See somewhere docs test.");
78400
78427
  return [...lines, JSON.stringify({
78401
78428
  ...summary,
78402
78429
  not_checked: coverage,
@@ -84103,7 +84130,7 @@ var init_verify = __esm({
84103
84130
  });
84104
84131
 
84105
84132
  // dist/commands/deploy.js
84106
- import { existsSync as existsSync29 } from "node:fs";
84133
+ import { existsSync as existsSync29, readFileSync as readFileSync30 } from "node:fs";
84107
84134
  import { join as join34 } from "node:path";
84108
84135
  import { basename as basename5, resolve as resolve16 } from "node:path";
84109
84136
  function resolveTargetDir(dir, cwd = process.cwd()) {
@@ -84529,7 +84556,7 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84529
84556
  process.stderr.write(`Still checking types before upload after ${formatDeployElapsed(performance.now() - typecheckStartedAt)}...
84530
84557
  `);
84531
84558
  }, deployHeartbeatMs()).unref() : void 0;
84532
- const typecheck = checkingTypes ? runTypecheck(targetDir).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
84559
+ const typecheck = checkingTypes ? runTypecheck(targetDir, { deploy: true }).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
84533
84560
  clearInterval(typecheckHeartbeat);
84534
84561
  typecheckMs = performance.now() - typecheckStartedAt;
84535
84562
  }) : Promise.resolve(null);
@@ -84979,6 +85006,8 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84979
85006
  saveProjectAppUrl(deployStateEntry.dir, deployStateEntry.config.project_id, httpsOrigin(result.url));
84980
85007
  }
84981
85008
  }
85009
+ result.warnings = result.warnings?.map((warning) => withLocalEnvHint(warning, targetDir));
85010
+ result.build_log = result.build_log?.map((line) => line.startsWith("warning: ") ? `warning: ${withLocalEnvHint(line.slice("warning: ".length), targetDir)}` : line);
84982
85011
  const formatted = formatDeploySuccess(result, {
84983
85012
  scope,
84984
85013
  functionCount: countFunctionRoutes(functions),
@@ -85120,7 +85149,7 @@ ${dim("Build")}`);
85120
85149
  }
85121
85150
  }
85122
85151
  if (!tempSession) {
85123
- if (formatted.liveUrl) {
85152
+ if (formatted.liveUrl && !result.warnings?.some(missingSetting)) {
85124
85153
  success(`Live at ${teal(formatted.liveUrl)}`);
85125
85154
  } else {
85126
85155
  success(formatted.liveMessage);
@@ -85370,15 +85399,32 @@ function formatDeploySuccess(result, options2) {
85370
85399
  const linkedSubdomain = typeof options2.linkedProject?.subdomain === "string" ? options2.linkedProject.subdomain.trim() : "";
85371
85400
  const subdomain = result.project_id && result.project_id === options2.linkedProject?.project_id && linkedSubdomain ? linkedSubdomain : null;
85372
85401
  const liveUrl = responseUrl ?? (subdomain && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(subdomain) ? `https://${subdomain}.${PROJECT_SITE_DOMAIN2}` : null);
85402
+ const missing = result.warnings?.filter(missingSetting).length ?? 0;
85373
85403
  return {
85374
85404
  staticFileCount,
85375
85405
  headline,
85376
85406
  projectRef: typeof result.project_id === "string" && result.project_id.trim() ? result.project_id.trim() : null,
85377
85407
  liveUrl,
85378
85408
  // Only an older platform omits the URL; name the command that shows it.
85379
- liveMessage: liveUrl ? `Live at ${liveUrl}` : `Deployed. The platform did not report the live URL; \`${cliInvocation()} project view ${typeof result.project_id === "string" && result.project_id.trim() ? result.project_id.trim() : "<project>"}\` shows it.`
85409
+ liveMessage: missing ? `Live, but ${missing} ${missing === 1 ? "setting is" : "settings are"} missing${liveUrl ? ` (${liveUrl})` : ""}` : liveUrl ? `Live at ${liveUrl}` : `Deployed. The platform did not report the live URL; \`${cliInvocation()} project view ${typeof result.project_id === "string" && result.project_id.trim() ? result.project_id.trim() : "<project>"}\` shows it.`
85380
85410
  };
85381
85411
  }
85412
+ function missingSetting(warning) {
85413
+ return /^Missing (?:public|server) setting ([A-Za-z_][A-Za-z0-9_]*)\./.exec(warning)?.[1];
85414
+ }
85415
+ function withLocalEnvHint(warning, dir) {
85416
+ const key = missingSetting(warning);
85417
+ if (!key)
85418
+ return warning;
85419
+ try {
85420
+ const source = readFileSync30(join34(dir, ".env"), "utf8");
85421
+ if (new RegExp(`^\\s*(?:export\\s+)?${key}\\s*=`, "m").test(source)) {
85422
+ return `${warning} Copy ${key} from your local .env file.`;
85423
+ }
85424
+ } catch {
85425
+ }
85426
+ return warning;
85427
+ }
85382
85428
  function normalizeWarning(value) {
85383
85429
  return value.replace(/^warning:\s*/i, "").trim();
85384
85430
  }
@@ -85739,6 +85785,8 @@ var init_deploy = __esm({
85739
85785
  PROJECT_SITE_DOMAIN2 = "somewhere.site";
85740
85786
  __name(linkedProjectWithSubdomain, "linkedProjectWithSubdomain");
85741
85787
  __name(formatDeploySuccess, "formatDeploySuccess");
85788
+ __name(missingSetting, "missingSetting");
85789
+ __name(withLocalEnvHint, "withLocalEnvHint");
85742
85790
  __name(normalizeWarning, "normalizeWarning");
85743
85791
  __name(warningsInBuildLog, "warningsInBuildLog");
85744
85792
  retriedAfterTransportFailure = /* @__PURE__ */ new WeakMap();
@@ -85848,7 +85896,7 @@ var init_deploys = __esm({
85848
85896
  });
85849
85897
 
85850
85898
  // dist/commands/pull.js
85851
- import { existsSync as existsSync30, lstatSync as lstatSync4, mkdirSync as mkdirSync15, readFileSync as readFileSync30, readdirSync as readdirSync7, rmSync as rmSync12, writeFileSync as writeFileSync19 } from "node:fs";
85899
+ import { existsSync as existsSync30, lstatSync as lstatSync4, mkdirSync as mkdirSync15, readFileSync as readFileSync31, readdirSync as readdirSync7, rmSync as rmSync12, writeFileSync as writeFileSync19 } from "node:fs";
85852
85900
  import { basename as basename6, dirname as dirname12, join as join35, relative as relative10, resolve as resolve17 } from "node:path";
85853
85901
  function registerPull(program2) {
85854
85902
  program2.command("pull [project]").description(`Download a project's deployed source files to the current directory. Scaffolds a tsconfig.json + package.json (only if absent) so \`${cliInvocation()} typecheck\` can catch undefined symbols locally before you deploy. In a linked folder, plain pull is the safe update when live is newer: files you have not edited move to the live version, your local edits and local-only files (AGENTS.md, notes, tests) are kept, and it stops without writing anything if a file changed both here and live.`).option("--env <env>", "Environment to pull from (dev or prod)", "prod").option("--out <dir>", "Output directory", ".").option("--force", "Also replace files you edited here with live, and delete published files you edited that live no longer has. Never deletes a file a deploy would not upload (AGENTS.md, CLAUDE.md, README.md, tests, dotfiles, .somewhereignore matches)").option("--json", "Print the raw source response as JSON").action(async (projectArg, opts) => {
@@ -85933,7 +85981,7 @@ function registerPull(program2) {
85933
85981
  const target = join35(outDir, path3);
85934
85982
  if (!existsSync30(target))
85935
85983
  continue;
85936
- const local = readFileSync30(target);
85984
+ const local = readFileSync31(target);
85937
85985
  if (local.equals(contents))
85938
85986
  continue;
85939
85987
  if (opts.force) {
@@ -86067,7 +86115,7 @@ function reconcileRemovedFiles(outDir, expected, force, base = null) {
86067
86115
  const was = base?.files[relPath];
86068
86116
  if (base && was === void 0)
86069
86117
  continue;
86070
- const unedited = was !== void 0 && was === sha2562(readFileSync30(fullPath));
86118
+ const unedited = was !== void 0 && was === sha2562(readFileSync31(fullPath));
86071
86119
  if (!force && !unedited) {
86072
86120
  skipped.push(relPath);
86073
86121
  continue;
@@ -87182,11 +87230,14 @@ function registerDb(program2) {
87182
87230
  return;
87183
87231
  }
87184
87232
  const rows = (r.tables ?? []).map((t) => typeof t === "string" ? { name: t } : t);
87185
- if (!rows.length) {
87186
- info(dim(`No tables yet. Create one with \`${cliInvocation()} db query "CREATE TABLE \u2026"\`.`));
87187
- return;
87233
+ if (rows.length) {
87234
+ table(["Table", "Rows"], rows.map((t) => [teal(t.name), t.row_count != null ? String(t.row_count) : dim("\u2014")]));
87235
+ } else {
87236
+ info(dim("No tables yet."));
87188
87237
  }
87189
- table(["Table", "Rows"], rows.map((t) => [teal(t.name), t.row_count != null ? String(t.row_count) : dim("\u2014")]));
87238
+ const hint = r.hint ?? (rows.length ? void 0 : "To add declared tables, define them in db/schema.ts and deploy.");
87239
+ if (hint)
87240
+ info(dim(hint));
87190
87241
  } catch (err) {
87191
87242
  error(err instanceof Error ? err.message : String(err), err);
87192
87243
  process.exit(1);
@@ -87211,7 +87262,7 @@ var init_db = __esm({
87211
87262
  });
87212
87263
 
87213
87264
  // dist/commands/postgres.js
87214
- import { readFileSync as readFileSync31 } from "node:fs";
87265
+ import { readFileSync as readFileSync32 } from "node:fs";
87215
87266
  function str(value) {
87216
87267
  return typeof value === "string" && value.length > 0 ? value : null;
87217
87268
  }
@@ -87220,7 +87271,7 @@ async function readNeonApiKey() {
87220
87271
  if (fromEnv)
87221
87272
  return fromEnv;
87222
87273
  if (!process.stdin.isTTY) {
87223
- return readFileSync31(0, "utf8").trim();
87274
+ return readFileSync32(0, "utf8").trim();
87224
87275
  }
87225
87276
  const response = await (0, import_prompts8.default)({
87226
87277
  type: "password",
@@ -87549,18 +87600,18 @@ var init_postgres = __esm({
87549
87600
  });
87550
87601
 
87551
87602
  // dist/lib/local-docs.js
87552
- import { appendFileSync as appendFileSync3, existsSync as existsSync31, lstatSync as lstatSync5, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync3, readFileSync as readFileSync32, renameSync as renameSync5, rmSync as rmSync13, writeFileSync as writeFileSync21 } from "node:fs";
87603
+ import { appendFileSync as appendFileSync3, existsSync as existsSync31, lstatSync as lstatSync5, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync3, readFileSync as readFileSync33, renameSync as renameSync5, rmSync as rmSync13, writeFileSync as writeFileSync21 } from "node:fs";
87553
87604
  import { join as join37 } from "node:path";
87554
87605
  function localDocsVersion(root = process.cwd()) {
87555
87606
  const path3 = join37(root, FOLDER, DOCS, STAMP);
87556
87607
  if (!existsSync31(path3))
87557
87608
  return void 0;
87558
- const stamp2 = JSON.parse(readFileSync32(path3, "utf8"));
87609
+ const stamp2 = JSON.parse(readFileSync33(path3, "utf8"));
87559
87610
  return typeof stamp2.version === "string" && /^[a-f0-9]{16}$/.test(stamp2.version) ? stamp2.version : void 0;
87560
87611
  }
87561
87612
  function ensureGitIgnore(root) {
87562
87613
  const path3 = join37(root, ".gitignore");
87563
- const text = existsSync31(path3) ? readFileSync32(path3, "utf8") : "";
87614
+ const text = existsSync31(path3) ? readFileSync33(path3, "utf8") : "";
87564
87615
  if (text.split(/\r?\n/).some((line) => line === ".somewhere/" || line === "/.somewhere/"))
87565
87616
  return;
87566
87617
  appendFileSync3(path3, `${text && !text.endsWith("\n") ? "\n" : ""}/.somewhere/
@@ -87617,7 +87668,7 @@ var init_local_docs = __esm({
87617
87668
  });
87618
87669
 
87619
87670
  // dist/lib/advisor-context.js
87620
- import { readFileSync as readFileSync33, statSync as statSync6 } from "node:fs";
87671
+ import { readFileSync as readFileSync34, statSync as statSync6 } from "node:fs";
87621
87672
  import { basename as basename8 } from "node:path";
87622
87673
  function tail(value, limit) {
87623
87674
  return value.length <= limit ? value : `\u2026${value.slice(-limit)}`;
@@ -87639,7 +87690,7 @@ function buildAdvisorContext(filePath) {
87639
87690
  const stat6 = statSync6(filePath);
87640
87691
  if (!stat6.isFile())
87641
87692
  throw new Error("--file must name a regular file.");
87642
- const content = readFileSync33(filePath, "utf8");
87693
+ const content = readFileSync34(filePath, "utf8");
87643
87694
  context.file = {
87644
87695
  path: filePath,
87645
87696
  content: tail(redactAdvisorText(content, isDotenvPath(filePath)), FILE_LIMIT)
@@ -87665,7 +87716,7 @@ var init_advisor_context = __esm({
87665
87716
 
87666
87717
  // dist/lib/advisor-runs.js
87667
87718
  import { randomBytes as randomBytes7, randomUUID as randomUUID8 } from "node:crypto";
87668
- import { chmodSync as chmodSync4, existsSync as existsSync32, mkdirSync as mkdirSync17, readFileSync as readFileSync34, renameSync as renameSync6, writeFileSync as writeFileSync22 } from "node:fs";
87719
+ import { chmodSync as chmodSync4, existsSync as existsSync32, mkdirSync as mkdirSync17, readFileSync as readFileSync35, renameSync as renameSync6, writeFileSync as writeFileSync22 } from "node:fs";
87669
87720
  import { join as join38 } from "node:path";
87670
87721
  function path2(id) {
87671
87722
  if (!/^[a-f0-9-]{36}$/i.test(id))
@@ -87702,7 +87753,7 @@ function expiredResult(record3) {
87702
87753
  function load(id) {
87703
87754
  if (!existsSync32(path2(id)))
87704
87755
  throw Error("Advisor request was not found in this CLI configuration.");
87705
- const record3 = JSON.parse(readFileSync34(path2(id), "utf8"));
87756
+ const record3 = JSON.parse(readFileSync35(path2(id), "utf8"));
87706
87757
  prune(record3);
87707
87758
  save(record3);
87708
87759
  return record3;
@@ -87826,7 +87877,7 @@ var init_advisor_runs = __esm({
87826
87877
 
87827
87878
  // dist/lib/advisor-app.js
87828
87879
  import { createHash as createHash8 } from "node:crypto";
87829
- import { existsSync as existsSync33, mkdirSync as mkdirSync18, readFileSync as readFileSync35, rmSync as rmSync14, writeFileSync as writeFileSync23 } from "node:fs";
87880
+ import { existsSync as existsSync33, mkdirSync as mkdirSync18, readFileSync as readFileSync36, rmSync as rmSync14, writeFileSync as writeFileSync23 } from "node:fs";
87830
87881
  import { join as join39 } from "node:path";
87831
87882
  async function gatherAdvisorApp(client, ref) {
87832
87883
  const project = await client.call("GET", `/projects/${encodeURIComponent(ref)}`);
@@ -87861,7 +87912,7 @@ async function gatherAdvisorApp(client, ref) {
87861
87912
  }
87862
87913
  function loadAdvisorTurns(dir, projectId, account, now2 = Date.now()) {
87863
87914
  try {
87864
- const saved = JSON.parse(readFileSync35(join39(dir, FILE), "utf8"));
87915
+ const saved = JSON.parse(readFileSync36(join39(dir, FILE), "utf8"));
87865
87916
  if (saved.project_id !== projectId || saved.owner !== ownerOf(account) || !Array.isArray(saved.turns))
87866
87917
  return [];
87867
87918
  const last = saved.turns.at(-1);
@@ -87886,7 +87937,7 @@ function ensureAdvisorStateIgnored(dir) {
87886
87937
  writeFileSync23(path3, "# somewhere: local CLI state (Advisor follow-ups, test users)\n.somewhere/\n");
87887
87938
  return;
87888
87939
  }
87889
- const text = readFileSync35(path3, "utf8");
87940
+ const text = readFileSync36(path3, "utf8");
87890
87941
  if (text.split(/\r?\n/).map((l) => l.trim()).some((l) => covered.includes(l)))
87891
87942
  return;
87892
87943
  writeFileSync23(path3, `${text}${text.endsWith("\n") || !text ? "" : "\n"}
@@ -89314,7 +89365,7 @@ var init_envfile_write = __esm({
89314
89365
  });
89315
89366
 
89316
89367
  // dist/commands/env.js
89317
- import { existsSync as existsSync34, readFileSync as readFileSync36, writeFileSync as writeFileSync24 } from "node:fs";
89368
+ import { existsSync as existsSync34, readFileSync as readFileSync37, writeFileSync as writeFileSync24 } from "node:fs";
89318
89369
  import { resolve as resolve19 } from "node:path";
89319
89370
  function resolveProjectId(explicit) {
89320
89371
  if (explicit)
@@ -89396,7 +89447,7 @@ function registerEnv(program2) {
89396
89447
  process.exit(1);
89397
89448
  }
89398
89449
  if (existsSync34(outPath) && !opts.force) {
89399
- const existing = readFileSync36(outPath, "utf-8");
89450
+ const existing = readFileSync37(outPath, "utf-8");
89400
89451
  const hasValues = existing.split("\n").some((l) => /^[^#=]+=.+/.test(l.trim()));
89401
89452
  const { ok } = await (0, import_prompts9.default)({
89402
89453
  type: "confirm",
@@ -89449,7 +89500,7 @@ function registerEnv(program2) {
89449
89500
  if (inputNote && !opts.json)
89450
89501
  process.stderr.write(`Note: ${inputNote}
89451
89502
  `);
89452
- const value = opts.stdin ? readFileSync36(0, "utf8").replace(/\r?\n$/, "") : positionalValue;
89503
+ const value = opts.stdin ? readFileSync37(0, "utf8").replace(/\r?\n$/, "") : positionalValue;
89453
89504
  const client = new ApiClient(getToken());
89454
89505
  const pid = resolveProjectId(opts.project);
89455
89506
  try {
@@ -89519,7 +89570,7 @@ var init_env = __esm({
89519
89570
  });
89520
89571
 
89521
89572
  // dist/commands/run.js
89522
- import { existsSync as existsSync35, readFileSync as readFileSync37 } from "node:fs";
89573
+ import { existsSync as existsSync35, readFileSync as readFileSync38 } from "node:fs";
89523
89574
  import { isAbsolute as isAbsolute6, resolve as resolve20 } from "node:path";
89524
89575
  import { createRequire as createRequire8 } from "node:module";
89525
89576
  function parseArgs(values) {
@@ -89590,7 +89641,7 @@ function registerRun(program2) {
89590
89641
  error(`File not found: ${script}`);
89591
89642
  process.exit(1);
89592
89643
  }
89593
- const code = readFileSync37(absPath, "utf-8");
89644
+ const code = readFileSync38(absPath, "utf-8");
89594
89645
  if (!code.trim()) {
89595
89646
  error(`${script} is empty \u2014 nothing to run.`);
89596
89647
  process.exit(1);
@@ -90269,7 +90320,7 @@ var init_preview_jobs = __esm({
90269
90320
 
90270
90321
  // dist/commands/dev.js
90271
90322
  import { randomUUID as randomUUID9 } from "node:crypto";
90272
- import { existsSync as existsSync36, readFileSync as readFileSync38 } from "node:fs";
90323
+ import { existsSync as existsSync36, readFileSync as readFileSync39 } from "node:fs";
90273
90324
  import { join as join41, relative as relative11 } from "node:path";
90274
90325
  function previewFinishedReason(err) {
90275
90326
  if (!(err instanceof CliApiError) || err.code !== "DRAFT_SESSION_TERMINAL")
@@ -91262,11 +91313,11 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
91262
91313
  continue;
91263
91314
  const { kind, key } = classifyKey(rel);
91264
91315
  if (kind === "function")
91265
- updateFunctions[key] = readFileSync38(abs, "utf-8");
91316
+ updateFunctions[key] = readFileSync39(abs, "utf-8");
91266
91317
  else if (kind === "binary")
91267
- updateBinary[key] = readFileSync38(abs).toString("base64");
91318
+ updateBinary[key] = readFileSync39(abs).toString("base64");
91268
91319
  else
91269
- updateFiles[key] = readFileSync38(abs, "utf-8");
91320
+ updateFiles[key] = readFileSync39(abs, "utf-8");
91270
91321
  }
91271
91322
  for (const rel of deleted)
91272
91323
  deleteKeys.push(classifyKey(rel).key);
@@ -132052,7 +132103,7 @@ var require_dist15 = __commonJS({
132052
132103
 
132053
132104
  // dist/lib/update-security.js
132054
132105
  import { createHash as createHash9, timingSafeEqual } from "node:crypto";
132055
- import { mkdirSync as mkdirSync19, readFileSync as readFileSync39, statSync as statSync7 } from "node:fs";
132106
+ import { mkdirSync as mkdirSync19, readFileSync as readFileSync40, statSync as statSync7 } from "node:fs";
132056
132107
  import { join as join44 } from "node:path";
132057
132108
  import { Readable as Readable3 } from "node:stream";
132058
132109
  import { pipeline as pipeline4 } from "node:stream/promises";
@@ -132425,8 +132476,8 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
132425
132476
  try {
132426
132477
  if (statSync7(lockPath).size > MAX_LOCKFILE_BYTES)
132427
132478
  throw new Error("lockfile too large");
132428
- manifest = JSON.parse(readFileSync39(manifestPath, "utf8"));
132429
- lock = JSON.parse(readFileSync39(lockPath, "utf8"));
132479
+ manifest = JSON.parse(readFileSync40(manifestPath, "utf8"));
132480
+ lock = JSON.parse(readFileSync40(lockPath, "utf8"));
132430
132481
  } catch (cause) {
132431
132482
  throw new Error(`the verified artifact has no readable npm-shrinkwrap dependency lock: ${message(cause)}`);
132432
132483
  }
@@ -132464,7 +132515,7 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
132464
132515
  let bundledManifest;
132465
132516
  try {
132466
132517
  const bundledPath = join44(extractionDir, ...lockPath2.split("/"), "package.json");
132467
- bundledManifest = JSON.parse(readFileSync39(bundledPath, "utf8"));
132518
+ bundledManifest = JSON.parse(readFileSync40(bundledPath, "utf8"));
132468
132519
  } catch (cause) {
132469
132520
  throw new Error(`the verified artifact has an unreadable bundled dependency ${lockPath2}: ${message(cause)}`);
132470
132521
  }
@@ -132534,7 +132585,7 @@ ${GITHUB_REPOSITORY_ID}`,
132534
132585
  // dist/commands/update.js
132535
132586
  import { spawn as spawn6 } from "node:child_process";
132536
132587
  import { randomBytes as randomBytes8 } from "node:crypto";
132537
- import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync4, openSync as openSync5, readFileSync as readFileSync40, readSync, rmSync as rmSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync25 } from "node:fs";
132588
+ import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync4, openSync as openSync5, readFileSync as readFileSync41, readSync, rmSync as rmSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync25 } from "node:fs";
132538
132589
  import { createServer } from "node:http";
132539
132590
  import { tmpdir as tmpdir2 } from "node:os";
132540
132591
  import { join as join45 } from "node:path";
@@ -132545,7 +132596,7 @@ function refuse2(cause) {
132545
132596
  }
132546
132597
  function currentVersion2() {
132547
132598
  try {
132548
- const pkg = JSON.parse(readFileSync40(join45(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
132599
+ const pkg = JSON.parse(readFileSync41(join45(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
132549
132600
  return pkg.version;
132550
132601
  } catch {
132551
132602
  return "0.0.0";
@@ -132892,7 +132943,7 @@ var init_upgrade = __esm({
132892
132943
  });
132893
132944
 
132894
132945
  // dist/commands/call.js
132895
- import { readFileSync as readFileSync41 } from "node:fs";
132946
+ import { readFileSync as readFileSync42 } from "node:fs";
132896
132947
  function parseArguments(value, file) {
132897
132948
  if (value === void 0)
132898
132949
  return {};
@@ -132916,7 +132967,7 @@ function readCallArguments(jsonArgs, file) {
132916
132967
  }
132917
132968
  let text;
132918
132969
  try {
132919
- text = readFileSync41(file, "utf8");
132970
+ text = readFileSync42(file, "utf8");
132920
132971
  } catch (err) {
132921
132972
  const code = err?.code;
132922
132973
  throw new Error(`Could not read --file ${file}${code ? ` (${code})` : ""}. The requested tool was not called.`);
@@ -135244,7 +135295,7 @@ var init_test_response_capture = __esm({
135244
135295
  import { randomUUID as randomUUID12 } from "node:crypto";
135245
135296
  import { setDefaultResultOrder } from "node:dns";
135246
135297
  import { lookup } from "node:dns/promises";
135247
- import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "node:fs";
135298
+ import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync26 } from "node:fs";
135248
135299
  import { basename as basename10, dirname as dirname15, join as join46, relative as relative12, resolve as resolve24 } from "node:path";
135249
135300
  function launchOptions(extra = {}) {
135250
135301
  return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
@@ -135298,7 +135349,7 @@ function undeployedChanges(root, projectId, preview = false) {
135298
135349
  const path3 = join46(root, ".somewhere", "base-files.json");
135299
135350
  if (!existsSync38(path3))
135300
135351
  return null;
135301
- base = JSON.parse(readFileSync42(path3, "utf8"));
135352
+ base = JSON.parse(readFileSync43(path3, "utf8"));
135302
135353
  }
135303
135354
  if (base.project_id !== projectId || !base.files)
135304
135355
  return null;
@@ -136241,7 +136292,7 @@ var init_reference_check_note = __esm({
136241
136292
 
136242
136293
  // dist/lib/test-scripts.js
136243
136294
  import { createRequire as createRequire10 } from "node:module";
136244
- import { existsSync as existsSync39, mkdirSync as mkdirSync21, readFileSync as readFileSync43, readdirSync as readdirSync8, rmSync as rmSync17, statSync as statSync8, writeFileSync as writeFileSync27 } from "node:fs";
136295
+ import { existsSync as existsSync39, mkdirSync as mkdirSync21, readFileSync as readFileSync44, readdirSync as readdirSync8, rmSync as rmSync17, statSync as statSync8, writeFileSync as writeFileSync27 } from "node:fs";
136245
136296
  import { dirname as dirname16, join as join47, relative as relative13, resolve as resolve25 } from "node:path";
136246
136297
  import { spawn as spawn7, spawnSync as spawnSync5 } from "node:child_process";
136247
136298
  function hasSpecFiles(root) {
@@ -136341,7 +136392,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
136341
136392
  stderrLines("", true);
136342
136393
  let report2 = null;
136343
136394
  try {
136344
- report2 = existsSync39(handOver) ? JSON.parse(readFileSync43(handOver, "utf8")) : null;
136395
+ report2 = existsSync39(handOver) ? JSON.parse(readFileSync44(handOver, "utf8")) : null;
136345
136396
  } catch {
136346
136397
  report2 = null;
136347
136398
  }
@@ -136378,13 +136429,13 @@ function lastFailedScripts(root) {
136378
136429
  if (!existsSync39(path3))
136379
136430
  return [];
136380
136431
  try {
136381
- return (JSON.parse(readFileSync43(path3, "utf8")).results ?? []).filter((r) => !r.ok).map((r) => r.script);
136432
+ return (JSON.parse(readFileSync44(path3, "utf8")).results ?? []).filter((r) => !r.ok).map((r) => r.script);
136382
136433
  } catch {
136383
136434
  return [];
136384
136435
  }
136385
136436
  }
136386
136437
  function recordScriptResults(root, results, rerunOnly) {
136387
- const previous = rerunOnly && existsSync39(join47(root, LAST)) ? JSON.parse(readFileSync43(join47(root, LAST), "utf8")).results ?? [] : [];
136438
+ const previous = rerunOnly && existsSync39(join47(root, LAST)) ? JSON.parse(readFileSync44(join47(root, LAST), "utf8")).results ?? [] : [];
136388
136439
  const merged = [...previous.filter((p2) => !results.some((r) => r.script === p2.script)), ...results];
136389
136440
  mkdirSync21(join47(root, ".somewhere", "tests"), { recursive: true });
136390
136441
  writeFileSync27(join47(root, LAST), JSON.stringify({ finished: (/* @__PURE__ */ new Date()).toISOString(), results: merged }, null, 2) + "\n");
@@ -136413,7 +136464,7 @@ var init_test_scripts = __esm({
136413
136464
 
136414
136465
  // dist/commands/test.js
136415
136466
  function registerTest(program2) {
136416
- program2.command("test [files...]").description("Read the deployed app's smoke check. It checks the built-in data path, pages and saved browser flows, and reports function errors with evidence. Use @somewhere-cloud/cli/testing for your own app tests. A named file runs that script.").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("--only <check>", "Run just access, crawl, or one saved check, e.g. checks/add-note.json").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` reads the latest result. Use --again for a fresh run. The last line of a platform run is JSON with outcome and counts.\n").action(async (files, opts) => {
136467
+ program2.command("test [files...]").description("Run the deployed app's checks: your check lists in checks/*.json (requests as named test users the platform makes), saved browser flows, and the platform's own access and page checks. Prints PASS or FAIL per step with the request ID. A named file runs that script.").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("--only <check>", "Run just access, crawl, or one saved check, e.g. checks/add-note.json").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", '\nWrite what to prove as a check list in checks/<name>.json: {"users": ["alice", "bob"], "steps": [{"as": "bob", "delete": "/api/tasks/{task}", "expect": 403}]}. The platform runs every checks/*.json after each deploy and `somewhere test` reads the latest result; --again starts a fresh run and --only checks/<name>.json runs one. See somewhere docs test. The last line of a platform run is JSON with outcome and counts.\n').action(async (files, opts) => {
136417
136468
  markProcessStart("cli");
136418
136469
  mark("cli:action");
136419
136470
  if (opts.url)
@@ -136500,7 +136551,7 @@ var init_test = __esm({
136500
136551
  });
136501
136552
 
136502
136553
  // dist/commands/test-users.js
136503
- import { existsSync as existsSync40, readFileSync as readFileSync44, rmSync as rmSync18 } from "node:fs";
136554
+ import { existsSync as existsSync40, readFileSync as readFileSync45, rmSync as rmSync18 } from "node:fs";
136504
136555
  import { basename as basename11, join as join48 } from "node:path";
136505
136556
  import { randomBytes as randomBytes9 } from "node:crypto";
136506
136557
  async function resolveTarget(projectOpt, originOpt) {
@@ -137027,7 +137078,7 @@ var init_skills = __esm({
137027
137078
  });
137028
137079
 
137029
137080
  // dist/commands/ai.js
137030
- import { readFileSync as readFileSync45 } from "node:fs";
137081
+ import { readFileSync as readFileSync46 } from "node:fs";
137031
137082
  function fail4(message3) {
137032
137083
  error(message3);
137033
137084
  process.exit(1);
@@ -137048,7 +137099,7 @@ async function readKey(stdin) {
137048
137099
  if (stdin) {
137049
137100
  if (process.stdin.isTTY)
137050
137101
  fail4("Pipe the key into --stdin, or leave out --stdin to type it into a hidden prompt.");
137051
- raw = readFileSync45(0, "utf8");
137102
+ raw = readFileSync46(0, "utf8");
137052
137103
  } else {
137053
137104
  if (!process.stdin.isTTY)
137054
137105
  fail4("Pass --stdin to read the key from a pipe. Nothing was sent.");
@@ -137278,7 +137329,7 @@ __export(dist_exports, {
137278
137329
  runCli: () => runCli
137279
137330
  });
137280
137331
  import { spawnSync as spawnSync6 } from "node:child_process";
137281
- import { readFileSync as readFileSync46 } from "node:fs";
137332
+ import { readFileSync as readFileSync47 } from "node:fs";
137282
137333
  import { join as join51 } from "node:path";
137283
137334
  async function runCli() {
137284
137335
  const pinned = decidePin(process.cwd(), CLI_VERSION2, process.argv, process.env);
@@ -137307,7 +137358,7 @@ async function runCli() {
137307
137358
  process.exit(child.status ?? 1);
137308
137359
  }
137309
137360
  removeStaleRunRecord();
137310
- const pkg = JSON.parse(readFileSync46(join51(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
137361
+ const pkg = JSON.parse(readFileSync47(join51(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
137311
137362
  const program2 = new Command().name(cliInvocation()).description(`CLI for somewhere.cloud. Run ${cliInvocation()} init first, then read generated AGENTS.md: call shapes and access patterns for a typical app; docs are for exceptions.`).version(pkg.version);
137312
137363
  recordLastRun(pkg.version);
137313
137364
  const jsonOutputRequested = process.argv.includes("--json");