pyvolt-cli 0.6.0__tar.gz → 0.7.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyvolt-cli
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: The command-line companion to Pyvolt: managed Python deployments on infrastructure you actually own.
5
5
  Project-URL: Homepage, https://pyvolt.com
6
6
  Project-URL: Repository, https://github.com/pyvolt-hq/pyvolt-cli
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pyvolt-cli"
7
- version = "0.6.0"
7
+ version = "0.7.0"
8
8
  description = "The command-line companion to Pyvolt: managed Python deployments on infrastructure you actually own."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -634,3 +634,67 @@ def keys_rm(key_id: int = typer.Argument(..., metavar="ID", help="Key ID from `p
634
634
  """Remove an SSH public key by ID."""
635
635
  Api().delete(f"/v1/ssh-keys/{key_id}")
636
636
  console.print(f"[green]✓[/green] Removed key {key_id}. Re-syncing your servers.")
637
+
638
+
639
+ @apps_app.command("export-config")
640
+ def apps_export_config(
641
+ app_name: str = typer.Argument(..., metavar="DOMAIN"),
642
+ write: bool = typer.Option(
643
+ False, "--write", "-w", help="Write ./pyvolt.toml instead of printing it."
644
+ ),
645
+ ):
646
+ """Generate a pyvolt.toml from the app's current settings (ADR-0012).
647
+
648
+ Commit the file to manage this app's deploy config from the repo. Its keys
649
+ then override the dashboard on every deploy; omitted keys keep their current
650
+ values."""
651
+ from pathlib import Path
652
+
653
+ api = Api()
654
+ site = api.resolve_app(app_name)
655
+ body = api.get(f"/v1/apps/{site['id']}/config")
656
+ if _emit(body):
657
+ return
658
+ toml = body["toml"]
659
+ if not write:
660
+ # Raw stdout (no Rich markup/wrapping) so `> pyvolt.toml` is byte-clean.
661
+ print(toml, end="")
662
+ return
663
+ p = Path("pyvolt.toml")
664
+ if p.exists():
665
+ raise fail("pyvolt.toml already exists here — remove it first, or drop --write to print.")
666
+ p.write_text(toml)
667
+ console.print(
668
+ f"[green]✓ Wrote pyvolt.toml[/] ({len(toml.splitlines())} lines). "
669
+ "Commit it to manage this app's deploy config from the repo."
670
+ )
671
+
672
+
673
+ config_app = typer.Typer(
674
+ help="Validate and export pyvolt.toml (repo deploy config).", no_args_is_help=True
675
+ )
676
+ app.add_typer(config_app, name="config")
677
+
678
+
679
+ @config_app.command("validate")
680
+ def config_validate(
681
+ path: str = typer.Argument("pyvolt.toml", help="Path to the file to validate."),
682
+ ):
683
+ """Check a local pyvolt.toml against the server's schema — the SAME check the
684
+ deploy runs, so a pass here means the deploy won't reject it."""
685
+ from pathlib import Path
686
+
687
+ p = Path(path)
688
+ if not p.exists():
689
+ raise fail(f"No file at [bold]{path}[/bold].")
690
+ body = Api().post("/v1/config/validate", json={"text": p.read_text()}).json()
691
+ if _emit(body):
692
+ return
693
+ if body["valid"]:
694
+ managed = ", ".join(body.get("managed") or []) or "nothing"
695
+ console.print(f"[green]✓ {path} is valid.[/] It manages: {managed}")
696
+ return
697
+ console.print(f"[red]✗ {path} has problems:[/]")
698
+ for err in body["errors"]:
699
+ console.print(f" • {err}")
700
+ raise typer.Exit(1)
File without changes
File without changes
File without changes