From 305c3977a619c3f26122ace4cfa02cf7b3b58ab3 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sat, 3 Oct 2026 16:39:02 +0200 Subject: [PATCH] Add PLAN.md rule, garage .gitignore, remove hardcoded server port hint - AGENTS.md: mark PLAN.md as user-owned (never modify; it stays tracked) - move the .env ignore rule to the garage root so it covers any depth - drop the hardcoded "port 7654" hint from the no-server message; the target is now reported from the resolved SERVER_URL. The 7654 fallback remains only as the upstream TR default. --- .../{DevControlBot => }/.gitignore | 0 DevControlBot_garage/AGENTS.md | 16 ++++++++++++++-- .../DevControlBot/DevControlBot.nimble | 4 ++-- .../DevControlBot/DevControlBot.sh | 2 +- DevControlBot_garage/README.md | 15 ++++++++------- 5 files changed, 25 insertions(+), 12 deletions(-) rename DevControlBot_garage/{DevControlBot => }/.gitignore (100%) diff --git a/DevControlBot_garage/DevControlBot/.gitignore b/DevControlBot_garage/.gitignore similarity index 100% rename from DevControlBot_garage/DevControlBot/.gitignore rename to DevControlBot_garage/.gitignore diff --git a/DevControlBot_garage/AGENTS.md b/DevControlBot_garage/AGENTS.md index 9e1c326..c00f292 100644 --- a/DevControlBot_garage/AGENTS.md +++ b/DevControlBot_garage/AGENTS.md @@ -18,6 +18,18 @@ > is **NOT a layout contract for this folder**. If the root template and this file > disagree about layout, **this file wins.** +> ## ⚠️ DO NOT TOUCH `PLAN.md` +> +> **[`PLAN.md`](PLAN.md) is the user's personal working notes file.** The user +> maintains it and edits it exclusively. +> +> - Agents must **NEVER** modify, rewrite, reformat, move, delete or commit +> changes to `PLAN.md` — unless the user explicitly asks in that conversation. +> - Reading it is **not** assumed or expected; do not open it by default. +> - It **IS** tracked in git and is intended to be committed (deliberately added +> in commit `59fad00b`). Do **NOT** gitignore it and do **NOT** +> `git rm --cached` it. + ## Start here This file is the working rules for the bot. The human-facing description lives in @@ -103,7 +115,7 @@ forwards args and signals to `nimble runBot`, and propagates the exit code. directory containing the `.nimble`. From `DevControlBot_garage/` it fails with `Could not find a file with a .nimble extension inside the specified directory`. - `compile`/`build` are reserved Nimble builtin names — hence `runBot`. -- Without a Tank Royale server on `ws://localhost:7654` the run fails with +- Without a Tank Royale server at `SERVER_URL` the run fails with `[start] Cannot connect ... Connection refused` and exit code 1. That is expected during local verification, not a bug. @@ -154,7 +166,7 @@ forwards args and signals to `nimble runBot`, and propagates the exit code. re-exits with the code. Never mask it to 0, never let the shell's code be swallowed. - Exit codes (keep them distinct, they are what BotLauncher branches on): - `0` clean, `1` no game server on 7654 (expected), `2` dependency not + `0` clean, `1` no game server at `SERVER_URL` (expected), `2` dependency not installed, `3` compile failure, anything else = the bot's own code. Each prints its own short, actionable line; compile failures keep the raw compiler errors. diff --git a/DevControlBot_garage/DevControlBot/DevControlBot.nimble b/DevControlBot_garage/DevControlBot/DevControlBot.nimble index 8439ec1..4503565 100644 --- a/DevControlBot_garage/DevControlBot/DevControlBot.nimble +++ b/DevControlBot_garage/DevControlBot/DevControlBot.nimble @@ -25,7 +25,7 @@ requires "jsony >= 1.1.5" # # `exec` turns ANY non-zero exit into a NimScript exception, which prints a # stack trace plus an escaped copy of the whole script. That is nonsense for the -# expected "no game server on 7654" outcome. So the shell always exits 0 and +# expected "no game server at SERVER_URL" outcome. So the shell always exits 0 and # hands the real code back through the file named by $DEVCONTROLBOT_STATUS_FILE, # which DevControlBot.sh exports and then re-exits with. Direct `nimble runBot` # (no such variable) keeps the old behaviour: the shell exits with the real code @@ -216,7 +216,7 @@ if [ $bot_rc -ne 0 ]; then # The Tank Royale client answers a refused connection with this exact # exit code, so it means "no server", not "broken bot". echo "[devcontrolbot] No game server on ${SERVER_URL:-ws://localhost:7654} (SERVER_URL)." >&2 - echo "[devcontrolbot] Start the Tank Royale server, or check it is listening on port 7654." >&2 + echo "[devcontrolbot] Start the Tank Royale server, or point SERVER_URL at a running one." >&2 else echo "[devcontrolbot] The bot ran but failed at runtime (crash or bad metadata)." >&2 fi diff --git a/DevControlBot_garage/DevControlBot/DevControlBot.sh b/DevControlBot_garage/DevControlBot/DevControlBot.sh index 29227a3..a715abc 100755 --- a/DevControlBot_garage/DevControlBot/DevControlBot.sh +++ b/DevControlBot_garage/DevControlBot/DevControlBot.sh @@ -67,7 +67,7 @@ export DEVCONTROLBOT_DEBUG="$BUILD_MODE" # The runBot task's shell always exits 0 (otherwise Nimble raises a NimScript # exception with a stack trace and a dump of the whole script) and writes the # bot's real exit code here instead. We read it back and exit with it, so -# BotLauncher still sees the faithful status: 1 = no game server on 7654, +# BotLauncher still sees the faithful status: 1 = no game server at SERVER_URL, # 2 = a dependency is missing, 3 = compile failure, anything else = the bot's # own code, 0 = clean run. STATUS_FILE="$(mktemp "${TMPDIR:-/tmp}/devcontrolbot.status.XXXXXX")" diff --git a/DevControlBot_garage/README.md b/DevControlBot_garage/README.md index 030528e..be12f74 100644 --- a/DevControlBot_garage/README.md +++ b/DevControlBot_garage/README.md @@ -154,9 +154,10 @@ a successful release build stays short (10 lines including the no-server report, vs 16 with `--debug`). `--help` / `-h` prints usage and exits 0 **without building**; no arguments does the opposite — it builds and runs. -The bot needs a running Tank Royale server on `ws://localhost:7654`; without one -the run fails with `[start] Cannot connect to ws://localhost:7654` and exits 1 -(expected during local verification). +The bot needs a running Tank Royale server at `SERVER_URL` (the API's documented +default is `ws://localhost:7654`); without one the run fails with +`[start] Cannot connect to ` and exits 1 (expected during local +verification). ## Failure reporting and exit codes @@ -170,7 +171,7 @@ not masked. | exit | meaning | |---|---| | `0` | clean run | -| `1` | bot could not connect to the game server on `ws://localhost:7654` (expected locally) | +| `1` | bot could not connect to the game server at `SERVER_URL` (expected locally) | | `2` | a dependency is not installed — `nimble install ` | | `3` | compilation failed — the compiler's own errors are printed above | | other | the bot's own exit code (runtime crash, bad metadata) | @@ -178,10 +179,10 @@ not masked. Each mode prints its own short line, e.g. ``` -[start] Cannot connect to ws://localhost:7654: Connection refused +[start] Cannot connect to ws://localhost:4567: Connection refused [devcontrolbot] bot exited with code 1. -[devcontrolbot] No game server on ws://localhost:7654. -[devcontrolbot] Start the Tank Royale server, or check it is listening on port 7654. +[devcontrolbot] No game server on ws://localhost:4567 (SERVER_URL). +[devcontrolbot] Start the Tank Royale server, or point SERVER_URL at a running one. ``` No `Exception raised during nimble script execution`, no stack trace, no source