Skip to content

fix: skip server start when STATIC_HTML_SERVER_URL is set#56

Merged
Svtter merged 2 commits into
mainfrom
worktree-sth-skip-server-start
May 15, 2026
Merged

fix: skip server start when STATIC_HTML_SERVER_URL is set#56
Svtter merged 2 commits into
mainfrom
worktree-sth-skip-server-start

Conversation

@Svtter
Copy link
Copy Markdown
Contributor

@Svtter Svtter commented May 15, 2026

Summary

  • SKILL.md workflow step 2 now tells agents to skip start-server.sh when STATIC_HTML_SERVER_URL is set (server already deployed externally)
  • start-server.sh adds an early-exit guard: if STATIC_HTML_SERVER_URL is non-empty, prints a message and exits 0

Test plan

  • Set STATIC_HTML_SERVER_URL=http://something and run bash scripts/start-server.sh — should exit 0 without starting
  • Unset STATIC_HTML_SERVER_URL and run bash scripts/start-server.sh — should start server as before

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

不可合并

审查摘要

该 PR 在 start-server.sh 中添加了 STATIC_HTML_SERVER_URL 环境变量检查,并在 SKILL.md 中对应更新了工作流说明,逻辑清晰、改动精简。

阻塞项

存在阻塞性问题:start-server.sh 中行 12 调用了 bootstrap-repo.sh,但该行位于 guard 之后、不会被提前退出影响。然而 start-server.sh 行 12 使用了 $("$script_dir/bootstrap-repo.sh")——该子 shell 调用在 set -e 下如果 bootstrap-repo.sh 失败会正确退出,此处无问题。

实际阻塞项:

  1. 行 6 的变量展开存在歧义风险${STATIC_HTML_SERVER_URL:-} 在变量被显式设为空字符串时不会触发 guard(-n "" 为 false)。这意味着 STATIC_HTML_SERVER_URL="" 时脚本会继续执行而不跳过。如果用户意图是“只要有此变量就跳过”(无论值是否为空),则应使用 ${STATIC_HTML_SERVER_URL:+}[ -z "${STATIC_HTML_SERVER_URL+}" ] 的形式。当前行为导致语义模糊——文档只说"set",与代码行为不完全一致。

  2. 行 7 直接使用未加引号包裹的 $STATIC_HTML_SERVER_URL:虽然进入该分支时变量必为非空,但 ShellCheck 会警告未加引号可能因空格/特殊字符导致分词(word splitting)。应使用双引号包裹 "$STATIC_HTML_SERVER_URL"

建议项

  • SKILL.md 中可考虑在 STATIC_HTML_SERVER_URL 的环境变量覆盖表格里加一行说明此变量的另一个作用(跳过 server start),但目前已有提及,非强制。
  • 建议在 start-server.sh 中添加一条简短的注释说明 exit 0 的原因——"not an error, server expected to be already running",目前在行 5-9 之外的上下文已足够清晰,已有注释。

New%20session%20-%202026-05-15T07%3A45%3A10.627Z
opencode session  |  github run

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 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

可合并

审查总结

改动精简、逻辑清晰。start-server.sh 新增的 early-exit guard 与 SKILL.md 文档更新一致,代码风格统一,无安全或性能问题。

阻塞项

建议项

  • exit 0 前可考虑给一条简短注释如 # not an error, server expected externally,但非必需。

:前序自动 review 中提到的「行 7 未加引号」实际不存在——$STATIC_HTML_SERVER_URL 已在外层双引号内,引用正确。变量展开 :- 的语义在 set -u 下是正确的标准写法。

New%20session%20-%202026-05-15T07%3A49%3A10.477Z
opencode session  |  github run

@Svtter Svtter merged commit e8fbda4 into main May 15, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant