Files
floci-cli/skills/floci/scripts/install-floci.sh
Hector Ventura ac52515471 docs(skill): publish the floci agent skill for the CLI and the four emulators (#69)
* docs(skill): publish the floci agent skill for the CLI and the four emulators

skills/floci/ teaches an AI agent to run, wire up and troubleshoot the AWS,
GCP, Azure and OCI emulators through floci-cli, docker run or Docker Compose.

- SKILL.md with the lifecycle, the hard rules (fake credentials only, verify
  the endpoint, name the tree, parse -o json) and one reference per cloud.
- references/docs.md sends the agent to the published documentation of each
  emulator instead of copying coverage lists that go stale.
- references/docker.md and assets/compose/ give docker run equivalents of
  'floci <tree> start' and a ready Compose template per cloud, plus one with
  all four on a network.
- scripts/install-floci.sh and scripts/ensure-running.sh.
- .claude-plugin/marketplace.json publishes it as a Claude Code plugin and the
  root plugin.json as a Kiro power (Agent Plugins format).
- SkillDocsTest checks every floci command and flag the skill quotes against
  the real command tree, its links, its frontmatter and both manifests.
- README: an "AI agents" section with the install commands, a Privacy section
  on what the CLI and the skill send over the network, and support links.
- AGENTS.md: a command, flag, env output or exit code change updates the
  skill in the same change.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* docs(skill): bind published ports to loopback and make the helper fail safely

Addresses the review of #69.

- The Compose templates and the docker run examples publish the emulator on
  127.0.0.1. The emulators accept fake credentials, so a plain 4566:4566
  exposed local resources to the network. docker.md says when to drop it and
  that 'floci <tree> start' still publishes on every interface.
- ensure-running.sh no longer replaces a stopped container: it exits 3 and
  leaves it alone unless FLOCI_REPLACE_STOPPED=1, because start removes the
  container and, without a profile, its settings.
- The documented call is now 'exports="$(...)" && eval "$exports"'. The
  one-step eval succeeded when the helper failed, so later commands ran with
  missing or stale wiring.
- The templates say that container name, namespace and network name are per
  project and change together.
- docker.md lists the network settings to copy into the multi-cloud file
  when an app reaches child containers by name.
- ci.md installs into a user-writable directory instead of assuming
  /usr/local/bin or sudo.
- SkillDocsTest now reads commands inside assignments and across continued
  lines, with a test that a wrong flag is found in each form. The helper's
  own status and env calls were not being checked.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-12 20:27:02 -05:00

87 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install floci-cli if it is missing. Linux and macOS.
# Windows: iwr https://floci.io/install.ps1 | iex (installs to %LOCALAPPDATA%\floci\bin, no admin)
#
# Usage: install-floci.sh [--method brew|script] [--version <tag>] (tags have no 'v': 0.4.0)
#
# Defaults: Homebrew when brew is on PATH, otherwise the official install script into
# ~/.local/bin, which needs no sudo (the script's own default, /usr/local/bin, prompts for
# sudo, which hangs a non-interactive agent). Override the dir with FLOCI_INSTALL_DIR.
set -euo pipefail
method=""
version="${FLOCI_CLI_VERSION:-latest}"
while [[ $# -gt 0 ]]; do
case "$1" in
--method) method="${2:-}"; shift 2 ;;
--version) version="${2:-}"; shift 2 ;;
-h|--help) sed -n '2,10p' "$0"; exit 0 ;;
*) echo "unknown argument: $1" >&2; exit 64 ;;
esac
done
if command -v floci >/dev/null 2>&1; then
echo "floci already installed: $(command -v floci)"
floci version 2>/dev/null | head -1 || true
if [[ "$version" != "latest" ]]; then
echo "NOTE: --version $version was not applied. Use 'floci update --version $version' (or brew) to change the installed version." >&2
fi
exit 0
fi
case "$(uname -s)" in
Linux|Darwin) ;;
*) echo "Unsupported OS for this script. On Windows run: iwr https://floci.io/install.ps1 | iex" >&2; exit 1 ;;
esac
if [[ -z "$method" ]]; then
if command -v brew >/dev/null 2>&1 && [[ "$version" == "latest" ]]; then
method="brew"
else
method="script"
fi
fi
case "$method" in
brew)
command -v brew >/dev/null 2>&1 || { echo "brew not found; use --method script" >&2; exit 1; }
if [[ "$version" != "latest" ]]; then
echo "NOTE: Homebrew installs the current release; --version $version is ignored. Use --method script to pin." >&2
fi
brew install floci-io/floci/floci
;;
script)
command -v curl >/dev/null 2>&1 || { echo "curl is required" >&2; exit 1; }
dir="${FLOCI_INSTALL_DIR:-$HOME/.local/bin}"
mkdir -p "$dir"
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
curl -fsSL https://floci.io/install.sh -o "$tmp"
FLOCI_INSTALL_DIR="$dir" FLOCI_CLI_VERSION="$version" sh "$tmp"
case ":$PATH:" in
*":$dir:"*) ;;
*)
echo
echo "NOTE: $dir is not on PATH. For this shell: export PATH=\"$dir:\$PATH\""
echo "To make it permanent, add that line to ~/.bashrc or ~/.zshrc (ask the user first)."
export PATH="$dir:$PATH"
;;
esac
;;
*)
echo "unknown method: $method (use brew or script)" >&2; exit 64 ;;
esac
if ! command -v floci >/dev/null 2>&1; then
echo "install finished but floci is not on PATH" >&2
exit 1
fi
floci version 2>/dev/null | head -1 || true
# The emulators run as containers; warn early if there is no Docker-compatible runtime.
if ! command -v docker >/dev/null 2>&1; then
echo "WARNING: docker CLI not found. Floci needs Docker (or Podman via DOCKER_HOST) to run the emulators." >&2
elif ! docker info >/dev/null 2>&1; then
echo "WARNING: docker is installed but the daemon is not reachable. Start Docker, or set DOCKER_HOST for Podman." >&2
fi