Add render-first lint step for chezmoi templates - #57
Conversation
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a new shell script ChangesTemplate Lint Tooling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsLinked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
82a85e4 to
1acf1fd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/lint-templates.sh`:
- Around line 13-16: The hosttype prompt text is duplicated between the lint
script and the chezmoi template, which can drift and break promptChoice
matching. Update the logic in scripts/lint-templates.sh around hosttype_prompt
to derive the prompt text at runtime from home/.chezmoi.yaml.tmpl instead of
hardcoding it, so the value always stays in sync and avoids a silent
--promptChoice fallback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d642c496-c052-4b49-a20d-351589b25586
⛔ Files ignored due to path filters (2)
hk.pklis excluded by!**/*.pklmise.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
AGENTS.mdmise.tomlscripts/lint-templates.sh
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
AGENTS.md
📄 CodeRabbit inference engine (CLAUDE.md)
AGENTS.md: Document agent responsibilities and capabilities in AGENTS.md
Maintain AGENTS.md as the source of truth for agent configuration and behavior documentation
Files:
AGENTS.md
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: Never edit deployed files directly (for example `~/.gitconfig`, `~/.config/AGENTS.md`, or `~/.claude/settings.json`); edit the corresponding source files under `home/` and deploy with `chezmoi apply`.
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: Always pass `--no-tty` to `chezmoi apply` so interactive prompts fail instead of blocking.
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: Never run `chezmoi apply --force` without targets; if `--force` is needed, scope it to specific target path(s).
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: When editing shared templates that feed multiple outputs, use bare `chezmoi apply` so all outputs regenerate.
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: To preview changes without applying them, use `chezmoi diff`.
Learnt from: CR
Repo: gtbuchanan/dotfiles
Timestamp: 2026-07-02T23:53:38.989Z
Learning: To force a rerun of a `run_onchange_*` script, delete its `entryState` entry keyed by the rendered script destination path and then run `chezmoi apply`.
🔇 Additional comments (4)
scripts/lint-templates.sh (2)
1-36: LGTM!
38-67: LGTM!mise.toml (1)
38-40: LGTM!AGENTS.md (1)
103-103: LGTM!
The shell and eslint steps exclude *.tmpl, so templates were unlinted. Add an hk render-templates step that renders each through `chezmoi execute-template`, failing on syntax and undefined-ref errors. CI has no `chezmoi init` config, so scripts/lint-templates.sh regenerates one from .chezmoi.yaml.tmpl and renders against it. Adds chezmoi to mise.toml so the step resolves in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1acf1fd to
eb75058
Compare
What
Adds an hk
render-templatesstep that renders every changed*.tmplthroughchezmoi execute-template, failing on template syntax and undefined-ref errors. The shell and eslint steps exclude*.tmpl(their parsers choke on{{ }}), so source templates were unlinted. This validates that templates render — not that the rendered output passes a type-specific lint.CI config generation
chezmoi execute-templateneeds the config data thatchezmoi initnormally generates, which CI doesn't have.scripts/lint-templates.shregenerates it from.chezmoi.yaml.tmplinto a throwaway file and renders against it, so the check behaves the same locally and in CI.chezmoiis added tomise.tomlso CI can install it.Scope
A render picks one conditional branch, so only one representative hosttype/OS variation is exercised. Linting rendered output through per-type tools was prototyped but dropped — it only ever covers the rendered variation.
🤖 Generated with Claude Code