#!/usr/bin/env bash
# unoverse help, the OPERATOR half.
#
# Printed by the npm CLI when you are standing in a universe folder. It lists what you
# can do to a universe, and nothing else. Commands that still exist but are not for
# day-to-day operating (ground, dev, build) are deliberately absent: a list you can read
# in one glance is worth more than a complete one. `deploy` is listed under Anywhere:
# the target says what ships (studio = this workspace's items; aws/digitalocean = the
# platform monorepo root releases the platform — LOCAL_STUDIO.md §Publish is terminal-only).

cmd_help() {

  echo ""
  echo -e "  ${BOLD}${CYAN}⬡ unoverse${NC} ${DIM}v${GRAVITY_VERSION}${NC}"
  echo ""
  echo -e "  ${BOLD}Anywhere${NC}"
  echo -e "    ${GREEN}create${NC}      Start something new, here"
  echo -e "    ${GREEN}studio${NC}      Author components, nodes, agent skills"
  echo -e "    ${GREEN}deploy${NC}      Ship it"
  echo -e "                ${DIM}deploy studio         your components, nodes and skills → your universe${NC}"
  echo -e "                ${DIM}deploy aws            your universe → AWS${NC}"
  echo -e "                ${DIM}deploy digitalocean   your universe → DigitalOcean${NC}"
  echo -e "    ${GREEN}login${NC}       Sign in to a universe ${DIM}(deploy asks by itself; this is for up front)${NC}"
  echo -e "    ${GREEN}where${NC}       Links to your universe ${DIM}(Canvas, API), checked live${NC}"
  echo -e "    ${GREEN}update${NC}      Update this CLI"
  echo ""
  echo -e "  ${BOLD}This universe${NC}"
  echo -e "    ${GREEN}start${NC}       Start it ${DIM}(--pull for the latest images)${NC}"
  echo -e "    ${GREEN}stop${NC}        Stop it"
  echo -e "    ${GREEN}check${NC}       Is it healthy ${DIM}(services, schema, environment)${NC}"
  echo -e "    ${GREEN}logs${NC}        What is it doing ${DIM}(unoverse logs <service> for one)${NC}"
  # THE ARGUMENT IS ON THE LINE, not in a footnote. It read as a special case for people
  # with two clouds; it is simply how the command is shaped. A cloud is optional when only
  # one ground exists and required when two do.
  # SHOW THE COMMAND, not a description of it. "aws or digitalocean" told a reader the
  # clouds exist without telling them what to type, so the shape of the command still had
  # to be guessed. Print the line they will actually run.
  echo -e "    ${GREEN}destroy${NC}     Take it down ${DIM}(shows what goes, and what stays)${NC}"
  echo -e "                ${DIM}unoverse destroy aws   ·   unoverse destroy digitalocean${NC}"
  echo -e "    ${GREEN}db-allow${NC}    Let this machine reach the database ${DIM}(run it when you change network)${NC}"
  echo ""
  # Owner-only lane. Printed ONLY when publish.sh is present, so a starter kit never
  # advertises a command it does not have (sync-starter.sh deletes that file).
  if type cmd_publish >/dev/null 2>&1; then
    echo -e "  ${BOLD}${DIM}Platform owner${NC}"
    echo -e "    ${GREEN}publish${NC}     Full release. Every lane whose content changed"
    echo -e "    ${GREEN}dev${NC}         Run the monorepo locally"
    echo ""
  fi
}
