@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,370 @@
1
+ # Custom Domains
2
+
3
+ ## Connect your own domain in the dashboard
4
+
5
+ Open your app in the [dashboard](https://somewhere.cloud/app). In **Address**, choose **Set up** next to **Your own domain**. On **Use your own domain**, enter your domain and choose **Continue**. Add any DNS records the page shows at your DNS provider. The page checks when the domain opens your app.
6
+
7
+ A project serves a custom domain through one of three setup paths:
8
+
9
+ Claimed domain — a domain the owner already has, on a paid plan. The
10
+ owner points its nameservers at the platform once; it
11
+ can then be attached to and moved between projects, and
12
+ it can receive email for the project.
13
+
14
+ DNS-record setup — one project, one hostname, on every plan. The owner
15
+ adds two DNS records and keeps their nameservers.
16
+
17
+ Bought domain — registered through checkout. It is set up as a claim
18
+ (its DNS is hosted here) after payment, with no further step.
19
+
20
+ ## Recommended: claim by delegating nameservers
21
+
22
+ One claim covers the apex (`example.com`), `www` and any subdomain.
23
+ Once active, the domain can be attached to a different project without
24
+ verifying ownership again.
25
+
26
+ // 1. Claim — returns the nameserver pair to set at the registrar.
27
+ domain_claim({ domain: "example.com" })
28
+ // → { id, claim_status: "pending_ns",
29
+ // nameservers: ["<ns1>", "<ns2>"], // the pair for this domain
30
+ // instructions: [...] }
31
+
32
+ // 2. The owner replaces the nameservers at their registrar.
33
+
34
+ // 3. The platform checks pending claims every hour; check now with:
35
+ domain_check_ns({ id })
36
+ // → { claim_status: "active" } once the new nameservers are visible.
37
+
38
+ // 4. Attach to a project. host = "apex" (default), "www", or a
39
+ // single subdomain label like "app".
40
+ domain_attach({ id, project_id: "my-app", host: "apex" })
41
+
42
+ // To move the domain to a different project later — no re-verify:
43
+ domain_detach({ id })
44
+ domain_attach({ id, project_id: "other-app", host: "apex" })
45
+
46
+ // To list every domain the account has claimed (attached or not):
47
+ domain_owned({})
48
+
49
+ `domain_attach` on a domain that is attached to another app changes nothing
50
+ and answers `409 DOMAIN_ATTACHED_ELSEWHERE`, naming that app: detach it there
51
+ first. Attaching again to the same app (for example to change `host`) is
52
+ accepted.
53
+
54
+ ## Where the domain tools are
55
+
56
+ - **Full MCP (`/mcp`).** A bare `tools/list` shows the core set, which for
57
+ domains is `domain_buy`, `domain_check` and `domain_list`. Every other domain
58
+ tool (`domain_add`, `domain_verify`, `domain_remove`, `domain_claim`,
59
+ `domain_check_ns`, `domain_attach`, `domain_detach`, `domain_owned`,
60
+ `domain_enable_email`, `domain_publish`) works when called and is listed by
61
+ `catalog({ load: "domains" })`, or for the whole session with
62
+ `?groups=domains` on the MCP URL (or the `Mcp-Tool-Groups: domains` header).
63
+ - **The claude.ai connector (`/mcp/connector`).** It has `domain_add`,
64
+ `domain_verify` and `domain_check`. The claim path goes through `api_write`
65
+ and `api_read` with the same REST calls the tools make:
66
+
67
+ api_write({ calls: [{ method: "POST", path: "/v1/domains/claim", body: { domain: "example.com" } }] })
68
+ api_write({ calls: [{ method: "POST", path: "/v1/domains/<id>/check-ns", body: {} }] })
69
+ api_write({ calls: [{ method: "POST", path: "/v1/domains/<id>/attach", body: { project_id: "<project id>", host: "apex" } }] })
70
+ api_write({ calls: [{ method: "POST", path: "/v1/domains/<id>/detach", body: {} }] })
71
+ api_write({ calls: [{ method: "PATCH", path: "/v1/domains/app.example.com/reassign", body: { project_id: "<project id>" } }] })
72
+ api_write({ calls: [{ method: "DELETE", path: "/v1/domains/example.com" }] })
73
+ api_read({ calls: [{ method: "GET", path: "/v1/domains/owned" }] })
74
+ api_read({ calls: [{ method: "GET", path: "/v1/domains?project_id=<project id>" }] })
75
+
76
+ Buying is not available through `api_write`: the owner buys on the
77
+ purchase page (see below).
78
+ - **The ChatGPT app.** It has no domain operations; the owner connects a
79
+ domain on the app's domain page in the dashboard.
80
+ - **The `somewhere` CLI.** It has no separate `domain` command; every
81
+ domain tool runs through `somewhere call`, for example
82
+ `somewhere call domain_claim '{"domain":"example.com"}'` or
83
+ `somewhere call domain_attach '{"id":"<id>","project_id":"<project id>","host":"apex"}'`.
84
+
85
+ ## What the domain owner does
86
+
87
+ - **Plan.** Claiming needs a paid plan; on Free, `domain_claim` returns
88
+ `402 UPGRADE_REQUIRED`. The DNS-record path below works on every plan.
89
+ - **Their one step.** At their registrar (where the domain is registered),
90
+ they replace the existing nameservers with the two in `nameservers`.
91
+ Take the pair from the `domain_claim` response, or from `domain_owned`
92
+ later, never from memory or an example.
93
+ - **A domain set up here before.** If the domain's nameservers still point
94
+ at an earlier setup on the platform, `domain_claim` returns
95
+ `409 NAMESERVERS_STILL_DELEGATED`: change them at the registrar to anything
96
+ else, then claim again. The claim then starts fresh, and the domain goes
97
+ live only after the registrar is pointed at the pair the new claim returns.
98
+ This also applies to an owner re-claiming a domain they removed
99
+ themselves: the nameservers have to move away and back.
100
+ - **Timing.** The change usually takes effect within minutes and can take up
101
+ to 24 hours.
102
+ - **When it is live.** No email or notice is sent when a claim becomes
103
+ active. `domain_check_ns` reports `claim_status: "active"`, and the
104
+ domain serves the project as soon as it is attached.
105
+ - **Existing records.** Claiming moves the domain's DNS to the platform and
106
+ does not copy existing records, so mail and any other records the domain
107
+ serves stop when the nameservers move. A domain that already sends or
108
+ receives email, or serves other records, stays on the DNS-record path.
109
+
110
+ ## Claim lifetime + cleanup
111
+
112
+ A claim belongs to the owner's account, not to a project, so
113
+ `project_delete` does not remove it: deleting the app detaches the claim at
114
+ once, and it stays in `domain_owned`, ready to attach to another app. To
115
+ remove a claim from `domain_owned`, pending or active:
116
+
117
+ domain_remove({ domain: "example.com" })
118
+
119
+ `domain_detach({ id })` frees the project binding and keeps the claim for
120
+ later.
121
+
122
+ ## Sending mail on a claimed domain (automatic)
123
+
124
+ Attaching a claimed domain to an app also sets up sending as that domain for
125
+ the app, with no further call. A few minutes after the attach the platform:
126
+
127
+ - registers the domain with the mail provider that sends for the app;
128
+ - writes three DKIM records into the domain's zone (CNAME
129
+ `<token>._domainkey.<domain>` → `<token>.dkim.amazonses.com`, comment
130
+ "somewhere sender-domain auto-setup") and one TXT record at
131
+ `_somewhere.<domain>` that proves the setup is the app's;
132
+ - adds the domain to the app's sending domains and marks it verified once the
133
+ provider confirms the records.
134
+
135
+ It writes no MX or SPF record, so receiving mail stays as it was. A bought
136
+ domain gets the same setup, as a claim does. The setup belongs to the
137
+ app it was made for:
138
+
139
+ - `domain_detach` removes that app's setup first, then detaches the domain;
140
+ the next app the domain is attached to gets its own. If the setup cannot be
141
+ removed right now, nothing is detached and the call answers
142
+ `503 SENDER_DOMAIN_REMOVE_FAILED`; the same call retries.
143
+ - `domain_remove` on an attached domain (bought ones included) removes that
144
+ app's setup first, then the domain.
145
+ - The records stay in the zone in every case. Once the setup is removed they
146
+ verify nothing, and a new setup writes new ones.
147
+
148
+ ## Receiving mail on a claimed domain (opt-in)
149
+
150
+ `domain_claim` adds no MX records, and claiming does not copy the domain's
151
+ existing records. A domain that already receives email through Gmail,
152
+ Workspace or its own server stops receiving it when its nameservers move;
153
+ keep such a domain on the DNS-record path. Receiving mail is a separate step:
154
+
155
+ domain_enable_email({ id })
156
+ // → { receiving_host }. With no mail provider on the domain, mail is
157
+ // received on the domain itself. With one (Gmail/Workspace, Microsoft
158
+ // 365, a forwarding catch-all, any other MX or SPF), its records are left
159
+ // unchanged and app mail is received on reply.<domain> instead.
160
+ // Addresses on receiving_host are registered through the mail API (/v1/mail).
161
+
162
+ ## Ownership
163
+
164
+ A domain bought through somewhere.cloud is registered in the buyer's name
165
+ from the moment of purchase. It can leave on the registry's transfer rules:
166
+
167
+ - to another registrar from 60 days after registration (the ICANN transfer
168
+ rule for generic endings such as .com; country endings such as .uk follow
169
+ their own registry's rules);
170
+ - to the buyer's own Name.com account from 5 days after registration.
171
+
172
+ Either move starts with an email to support@somewhere.cloud from the
173
+ account's email address, naming the domain. Full details:
174
+ https://somewhere.cloud/docs/domain-ownership
175
+
176
+ ## Stuck domain recovery
177
+
178
+ A claimed, active domain that resolves to nothing is repaired with
179
+ `domain_publish({ id })`: `troubleshooting` →
180
+ `a-claimed-domain-is-active-but-does-not-resolve`.
181
+
182
+ ## DNS-record setup
183
+
184
+ Use this path when the nameservers stay where they are, for example a
185
+ company domain whose DNS another team runs.
186
+
187
+ domain_add({ project_id: "my-app", domain: "app.yourcompany.com" })
188
+ // → { cname_target, registrable_domain, dns_record_host,
189
+ // verification_txt_name, verification_txt_value, instructions }
190
+
191
+ domain_verify({ project_id: "my-app", domain: "app.yourcompany.com" })
192
+ // → { verified, cname_ok, txt_ok, next_step, ... }
193
+
194
+ The owner adds the CNAME (to `cname_target`) and the TXT record
195
+ (`verification_txt_name` = `verification_txt_value`) at their DNS host,
196
+ with the values from the `domain_add` response. `dns_records` lists both
197
+ records, each with `host` (the name relative to the registrable domain, which
198
+ most DNS hosts expect because they add the domain themselves) and
199
+ `full_name` (for a host that wants the whole name):
200
+
201
+ // domain_add({ project_id, domain: "app.example.com" }).dns_records
202
+ [{ type: "CNAME", host: "app", full_name: "app.example.com", value: "proxy.somewhere.tech", purpose: "routing" },
203
+ { type: "TXT", host: "_somewhere-verify.app",
204
+ full_name: "_somewhere-verify.app.example.com", value: "smt-verify-…", purpose: "ownership" }]
205
+
206
+ **A bare domain** (`example.com` itself, not `app.example.com`) whose DNS is
207
+ at another company cannot be connected with DNS records. It works here in one
208
+ of two ways:
209
+
210
+ - **Claim it:** `domain_claim({ domain: "example.com" })` (paid plan) moves
211
+ its nameservers here; the bare domain, `www` and mail then serve (see
212
+ above).
213
+ - **Connect www instead:** `domain_add` with `www.example.com` (the CNAME and
214
+ TXT records above), then forward `example.com` to `www.example.com` at the
215
+ DNS company.
216
+
217
+ `domain_add` for a bare domain answers `400 BARE_DOMAIN_NEEDS_CLAIM_OR_WWW`
218
+ with those two ways and no records. A bare domain connected here before keeps
219
+ working. `domain_verify` marks every record with `in_place`.
220
+
221
+ `registrable_domain` is
222
+ the name the owner manages at their registrar (`example.co.uk` for
223
+ `shop.example.co.uk`, from the public suffix list) and `dns_record_host` is
224
+ the record name to enter there (`@` for the registrable domain itself,
225
+ otherwise `shop`). Every domain answer (`domain_add`, `domain_verify`,
226
+ `domain_check`, the project's domain list and status) carries both fields,
227
+ so no caller splits labels itself. `domain_verify` checks
228
+ both; until then `next_step` names exactly what is missing: which record
229
+ (CNAME or TXT) is absent or points elsewhere, with its name and the value it
230
+ needs, and then where the domain's DNS is managed when that is a known
231
+ provider (`third_party_dns_provider`). `next_step` is a plain sentence that
232
+ can be shown to the owner as it is. `cname_ok` and `txt_ok` say the same per
233
+ record.
234
+
235
+ When the subdomain's registrable domain is a domain the same account has
236
+ already claimed here, `parent_zone_in_account` is `{ id, domain }` (on
237
+ `domain_verify` and on each row of the domain list). That subdomain needs no
238
+ DNS records: `domain_attach({ id, project_id, host: "app" })` on the claim
239
+ serves it.
240
+
241
+ Adding a domain again to the same project answers `already_exists: true` with
242
+ its real `verified` state. A domain that cannot be added answers
243
+ `409 DOMAIN_TAKEN` with `data.reason`:
244
+
245
+ - `own_app`: it is on another of your apps. The message names the app and
246
+ the move: `PATCH /v1/domains/<domain>/reassign` with `{ project_id }`, or for
247
+ a claim, detach then attach.
248
+ - `own_claim`: it is a domain you claimed and it is not on any app. Attach it
249
+ (`data.domain_id`), with no records.
250
+ - `deleted_app`: an app of yours that was deleted still holds it, until that
251
+ deletion completes.
252
+ - `other_account`: another account holds it.
253
+
254
+ ## Moving a domain to another app
255
+
256
+ `PATCH /v1/domains/<domain>/reassign` with `{ "project_id": "<project id>" }`
257
+ moves a DNS-record or bought domain to another app you can edit, with no new
258
+ DNS records or verification. The app's sending setup for the domain moves with
259
+ it, and it is refused (`409 SENDER_DOMAIN_CONFLICT`) when both apps send as
260
+ the domain. A claimed domain moves with `domain_detach`, then `domain_attach`.
261
+
262
+ Once verified, a DNS-record domain serves production within a couple of
263
+ minutes. A verified custom domain and the project's
264
+ `*.somewhere.site` subdomain serve the same immutable release named by
265
+ `active_release_id`.
266
+
267
+ ## Buy a domain through checkout
268
+
269
+ The account owner pays for the domain in checkout, and it renews yearly.
270
+ Check availability, then request the purchase preview:
271
+
272
+ domain_check({ domain: "acmedash.com" })
273
+ // → { available: true, price: "<amount>/year", price_cents }
274
+
275
+ Domains cost the registrar's yearly price with no markup, so each name has
276
+ its own price: quote it from `domain_check` or the search (both carry the
277
+ same registrar quote), never from a fixed list. `GET /v1/pricing` states this
278
+ rule under `domains`.
279
+
280
+ A first year can be a registrar promotion priced below later years. Search
281
+ answers carry `renewal_price_cents`, the registrar's price for each later
282
+ year; each renewal charges the registrar's renewal price at that time, also
283
+ with no markup.
284
+
285
+ Purchase connects the domain to the app with no DNS steps. A bought domain
286
+ is a claimed domain: its DNS is hosted here, its nameservers are set at
287
+ registration, and it serves the bare name and www over HTTPS. A new name
288
+ usually serves within 30 minutes of payment, once the registry publishes it;
289
+ `domain_list` shows it as pending until then. Receiving email is off until
290
+ `domain_enable_email`, as for any claim.
291
+
292
+ domain_buy({ project_id: "my-app", domain: "acmedash.com" })
293
+ // → { ok: false, error: "PURCHASE_CONFIRMATION_REQUIRED",
294
+ // domain: "acmedash.com", price: "<amount>/year",
295
+ // dashboard_checkout_url: "https://somewhere.cloud/app/<project id>/buy/acmedash.com" }
296
+
297
+ The owner opens `dashboard_checkout_url` (the app's purchase page), signs in
298
+ if needed, and pays in checkout. No confirmation token is involved;
299
+ there is no agent-side purchase step. Registration and DNS/HTTPS setup begin
300
+ only after payment settles. The first paid domain on a Free account also
301
+ unlocks 30 days of Builder.
302
+
303
+ ## Domain search
304
+
305
+ `GET /v1/domains/search?q=<word or name>` (or `domain_check({ domain: "acmedash", search: true })`)
306
+ checks priced endings for the word. Internationalized endings are not offered
307
+ as search suggestions.
308
+ A whole name (`acmedash.com`) is checked exactly, returned as `exact` and
309
+ listed first; its first label is searched for the alternatives.
310
+
311
+ domain_check({ domain: "acmedash", search: true, max_price: 40 })
312
+ // → { keyword: "acmedash", exact: null,
313
+ // results: [{ domain: "acmedash.foundation", available: true, premium: false,
314
+ // price: "<amount>/year", price_cents, renewal_price_cents,
315
+ // price_status: "quoted", tld, category }, ...],
316
+ // more_available, endings_total, endings_checked, partial,
317
+ // unanswered_count, unanswered }
318
+
319
+ - Every available name carries its first-year price (`price`, `price_cents`)
320
+ and its renewal price when the registrar gives one (`renewal_price_cents`).
321
+ These are the same quotes `domain_check` returns for one name, which is what
322
+ checkout charges.
323
+ - `premium: true` marks a premium name, priced above its ending's standard price.
324
+ - `price_status: "unknown"` means the name is available but its price did not
325
+ come back; check it with `domain_check({ domain })`.
326
+ - `max_price` (dollars) keeps only names at or under that price. `sort` is
327
+ `price` (default: cheapest available first, after an exact match) or `name`.
328
+ Without `max_price`, taken names follow the available ones.
329
+ - At most 60 names come back; `more_available` counts the available names
330
+ left out, and `next_cursor` gives the next 60: pass it back as `cursor`
331
+ (`domain_check({ domain, search: true, cursor })`). The cheapest endings are
332
+ checked first. `endings_total` counts the priced endings within the search
333
+ and `endings_checked` counts how many of those returned an answer.
334
+ - While checks are running, `partial` is true. Repeat the search after a few
335
+ seconds for the finished result. After checks finish, `partial` is false and
336
+ paging is available. `unanswered_count` and `unanswered` give the count and
337
+ full names whose availability is still unknown. The list can include an exact
338
+ name checked separately from the priced endings.
339
+ - Limits: 10 searches or checks per minute and
340
+ 100 per day per user; a repeated search returns cached
341
+ results for 5 minutes.
342
+
343
+ ## Listing + removal
344
+
345
+ domain_list({ project_id: "my-app" }) // custom domains
346
+ domain_remove({ domain: "app.yourcompany.com" }) // remove or release a claim
347
+
348
+ Deleting an app yourself (`project_delete`) frees its custom domains and
349
+ email sending setup at once, not at the end of the 30-day retention:
350
+
351
+ - A DNS-record domain is removed the way `domain_remove` removes it: the
352
+ app's sending setup for that domain first, then its address.
353
+ - A claimed or bought domain is detached. It stays in your account,
354
+ unattached and reusable; its DNS zone and a purchase's renewal are
355
+ unchanged. The sending setup the platform made for it on the app is removed.
356
+ - Every sending domain the app held is released for another app.
357
+
358
+ Restoring a deleted app through support within the 30 days does not bring
359
+ back its domain connections or sending setup.
360
+
361
+ An app deleted because its subscription was cancelled is different: its
362
+ domains and sending setup stay connected to it until it is erased, 30 days
363
+ after its deletion began, so restoring it keeps them.
364
+
365
+ A domain the delete could not release stays with the deleted app, which
366
+ serves nothing. The answer is `503 DELETE_INCOMPLETE` with
367
+ `data.domains_pending` (each `{ domain, reason }`) and what was freed
368
+ (`domains_removed`, `domains_detached`, `sending_domains_removed`).
369
+ Repeating the delete releases the rest; if it is never repeated, the domain
370
+ is released when the app is erased.
@@ -0,0 +1,88 @@
1
+ # Platform Feedback — Bug? Doc gap? Tell us.
2
+
3
+ Send platform bugs, unclear documentation and feature requests with
4
+ `support_ticket`. Include what you tried, what you expected and what
5
+ happened. You can attach the project and structured context so the team
6
+ can investigate without asking you to repeat the basics.
7
+
8
+ ## Submit
9
+
10
+ ```ts
11
+ const t = await support_ticket({
12
+ message: "I need to reorder project groups in the dashboard. Is there a supported way to do that?",
13
+ project_id: "my-app", // optional
14
+ context: { area: "dashboard", action: "reorder groups" }, // optional
15
+ });
16
+ // → { ticket_id: "pfb_<ticket-id>", status: "open", created_at: 1715000000000 }
17
+ ```
18
+
19
+ Our team is alerted immediately with your message and ticket
20
+ id. They reply on the ticket — and **when they do, you get an email**
21
+ at the address on your account. No polling required.
22
+
23
+ ## Read back
24
+
25
+ Use these if you want to check before the email lands:
26
+
27
+ - `support_ticket({ ticket_id })` — one ticket, full
28
+ detail including the response.
29
+ - `support_ticket({ status?, limit? })` — every ticket
30
+ you've filed (most recent first), with status and response inline
31
+ (omit `message` and `ticket_id` to list).
32
+
33
+ ## Shape returned by status / list
34
+
35
+ A single-ticket read returns this ticket object inside the response
36
+ `data` field:
37
+
38
+ ```json
39
+ {
40
+ "ticket_id": "pfb_<ticket-id>",
41
+ "user_id": "<your user id>",
42
+ "email": "you@example.com",
43
+ "project_id": null,
44
+ "message": "your original report",
45
+ "context": null,
46
+ "status": "resolved",
47
+ "response": "This is fixed and live. No action needed.",
48
+ "responder": null,
49
+ "parent_id": null,
50
+ "created_at": 1715000000000,
51
+ "updated_at": 1715000360000,
52
+ "resolved_at": 1715000360000
53
+ }
54
+ ```
55
+
56
+ `status` is `open`, `investigating` or `resolved`. `response` is
57
+ `null` until the team answers, and `resolved_at` is `null` until the ticket is
58
+ resolved. `responder` is `null` unless you are platform staff. A list
59
+ returns `tickets` with the same fields except `context`, named `id` and
60
+ `responder_email` instead of `ticket_id` and `responder`.
61
+
62
+ ## What "good" looks like
63
+
64
+ A useful ticket gives the platform team three things in 4–5 lines:
65
+
66
+ 1. **What you tried** — exact endpoint or MCP tool + the args.
67
+ 2. **What you expected** — based on what doc or precedent.
68
+ 3. **What happened** — the raw response or error code, not a paraphrase.
69
+
70
+ For an error report, include the command or tool call and the returned
71
+ error code. For a feature request, describe the job you want to finish and
72
+ where the current workflow stops. Remove passwords, API keys and private
73
+ customer data from the example.
74
+
75
+ ## When to use which
76
+
77
+ - **Stuck on architecture** → `advisor({ question })`.
78
+ - **The platform itself is broken or unclear** → `support_ticket`.
79
+ - **You think the docs are wrong** → `support_ticket`. Include the topic,
80
+ the example you followed and what happened so we can correct the shared
81
+ documentation used by the website, CLI and MCP.
82
+
83
+ ## What the team does with it
84
+
85
+ The team investigates the report and records its answer on the ticket.
86
+ The response explains the fix, a workaround, or the information needed
87
+ to continue. For a documentation correction, include the topic and the
88
+ example so the update reaches the shared website, CLI and MCP docs.
@@ -0,0 +1,116 @@
1
+ # File tools — project-wide search, glob, diff and integrity check
2
+
3
+ These tools look across every file a project stores. They're for you and your
4
+ coding agent while developing, not for app code.
5
+
6
+ - **Search, glob and diff** are the developer tools `fs_search`, `fs_glob`
7
+ and `fs_diff`. The same operations are on `sw.fs.dev` in developer
8
+ `run_code`.
9
+ - **The integrity check** is only the developer tool `fs_integrity_check`.
10
+ `run_code` can't call it.
11
+
12
+ From a terminal, `somewhere call <tool> '<json>'` runs any of these tools;
13
+ a full MCP connection calls them directly.
14
+
15
+ A deployed function never has these tools, whether it handles a request, a
16
+ cron, a queue message or a job: `sw.fs.dev` is undefined there, and
17
+ `sw.fs.search`, `sw.fs.glob` and `sw.fs.diff` throw `FS_DEV_ONLY` (400). For
18
+ each user's own files, use `recipe-file-uploads`. Ordinary file calls,
19
+ `sw.fs.replace` included, are in `sw.fs`.
20
+
21
+ ## Who can use them
22
+
23
+ - The tools act with your developer login: the CLI, a full MCP connection or
24
+ an `smt_` key. The integrity check accepts nothing else and answers 403
25
+ `FORBIDDEN` to other callers, `run_code` included.
26
+ - `run_code` runs your script with the project's own authority, not your
27
+ developer key. Project environment values (`sw.env`) are omitted unless you
28
+ pass `include_env: true`.
29
+ - `sw.fs.dev` acts on the whole project and ignores any app user.
30
+ - Use these through developer tools. Never put a developer key in browser code.
31
+
32
+ ## Search, glob and diff
33
+
34
+ ```bash
35
+ # Every Markdown page under /content, paths only:
36
+ somewhere call fs_glob '{"project_id":"my-app","pattern":"/content/**/*.md"}'
37
+
38
+ # Pages that mention invoices; limit 20 is this example's choice:
39
+ somewhere call fs_search '{"project_id":"my-app","path":"/content/","query":"invoice","limit":20}'
40
+ ```
41
+
42
+ - **`fs_glob`** — `{ project_id, pattern, limit? }`. It reads paths only, not
43
+ contents, and supports `*`, `**`, `?` and `{a,b}`. A pattern can have up to
44
+ 500 characters, including the leading `/` (added
45
+ when omitted). `*` and `?` stay within one path segment; `**` can cross
46
+ `/`, including in the middle of a segment. `**/` matches zero or more
47
+ nonempty directory segments. Braces can nest and expand into at most
48
+ 64 plain patterns, each within the same character
49
+ limit. A larger expansion is refused with a validation error naming the
50
+ limit, never truncated. Backslash escapes `{`, `}` and backslash; an
51
+ unmatched brace stays literal. Brackets such as `[ab]` and other regex
52
+ punctuation are literal, not character classes or regular expressions.
53
+ Paths longer than 4,096 characters are refused by
54
+ glob matching. `limit` defaults to
55
+ 500 (5,000 at most). The answer is
56
+ `{ pattern, total, truncated, matches }`, and each match is
57
+ `{ path, size_bytes, content_type, version, updated_at }`.
58
+ - **`fs_search`** — `{ project_id, query, path?, limit?, max_files? }`. It
59
+ searches text files, judged by content type or extension, under `path`
60
+ (default `/`). A query can have up to 500
61
+ characters. `limit` defaults to 50
62
+ (500 at most). The answer is
63
+ `{ query, path, mode, total_matches, truncated, results }`.
64
+ - `mode: 'fts5'` uses the project's index. It matches each run of ASCII
65
+ letters and digits in the query as the start of a word, ignoring case,
66
+ and returns the best matches as `{ path, snippet }`. Each write indexes
67
+ the first 1,048,576 characters of a text file. When the index is
68
+ built for files already stored, files over 1,048,576 bytes are
69
+ skipped.
70
+ - `mode: 'scan'` is used when the index is not ready or falls back, and in development
71
+ environments. It's a literal, case-sensitive match, line by line, over at
72
+ most `max_files` files (500 by default,
73
+ 2,000 at most), and it skips files over
74
+ 1,048,576 bytes. Each result is
75
+ `{ path, line, snippet, before, after }`, and the answer adds
76
+ `files_scanned`. A production scan schedules index backfill.
77
+ - 503 `FILE_INDEX_UNAVAILABLE` means the index needs recovery; search
78
+ again later.
79
+ - **`fs_diff`** — `{ project_id, path, version? }`. It compares the current
80
+ text file with its previous version, or with the `version` you name, and
81
+ returns `{ path, from_version, to_version, changed_lines, diff }`.
82
+ `NOT_FOUND` means there's no earlier version, and `DIFF_TOO_LARGE` means a
83
+ side has more than 2,000 lines.
84
+
85
+ `truncated: true` means the answer reached `limit`, so there may be more. A
86
+ `limit` or `max_files` above its maximum is lowered to it; a longer query or
87
+ pattern is refused.
88
+
89
+ In `run_code`, the same operations are
90
+ `sw.fs.dev.glob(pattern, { limit? })`,
91
+ `sw.fs.dev.search({ query, path?, limit?, max_files? })` and
92
+ `sw.fs.dev.diff(path, { version? })`, with the same answers.
93
+
94
+ ## Integrity check: orphan file records
95
+
96
+ Reading a file whose stored bytes are missing answers `NOT_FOUND` and removes
97
+ that file's record. Its version records stay. To check a whole project, for
98
+ example after an incident, start read-only:
99
+
100
+ ```bash
101
+ somewhere call fs_integrity_check '{"project_id":"my-app"}'
102
+ ```
103
+
104
+ The answer is `{ scanned, orphan_files, orphan_versions, auto_clean,
105
+ cleaned, next_cursor }`. Each orphan file is `{ id, path, storage_key }`;
106
+ each orphan version is `{ id, file_id, version, storage_key }`. One call
107
+ checks up to `limit` files (1,000 by default,
108
+ 5,000 at most). Pass `next_cursor` back as `cursor` until
109
+ it's `null`.
110
+
111
+ Removing records is a separate, explicit choice. After reviewing the list,
112
+ repeat the call with `"auto_clean": true`. That call deletes the orphan
113
+ records it finds, together with their version records, and reports the counts
114
+ in `cleaned`. The deletion can't be undone; the stored bytes were already
115
+ gone. Over HTTP, the same call is `POST /v1/fs/{project_id}/integrity-check`
116
+ with a developer credential.