@zerct/zerct 0.1.11 → 0.1.13

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 (3) hide show
  1. package/README.md +4 -0
  2. package/bin/zerct.js +62 -25
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -20,6 +20,10 @@ on `0.0.0.0:$PORT` and expose the configured health endpoint.
20
20
  From a full-stack repo root, the same deploy command discovers nested
21
21
  `zerct.toml` files and deploys the whole workspace in one command.
22
22
 
23
+ Managed Postgres apps receive `DATABASE_URL`, `ZERCT_DATABASE_URL`, and
24
+ `ZERCT_DATABASE_CONNECTION_LIMIT`. Use that limit as the max size for your
25
+ database pool.
26
+
23
27
  Agents can also inspect API capabilities, account identity, usage, account
24
28
  activity, apps, complete app overviews, deploys, builds, app/deploy/build logs,
25
29
  env metadata, custom domains, domain verification, and billing portal links
package/bin/zerct.js CHANGED
@@ -4,7 +4,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSy
4
4
  import { homedir } from 'node:os'
5
5
  import path from 'node:path'
6
6
 
7
- const VERSION = '0.1.11'
7
+ const VERSION = '0.1.13'
8
8
  const DEFAULT_API_URL = 'https://api.zerct.com'
9
9
  const ARCHIVE_LIMIT_BYTES = 48 * 1024 * 1024
10
10
  const DEFAULT_DEPLOY_WAIT_TIMEOUT_SECONDS = 900
@@ -71,20 +71,20 @@ Usage:
71
71
  zerct usage [--api <url>] [--json]
