@fabrika/cli 0.4.0 → 0.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,19 +30,19 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "zod": "^3.25.76",
33
- "@fabrika/app": "^0.4.0",
34
- "@fabrika/auth-core": "^0.4.0",
35
- "@fabrika/control-contract": "^0.4.0",
36
- "@fabrika/provider-contract": "^0.4.0",
37
- "@fabrika/db": "^0.4.0",
38
- "@fabrika/platform": "^0.4.0",
39
- "@fabrika/platform-node": "^0.4.0",
40
- "@fabrika/check": "^0.4.0"
33
+ "@fabrika/app": "^0.4.2",
34
+ "@fabrika/auth-core": "^0.4.2",
35
+ "@fabrika/control-contract": "^0.4.2",
36
+ "@fabrika/provider-contract": "^0.4.2",
37
+ "@fabrika/db": "^0.4.2",
38
+ "@fabrika/platform": "^0.4.2",
39
+ "@fabrika/platform-node": "^0.4.2",
40
+ "@fabrika/check": "^0.4.2"
41
41
  },
42
42
  "peerDependencies": {
43
- "@fabrika/builder": "^0.4.0",
44
- "@fabrika/provider-cloudflare": "^0.4.0",
45
- "@fabrika/provider-zerops": "^0.4.0"
43
+ "@fabrika/builder": "^0.4.2",
44
+ "@fabrika/provider-cloudflare": "^0.4.2",
45
+ "@fabrika/provider-zerops": "^0.4.2"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@fabrika/builder": {
@@ -0,0 +1,120 @@
1
+ // What `fabrika app dev` stands in for outside the application: the dev outbox, which captures every request the
2
+ // process sends to `DEV_OUTBOX_ORIGIN` (a mail provider's stand-in, say), and `dev/dev.env`, the application's variables.
3
+
4
+ import { DEV_OUTBOX_ORIGIN, type DevOutboxMessage, type DevOutside } from '@fabrika/app/testing'
5
+ import { existsSync, readFileSync } from 'node:fs'
6
+ import { join } from 'node:path'
7
+ import { z } from 'zod/v4'
8
+
9
+ /** The application's variables for `app dev`, beside the seed. */
10
+ export const DEV_ENV_FILE = 'dev/dev.env'
11
+
12
+ const MAX_MESSAGES = 200
13
+ const MAX_BODY_BYTES = 256 * 1024
14
+ const VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/
15
+
16
+ /** A refusal of `dev/dev.env`; it names the line, never a value. */
17
+ export class DevEnvProblem extends Error {
18
+ override readonly name = 'DevEnvProblem'
19
+ }
20
+
21
+ /**
22
+ * The variables of `<root>/dev/dev.env`, or none without the file: `NAME=value` lines, `#` comments and blank lines; a
23
+ * value in matching single or double quotes loses them. A framework name (`FABRIKA_*`) is the platform's, not the
24
+ * application's, so it is refused.
25
+ */
26
+ export function readDevEnv(root: string): Readonly<Record<string, string>> {
27
+ const path = join(root, DEV_ENV_FILE)
28
+ if (!existsSync(path)) return {}
29
+ const variables: Record<string, string> = {}
30
+ const lines = readFileSync(path, 'utf8').split(/\r?\n/)
31
+ for (let index = 0; index < lines.length; index++) {
32
+ const line = (lines[index] ?? '').trim()
33
+ if (line === '' || line.startsWith('#')) continue
34
+ const at = line.indexOf('=')
35
+ const name = at < 0 ? '' : line.slice(0, at).trim()
36
+ if (!VARIABLE_NAME.test(name)) {
37
+ throw new DevEnvProblem(`app dev: ${DEV_ENV_FILE} line ${index + 1} is no NAME=value`)
38
+ }
39
+ if (name.startsWith('FABRIKA_')) {
40
+ throw new DevEnvProblem(`app dev: ${DEV_ENV_FILE} line ${index + 1} sets ${name}, a framework variable the kit writes itself`)
41
+ }
42
+ const raw = line.slice(at + 1).trim()
43
+ const quoted = raw.length >= 2 && (raw[0] === '"' || raw[0] === "'") && raw.endsWith(raw[0])
44
+ variables[name] = quoted ? raw.slice(1, -1) : raw
45
+ }
46
+ return variables
47
+ }
48
+
49
+ export interface DevOutbox extends DevOutside {
50
+ /** Captures the process's requests to `DEV_OUTBOX_ORIGIN` until the returned function restores `fetch`. */
51
+ install(): () => void
52
+ }
53
+
54
+ /** Whether a `fetch` call goes to the dev outbox, read off its URL without touching its body. */
55
+ function toOutbox(input: string | URL | Request): boolean {
56
+ const url = input instanceof Request ? input.url : String(input)
57
+ return URL.canParse(url) && new URL(url).origin === DEV_OUTBOX_ORIGIN
58
+ }
59
+
60
+ export function devOutbox(): DevOutbox {
61
+ const messages: DevOutboxMessage[] = []
62
+ const capture = async (request: Request): Promise<Response> => {
63
+ const body = await request.arrayBuffer()
64
+ if (body.byteLength > MAX_BODY_BYTES) {
65
+ return Response.json({ error: `the dev outbox keeps a body of at most ${MAX_BODY_BYTES} bytes` }, { status: 413 })
66
+ }
67
+ if (messages.length >= MAX_MESSAGES) messages.shift()
68
+ const id = (messages[messages.length - 1]?.id ?? 0) + 1
69
+ messages.push({
70
+ id,
71
+ method: request.method,
72
+ path: new URL(request.url).pathname,
73
+ contentType: request.headers.get('Content-Type'),
74
+ body: new TextDecoder().decode(body),
75
+ })
76
+ return Response.json({ id: `dev-outbox-${id}` })
77
+ }
78
+ return {
79
+ outbox: () => [...messages],
80
+ install() {
81
+ const original = globalThis.fetch
82
+ const captured: typeof fetch = Object.assign(
83
+ (input: string | URL | Request, init?: RequestInit): Promise<Response> =>
84
+ toOutbox(input) ? capture(new Request(input, init)) : original(input, init),
85
+ { preconnect: original.preconnect },
86
+ )
87
+ globalThis.fetch = captured
88
+ return () => {
89
+ if (globalThis.fetch === captured) globalThis.fetch = original
90
+ }
91
+ },
92
+ }
93
+ }
94
+
95
+ /** A message's body as the dev view shows it: JSON indented, anything else as it came. */
96
+ export function shownBody(message: DevOutboxMessage): string {
97
+ try {
98
+ return JSON.stringify(JSON.parse(message.body), null, 2)
99
+ } catch {
100
+ return message.body
101
+ }
102
+ }
103
+
104
+ /** The fields of a mail provider's JSON body the dev view shows; any other field is kept out of it. */
105
+ const MailHead = z.looseObject({ to: z.union([z.string(), z.array(z.string())]).optional(), subject: z.string().optional() })
106
+
107
+ /** The recipient and subject a mail provider's JSON body names (`to`, `subject`), else the request's path. */
108
+ export function mailHeadOf(message: DevOutboxMessage): { readonly to: string; readonly subject: string } {
109
+ let parsed: z.infer<typeof MailHead> = {}
110
+ try {
111
+ parsed = MailHead.safeParse(JSON.parse(message.body)).data ?? {}
112
+ } catch {
113
+ parsed = {}
114
+ }
115
+ const recipients = Array.isArray(parsed.to) ? parsed.to.join(', ') : (parsed.to ?? '')
116
+ return {
117
+ to: recipients === '' ? message.path : recipients,
118
+ subject: parsed.subject === undefined || parsed.subject === '' ? `${message.method} ${message.path}` : parsed.subject,
119
+ }
120
+ }
@@ -69,14 +69,14 @@ export function seedPath(root: string, given: string | null): string | null {
69
69
  return existsSync(conventional) ? conventional : null
70
70
  }
71
71
 
72
- /** The seed's default export, a function; its import runs application code, so the caller withholds what it throws. */
73
- export async function importSeed(path: string): Promise<(dev: unknown) => unknown> {
72
+ /** The seed's default export, a function of the kit and the dev outbox. */
73
+ export async function importSeed(path: string): Promise<(dev: unknown, outside: unknown) => unknown> {
74
74
  const module: unknown = await import(pathToFileURL(path).href)
75
75
  const seed: unknown = typeof module === 'object' && module !== null ? Reflect.get(module, 'default') : undefined
76
76
  if (typeof seed !== 'function') {
77
77
  throw new SeedProblem('app dev: the seed module default-exports no function: export default (async (dev) => { … }) satisfies DevSeed<…>')
78
78
  }
79
- return (dev) => Reflect.apply(seed, undefined, [dev])
79
+ return (dev, outside) => Reflect.apply(seed, undefined, [dev, outside])
80
80
  }
81
81
 
82
82
  /** What `answer`, the seed's result, offers the picker, or a `SeedProblem` naming the entry that is wrong. */
package/src/app-dev-ui.ts CHANGED
@@ -51,7 +51,8 @@ export interface LinkView {
51
51
  export interface MailView {
52
52
  readonly to: string
53
53
  readonly subject: string
54
- readonly status: 'open' | 'accepted' | 'cancelled' | 'expired'
54
+ /** An invitation's state, or `sent` for a message of the dev outbox. */
55
+ readonly status: 'open' | 'accepted' | 'cancelled' | 'expired' | 'sent'
55
56
  readonly action: { readonly label: string; readonly href: string } | null
56
57
  }
57
58
 
@@ -94,6 +95,7 @@ interface Strings {
94
95
  readonly invitation: (role: string, scope: string) => string
95
96
  readonly accept: string
96
97
  readonly continueAs: string
98
+ readonly openMessage: string
97
99
  readonly status: Readonly<Record<MailView['status'], string>>
98
100
  readonly to: string
99
101
  readonly picker: string
@@ -122,13 +124,14 @@ const STRINGS: Readonly<Record<Locale, Strings>> = {
122
124
  links: 'Link pages',
123
125
  linksText: 'Each opens as the holder of a link the application issued.',
124
126
  openLink: 'Open as link holder',
125
- mail: 'Mail sent by IAM',
126
- mailText: 'The invitations the stand-in IAM would have e-mailed.',
127
- noMail: 'IAM has sent nothing yet.',
127
+ mail: 'Mail',
128
+ mailText: 'The invitations the stand-in IAM would have e-mailed, and what the application sent to the dev outbox.',
129
+ noMail: 'Nothing has been sent yet.',
128
130
  invitation: (role, scope) => `Invitation: ${role} in ${scope}`,
129
131
  accept: 'Accept invitation',
130
132
  continueAs: 'Continue as this person',
131
- status: { open: 'waiting', accepted: 'accepted', cancelled: 'cancelled', expired: 'expired' },
133
+ openMessage: 'Open the message',
134
+ status: { open: 'waiting', accepted: 'accepted', cancelled: 'cancelled', expired: 'expired', sent: 'sent' },
132
135
  to: 'To',
133
136
  picker: 'Choose another caller',
134
137
  close: 'Close',
@@ -154,13 +157,14 @@ const STRINGS: Readonly<Record<Locale, Strings>> = {
154
157
  links: 'Stránky přes odkaz',
155
158
  linksText: 'Každá se otevře jako držitel odkazu, který aplikace vydala.',
156
159
  openLink: 'Otevřít jako držitel odkazu',
157
- mail: 'Pošta od IAM',
158
- mailText: 'Pozvánky, které by zástupný IAM odeslal e-mailem.',
159
- noMail: 'IAM zatím nic neodeslal.',
160
+ mail: 'Pošta',
161
+ mailText: 'Pozvánky, které by zástupný IAM odeslal e-mailem, a co aplikace poslala do vývojové schránky.',
162
+ noMail: 'Zatím nebylo nic odesláno.',
160
163
  invitation: (role, scope) => `Pozvánka: ${role} v ${scope}`,
161
164
  accept: 'Přijmout pozvánku',
162
165
  continueAs: 'Pokračovat jako tato osoba',
163
- status: { open: 'čeká', accepted: 'přijata', cancelled: 'zrušena', expired: 'vypršela' },
166
+ openMessage: 'Otevřít zprávu',
167
+ status: { open: 'čeká', accepted: 'přijata', cancelled: 'zrušena', expired: 'vypršela', sent: 'odesláno' },
164
168
  to: 'Komu',
165
169
  picker: 'Vybrat jiného volajícího',
166
170
  close: 'Zavřít',
package/src/app-dev.ts CHANGED
@@ -8,18 +8,20 @@ import { CONTRACT_FILE, IMPLEMENTATION_FILE } from '@fabrika/app/build'
8
8
  import { implementationAt } from '@fabrika/app/bun'
9
9
  import type { AnyContract } from '@fabrika/app/contract'
10
10
  import { BootError, type ContractImplementation } from '@fabrika/app/implement'
11
- import { type DevKit, devKit, type LabelledTestCaller, type TestCaller } from '@fabrika/app/testing'
11
+ import { DEV_OUTBOX_ORIGIN, type DevKit, devKit, type DevOutside, type LabelledTestCaller, type TestCaller } from '@fabrika/app/testing'
12
12
  import { TEST_POSTGRES_URL, type TestDatabase, testDatabase } from '@fabrika/db/testing'
13
13
  import { PostgresMigrationError } from '@fabrika/platform-node'
14
14
  import { MemoryFileObjects } from '@fabrika/platform/testing'
15
15
  import { existsSync } from 'node:fs'
16
16
  import { join } from 'node:path'
17
17
  import { z } from 'zod/v4'
18
+ import { DEV_ENV_FILE, DevEnvProblem, devOutbox, mailHeadOf, readDevEnv, shownBody } from './app-dev-outside'
18
19
  import { DEFAULT_SEED, importSeed, isLocalPath, NOTHING_SEEDED, parseSeeded, type Seeded, seedPath, SeedProblem } from './app-dev-seed'
19
20
  import {
20
21
  type Badge,
21
22
  type CurrentView,
22
23
  type DevView,
24
+ type MailView,
23
25
  noticePage,
24
26
  pickerPage,
25
27
  type RoleView,
@@ -40,8 +42,10 @@ and a throwaway schema of the database in ${TEST_POSTGRES_URL}, migrated from db
40
42
  The seed module (--seed, or ${DEFAULT_SEED} when it exists) default-exports a DevSeed of @fabrika/app/testing: it
41
43
  receives the kit, writes through the endpoints, and answers the personas, link pages and scope values to offer.
42
44
  Pick who the browser is at /__fabrika/dev; every SPA page shows a toolbar that switches the caller and lists the
43
- mail IAM sent. The application's own variables come from the environment. It listens on 127.0.0.1 (or ::1,
44
- localhost) only, port 3000 unless --port says otherwise (0 picks a free one), and prints the address it serves.
45
+ mail IAM sent and the requests the application sent to ${DEV_OUTBOX_ORIGIN}, the dev outbox. A form's challenge
46
+ passes. The application's own variables come from ${DEV_ENV_FILE} (NAME=value lines) over the environment. What the
47
+ seed or a job's handler throws is printed with its stack. It listens on 127.0.0.1 (or ::1, localhost) only, port
48
+ 3000 unless --port says otherwise (0 picks a free one), and prints the address it serves.
45
49
  `
46
50
 
47
51
  const LOOPBACK: ReadonlySet<string> = new Set(['127.0.0.1', '::1', 'localhost'])
@@ -50,6 +54,7 @@ const PICKER_PATH = '/__fabrika/dev'
50
54
  const CHOOSE_PATH = '/__fabrika/dev/as'
51
55
  const ACCEPT_PATH = '/__fabrika/dev/accept'
52
56
  const STATE_PATH = '/__fabrika/dev/state'
57
+ const OUTBOX_PATH = '/__fabrika/dev/outbox/'
53
58
  const TOOLBAR_PATH = '/__fabrika/dev/toolbar.js'
54
59
  const CHOICE_COOKIE = 'fabrika-dev-as'
55
60
  const MAX_SCOPE_VALUE = 200
@@ -69,12 +74,16 @@ export class AppDevError extends Error {
69
74
  }
70
75
 
71
76
  /**
72
- * What of a startup failure reaches the terminal: the message of `app dev`'s own refusal, of the seed's answer, of the
73
- * framework's boot and of the migration runner, which name no value of the environment; anything else (an application
74
- * module, the seed's own code, a driver, a dependency `deps` built) may carry a credential, so it is a fixed code.
77
+ * What of a startup failure reaches the terminal: the message of `app dev`'s own refusal (the seed's own throw, with its
78
+ * stack, included), of the seed's answer, of `dev/dev.env`, of the framework's boot and of the migration runner;
79
+ * anything else (an application module, a driver, a dependency `deps` built) may carry a credential, so it is a fixed
80
+ * code.
75
81
  */
76
82
  export function startupFailure(error: unknown): Error {
77
- if (error instanceof AppDevError || error instanceof SeedProblem || error instanceof BootError || error instanceof PostgresMigrationError) {
83
+ if (
84
+ error instanceof AppDevError || error instanceof SeedProblem || error instanceof DevEnvProblem || error instanceof BootError
85
+ || error instanceof PostgresMigrationError
86
+ ) {
78
87
  return new Error(error.message)
79
88
  }
80
89
  return new Error('app dev could not start: start_failed (the error is withheld: it may contain a credential)')
@@ -195,37 +204,66 @@ export async function startAppDev(app: ContractImplementation<AnyContract>, opti
195
204
  }
196
205
  }
197
206
 
198
- /** The seed's answer; its own code may throw anything, which is withheld, and its answer's problems are named. */
199
- async function runSeed(dev: DevKit<AnyContract>, path: string | null): Promise<Seeded> {
207
+ /**
208
+ * The seed's answer, and its answer's problems named. What its own code throws is printed whole, stack included: the
209
+ * developer's code on the developer's machine.
210
+ */
211
+ async function runSeed(dev: DevKit<AnyContract>, outside: DevOutside, path: string | null): Promise<Seeded> {
200
212
  if (path === null) return NOTHING_SEEDED
201
213
  let answer: unknown
202
214
  try {
203
215
  const seed = await importSeed(path)
204
- answer = await seed(dev.kit)
216
+ answer = await seed(dev.kit, outside)
205
217
  } catch (error) {
206
218
  if (error instanceof SeedProblem) throw error
207
- throw new AppDevError('app dev could not seed: seed_failed (the error is withheld: it may contain a credential; run the same calls in a test)')
219
+ throw new AppDevError(`app dev could not seed: the seed threw\n${Bun.inspect(error)}`)
208
220
  }
209
221
  return parseSeeded(dev, answer)
210
222
  }
211
223
 
212
- /** The server over the kit of `app`, on `postgres` when it has a data layer; its `stop` also drops the schema. */
224
+ /** What a job's handler threw, printed whole on the developer's terminal. */
225
+ const printHandlerError = (where: string, error: unknown): void => {
226
+ console.error(`fabrika app dev: ${where} threw\n${Bun.inspect(error)}`)
227
+ }
228
+
229
+ /**
230
+ * The server over the kit of `app`, on `postgres` when it has a data layer; its `stop` also drops the schema. The dev
231
+ * outbox captures the process's `fetch` from before the seed runs until `stop`, or until a failed start.
232
+ */
213
233
  async function serveThroughKit(
214
234
  app: ContractImplementation<AnyContract>,
215
235
  options: AppDevOptions,
216
236
  postgres: TestDatabase | null,
237
+ ): Promise<AppDevServer> {
238
+ const outbox = devOutbox()
239
+ const restoreFetch = outbox.install()
240
+ try {
241
+ return await serveDevKit(app, options, postgres, outbox, restoreFetch)
242
+ } catch (error) {
243
+ restoreFetch()
244
+ throw error
245
+ }
246
+ }
247
+
248
+ async function serveDevKit(
249
+ app: ContractImplementation<AnyContract>,
250
+ options: AppDevOptions,
251
+ postgres: TestDatabase | null,
252
+ outbox: DevOutside,
253
+ restoreFetch: () => void,
217
254
  ): Promise<AppDevServer> {
218
255
  const contract = app.contract
219
256
  const vocabulary = contract.vocabulary
220
257
  const hasFiles = Object.keys(contract.surface.files ?? {}).length > 0
221
258
  const dev = devKit(app, {
222
259
  root: options.root,
223
- env: applicationVariables(options.env),
260
+ env: { ...applicationVariables(options.env), ...readDevEnv(options.root) },
224
261
  ...(postgres === null ? {} : { database: postgres.database }),
225
262
  ...(hasFiles ? { files: new MemoryFileObjects() } : {}),
263
+ revealHandlerErrors: printHandlerError,
226
264
  })
227
265
  const kit = dev.kit
228
- const seeded = await runSeed(dev, options.seed)
266
+ const seeded = await runSeed(dev, outbox, options.seed)
229
267
  const text = stringsOf(vocabulary.locale ?? 'en')
230
268
  const title = vocabulary.displayName ?? vocabulary.app
231
269
  const mounts = Object.values(kit.artifact.mounts)
@@ -323,16 +361,23 @@ async function serveThroughKit(
323
361
  })),
324
362
  anonymousHref: chooseHref({ anonymous: '1' }, next),
325
363
  links: seeded.links.map((link) => ({ title: link.title, description: link.description, href: link.url })),
326
- mail: dev.invitations().map((invitation) => ({
327
- to: invitation.email,
328
- subject: text.invitation(invitation.role, scopeLabel(invitation.scope.type, invitation.scope.value)),
329
- status: invitation.status,
330
- action: invitation.status === 'open'
331
- ? { label: text.accept, href: `${ACCEPT_PATH}?${new URLSearchParams({ invitation: invitation.id, next }).toString()}` }
332
- : invitation.status === 'accepted' && invitees.has(invitation.id)
333
- ? { label: text.continueAs, href: chooseHref({ invitation: invitation.id }, next) }
334
- : null,
335
- })),
364
+ mail: [
365
+ ...dev.invitations().map((invitation): MailView => ({
366
+ to: invitation.email,
367
+ subject: text.invitation(invitation.role, scopeLabel(invitation.scope.type, invitation.scope.value)),
368
+ status: invitation.status,
369
+ action: invitation.status === 'open'
370
+ ? { label: text.accept, href: `${ACCEPT_PATH}?${new URLSearchParams({ invitation: invitation.id, next }).toString()}` }
371
+ : invitation.status === 'accepted' && invitees.has(invitation.id)
372
+ ? { label: text.continueAs, href: chooseHref({ invitation: invitation.id }, next) }
373
+ : null,
374
+ })),
375
+ ...outbox.outbox().map((message): MailView => ({
376
+ ...mailHeadOf(message),
377
+ status: 'sent',
378
+ action: { label: text.openMessage, href: `${OUTBOX_PATH}${message.id}` },
379
+ })),
380
+ ],
336
381
  pickerHref: `${PICKER_PATH}?${new URLSearchParams({ next }).toString()}`,
337
382
  })
338
383
 
@@ -435,8 +480,18 @@ async function serveThroughKit(
435
480
  return new Response(withToolbar(await response.text(), TOOLBAR_PATH), { status: 200, statusText: response.statusText, headers })
436
481
  }
437
482
 
483
+ /** A message of the dev outbox, its body as it came (JSON indented); its headers, which carry keys, are not kept. */
484
+ const outboxMessage = (path: string): Response => {
485
+ const message = outbox.outbox().find((candidate) => `${OUTBOX_PATH}${candidate.id}` === path)
486
+ if (message === undefined) return plain(404, 'no such message in the dev outbox')
487
+ return new Response(`${message.method} ${DEV_OUTBOX_ORIGIN}${message.path}\n\n${shownBody(message)}\n`, {
488
+ headers: { 'Content-Type': 'text/plain; charset=utf-8', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' },
489
+ })
490
+ }
491
+
438
492
  const devRoute = (request: Request, url: URL): Response | null => {
439
493
  if (request.method !== 'GET') return null
494
+ if (url.pathname.startsWith(OUTBOX_PATH)) return outboxMessage(url.pathname)
440
495
  switch (url.pathname) {
441
496
  case PICKER_PATH:
442
497
  return new Response(pickerPage(viewOf(choiceOf(request), nextOf(url.searchParams.get('next')))), { headers: PAGE_HEADERS })
@@ -483,6 +538,7 @@ async function serveThroughKit(
483
538
  try {
484
539
  await server.stop(true)
485
540
  } finally {
541
+ restoreFetch()
486
542
  await postgres?.close()
487
543
  }
488
544
  },
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import { CONTROL_USAGE, registerCompiledManifest, runControlCli } from './contro
9
9
  const USAGE = `fabrika — application platform CLI
10
10
 
11
11
  Usage:
12
+ fabrika platform guide --provider=zerops
12
13
  fabrika platform install --provider=zerops [provider options]
13
14
  fabrika platform init --provider=<cloudflare|zerops> [provider options]
14
15
  fabrika platform plan --provider=<cloudflare|zerops> [provider options]
@@ -29,6 +30,9 @@ Usage:
29
30
  fabrika job run <name>
30
31
  fabrika connect <add|pull> <app>/<export>@<version> --consumer=<app> --env=<env> [--url=<control origin>]
31
32
 
33
+ Installing the platform on Zerops? Run \`fabrika platform guide --provider=zerops\` first: the whole bring-up
34
+ in order, what to ask the human for, and the traps.
35
+
32
36
  For app commands, the provider is read from the config returned by the selected provider's defineApp().
33
37
  An explicit --provider is required only when no app config is available.
34
38