Files
davidandClaude Opus 5.5 d039484a4a Phase 0: turn Supermarket into a Dockerized local web app
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>
2026-11-19 08:38:09 -07:00

70 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : Install Supermarket (run by CoreDesktop's `sibling add`). Safe to
# run again: it only does what's missing.
set -e
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib.sh
source "$SELF/lib.sh"
echo "Installing Supermarket, a marketing suite that runs as a web app on this computer."
if ! command -v docker > /dev/null; then
echo "Supermarket needs Docker, which CoreDesktop installs. Install it with: sudo pacman -S docker docker-compose"
exit 1
fi
if ! docker info > /dev/null 2>&1; then
if ! id -nG | tr ' ' '\n' | grep -qx docker; then
echo "You can't use Docker yet. Add yourself to the docker group, log out and in, and run this again:"
echo " sudo usermod -aG docker \$USER"
else
echo "Docker isn't running. Start it and run this again: sudo systemctl enable --now docker"
fi
exit 1
fi
mkdir -p "$DATA"
chmod 700 "$DATA"
# The old terminal app's files: copied (never moved) to import/, which the app
# reads once on its first start.
if [ -f "$OLD_STATE/config.yaml" ] && [ ! -d "$DATA/import" ]; then
mkdir -m 700 "$DATA/import"
for f in config.yaml state.json posts.json dismissed.json; do
[ -f "$OLD_STATE/$f" ] && install -m 600 "$OLD_STATE/$f" "$DATA/import/$f"
done
echo "Found the old Coremarketing's settings in $OLD_STATE: its inventory, credentials and queued posts will be imported."
fi
# The token agents use to reach the app. Made here, before the app starts,
# so Hermes can be given it.
if [ ! -s "$DATA/mcp-token" ]; then
(umask 077 && od -An -tx1 -N32 /dev/urandom | tr -d ' \n' > "$DATA/mcp-token" && echo >> "$DATA/mcp-token")
fi
bash "$SELF/update.sh"
if command -v webapp > /dev/null; then
if [ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/applications/webapp-supermarket.desktop" ]; then
webapp add Supermarket "$URL" && echo "Added Supermarket to the app grid."
fi
fi
echo
bash "$SELF/hermes/setup.sh" || echo "Hermes setup didn't finish; run it again any time: bash $SELF/hermes/setup.sh"
if command -v claude > /dev/null && ! claude mcp get supermarket > /dev/null 2>&1; then
echo
if confirm_yes "Let Claude Code use Supermarket's tools (profile, inventory) too?"; then
claude mcp add --transport http --scope user supermarket "$URL/mcp" \
--header "Authorization: Bearer $(tr -d '\n' < "$DATA/mcp-token")" > /dev/null \
&& echo "Claude Code can use Supermarket (claude mcp get supermarket)."
fi
fi
echo
echo "Supermarket is installed. Open it from the app grid, or at $URL"
echo "Start with the company profile, then Settings > AI provider."