You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: agent-UX — point K-PAR-001 end-tag errors at kida check (#112)
Agents doing bulk template migrations in downstream repos (e.g. IA
rewrites across dozens of `{% call %}`/`{% if %}` nests) hit parse
errors one rendered route at a time because no error message told
them `kida check <dir> --strict --validate-calls` batch-validates
the whole directory. The CLI already existed; the agent-UX gap was
that nothing surfaced it.
Adds `BULK_CHECK_TIP` in `kida.parser.errors`, appended to the five
K-PAR-001 end-tag mismatch paths: orphan `{% end %}`, mismatched
closing tags, and typed-end mismatches. AGENTS.md gains a
"downstream bulk-edit agents" bullet under "Who reads your output"
so future error-message work treats them as a first-class reader.
No test assertions rely on the exact suggestion strings; 4116 tests
pass, ruff/ty clean.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,7 @@ Kida is shipped (Bengal and Chirp depend on it) and pre-1.0. Calibrate according
42
42
43
43
-**Framework builders** — Bengal, Chirp. They read `template_metadata()`, `block_metadata()`, tracebacks with line/col, and your error messages when their users misuse a tag.
44
44
-**SSG authors** — read `kida check` / `kida format` output. If your error doesn't include the template path and a fix, it's wrong.
45
+
-**Agents doing bulk template edits in downstream repos** — the whack-a-mole case. An agent migrating an IA across dozens of `{% call %}`/`{% if %}` nests finds parse errors one rendered route at a time unless we tell them about `kida check <dir> --strict --validate-calls`. Parser errors on unmatched `{% end %}` should surface that tip; agent-facing docs should lead with it.
45
46
-**Migrators from Jinja2** — want to be done in five minutes. The `set` vs `let` trap is the #1 thing they hit. Error messages should *catch them*, not let them debug it themselves.
46
47
-**Contributors** — know templating, not our internals. They read parser/compiler files; mixin patterns are surprising.
47
48
-**Me (Lawrence)** — read diffs. Put the *what* in code, the *why* in the PR.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
-**`kida check --lint-fragile-paths`** — Opt-in lint rule that flags cross-template references whose target lives in the same folder as the caller (e.g. `{% include "pages/card.html" %}` from `pages/about.html`) and suggests the refactor-safe `./card.html` form. The rule covers `{% include %}`, `{% extends %}`, `{% embed %}`, `{% import %}`, and `{% from ... import %}`; references that already use `./`, `../`, or `@alias/` are ignored, and only exact same-folder matches are flagged to keep false-positives low. Default `kida check` behavior is unchanged — the rule only runs when the flag is passed.
14
14
-**Refactor-safe templates tutorial** — New `site/content/docs/tutorials/refactor-safe-templates.md` walks through the folder-move problem, when to use `./` / `../` vs `@alias/`, and a step-by-step migration recipe using `ripgrep`. Cross-linked from the tutorials index and `docs/syntax/includes.md`.
15
15
-**Namespace aliases for template paths** — `Environment(template_aliases={...})` maps short `@name/` prefixes to root-relative subtrees so cross-cutting component libraries stop being path-coupled. With `template_aliases={"components": "ui/components", "layouts": "ui/layouts"}`, templates can write `{% include "@components/card.html" %}` or `{% extends "@layouts/base.html" %}` regardless of where the caller lives — aliases resolve before loader lookup, so the same prefix works in every cross-template statement (`{% include %}`, `{% extends %}`, `{% embed %}`, `{% from ... import ... %}`). Aliases and `./`/`../` relative paths are orthogonal modes; aliases always resolve to an absolute root, so there is no composition of the two. Unknown aliases raise `TemplateNotFoundError` with the list of configured aliases.
16
+
-**K-PAR-001 end-tag errors now point at `kida check`** — Orphan `{% end %}`, mismatched closing tags (e.g. `{% endfor %}` against an open `{% if %}`), and typed-end mismatches (e.g. `{% endblock %}` inside a `{% def %}`) now append a tip telling the reader to run `kida check <templates-dir> --strict` to surface every mismatch across the directory at once. Agents and humans doing bulk template migrations were discovering these one rendered route at a time; the CLI already batch-validates, but nothing in the error message said so. New `BULK_CHECK_TIP` constant in `kida.parser.errors`, wired into the five end-tag mismatch paths across `parser/statements.py`, `parser/core.py`, and `parser/blocks/core.py`. `AGENTS.md` gains an "Agents doing bulk template edits in downstream repos" bullet under "Who reads your output" to make the audience explicit for future error-message work.
0 commit comments