Documentation
¶
Overview ¶
Package toolcli is the "openctem tool" command: scaffold, validate, run, test, diff and describe a tool. cmd/openctem and the older cmd/openctem-conformance call it.
Index ¶
- Constants
- func GitHubCI() string
- func GitLabCI() string
- func InstallSandbox(mode string, w io.Writer) error
- func Main(args []string, stdout, stderr io.Writer) int
- func PythonHelper() string
- func Scaffold(kind, capRef, name string) (map[string]scaffoldFile, tool.Manifest, error)
- func Test(path string, opts conformance.ContractOptions, update bool, stdout io.Writer) int
Constants ¶
const ( KindExecSARIF = "exec-sarif" KindExecCTIS = "exec-ctis" KindExecJSON = "exec-json" KindGo = "go" KindPython = "python" )
Kinds of scaffold.
const ( ExitOK = 0 ExitFail = 1 ExitUsage = 2 )
Exit codes.
const EnvSandbox = "OPENCTEM_SANDBOX"
EnvSandbox sets the sandbox mode of "openctem tool run" and "test" when --sandbox is not given: off, auto (default) or required.
const EnvSandboxNetwork = "OPENCTEM_SANDBOX_NETWORK"
EnvSandboxNetwork sets network confinement of those commands: auto (default), required or off (see executor.Config.ConfineNetwork).
Variables ¶
This section is empty.
Functions ¶
func GitHubCI ¶
func GitHubCI() string
GitHubCI and GitLabCI are the CI templates a scaffold gets (also in the repository's ci/ directory).
func InstallSandbox ¶
InstallSandbox runs every task of this process in the same process sandbox a sensor uses (pkg/sensorkit/executor), so a tool that works here works on a sensor: a private task directory, rlimits, no_new_privs, Landlock and seccomp. mode "" reads OPENCTEM_SANDBOX, then defaults to auto, which enforces what this host supports and notes the rest on w; required refuses to run without every control. The program must call executor.RunLauncherIfRequested first thing in main.
func Scaffold ¶
Scaffold builds the files of a new tool implementing one capability: a tool.yaml pre-filled from the capability (implements, consumes, produces, tier floor, a config key for each standard param), a fixture task and its expected CTIS, a stub program that emits nothing yet, a Makefile and a CI workflow. The stub passes "openctem tool test" as it is.
func Test ¶
func Test(path string, opts conformance.ContractOptions, update bool, stdout io.Writer) int
Test runs the protocol and fixture suite and the contract suite of one tool: the "test" command, and the older "openctem-conformance tool".
Types ¶
This section is empty.