@somewhere-cloud/cli 0.38.67 → 0.38.69

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.
@@ -1,155 +1,181 @@
1
- import { BUNDLED_SKILLS_PACK } from './skills-pack.generated.js';
2
- import { SKILLS_DIR, skillNames } from './skills-pack.js';
1
+ import { SKILLS_DIR } from './skills-pack.js';
3
2
  // Generated mirror of somewhere.cloud/docs/agent-workflow.md. The platform
4
3
  // docs lint byte-compares this value when SOMEWHERE_CLI_REPO points here.
5
4
  export const AGENT_WORKFLOW = `## Build, deploy, test
6
5
 
7
- Declare access rules in db/schema.ts; use the schema-generated browser client
8
- for ordinary app reads and writes. The platform enforces those rules on every call.
9
- Start with owner() for personal rows:
6
+ This core holds the call shapes and access patterns for a typical app; docs are for
7
+ exceptions. Declare access and use the generated browser client. Pick your shape:
10
8
 
11
- Schema: db/schema.ts is declaration only: imports and a default schema export.
12
- No helper functions or arbitrary TypeScript expressions. Named declarative
13
- constants and spreads of those constants are supported.
14
- id() is a random text key; references use text(). owner() adds/fills user_id.
9
+ | Requirement | Declaration below |
10
+ | --- | --- |
11
+ | Each user sees only their own rows | notes: owner() |
12
+ | Team: owner adds members; members read/write; per-row creator rights | teams/team_members/tasks: member() + owner() |
13
+ | Owner and staff see a record; staff-only child notes | tickets: owner() or appRole(); messages: parent(); staff_notes: appRole() |
14
+ | Public pages from private drafts | pages: owner(), publicRead with published condition |
15
+ | Share one record read-only with another account | shared_notes + note_shares: owner() or read-only grant() |
16
+
17
+ db/schema.ts: declarations only (imports, constants/spreads, default schema); no
18
+ helpers/expressions. id() is random text; owner() stamps user_id. Include the key in
19
+ client.read. Also: timestamp({ default: 'now' }), text({ nullable: true }), indexes: [['team_id']].
15
20
 
16
21
  \`\`\`ts
17
- import { schema, table, id, text, owner } from 'somewhere/db';
22
+ import { schema, table, id, text, owner, member, anyOf, serverOnly, parent, appRole, boolean, grant } from 'somewhere/db';
18
23
  export default schema({
19
- notes: table({ id: id(), title: text() }, {
20
- scope: owner(),
21
- client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
24
+ notes: table({ id: id(), title: text() }, { scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'], delete: true },
22
25
  }),
23
- });
26
+ teams: table({ id: id(), name: text(), owner_id: text() }, {
27
+ scope: member({ group: 'id', membership: 'team_members', member_user: 'user_id', member_group: 'team_id' }),
28
+ client: { read: ['id', 'name'] },
29
+ }),
30
+ team_members: table({ id: id(), team_id: text(), user_id: text() }, {
31
+ scope: serverOnly(), unique: [['team_id', 'user_id']],
32
+ }),
33
+ tasks: table({ id: id(), team_id: text({ references: 'teams' }), title: text() }, {
34
+ scope: anyOf(owner(), member({ group: 'team_id', membership: 'team_members',
35
+ member_user: 'user_id', member_group: 'team_id', operations: ['read', 'create', 'update'] })),
36
+ client: { read: ['id', 'team_id', 'title'], create: ['team_id', 'title'], update: ['title'], delete: true },
37
+ }),
38
+ tickets: table({ id: id(), subject: text() }, {
39
+ scope: anyOf(owner(), appRole({ roles: { read: ['staff'], create: ['staff'], update: ['staff'] } })),
40
+ client: { read: ['id', 'subject'], create: ['subject'], update: ['subject'] },
41
+ }),
42
+ messages: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
43
+ scope: parent({ via: 'ticket_id' }),
44
+ client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
45
+ }),
46
+ staff_notes: table({ id: id(), ticket_id: text({ references: 'tickets' }), body: text() }, {
47
+ scope: appRole({ roles: { read: ['staff'], create: ['staff'] } }),
48
+ client: { read: ['id', 'ticket_id', 'body'], create: ['ticket_id', 'body'] },
49
+ }),
50
+ pages: table({ id: id(), title: text(), published: boolean({ default: false }) }, {
51
+ scope: owner(), client: { read: ['id', 'title'], create: ['title'], update: ['title'],
52
+ publicRead: { where: { published: true } } },
53
+ }),
54
+ note_shares: table({ id: id(), grantee_id: text(), note_id: text({ references: 'shared_notes', onDelete: 'cascade' }) }, {
55
+ scope: owner(), unique: [['note_id', 'grantee_id']],
56
+ }),
57
+ shared_notes: table({ id: id(), title: text() }, {
58
+ scope: anyOf(owner(), grant({ table: 'note_shares', grantee: 'grantee_id', row: 'note_id', operations: ['read'] })),
59
+ client: { read: ['id', 'title'], create: ['title'], update: ['title'] },
60
+ }),
61
+ }, { appRoles: { staff: { emailDomain: 'staff.example.com' } } });
24
62
  \`\`\`
25
63
 
26
- Browser data is generated from the schema. list returns at most 100 rows, no
27
- order option: sort in the client or use a server endpoint for ordered queries.
64
+ messages inherit ticket access: owner() would hide a staff reply from the customer.
65
+ Staff roles here require verified domain email; never infer roles from unverified email.
66
+ Publish pages through an owner-checked endpoint setting published; not a browser write.
67
+ Share through an endpoint using caller-scoped sw.db.insert('note_shares', { grantee_id,
68
+ note_id }); the declaration checks ownership. Never grant browser writes to ledgers.
69
+
70
+ Browser data comes from the schema. list: max 100, after cursor, no order; sort
71
+ in the browser or an endpoint.
28
72
 
29
73
  \`\`\`ts
30
74
  import { data } from 'somewhere:data';
31
- async function useNotesData() {
75
+ async function notes() {
32
76
  const { data: note } = await data.notes.create({ title: 'Hello' });
33
77
  if (note) await data.notes.update(note.id, { title: 'Updated' });
34
78
  const page = await data.notes.list({ limit: 100 });
35
- if (page.has_more && page.next) return data.notes.list({ limit: 100, after: page.next });
79
+ if (page.has_more && page.next) return data.notes.list({ after: page.next });
36
80
  return page;
37
81
  }
38
82
  \`\`\`
39
83
 
40
-
41
- Use serverOnly() and endpoint checks only when a required rule cannot be expressed
42
- by the declared scopes: compare the required identities and relationships with
43
- the supported owner, membership, parent and role policies before choosing the fallback.
44
- Built-in groups and email-domain roles require VERIFIED email. If the app must
45
- work before verification, use its own membership/role table and server checks.
46
- Never grant privilege solely because an unverified address claims a domain.
47
-
48
- Starter map:
49
- - src/App.tsx + src/routes.ts: route selection, including a detail path parameter;
50
- navigate/linkTo accept string paths. Extensionless paths serve index.html.
51
- - src/pages/HomePage.tsx: build here; src/pages/SignedInLayout.tsx: signed-in layout;
52
- src/ui/AppShell.tsx: account/sign-out; src/ui/layout.tsx: PageHeader (React-node title).
53
- - src/auth/hooks.ts: existing useAuthState/useSignOut; src/services/auth.ts: errors.
54
- In components, useAuth from @somewhere-cloud/sdk/react exposes signIn/signUp
55
- ({ email, password }); both throw readable errors. Sign-up signs in immediately;
56
- unverified users pass auth: 'required'. Keep api/auth/[...path].ts and the session gate.
57
- - src/config.ts: app name, SIGN_IN_PROVIDERS, SHOW_EMAIL_VERIFICATION.
58
-
59
- Endpoint files: api/notes.ts → /api/notes; api/notes/[id].ts → params.id;
60
- api/notes/[id]/sub.ts → /api/notes/:id/sub; underscore-prefixed files are helpers.
61
- The global sw only declares endpoints; the handler's second argument is the runtime.
62
- Method-named exports select GET/DELETE; default export handles POST with a body.
63
- Declare auth on every endpoint; declare body fields before reading JSON. GET has no body.
64
- Plain objects become JSON 200; return Response.json(value, { status }) for other statuses.
84
+ Teams without verification: own membership table + member(); sw.groups and domain
85
+ roles need VERIFIED emails. Members read/create/update tasks; creators delete while
86
+ members. A team-owner delete is one checked endpoint; keep other access declared.
87
+ Create the team and its owner membership atomically:
65
88
 
66
89
  \`\`\`ts
67
- export const GET = sw.endpoint({
68
- auth: 'required',
69
- handler: async ({ params }, sw) => sw.db.from('notes', { limit: 100 }),
70
- });
90
+ // api/teams.ts
71
91
  export default sw.endpoint({
72
- auth: 'required', body: { title: 'string' },
73
- handler: async ({ body }, sw) => sw.db.insert('notes', { title: body.title }),
92
+ auth: 'required', body: { name: 'string' },
93
+ handler: async ({ user, params, body }, sw) => {
94
+ const creatorEmail = user.email; // required auth supplies id and email
95
+ const id = crypto.randomUUID();
96
+ await sw.db.server.tx([
97
+ { op: 'insert', table: 'teams', values: { id, name: body.name, owner_id: user.id } },
98
+ { op: 'insert', table: 'team_members', values: { id: crypto.randomUUID(), team_id: id, user_id: user.id } },
99
+ ]);
100
+ return { id, creatorEmail };
101
+ },
74
102
  });
75
- export const DELETE = sw.endpoint({
76
- auth: 'required',
77
- handler: async ({ params }, sw) => sw.db.remove('notes', { where: { id: params.id } }),
103
+ \`\`\`
104
+
105
+ \`\`\`ts
106
+ // api/teams/[id]/members.ts — only the team owner adds a member
107
+ export default sw.endpoint({
108
+ auth: 'required', body: { email: 'string' },
109
+ handler: async ({ user, params, body }, sw) => {
110
+ const { data: teams } = await sw.db.from('teams', { where: { id: params.id, owner_id: user.id }, limit: 1 });
111
+ if (!teams[0]) return Response.json({ error: 'Team owner required' }, { status: 403 });
112
+ const { users: [target] } = await sw.auth.server.listUsers({ emails: [body.email] });
113
+ if (!target) return Response.json({ error: 'Account not found' }, { status: 404 });
114
+ await sw.db.server.insert('team_members', {
115
+ id: crypto.randomUUID(), team_id: params.id, user_id: target.id,
116
+ }, { onConflict: 'ignore' });
117
+ return { ok: true };
118
+ },
78
119
  });
79
120
  \`\`\`
80
121
 
122
+ Do not mark app-read/write data serverOnly() and hand-write access checks: declare
123
+ who may read/write it; the platform enforces it. Server-only fits job/import/audit/
124
+ counter state, membership ledgers, and undeclarable rules: arbitrary predicates
125
+ (e.g. expiry), or different writable fields per role (split tables or check that write).
126
+ Grant ledgers need owner() scope and no browser writes. Keep other access declared.
81
127
 
82
- Scopes:
83
- - owner(): personal rows, caller ownership applied by the platform.
84
- - member(): your membership table controls shared rows; parent(): inherit a related row's access.
85
- - serverOnly(): functions authorize every read/write; no browser data access.
86
- - publicRead: { where }: visitor reads of explicitly selected rows/columns.
87
- client grants browser operations/columns; read must include the primary key.
88
- Omitted browser write grants prevent direct writes; use endpoints for validation.
128
+ Starter: src/pages/HomePage.tsx; routes src/App.tsx + src/routes.ts; layout
129
+ src/pages/SignedInLayout.tsx. Auth hooks: src/auth/hooks.ts; useAuth from
130
+ @somewhere-cloud/sdk/react: signIn/signUp({ email, password }); sign-up signs in.
131
+ Keep api/auth/[...path].ts. src/config.ts controls providers/verification.
89
132
 
90
- Server calls return { data: rows, count, changes }. sw.db applies caller scopes;
91
- sw.db.server bypasses them, so authorize first and supply trusted ownership on insert.
92
- update takes TWO arguments: table and { where, set }. Transactions take an ARRAY
93
- of write intents, never a callback; pre-generate related IDs. No reads or result
94
- references inside tx; a zero-match update does not abort it. Use unique constraints
95
- for concurrent uniqueness, not a read-then-insert check.
133
+ Files: api/notes.ts → /api/notes; api/notes/[id]/sub.ts → /api/notes/:id/sub
134
+ (params.id). Underscore-prefixed files are helpers. GET/DELETE: named exports;
135
+ POST: default export. Objects return JSON 200; Response.json sets other statuses.
96
136
 
97
137
  \`\`\`ts
98
- async function writeNotes(sw: SomewhereRuntimeContext, ownerId: string) {
99
- // ownerId must come from the caller or an authorized lookup, never unchecked input.
100
- const id = crypto.randomUUID();
101
- await sw.db.server.tx([
102
- { op: 'insert', table: 'notes', values: { id, user_id: ownerId, title: 'Hello' } },
103
- { op: 'update', table: 'notes', where: { id }, set: { title: 'Updated' } },
104
- ]);
105
- await sw.db.from('notes', { where: { id }, limit: 1 });
106
- await sw.db.insert('notes', { title: 'Hello' });
107
- await sw.db.update('notes', { where: { id }, set: { title: 'Updated' } });
108
- await sw.db.remove('notes', { where: { id } });
109
- // Server directory: authorize the caller before looking up another account.
110
- const { users: [user] } = await sw.auth.server.listUsers({ emails: ['person@example.com'] });
111
- return user; // undefined when no eligible account matches
112
- }
138
+ export const GET = sw.endpoint({
139
+ auth: 'required',
140
+ handler: async (_, sw) => sw.db.from('notes', { limit: 100 }),
141
+ });
142
+ export const DELETE = sw.endpoint({
143
+ auth: 'required',
144
+ handler: async ({ params }, sw) => sw.db.remove('notes', { where: { id: params.id } }),
145
+ });
113
146
  \`\`\`
114
147
 
148
+ Structured sw.db calls apply caller scopes; sw.db.server bypasses them: authorize first.
149
+ Reads: from(table, { where, columns, order: [['id', 'asc']], limit, offset }).
150
+ Filters include { id: { in: ids } }; schema uniqueness is unique: [['a', 'b']].
151
+ Writes: insert(table, values), update(table, { where, set }), remove(table, { where }).
152
+ Transactions are ARRAYs of write intents (above), never callbacks; pre-generate
153
+ IDs.
115
154
 
116
- Call your API with fetch(path, { method: 'POST', credentials: 'same-origin',
155
+ Browser: fetch(path, { method: 'POST', credentials: 'same-origin',
117
156
  headers: { 'content-type': 'application/json' }, body: JSON.stringify(values) }).
118
- The short-lived access cookie refreshes automatically; do not store tokens.
119
- Scripts sending cookie-authenticated POST/PATCH/DELETE must send Origin equal to
120
- the app URL. UI rendering/session checks are asynchronous: wait for loaded UI.
121
- Test with throwaway users at <name>@<subdomain>.test.somewhere.site.
122
-
123
- Publish: somewhere typecheck → somewhere deploy → somewhere test.
124
- Deploy raw source; do not run a frontend build. Type errors stop before upload;
125
- explicit override: somewhere deploy --allow-type-errors. Deploy applies the schema.
126
- somewhere test runs project tests against production; also test each table's
127
- access and the affected journey. Diagnose with somewhere errors and somewhere logs.
128
- RATE_LIMIT_UNAVAILABLE is temporary platform unavailability: the request was not
129
- admitted; retry it and keep rateLimit protection.
157
+ Access cookies refresh automatically. Cookie-auth POST/PATCH/DELETE from scripts
158
+ need Origin equal to the app URL.
159
+
160
+ Publish: somewhere typecheck → npx @somewhere-cloud/cli deploy → somewhere verify → somewhere test.
161
+ Deploy raw source, no frontend build. Type errors stop before upload; explicit
162
+ override: somewhere deploy --allow-type-errors.
163
+ Tests: newUser() gives a signed-in user with its own browser page and API request client; call as many times as needed (owner, member, outsider).
164
+ newUser() accepts no chosen email; grant roles or insert memberships in test setup through your app's own authorized server endpoint.
165
+ Diagnose with somewhere errors and somewhere logs.
130
166
 
131
167
  On demand:
132
168
  - Membership/parent: \`somewhere docs sw.db --section owner-or-member-and-parent-access\`
133
- - Groups: \`somewhere docs sw.groups --section create-a-group\`
134
- - Transactions: \`somewhere docs sw.db --section transaction-intents\`
135
- - Updates: \`somewhere docs sw.db --section update-shape\`
136
- - Browser limits: \`somewhere docs sw.db --section browser-list-limits\`
169
+ - Server paging: \`somewhere docs sw.db --section server-read-paging\`
137
170
  - Direct HTTP data tests: \`somewhere docs declared-data --section calling-the-data-endpoint-directly\`
138
- - Auth hooks: \`somewhere docs auth-client --section react-auth-state\`
139
- - Files/background import: \`somewhere docs recipe-csv-import --section larger-files\`
140
- - Scheduled work: \`somewhere docs cron --section create-a-schedule\`
141
- - Server-rendered pages: \`somewhere docs recipe-seo --section 5-server-rendered-pages-and-redirects\`
171
+ - Endpoint inputs: \`somewhere docs sw.endpoint --section what-your-handler-receives\`
142
172
  `;
