@fabrika/cli 0.9.0-dev.5 → 0.9.0-dev.50
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 +16 -13
- package/src/app-dev-seed.ts +2 -6
- package/src/app-dev-ui.ts +155 -24
- package/src/app-dev.ts +65 -24
- package/src/connect.ts +24 -8
- package/src/control-oauth.ts +463 -0
- package/src/control.ts +899 -105
- package/src/credential-origin.ts +54 -0
- package/src/data.ts +61 -24
- package/src/db.ts +35 -212
- package/src/index.ts +21 -5
- package/src/job.ts +2 -2
- package/src/operations.ts +737 -0
- package/types/src/app-dev-seed.d.ts +0 -2
- package/types/src/app-dev-ui.d.ts +22 -8
- package/types/src/connect.d.ts +4 -1
- package/types/src/control-oauth.d.ts +56 -0
- package/types/src/control.d.ts +86 -14
- package/types/src/credential-origin.d.ts +14 -0
- package/types/src/data.d.ts +3 -1
- package/types/src/db.d.ts +1 -3
- package/types/src/job.d.ts +1 -1
- package/types/src/operations.d.ts +23 -0
- package/src/junit.ts +0 -37
- package/types/src/junit.d.ts +0 -10
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { authoredAppProvider } from '@fabrika/provider-contract'
|
|
|
5
5
|
import { type AppCli, appCliFromModule, type NamespaceCli } from '@fabrika/provider-contract/app-cli'
|
|
6
6
|
import { installationCliFromModule, isInstallationCommand, supportsInstallationCommand } from '@fabrika/provider-contract/installation'
|
|
7
7
|
import { dirname, join, relative, resolve } from 'node:path'
|
|
8
|
-
import { CONTROL_USAGE, registerCompiledManifest, runControlCli } from './control.js'
|
|
8
|
+
import { ApprovalPendingError, CONTROL_USAGE, registerCompiledManifest, runControlCli } from './control.js'
|
|
9
9
|
|
|
10
10
|
const USAGE = `fabrika — application platform CLI
|
|
11
11
|
|
|
@@ -25,10 +25,11 @@ Usage:
|
|
|
25
25
|
[--domain=<host>] [--public-origin=<url>] [--trigger-ref=<ref>]
|
|
26
26
|
[--namespace=<id>] [--installation-id=<n|none>] [--url=<origin>] [--json]
|
|
27
27
|
fabrika namespace <plan|create|adopt|reconcile> --provider=zerops [provider options]
|
|
28
|
-
fabrika control <key|apps|namespaces|register|deploy|runs> [options]
|
|
28
|
+
fabrika control <key|apps|namespaces|register|deploy|runs|access|external-apps|oauth-clients> [options]
|
|
29
29
|
fabrika env <inspect|maintenance|operations|recover|backups|restore> <app> <env> [arguments] [--json]
|
|
30
|
+
fabrika operations <issues|issue|releases|health> [options] [--json]
|
|
30
31
|
fabrika builder <init|next|advance|gate|ensure-daemon|induce|build> [options]
|
|
31
|
-
fabrika db <new|migrate|codegen
|
|
32
|
+
fabrika db <new|migrate|codegen> [options]
|
|
32
33
|
fabrika job run <name>
|
|
33
34
|
fabrika connect <add|pull> <app>/<export>@<version> --consumer=<app> --env=<env> [--url=<control origin>]
|
|
34
35
|
|
|
@@ -51,7 +52,7 @@ A bare \`--trigger-ref\` is a branch (\`deploy/prod\` deploys on a push to \`ref
|
|
|
51
52
|
\`refs/tags/<tag>\` or a glob such as \`refs/tags/v*\`. \`fabrika control --help\` lists every form.
|
|
52
53
|
|
|
53
54
|
\`fabrika db\` manages an application's Postgres schema: migration files, applying them (the template's
|
|
54
|
-
\`run.initCommands\`)
|
|
55
|
+
\`run.initCommands\`) and the generated types. Run \`fabrika db --help\` for its surface.
|
|
55
56
|
|
|
56
57
|
\`fabrika job run <name>\` runs one c.cron job of a contract application: the command each crontab entry runs. Run
|
|
57
58
|
\`fabrika job --help\` for its surface.
|
|
@@ -66,6 +67,9 @@ provider-neutral, loads no installation package, and speaks the same typed API t
|
|
|
66
67
|
\`fabrika env\` shows an application environment's data and backups through the control plane, puts it into
|
|
67
68
|
maintenance, restores its data as of a past time, or recovers a stuck operation. Run \`fabrika env --help\` for its surface.
|
|
68
69
|
|
|
70
|
+
\`fabrika operations\` reads Operations — issues and their events, releases, health — through the console's API, with
|
|
71
|
+
FABRIKA_CONTROL_KEY. It is read-only. Run \`fabrika operations --help\` for its surface.
|
|
72
|
+
|
|
69
73
|
Which platform commands exist, and how WIDE each one is, is the provider's own answer — Zerops'
|
|
70
74
|
\`platform deploy\` owns the whole ordered sequence while Cloudflare's is one step of a scaffolded
|
|
71
75
|
workflow (ADR-0027), and only Zerops offers \`platform install\`, the from-scratch bring-up,
|
|
@@ -277,6 +281,11 @@ export const runCli = async (argv: readonly string[]): Promise<void> => {
|
|
|
277
281
|
console.info(ENV_USAGE)
|
|
278
282
|
return
|
|
279
283
|
}
|
|
284
|
+
if (parsed.help && parsed.area === 'operations') {
|
|
285
|
+
const { OPERATIONS_USAGE } = await import('./operations.js')
|
|
286
|
+
console.info(OPERATIONS_USAGE)
|
|
287
|
+
return
|
|
288
|
+
}
|
|
280
289
|
if (parsed.help && parsed.area === 'namespace') {
|
|
281
290
|
if (parsed.provider !== undefined && parsed.provider !== '') {
|
|
282
291
|
console.info((await namespaceCli(parsed.provider)).usage)
|
|
@@ -337,6 +346,12 @@ export const runCli = async (argv: readonly string[]): Promise<void> => {
|
|
|
337
346
|
await runEnvCli(parsed.command, parsed.rest)
|
|
338
347
|
return
|
|
339
348
|
}
|
|
349
|
+
if (parsed.area === 'operations') {
|
|
350
|
+
const { runOperationsCli } = await import('./operations.js')
|
|
351
|
+
const exitCode = await runOperationsCli(parsed.command, parsed.rest)
|
|
352
|
+
if (exitCode !== 0) process.exitCode = exitCode
|
|
353
|
+
return
|
|
354
|
+
}
|
|
340
355
|
if (parsed.area === 'db') {
|
|
341
356
|
const { runDbCli } = await import('./db.js')
|
|
342
357
|
await runDbCli(parsed.command, parsed.rest)
|
|
@@ -365,6 +380,7 @@ export const runCli = async (argv: readonly string[]): Promise<void> => {
|
|
|
365
380
|
if (import.meta.main) {
|
|
366
381
|
await runCli(process.argv.slice(2)).catch((error: unknown) => {
|
|
367
382
|
console.error(`fabrika: ${error instanceof Error ? error.message : String(error)}`)
|
|
368
|
-
|
|
383
|
+
// A write that waits for a person neither applied nor failed: its own code lets a script tell it apart.
|
|
384
|
+
process.exit(error instanceof ApprovalPendingError ? error.exitCode : 1)
|
|
369
385
|
})
|
|
370
386
|
}
|
package/src/job.ts
CHANGED
|
@@ -16,8 +16,8 @@ come from the environment only and leave the process before ${IMPLEMENTATION_FIL
|
|
|
16
16
|
process started again with the runtime role's credential in place of FABRIKA_APP_DATABASE_URL. A run takes the job's lease
|
|
17
17
|
or does not start. It exits 1 when the job failed, and 0 when it succeeded or a previous run still holds the lease.
|
|
18
18
|
A failure is named by a fixed code (timeout, lease_lost, handler_failed, query_refused, capability_refused,
|
|
19
|
-
driver_failed, crashed, unauthorized, iam_unavailable, boot_failed), never by the
|
|
20
|
-
its catalog reason (query_refused: undeclared_reach).
|
|
19
|
+
framework_fault, unavailable, driver_failed, crashed, unauthorized, iam_unavailable, boot_failed), never by the
|
|
20
|
+
application's error; a framework failure adds its catalog reason (query_refused: undeclared_reach).
|
|
21
21
|
`
|
|
22
22
|
|
|
23
23
|
export interface JobCommandDependencies {
|