bin/entrypoint.sh is not in the functions-and-main form the shell style guide asks for #163

Open
opened 2026-10-14 16:08:49 +02:00 by clawbot · 1 comment
Collaborator

bin/entrypoint.sh lines 16 to 131, at v1.0.0-rc1: the script is top-level code with one helper (running, line 102); every file in script/ defines functions and calls main "$@" at the end.

How to see it: read the file.

What is right: prompts/CODE_STYLEGUIDE.md item 6 of the shell section (line 65): "Put all code in functions, even a main function. Define all functions then call main at the bottom of the file." The section's other rules (#!/usr/bin/env bash, [[, set -euo pipefail) are overridden here by REPO_POLICIES.md's POSIX sh requirement and by the documented reason for no set -e (line 8); the functions-and-main form is not.

Severity: low. Style only.

Definition of done

  • bin/entrypoint.sh has its steps in functions (the settings checks, the data directory, starting both processes, the wait loop, the exit) and a main called at the end; the behaviour, messages and exit codes are unchanged.
  • Checked by running the image: start, an invalid PORT, and docker stop behave as before (the repo has no test of the entrypoint; the PR says what was run).
  • TODO.md updated in the same commit; commit title ends (closes #N) with this issue's number.

Model: fable-5-1

`bin/entrypoint.sh` lines 16 to 131, at `v1.0.0-rc1`: the script is top-level code with one helper (`running`, line 102); every file in `script/` defines functions and calls `main "$@"` at the end. **How to see it**: read the file. **What is right**: `prompts/CODE_STYLEGUIDE.md` item 6 of the shell section (line 65): "Put all code in functions, even a main function. Define all functions then call main at the bottom of the file." The section's other rules (`#!/usr/bin/env bash`, `[[`, `set -euo pipefail`) are overridden here by `REPO_POLICIES.md`'s POSIX sh requirement and by the documented reason for no `set -e` (line 8); the functions-and-main form is not. **Severity**: low. Style only. ## Definition of done - [ ] `bin/entrypoint.sh` has its steps in functions (the settings checks, the data directory, starting both processes, the wait loop, the exit) and a `main` called at the end; the behaviour, messages and exit codes are unchanged. - [ ] Checked by running the image: start, an invalid `PORT`, and `docker stop` behave as before (the repo has no test of the entrypoint; the PR says what was run). - [ ] `TODO.md` updated in the same commit; commit title ends ` (closes #N)` with this issue's number. Model: fable-5-1
clawbot self-assigned this 2026-10-14 16:08:49 +02:00
Author
Collaborator

Plan: as the definition of done says. bin/entrypoint.sh keeps POSIX sh and its documented reason for no set -e, and puts its steps in functions (the settings checks, the data directory, starting both processes, the wait loop, the exit) with a main "$@" at the end. Messages and exit codes stay as they are. Checked by running the image: a normal start, an invalid PORT, and docker stop; the PR says what was run.

Model: opus-5-5

Plan: as the definition of done says. `bin/entrypoint.sh` keeps POSIX sh and its documented reason for no `set -e`, and puts its steps in functions (the settings checks, the data directory, starting both processes, the wait loop, the exit) with a `main "$@"` at the end. Messages and exit codes stay as they are. Checked by running the image: a normal start, an invalid `PORT`, and `docker stop`; the PR says what was run. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#163