Netsuke registers focused path, collection, command, network, and time helpers alongside MiniJinja's built-ins. The library covers path and collection filters, file tests, clocks and durations, host commands, executable discovery, environment variables, globbing, and policy-controlled network retrieval.
See the template standard-library guide for every helper's signature, defaults, purity, platform caveats, and executable examples. Host-observing helpers belong only in trusted manifests: Netsuke bounds command and network output, but does not sandbox template evaluation.
Network fetch policy
fetch() applies the configured NetworkPolicy to the caller-supplied URL and
to every redirect destination before opening a connection. The default policy
allows only HTTPS; --fetch-allow-scheme, --fetch-allow-host,
--fetch-default-deny, and --fetch-block-host adjust the scheme and host
rules. A redirect from HTTPS to HTTP therefore succeeds only when http is
explicitly allowed and the destination host also passes the policy.
Supported redirects (301, 302, 303, 307, and 308) retain GET
semantics, resolve relative Location values against the current URL, and stop
after five redirects. Repeated destinations, missing or invalid Location
values, and policy-rejected destinations fail with distinct localized
diagnostics. Credentials in the URL are removed when a redirect changes origin,
and redirect diagnostics do not disclose URL userinfo.
When cache=true, the cache entry is identified by the original URL. A cache
miss applies the same policy checks to every redirect before storing the body;
a cache hit performs no network request.
When a Boolean is interpolated into a string field, Netsuke renders it as
lowercase true or false. For example, this writes true to status.txt:
netsuke_version: "1.0.0"
vars:
enabled: true
targets:
- name: status.txt
command: "printf '%s\\n' '{{ enabled }}' > {{ outs }}"
The now(offset=...) helper accepts Z or z for UTC and signed ISO 8601
offsets whose absolute hour component is below 24. Offsets such as +24:00,
-24:00, and larger absolute hour values are rejected as invalid.
One helper deserves a note here because its result depends on the host's
environment. path | expanduser expands a leading ~ against the home
directory, resolved from HOME then USERPROFILE on POSIX hosts, and from
HOME, USERPROFILE, the HOMEDRIVE/HOMEPATH pair, then HOMESHARE on
Windows. The Windows pair counts only when both halves are non-empty; an
incomplete pair falls through to HOMESHARE. Named-user forms such as ~alice
are unsupported, and when no home directory resolves at all, the filter fails
rather than passing the ~ through silently.