feat(launcher): install the server from a prebuilt archive (P1.3c)

The launcher is now a self-contained installer with install, run, update,
doctor and uninstall. Install downloads waggle-server-<version>-<target>
.tar.gz, checks its SHA-256, unpacks it into a per-user program directory
and writes a waggle-server command that runs the tool on the archive's own
Node. Nothing is built on the user's machine and the data directory stays
WAGGLE_DATA_DIR or ~/.waggle.

scripts/build-server-archive.mjs packs the staged desktop sidecar payload
with the built web UI and a manifest. The download location waits for the
repository decision; until then install takes --from or
WAGGLE_RELEASE_BASE_URL (ADR-0009).

Removes install.sh, scripts/waggle-server.sh and their CI job, which the
installer replaces, and the bin name clash with @waggle/cli.
This commit is contained in:
shumeiko.it
2026-11-01 01:35:54 +01:00
parent eb2412b687
commit 3a426a5423
22 changed files with 1455 additions and 2206 deletions

View File

@@ -67,7 +67,6 @@ jobs:
npm test --
--exclude=packages/cli/tests/cli-runtime.test.ts
--exclude=packages/marketplace/tests/cli-runtime.test.ts
--exclude=packages/launcher/tests/cli.test.ts
--maxWorkers=2
# These tests each create a temporary project and run npm install. Running
@@ -78,7 +77,6 @@ jobs:
npx vitest run
packages/cli/tests/cli-runtime.test.ts
packages/marketplace/tests/cli-runtime.test.ts
packages/launcher/tests/cli.test.ts
--maxWorkers=1
--no-file-parallelism

View File

@@ -1,115 +0,0 @@
name: Installer Smoke
# Authoritative Linux proof for the one-line self-host installer (steal #5).
# The installer is developed on Windows, where the esbuild-hoist trap and CRLF
# quirks are Windows-only — so a green `bash -n` locally is NOT proof it works
# for the VPS/homelab audience. This job runs install.sh end-to-end from a
# clean ubuntu runner: it actually installs, builds packages, boots the sidecar,
# and asserts /health returns 200, then tears it down and asserts the port frees.
on:
pull_request:
paths:
- install.sh
- scripts/waggle-server.sh
- .github/workflows/installer-smoke.yml
push:
paths:
- install.sh
- scripts/waggle-server.sh
- .github/workflows/installer-smoke.yml
workflow_dispatch:
jobs:
installer-smoke:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
WAGGLE_PORT: "3947"
steps:
- uses: actions/checkout@v4
# The `runner` context is not available in job-level env, so the scratch
# paths (isolated from the checkout to exercise the real "copy + fresh
# install" path) are computed here from $RUNNER_TEMP instead.
- name: Compute scratch paths
run: |
echo "WAGGLE_INSTALL_DIR=$RUNNER_TEMP/waggle" >> "$GITHUB_ENV"
echo "WAGGLE_DATA_DIR=$RUNNER_TEMP/wdata" >> "$GITHUB_ENV"
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
# shellcheck ships pre-installed on ubuntu-latest runners. Findings are
# failures — the installer is user-facing shell that runs unsupervised via
# `curl | bash`, so lint cleanliness is a correctness gate, not a nicety.
- name: shellcheck installer scripts
run: shellcheck install.sh scripts/waggle-server.sh
# The real E2E. --local-source copies THIS checkout (tracked + untracked,
# excluding node_modules/dist) into a scratch dir, then does a from-scratch
# npm install + build:packages there. --no-web keeps it to API/echo mode
# (no vite build); --no-start hands the boot to waggle-server.sh below so we
# test the process manager too.
- name: Install (install.sh --yes, from-scratch)
run: |
./install.sh \
--yes \
--no-web \
--no-start \
--local-source "$GITHUB_WORKSPACE" \
--dir "$WAGGLE_INSTALL_DIR" \
--data-dir "$WAGGLE_DATA_DIR" \
--port "$WAGGLE_PORT"
- name: Start the sidecar (waggle-server.sh start)
run: |
bash "$WAGGLE_INSTALL_DIR/scripts/waggle-server.sh" start \
--port "$WAGGLE_PORT" \
--data-dir "$WAGGLE_DATA_DIR"
# Defensive re-poll. waggle-server.sh already blocks until /health is 200
# (up to 60s; the sidecar spends ~9s on marketplace sync before listening),
# so this normally passes on the first attempt. The wider 90s budget guards
# against a slow cold runner without making the assertion flaky.
- name: Wait for /health (HTTP 200)
run: |
url="http://127.0.0.1:${WAGGLE_PORT}/health"
for i in $(seq 1 90); do
code="$(curl -s -o /dev/null -w '%{http_code}' --max-time 3 "$url" || echo 000)"
if [ "$code" = "200" ]; then
echo "healthy after ${i}s (HTTP 200)"
exit 0
fi
sleep 1
done
echo "::error::/health did not return 200 within 90s"
echo "--- last sidecar log lines ---"
tail -n 40 "$WAGGLE_DATA_DIR/server.log" 2>/dev/null || true
exit 1
- name: Status
run: |
bash "$WAGGLE_INSTALL_DIR/scripts/waggle-server.sh" status \
--port "$WAGGLE_PORT" \
--data-dir "$WAGGLE_DATA_DIR"
- name: Stop
run: |
bash "$WAGGLE_INSTALL_DIR/scripts/waggle-server.sh" stop \
--port "$WAGGLE_PORT" \
--data-dir "$WAGGLE_DATA_DIR"
- name: Assert port is free after stop
run: |
url="http://127.0.0.1:${WAGGLE_PORT}/health"
if curl -fsS -o /dev/null --max-time 3 "$url"; then
echo "::error::/health still responding on port ${WAGGLE_PORT} after stop"
exit 1
fi
echo "port ${WAGGLE_PORT} is free"
- name: Dump sidecar log on failure
if: failure()
run: tail -n 100 "$WAGGLE_DATA_DIR/server.log" 2>/dev/null || echo "(no log file)"