Re-vendor the canonical files from sneak/prompts at dd4027b (closes #171)
check / check (push) Successful in 3m59s
check / check (push) Successful in 3m59s
.dockerignore, .gitignore, .prettierignore and REPO_POLICIES.md are copied from sneak/prompts at dd4027b; .editorconfig, check.yml and .prettierrc already matched. This repository's build artifacts follow the copied content in .gitignore and, anchored, in .dockerignore. The scripts follow the new policy: check runs fmt-check, cibuild bootstraps and runs check before the image build, fmt and fmt-check find the pinned yarn under nvm, and the image's last stage marks /app safe for git. The build-context test expects the new pattern forms. Judgement call: script/precommit runs lint and fmt-check without the tests, so the README's red-phase test commit can still land; the policy allows that form only where local testing is impossible. Not applicable: the issue's .golangci.yml entries; this TypeScript repository has none. Model: opus-5-5
This commit is contained in:
@@ -137,16 +137,15 @@ alpine. We provide:
|
||||
- `script/lint` — run eslint and a prettier check, by building the `lint` phase
|
||||
of the `Dockerfile`; requires docker (see Linting and testing below)
|
||||
- `script/fmt` — format all files with prettier (writes)
|
||||
- `script/fmt-check` — check formatting on the host (read-only); standalone, and
|
||||
not called by `script/check` or `script/precommit`, because `script/lint`
|
||||
already checks formatting in the container
|
||||
- `script/check` — run all checks: `test`, `lint` (our own extension)
|
||||
- `script/fmt-check` — check formatting on the host (read-only)
|
||||
- `script/check` — run all checks: `test`, `lint`, `fmt-check` (our own
|
||||
extension)
|
||||
- `script/docker` — build the image, tagged via `script/projectname`
|
||||
- `script/cibuild` — build the image (what CI runs); its last stage depends on
|
||||
the `lint` and `test` phases, so this one build lints, tests and compiles
|
||||
- `script/cibuild` — what CI runs: `script/bootstrap`, then `script/check`, then
|
||||
the image build
|
||||
- `script/precommit` — run by the git pre-commit hook (our own extension); runs
|
||||
`script/lint`, which checks both lint and formatting, but deliberately not the
|
||||
tests, so the TDD red-phase commit can land
|
||||
`script/lint` and `script/fmt-check` but deliberately not the tests, so the
|
||||
TDD red-phase commit can land
|
||||
- `script/install-precommit` — installs the git pre-commit hook (our own
|
||||
extension); `make hooks` shims to it
|
||||
|
||||
@@ -162,22 +161,19 @@ script runs the tools on the host: docker is required, and that also works where
|
||||
the docker daemon is remote and bind mounts are impossible.
|
||||
|
||||
The last stage of the `Dockerfile` compiles the package, and it copies a file
|
||||
from each phase, so it cannot be built unless lint and the tests pass. That is
|
||||
why `script/cibuild` is a single `docker build`: it runs lint and the tests once
|
||||
each and then compiles.
|
||||
from each phase, so it cannot be built unless lint and the tests pass. The image
|
||||
build in `script/cibuild` therefore runs lint and the tests a second time, after
|
||||
`script/check` has run them.
|
||||
|
||||
Every `docker build` in `script/` passes `--no-cache`. On an unchanged tree
|
||||
Docker would otherwise serve the lint and test steps from cache, nothing would
|
||||
run, and the build would still exit 0.
|
||||
|
||||
The formatting check is part of the `lint` phase, not a step beside it, so
|
||||
`script/check` and `script/precommit` do not call `script/fmt-check` as well;
|
||||
that would run prettier a second time over the same tree for the same verdict.
|
||||
`script/fmt-check` remains as a standalone entrypoint for asking the formatting
|
||||
question on the host. Its verdict matches the container's: prettier is pinned to
|
||||
an exact version, installed from `yarn.lock` under `--frozen-lockfile` in both
|
||||
places, and reads `.gitignore` as its default ignore file — which is why
|
||||
`.dockerignore` keeps `.gitignore` in the build context.
|
||||
`script/fmt-check` runs prettier on the host. Its verdict matches the `lint`
|
||||
phase's: prettier is pinned to an exact version, installed from `yarn.lock`
|
||||
under `--frozen-lockfile` in both places, and reads `.gitignore` as its default
|
||||
ignore file — which is why `.dockerignore` keeps `.gitignore` in the build
|
||||
context.
|
||||
|
||||
### Version
|
||||
|
||||
@@ -259,11 +255,10 @@ All work on quak is test-driven. No exceptions.
|
||||
history must still show tests landing before (or with) the matching
|
||||
implementation.
|
||||
8. The pre-commit hook installed by `make hooks` runs `script/precommit`, which
|
||||
runs `script/lint` — eslint and the prettier check, in the container — but
|
||||
not the tests, and so not the full `make check`. This is deliberate so the
|
||||
TDD red-phase commit (failing tests, no implementation yet) can land. The
|
||||
`test` phase is part of the image build, which is what CI executes via
|
||||
`script/cibuild`, so a red branch still cannot reach `next`.
|
||||
runs `script/lint` and `script/fmt-check` but not the tests, and so not the
|
||||
full `make check`. This is deliberate so the TDD red-phase commit (failing
|
||||
tests, no implementation yet) can land. CI executes `script/cibuild`, which
|
||||
runs the tests, so a red branch still cannot reach `next`.
|
||||
|
||||
## Design
|
||||
|
||||
@@ -995,14 +990,12 @@ documents:
|
||||
before the implementation. Tests are the canonical API documentation and must
|
||||
be commented thoroughly. `main` and `next` are always green.
|
||||
|
||||
- **Required checks before every commit:** `make lint` must pass — that is
|
||||
eslint plus the prettier check, and it builds the `lint` phase of the
|
||||
`Dockerfile`, so it needs docker. The pre-commit hook enforces exactly that.
|
||||
`make check` (which also runs the tests) must pass before merging into `next`.
|
||||
`make fmt-check` is available for a host-side formatting check on its own, but
|
||||
it is not a separate requirement: `make lint` already covers it, and running
|
||||
both would check formatting twice. Never invoke eslint or prettier directly;
|
||||
linting runs in the container only.
|
||||
- **Required checks before every commit:** `make lint` and `make fmt-check` must
|
||||
pass. `make lint` is eslint plus the prettier check, and it builds the `lint`
|
||||
phase of the `Dockerfile`, so it needs docker. The pre-commit hook enforces
|
||||
exactly that. `make check` (which also runs the tests) must pass before
|
||||
merging into `next`. Never invoke eslint or prettier directly; linting runs in
|
||||
the container only.
|
||||
|
||||
- **Formatting:** prettier with 4-space indents and `proseWrap: always` for
|
||||
markdown. Use `make fmt` to format. Use `yarn` not `npm`.
|
||||
|
||||
Reference in New Issue
Block a user