72
72
  zerct activity [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
73
73
  zerct apps [--api <url>] [--json]
74
- zerct overview --app <app_id> [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
75
- zerct deploys [--app <app_id>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
76
- zerct builds [--app <app_id>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
77
- zerct logs --app <app_id> [--deploy <deploy_id>] [--build <build_id>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
78
- zerct status --app <app_id> [--api <url>] [--json]
79
- zerct inspect --app <app_id> [--api <url>] [--json]
80
- zerct db --app <app_id> [--api <url>] [--json]
81
- zerct env list --app <app_id> [--api <url>] [--json]
82
- zerct env set --app <app_id> KEY=value [--api <url>] [--json]
83
- zerct env delete --app <app_id> KEY [--api <url>] [--json]
84
- zerct domains list --app <app_id> [--api <url>] [--json]
85
- zerct domains add --app <app_id> <domain> [--api <url>] [--json]
86
- zerct domains verify --app <app_id> <domain> [--api <url>] [--json]
87
- zerct domains delete --app <app_id> <domain> [--api <url>] [--json]
74
+ zerct overview --app <app> [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
75
+ zerct deploys [--app <app>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
76
+ zerct builds [--app <app>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
77
+ zerct logs --app <app> [--deploy <deploy_id>] [--build <build_id>] [--limit <n>] [--cursor <cursor>] [--api <url>] [--json]
78
+ zerct status --app <app> [--api <url>] [--json]
79
+ zerct inspect --app <app> [--api <url>] [--json]
80
+ zerct db --app <app> [--api <url>] [--json]
81
+ zerct env list --app <app> [--api <url>] [--json]
82
+ zerct env set --app <app> KEY=value [--api <url>] [--json]
83
+ zerct env delete --app <app> KEY [--api <url>] [--json]
84
+ zerct domains list --app <app> [--api <url>] [--json]
85
+ zerct domains add --app <app> <domain> [--api <url>] [--json]
86
+ zerct domains verify --app <app> <domain> [--api <url>] [--json]
87
+ zerct domains delete --app <app> <domain> [--api <url>] [--json]
88
88
  zerct billing [portal] [--api <url>] [--json]
89
89
 
90
90
  Agent contract:
@@ -301,7 +301,7 @@ function installProject(projectDir) {
301
301
  }
302
302
 
303
303
  function doctorProject(projectDir, json) {
304
- const report = runDoctor(projectDir)
304
+ const report = runDoctorWorkspace(projectDir)
305
305
  if (json) {
306
306
  console.log(JSON.stringify(report, null, 2))
307
307
  if (!report.ok) {
@@ -310,16 +310,49 @@ function doctorProject(projectDir, json) {
310
310
  return
311
311
  }
312
312
 
313
- for (const check of report.checks) {
314
- console.log(`${check.ok ? 'ok' : 'fail'} ${check.name}${check.message ? ` - ${check.message}` : ''}`)
313
+ if (Array.isArray(report.projects)) {
314
+ for (const project of report.projects) {
315
+ console.log(`project ${project.relative}`)
316
+ for (const check of project.checks) {
317
+ console.log(`${check.ok ? 'ok' : 'fail'} ${check.name}${check.message ? ` - ${check.message}` : ''}`)
318
+ }
319
+ }
320
+ } else {
321
+ for (const check of report.checks) {
322
+ console.log(`${check.ok ? 'ok' : 'fail'} ${check.name}${check.message ? ` - ${check.message}` : ''}`)
323
+ }
315
324
  }
316
325
 
317
326
  if (!report.ok) {
318
- const firstFailure = report.checks.find((check) => !check.ok)
327
+ const checks = Array.isArray(report.projects)
328
+ ? report.projects.flatMap((project) => project.checks)
329
+ : report.checks
330
+ const firstFailure = checks.find((check) => !check.ok)
319
331
  throw agentError('doctor_failed', 'Zerct doctor failed.', firstFailure?.agent_instruction || 'Fix the failed checks and retry `npx @zerct/zerct doctor`.', json)
320
332
  }
321
333
  }
322
334
 
335
+ function runDoctorWorkspace(projectDir) {
336
+ if (existsSync(path.join(projectDir, 'zerct.toml'))) {
337
+ return runDoctor(projectDir)
338
+ }
339
+
340
+ const projects = discoverDeployProjects(projectDir)
341
+ if (projects.length === 0) {
342
+ return runDoctor(projectDir)
343
+ }
344
+
345
+ const reports = projects.map((project) => ({
346
+ relative: project.relative,
347
+ ...runDoctor(project.dir)
348
+ }))
349
+ return {
350
+ ok: reports.every((report) => report.ok),
351
+ workspace: projectDir,
352
+ projects: reports
353
+ }
354
+ }
355
+
323
356
  function runDoctor(projectDir) {
324
357
  const checks = []
325
358
  let config = null
@@ -494,9 +527,7 @@ async function deploy(projectDir, cli) {
494
527
  }
495
528
 
496
529
  if (cli.wait) {
497
- for (const result of results) {
498
- result.finalBuild = await waitForBuild(cli, token, result.response.build_job.id)
499
- }
530
+ await waitForWorkspaceBuilds(cli, token, results)
500
531
  }
501
532
 
502
533
  printWorkspaceDeployResults(projectDir, results, cli)
@@ -599,6 +630,12 @@ function printWorkspaceDeployResults(projectDir, results, cli) {
599
630
  }
600
631
  }
601
632
 
633
+ async function waitForWorkspaceBuilds(cli, token, results) {
634
+ await Promise.all(results.map(async (result) => {
635
+ result.finalBuild = await waitForBuild(cli, token, result.response.build_job.id)
636
+ }))
637
+ }
638
+
602
639
  async function waitForBuild(cli, token, buildId) {
603
640
  const deadline = Date.now() + cli.waitTimeoutSeconds * 1000
604
641
  let lastStatus = ''
@@ -736,7 +773,7 @@ async function envCommand(cli) {
736
773
  if (cli.args[0] === 'delete') {
737
774
  const name = cli.args[1] || ''
738
775
  if (!name) {
739
- throw agentError('invalid_env', 'Environment variable name is required.', 'Use `npx @zerct/zerct env delete --app <app_id> KEY`.', cli.json)
776
+ throw agentError('invalid_env', 'Environment variable name is required.', 'Use `npx @zerct/zerct env delete --app <app> KEY`.', cli.json)
740
777
  }
741
778
  const token = await readOrLoginToken(process.cwd(), cli)
742
779
  const app = requireApp(cli)
@@ -773,7 +810,7 @@ async function domainsCommand(cli) {
773
810
 
774
811
  const domain = cli.args[1] || ''
775
812
  if (!domain) {
776
- throw agentError('missing_domain', 'Domain is required.', 'Use `npx @zerct/zerct domains add --app <app_id> api.example.com`.', cli.json)
813
+ throw agentError('missing_domain', 'Domain is required.', 'Use `npx @zerct/zerct domains add --app <app> api.example.com`.', cli.json)
777
814
  }
778
815
 
779
816
  const token = await readOrLoginToken(process.cwd(), cli)
@@ -887,7 +924,7 @@ async function pollLogin(cli, start) {
887
924
 
888
925
  function requireApp(cli) {
889
926
  if (!cli.app) {
890
- throw agentError('missing_app', 'App id is required.', 'Pass `--app <app_id>`. Use the app id printed by `npx @zerct/zerct deploy`.', cli.json)
927
+ throw agentError('missing_app', 'App is required.', 'Pass `--app <app>` using either the app name from zerct.toml or the app id printed by deploy.', cli.json)
891
928
  }
892
929
  return cli.app
893
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerct/zerct",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Deploy Rust backends and static frontends to Zerct.",
5
5
  "type": "module",
6
6
  "bin": {