feat(template): a declared template rule, and the tmpl applet on the same renderer - #440
Open
raphaelvigee wants to merge 1 commit into
Conversation
raphaelvigee
force-pushed
the
raphaelvigee/coreutils-template-driver
branch
from
August 29, 2026 21:35
d386399 to
168264d
Compare
raphaelvigee
force-pushed
the
raphaelvigee/coreutils-template-driver
branch
from
September 3, 2026 16:26
168264d to
7ae3435
Compare
raphaelvigee
force-pushed
the
raphaelvigee/coreutils-template-driver
branch
from
September 3, 2026 16:56
7ae3435 to
cceac42
Compare
…same renderer Filling in a config file should not require a shell. `template(name, src, out, vars)` renders a declared template with declared variables, in-process (`crates/builtins/src/plugintemplate`) — inputs and outputs fully declared, no `sed` pipeline, no quoting rules to get wrong. The renderer itself lives in `crates/template` so the rule and the `tmpl` applet are the same code rather than two implementations of one syntax. `tmpl` covers the mid-recipe case (and `envsubst`); the rule is the one to reach for, because a rule's inputs are in the cache key and a mid-recipe render's are not. Two constraints the renderer carries deliberately: - **No non-deterministic builtins.** No `now()`, no randomness — a template that can render differently from the same inputs is a target that can never be a cache hit. - **`TEMPLATE_FORMAT_VERSION` in the def hash**, so a minijinja upgrade that changes rendering invalidates rather than silently diverging. `vars` is hashed from a `BTreeMap` because it arrives as a `HashMap`, and hashing it in iteration order would move the def hash on every run. The rule and the applet land together because they are one feature: a shared renderer used two ways. Splitting them would put a crate in trunk with one caller and review the same rendering semantics twice. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0181d7hhbYWXT42Z1KQPM29Q
raphaelvigee
force-pushed
the
raphaelvigee/coreutils-template-driver
branch
from
September 3, 2026 17:30
cceac42 to
31f29a2
Compare
raphaelvigee
changed the base branch from
raphaelvigee/core-utils-templating-engine
to
raphaelvigee/coreutils-rest-of-toolbox
September 3, 2026 17:32
This was referenced Sep 3, 2026
This was referenced Sep 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Filling in a config file should not require a shell.
template(name, src, out, vars)renders a declared template with declared variables, in-process — inputs and outputs fully declared, nosedpipeline, no quoting rules to get wrong.One feature, two surfaces
The renderer lives in
crates/templateso the rule and thetmplapplet are the same code rather than two implementations of one syntax:template()— the rule, and the one to reach for. Its inputs are in the cache key.tmpl— the applet, for the mid-recipe case, and it coversenvsubst.They land together because splitting them would put a crate in trunk with one caller and review the same rendering semantics twice.
Two constraints the renderer carries deliberately
now(), no randomness — a template that can render differently from identical inputs is a target that can never be a cache hit.TEMPLATE_FORMAT_VERSIONin the def hash, so a minijinja upgrade that changes rendering invalidates rather than silently diverging.varsis hashed from aBTreeMapbecause it arrives as aHashMap, and hashing it in iteration order would move the def hash on every run.The stack
Merge bottom-up, and
gh stack syncafter each one lands —masteris squash-only, so the rebase will conflict and the resolution rule in CLAUDE.md applies.PATH— breakingtemplaterule and thetmplappletPATHseam ← base, targetsmasterOnly #451 builds automatically: since #449 a stacked PR is skipped unless it carries
ci/force-ci. Every layer was checked locally on its own —cargo build --workspace --all-targets,cargo clippy --workspace --all-targets, and its unit tests — not just at the top of the stack.🤖 Generated with Claude Code
https://claude.ai/code/session_0181d7hhbYWXT42Z1KQPM29Q