Replace the old Go TUI with a web app (port 8470) that runs in a container as a CoreDesktop sibling: - cmd/supermarket server with htmx web UI: dashboard, company profile, inventory (partners/competitors), AI and credential settings, and a Core & Hermes page - SQLite storage and a secrets store under ~/.local/share/supermarket - AI providers (Anthropic, OpenAI-compatible) behind one interface - MCP server and a Hermes bridge to the Federated Core MCP hub - Import of the old Coremarketing TUI's state - install.sh / update.sh / lib.sh, Dockerfile, compose.yaml, the bin/supermarket launcher and hermes/setup.sh Posting is not wired back up yet; that comes in Phase 1. See PLAN.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Purpose : Open and manage Supermarket's container.
|
|
|
|
DATA="${XDG_DATA_HOME:-$HOME/.local/share}/supermarket"
|
|
COMPOSE_ENV="$DATA/compose.env"
|
|
URL="http://localhost:8470"
|
|
|
|
usage() {
|
|
cat << EOF
|
|
Usage: supermarket [command]
|
|
|
|
open Open Supermarket in the browser (the default)
|
|
status Is it running, and which version
|
|
start Start the container
|
|
stop Stop it; it stays stopped, even after a reboot, until you start it
|
|
restart Restart it, e.g. to retry an import
|
|
logs Follow its log (Ctrl-C to stop)
|
|
hermes Set up, or repair, Hermes' connection to your Core's MCP hub
|
|
token Print the token agents use to reach Supermarket's MCP endpoint
|
|
data Print where its data is kept
|
|
|
|
Updates come with CoreDesktop's \`update\`.
|
|
EOF
|
|
}
|
|
|
|
if [ ! -f "$COMPOSE_ENV" ]; then
|
|
echo "Supermarket isn't installed: run its install.sh (or \`sibling add <url>\`)."
|
|
exit 1
|
|
fi
|
|
REPO="$(sed -n 's/^SUPERMARKET_REPO=//p' "$COMPOSE_ENV")"
|
|
|
|
compose() {
|
|
docker compose --project-directory "$REPO" -f "$REPO/compose.yaml" --env-file "$COMPOSE_ENV" "$@"
|
|
}
|
|
|
|
case "${1:-open}" in
|
|
open)
|
|
if ! curl -sf -o /dev/null "$URL/healthz"; then
|
|
echo "Supermarket isn't running; starting it..."
|
|
compose up -d || exit 1
|
|
sleep 2
|
|
fi
|
|
xdg-open "$URL" > /dev/null 2>&1 &
|
|
;;
|
|
status)
|
|
if curl -sf -o /dev/null "$URL/healthz"; then
|
|
echo "Running at $URL ($(docker exec supermarket supermarket version 2> /dev/null))"
|
|
else
|
|
echo "Not running."
|
|
compose ps
|
|
fi
|
|
;;
|
|
start) compose up -d ;;
|
|
stop) compose stop ;;
|
|
restart) compose restart ;;
|
|
logs) compose logs -f --tail 200 ;;
|
|
hermes) shift; bash "$REPO/hermes/setup.sh" "$@" ;;
|
|
token) cat "$DATA/mcp-token" ;;
|
|
data) echo "$DATA" ;;
|
|
-h|--help|help) usage ;;
|
|
*) usage; exit 1 ;;
|
|
esac
|