Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

docs: AGENTS.md's recipes move to docs/workflows/, word for word

sim5865347dfc29
diff --git a/AGENTS.md b/AGENTS.md
index c831556f0..0fd29c717 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -55,7 +55,7 @@ this file repeats their rules in the form an agent needs, and links to them for
The person's backups (`backup/`), screenshots (`shots/`), notes (`work/`) and the ADB key
(`tools/adbkey/`) are listed in `.gitignore` and must never be committed. If the person wants to
-share their TV's list afterwards, follow [Add a TV list](#add-a-tv-list) below.
+share their TV's list afterwards, follow [`docs/workflows/tv-list.md`](docs/workflows/tv-list.md).
## Repo map
@@ -85,7 +85,7 @@ The core stays small on purpose. Pick the smallest home that fits (CONTRIBUTING,
| The change | Where it goes |
|---|---|
| A TV list, a fix, a translation, docs, a tool fix | A pull request here |
-| A small launcher switch that is off by default | A pull request here: see [the switch recipe](#add-an-off-by-default-launcher-switch) |
+| A small launcher switch that is off by default | A pull request here: see [`docs/workflows/launcher-switch.md`](docs/workflows/launcher-switch.md) |
| A new look: colours, wallpaper, dock, columns, that existing config keys can carry | `themes/<name>/` |
| A widget or tile that can be its own small app | `addons/<name>/`, as a module card that never touches `launcher/` |
| A whole new launcher, a heavy restyle, a port to another platform, a lower `minSdk`, new permissions or network access, Fire TV Home takeover, a changed default for every TV | Your own repository, plus one row in `SHOWCASE.md` |
@@ -105,142 +105,19 @@ Read that file before a non-trivial PR; the verdicts are:
| hold | A maintainer decision, or a run on a real TV first. Changes to the Home or launch path (Home key, boot, return to Home, the install scripts) usually need one. |
| close | A duplicate, superseded, or against the base rule: no root, nothing uninstalled, you build it yourself. |
-## Recipes
-
-Run the tests after every recipe: `python3 -m unittest discover -s tests -v` (see [Before opening a PR](#before-opening-a-pr)).
-
-### Add a TV list
-
-1. Check `examples/README.md` first. The same product code and firmware as an existing folder is usually a
- second unit or a re-badge: add your notes to that folder instead of a new one.
-2. Create `examples/<brand>-<model>/debloat.txt`, lower-case with hyphens. Copy the format of
- `examples/xiaomi-mi-tv-4a/debloat.txt`:
- - The first line is a comment with the exact model, Android version and firmware build
- (`tools/tv.py --probe` prints them).
- - Then the Apply and Undo lines, the stock launcher and Live TV package if they differ, and what was kept and why.
- - One package per line, grouped under a comment that names the group, with a trailing comment on anything
- non-obvious. No duplicates, nothing but package names outside comments.
-3. List only packages you actually disabled and lived with for a few days. Note anything you re-enabled.
- Mark untested entries as comments.
-4. Add one row to the table in `examples/README.md` (`` | `<folder>/` | TV | OS | Notes | ``) and one to the
- TV table in `README.md` (`| TV | OS |`). The TV cell must be the same text in both; `tests/test_examples.py`
- compares them.
-5. Leave the counts alone (the `TV models` number in the card's alt text, the brand line): CI checks them only
- on `main`, and they are fixed up on merge.
-6. A `README.md` for TV-specific notes and a `config.json` with the dock are welcome in the folder. Do not add
- install or restore scripts, Private DNS or AdGuard setup, or `pm uninstall` steps: the folder only
- disables, and `tools/disable.sh` and `tools/restore.sh` do the rest.
-
-A model with notes but no several-day list goes in `docs/devices/<brand-model>.md`, with one line under the notes
-list at the end of `examples/README.md`. A folder in `examples/` must have packages in it.
-
-### Update an existing list
-
-Keep the header accurate: add the second unit's model, firmware and region rather than replacing the first.
-Explain each added or re-enabled package in a comment. A list that disables the firmware updater says why in the
-header; keeping it enabled is preferred. `pm hide` or `pm block` needs the matching undo in the header. Edits to
-someone else's list are judgement calls, so say in the PR which TV you tested on and for how long.
-
-### Add a launcher translation
-
-1. Create `launcher/app/src/main/res/values-<qualifier>/strings.xml` and translate every string in
- `launcher/app/src/main/res/values/strings.xml`, skipping the ones marked `translatable="false"`. Keep
- placeholders (`%1$s`, `%d`) and XML escapes intact.
-2. Add the locale to `launcher/app/src/main/res/xml/locales_config.xml`.
-3. Add the language to the Languages list in `README.md`.
-4. To fix a missing string in existing locales, add it to every `values-*` folder you can, in the same order as
- the default `strings.xml`. A missing string falls back to English (`launcher/app/lint.xml`), but a new switch
- needs its strings in every locale.
-5. Moving hard-coded text into resources is welcome; do not bundle unrelated build changes with it.
-6. Build the launcher, set the TV's language (Android 13+: `tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales <tag>'`)
- and attach a screenshot. Right-to-left languages mirror the layout like Hebrew; `tests/test_hebrew_resources.py`
- checks that `layout-iw` keeps every view.
-
-### Add an off-by-default launcher switch
-
-The core takes a switch only if it changes nothing until a theme or `config.xml` turns it on:
-
-1. Add the key to `launcher/app/src/main/res/values/config.xml` with a comment that says what it does and
- that a theme can set it, defaulting to off (`false`, `0` or the current behaviour).
-2. Read it in `launcher/app/src/main/java/com/gathin/tvhome/Config.java`, from the resource and from the
- theme JSON, the way existing keys such as `show_stats` are read.
-3. Add a row to the Keys table in `themes/README.md`.
-4. If it adds a row to Launcher settings, put its strings in `launcher/app/src/main/res/values/strings.xml`
- and every `values-*` folder.
-5. With the key off, nothing new runs: no receiver, no service, no write, no permission grant in the install
- script. The bot checks this in the diff, not in the description.
-6. Add a JVM unit test under `launcher/app/src/test/java/com/gathin/tvhome/` for any logic that can be tested
- without a TV.
-7. Keep it small: a switch should cost a few hundred bytes to about 1 KB of APK. Build and check the size
- gate; the gate is hard.
-8. Verify on a real TV with the switch on and off, D-pad from every edge, and attach screenshots.
-9. If you can, run the regression check in [`docs/workflows/perf-ab.md`](docs/workflows/perf-ab.md) with the
- switch on: a baseline before you start, your build after, and the numbers in the PR. It's optional, but welcome.
-
-Anything TV-specific goes in `config.xml` or a theme, not in code. A bug fix that corrects wrong behaviour needs
-no switch. No new dependencies in `launcher/app/build.gradle` without an issue first.
-
-### Add a theme
-
-1. Create `themes/<name>/config.json` using only keys from the table in `themes/README.md`;
- `themes/default/config.json` is the starting point.
-2. Add `wallpaper.jpg` or a `wallpapers/` folder if it uses them: dark, 1920x1080, under about 300 KB each,
- and art you have the right to use.
-3. Push it to a real TV with `tools/theme.sh themes/<name>` and take `screenshot.jpg` of Home with the focus
- on the dock: a JPEG at 1280x720 (16:9), at most 300 KB. Not a mock-up, not an emulator.
- `tests/test_themes.py` fails without it.
-4. Add a row to the table in `themes/README.md` showing the screenshot, like the others.
-5. A look that needs a new key is a launcher switch first, in its own PR.
-
-### Add an add-on
-
-1. Create `addons/<name>/` as its own Gradle project (`settings.gradle` and an `app` module), with its own
- package name.
-2. It talks to the launcher only through the module-card contract (`docs/modules.md`, `docs/specs/card.md`).
- Nothing under `launcher/` changes, and `launcher/` never mentions `addons/`. If the idea needs a launcher
- change, it is not an add-on: open an issue.
-3. Its `README.md` has a Permissions section listing every permission and why, plus any network access or
- background service. No telemetry without an opt-in, no ads, your own art.
-4. Add one row to the table in `addons/README.md` linking `<name>/`, with the TV it was tested on.
-5. No APKs in the repo. `tests/test_addons.py` checks all of this; `.github/workflows/addons.yml` builds the
- add-ons that changed with `./gradlew --no-daemon assembleRelease`.
-
-### Add a showcase row
-
-1. Add one row to the section of `SHOWCASE.md` that fits (home screens, forks, screensavers and add-ons,
- tools, other platforms), and the project under its TV brand in "Find a project by TV brand".
-2. Keep each cell to one line: what it is, what it was built and tested on, and the author.
-3. The project is open source with a link people can read and build, says which TV it was tested on, collects
- nothing beyond what its README says, and is yours or listed with the author's blessing.
-4. Put a screenshot in the PR description; it is linked from the row.
-
-### Add a press entry
-
-1. Add a row `| Outlet | [Headline](<url>) | Date |` to the right country section of `docs/PRESS.md`, in the
- headline's own language. The link must open and show the article: no syndicated copies, no auto-generated
- listings, nothing that cannot be checked.
-2. Update the counts in all four places `tests/test_press_counts.py` checks: the `docs/PRESS.md` intro line,
- its index line, the README card's alt text ("and N more: N articles from N countries") and `MORE` in
- `tools/readme_featured.py`. If you cannot redraw `docs/featured.png` and `docs/card.jpg` with
- `tools/readme_featured.py` and `tools/readme_card.py`, say so in the PR.
-
-### Docs and troubleshooting notes
-
-- `docs/TROUBLESHOOTING.md` is grouped under headings (Connecting, Working on the TV, then one per larger
- problem). An entry is a bullet that opens with the symptom in bold, then the cause and the fix, naming the
- TV model and firmware it was seen on.
-- A fix for something your agent got stuck on usually belongs in `PROMPT.md` as one extra sentence, kept
- brand-neutral. Brand-specific knowledge goes in `examples/` or `docs/devices/`. Changes to the safety rules
- themselves go to the maintainer.
-- Several tests pin facts in `docs/devices/` notes, `PROMPT.md` and `docs/TROUBLESHOOTING.md` (the
- `tests/test_*_note.py` files). If you reword one of those passages, run the suite and keep the fact.
-- Docs and the README stay in step: a new list, theme, add-on or tool gets its row where the others are.
-
## Workflows
-Multi-step methods in `docs/workflows/`. Read the one that fits before you start; each opens with when to
-use it and links the tool guides it needs.
-
+Step-by-step methods in `docs/workflows/`. Read the one that fits before you start; each opens with when to
+use it and ends with the check to run.
+
+- [`tv-list.md`](docs/workflows/tv-list.md): add a tested TV's debloat list with its README rows, or update one.
+- [`launcher-switch.md`](docs/workflows/launcher-switch.md): add an off-by-default launcher switch, within the size gate.
+- [`translation.md`](docs/workflows/translation.md): add a launcher language, or fill strings missing from one.
+- [`theme.md`](docs/workflows/theme.md): add a theme from existing keys, with its screenshot from a real TV.
+- [`addon.md`](docs/workflows/addon.md): add a module-card app that never touches `launcher/`.
+- [`showcase.md`](docs/workflows/showcase.md): list a project that lives in its own repository.
+- [`press.md`](docs/workflows/press.md): add an article and update the four press counts.
+- [`docs-notes.md`](docs/workflows/docs-notes.md): add a troubleshooting entry or a `PROMPT.md` fix, keeping pinned facts.
- [`perf-ab.md`](docs/workflows/perf-ab.md): an optional check of a launcher change for performance regressions with
`tools/bench.py`, and measure an improvement or a failed check with traces, a report and flame charts.
diff --git a/docs/workflows/addon.md b/docs/workflows/addon.md
new file mode 100644
index 000000000..d45577624
--- /dev/null
+++ b/docs/workflows/addon.md
@@ -0,0 +1,16 @@
+# Workflow: Add an add-on
+
+**When to use this:** a widget or tile that can be its own small app, shown through a module card.
+
+1. Create `addons/<name>/` as its own Gradle project (`settings.gradle` and an `app` module), with its own
+ package name.
+2. It talks to the launcher only through the module-card contract (`docs/modules.md`, `docs/specs/card.md`).
+ Nothing under `launcher/` changes, and `launcher/` never mentions `addons/`. If the idea needs a launcher
+ change, it is not an add-on: open an issue.
+3. Its `README.md` has a Permissions section listing every permission and why, plus any network access or
+ background service. No telemetry without an opt-in, no ads, your own art.
+4. Add one row to the table in `addons/README.md` linking `<name>/`, with the TV it was tested on.
+5. No APKs in the repo. `tests/test_addons.py` checks all of this; `.github/workflows/addons.yml` builds the
+ add-ons that changed with `./gradlew --no-daemon assembleRelease`.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/docs-notes.md b/docs/workflows/docs-notes.md
new file mode 100644
index 000000000..58b0de9d7
--- /dev/null
+++ b/docs/workflows/docs-notes.md
@@ -0,0 +1,15 @@
+# Workflow: Docs and troubleshooting notes
+
+**When to use this:** a troubleshooting entry, a fix to `PROMPT.md`, or any other docs change.
+
+- `docs/TROUBLESHOOTING.md` is grouped under headings (Connecting, Working on the TV, then one per larger
+ problem). An entry is a bullet that opens with the symptom in bold, then the cause and the fix, naming the
+ TV model and firmware it was seen on.
+- A fix for something your agent got stuck on usually belongs in `PROMPT.md` as one extra sentence, kept
+ brand-neutral. Brand-specific knowledge goes in `examples/` or `docs/devices/`. Changes to the safety rules
+ themselves go to the maintainer.
+- Several tests pin facts in `docs/devices/` notes, `PROMPT.md` and `docs/TROUBLESHOOTING.md` (the
+ `tests/test_*_note.py` files). If you reword one of those passages, run the suite and keep the fact.
+- Docs and the README stay in step: a new list, theme, add-on or tool gets its row where the others are.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/launcher-switch.md b/docs/workflows/launcher-switch.md
new file mode 100644
index 000000000..00a7476ad
--- /dev/null
+++ b/docs/workflows/launcher-switch.md
@@ -0,0 +1,27 @@
+# Workflow: Add an off-by-default launcher switch
+
+**When to use this:** a launcher behaviour or look that existing config keys can't carry.
+
+The core takes a switch only if it changes nothing until a theme or `config.xml` turns it on:
+
+1. Add the key to `launcher/app/src/main/res/values/config.xml` with a comment that says what it does and
+ that a theme can set it, defaulting to off (`false`, `0` or the current behaviour).
+2. Read it in `launcher/app/src/main/java/com/gathin/tvhome/Config.java`, from the resource and from the
+ theme JSON, the way existing keys such as `show_stats` are read.
+3. Add a row to the Keys table in `themes/README.md`.
+4. If it adds a row to Launcher settings, put its strings in `launcher/app/src/main/res/values/strings.xml`
+ and every `values-*` folder.
+5. With the key off, nothing new runs: no receiver, no service, no write, no permission grant in the install
+ script. The bot checks this in the diff, not in the description.
+6. Add a JVM unit test under `launcher/app/src/test/java/com/gathin/tvhome/` for any logic that can be tested
+ without a TV.
+7. Keep it small: a switch should cost a few hundred bytes to about 1 KB of APK. Build and check the size
+ gate; the gate is hard.
+8. Verify on a real TV with the switch on and off, D-pad from every edge, and attach screenshots.
+9. If you can, run the regression check in [`perf-ab.md`](perf-ab.md) with the
+ switch on: a baseline before you start, your build after, and the numbers in the PR. It's optional, but welcome.
+
+Anything TV-specific goes in `config.xml` or a theme, not in code. A bug fix that corrects wrong behaviour needs
+no switch. No new dependencies in `launcher/app/build.gradle` without an issue first.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/press.md b/docs/workflows/press.md
new file mode 100644
index 000000000..9b6f96a00
--- /dev/null
+++ b/docs/workflows/press.md
@@ -0,0 +1,13 @@
+# Workflow: Add a press entry
+
+**When to use this:** an article about this project.
+
+1. Add a row `| Outlet | [Headline](<url>) | Date |` to the right country section of `docs/PRESS.md`, in the
+ headline's own language. The link must open and show the article: no syndicated copies, no auto-generated
+ listings, nothing that cannot be checked.
+2. Update the counts in all four places `tests/test_press_counts.py` checks: the `docs/PRESS.md` intro line,
+ its index line, the README card's alt text ("and N more: N articles from N countries") and `MORE` in
+ `tools/readme_featured.py`. If you cannot redraw `docs/featured.png` and `docs/card.jpg` with
+ `tools/readme_featured.py` and `tools/readme_card.py`, say so in the PR.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/showcase.md b/docs/workflows/showcase.md
new file mode 100644
index 000000000..16b200741
--- /dev/null
+++ b/docs/workflows/showcase.md
@@ -0,0 +1,12 @@
+# Workflow: Add a showcase row
+
+**When to use this:** a project built on this repo that lives in its own repository.
+
+1. Add one row to the section of `SHOWCASE.md` that fits (home screens, forks, screensavers and add-ons,
+ tools, other platforms), and the project under its TV brand in "Find a project by TV brand".
+2. Keep each cell to one line: what it is, what it was built and tested on, and the author.
+3. The project is open source with a link people can read and build, says which TV it was tested on, collects
+ nothing beyond what its README says, and is yours or listed with the author's blessing.
+4. Put a screenshot in the PR description; it is linked from the row.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/theme.md b/docs/workflows/theme.md
new file mode 100644
index 000000000..f957fb25c
--- /dev/null
+++ b/docs/workflows/theme.md
@@ -0,0 +1,15 @@
+# Workflow: Add a theme
+
+**When to use this:** a new look that the keys in `themes/README.md` already carry.
+
+1. Create `themes/<name>/config.json` using only keys from the table in `themes/README.md`;
+ `themes/default/config.json` is the starting point.
+2. Add `wallpaper.jpg` or a `wallpapers/` folder if it uses them: dark, 1920x1080, under about 300 KB each,
+ and art you have the right to use.
+3. Push it to a real TV with `tools/theme.sh themes/<name>` and take `screenshot.jpg` of Home with the focus
+ on the dock: a JPEG at 1280x720 (16:9), at most 300 KB. Not a mock-up, not an emulator.
+ `tests/test_themes.py` fails without it.
+4. Add a row to the table in `themes/README.md` showing the screenshot, like the others.
+5. A look that needs a new key is a launcher switch first, in its own PR.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/translation.md b/docs/workflows/translation.md
new file mode 100644
index 000000000..2f0cc93ea
--- /dev/null
+++ b/docs/workflows/translation.md
@@ -0,0 +1,18 @@
+# Workflow: Add or fix a launcher translation
+
+**When to use this:** a new launcher language, or strings missing from existing ones.
+
+1. Create `launcher/app/src/main/res/values-<qualifier>/strings.xml` and translate every string in
+ `launcher/app/src/main/res/values/strings.xml`, skipping the ones marked `translatable="false"`. Keep
+ placeholders (`%1$s`, `%d`) and XML escapes intact.
+2. Add the locale to `launcher/app/src/main/res/xml/locales_config.xml`.
+3. Add the language to the Languages list in `README.md`.
+4. To fix a missing string in existing locales, add it to every `values-*` folder you can, in the same order as
+ the default `strings.xml`. A missing string falls back to English (`launcher/app/lint.xml`), but a new switch
+ needs its strings in every locale.
+5. Moving hard-coded text into resources is welcome; do not bundle unrelated build changes with it.
+6. Build the launcher, set the TV's language (Android 13+: `tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales <tag>'`)
+ and attach a screenshot. Right-to-left languages mirror the layout like Hebrew; `tests/test_hebrew_resources.py`
+ checks that `layout-iw` keeps every view.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/docs/workflows/tv-list.md b/docs/workflows/tv-list.md
new file mode 100644
index 000000000..e26272f7d
--- /dev/null
+++ b/docs/workflows/tv-list.md
@@ -0,0 +1,35 @@
+# Workflow: Add or update a TV list
+
+**When to use this:** you tested a TV's debloat list for a few days and want to share it, or you have a second unit or a fix for a list that exists.
+
+1. Check `examples/README.md` first. The same product code and firmware as an existing folder is usually a
+ second unit or a re-badge: add your notes to that folder instead of a new one.
+2. Create `examples/<brand>-<model>/debloat.txt`, lower-case with hyphens. Copy the format of
+ `examples/xiaomi-mi-tv-4a/debloat.txt`:
+ - The first line is a comment with the exact model, Android version and firmware build
+ (`tools/tv.py --probe` prints them).
+ - Then the Apply and Undo lines, the stock launcher and Live TV package if they differ, and what was kept and why.
+ - One package per line, grouped under a comment that names the group, with a trailing comment on anything
+ non-obvious. No duplicates, nothing but package names outside comments.
+3. List only packages you actually disabled and lived with for a few days. Note anything you re-enabled.
+ Mark untested entries as comments.
+4. Add one row to the table in `examples/README.md` (`` | `<folder>/` | TV | OS | Notes | ``) and one to the
+ TV table in `README.md` (`| TV | OS |`). The TV cell must be the same text in both; `tests/test_examples.py`
+ compares them.
+5. Leave the counts alone (the `TV models` number in the card's alt text, the brand line): CI checks them only
+ on `main`, and they are fixed up on merge.
+6. A `README.md` for TV-specific notes and a `config.json` with the dock are welcome in the folder. Do not add
+ install or restore scripts, Private DNS or AdGuard setup, or `pm uninstall` steps: the folder only
+ disables, and `tools/disable.sh` and `tools/restore.sh` do the rest.
+
+A model with notes but no several-day list goes in `docs/devices/<brand-model>.md`, with one line under the notes
+list at the end of `examples/README.md`. A folder in `examples/` must have packages in it.
+
+## Update an existing list
+
+Keep the header accurate: add the second unit's model, firmware and region rather than replacing the first.
+Explain each added or re-enabled package in a comment. A list that disables the firmware updater says why in the
+header; keeping it enabled is preferred. `pm hide` or `pm block` needs the matching undo in the header. Edits to
+someone else's list are judgement calls, so say in the PR which TV you tested on and for how long.
+
+Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/tests/test_agents_md.py b/tests/test_agents_md.py
index d7e78b993..67bfd6cba 100644
--- a/tests/test_agents_md.py
+++ b/tests/test_agents_md.py
@@ -1,5 +1,8 @@
"""Keeps AGENTS.md honest: every path it names exists, and its numbers match the files they come from.
+The workflows in docs/workflows/ hold the recipes AGENTS.md used to carry, so their paths are checked
+the same way: words in backticks from the repository root, links from the workflow's own folder.
+
Coding agents follow AGENTS.md to the letter, so a renamed file or a moved gate turns into a confident
wrong instruction. A path is anything in a link or in backticks that has a slash or a file extension;
templates such as `examples/<brand>-<model>/` and globs are skipped, and so are the local folders
@@ -15,6 +18,7 @@ import unittest
ROOT = Path(__file__).resolve().parents[1]
AGENTS = ROOT / "AGENTS.md"
+WORKFLOWS = ROOT / "docs" / "workflows"
CI = ROOT / ".github" / "workflows" / "ci.yml"
GRADLE = ROOT / "launcher" / "app" / "build.gradle"
@@ -23,6 +27,7 @@ TEMPLATE = re.compile(r"[<>*{}$=%]")
LINK = re.compile(r"\]\(([^)\s]+)\)")
CODE = re.compile(r"(`+)(.+?)\1")
SKIP_DIRS = {".git", "venv", "build", ".gradle", "__pycache__"}
+WRITTEN = {"result.json"} # files a tool writes on a contributor's machine (tools/bench.py), not in a clone
def text():
@@ -43,9 +48,9 @@ def file_names():
return names
-def named_paths():
+def named_paths(body=None):
"""(source, path) for every link target outside code and every path-like word in backticks."""
- body = text()
+ body = text() if body is None else body
found = []
for target in LINK.findall(CODE.sub("", body)):
if not re.match(r"(https?:|mailto:|#)", target):
@@ -76,6 +81,29 @@ class AgentsPathsTest(unittest.TestCase):
else:
self.assertTrue((ROOT / path).exists(), f"AGENTS.md names {path}, which does not exist")
+ def test_every_path_a_workflow_names_exists(self):
+ ignored = ignored_prefixes()
+ names = file_names()
+ for workflow in sorted(WORKFLOWS.glob("*.md")):
+ for source, path in named_paths(workflow.read_text(encoding="utf-8")):
+ with self.subTest(workflow=workflow.name, path=path, source=source):
+ if source == "link":
+ target = (workflow.parent / path).resolve()
+ self.assertTrue(target.exists(), f"{workflow.name} links {path}, which does not exist")
+ elif path in WRITTEN or any(path == p or path.startswith(p + "/") for p in ignored):
+ continue
+ elif "/" not in path.rstrip("/"):
+ self.assertTrue((ROOT / path).exists() or path.rstrip("/") in names,
+ f"{workflow.name} names {path}, and no file in the repo has that name")
+ else:
+ self.assertTrue((ROOT / path).exists(), f"{workflow.name} names {path}, which does not exist")
+
+ def test_every_workflow_is_listed(self):
+ for workflow in sorted(WORKFLOWS.glob("*.md")):
+ with self.subTest(workflow=workflow.name):
+ self.assertIn(f"](docs/workflows/{workflow.name})", text(),
+ f"AGENTS.md's Workflows section has no line for {workflow.name}")
+
def test_it_names_paths_at_all(self):
# A parser that silently finds nothing would make the test above pass for any text.
paths = [p for _, p in named_paths()]
diff --git a/tests/test_theme_keys_config.py b/tests/test_theme_keys_config.py
index dbf6d2acf..79f9c34c9 100644
--- a/tests/test_theme_keys_config.py
+++ b/tests/test_theme_keys_config.py
@@ -156,7 +156,7 @@ class KeysTableCoversConfigXmlTest(unittest.TestCase):
for name in missing:
with self.subTest(key=name):
self.fail(f"the launcher reads `{name}` from config.xml and the Keys table has no row "
- f"for it: add one (AGENTS.md's switch recipe) or, if it is not a key a "
+ f"for it: add one (docs/workflows/launcher-switch.md) or, if it is not a key a "
f"reader sets, add it to EXEMPT with the page that documents it instead")
def test_settings_fallback_components_has_its_row(self):
diff --git a/tests/test_theme_keys_table.py b/tests/test_theme_keys_table.py
index 921f608c1..dabdc9bce 100644
--- a/tests/test_theme_keys_table.py
+++ b/tests/test_theme_keys_table.py
@@ -1,6 +1,6 @@
"""The Keys table in themes/README.md defines each key once.
-The recipe in AGENTS.md says to add a key's row to this table, and four contributors each did exactly
+The switch recipe (docs/workflows/launcher-switch.md) says to add a key's row to this table, and four contributors each did exactly
that when they taught `app_keys` a new form (a scancode on 20 Oct, `input:` on 21 Oct, `hold:` on 22
Oct), so the table ended up with four `app_keys` rows: the third one lost the scancode form that the
first two document, and a reader who finds it first concludes scancodes are not supported.