Both scripts wrap something every agent on this repo ends up doing by hand,
and each encodes a constraint that is easy to get wrong once and expensive
to get wrong twice. Agent-agnostic on purpose -- plain scripts, plain text
output -- so opencode agents use the same ones rather than each
hand-rolling the equivalent command and getting a different detail wrong.
Indexed from AGENTS.md; the reasoning is in scripts/README.md.
scripts/sandbox.sh -- throwaway router on 8081. Encodes the port convention
(8080 is production and this cannot bind it), the kill discipline (only a
pid it recorded itself; never kill-by-name, Restart=always will fight you
and on this machine that process is the operator's model access), and the
cwd-vs-PYTHONPATH split that decides which config.yaml, which router.db and
which admin/frontend get used.
Writing it found two bugs in itself, both only visible by running it:
- `sandbox.sh start | tail` hung until the SERVER exited, because the
child inherited the script's stdout and held the pipe open. Fixed with
</dev/null and all three fds redirected.
- $! recorded a pid one off from the real uvicorn, so `stop` reported
success while the server kept running and `status` said "not running"
against a live :8081 answering 200. Fixed by backgrounding the command
directly instead of inside `( ... & echo $! )`, plus a post-start check
that the recorded pid is the one actually holding the port -- without
that check both bugs printed success.
scripts/mkpr.sh -- cut a gitea PR with a long markdown body. `tea pr
create` has no --description-file, so the body must arrive via $(cat ...),
which a worktree-pinned agent session refuses as too complex to verify;
running it from a script file sidesteps that without weakening it. Passes
--remote origin as well as --repo because AGENTS.md notes the `alee` login
is not tea's default. Refuses a head branch that is unpushed, diverged from
its remote, or not ahead of the base -- tea will cheerfully do all three.
Deliberately not scripted: merging to main (needs main checked out, which
conflicts with any agent in a worktree), Seed Energy and Restart Service
(one spends real credit, the other restarts production), and anything that
writes config.local.yaml.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VRQXz5SYZYVWscxS1QqF6U
3.6 KiB
Executable File
3.6 KiB
Executable File