fix(scripts): setup.ps1/sh comment parsing, network creation, elevation UX

- Strip inline comments from hosts template before hostname extraction
- Create stellaops bridge network if missing (was only creating frontdoor)
- Clear elevation warning with missing count, re-run instructions, clipboard copy
- Both setup.ps1 (Windows) and setup.sh (Linux/macOS) fixed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-09 16:45:23 +03:00
parent 3a36aefd81
commit d0e67e59fb
2 changed files with 68 additions and 19 deletions

View File

@@ -341,7 +341,13 @@ check_hosts() {
local source_lines=()
while IFS= read -r line; do
[[ -z "${line// }" ]] && continue
# Skip full-line comments
[[ "$line" =~ ^[[:space:]]*# ]] && continue
# Strip inline comments (e.g. "127.1.0.14 host.local # alias note")
line="${line%%#*}"
# Trim trailing whitespace left after stripping the comment
line="${line%"${line##*[![:space:]]}"}"
[[ -z "$line" ]] && continue
source_lines+=("$line")
done < "$hosts_source"
@@ -445,24 +451,35 @@ get_frontdoor_network_name() {
printf '%s\n' 'stellaops_frontdoor'
}
ensure_frontdoor_network() {
local network_name
network_name="$(get_frontdoor_network_name)"
ensure_docker_network() {
local network_name="$1"
local label="$2"
if docker network inspect "$network_name" >/dev/null 2>&1; then
ok "Frontdoor network available ($network_name)"
ok "$label network available ($network_name)"
return
fi
warn "Frontdoor network missing ($network_name); creating it now."
warn "$label network missing ($network_name); creating it now."
docker network create "$network_name" >/dev/null
ok "Created frontdoor network ($network_name)"
ok "Created $label network ($network_name)"
}
ensure_stellaops_network() {
ensure_docker_network 'stellaops' 'Stellaops'
}
ensure_frontdoor_network() {
local network_name
network_name="$(get_frontdoor_network_name)"
ensure_docker_network "$network_name" 'Frontdoor'
}
# ─── 4. Start infrastructure ───────────────────────────────────────────────
start_infra() {
step 'Starting infrastructure containers (docker-compose.dev.yml)'
ensure_stellaops_network
cd "$COMPOSE_DIR"
docker compose -f docker-compose.dev.yml up -d
@@ -509,6 +526,7 @@ build_images() {
start_platform() {
step 'Starting full Stella Ops platform'
ensure_stellaops_network
ensure_frontdoor_network
cd "$COMPOSE_DIR"
docker compose -f docker-compose.stella-ops.yml up -d