#!/usr/bin/env bash
# Print compose service names for shell completion (one per line).
# Uses this workspace's live compose config when possible, otherwise the
# per-project cache in ~/.run/services.json — never a hard-coded list.
set -euo pipefail

source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
# shellcheck source=workspace.sh
source "$(dirname "${BASH_SOURCE[0]}")/workspace.sh"

if ! resolve_workspace "${RUN_WORKSPACE_DIR:-${PWD}}"; then
  exit 0
fi

# shellcheck disable=SC2153
[ -f "${ENV_FILE}" ] || exit 0
load_env
remember_and_list_services
