Skip to main content

Module render

Module render 

Source
Expand description

Template rendering for one server and client with secret delivery (SPEC 11.2, 11.4): path variables become paths, and each value holding references is written in the mode Policy::choose picks:

  • env: the client’s own variable syntax (${NAME}, ${env:NAME}), or a forwarded variable name (Codex);
  • launch: the key leaves the entry’s env, and the entry starts surject exec --ref KEY=REF ... -- <command> <args> instead;
  • command: omp and Pi get !<surjection> secret get --ref REF, Claude Code gets one headersHelper running <surjection> secret-header;
  • inline: the resolved value, kept for masking in diffs.

Command templates mark a value with {secret:KEY}, bound by --ref KEY=REF: no $, % or !, so neither a client nor a shell expands it.

Structs§

RenderEnv
What rendering reads: Surjection’s environment (paths, inline env: values), the catalog and this machine’s providers.
Renderer
Renders the values of one server for one client.

Enums§

EnvValue
A stdio env value as written.
HeaderValue
A header value as written.
Spell
One part of a value spelled in a client’s own variable syntax (spell).

Constants§

PLACEHOLDER
The placeholder opening of a bound value in command templates.

Functions§

fill_template
Renders a command template: each {secret:KEY} becomes values[KEY]. Fails on a placeholder with no value or an unterminated one.
parse_binding
KEY=REF as given to surject exec, secret get and secret-header: the key is a variable name, the reference a provider reference.
shell_quote
One argument of a command line run through the client’s shell: single quotes on Unix; double quotes on Windows. Which shell a Windows client uses (cmd.exe, or a POSIX shell such as Git Bash) is not settled (scripts/verify-clients.md DX-6, DX-7), so only text both read the same inside double quotes passes: ", %, $, a backtick, a line break and a trailing backslash are refused.
spell
pieces as client writes them in field (SPEC 11.4 env delivery): each variable in the client’s syntax, literal text escaped where the client has an escape (Pi) and refused where the client would expand part of it. delivery_unavailable when the client does not expand variables in field.