@somewhere-cloud/cli 0.38.154 → 0.38.155

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 (142) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/docs/adopt.md +39 -0
  3. package/dist/docs/analytics.md +161 -0
  4. package/dist/docs/api-reference.md +339 -0
  5. package/dist/docs/api-surface.md +2067 -0
  6. package/dist/docs/app-mcp.md +162 -0
  7. package/dist/docs/architecture-patterns.md +334 -0
  8. package/dist/docs/auth-client.md +531 -0
  9. package/dist/docs/billing.md +76 -0
  10. package/dist/docs/browser.md +639 -0
  11. package/dist/docs/calendar.md +298 -0
  12. package/dist/docs/changes.md +323 -0
  13. package/dist/docs/cli.md +407 -0
  14. package/dist/docs/common-mistakes.md +199 -0
  15. package/dist/docs/connect-agent.md +72 -0
  16. package/dist/docs/cors.md +114 -0
  17. package/dist/docs/cron.md +167 -0
  18. package/dist/docs/database-engine.md +167 -0
  19. package/dist/docs/declared-data.md +1656 -0
  20. package/dist/docs/declared-files.md +475 -0
  21. package/dist/docs/deploy-intelligence.md +188 -0
  22. package/dist/docs/deploy.md +733 -0
  23. package/dist/docs/design-system.md +273 -0
  24. package/dist/docs/dev-environments.md +496 -0
  25. package/dist/docs/domain-ownership.md +31 -0
  26. package/dist/docs/domains.md +370 -0
  27. package/dist/docs/feedback.md +88 -0
  28. package/dist/docs/file-tools.md +116 -0
  29. package/dist/docs/functions.md +489 -0
  30. package/dist/docs/getting-started.md +238 -0
  31. package/dist/docs/github.md +95 -0
  32. package/dist/docs/google-calendar.md +212 -0
  33. package/dist/docs/groups.md +836 -0
  34. package/dist/docs/guarantees.md +58 -0
  35. package/dist/docs/handled-for-you.md +224 -0
  36. package/dist/docs/inspect.md +171 -0
  37. package/dist/docs/limits.md +68 -0
  38. package/dist/docs/live-data.md +197 -0
  39. package/dist/docs/live.md +92 -0
  40. package/dist/docs/local-dev.md +30 -0
  41. package/dist/docs/migration-supabase.md +58 -0
  42. package/dist/docs/payments.md +1102 -0
  43. package/dist/docs/portability.md +194 -0
  44. package/dist/docs/postgres.md +301 -0
  45. package/dist/docs/pricing-comparison.md +42 -0
  46. package/dist/docs/pricing.md +39 -0
  47. package/dist/docs/project-groups.md +107 -0
  48. package/dist/docs/projects.md +380 -0
  49. package/dist/docs/recipe-ai-agent.md +112 -0
  50. package/dist/docs/recipe-ai-features.md +227 -0
  51. package/dist/docs/recipe-ai-receipts.md +783 -0
  52. package/dist/docs/recipe-background-jobs.md +369 -0
  53. package/dist/docs/recipe-booking.md +348 -0
  54. package/dist/docs/recipe-csv-import.md +390 -0
  55. package/dist/docs/recipe-ecommerce.md +127 -0
  56. package/dist/docs/recipe-email.md +282 -0
  57. package/dist/docs/recipe-escalation.md +133 -0
  58. package/dist/docs/recipe-file-uploads.md +159 -0
  59. package/dist/docs/recipe-import-app.md +110 -0
  60. package/dist/docs/recipe-login.md +457 -0
  61. package/dist/docs/recipe-multi-chat.md +198 -0
  62. package/dist/docs/recipe-paid-api.md +161 -0
  63. package/dist/docs/recipe-pdfs.md +205 -0
  64. package/dist/docs/recipe-push-notifications.md +107 -0
  65. package/dist/docs/recipe-seo.md +200 -0
  66. package/dist/docs/recipe-signed-in-app.md +330 -0
  67. package/dist/docs/render.md +99 -0
  68. package/dist/docs/rooms.md +554 -0
  69. package/dist/docs/sdk.md +287 -0
  70. package/dist/docs/sdks.md +24 -0
  71. package/dist/docs/search.md +199 -0
  72. package/dist/docs/security-model.md +168 -0
  73. package/dist/docs/setup.md +212 -0
  74. package/dist/docs/smoke.md +102 -0
  75. package/dist/docs/speed.md +298 -0
  76. package/dist/docs/sql-compatibility.md +96 -0
  77. package/dist/docs/sw.agent.md +248 -0
  78. package/dist/docs/sw.ai.md +1291 -0
  79. package/dist/docs/sw.auth.md +1811 -0
  80. package/dist/docs/sw.billing.md +171 -0
  81. package/dist/docs/sw.db.md +2128 -0
  82. package/dist/docs/sw.email.md +661 -0
  83. package/dist/docs/sw.endpoint.md +187 -0
  84. package/dist/docs/sw.env.md +303 -0
  85. package/dist/docs/sw.fetch.md +115 -0
  86. package/dist/docs/sw.fs.md +424 -0
  87. package/dist/docs/sw.groups.md +836 -0
  88. package/dist/docs/sw.image.md +69 -0
  89. package/dist/docs/sw.jobs.md +520 -0
  90. package/dist/docs/sw.logs.md +61 -0
  91. package/dist/docs/sw.mail.md +106 -0
  92. package/dist/docs/sw.notifications.md +78 -0
  93. package/dist/docs/sw.push.md +161 -0
  94. package/dist/docs/sw.rateLimit.md +67 -0
  95. package/dist/docs/sw.web.md +128 -0
  96. package/dist/docs/tasks.md +269 -0
  97. package/dist/docs/test.md +220 -0
  98. package/dist/docs/tool-reference-account.md +7 -0
  99. package/dist/docs/tool-reference-ai.md +121 -0
  100. package/dist/docs/tool-reference-analytics.md +37 -0
  101. package/dist/docs/tool-reference-api.md +19 -0
  102. package/dist/docs/tool-reference-artifacts.md +35 -0
  103. package/dist/docs/tool-reference-auth.md +163 -0
  104. package/dist/docs/tool-reference-browser.md +114 -0
  105. package/dist/docs/tool-reference-code.md +26 -0
  106. package/dist/docs/tool-reference-connect.md +21 -0
  107. package/dist/docs/tool-reference-cron.md +48 -0
  108. package/dist/docs/tool-reference-db.md +282 -0
  109. package/dist/docs/tool-reference-domains.md +107 -0
  110. package/dist/docs/tool-reference-email.md +55 -0
  111. package/dist/docs/tool-reference-env.md +19 -0
  112. package/dist/docs/tool-reference-feedback.md +56 -0
  113. package/dist/docs/tool-reference-fs.md +265 -0
  114. package/dist/docs/tool-reference-github.md +57 -0
  115. package/dist/docs/tool-reference-groups.md +85 -0
  116. package/dist/docs/tool-reference-help.md +29 -0
  117. package/dist/docs/tool-reference-jobs.md +39 -0
  118. package/dist/docs/tool-reference-live.md +48 -0
  119. package/dist/docs/tool-reference-logs.md +16 -0
  120. package/dist/docs/tool-reference-payments.md +44 -0
  121. package/dist/docs/tool-reference-project.md +706 -0
  122. package/dist/docs/tool-reference-push.md +78 -0
  123. package/dist/docs/tool-reference-rate-limit.md +18 -0
  124. package/dist/docs/tool-reference-search.md +68 -0
  125. package/dist/docs/tool-reference-security.md +42 -0
  126. package/dist/docs/tool-reference-smoke.md +17 -0
  127. package/dist/docs/tool-reference-stock-photos.md +20 -0
  128. package/dist/docs/tool-reference-tasks.md +73 -0
  129. package/dist/docs/tool-reference-telegram.md +32 -0
  130. package/dist/docs/tool-reference-usage.md +9 -0
  131. package/dist/docs/tool-reference-web.md +71 -0
  132. package/dist/docs/tool-reference-webhooks.md +9 -0
  133. package/dist/docs/troubleshooting.md +411 -0
  134. package/dist/docs/typed-functions.md +94 -0
  135. package/dist/docs/verify-before-deploy.md +67 -0
  136. package/dist/docs/vs-supabase.md +75 -0
  137. package/dist/docs/vs-vercel.md +103 -0
  138. package/dist/lib/bundle.js +303 -221
  139. package/dist/lib/bundle.js.map +3 -3
  140. package/dist/types/lib/test-session.d.ts +8 -0
  141. package/npm-shrinkwrap.json +2 -2
  142. package/package.json +3 -2
