|
1
|
"""Boilerworks CLI — main entry point.""" |
|
2
|
|
|
3
|
from __future__ import annotations |
|
4
|
|
|
5
|
import click |
|
6
|
|
|
7
|
from boilerworks import __version__ |
|
8
|
|
|
9
|
|
|
10
|
@click.group() |
|
11
|
@click.version_option(__version__, prog_name="boilerworks") |
|
12
|
def main() -> None: |
|
13
|
"""Boilerworks — production-ready project templates.""" |
|
14
|
|
|
15
|
|
|
16
|
@main.command() |
|
17
|
def setup() -> None: |
|
18
|
"""Interactive wizard → writes boilerworks.yaml.""" |
|
19
|
from boilerworks.wizard import run_wizard |
|
20
|
|
|
21
|
run_wizard() |
|
22
|
|
|
23
|
|
|
24
|
@main.command(name="init") |
|
25
|
@click.option("--manifest", "manifest_path", default=None, help="Path to boilerworks.yaml") |
|
26
|
@click.option("--output", "output_dir", default=".", show_default=True, help="Output directory for generated project") |
|
27
|
@click.option("--dry-run", is_flag=True, default=False, help="Print what would happen without doing it") |
|
28
|
def init_command(manifest_path: str | None, output_dir: str, dry_run: bool) -> None: |
|
29
|
"""Clone a template and configure it from boilerworks.yaml.""" |
|
30
|
from boilerworks.generator import generate_from_manifest |
|
31
|
|
|
32
|
generate_from_manifest(manifest_path=manifest_path, output_dir=output_dir, dry_run=dry_run) |
|
33
|
|
|
34
|
|
|
35
|
@main.command() |
|
36
|
@click.option("--ops-dir", default=None, help="Path to ops directory (default: ../{project}-ops)") |
|
37
|
@click.option("--dry-run", is_flag=True, default=True, help="Show execution plan (v1 only supports dry-run)") |
|
38
|
def bootstrap(ops_dir: str | None, dry_run: bool) -> None: |
|
39
|
"""Show infrastructure bootstrap plan (Terraform — v2).""" |
|
40
|
from boilerworks.bootstrap import run_bootstrap |
|
41
|
|
|
42
|
run_bootstrap(ops_dir=ops_dir, dry_run=dry_run) |
|
43
|
|
|
44
|
|
|
45
|
@main.command(name="list") |
|
46
|
@click.option("--size", type=click.Choice(["full", "micro", "edge"]), default=None, help="Filter by template size") |
|
47
|
@click.option( |
|
48
|
"--language", |
|
49
|
type=click.Choice(["python", "typescript", "ruby", "php", "java", "go", "elixir", "rust", "svelte"]), |
|
50
|
default=None, |
|
51
|
help="Filter by primary language", |
|
52
|
) |
|
53
|
@click.option("--status", type=click.Choice(["done", "building", "planned"]), default=None, help="Filter by status") |
|
54
|
def list_command(size: str | None, language: str | None, status: str | None) -> None: |
|
55
|
"""List all available templates.""" |
|
56
|
from boilerworks.console import print_template_table |
|
57
|
from boilerworks.registry import Registry |
|
58
|
|
|
59
|
registry = Registry() |
|
60
|
templates = registry.list_all() |
|
61
|
|
|
62
|
if size: |
|
63
|
templates = [t for t in templates if t.size == size] |
|
64
|
if language: |
|
65
|
templates = [t for t in templates if t.language == language] |
|
66
|
if status: |
|
67
|
templates = [t for t in templates if t.status == status] |
|
68
|
|
|
69
|
print_template_table(templates) |
|
70
|
|