toolcli

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

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

View Source
const (
	KindExecSARIF = "exec-sarif"
	KindExecCTIS  = "exec-ctis"
	KindExecJSON  = "exec-json"
	KindGo        = "go"
	KindPython    = "python"
)

Kinds of scaffold.

View Source
const (
	ExitOK    = 0
	ExitFail  = 1
	ExitUsage = 2
)

Exit codes.

View Source
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.

View Source
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 GitLabCI

func GitLabCI() string

GitLabCI is the GitLab CI template.

func InstallSandbox

func InstallSandbox(mode string, w io.Writer) error

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 Main

func Main(args []string, stdout, stderr io.Writer) int

Main runs "openctem tool <args>".

func PythonHelper

func PythonHelper() string

PythonHelper is openctem_tool.py.

func Scaffold

func Scaffold(kind, capRef, name string) (map[string]scaffoldFile, tool.Manifest, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL