verulla-cli 0.0.4__tar.gz → 0.0.6__tar.gz

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 (29) hide show
  1. verulla_cli-0.0.6/CHANGELOG.md +9 -0
  2. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/PKG-INFO +2 -2
  3. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/pyproject.toml +2 -2
  4. verulla_cli-0.0.6/tests/test_cli_import.py +6 -0
  5. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_main.py +63 -5
  6. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/__init__.py +1 -1
  7. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/main.py +55 -11
  8. verulla_cli-0.0.4/tests/test_cli_import.py +0 -4
  9. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/.gitignore +0 -0
  10. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_admin_cmd.py +0 -0
  11. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_apps_client.py +0 -0
  12. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_auth.py +0 -0
  13. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_buildkit.py +0 -0
  14. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_buildkit_real.py +0 -0
  15. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_deploy_client.py +0 -0
  16. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_dev_check.py +0 -0
  17. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_emulate.py +0 -0
  18. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_owner_commands.py +0 -0
  19. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_packaging.py +0 -0
  20. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_secrets_client.py +0 -0
  21. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/tests/test_sketch_status.py +0 -0
  22. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/apps_client.py +0 -0
  23. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/auth.py +0 -0
  24. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/buildkit.py +0 -0
  25. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/config.py +0 -0
  26. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/deploy_client.py +0 -0
  27. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/emulate.py +0 -0
  28. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/packaging.py +0 -0
  29. {verulla_cli-0.0.4 → verulla_cli-0.0.6}/verulla_cli/secrets_client.py +0 -0
@@ -0,0 +1,9 @@
1
+ # verulla-cli changelog
2
+
3
+ ## 0.0.6
4
+
5
+ - Support the `port:` manifest field for Dockerfile apps, including the Dockerfile `EXPOSE` consistency check.
6
+
7
+ ## 0.0.5
8
+
9
+ - Make `verulla deploy --wait` wait for the deployed app's runtime health to become ready, not just build/apply completion. It exits nonzero on a crash and reports the available crash cause plus a hint to check the configured (or default 8080) listening port; the wait timeout remains bounded.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verulla-cli
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: docker>=7
6
6
  Requires-Dist: httpx>=0.27
7
7
  Requires-Dist: typer>=0.12
8
- Requires-Dist: verulla-manifest==0.0.2
8
+ Requires-Dist: verulla-manifest==0.0.3
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "verulla-cli"
3
- version = "0.0.4"
3
+ version = "0.0.6"
4
4
  requires-python = ">=3.12"
5
5
  dependencies = [
6
- "verulla-manifest==0.0.2",
6
+ "verulla-manifest==0.0.3",
7
7
  "typer>=0.12",
8
8
  "httpx>=0.27",
9
9
  "docker>=7",
@@ -0,0 +1,6 @@
1
+ def test_import():
2
+ import verulla_cli
3
+ import verulla_manifest
4
+
5
+ assert verulla_cli.__version__ == "0.0.6"
6
+ assert verulla_manifest.__version__ == "0.0.3"
@@ -10,6 +10,13 @@ from verulla_cli.main import _secret_scope, app
10
10
  runner = CliRunner()
11
11
 
12
12
 
13
+ def test_cli_reports_installed_version() -> None:
14
+ result = runner.invoke(app, ["--version"])
15
+
16
+ assert result.exit_code == 0
17
+ assert result.output.strip() == "verulla 0.0.6"
18
+
19
+
13
20
  def test_auth_and_customer_commands_are_registered() -> None:
14
21
  result = runner.invoke(app, ["--help"])
15
22
  assert result.exit_code == 0
@@ -317,6 +324,36 @@ def test_deploy_valid_manifest_not_logged_in(tmp_path, monkeypatch) -> None:
317
324
  assert "not authenticated" in result.output
318
325
 
319
326
 
327
+ def test_deploy_accepts_dockerfile_port_before_login(tmp_path, monkeypatch) -> None:
328
+ monkeypatch.setattr("verulla_cli.main.get_token", _not_logged_in)
329
+ (tmp_path / "Dockerfile").write_text("FROM example\nEXPOSE 8000\n")
330
+ (tmp_path / "verulla.yml").write_text(
331
+ "version: 1\napp: demo-app\nfunctions:\n"
332
+ " - name: web\n runtime: dockerfile\n port: 8000\n"
333
+ "routes:\n - path: /\n function: web\n"
334
+ )
335
+
336
+ result = runner.invoke(app, ["deploy", str(tmp_path), "--api-url", "http://127.0.0.1:1"])
337
+
338
+ assert result.exit_code == 1
339
+ assert "not authenticated" in result.output
340
+ assert "port" not in result.output.lower()
341
+
342
+
343
+ def test_deploy_rejects_unknown_manifest_key_before_login(tmp_path, monkeypatch) -> None:
344
+ def _boom():
345
+ raise AssertionError("get_token must not be called for invalid manifests")
346
+
347
+ monkeypatch.setattr("verulla_cli.main.get_token", _boom)
348
+ (tmp_path / "verulla.yml").write_text(VALID_MANIFEST + "unexpected: true\n")
349
+
350
+ result = runner.invoke(app, ["deploy", str(tmp_path), "--api-url", "http://127.0.0.1:1"])
351
+
352
+ assert result.exit_code == 1
353
+ assert "Error" in result.output
354
+ assert "unexpected" in result.output
355
+
356
+
320
357
  def test_deploy_success_prints_deployment(tmp_path, monkeypatch) -> None:
321
358
  monkeypatch.setattr(
322
359
  "verulla_cli.main.get_token", lambda: "tok"
@@ -355,7 +392,7 @@ def test_deploy_wait_success_prints_sketch_handoff(tmp_path, monkeypatch) -> Non
355
392
  })