143
- export const SKILLS_POINTER = `Skills: \`${SKILLS_DIR}/\` — `
144
- + skillNames(BUNDLED_SKILLS_PACK).map((name) => `\`${name}\``).join(', ')
145
- + '. Read the skill that matches the task. `somewhere skills status` inspects the installed pack; `somewhere skills update` updates unmodified files.';
173
+ export const SKILLS_POINTER = `Task-specific skills: \`${SKILLS_DIR}/\`. Inspect/update with somewhere skills status/update.`;
146
174
  export const DECLARED_ACCESS_POINTER = '';
147
175
  /** One line telling agents the app's data and code can leave:
148
176
  * an evaluating agent concluded the platform had no exits. Kept outside
149
177
  * AGENT_WORKFLOW, which is a byte mirror of the platform's agent workflow. */
150
- export const PORTABILITY_POINTER = 'Your data and code are yours: `somewhere pull` (source), `somewhere db dump` (raw SQL database as one .sql file), '
151
- + 'one-table CSV export and attaching PostgreSQL in your own Neon account; managed-database tables are not in the dump or CSV yet. '
152
- + 'Limits per path: `somewhere docs portability`.';
153
- export const INIT_AGENTS_MD = `# somewhere.cloud project contract\n${SKILLS_POINTER}\n${DECLARED_ACCESS_POINTER}\n${PORTABILITY_POINTER}\n${AGENT_WORKFLOW}\n`;
178
+ export const PORTABILITY_POINTER = 'Data/code export limits: `somewhere docs portability`.';
179
+ export const INIT_AGENTS_MD = `# somewhere.cloud project contract\n${AGENT_WORKFLOW}\n${SKILLS_POINTER}\n${PORTABILITY_POINTER}\n`;
154
180
  export const INIT_CLAUDE_MD = 'Read AGENTS.md for project instructions.\n';
