Documentation
¶
Index ¶
- func CheckCredentialURIs(w io.Writer, sources []string, allowCredentials bool) error
- func ConfigHeader(complypackVersion, date string) string
- func MarshalConfigYAML(cfg *ComplyPackConfig, complypackVersion, date string) ([]byte, error)
- func WriteConfigFile(path string, data []byte, force, createParents bool) error
- type ComplyPackConfig
- type DirConfig
- type GemaraConfig
- type GemaraSourceEntry
- type SchemaRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCredentialURIs ¶ added in v0.0.8
CheckCredentialURIs inspects source URIs for embedded credentials (userinfo component per RFC 3986 §3.2.1). When allowCredentials is false, the first URI containing credentials causes an error. When true, a warning is written to w instead.
func ConfigHeader ¶ added in v0.0.8
ConfigHeader builds the comment block prepended to generated complypack.yaml files. It includes the complypack version and the date the file was generated.
func MarshalConfigYAML ¶ added in v0.0.8
func MarshalConfigYAML(cfg *ComplyPackConfig, complypackVersion, date string) ([]byte, error)
MarshalConfigYAML serializes a ComplyPackConfig to YAML with a header comment and 2-space indentation matching the project convention. complypackVersion is the tool version (e.g. "1.0.0" or "(devel)") and date is the generation date in YYYY-MM-DD format.
func WriteConfigFile ¶ added in v0.0.8
WriteConfigFile writes data to path with safety checks for existing files and symlinks. When force is false, it refuses to overwrite existing files or follow symlinks. When createParents is true, missing parent directories are created automatically.
Types ¶
type ComplyPackConfig ¶
type ComplyPackConfig struct {
ID string `yaml:"id,omitempty"`
EvaluatorID string `yaml:"evaluator-id,omitempty"`
Version string `yaml:"version,omitempty"`
Gemara GemaraConfig `yaml:"gemara,omitempty"`
Schemas []SchemaRef `yaml:"schemas,omitempty"`
Policies *DirConfig `yaml:"policies,omitempty"`
Tests *DirConfig `yaml:"tests,omitempty"`
Fixtures *DirConfig `yaml:"fixtures,omitempty"`
Output *DirConfig `yaml:"output,omitempty"`
}
ComplyPackConfig represents the structure of complypack.yaml. Aligned with CEP-0001 and complypack-pipeline specification.
func BuildConfig ¶ added in v0.0.8
func BuildConfig(id, evaluatorID, version string, sources []GemaraSourceEntry, schemas []SchemaRef) *ComplyPackConfig
BuildConfig assembles a ComplyPackConfig from parsed component values. This is the single assembly point for both init and mcp serve commands.
func LoadConfig ¶
LoadConfig reads and parses a complypack.yaml file. Validation warnings are written to w. Pass os.Stderr for default behavior.
func (*ComplyPackConfig) Validate ¶
func (c *ComplyPackConfig) Validate() error
Validate checks that required fields are present and well-formed. Version is always required. Format is enforced on all present fields.
func (*ComplyPackConfig) ValidateForInit ¶ added in v0.0.8
func (c *ComplyPackConfig) ValidateForInit() error
ValidateForInit checks fields required to produce a usable config file. This is the union of ValidateForPack and ValidateForMCP: the generated config must be immediately usable by both pack and mcp serve.
func (*ComplyPackConfig) ValidateForMCP ¶
func (c *ComplyPackConfig) ValidateForMCP() error
ValidateForMCP checks fields required for MCP server operation. id, evaluator-id, and version are optional for MCP (can be provided via CLI flags), but format is enforced when present.
func (*ComplyPackConfig) ValidateForPack ¶
func (c *ComplyPackConfig) ValidateForPack() error
ValidateForPack checks fields required for pack operation.
type GemaraConfig ¶
type GemaraConfig struct {
Sources []GemaraSourceEntry
}
GemaraConfig represents Gemara catalog source configuration. Supports both legacy single-source format and multi-source format:
# Legacy (still supported):
gemara:
source: catalogs/controls.yaml
# Multi-source:
gemara:
sources:
- source: catalogs/controls.yaml
- source: ghcr.io/org/guidance:v1
plain-http: true
func (*GemaraConfig) UnmarshalYAML ¶
func (g *GemaraConfig) UnmarshalYAML(value *yaml.Node) error
type GemaraSourceEntry ¶
type GemaraSourceEntry struct {
Source string `yaml:"source"`
PlainHTTP bool `yaml:"plain-http,omitempty"`
}
GemaraSourceEntry represents a single Gemara artifact source.
type SchemaRef ¶
type SchemaRef struct {
// Platform identifies the target platform (e.g., "kubernetes-deployment", "ci-github-actions")
Platform string `yaml:"platform"`
// Source is a URI specifying where to load the schema from.
// Supported schemes:
// - cue://module.path -> CUE registry module
// - https://example.com/s.json -> HTTP(S) download
// - file://./path/to/file -> Local file
// If empty, falls back to index defaults.
Source string `yaml:"source,omitempty"`
// Path is deprecated - use Source with file:// scheme instead.
// Kept for backward compatibility.
Path string `yaml:"path,omitempty"`
}
SchemaRef represents a platform schema with its source and platform identifier.