Share a script and use a template¶
Goal: make a script from a template with your own values, and share a script on the context so everyone who uses it (in the TUI and the web app) has it.
Prerequisites
- An active context (Switch context).
- The Scripts pane open (Infra › Scripts, or
ctrl+p→Go to Infra › Scripts), as in Write and run a script.
Steps¶
-
Look at the sections. Library is read-only. Shared lists the scripts shared on this context: locked ones only admins change (in the web app), template ones are offered for
u, app only ones are TypeScript and run in the web app. Scripts an admin hid are not listed in the TUI. -
Use a template: highlight a library script (or a shared template), e.g. Deploy an indicator set, and press
u. Its form shows with the button Create script. Enter the values you want this script to keep (pairs, scenario, ...) and press it. -
The new script opens unsaved under Mine, its form filled in with your values. You can still change a value before a run, except one the template fixes (
x-fixed): that one is read-only. -
Share it: press
S, give a name (a letter, then letters, digits or_) and Enter. On a protected context the TUI asks once (share script NAME?). The script is listed under Shared and the write shows on Infra › Changes. -
Or keep it to yourself:
sasks for a name and saves it to Mine (~/.config/virtufin/tui/examples/<name>.py, with its form and bound values next to it).
Copy instead: c opens an unsaved copy of any script (same code and form), to change
and save with s or share with S. The original stays as it is.
What you should see¶
- After
S: Shared as NAME on this context. in the output, the script under Shared, and on Infra › Changes a line share script NAME with outcomedone. - A locked shared script: the editor is read-only and the status line says locked: only admins can change it, in the web app.
Troubleshooting¶
| Symptom | Cause and fix |
|---|---|
NAME is locked: only admins change it, in the web app |
The shared script of that name is locked. Share under another name, or ask an admin. |
NAME is taken by a script only admins see: pick another name |
An admin's hidden script has that name. Pick another. |
Shared has NAME already: pick another name |
Sharing a copy over an existing shared script is refused; give a new name, or open that script and save it with s. |
Not a template: library scripts and shared templates are on u |
Only library scripts and shared scripts an admin marked template can be used as templates; c copies any script. |
... is typescript: it runs in the web app on r |
A TypeScript shared script; run it in the web app. |
share script NAME: declined on Changes |
You said no on the protected context; nothing was written. |
Hidden is not secret: an admin can hide a shared script from the clients' users, but
until access-control restricts API keys, anyone with an API key for the context can still
read it from the gateway. Keep credentials in your secrets (await vf.secret(name)),
never in a script. Reference: Scripts › Library, Shared, Mine,
Scripts › Templates.