@@ -0,0 +1,273 @@
1
+ # Design System — Read before generating UI
2
+
3
+ Decide how the app looks before you build features, then build every screen
4
+ from that decision. The React starter from `somewhere init` gives you the
5
+ pieces: design tokens in `src/styles/tokens.css`, shared classes in
6
+ `src/styles/app.css`, and ready components in `src/ui/`.
7
+
8
+ Choose a visual idea that fits your audience, record it in `DESIGN.md`, and
9
+ set the starter's colors and fonts to match. Build one screen with its loading,
10
+ empty and error states before adding features. Reuse those tokens and
11
+ components on the next screen so the app keeps the same look. Deploy the raw
12
+ source to check the result on a phone; the platform compiles it for you.
13
+
14
+ ## Decide the look first
15
+
16
+ Write the decision down in a short `DESIGN.md` at the project root, before
17
+ the first feature. Keep it to a few lines your agent can reread every session:
18
+
19
+ - **Audience** — who uses the app and where (a nurse between shifts, a
20
+ collector browsing at night).
21
+ - **One distinctive idea** — something specific enough to recognize. "Library
22
+ card: cream paper, oxblood accent, serif headings" works; "clean and modern"
23
+ describes every app.
24
+ - **Palette, type and layout** — the token values you chose and why.
25
+ - **Components** — which starter components you use as they are, and what you
26
+ add.
27
+
28
+ ```md
29
+ # DESIGN.md — reading list
30
+ Audience: readers keeping a shelf of books to read next, mostly on a phone.
31
+ Idea: a library card — cream paper, an oxblood accent, a serif display face.
32
+ Palette: --color-bg #f6f0e4, --color-accent #7a1f2b; neutrals stay warm.
33
+ Type: Iowan Old Style for headings, Avenir Next for body text.
34
+ Layout: one centered column; each book is a .panel row.
35
+ Components: AppShell and AuthCard as shipped; EmptyState for an empty shelf.
36
+ ```
37
+
38
+ Point to it from the starter's `AGENTS.md` so every session reads it. A
39
+ root `.md` file stays on your machine: `somewhere deploy` publishes it only
40
+ if your app references it or you opt it in with
41
+ `somewhere deploy --include DESIGN.md` (or a `!DESIGN.md` line in
42
+ `.somewhereignore`).
43
+
44
+ ## Start from the starter
45
+
46
+ | File | What it holds |
47
+ |---|---|
48
+ | `src/styles/tokens.css` | The design values, as custom properties on `:root`, with a light block and a dark block. |
49
+ | `src/styles/app.css` | The classes the kit renders and the shared ones (`.panel`, `.muted`, `.hint`, `.error`), all reading the tokens. |
50
+ | `src/ui/` | The UI kit: `Button`, `TextField`, `SelectField`, `TextareaField`, `CheckboxField`, `FormRow`, `Card`, `Table`, `Stat`, `Badge`, `Tabs`, `Dialog`, `Notice`, `Skeleton`, `Stack`, `Grid`, `Inline`, `PageHeader`; plus `AppShell` (the frame), `AuthCard` (sign-in) and `feedback.tsx` (`Alert`, `EmptyState`). |
51
+ | `src/pages/HomePage.tsx` | A worked example of the kit: a header with the one main action, a stat row, a table in a card, a dialog form. Copy its shape. |
52
+
53
+ Set your design in `tokens.css` first; the starter's classes and components
54
+ read it. Reuse them before writing new ones, and have new components read the
55
+ same tokens, so a new screen carries the look instead of restating it.
56
+
57
+ ## Build with the kit
58
+
59
+ The starter is a small design system, and pages built with it look finished;
60
+ pages built around it look like a form from 2009. The rules that keep a page
61
+ inside the system:
62
+
63
+ - Every control is a kit component. A bare `<input>`, `<select>` or
64
+ `<button>` in a page renders with browser defaults next to styled controls;
65
+ use `TextField`, `SelectField` and `Button`.
66
+ - Never write a colour, font or size in a page: every value is a token such as
67
+ `var(--color-accent)` or `var(--space-4)`. A missing token goes in
68
+ `tokens.css`, in both the light and the dark block.
69
+ - Never restyle a tag globally (`select { … }`, `input { … }`). Add a class
70
+ at the end of `app.css`.
71
+ - One h1 and one primary `Button` per page, both in `PageHeader`; everything
72
+ else is secondary, quiet or a link. Two primary buttons means neither is.
73
+ - Cards group peers: a list, a form, two to four `Stat`s in a `Grid`. A page
74
+ that is nothing but identical cards has no hierarchy; the main number goes in
75
+ the header and the rest in a `Table`.
76
+ - Empty, loading and error are states to design, not afterthoughts:
77
+ `EmptyState` with one action, `Skeleton` while loading, `Notice` with a
78
+ retry when a request fails. Design the empty state before the populated one.
79
+ - Everything reflows at phone width: `Grid` and `FormRow` stack their
80
+ children, and a `Table` stacks each row as label and value lines on a phone,
81
+ so nothing scrolls sideways.
82
+
83
+ Two mistakes account for most pages that look unfinished. A page that is six
84
+ white boxes with the same shadow: move the main number into `PageHeader`,
85
+ group the peers into one `Card` with a `Table`, and put the form in a
86
+ `Dialog` behind the primary button. A `<select>` with the browser's grey box
87
+ and square arrow: it is not a `SelectField`.
88
+
89
+ ## Add to the sign-in page
90
+
91
+ `AuthCard` has two slots: `providers` above the email form and `children`
92
+ below it. Social sign-in buttons go in `providers`, which `SIGN_IN_PROVIDERS`
93
+ in `src/config.ts` already fills; a magic-link form or a terms line goes in
94
+ `children`. Nothing is added as a sibling of the card: its two-column grid
95
+ holds exactly the intro and the form, and a third child lands in its own row.
96
+ `APP_NAME` and `APP_TAGLINE` in `src/config.ts` set the page's words.
97
+
98
+ ## CSS variable convention (theme-correct by default)
99
+
100
+ Components read colors, type, spacing and radii from the tokens, never from
101
+ hardcoded values:
102
+
103
+ ```tsx
104
+ <section className="panel">
105
+ <p style={{ color: 'var(--color-muted)' }}>Saved</p>
106
+ </section>
107
+ ```
108
+
109
+ The starter's tokens:
110
+
111
+ | Tokens | Use |
112
+ |---|---|
113
+ | `--color-bg`, `--color-surface`, `--color-surface-2` | Page background, panels and inputs, a subtle second surface |
114
+ | `--color-text`, `--color-muted` | Body text, secondary text |
115
+ | `--color-border`, `--color-border-strong` | Dividers, input borders |
116
+ | `--color-accent`, `--color-accent-hover`, `--color-accent-soft`, `--color-on-accent` | Primary actions, their hover, a tint, and the text on them |
117
+ | `--color-danger`, `--color-focus` | Errors, the keyboard focus ring |
118
+ | `--color-success`, `--color-warning`, `--color-info` (+ `-soft`) | Tones for `Badge`, `Notice` and `Stat` details, never for buttons |
119
+ | `--font-display`, `--font-body`, `--font-mono` | Headings, everything else, codes and IDs |
120
+ | `--text-xs` … `--text-2xl`, `--text-display` | Type sizes |
121
+ | `--space-1` … `--space-16` | Spacing in steps of 4px |
122
+ | `--radius-control`, `--radius-panel`, `--radius-pill` | Inputs and buttons, panels, badges |
123
+ | `--shadow-sm`, `--shadow-md`, `--shadow-lg` | Cards, panels, dialogs |
124
+ | `--control-height`, `--content-width` | The 44px control height, the page column |
125
+
126
+ Pick one accent and let everything else stay quiet: tinted neutrals for
127
+ background and surface, with the surface distinct from the background. When
128
+ you need a value the set lacks, add a token to `tokens.css` and use it, so the
129
+ next change happens in one place.
130
+
131
+ The starter ships both modes: `tokens.css` holds the light values on
132
+ `:root` and the dark values in a `prefers-color-scheme: dark` block, so a
133
+ colour you change is changed in both. Keep the font, spacing and radius tokens
134
+ shared. For the library-card idea, cream paper and an oxblood accent, the
135
+ colour part of the file looks like this:
136
+
137
+ ```css
138
+ :root {
139
+ color-scheme: light dark;
140
+ --color-bg: #f6f0e4;
141
+ --color-surface: #fffcf5;
142
+ --color-text: #221c17;
143
+ --color-muted: #6b5f53;
144
+ --color-border: #918170;
145
+ --color-accent: #7a1f2b;
146
+ --color-on-accent: #fffcf5;
147
+ --color-danger: #a63c12;
148
+ --color-focus: #7a1f2b;
149
+ }
150
+
151
+ @media (prefers-color-scheme: dark) {
152
+ :root {
153
+ --color-bg: #1b1714;
154
+ --color-surface: #26201b;
155
+ --color-text: #f1e8da;
156
+ --color-muted: #b8aa98;
157
+ --color-border: #80705f;
158
+ --color-accent: #e3a1a6;
159
+ --color-on-accent: #2a0c10;
160
+ --color-danger: #f4a06a;
161
+ --color-focus: #e3a1a6;
162
+ }
163
+ }
164
+ ```
165
+
166
+ The page switches with the device setting, so there is no toggle to build.
167
+ `color-scheme` lets the browser draw scrollbars and form controls to match.
168
+ In both modes, body text, secondary text, links and errors keep at least 4.5:1
169
+ contrast on the page and on panels, and button text keeps it on the accent.
170
+ The starter's classes follow these tokens; check any component that sets its
171
+ own colors.
172
+
173
+ ## Font pairing — defaults that work
174
+
175
+ The starter uses local font stacks, so text renders immediately with no font
176
+ download. Pair one display face with one body face, and choose the pairing to
177
+ fit your distinctive idea:
178
+
179
+ - **Precise** — the system sans for both. The starter's default:
180
+ `--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`
181
+ with `--font-display: var(--font-body)`, `font-variant-numeric: tabular-nums`
182
+ on figures and `--font-mono` for codes and IDs. Suits dashboards and tools,
183
+ and falls back well on every platform.
184
+ - **Editorial** — serif headings over the same sans: set
185
+ `--font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif`.
186
+ - **Friendly** — a rounded display face
187
+ (`ui-rounded, "SF Pro Rounded", system-ui, sans-serif`) over the system
188
+ sans. Suits consumer and family apps.
189
+
190
+ Local stacks are the working default. To use a font you chose deliberately,
191
+ add its `.woff2` to the project, declare it with `@font-face` in
192
+ `tokens.css`, and name it first in `--font-display` or `--font-body`,
193
+ keeping the local stack as the fallback. Setting fonts through these two tokens
194
+ keeps the choice in one place.
195
+
196
+ ## Layout
197
+
198
+ - One centered content column on phones; switch to a grid from about
199
+ `768px` when the content has two real columns.
200
+ - Space with the `--space-*` tokens rather than freehand pixel values.
201
+
202
+ ## Animation
203
+
204
+ - Keep hover and press feedback short: transitions on color and shadow around
205
+ 150ms.
206
+ - Wrap motion in `@media (prefers-reduced-motion: no-preference)`.
207
+
208
+ ## The edit→deploy→verify loop
209
+
210
+ Build each feature on the design: write the screen with the starter
211
+ components and token classes, then deploy and check it.
212
+
213
+ Read the live source, make the smallest coherent edit, run the relevant local
214
+ check, deploy once, and verify the public `<slug>.somewhere.site` URL. The
215
+ default workflow has no staging or private-preview step.
216
+
217
+ ## Read the live tokens back
218
+
219
+ `project_design_tokens({ project_id })` returns the palette, fonts, spacing
220
+ and radii found in the authored CSS of the project's active release (from a
221
+ shell: `somewhere call project_design_tokens '{"project_id":"my-app"}'`).
222
+ Use it to check what shipped, or to hand a visual editor the current values.
223
+
224
+ ## One theme across projects
225
+
226
+ Projects in a group can share a theme. The group stores design tokens as a
227
+ JSON object, written by an owner or editor with
228
+ `PUT /v1/groups/:id/tokens` `{ "tokens": { "color-accent": "#7a1f2b" } }`
229
+ and read back with `group_get`. Keys may omit the leading `--`. Member
230
+ sites receive them as custom properties on `:root` on later page loads,
231
+ with no redeploy.
232
+
233
+ A project's own declarations take precedence: a token defined in its
234
+ `tokens.css` overrides the group value. To let a member follow the group,
235
+ leave that token out of the member's `tokens.css`. The full group model is
236
+ in `project-groups` → `the-shared-theme`.
237
+
238
+ ## Self-check before `somewhere deploy`
239
+
240
+ 1. Search the components for hex colors and raw font names; each should be a
241
+ token.
242
+ 2. Search the pages for bare `<input>`, `<select>` and `<button>`; each should
243
+ be a kit component.
244
+ 3. Resize to 375px wide — does anything overflow horizontally?
245
+ 4. Tab through with the keyboard — is the focus ring visible on every
246
+ interactive element?
247
+ 5. Compare the screen with `DESIGN.md`: is the distinctive idea visible?
248
+ 6. After deploying, run `somewhere verify` and check the live page at desktop
249
+ and phone size; its layout line reports contrast, overflow and tap targets
250
+ below 24px (the WCAG 2.2 AA minimum), and each is a regression; targets
251
+ between 24 and 44px are listed as a note.
252
+
253
+ ## Tone
254
+
255
+ Use words your audience uses. Name the action on each button, explain errors
256
+ with a next step, and make empty states show how to begin. Let the app's
257
+ purpose set the tone: a family planner and a finance dashboard should sound
258
+ different. Avoid generic promises such as "supercharge" or "revolutionary".
259
+
260
+ ## Variants
261
+
262
+ When generating multiple visual variants for a single design ask,
263
+ ensure the variants differ along at least TWO axes — e.g. layout AND
264
+ type scale, not just color. A "blue version / green version" isn't
265
+ variance.
266
+
267
+ ## Rule zero: deploy raw source, don't build
268
+
269
+ Deploy the `.tsx`, `.css` and `.html` source; the platform compiles it.
270
+ Keeping the source lets you read design tokens back and edit the app through
271
+ `project_patch` find/replace. Follow `deploy` for the deployment workflow.
272
+
273
+ Related: `sw.image`, `deploy`, `project-groups`, `portability`.