@somewhere-cloud/cli 0.38.143 → 0.38.144

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.144
4
+
5
+ - Matches platform consumer contract 36, so deploys no longer warn that the CLI contract differs from the platform.
6
+ - `somewhere deploy` states the dotfile rule only when it leaves a dotfile out; `--json` with nothing left out keeps stderr quiet.
7
+ - `somewhere typecheck` no longer fails on `somewhere:api` imports; it says once that they are checked at deploy, where the client is generated.
8
+
3
9
  ## 0.38.143
4
10
 
5
11
  - Include the project name in the CLI docs starter command.
@@ -44647,8 +44647,8 @@ var init_skills_pack_generated = __esm({
44647
44647
  BUNDLED_SKILLS_PACK = {
44648
44648
  "schema": 1,
44649
44649
  "name": "somewhere-skills",
44650
- "version": "1+1f34c974ae28",
44651
- "sha256": "1f34c974ae2841bffb28d8eccb98fcee84bf5f98e15de6aaf453a9a050c95e4b",
44650
+ "version": "1+c727c92e8193",
44651
+ "sha256": "c727c92e81938d2e7cbf125de17c4d8a6feef4cf5bc4530f173f6dc04fe0da3e",
44652
44652
  "files": [
44653
44653
  {
44654
44654
  "path": "adopt/SKILL.md",
@@ -44662,8 +44662,8 @@ var init_skills_pack_generated = __esm({
44662
44662
  },
44663
44663
  {
44664
44664
  "path": "schema-changes/SKILL.md",
44665
- "sha256": "71fafce1ed983f1de2667253b4be41f8a0ec15e61fc5eda22ecfe05310746f49",
44666
- "content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or start with `somewhere init --features private-data`, which includes one.\n\n```ts\n// db/schema.ts\nimport { id, owner, schema, table, text, timestamp } from 'somewhere/db';\n\nexport default schema({\n notes: table(\n {\n id: id(),\n title: text(),\n body: text({ default: '' }),\n created_at: timestamp({ default: 'now' }),\n },\n {\n scope: owner(),\n client: {\n read: ['id', 'title', 'body', 'created_at'],\n create: ['title', 'body'],\n update: ['title', 'body'],\n delete: true,\n },\n },\n ),\n});\n```\n\nA table without a `client` block can't be reached from the browser at all.\n\nBefore the first deploy, delete an unused starter table declaration outright: there is no deployed table to retire. After a table has been deployed, mark it `removedTable()` to retire it with 30-day data retention, including when the table is empty.\n\nRun `somewhere typecheck` before deploying schema changes.\n\n## What a deploy does with it\n\n- **Additive changes apply**: a new table, a new nullable-or-defaulted column, a new index, a new unique group. Unchanged schema is a no-op.\n- **Unmarked removals and shape changes refuse** with `409 SCHEMA_DEPLOY_REFUSED` and a message naming the change.\n- **Access-rule changes apply in place**: a later deploy can change an existing table's scope, and its rows stay.\n- a production deploy or a promotion that would remove or rename a column is refused before anything changes, so a running release never loses a column it uses. Keep the column declared and leave its data in place.\n\n## Failure: raw SQL refused after the schema file deploys\n\nOn an older shared database, ordinary `sw.db.query` / `sw.db.batch` fail before transport with `MANAGED_RAW_SQL_REQUIRES_SERVER_AUTHORITY`, including in job, queue, and cron handlers; with a separate SQL database they run there and never see declared tables. Fix: write with `sw.db.insert` / `sw.db.update` / `sw.db.remove` (the table needs a declared intent)\n\nSources (`somewhere docs <topic>`): declared-data, getting-started, sw.db, troubleshooting.\n"
44665
+ "sha256": "ab5a21715672de983d2bb1ed19822563a8d94fad936b2424f3653c0c087642b2",
44666
+ "content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or run `somewhere init --name my-app --features private-data` to start with a schema.\n\n```ts\n// db/schema.ts\nimport { id, owner, schema, table, text, timestamp } from 'somewhere/db';\n\nexport default schema({\n notes: table(\n {\n id: id(),\n title: text(),\n body: text({ default: '' }),\n created_at: timestamp({ default: 'now' }),\n },\n {\n scope: owner(),\n client: {\n read: ['id', 'title', 'body', 'created_at'],\n create: ['title', 'body'],\n update: ['title', 'body'],\n delete: true,\n },\n },\n ),\n});\n```\n\nA table without a `client` block can't be reached from the browser at all.\n\nBefore the first deploy, delete an unused starter table declaration outright: there is no deployed table to retire. After a table has been deployed, mark it `removedTable()` to retire it with 30-day data retention, including when the table is empty.\n\nRun `somewhere typecheck` before deploying schema changes.\n\n## What a deploy does with it\n\n- **Additive changes apply**: a new table, a new nullable-or-defaulted column, a new index, a new unique group. Unchanged schema is a no-op.\n- **Unmarked removals and shape changes refuse** with `409 SCHEMA_DEPLOY_REFUSED` and a message naming the change.\n- **Access-rule changes apply in place**: a later deploy can change an existing table's scope, and its rows stay.\n- a production deploy or a promotion that would remove or rename a column is refused before anything changes, so a running release never loses a column it uses. Keep the column declared and leave its data in place.\n\n## Failure: raw SQL refused after the schema file deploys\n\nOn an older shared database, ordinary `sw.db.query` / `sw.db.batch` fail before transport with `MANAGED_RAW_SQL_REQUIRES_SERVER_AUTHORITY`, including in job, queue, and cron handlers; with a separate SQL database they run there and never see declared tables. Fix: write with `sw.db.insert` / `sw.db.update` / `sw.db.remove` (the table needs a declared intent)\n\nSources (`somewhere docs <topic>`): declared-data, getting-started, sw.db, troubleshooting.\n"
44667
44667
  },
44668
44668
  {
44669
44669
  "path": "sign-in-setup/SKILL.md",
@@ -74547,12 +74547,17 @@ import { spawn as spawn3, spawnSync } from "node:child_process";
74547
74547
  import { existsSync as existsSync12, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
74548
74548
  import { randomUUID as randomUUID4 } from "node:crypto";
74549
74549
  import { dirname as dirname4, join as join13, relative as relative3 } from "node:path";
74550
+ function isGeneratedApiImport(e) {
74551
+ return e.code === "TS2307" && /^Cannot find module ['"]somewhere:api['"]/.test(e.message);
74552
+ }
74550
74553
  function isUnresolvedBareImport(e) {
74551
74554
  if (!UNRESOLVED_DEP_CODES.has(e.code))
74552
74555
  return false;
74553
74556
  const specifier = /['"]([^'"]+)['"]/.exec(e.message)?.[1];
74554
74557
  if (specifier === void 0)
74555
74558
  return true;
74559
+ if (specifier === "somewhere:api")
74560
+ return isGeneratedApiImport(e);
74556
74561
  if (/^somewhere(?::data|:files|\/db)$/.test(specifier))
74557
74562
  return false;
74558
74563
  return !/^(?:\.{1,2}(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/])/.test(specifier);
@@ -74895,6 +74900,9 @@ async function runTypecheckWith(projectDir, command, args, via, declaredData) {
74895
74900
  if (run.error)
74896
74901
  return { ok: false, errors: [], via, raw: run.out, spawnError: run.error.message };
74897
74902
  const allErrors = parseTscOutput(run.out);
74903
+ if (allErrors.some(isGeneratedApiImport)) {
74904
+ process.stderr.write("The somewhere:api import is checked at deploy, where its client is generated.\n");
74905
+ }
74898
74906
  const errors = allErrors.filter((e) => !isUnresolvedBareImport(e));
74899
74907
  const unexplainedFailure = run.code !== 0 && allErrors.length === 0;
74900
74908
  return { ok: errors.length === 0 && !unexplainedFailure, errors, via, raw: run.out };
@@ -74914,6 +74922,7 @@ var init_typecheck = __esm({
74914
74922
  init_platform_contract();
74915
74923
  init_declared_data();
74916
74924
  UNRESOLVED_DEP_CODES = /* @__PURE__ */ new Set(["TS2307", "TS7016", "TS2306", "TS2875"]);
74925
+ __name(isGeneratedApiImport, "isGeneratedApiImport");
74917
74926
  __name(isUnresolvedBareImport, "isUnresolvedBareImport");
74918
74927
  __name(npxTscInvocation, "npxTscInvocation");
74919
74928
  __name(typecheckArgs, "typecheckArgs");
@@ -76832,7 +76841,7 @@ function isBinaryPath2(p2) {
76832
76841
  return BINARY_EXTS.has(extname3(p2).toLowerCase());
76833
76842
  }
76834
76843
  function collectFiles(baseDir, options2 = {}) {
76835
- const out = { files: {}, binaryFiles: {}, functions: {}, skipped: [], oversize: [], notes: [], excluded: [], sensitive: [], published: [] };
76844
+ const out = { dotfilesLeftOut: false, files: {}, binaryFiles: {}, functions: {}, skipped: [], oversize: [], notes: [], excluded: [], sensitive: [], published: [] };
76836
76845
  const ignore = loadDeployIgnore(baseDir);
76837
76846
  const candidates = [];
76838
76847
  const sizes = /* @__PURE__ */ new Map();
@@ -76923,6 +76932,8 @@ function walk(baseDir, currentDir, out, ignore, candidates, sizes) {
76923
76932
  for (const entry of readdirSync3(currentDir, { withFileTypes: true })) {
76924
76933
  const fullPath = join16(currentDir, entry.name);
76925
76934
  const relPath = toDeployPath(relative6(baseDir, fullPath));
76935
+ if (!IGNORE.has(entry.name) && entry.name.startsWith(".") && entry.name !== ".well-known")
76936
+ out.dotfilesLeftOut = true;
76926
76937
  if (IGNORE.has(entry.name) || entry.name.startsWith(".") && entry.name !== ".well-known" || ignore.ignores(relPath, entry.isDirectory())) {
76927
76938
  continue;
76928
76939
  }
@@ -84118,8 +84129,9 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
84118
84129
  process.exit(1);
84119
84130
  }
84120
84131
  if (opts.listUnpublished) {
84121
- const { excluded: excluded2, sensitive: sensitive2, skipped: skipped2 } = collectFiles(targetDir, { include: opts.include ?? [] });
84122
- console.error(DOTFILE_NOTICE);
84132
+ const { excluded: excluded2, sensitive: sensitive2, skipped: skipped2, dotfilesLeftOut } = collectFiles(targetDir, { include: opts.include ?? [] });
84133
+ if (dotfilesLeftOut)
84134
+ console.error(DOTFILE_NOTICE);
84123
84135
  if (opts.json)
84124
84136
  printJson({ excluded: excluded2, sensitive: sensitive2, skipped: skipped2 });
84125
84137
  else {
@@ -84148,7 +84160,8 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
84148
84160
  const collectionEndedAt = performance.now();
84149
84161
  const collectionMs = collectionEndedAt - collectionStartedAt;
84150
84162
  const { files, binaryFiles, functions, skipped, excluded, sensitive } = collected;
84151
- console.error(DOTFILE_NOTICE);
84163
+ if (collected.dotfilesLeftOut)
84164
+ console.error(DOTFILE_NOTICE);
84152
84165
  const sensitiveRefusal = sensitiveReferenceRefusal(collected);
84153
84166
  if (sensitiveRefusal) {
84154
84167
  if (opts.json)