Make every README the app's setup checklist (#40)

Each README is now only the app's Getting set up steps (First login, Get started, Bring your data, Add people), plus icon credits and trademark notices. CI checks the format (.github/check-readmes.py).
This commit is contained in:
michael authored and GitHub committed 2026-11-24 10:21:47 -05:00
1 parent 6ace960a0b
commit 6a4a96e7ed
103 files changed
+476 -888

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
"""Checks every recipe's README.md is a setup checklist: only the allowed sections, in order,
each a short step. Cottage shows these sections as "Getting set up" on the app's page; anything
else belongs in the app's guide in the docs. See "README.md: the setup checklist" in README.md."""
import glob, re, sys
ORDER = ["First login", "Get started", "Bring your data", "Add people", "Icon", "Trademark"]
NOT_STEPS = {"Icon", "Trademark"} # credits and notices, not shown in the checklist
MAX_WORDS = 100
bad = []
for path in sorted(glob.glob("apps/*/README.md")):
text = open(path).read()
sections, current, body = [], None, []
for line in text.splitlines():
m = re.match(r"^(#{1,6})\s+(.*?)\s*$", line)
if m and not line.startswith(" "):
if m.group(1) != "##":
bad.append(f"{path}: only ## headings, found {line!r}")
continue
if current is not None:
sections.append((current, "\n".join(body)))
current, body = m.group(2), []
elif current is None:
if line.strip():
bad.append(f"{path}: text before the first section: {line.strip()[:60]!r}")
else:
body.append(line)
if current is not None:
sections.append((current, "\n".join(body)))
names = [n for n, _ in sections]
for n in names:
if n not in ORDER:
bad.append(f"{path}: section {n!r} isn't a checklist step (allowed: {', '.join(ORDER)})")
known = [n for n in names if n in ORDER]
if known != sorted(known, key=ORDER.index) or len(set(known)) != len(known):
bad.append(f"{path}: sections must appear once each, in the order {', '.join(ORDER)}")
if "First login" not in names and "Get started" not in names:
bad.append(f"{path}: needs First login (apps with accounts) or Get started")
for n, b in sections:
words = len(re.findall(r"\S+", b))
if words == 0:
bad.append(f"{path}: section {n!r} is empty")
elif n not in NOT_STEPS and words > MAX_WORDS:
bad.append(f"{path}: section {n!r} has {words} words; a step is at most {MAX_WORDS}")
print("\n".join(bad) or "all READMEs OK")
sys.exit(1 if bad else 0)
+1
View File
@@ -50,6 +50,7 @@ jobs:
- run: pip install --quiet jsonschema pyyaml
- run: python3 .github/check-parameters.py
- run: python3 .github/check-listings.py
- run: python3 .github/check-readmes.py
# Cottage skips a recipe at sync time if its template runs an image the listing has no
# digest for, so catch that here.