Compare commits

..
2 Commits
Author SHA1 Message Date
clawbot 9af51bd68a Format Markdown with prettier in make fmt and fmt-check (closes #23)
check / check (push) Successful in 2m9s
`make fmt` now runs prettier over the Markdown files after the Go
formatters, and `make fmt-check` fails when prettier would change one.
`package.json`, `yarn.lock`, `.prettierrc` and `.prettierignore` are the
`sneak/prompts` copies at `dd4027b`, and both scripts find yarn the way
that repo's scripts do. `script/bootstrap` installs prettier with
`yarn install --frozen-lockfile`. When the yarn those scripts would run
is not 1.22.22, it installs yarn through corepack under node 22.17.0:
the node on `PATH` if it has that version, otherwise one installed
through nvm from a hash-checked archive. `README.md` and `TODO.md` are
reformatted once.

Model: opus-5-5
2026-10-06 08:45:27 +00:00
clawbot 4666af1cc8 Make fmt-check check what fmt writes (closes #22)
check / check (push) Successful in 2m10s
script/fmt writes with gofmt -s and goimports, but script/fmt-check
only ran gofmt -l. A file that gofmt -s would simplify, or whose
imports goimports would regroup, passed make check and then changed
on the next make fmt.

script/fmt-check now runs gofmt -s -l and goimports -l, prints each
file either would change once, and fails. It puts Go's bin directory
on PATH first, as script/fmt does, so it runs the goimports that
script/bootstrap installs. The README line on what make check runs
now names both formatters.

Model: opus-5-5
2026-10-06 10:43:51 +02:00
3 changed files with 14 additions and 6 deletions

No files matched your search

+3 -3
View File
@@ -102,9 +102,9 @@ Future improvements under consideration:
- Author & maintainer: **sneak** – <sneak@sneak.berlin>
- Issues / PRs: <https://git.eeqj.de/sneak/attrsum/>
- Code must pass `make check`, which runs the tests and golangci-lint as phases
of the `Dockerfile` (Docker is required) and checks formatting with `gofmt`
for Go and prettier for Markdown. `make bootstrap` installs prettier, and
`make fmt` fixes what the check reports.
of the `Dockerfile` (Docker is required) and checks formatting with `gofmt -s`
and goimports for Go and prettier for Markdown. `make bootstrap` installs
goimports and prettier, and `make fmt` fixes what the check reports.
- No CLA; contributions are under WTFPL v2.
---
+3
View File
@@ -28,6 +28,9 @@ TODO, License exist; Description, Entrypoints, Design, Author are missing)
change; prettier is pinned in `package.json` and `yarn.lock`, and
`script/bootstrap` installs it, along with the pinned node and yarn when the
yarn on hand is not the pinned version; the Markdown files reformatted once
- 2026-10-06: `script/fmt-check` checks what `script/fmt` writes: it fails and
lists the files when `gofmt -s` or goimports would change one, so a file that
passes `make check` no longer changes on the next `make fmt`
- 2026-10-06: canonical files re-vendored from `sneak/prompts` at `dd4027b`:
`REPO_POLICIES.md` and `.editorconfig` added; `.dockerignore`, `.gitignore`,
`.golangci.yml` and the workflow refreshed, keeping this repo's own entries
+8 -3
View File
@@ -27,10 +27,15 @@ run_yarn() {
main() {
cd "$ROOT"
files="$(gofmt -l .)"
# script/bootstrap installs goimports into Go's bin directory, which
# need not be on PATH.
gobin="$(go env GOBIN)"
[ -n "$gobin" ] || gobin="$(go env GOPATH)/bin"
PATH="$gobin:$PATH"
files="$(gofmt -s -l .; goimports -l .)"
if [ -n "$files" ]; then
echo "gofmt: files not formatted:" >&2
echo "$files" >&2
echo "files that make fmt would change:" >&2
echo "$files" | sort -u >&2
exit 1
fi
run_yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always