Symptom
`bin/fm-brief.sh ` fails immediately with:
```
bin/fm-brief.sh: line 314: unexpected EOF while looking for matching `)'
bin/fm-brief.sh: line 388: syntax error: unexpected end of file
```
This breaks every ship-brief scaffold, not just `no-mistakes`-mode ones, because the whole file must parse before any branch runs.
Root cause
The no-mistakes-mode DOD heredoc (around line 314-331) is built with `DOD=$(cat <<EOF ... EOF)` - a heredoc nested inside a `$(...)` command substitution. One line in that heredoc body contains a literal apostrophe:
`- Avoid \`--yes\`: it would silently bypass firstmate's authority check and any required captain escalation.`
On this bash (confirmed on the local `/bin/bash`), an odd number of literal single-quote characters inside a heredoc body that is itself wrapped in `$(...)` breaks the parser's paren-matching, even though heredocs otherwise ignore quoting. Minimal repro:
```sh
DOD=$(cat <<EOF
hello firstmate's world
EOF
)
echo "$DOD"
```
`bash -n` on that alone reproduces the same `unexpected EOF while looking for matching `)'` error.
Fix
Reword that line to avoid the bare apostrophe (e.g. "the firstmate authority check" instead of "firstmate's authority check"), or restructure the heredoc to not sit inside `$(...)` (e.g. write to a temp var via `read -r -d ''` or build with `printf`). Add a regression test asserting `bash -n bin/fm-brief.sh` (and ideally a scaffold smoke test for every project mode) so a future edit to any of these heredocs can't silently reintroduce this.
Impact discovered
Hit this live while dispatching a ship task; worked around it by hand-writing the brief instead of running the scaffold. Filing so it gets a proper fix through the normal pipeline instead of a hotfix under time pressure.
Symptom
`bin/fm-brief.sh ` fails immediately with:
```
bin/fm-brief.sh: line 314: unexpected EOF while looking for matching `)'
bin/fm-brief.sh: line 388: syntax error: unexpected end of file
```
This breaks every ship-brief scaffold, not just `no-mistakes`-mode ones, because the whole file must parse before any branch runs.
Root cause
The no-mistakes-mode DOD heredoc (around line 314-331) is built with `DOD=$(cat <<EOF ... EOF)` - a heredoc nested inside a `$(...)` command substitution. One line in that heredoc body contains a literal apostrophe:
`- Avoid \`--yes\`: it would silently bypass firstmate's authority check and any required captain escalation.`
On this bash (confirmed on the local `/bin/bash`), an odd number of literal single-quote characters inside a heredoc body that is itself wrapped in `$(...)` breaks the parser's paren-matching, even though heredocs otherwise ignore quoting. Minimal repro:
```sh
DOD=$(cat <<EOF
hello firstmate's world
EOF
)
echo "$DOD"
```
`bash -n` on that alone reproduces the same `unexpected EOF while looking for matching `)'` error.
Fix
Reword that line to avoid the bare apostrophe (e.g. "the firstmate authority check" instead of "firstmate's authority check"), or restructure the heredoc to not sit inside `$(...)` (e.g. write to a temp var via `read -r -d ''` or build with `printf`). Add a regression test asserting `bash -n bin/fm-brief.sh` (and ideally a scaffold smoke test for every project mode) so a future edit to any of these heredocs can't silently reintroduce this.
Impact discovered
Hit this live while dispatching a ship task; worked around it by hand-writing the brief instead of running the scaffold. Filing so it gets a proper fix through the normal pipeline instead of a hotfix under time pressure.