more restructuring
This commit is contained in:
26
soleprint/ctrl/build.sh
Executable file
26
soleprint/ctrl/build.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Build soleprint for local development
|
||||
#
|
||||
# Usage:
|
||||
# ./build.sh # Build gen/standalone/
|
||||
# ./build.sh amar # Build gen/amar/
|
||||
# ./build.sh --all # Build all targets
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
TARGET="${1:-}"
|
||||
|
||||
if [ "$TARGET" = "--all" ]; then
|
||||
echo "Building all targets..."
|
||||
python build.py --all
|
||||
elif [ -n "$TARGET" ]; then
|
||||
echo "Building gen/$TARGET/..."
|
||||
python build.py --cfg "$TARGET"
|
||||
else
|
||||
echo "Building gen/standalone/..."
|
||||
python build.py
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Done. Run with: ./ctrl/start.sh [target]"
|
||||
29
soleprint/ctrl/logs.sh
Executable file
29
soleprint/ctrl/logs.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# View soleprint logs
|
||||
#
|
||||
# Usage:
|
||||
# ./logs.sh # Logs for standalone
|
||||
# ./logs.sh amar # Logs for amar
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
TARGET="standalone"
|
||||
ARGS=""
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-*) ARGS="$ARGS $arg" ;;
|
||||
*) TARGET="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GEN_DIR="gen/$TARGET"
|
||||
|
||||
if [ ! -d "$GEN_DIR" ]; then
|
||||
echo "$GEN_DIR not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$GEN_DIR"
|
||||
docker compose logs -f $ARGS
|
||||
32
soleprint/ctrl/start.sh
Executable file
32
soleprint/ctrl/start.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Start soleprint with Docker
|
||||
#
|
||||
# Usage:
|
||||
# ./start.sh # Start standalone
|
||||
# ./start.sh amar # Start amar
|
||||
# ./start.sh -d # Detached
|
||||
# ./start.sh amar -d # Start amar detached
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
TARGET="standalone"
|
||||
ARGS=""
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-d|--detach) ARGS="$ARGS -d" ;;
|
||||
--build) ARGS="$ARGS --build" ;;
|
||||
*) TARGET="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GEN_DIR="gen/$TARGET"
|
||||
|
||||
if [ ! -d "$GEN_DIR" ]; then
|
||||
echo "$GEN_DIR not found. Run ./ctrl/build.sh $TARGET first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$GEN_DIR"
|
||||
docker compose up $ARGS
|
||||
20
soleprint/ctrl/stop.sh
Executable file
20
soleprint/ctrl/stop.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Stop soleprint Docker container
|
||||
#
|
||||
# Usage:
|
||||
# ./stop.sh # Stop standalone
|
||||
# ./stop.sh amar # Stop amar
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
TARGET="${1:-standalone}"
|
||||
GEN_DIR="gen/$TARGET"
|
||||
|
||||
if [ ! -d "$GEN_DIR" ]; then
|
||||
echo "$GEN_DIR not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$GEN_DIR"
|
||||
docker compose down
|
||||
@@ -95,7 +95,7 @@ def scan_directory(base_path: Path, pattern: str = "*") -> list[dict]:
|
||||
def health():
|
||||
return {
|
||||
"status": "ok",
|
||||
"service": "soleprint-dev",
|
||||
"service": "soleprint",
|
||||
"mode": "bare-metal",
|
||||
}
|
||||
|
||||
@@ -274,6 +274,76 @@ def station_route(path: str):
|
||||
return {"system": "station", "path": path, "message": "Station route placeholder"}
|
||||
|
||||
|
||||
# === Generate ===
|
||||
|
||||
|
||||
@app.get("/generate")
|
||||
def generate_ui():
|
||||
"""Serve the generation UI."""
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
return FileResponse(SPR_ROOT / "generate.html")
|
||||
|
||||
|
||||
@app.post("/api/generate")
|
||||
def generate_config(req: dict):
|
||||
"""Generate a config.json for a new room."""
|
||||
config = load_config()
|
||||
hub_port = config.get("framework", {}).get("hub_port", 12000)
|
||||
system_ports = {s["key"]: s["port"] for s in config.get("systems", [])}
|
||||
|
||||
framework = req.get("framework", {})
|
||||
systems = req.get("systems", {})
|
||||
managed = req.get("managed")
|
||||
|
||||
result = {
|
||||
"framework": {
|
||||
"name": framework.get("name", "soleprint"),
|
||||
"slug": framework.get("name", "soleprint").lower().replace(" ", "-"),
|
||||
"version": "0.1.0",
|
||||
"hub_port": hub_port,
|
||||
},
|
||||
"systems": [
|
||||
{
|
||||
"key": "data_flow",
|
||||
"name": systems.get("artery", "artery"),
|
||||
"port": system_ports.get("data_flow", 12001),
|
||||
},
|
||||
{
|
||||
"key": "documentation",
|
||||
"name": systems.get("atlas", "atlas"),
|
||||
"port": system_ports.get("documentation", 12002),
|
||||
},
|
||||
{
|
||||
"key": "execution",
|
||||
"name": systems.get("station", "station"),
|
||||
"port": system_ports.get("execution", 12003),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
if managed and managed.get("name"):
|
||||
result["managed"] = {"name": managed["name"], "repos": managed.get("repos", {})}
|
||||
|
||||
return {"config": result, "room_name": req.get("room_name")}
|
||||
|
||||
|
||||
@app.post("/api/generate/preview")
|
||||
def generate_preview(req: dict):
|
||||
"""Preview the generated folder structure."""
|
||||
room = req.get("room_name") or "room"
|
||||
fw = req.get("framework", {}).get("name") or "soleprint"
|
||||
managed = req.get("managed")
|
||||
|
||||
lines = [f'<span class="folder">gen/{room}/</span>']
|
||||
if managed and managed.get("name"):
|
||||
lines.append(f' <span class="folder">{managed["name"]}/</span>')
|
||||
lines.append(' <span class="folder">link/</span>')
|
||||
lines.append(f' <span class="folder">{fw}/</span>')
|
||||
|
||||
return {"tree": "\n".join(lines)}
|
||||
|
||||
|
||||
# === Main ===
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user