feat: CLI consistency pass — unified args, verbs, and status
#1 Positional dest unified to `name` across info + dev verbs (was `project`). #2 install/uninstall help now states the activate semantics (tool→PATH, service/job→systemd, frontend→served) rather than 'to PATH'. #4 `service status` (a plural op) moved to `services status`; the singular `service` group is enable/disable only. #5 `list --behavior` now filters the program *catalog* by its real behavior field. behavior (what a program is) and service/job (how it's deployed) are separate axes: `list` shows a Programs catalog plus Services/Jobs deployment views; a behavior filter scopes the catalog only. #6 `list` uses lifecycle.is_active uniformly for the status dot (tool on PATH / service running / job timer / static frontend served) instead of registry presence. #7 New `castle restart <name>` — restart a service (unit) or job (timer). #8 New `castle status` — unified services + jobs + programs activation view. #9 New `castle format [name]` dev verb (ruff format / pnpm format); wired into stacks DEV_ACTIONS + handlers. #10 New `castle up` — deploy + start everything in one shot. Docs: CLAUDE.md command reference refreshed. Tests updated to the two-axis list model (+ a daemon-behavior program fixture). core 92 · cli 24 · api 52 green; ruff clean.
This commit is contained in:
@@ -10,12 +10,12 @@ from pathlib import Path
|
||||
|
||||
from castle_core.manifest import ProgramSpec
|
||||
|
||||
DEV_ACTIONS = ["build", "test", "lint", "type-check", "check", "run"]
|
||||
DEV_ACTIONS = ["build", "test", "lint", "format", "type-check", "check", "run"]
|
||||
INSTALL_ACTIONS = ["install", "uninstall"]
|
||||
ALL_ACTIONS = DEV_ACTIONS + INSTALL_ACTIONS
|
||||
|
||||
# Verbs a stack handler can provide (everything except `run`, which is declared-only).
|
||||
_STACK_VERBS = {"build", "test", "lint", "type-check", "check", "install", "uninstall"}
|
||||
_STACK_VERBS = {"build", "test", "lint", "format", "type-check", "check", "install", "uninstall"}
|
||||
# Verbs whose handler method name differs from the verb spelling.
|
||||
_VERB_METHOD = {"type-check": "type_check"}
|
||||
|
||||
@@ -77,6 +77,9 @@ class StackHandler:
|
||||
async def lint(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
raise NotImplementedError
|
||||
|
||||
async def format(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
raise NotImplementedError
|
||||
|
||||
async def type_check(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -133,6 +136,13 @@ class PythonHandler(StackHandler):
|
||||
program=name, action="lint", status="ok" if rc == 0 else "error", output=output
|
||||
)
|
||||
|
||||
async def format(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
src = _source_dir(comp, root)
|
||||
rc, output = await _run(["uv", "run", "ruff", "format", "."], src)
|
||||
return ActionResult(
|
||||
program=name, action="format", status="ok" if rc == 0 else "error", output=output
|
||||
)
|
||||
|
||||
async def type_check(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
src = _source_dir(comp, root)
|
||||
rc, output = await _run(["uv", "run", "pyright"], src)
|
||||
@@ -190,6 +200,13 @@ class ReactViteHandler(StackHandler):
|
||||
program=name, action="lint", status="ok" if rc == 0 else "error", output=output
|
||||
)
|
||||
|
||||
async def format(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
src = _source_dir(comp, root)
|
||||
rc, output = await _run(["pnpm", "format"], src)
|
||||
return ActionResult(
|
||||
program=name, action="format", status="ok" if rc == 0 else "error", output=output
|
||||
)
|
||||
|
||||
async def type_check(self, name: str, comp: ProgramSpec, root: Path) -> ActionResult:
|
||||
src = _source_dir(comp, root)
|
||||
rc, output = await _run(["pnpm", "type-check"], src)
|
||||
|
||||
Reference in New Issue
Block a user