fix(opencode): format shipped files with Prettier #164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/prettier-shipped-files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
An adopter that keeps its tracked files Prettier-clean runs
prettier --checkwith the.prettierrcAgent Foundry gave it, and itfails on two files that also came from Agent Foundry:
.prettierrcitself and
.opencode/plugins/shellcheck.js. The adopter can formatthem, and then meet conflicts at every upgrade, or live with the
failure. Fixes #163.
Running
prettier --writeon both, as the issue suggests, is notenough. Prettier splits the plugin's
execFile(...)line, andscripts/verify-agent-config.shpins that line exactly, so thevalidator then fails on the source and on every adopter that keeps
.opencode/.What changed
Both files are now in Prettier's layout under the shipped
.prettierrc..prettierrcgets a trailing comma after its last key,which is valid because Prettier reads
.prettierrcwith its YAML parser.In the plugin, only whitespace and line breaks change, and one trailing
comma is added inside a call.
The validator used to pin the
execFilecall as one line. It now pinsthe three lines Prettier gives it:
const child = execFile(,checker,and
["hook"]. It still refuses a plugin that runs the checker inanother mode.
How to verify
From a fresh checkout of the branch, with Prettier 3:
The first command reports that all files use Prettier code style. On
mainit exits 1 and warns on.prettierrcand.opencode/plugins/shellcheck.js. The validator then reportsstate=template, and the hook-wiring area passes all 21 tests,including "fails when the OpenCode plugin runs another checker mode".
The Maintenance checks of the README all pass on
a516bde, including 299agent-configuration tests and 46 work-folder tests. The change reviewer
and the security reviewer report no findings. I have not run the plugin
inside OpenCode, because no OpenCode is installed here.
git diff -w --word-diffshows that only whitespace, line breaks and the one commachanged.
Considerations
The Maintenance
prettier --checkcovers Markdown only, so this driftwent unnoticed and could happen again. I left the shipped
.prettierrcand
.opencode/plugins/*.jsout of that check because adding them addsa step to the maintenance workflow, and that is your decision.
The validator does not check that the three pinned lines are adjacent
or in order. The security review set this aside as hardening rather
than a finding: the old single-line pin also guarded only against
accidental drift, never against a deliberate edit.