Add local web UI for native packs (RBT-WP-0004-T02)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
parent
6056710e8e
commit
9cbdc11f5e
5 changed files with 282 additions and 4 deletions
|
|
@ -72,6 +72,9 @@ def main(argv: list[str] | None = None) -> int:
|
|||
sp.add_argument("--yes", action="store_true", help="confirm running a verify command")
|
||||
sp.add_argument("--pass", dest="passed", action="store_true", help="manual check: operator confirms it passed")
|
||||
sp.add_argument("--apply", action="store_true", help="finish: write the exercise-status change")
|
||||
sp = sub.add_parser("ui", help="serve the local UI on 127.0.0.1")
|
||||
sp.add_argument("roots", nargs="*", default=["."])
|
||||
sp.add_argument("--port", type=int, default=8877)
|
||||
sp = sub.add_parser("launch"); sp.add_argument("manifest")
|
||||
sp.add_argument("--timeout", type=float, default=30.0)
|
||||
sp = sub.add_parser("show"); sp.add_argument("manifest")
|
||||
|
|
@ -79,6 +82,15 @@ def main(argv: list[str] | None = None) -> int:
|
|||
sp.add_argument("--param", "-p", action="append", default=[], help="name=value")
|
||||
a = ap.parse_args(argv)
|
||||
|
||||
if a.cmd == "ui":
|
||||
from . import ui
|
||||
srv = ui.serve([Path(r) for r in a.roots], a.port)
|
||||
print(f"http://127.0.0.1:{a.port} (Ctrl-C stops)")
|
||||
try:
|
||||
srv.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
return 0
|
||||
if a.cmd in ("list", "validate"):
|
||||
packs = _packs(a.root)
|
||||
if not packs:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue