feat: Add castle build command

Added castle build [project] command following the same pattern as castle test and castle lint. Stack handlers already had build methods — this just wires up the CLI to expose them.

Supports building a single project or all projects, providing feature parity with existing project-level commands.
This commit is contained in:
2026-04-27 20:48:35 -07:00
parent 529ca53242
commit b720a96c6e
2 changed files with 37 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
"""castle test / castle lint - run dev commands across projects."""
"""castle build / castle test / castle lint - run dev commands across projects."""
from __future__ import annotations
@@ -98,3 +98,29 @@ def run_lint(args: argparse.Namespace) -> int:
else:
print("\nSome lint checks failed.")
return 0 if all_passed else 1
def run_build(args: argparse.Namespace) -> int:
"""Run build for one or all projects."""
config = load_config()
if args.project:
success = _run_action(config, args.project, "build")
return 0 if success else 1
# Run all buildable projects
all_passed = True
for name, comp in config.programs.items():
if not comp.source:
continue
handler = get_handler(comp.stack)
if handler is None:
continue
if not _run_action(config, name, "build"):
all_passed = False
if all_passed:
print("\nAll builds succeeded.")
else:
print("\nSome builds failed.")
return 0 if all_passed else 1