Populate the program stack select from castle-api
The dashboard's stack dropdown hardcoded its options (python-cli/fastapi/ react-vite), so a supabase program showed "(none)" — the value had no matching option. Make the backend the single source of truth instead: - core: available_stacks() returns sorted(HANDLERS) — the stacks castle has handlers for. - castle-api: GET /stacks exposes it. - cli: --stack choices derive from available_stacks() (drops the duplicated list). - app: ProgramFields fetches /stacks (useStacks) and renders options from it, always including the current value so it never silently blanks; StackBadge gets a Supabase label. A new backend stack now appears everywhere without a frontend edit.
This commit is contained in:
@@ -12,6 +12,8 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from castle_core.stacks import available_stacks
|
||||
|
||||
from castle_cli import __version__
|
||||
|
||||
DEV_VERBS = ["build", "test", "lint", "format", "type-check", "check"]
|
||||
@@ -37,11 +39,7 @@ def _build_program_group(subparsers: argparse._SubParsersAction) -> None:
|
||||
|
||||
p = sub.add_parser("create", help="Scaffold a new program")
|
||||
_add_name(p, "Program name")
|
||||
p.add_argument(
|
||||
"--stack",
|
||||
choices=["python-cli", "python-fastapi", "react-vite", "supabase"],
|
||||
default=None,
|
||||
)
|
||||
p.add_argument("--stack", choices=available_stacks(), default=None)
|
||||
p.add_argument("--description", default="", help="Program description")
|
||||
p.add_argument("--port", type=int, help="Port (daemons only)")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user