@zerct/zerct 0.1.12 → 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 (2) hide show
  1. package/bin/zerct.js +55 -22
  2. package/package.json +1 -1
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.12'
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
@@ -740,7 +773,7 @@ async function envCommand(cli) {
740
773
  if (cli.args[0] === 'delete') {
741
774
  const name = cli.args[1] || ''
742
775
  if (!name) {
743
- 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)
744
777
  }
745
778
  const token = await readOrLoginToken(process.cwd(), cli)
746
779
  const app = requireApp(cli)
@@ -777,7 +810,7 @@ async function domainsCommand(cli) {
777
810
 
778
811
  const domain = cli.args[1] || ''
779
812
  if (!domain) {
780
- 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)
781
814
  }
782
815
 
783
816
  const token = await readOrLoginToken(process.cwd(), cli)
@@ -891,7 +924,7 @@ async function pollLogin(cli, start) {
891
924
 
892
925
  function requireApp(cli) {
893
926
  if (!cli.app) {
894
- 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)
895
928
  }
896
929
  return cli.app
897
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerct/zerct",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Deploy Rust backends and static frontends to Zerct.",
5
5
  "type": "module",
6
6
  "bin": {