update 33.1 50

This commit is contained in:
2026-08-10 03:23:30 -03:00
parent 33f0559268
commit ef63b02554
23 changed files with 753 additions and 368 deletions

37
ctrl/build.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Build a room into gen/ — thin wrapper over build.py.
#
# Usage:
# ./ctrl/build.sh # standalone -> gen/standalone/
# ./ctrl/build.sh amar # amar -> gen/amar/
# ./ctrl/build.sh all # every room under cfg/
# ./ctrl/build.sh models # only regenerate models
#
# build.py holds the logic; this exists so `make build` has exactly one
# script to call, and so the room name is a plain argument.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$ROOT_DIR"
PYTHON="${PYTHON:-python3}"
ROOM="${1:-standalone}"
case "$ROOM" in
all) exec "$PYTHON" build.py --all ;;
models) exec "$PYTHON" build.py --models ;;
esac
if [[ ! -d "cfg/$ROOM" ]]; then
echo "No such room: cfg/$ROOM" >&2
echo "Available: $(find cfg -mindepth 1 -maxdepth 1 -type d -not -name '.*' -printf '%f ')" >&2
exit 1
fi
# standalone is build.py's default and takes no --cfg
if [[ "$ROOM" == "standalone" ]]; then
exec "$PYTHON" build.py
fi
exec "$PYTHON" build.py --cfg "$ROOM"

24
ctrl/cluster.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# The shared `spr` kind cluster [up|down|status] (default status).
#
# Usage:
# ./ctrl/cluster.sh up # create the cluster (no-op if it exists)
# ./ctrl/cluster.sh down # delete it (drops every room's namespace)
# ./ctrl/cluster.sh status # what's running on it
#
# One target, one script — the variants live here. The kind-*.sh files stay
# exactly as they are and remain runnable on their own; this only dispatches.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "${1:-status}" in
up) exec "$SCRIPT_DIR/kind-up.sh" ;;
down) exec "$SCRIPT_DIR/kind-down.sh" ;;
status) exec "$SCRIPT_DIR/kind-status.sh" ;;
*)
echo "Unknown subcommand: $1" >&2
echo "Usage: cluster.sh [up|down|status]" >&2
exit 1
;;
esac

View File

@@ -11,6 +11,7 @@ Usage:
python ctrl/spr.py sync soleprint-ui ~/wdir/unt/ui/framework
python ctrl/spr.py watch soleprint-ui ~/wdir/unt/ui/framework # ctrl+c to stop
python ctrl/spr.py publish soleprint-ui ~/wdir/mpr/ui/framework
python ctrl/spr.py publish soleprint-ui /tmp/out --dist # built bundle only
python ctrl/spr.py diff soleprint-ui ~/wdir/mpr/ui/framework
"""
@@ -194,6 +195,37 @@ def cmd_list(args):
log.info(" %s %s v%-10s %s", f"{name:<25}", f"{comp_type:<5}", version, entry["path"])
def publish_dist(source, dest):
"""Copy only the built bundle — dist/ plus the manifest and any docs.
The artifact-only form: a consumer gets something that runs, not the
sources. Deliberately NOT a variant of copy_tree, which walks the whole
tree and strips dist; here dist is the entire point.
"""
dist = source / "dist"
if not dist.is_dir() or not any(dist.iterdir()):
log.error("no build at %s", dist)
log.info("build it first: cd %s && pnpm build", source)
sys.exit(1)
count = 0
dest.mkdir(parents=True, exist_ok=True)
for item in dist.rglob("*"):
if item.is_file():
target = dest / "dist" / item.relative_to(dist)
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(item, target)
count += 1
# The manifest travels too, or the bundle's entry points aren't resolvable.
for name in ("package.json", "README.md", "LICENSE"):
if (source / name).is_file():
shutil.copy2(source / name, dest / name)
count += 1
return count
def cmd_publish(args):
registry = load_registry()
comp_type, source = resolve_component(registry, args.component)
@@ -202,12 +234,17 @@ def cmd_publish(args):
if dest.exists():
shutil.rmtree(dest)
count = copy_tree(source, dest)
write_stamp(dest, args.component, comp_type, source, "published")
if args.dist:
count = publish_dist(source, dest)
mode = "published-dist"
else:
count = copy_tree(source, dest)
mode = "published"
write_stamp(dest, args.component, comp_type, source, mode)
version = get_version(comp_type, source)
sha = get_sha()
log.info("%s v%s (%s) -> %s (%d files)", args.component, version, sha, dest, count)
log.info("%s v%s (%s) -> %s (%d files, %s)", args.component, version, sha, dest, count, mode)
def cmd_sync(args):
@@ -306,6 +343,12 @@ def main():
p = sub.add_parser(cmd)
p.add_argument("component", help="component name")
p.add_argument("dest", help="target folder path")
if cmd == "publish":
p.add_argument(
"--dist",
action="store_true",
help="ship only the built bundle (dist/ + manifest), not the sources",
)
p = sub.add_parser("watch", help="continuous two-way sync (foreground, ctrl+c to stop)")
p.add_argument("component", help="component name")

35
ctrl/start.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Start a built room by dispatching to its own ctrl/start.sh in gen/.
#
# Usage:
# ./ctrl/start.sh # standalone, foreground
# ./ctrl/start.sh amar -d # amar, detached
# ./ctrl/start.sh sample --build # flags pass straight through
#
# Every room ships its own start script (gen/<room>/ctrl/start.sh) and stays
# runnable on its own — this only saves cd'ing there and picks the default room.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
ROOM="standalone"
if [[ $# -gt 0 && "$1" != -* ]]; then
ROOM="$1"
shift
fi
ROOM_DIR="$ROOT_DIR/gen/$ROOM"
if [[ ! -d "$ROOM_DIR" ]]; then
echo "Room '$ROOM' is not built — run: ./ctrl/build.sh $ROOM" >&2
exit 1
fi
if [[ ! -x "$ROOM_DIR/ctrl/start.sh" ]]; then
echo "No start script at gen/$ROOM/ctrl/start.sh" >&2
echo "(rebuild the room, or start it by hand from $ROOM_DIR)" >&2
exit 1
fi
exec "$ROOM_DIR/ctrl/start.sh" "$@"

27
ctrl/stop.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Stop a running room by dispatching to its own ctrl/stop.sh in gen/.
#
# Usage:
# ./ctrl/stop.sh # standalone
# ./ctrl/stop.sh amar # a named room
#
# Mirror of ctrl/start.sh — the room's own script does the work.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
ROOM="standalone"
if [[ $# -gt 0 && "$1" != -* ]]; then
ROOM="$1"
shift
fi
ROOM_DIR="$ROOT_DIR/gen/$ROOM"
if [[ ! -x "$ROOM_DIR/ctrl/stop.sh" ]]; then
echo "No stop script at gen/$ROOM/ctrl/stop.sh — nothing to stop." >&2
exit 0
fi
exec "$ROOM_DIR/ctrl/stop.sh" "$@"