155
181
  //# sourceMappingURL=init-agent-guide.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-agent-guide.js","sourceRoot":"","sources":["../../src/lib/init-agent-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE1D,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyI7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,UAAU,QAAQ;MACzD,UAAU,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;MACvE,oJAAoJ,CAAC;AAEzJ,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,oHAAoH;MACnJ,kIAAkI;MAClI,gDAAgD,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,cAAc,KAAK,uBAAuB,KAAK,mBAAmB,KAAK,cAAc,IAAI,CAAC;AAC/J,MAAM,CAAC,MAAM,cAAc,GAAG,4CAA4C,CAAC"}
1
+ {"version":3,"file":"init-agent-guide.js","sourceRoot":"","sources":["../../src/lib/init-agent-guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,2EAA2E;AAC3E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwK7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,2BAA2B,UAAU,0DAA0D,CAAC;AAE9H,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;+EAE+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,wDAAwD,CAAC;AAE5F,MAAM,CAAC,MAAM,cAAc,GAAG,uCAAuC,cAAc,KAAK,cAAc,KAAK,mBAAmB,IAAI,CAAC;AACnI,MAAM,CAAC,MAAM,cAAc,GAAG,4CAA4C,CAAC"}
@@ -1,4 +1,4 @@
1
- const session = `import { test, expect, data, expectRefused, ready } from '@somewhere-cloud/cli/testing';
1
+ const session = `import { test, expect, ready } from '@somewhere-cloud/cli/testing';
2
2
 
3
3
  test('session and sign-out', async ({ newUser }) => {
4
4
  const user = await newUser();
@@ -13,11 +13,6 @@ test('session and sign-out', async ({ newUser }) => {
13
13
  await ready(user.page, 'signed-out');
14
14
  });
15
15
  `;
16
- const closed = `
17
- test('browser data is closed', async ({ anonymous }) => {
18
- await expectRefused(await data(anonymous, 'notes', { operation: 'list' }), 403, 'DATA_ACCESS_DENIED');
19
- });
20
- `;
21
16
  const isolation = `
22
17
  test('owners can read only their own notes', async ({ newUser }) => {
23
18
  const owner = await newUser();
@@ -48,6 +43,6 @@ test('owners can read only their own notes', async ({ newUser }) => {
48
43
  });
49
44
  `;
50
45
  export function starterTests(privateData = false) {
51
- return [{ path: 'tests/app.spec.ts', content: session + (privateData ? isolation : closed) }];
46
+ return [{ path: 'tests/app.spec.ts', content: session.replace('test, expect, ready', privateData ? 'test, expect, ready, data, expectRefused' : 'test, expect, ready') + (privateData ? isolation : '') }];
52
47
  }
53
48
  //# sourceMappingURL=init-test-template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;CAcf,CAAC;AACF,MAAM,MAAM,GAAG;;;;CAId,CAAC;AACF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB,CAAC;AACF,MAAM,UAAU,YAAY,CAAC,WAAW,GAAG,KAAK;IAC9C,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChG,CAAC"}
1
+ {"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;CAcf,CAAC;AACF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB,CAAC;AACF,MAAM,UAAU,YAAY,CAAC,WAAW,GAAG,KAAK;IAC9C,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7M,CAAC"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.67",
3
+ "version": "0.38.69",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.67",
9
+ "version": "0.38.69",
10
10
  "bundleDependencies": [
11
11
  "@modelcontextprotocol/sdk",
12
12
  "chokidar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.67",
3
+ "version": "0.38.69",
4
4
  "description": "CLI for somewhere.cloud — auth, projects, deploy, pull, promote, db, logs, env, MCP bridge.",
5
5
  "keywords": [
6
6
  "somewhere",
@@ -6,7 +6,7 @@
6
6
  "shared/d1-session.ts": "2ae29b74bba68016c86d25fa2a58f8c2fce4aca8fe57fafc253d380c47a3c0ab",
7
7
  "shared/types/placeholder-identity.ts": "089a46e2474a21193d3611eddd9c94b6bbe62441b3039ed80fc8499bada447ca",
8
8
  "worker/containers/compile/checker-contract.cjs": "c6d4ebc9ec058b3562655cc4f18dc1cea7e4492eb35b7f0fd0d87e974c26b492",
9
- "worker/containers/compile/consumer-contract.cjs": "e99a52f4f1f4efb9eea6ec9507fa2cda4864ed7489c69ed628d7fbc9b7a05d43",
9
+ "worker/containers/compile/consumer-contract.cjs": "23b9a7e1bda74fb50075038cac44f9f74bdfdd826763da6e4a5d10ce20685ccb",
10
10
  "worker/containers/compile/declared-data-contract.cjs": "cd63f117c495d24a1346df95858f162ad09b3fea3654a6ad8cef8ec612482092",
11
11
  "worker/containers/compile/generated-declarations-render.cjs": "7ffdb34645cc9eccac6eba39dc86b646a41c4de8a1a038d2b5b46f42df9f1157",
12
12
  "worker/containers/compile/generated-declarations.cjs": "6e9902e054c5c784fd9b3c3fafc1869e79954100a45014e1132247cd82833ec4",
@@ -58,5 +58,5 @@
58
58
  "worker/src/utils/telegram-attempt-receipts.ts": "a9ba55ae71f63ada44a105f1ceae04b0491bda0d6e77e5762db2dbecdd2981dd",
59
59
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da"
60
60
  },
61
- "sha256": "118a41431c2def6a41845fcf39d4f306d020fa0e9dd9f208d5d1346009b58f1a"
61
+ "sha256": "b5ba85458713c213a22156fb7577d13a38d8fec2bc2ce587f5f8fd484342bd4b"
62
62
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha256": "527e58c9b19aab0703f70f442023bbc7d2e1c825a0cebc7e37e96cf36d1909ac"
2
+ "sha256": "6edf7964ba43090b85bbff144b73530e34f4e4271ea8cdc985d274ff659cebd0"
3
3
  }
@@ -27,7 +27,7 @@
27
27
  "worker/src/runtime/calendar.ts": "483a7e0151b5cff2b0cccadc52da2a32d547c87a565edbbe66d7a2a26b537371",
28
28
  "worker/src/runtime/connect.ts": "45bba4d2f90d3fe5bc60a985dacf459e1132f89fbbcbe369ec2829100acc049a",
29
29
  "worker/src/runtime/context-head.ts": "ea9af3394dd483143dd30fb36b36ad63f168740b005d857bf087d73c2e7ab8eb",
30
- "worker/src/runtime/context-tail.ts": "8fa257b0117e01a7852dc27d5dd6c74064f1161b66353e7fdf4f36d73f30472a",
30
+ "worker/src/runtime/context-tail.ts": "7911800e7a9fabae72163cfd05263fec2b48874ef8dc6a0c16846e8b7994e525",
31
31
  "worker/src/runtime/context.ts": "e3810d92c7c7bab05c12d518b012fcc84523e8aee0f1003a319ca11e8593e409",
32
32
  "worker/src/runtime/cron.ts": "4aac732fe8ce072dec8e3dafaebfc1b48818ec34bb13b388a4f1bb3f184b4383",
33
33
  "worker/src/runtime/crypto.ts": "5c91be24e7da79a8c11f04e06f70158ce89e09940a0918711c656d4cc893915d",
@@ -88,7 +88,7 @@
88
88
  "worker/src/runtime/storage.ts": "15c7953b994497c7883b774f79ae93bae96e16373a0826cc733d21005de22ad7",
89
89
  "worker/src/runtime/tasks.ts": "75efa2e3083853bfba1dc49745ede8865ddd218b84d568a00da2dbd669f9ab23",
90
90
  "worker/src/runtime/verify-signup.ts": "dcac46b4581794fe875e3f85e3d93a2253b470f60a3c7fcee68543d8be8a6fa1",
91
- "worker/src/runtime/version.ts": "df2611361fc0de08a61d6457d1881379aa62ddecb141d8050ef858a731b63e7a",
91
+ "worker/src/runtime/version.ts": "5a7f3cc7873c601c405f96e4379f7c40a3cf1e337858d57bf56751ed3de15c5c",
92
92
  "worker/src/runtime/visitor-session.generated.ts": "f788a0c4efe22b18c313d8433150931d48a5f872e3bd98549d94138a5b0dfe5d",
93
93
  "worker/src/runtime/web.ts": "269590d44ffa6239bb6e79999b58ba42435c230f045daea52bf73d09519afb0e",
94
94
  "worker/src/security/browser-secret-scan.ts": "31ebc9dd94eed4d0a9a6b67b3b1e2505d4f7812c557c90337e034c1e3994c039",
@@ -162,6 +162,6 @@
162
162
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da",
163
163
  "worker/src/vendor/neondatabase-serverless/source.generated.ts": "96a3c18fde7d8888fdb53a4d7cd0721c238a234521d2084d1e66868a8df8e69c"
164
164
  },
165
- "sha256": "990a318a92c26567b57795979f280d56a4051c838e0e95589be76ee722f2532d",
165
+ "sha256": "59da48afa417269b03a304d90587143a08c2de3a615f16bf2d80b5fd6f8a3e17",
166
166
  "fixtures_sha256": "908827d1430f4af5a83cae59ed476abc51dc9648757eac0089fe6e6db95f66c5"
167
167
  }
@@ -4476,8 +4476,8 @@ var require_consumer_contract = __commonJS({
4476
4476
  "worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
4477
4477
  "use strict";
4478
4478
  var CONSUMER_CONTRACT2 = Object.freeze({
4479
- version: 12,
4480
- digest: "bfd8e484c8101c1435f1e41e39056c57950c17f1bf04a5074563215d715605cf"
4479
+ version: 13,
4480
+ digest: "710925c27f431929318c5bcecc3da5e4111c854fc5d875b689b4f0ffb1649440"
4481
4481
  });
4482
4482
  var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
4483
4483
  var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
@@ -4587,6 +4587,7 @@ __export(declared_data_vendor_entry_exports, {
4587
4587
  FILES_DECLARATION_FILE: () => import_typed_files2.CLIENT_FILE,
4588
4588
  RUNTIME_CONTEXT_DECLARATION: () => import_runtime_types3.RUNTIME_CONTEXT_DECLARATION,
4589
4589
  SCHEMA_DECLARATION: () => import_schema_types.SCHEMA_DECLARATION,
4590
+ allTablesServerOnlyWithoutClient: () => allTablesServerOnlyWithoutClient,
4590
4591
  checkerContract: () => checkerContract,
4591
4592
  consumerContractComponents: () => import_consumer_contract.consumerContractComponents,
4592
4593
  consumerContractFingerprint: () => import_consumer_contract.consumerContractFingerprint,
@@ -8306,6 +8307,12 @@ function isRuntimeEndpointGlobal(diag, functions) {
8306
8307
 
8307
8308
 
8308
8309
  var import_consumer_contract = __toESM(require_consumer_contract());
8310
+ function allTablesServerOnlyWithoutClient(files) {
8311
+ const source = files["db/schema.ts"];
8312
+ if (source === void 0) return false;
8313
+ const parsed = extractSchemaTs(source);
8314
+ return parsed.ok && parsed.declaration.tables.length > 0 && parsed.declaration.tables.every((table) => table.scope.kind === "server_only" && table.client === void 0);
8315
+ }
8309
8316
  function generateFromFiles(files) {
8310
8317
  const authority = clientAuthorityFromSource(files);
8311
8318
  return authority ? (0, import_typed_data.generateDataClient)(authority) : void 0;
@@ -8331,6 +8338,7 @@ function filesDeclarationFromFiles(files) {
8331
8338
  FILES_DECLARATION_FILE,
8332
8339
  RUNTIME_CONTEXT_DECLARATION,
8333
8340
  SCHEMA_DECLARATION,
8341
+ allTablesServerOnlyWithoutClient,
8334
8342
  checkerContract,
8335
8343
  consumerContractComponents,
8336
8344
  consumerContractFingerprint,
@@ -16283,6 +16283,8 @@ var CONTEXT_TAIL_JS = ` };
16283
16283
  const draftAuth = draftReadNamespace('auth', sw.auth, {
16284
16284
  fromRequest: sw.auth.fromRequest,
16285
16285
  requireUser: sw.auth.requireUser,
16286
+ // These methods refuse the draft before transport; preserve their typed production-only boundary.
16287
+ server: sw.auth.server,
16286
16288
  });
16287
16289
  const draftBilling = draftReadNamespace('billing', sw.billing, {
16288
16290
  has: sw.billing.has,