Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Two changes before this lands. #12486
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/12393-automate-a-review-finding-as-a-lint-or-t → main 2 commits fork
3 files
changed +23
−4
AGENTS.md +1 −1
| @@ -5,7 +5,7 @@ Read `CLAUDE.md` first: it is the rulebook for agents editing this repo. | ||
| 5 | 5 | The guide (`docs/guide-*.md`, ordered in `src/view/guide.ts`, served at `/docs` with search) is how a person and an outside agent are taught the forge: eleven pages, each at most 450 words, every command, path and link in them checked by `test/guide.test.ts`. A feature's `docs/features/<name>.md` is its reference; link it from the guide page it belongs to. llms.txt points at the same pages. |
| 6 | 6 | |
| 7 | 7 | README.md is capped: a new feature's how-to goes in `docs/features/<name>.md`, not a new README section. |
| 8 | A pull that adds a page (`src/web/pages/*.ts`) also adds a terminal screen under `src/tui/screens/` that another module imports (its palette entry) and a `docs/features/<name>.md`, or a commit line `No door: <why>`; `bun scripts/gate.ts` refuses it otherwise ("both doors", #10628). | |
| 8 | A pull that adds a page (`src/web/pages/*.ts`) also adds a terminal screen under `src/tui/screens/` that another module imports (its palette entry) and a `docs/features/<name>.md`, or a commit line `No door: <why>`; a new `src/web/render/*.ts` or `src/actions/*.ts` is asked for the screen alone; `bun scripts/gate.ts` refuses it otherwise ("both doors", #10628). | |
| 9 | 9 | A pull that changes `src/web/` (a `.ts` or `.css`) names, in a commit line `Looks: <path>`, the page of `app.looks` in forge.json whose before/after pictures show it, or says `No look: <why>`; `bun scripts/gate.ts` refuses it otherwise ("before/after looks", #12362). |
| 10 | 10 | |
| 11 | 11 | When you write an issue, end it with a `Files:` line naming the files the work touches (`Files: src/a.ts, docs/b.md`). The hot-file hold reads only that line when it is there; without it, every path the issue mentions counts. |
src/kernel/both_doors.ts +11 −3
| @@ -5,11 +5,17 @@ | ||
| 5 | 5 | * (`src/web/pages/*.ts`) therefore adds a terminal screen (a new file under |
| 6 | 6 | * `src/tui/`) and a features doc, or says in a commit message |
| 7 | 7 | * `No door: <why this page needs no terminal screen or how-to>`. |
| 8 | * | |
| 9 | * The same ask came back on a file kind renderer (#11287) and on an action | |
| 10 | * (#11626): a new `src/web/render/*.ts` or `src/actions/*.ts` is a feature | |
| 11 | * the web door shows, so it needs its terminal screen too (the how-to is | |
| 12 | * asked of pages only), or the same `No door:` line. | |
| 8 | 13 | */ |
| 9 | 14 | |
| 10 | 15 | import type { Change } from "./pin_edits.ts"; |
| 11 | 16 | |
| 12 | 17 | const PAGE = /^src\/web\/pages\/[^/]+\.ts$/; |
| 18 | const SURFACE = /^src\/(web\/render|actions)\/[^/]+\.ts$/; | |
| 13 | 19 | const SCREEN = /^src\/tui\/screens\/[^/]+\.ts$/; |
| 14 | 20 | const DOC = /^docs\/features\/[^/]+\.md$/; |
| 15 | 21 | const WAIVER = /^No door:\s*\S[^\n]{9,}/im; |
| @@ -29,15 +35,17 @@ export function bothDoorsProblems( | ||
| 29 | 35 | imported: (screen: string) => boolean, |
| 30 | 36 | ): string[] { |
| 31 | 37 | const pages = added(changes, PAGE); |
| 32 | if (pages.length === 0) return []; | |
| 38 | const surfaces = added(changes, SURFACE); | |
| 39 | if (pages.length === 0 && surfaces.length === 0) return []; | |
| 33 | 40 | if (messages.some((m) => WAIVER.test(m))) return []; |
| 34 | 41 | const missing: string[] = []; |
| 35 | 42 | const screens = added(changes, SCREEN); |
| 36 | 43 | if (screens.length === 0) missing.push("terminal screen in src/tui/screens/ (entry where AGENTS.md says)"); |
| 37 | 44 | else if (!screens.some(imported)) missing.push(`entry that opens ${screens[0]} (add its palette entry per AGENTS.md)`); |
| 38 | if (added(changes, DOC).length === 0) missing.push("docs/features/<name>.md how-to"); | |
| 45 | if (pages.length > 0 && added(changes, DOC).length === 0) missing.push("docs/features/<name>.md how-to"); | |
| 39 | 46 | if (missing.length === 0) return []; |
| 40 | const shown = pages.slice(0, 3).join(", ") + (pages.length > 3 ? ` and ${pages.length - 3} more` : ""); | |
| 47 | const all = [...pages, ...surfaces]; | |
| 48 | const shown = all.slice(0, 3).join(", ") + (all.length > 3 ? ` and ${all.length - 3} more` : ""); | |
| 41 | 49 | return [ |
| 42 | 50 | `rule "both doors": this pull adds ${shown} but no ${missing.join(" and no ")}; add them, or put a "No door: <why>" line (10+ characters) in a commit message`, |
| 43 | 51 | ]; |
test/both-doors.test.ts +11
| @@ -40,3 +40,14 @@ test("a helper under src/tui/ is not a screen, and a screen nothing imports is n | ||
| 40 | 40 | `rule "both doors": this pull adds src/web/pages/traffic.ts but no entry that opens src/tui/screens/traffic.ts (add its palette entry per AGENTS.md)${tail}`, |
| 41 | 41 | ]); |
| 42 | 42 | }); |
| 43 | ||
| 44 | test("a new file renderer or action needs a terminal screen, and is not asked for a how-to (#11287, #11626)", () => { | |
| 45 | for (const f of ["src/web/render/graphql.ts", "src/actions/schedules.ts"]) { | |
| 46 | expect(bothDoorsProblems([ch("A", f)], [], () => true)).toEqual([ | |
| 47 | `rule "both doors": this pull adds ${f} but no ${TUI}${tail}`, | |
| 48 | ]); | |
| 49 | expect(bothDoorsProblems([ch("A", f), ch("A", "src/tui/screens/s.ts")], [], () => true)).toEqual([]); | |
| 50 | expect(bothDoorsProblems([ch("A", f)], ["No door: a helper with no screen of its own"], () => true)).toEqual([]); | |
| 51 | expect(bothDoorsProblems([ch("M", f)], [], () => true)).toEqual([]); | |
| 52 | } | |
| 53 | }); |
new above
offline