From f674c4287dbfb5a6c7e088ea453c9514a6de3b2a Mon Sep 17 00:00:00 2001 From: Agent Date: Fri, 15 May 2026 15:43:45 +0800 Subject: [PATCH 1/2] fix: skip server start when STATIC_HTML_SERVER_URL is set When the sth server is already deployed externally, agents should not start a local instance. Check STATIC_HTML_SERVER_URL in both SKILL.md workflow and start-server.sh to skip server startup. Co-Authored-By: Claude Opus 4.7 --- skills/sth/SKILL.md | 6 +++++- skills/sth/scripts/start-server.sh | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/skills/sth/SKILL.md b/skills/sth/SKILL.md index c09ff6a..fafbba2 100644 --- a/skills/sth/SKILL.md +++ b/skills/sth/SKILL.md @@ -20,7 +20,11 @@ This script: - otherwise clones or updates `sun-praise/static-html` - builds `dist/sth` when the Go source fingerprint changes -2. Start the preview server: +2. Start the preview server **only if not already running**: + +If `STATIC_HTML_SERVER_URL` is set (e.g. the server is already deployed elsewhere), skip this step entirely. + +Otherwise start locally: ```bash bash scripts/start-server.sh [port] diff --git a/skills/sth/scripts/start-server.sh b/skills/sth/scripts/start-server.sh index 80b11bf..4a34bf7 100755 --- a/skills/sth/scripts/start-server.sh +++ b/skills/sth/scripts/start-server.sh @@ -2,6 +2,12 @@ set -euo pipefail +# If an external server is already configured, skip starting a local one. +if [ -n "${STATIC_HTML_SERVER_URL:-}" ]; then + echo "STATIC_HTML_SERVER_URL is set ($STATIC_HTML_SERVER_URL) — skipping server start." + exit 0 +fi + script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" repo_dir="$("$script_dir/bootstrap-repo.sh")" host="${STATIC_HTML_HOST:-0.0.0.0}" From 79839fd0fbc5e9b9a09ff6aeba1fbb52827c290b Mon Sep 17 00:00:00 2001 From: Agent Date: Fri, 15 May 2026 15:48:11 +0800 Subject: [PATCH 2/2] fix: quote $STATIC_HTML_SERVER_URL in echo to prevent word splitting ShellCheck warns about unquoted variable expansion. Quote the variable in the echo message to handle values with spaces or special characters. Co-Authored-By: Claude Opus 4.7 --- skills/sth/scripts/start-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/sth/scripts/start-server.sh b/skills/sth/scripts/start-server.sh index 4a34bf7..d5b491a 100755 --- a/skills/sth/scripts/start-server.sh +++ b/skills/sth/scripts/start-server.sh @@ -4,7 +4,7 @@ set -euo pipefail # If an external server is already configured, skip starting a local one. if [ -n "${STATIC_HTML_SERVER_URL:-}" ]; then - echo "STATIC_HTML_SERVER_URL is set ($STATIC_HTML_SERVER_URL) — skipping server start." + echo "STATIC_HTML_SERVER_URL is set ($STATIC_HTML_SERVER_URL) — skipping server start." >&2 exit 0 fi