Library Tools
This document defines the developer contract for tool configuration in config.
Goals
- Keep the schema simple and explicit.
- Run every tool in Docker.
- Require tools to write one or more JSON outputs into
/outputs/. - Support built-in defaults and local user overrides for tool inputs.
Config Shape
Tool configuration is flattened under config:
config.policyconfig.conflictsconfig.toolsconfig.cli
Config Fields
config.policy
Policy profile:
defaultstrictexpert
config.conflicts
Conflict handling behavior:
warnstrict
config.tools
List of tool definitions. Each tool entry has:
id: unique tool id.parser: built-in parser name.image: Docker image used for execution.command: tokenized argv command.env: environment variables for the tool container.inputs: named input mapping (ToolInputs).socket: whether/var/run/docker.sockis mounted.outputs: fixed literal/outputs/.
config.cli
Dictionary mapping CLI command names to tool ids.
Example:
scan: default-scannerlint: default-linter
Validation rules:
- every tool id in
config.toolsmust be unique. - every
config.clitarget must reference an existing tool id.
ToolInputs
Each tools[].inputs.<key> entry contains:
source: either:defaultfor packaged built-in config- a local file path
destination: absolute path inside the container where input is mounted
Runtime Contract
- Every tool runs in Docker.
- Container outputs path is fixed:
/outputs/. - Host run workspace is deterministic:
./outputs/{tool-id}/{DATETIME}/- Host run workspace is always mounted into container as
/outputs. - All tool outputs are written to
/outputs/*inside the container. inputsare resolved and mounted atdestination.
Variables and Source of Truth
| Variable | Example | Source |
|---|---|---|
tool.id |
default-scanner |
config.tools[] |
tool.image |
docker.io/aquasec/trivy:latest |
config.tools[] |
tool.command |
["trivy", "image", ...] |
config.tools[] |
tool.inputs.<key>.source |
default or ./ci/trivy.yaml |
config.tools[] |
tool.inputs.<key>.destination |
/config/trivy.yaml |
config.tools[] |
tool.socket |
true |
config.tools[] |
tool.outputs |
/outputs/ |
config.tools[] (fixed literal) |
image.reference |
docker.io/library/alpine:3.19 |
CLI runtime |
DATETIME |
20260217T213015Z |
CLI runtime clock |
Supported Command Tokens
The schema validates these tokens in tool.command:
{{inputs.<key>}}{{image.reference}}
Examples:
{{inputs.trivy}}-> value frominputs.trivy.destination{{image.reference}}-> runtime image reference value
Complete Lifecycle
- CLI command (for example
scan) is resolved throughconfig.clito a tool id. - CLI loads the matching tool from
config.tools. - CLI computes run directory:
./outputs/{tool-id}/{DATETIME}/- CLI creates that run directory.
- CLI resolves each input source:
default-> packaged config in the library- file path -> local override
- CLI mounts each resolved input to its
destination(read-only). - CLI mounts host run directory to container
/outputs(read-write). - CLI mounts Docker socket if
socket=true. - CLI renders command tokens and runs the tool container.
- Tool writes one or more JSON files into
/outputs/. - JSON artifacts are available on host under
./outputs/{tool-id}/{DATETIME}/. - Parser selected by
tool.parserconsumes outputs for result reporting.
Minimal Example
config:
policy: default
conflicts: warn
tools:
- id: default-scanner
parser: trivy
image: docker.io/aquasec/trivy:latest
command:
- trivy
- image
- --config
- "{{inputs.trivy}}"
- --format
- json
- --output
- /outputs/scan.json
- "{{image.reference}}"
inputs:
trivy:
source: default
destination: /config/trivy.yaml
socket: true
outputs: /outputs/
cli:
scan: default-scanner
Advanced Example
config:
policy: strict
conflicts: strict
tools:
- id: srcnet-scanner
parser: trivy
image: docker.io/aquasec/trivy:latest
env:
TRIVY_CACHE_DIR: /tmp/trivy-cache
command:
- trivy
- image
- --config
- "{{inputs.trivy}}"
- --format
- json
- --output
- /outputs/scan.json
- "{{image.reference}}"
inputs:
trivy:
source: ./ci/trivy-srcnet.yaml
destination: /config/trivy.yaml
policy:
source: ./ci/policy.yaml
destination: /config/policy.yaml
socket: true
outputs: /outputs/
cli:
scan: srcnet-scanner