Documentation
¶
Overview ¶
Package hcl provides an HCL → YAML converter for docker-agent configuration files. The HCL surface mirrors the YAML schema with a few conventions:
- Top-level keyed maps (agents, models, providers, mcps, rag) are written as labeled blocks, e.g. `agent "root" { ... }` becomes `agents: { root: { ... } }`.
- Inside an agent, `command "name" { ... }` becomes `commands: { name: { ... } }`.
- Toolsets use the label as the `type` field: `toolset "mcp" { ... }` becomes `toolsets: [{ type: mcp, ... }]`.
- Multi-line strings should use heredocs. Because HCL templates expand `${...}` interpolation, any literal `${...}` (such as `${shell({cmd: "..."})}`) must be escaped as `$${...}`.
- The custom `file("path")` function reads a UTF-8 text file and returns its contents as a string. Relative paths are resolved from the HCL config file's directory.
The converter does not validate the resulting document against the configuration schema; that is left to the existing YAML/JSON loader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelKeyedMapOutKeys ¶
LabelKeyedMapOutKeys returns the set of YAML keys produced by HCL block rules that map a labeled block into a label-keyed map (e.g. agent "x" {} becomes agents.x). It is exported so tests can verify the HCL conventions stay in sync with top-level keyed maps in the JSON schema.
func LooksLikeHCL ¶
LooksLikeHCL reports whether the given bytes look like an HCL document rather than a YAML one. The detection is heuristic and is intended for callers that do not have a filename hint to rely on (for example, OCI artifacts). It looks for top-level labeled blocks of the docker-agent HCL schema, e.g. `agent "..." {`, which are not valid YAML.
Types ¶
This section is empty.