356
393
  states = iter([
357
394
  {"status": "building", "build_log_tail": ""},
358
- {"status": "deployed", "build_log_tail": ""},
395
+ {"status": "deployed", "runtime_health": "ready", "build_log_tail": ""},
359
396
  ])
360
397
  monkeypatch.setattr("verulla_cli.main.get_deployment", lambda *args: next(states))
361
398
  monkeypatch.setattr("verulla_cli.main.get_sketch_status", lambda *args: {
@@ -389,7 +426,25 @@ def test_deploy_wait_failure_exits_nonzero_and_shows_build_log_tail(tmp_path, mo
389
426
  assert result.exit_code == 1
390
427
  assert "verulla logs demo-app" in result.output
391
428
  assert "build output tail" in result.output
392
- assert "Runtime/pod logs are not available yet" in result.output
429
+ assert "Runtime health is shown above" in result.output
430
+
431
+
432
+ def test_deploy_wait_crashing_reports_runtime_reason_and_hint(tmp_path, monkeypatch) -> None:
433
+ monkeypatch.setattr("verulla_cli.main.get_token", lambda: "tok")
434
+ monkeypatch.setattr("verulla_cli.main.create_deployment", lambda *args: {
435
+ "id": "d-crash", "app": "demo-app", "status": "queued",
436
+ })
437
+ monkeypatch.setattr("verulla_cli.main.get_deployment", lambda *args: {
438
+ "id": "d-crash", "status": "deployed", "runtime_health": "crashing",
439
+ "runtime_health_reason": "Error (exit code 1); sqlite3.OperationalError: unable to open database file",
440
+ "effective_port": 8000,
441
+ })
442
+ result = runner.invoke(app, ["deploy", str(_valid_project(tmp_path)), "--api-url", "http://api.test", "--wait"])
443
+ assert result.exit_code == 1
444
+ assert "crashing" in result.output
445
+ assert "unable to open database file" in result.output
446
+ assert "filesystem is read-only except /tmp" in result.output
447
+ assert "make sure the app listens on the port set in verulla.yml (8000)" in result.output
393
448
 
394
449
 
395
450
  def test_deploy_wait_timeout_exits_nonzero_with_inspection_action(tmp_path, monkeypatch) -> None:
@@ -397,13 +452,15 @@ def test_deploy_wait_timeout_exits_nonzero_with_inspection_action(tmp_path, monk
397
452
 
398
453
  monkeypatch.setattr(cli_main, "get_token", lambda: "tok")
399
454
  monkeypatch.setattr(cli_main, "create_deployment", lambda *args: {"id": "d-slow", "app": "demo-app", "status": "queued"})
400
- monkeypatch.setattr(cli_main, "get_deployment", lambda *args: {"status": "building"})
455
+ monkeypatch.setattr(cli_main, "get_deployment", lambda *args: {"status": "building", "runtime_health": "starting",
456
+ "runtime_health_reason": "app did not answer on port 8000; set port: in verulla.yml"})
401
457
  monkeypatch.setattr(cli_main.time, "monotonic", iter([0.0, 0.0, 2.0]).__next__)
402
458
  monkeypatch.setattr(cli_main.time, "sleep", lambda _: None)
403
459
  result = runner.invoke(app, ["deploy", str(_valid_project(tmp_path)), "--api-url", "http://api.test", "--wait", "--wait-timeout", "1"])
404
460
  assert result.exit_code == 1
405
461
  assert "Timed out after 1s" in result.output
406
462
  assert "verulla logs demo-app" in result.output
463
+ assert "app did not answer on port 8000" in result.output
407
464
 
408
465
 
409
466
  def test_deploy_logged_in_unreachable_api_fails_cleanly(tmp_path, monkeypatch) -> None:
@@ -480,7 +537,7 @@ def test_logs_fetches_and_prints_build_log(monkeypatch) -> None:
480
537
  assert result.exit_code == 0, result.output
481
538
  assert "status: failed" in result.output
482
539
  assert "compiler output" in result.output
483
- assert "Runtime/pod logs are not available yet." in result.output
540
+ assert "Runtime/pod logs are not included" in result.output
484
541
 
485
542
 
486
543
  def test_logs_reports_api_errors(monkeypatch) -> None:
@@ -527,10 +584,11 @@ def test_status_includes_plan_and_paid_term_fields(monkeypatch) -> None:
527
584
  monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {
528
585
  "app": "demo", "tier_id": "live", "pricing_version": "v1",
529
586
  "paid_through": "2026-11-25T00:00:00+00:00", "renewal_date": "2026-11-25", "status": "deployed",
587
+ "runtime_health": "crashing", "runtime_health_reason": "exit code 1",
530
588
  })
531
589
  result = runner.invoke(app, ["status", "demo", "--api-url", "https://api.test"])
532
590
  assert result.exit_code == 0, result.output
533
- for field in ("tier_id: live", "pricing_version: v1", "paid_through:", "renewal_date: 2026-11-25"):
591
+ for field in ("tier_id: live", "pricing_version: v1", "paid_through:", "renewal_date: 2026-11-25", "runtime_health: crashing", "runtime_health_reason: exit code 1"):
534
592
  assert field in result.output
535
593
 
536
594
 
@@ -4,4 +4,4 @@ Human + agent entry point: login (OIDC device flow), dev (local Docker
4
4
  emulation via verulla_manifest), deploy, secrets, logs.
5
5
  """
6
6
 
7
- __version__ = "0.0.3"
7
+ __version__ = "0.0.6"
@@ -11,6 +11,7 @@ import uuid
11
11
 
12
12
  import typer
13
13
 
14
+ from verulla_cli import __version__
14
15
  from verulla_cli.config import DEFAULT_API_URL
15
16
  from verulla_cli.auth import CREDENTIALS_PATH, DeviceLoginError, get_token, run_device_login, save_credentials
16
17
  from verulla_manifest import load_manifest, translate
@@ -56,7 +57,21 @@ app = typer.Typer(
56
57
  name="verulla",
57
58
  help=f"Verulla: AI-agent-friendly deployment & hosting CLI. API URL default: {DEFAULT_API_URL} (override with --api-url or VERULLA_API_URL).",
58
59
  no_args_is_help=True,
60
+ invoke_without_command=True,
59
61
  )
62
+
63
+
64
+ @app.callback()
65
+ def _main(
66
+ version: bool = typer.Option(
67
+ False, "--version", is_eager=True, help="Show the installed Verulla CLI version and exit."
68
+ ),
69
+ ) -> None:
70
+ if version:
71
+ typer.echo(f"verulla {__version__}")
72
+ raise typer.Exit()
73
+
74
+
60
75
  sketch_app = typer.Typer(name="sketch", help="Inspect Sketch trial lifecycle status.", no_args_is_help=True)
61
76
  app.add_typer(sketch_app, name="sketch")
62
77
  owner_app = typer.Typer(name="owner", help="Manage the verified owner hand-off.", no_args_is_help=True)
@@ -339,7 +354,7 @@ def deploy(
339
354
  envvar="VERULLA_API_URL", show_default=True,
340
355
  help="Verulla control plane base URL.",
341
356
  ),
342
- wait: bool = typer.Option(False, "--wait", help="Wait for build/apply to finish, then print the Sketch hand-off."),
357
+ wait: bool = typer.Option(False, "--wait", help="Wait for runtime health to be ready; fail with the crash cause and port hint otherwise."),
343
358
  wait_timeout: int = typer.Option(600, "--wait-timeout", min=1, max=3600,
344
359
  help="Maximum seconds to wait (1-3600; default 600)."),
345
360
  ) -> None:
@@ -378,7 +393,7 @@ def deploy(
378
393
  for fn in deployment.get("functions", []):
379
394
  typer.echo(f" {fn['name']} ({fn['adapter']})")
380
395
  if wait:
381
- terminal = {"deployed", "build_failed", "apply_failed", "failed", "deleted", "delete_failed", "superseded", "suspended"}
396
+ terminal = {"build_failed", "apply_failed", "failed", "deleted", "delete_failed", "superseded", "suspended"}
382
397
  deadline = time.monotonic() + wait_timeout
383
398
  while True:
384
399
  try:
@@ -387,18 +402,37 @@ def deploy(
387
402
  typer.echo(f"Error checking deployment status: {exc}", err=True)
388
403
  raise typer.Exit(code=1) from exc
389
404
  status = latest.get("status")
390
- if status in terminal:
405
+ runtime_health = latest.get("runtime_health", "starting")
406
+ if status in terminal or runtime_health in {"crashing", "failed"} or (
407
+ status == "deployed" and runtime_health == "ready"
408
+ ):
391
409
  break
392
410
  remaining = deadline - time.monotonic()
393
411
  if remaining <= 0:
394
412
  typer.echo(
395
- f"Timed out after {wait_timeout}s waiting for deployment {deployment['id']} (last status: {status}). "
413
+ f"Timed out after {wait_timeout}s waiting for deployment {deployment['id']} "
414
+ f"(last status: {status}, runtime health: {runtime_health}). "
415
+ f"Runtime reason: {latest.get('runtime_health_reason') or '(none reported)'}. "
396
416
  f"Inspect with: verulla logs {deployment['app']}", err=True,
397
417
  )
398
418
  raise typer.Exit(code=1)
399
419
  time.sleep(min(2, remaining))
400
- if status != "deployed":
420
+ if status != "deployed" or runtime_health != "ready":
401
421
  typer.echo(f"Deployment {deployment['id']} ended with status {status}.", err=True)
422
+ if runtime_health in {"crashing", "failed"}:
423
+ reason = latest.get("runtime_health_reason") or "no runtime details reported"
424
+ typer.echo(f"App exited at startup: {reason}", err=True)
425
+ typer.echo(f"Runtime health: {runtime_health}", err=True)
426
+ port = latest.get("effective_port")
427
+ hint = (
428
+ f"make sure the app listens on the port set in verulla.yml ({port})"
429
+ if isinstance(port, int)
430
+ else "make sure the app listens on the port set in verulla.yml (default 8080)"
431
+ )
432
+ typer.echo(
433
+ f"Hint: app exited at startup; the filesystem is read-only except /tmp; {hint}.",
434
+ err=True,
435
+ )
402
436
  if latest.get("error"):
403
437
  typer.echo(f"Error: {latest['error']}", err=True)
404
438
  try:
@@ -410,7 +444,7 @@ def deploy(
410
444
  typer.echo("build_log_tail:", err=True)
411
445
  tail = logs.get("build_log_tail") if logs.get("deployment_id") == deployment["id"] else None
412
446
  typer.echo(tail or "(no matching build log available)", err=True)
413
- typer.echo("Runtime/pod logs are not available yet.", err=True)
447
+ typer.echo("Runtime health is shown above; pod log tails are not included in this output.", err=True)
414
448
  raise typer.Exit(code=1)
415
449
  try:
416
450
  receipt = _safe_sketch_receipt(get_sketch_status(api_url.rstrip("/"), token, deployment["app"]))
@@ -547,11 +581,11 @@ def logs(
547
581
  except AppsError as exc:
548
582
  typer.echo(f"Error: {exc}", err=True)
549
583
  raise typer.Exit(code=1) from exc
550
- for key in ("app", "deployment_id", "status", "error"):
584
+ for key in ("app", "deployment_id", "status", "runtime_health", "runtime_health_reason", "error"):
551
585
  typer.echo(f"{key}: {result.get(key)}")
552
586
  typer.echo("build_log_tail:")
553
587
  typer.echo(result.get("build_log_tail") or "(no build log available)")
554
- typer.echo("Runtime/pod logs are not available yet.")
588
+ typer.echo("Runtime/pod logs are not included; see runtime_health and runtime_health_reason above.")
555
589
 
556
590
 
557
591
  def _resolve_app(name: str | None) -> str:
@@ -587,7 +621,12 @@ def apps(
587
621
  typer.echo("No apps.")
588
622
  return
589
623
  for row in rows:
590
- typer.echo(f"{row['app']} {row['status']} {row.get('url') or '-'}")
624
+ typer.echo(
625
+ f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
626
+ f"{row.get('url') or '-'}"
627
+ )
628
+ if row.get("runtime_health_reason"):
629
+ typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
591
630
 
592
631
 
593
632
  @app.command()
@@ -727,10 +766,15 @@ def status(
727
766
  if app_name is None:
728
767
  rows = list_apps(api_url.rstrip("/"), token)
729
768
  for row in rows:
730
- typer.echo(f"{row['app']} {row['status']} {row.get('url') or '-'}")
769
+ typer.echo(
770
+ f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
771
+ f"{row.get('url') or '-'}"
772
+ )
773
+ if row.get("runtime_health_reason"):
774
+ typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
731
775
  else:
732
776
  row = get_app(api_url.rstrip("/"), token, app_name)
733
- for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
777
+ for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "runtime_health", "runtime_health_reason", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
734
778
  if key in row:
735
779
  typer.echo(f"{key}: {row[key]}")
736
780
  except AppsError as exc:
@@ -1,4 +0,0 @@
1
- def test_import():
2
- import verulla_cli
3
-
4
- assert verulla_cli.__version__
File without changes