Adopt scripts-to-rule-them-all: script/ entrypoints, Makefile shims, policy update
Some checks failed
check / check (push) Failing after 5s
Some checks failed
check / check (push) Failing after 5s
This commit is contained in:
23
Makefile
23
Makefile
@@ -1,31 +1,32 @@
|
|||||||
.PHONY: test lint fmt fmt-check check docker hooks
|
.PHONY: test lint fmt fmt-check check docker hooks
|
||||||
|
|
||||||
# flags are repeated here (also in .prettierrc) so this Makefile works
|
# Makefile targets are thin shims; the implementations live in script/
|
||||||
# standalone when copied as a template
|
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
|
||||||
PRETTIER := yarn run prettier
|
# of README.md).
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@echo "No tests defined."
|
@script/test
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@echo "Linting markdown files..."
|
@script/lint
|
||||||
@$(PRETTIER) --check '**/*.md' --tab-width 4 --prose-wrap always
|
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
@$(PRETTIER) --write '**/*.md' --tab-width 4 --prose-wrap always
|
@script/fmt
|
||||||
|
|
||||||
fmt-check:
|
fmt-check:
|
||||||
@$(PRETTIER) --check '**/*.md' --tab-width 4 --prose-wrap always
|
@script/fmt-check
|
||||||
|
|
||||||
check: test lint fmt-check
|
check:
|
||||||
|
@script/check
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
docker build -t prompts .
|
@script/docker
|
||||||
|
|
||||||
hooks:
|
hooks:
|
||||||
@printf '#!/bin/sh\nset -e\n' > .git/hooks/pre-commit
|
@printf '#!/bin/sh\nset -e\n' > .git/hooks/pre-commit
|
||||||
@if [ -f go.mod ]; then \
|
@if [ -f go.mod ]; then \
|
||||||
printf 'go mod tidy\ngo fmt ./...\ngit diff --exit-code -- go.mod go.sum || { echo "go mod tidy changed files; please stage and retry"; exit 1; }\n' >> .git/hooks/pre-commit; \
|
printf 'go mod tidy\ngo fmt ./...\ngit diff --exit-code -- go.mod go.sum || { echo "go mod tidy changed files; please stage and retry"; exit 1; }\n' >> .git/hooks/pre-commit; \
|
||||||
fi
|
fi
|
||||||
@printf 'make check\n' >> .git/hooks/pre-commit
|
@printf 'script/precommit\n' >> .git/hooks/pre-commit
|
||||||
@chmod +x .git/hooks/pre-commit
|
@chmod +x .git/hooks/pre-commit
|
||||||
|
@echo "pre-commit hook installed"
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -102,6 +102,26 @@ cd prompts
|
|||||||
Prompts are stored as Markdown files in `prompts/`. Copy or reference them as
|
Prompts are stored as Markdown files in `prompts/`. Copy or reference them as
|
||||||
needed in your projects.
|
needed in your projects.
|
||||||
|
|
||||||
|
## Entrypoints
|
||||||
|
|
||||||
|
This repository adheres to the
|
||||||
|
[Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
|
||||||
|
standard: normalized scripts in `script/` are the entrypoints for the
|
||||||
|
development workflow, and the Makefile targets are thin shims that call
|
||||||
|
them. We provide:
|
||||||
|
|
||||||
|
- `script/test` — run the test suite (no tests defined here)
|
||||||
|
- `script/lint` — lint the markdown files with prettier
|
||||||
|
- `script/fmt` — format all markdown files with prettier (writes)
|
||||||
|
- `script/fmt-check` — check formatting (read-only)
|
||||||
|
- `script/check` — run all checks: `test`, `lint`, `fmt-check` (our own
|
||||||
|
extension)
|
||||||
|
- `script/docker` — build the Docker image
|
||||||
|
- `script/precommit` — run by the git pre-commit hook (our own
|
||||||
|
extension); calls `script/check`
|
||||||
|
|
||||||
|
`make hooks` installs the pre-commit hook that runs `script/precommit`.
|
||||||
|
|
||||||
## Rationale
|
## Rationale
|
||||||
|
|
||||||
LLM prompts, especially development policies, benefit from version control and a
|
LLM prompts, especially development policies, benefit from version control and a
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Existing Repo Checklist
|
title: Existing Repo Checklist
|
||||||
last_modified: 2026-03-10
|
last_modified: 2026-07-06
|
||||||
---
|
---
|
||||||
|
|
||||||
Use this checklist when beginning work in a repo that may not yet conform to our
|
Use this checklist when beginning work in a repo that may not yet conform to our
|
||||||
@@ -45,12 +45,19 @@ with your task.
|
|||||||
- [ ] Python: `pyproject.toml`
|
- [ ] Python: `pyproject.toml`
|
||||||
- [ ] Docs/writing: `.prettierrc`, `.prettierignore` (same URLs as above)
|
- [ ] Docs/writing: `.prettierrc`, `.prettierignore` (same URLs as above)
|
||||||
|
|
||||||
# Makefile
|
# Makefile and script/ Entrypoints
|
||||||
|
|
||||||
- [ ] `Makefile` exists in root — reference
|
- [ ] `Makefile` exists in root — reference
|
||||||
`https://git.eeqj.de/sneak/prompts/raw/branch/main/Makefile`
|
`https://git.eeqj.de/sneak/prompts/raw/branch/main/Makefile`
|
||||||
- [ ] Has targets: `test`, `lint`, `fmt`, `fmt-check`, `check`, `docker`,
|
- [ ] Has targets: `test`, `lint`, `fmt`, `fmt-check`, `check`, `docker`,
|
||||||
`hooks`
|
`hooks`
|
||||||
|
- [ ] Target implementations live in `script/` (scripts-to-rule-them-all);
|
||||||
|
Makefile targets are thin shims calling them — model scripts at
|
||||||
|
`https://git.eeqj.de/sneak/prompts/raw/branch/main/script/<name>`
|
||||||
|
- [ ] `script/precommit` exists and the pre-commit hook installed by
|
||||||
|
`make hooks` runs it
|
||||||
|
- [ ] README has an **Entrypoints** section documenting the `script/`
|
||||||
|
entrypoints and linking the standard
|
||||||
- [ ] `make check` does not modify any files in the repo
|
- [ ] `make check` does not modify any files in the repo
|
||||||
- [ ] `make test` has a 30-second timeout
|
- [ ] `make test` has a 30-second timeout
|
||||||
- [ ] `make test` runs real tests, not a no-op (at minimum, import/compile
|
- [ ] `make test` runs real tests, not a no-op (at minimum, import/compile
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: New Repo Checklist
|
title: New Repo Checklist
|
||||||
last_modified: 2026-02-22
|
last_modified: 2026-07-06
|
||||||
---
|
---
|
||||||
|
|
||||||
Use this checklist when creating a new repository from scratch. Follow the steps
|
Use this checklist when creating a new repository from scratch. Follow the steps
|
||||||
@@ -65,15 +65,24 @@ Template files can be fetched from:
|
|||||||
- [ ] JS: `yarn init`, `yarn add --dev prettier`
|
- [ ] JS: `yarn init`, `yarn add --dev prettier`
|
||||||
- [ ] Python: `pyproject.toml`
|
- [ ] Python: `pyproject.toml`
|
||||||
|
|
||||||
## Configure Makefile
|
## Configure script/ Entrypoints and Makefile
|
||||||
|
|
||||||
- [ ] `make test` — runs real tests, not a no-op (30-second timeout)
|
Implementations live in `script/` (scripts-to-rule-them-all); Makefile
|
||||||
- [ ] `make lint` — runs linter
|
targets are thin shims calling them. Model scripts:
|
||||||
- [ ] `make fmt` — formats code (writes)
|
`https://git.eeqj.de/sneak/prompts/raw/branch/main/script/<name>`
|
||||||
- [ ] `make fmt-check` — checks formatting (read-only)
|
|
||||||
- [ ] `make check` — prereqs: `test`, `lint`, `fmt-check`; must not modify files
|
- [ ] `script/test` / `make test` — runs real tests, not a no-op
|
||||||
- [ ] `make docker` — builds Docker image
|
(30-second timeout)
|
||||||
- [ ] `make hooks` — installs pre-commit hook
|
- [ ] `script/lint` / `make lint` — runs linter
|
||||||
|
- [ ] `script/fmt` / `make fmt` — formats code (writes)
|
||||||
|
- [ ] `script/fmt-check` / `make fmt-check` — checks formatting (read-only)
|
||||||
|
- [ ] `script/check` / `make check` — runs `test`, `lint`, `fmt-check`; must
|
||||||
|
not modify files
|
||||||
|
- [ ] `script/docker` / `make docker` — builds Docker image
|
||||||
|
- [ ] `script/precommit` — called by the pre-commit hook; runs `script/check`
|
||||||
|
- [ ] `make hooks` — installs pre-commit hook that runs `script/precommit`
|
||||||
|
- [ ] README **Entrypoints** section documents the scripts and links the
|
||||||
|
standard
|
||||||
|
|
||||||
# 4. Verify
|
# 4. Verify
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Repository Policies
|
title: Repository Policies
|
||||||
last_modified: 2026-03-18
|
last_modified: 2026-07-06
|
||||||
---
|
---
|
||||||
|
|
||||||
This document covers repository structure, tooling, and workflow standards. Code
|
This document covers repository structure, tooling, and workflow standards. Code
|
||||||
@@ -35,10 +35,23 @@ style conventions are in separate documents:
|
|||||||
|
|
||||||
- Every repo with software must have a root `Makefile` with these targets:
|
- Every repo with software must have a root `Makefile` with these targets:
|
||||||
`make test`, `make lint`, `make fmt` (writes), `make fmt-check` (read-only),
|
`make test`, `make lint`, `make fmt` (writes), `make fmt-check` (read-only),
|
||||||
`make check` (prereqs: `test`, `lint`, `fmt-check`), `make docker`, and
|
`make check` (runs `test`, `lint`, `fmt-check`), `make docker`, and
|
||||||
`make hooks` (installs pre-commit hook). A model Makefile is at
|
`make hooks` (installs pre-commit hook). A model Makefile is at
|
||||||
`https://git.eeqj.de/sneak/prompts/raw/branch/main/Makefile`.
|
`https://git.eeqj.de/sneak/prompts/raw/branch/main/Makefile`.
|
||||||
|
|
||||||
|
- Repos follow the
|
||||||
|
[Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
|
||||||
|
pattern: the implementation of each Makefile target lives in an executable
|
||||||
|
script in `script/` (`script/test`, `script/lint`, `script/fmt`,
|
||||||
|
`script/fmt-check`, `script/check`, `script/docker`), and the Makefile
|
||||||
|
targets are thin shims that call them. Two scripts are our own extensions to
|
||||||
|
the standard: `script/check` runs `script/test`, `script/lint`, and
|
||||||
|
`script/fmt-check`; `script/precommit` is what the git pre-commit hook runs,
|
||||||
|
and it calls `script/check`. Model scripts are at
|
||||||
|
`https://git.eeqj.de/sneak/prompts/raw/branch/main/script/<name>`. The
|
||||||
|
README must document the provided scripts in an **Entrypoints** section (see
|
||||||
|
the README requirements below).
|
||||||
|
|
||||||
- Always use Makefile targets (`make fmt`, `make test`, `make lint`, etc.)
|
- Always use Makefile targets (`make fmt`, `make test`, `make lint`, etc.)
|
||||||
instead of invoking the underlying tools directly. The Makefile is the single
|
instead of invoking the underlying tools directly. The Makefile is the single
|
||||||
source of truth for how these operations are run.
|
source of truth for how these operations are run.
|
||||||
@@ -136,9 +149,10 @@ style conventions are in separate documents:
|
|||||||
Markdown (hard-wrap at 80 columns). Documentation and writing repos (Markdown,
|
Markdown (hard-wrap at 80 columns). Documentation and writing repos (Markdown,
|
||||||
HTML, CSS) should also have `.prettierrc` and `.prettierignore`.
|
HTML, CSS) should also have `.prettierrc` and `.prettierignore`.
|
||||||
|
|
||||||
- Pre-commit hook: `make check` if local testing is possible, otherwise
|
- Pre-commit hook: runs `script/precommit`, which calls `script/check`. If
|
||||||
`make lint && make fmt-check`. The Makefile should provide a `make hooks`
|
local testing is not possible in the repo, `script/precommit` may skip
|
||||||
target to install the pre-commit hook.
|
`script/test` and run only `script/lint` and `script/fmt-check`. The
|
||||||
|
Makefile must provide a `make hooks` target to install the hook.
|
||||||
|
|
||||||
- All repos with software must have tests that run via the platform-standard
|
- All repos with software must have tests that run via the platform-standard
|
||||||
test framework (`go test`, `pytest`, `jest`/`vitest`, etc.). If no meaningful
|
test framework (`go test`, `pytest`, `jest`/`vitest`, etc.). If no meaningful
|
||||||
@@ -297,6 +311,10 @@ style conventions are in separate documents:
|
|||||||
"µPaaS is an MIT-licensed Go web application by @sneak that receives
|
"µPaaS is an MIT-licensed Go web application by @sneak that receives
|
||||||
git-frontend webhooks and deploys applications via Docker in realtime."
|
git-frontend webhooks and deploys applications via Docker in realtime."
|
||||||
- **Getting Started**: Copy-pasteable install/usage code block.
|
- **Getting Started**: Copy-pasteable install/usage code block.
|
||||||
|
- **Entrypoints**: Opens by stating that the repo adheres to the
|
||||||
|
[Scripts to Rule Them All](https://github.com/github/scripts-to-rule-them-all)
|
||||||
|
standard (with that link), then documents each provided `script/`
|
||||||
|
entrypoint and its purpose.
|
||||||
- **Rationale**: Why does this exist?
|
- **Rationale**: Why does this exist?
|
||||||
- **Design**: How is the program structured?
|
- **Design**: How is the program structured?
|
||||||
- **TODO**: Update meticulously, even between commits. When planning, put
|
- **TODO**: Update meticulously, even between commits. When planning, put
|
||||||
@@ -351,6 +369,8 @@ style conventions are in separate documents:
|
|||||||
- `README.md`, `.git`, `.gitignore`, `.editorconfig`
|
- `README.md`, `.git`, `.gitignore`, `.editorconfig`
|
||||||
- `LICENSE`, `REPO_POLICIES.md` (copy from the `prompts` repo)
|
- `LICENSE`, `REPO_POLICIES.md` (copy from the `prompts` repo)
|
||||||
- `Makefile`
|
- `Makefile`
|
||||||
|
- `script/` entrypoints (`test`, `lint`, `fmt`, `fmt-check`, `check`,
|
||||||
|
`docker`, `precommit`)
|
||||||
- `Dockerfile`, `.dockerignore`
|
- `Dockerfile`, `.dockerignore`
|
||||||
- `.gitea/workflows/check.yml`
|
- `.gitea/workflows/check.yml`
|
||||||
- Go: `go.mod`, `go.sum`, `.golangci.yml`
|
- Go: `go.mod`, `go.sum`, `.golangci.yml`
|
||||||
|
|||||||
14
script/check
Normal file
14
script/check
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/check: run all checks (test, lint, fmt-check). Our own
|
||||||
|
# extension to scripts-to-rule-them-all. Must not modify any files.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
"$SCRIPT_DIR/test"
|
||||||
|
"$SCRIPT_DIR/lint"
|
||||||
|
"$SCRIPT_DIR/fmt-check"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
12
script/docker
Normal file
12
script/docker
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/docker: build the Docker image.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$ROOT"
|
||||||
|
docker build -t prompts .
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
12
script/fmt
Normal file
12
script/fmt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/fmt: format all files (writes).
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$ROOT"
|
||||||
|
yarn run prettier --write '**/*.md' --tab-width 4 --prose-wrap always
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
12
script/fmt-check
Normal file
12
script/fmt-check
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/fmt-check: check formatting (read-only).
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$ROOT"
|
||||||
|
yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
13
script/lint
Normal file
13
script/lint
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/lint: run the linter.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$ROOT"
|
||||||
|
echo "Linting markdown files..."
|
||||||
|
yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
12
script/precommit
Normal file
12
script/precommit
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/precommit: run by the git pre-commit hook; fails the commit if
|
||||||
|
# checks fail. Our own extension to scripts-to-rule-them-all.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
"$SCRIPT_DIR/check"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
12
script/test
Normal file
12
script/test
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# script/test: run the test suite.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd "$ROOT"
|
||||||
|
echo "No tests defined."
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in New Issue
Block a user