Documentation
¶
Index ¶
- func Apply(val any, vars map[string]string) any
- func Grab(jsonText, path string) (string, error)
- func PyReprToJSON(s string) string
- func StringMap(m map[string]string, vars map[string]string) map[string]string
- func Strings(ss []string, vars map[string]string) []string
- func Unresolved(val any) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply recursively replaces {{key}} in all string values of val using vars. {{env.NAME}} is resolved directly from the calling process environment. Non-string leaves (int, bool, float64) pass through unchanged.
func Grab ¶
Grab extracts a value from JSON text using a gjson path.
The leading dot convention from Ocarina's original syntax is preserved: ".0.sha" and "0.sha" both work. The full gjson path syntax is supported:
".name" — object key ".0" — array index ".items.0.title" — nested path "#[state==\"open\"].title" — filter: first match "#[state==\"open\"]#.title" — filter: all matches "#.name" — wildcard: all name values
func PyReprToJSON ¶
PyReprToJSON converts Python dict/list repr to JSON. Some MCP servers (e.g. mcp-server-sqlite) return str() of Python objects rather than JSON. Only handles the common case where string values contain no embedded single quotes. Returns "" if s doesn't look like a Python list/dict.
func Unresolved ¶
Unresolved returns the distinct {{var}} references still present in val after Apply, i.e. references that no key or prior echo: defined. Callers use it to fail a step rather than silently send literal braces to a tool.
Types ¶
This section is empty.