Documentation
¶
Overview ¶
Package opts resolves +/- selector expressions used by the CLI to filter detectors, auditors, matchers, and ecosystems. The resolver is generic: callers build a catalog of available items (with optional aliases) and pass a default set plus a raw expression — the resolver returns the include and exclude lists.
Index ¶
- Constants
- Variables
- func BindCommandFlagGroups(cmd *cobra.Command, cfg *config.Resolved, groups ...FlagGroup) error
- func BindJSONFormatFlag(flags *pflag.FlagSet, format *string, usage string)
- func PlanSubprojects(registryValue *engine.Registry, req Request) ([]sdk.Subproject, error)
- func RegistryConfigsFromResolved(cfg config.Resolved) engine.RegistryConfigs
- func ResolveAnalyzerFilter(raw string, reg *engine.Registry) (sdk.AnalyzerFilter, error)
- func ResolveAuditorFilter(raw string, reg *engine.Registry) (sdk.AuditorFilter, error)
- func ResolveMatcherFilter(raw string, reg *engine.Registry) (sdk.MatcherFilter, error)
- func ToContext(ctx context.Context, options *Options) context.Context
- type FlagGroup
- type Options
- func (o *Options) AnalyzerFilter() sdk.AnalyzerFilter
- func (o *Options) AuditorFilter() sdk.AuditorFilter
- func (o *Options) Bind(root *cobra.Command) error
- func (o *Options) Close() error
- func (o *Options) DetectorFilter() sdk.DetectorFilter
- func (o *Options) ExecutionTarget() sdk.ExecutionTarget
- func (o *Options) GetConfig() config.Resolved
- func (o *Options) MatcherFilter() sdk.MatcherFilter
- func (o *Options) OutputFormat() (output.Format, error)
- func (o *Options) PipelineRequest(scope sdk.Scope, stderr io.Writer) engine.PipelineRequest
- func (o *Options) PluginLaunchContext(ctx context.Context) context.Context
- func (o *Options) Prepare(ctx context.Context, logger *zap.Logger) (Options, error)
- func (o *Options) PrepareForExecutionTarget(ctx context.Context, logger *zap.Logger, executionTarget sdk.ExecutionTarget, ...) (Options, error)
- func (o *Options) ProjectDescriptor() output.ProjectDescriptor
- func (o *Options) ProjectDescriptorForSubproject(subproject sdk.Subproject) output.ProjectDescriptor
- func (o *Options) Registry() *engine.Registry
- func (o *Options) ResolveConfig(cmd *cobra.Command) error
- func (o *Options) ResolveExecutionTarget(logger *zap.Logger) (sdk.ExecutionTarget, func() error, error)
- func (o *Options) ResolveProjectPath() (string, error)
- func (o *Options) SetConfig(cfg config.Resolved)
- func (o *Options) Subprojects() []sdk.Subproject
- func (o *Options) Verbose() bool
- func (o *Options) Writer(stdout io.Writer) (io.Writer, func() error, error)
- type Request
Constants ¶
const (
VulnerabilityAuditorName = "vulnerability"
)
Variables ¶
var ErrNoSubprojects = errors.New("no subprojects discovered for execution target with the applied filters")
ErrNoSubprojects indicates that no compatible subprojects were discovered for the runtime.
Functions ¶
func BindCommandFlagGroups ¶
func BindJSONFormatFlag ¶
BindJSONFormatFlag binds --json as a no-argument shortcut for setting format to json.
func PlanSubprojects ¶
PlanSubprojects discovers subprojects for an execution target with the provided registry and filters.
func RegistryConfigsFromResolved ¶
func RegistryConfigsFromResolved(cfg config.Resolved) engine.RegistryConfigs
RegistryConfigsFromResolved converts resolved CLI configuration into scan registry wiring. Validation of FailOn values happens earlier in the CLI pipeline; here we drop parse errors and keep only the valid constraints so secondary callers (tests, plugin adapters) stay functional.
func ResolveAnalyzerFilter ¶
ResolveAnalyzerFilter parses --analyzers and returns an AnalyzerFilter. Empty input yields an empty filter so the registry's default-enabled set applies.
func ResolveAuditorFilter ¶
func ResolveMatcherFilter ¶
Types ¶
type Options ¶
type Options struct {
ResolvedConfig config.Resolved
Format output.Format
// contains filtered or unexported fields
}
Options encapsulates the context for executing a CLI command, including configuration, registry, execution target, filters, output format, and cleanup logic.
func FromContext ¶
FromContext returns the Bomly command context stored on ctx.
func NewOptions ¶
func NewOptions() *Options
func (*Options) AnalyzerFilter ¶
func (o *Options) AnalyzerFilter() sdk.AnalyzerFilter
AnalyzerFilter returns the analyzer filter prepared for command execution.
func (*Options) AuditorFilter ¶
func (o *Options) AuditorFilter() sdk.AuditorFilter
AuditorFilter returns the auditor filter prepared for command execution.
func (*Options) DetectorFilter ¶
func (o *Options) DetectorFilter() sdk.DetectorFilter
DetectorFilter returns the detector filter prepared for command execution.
func (*Options) ExecutionTarget ¶
func (o *Options) ExecutionTarget() sdk.ExecutionTarget
ExecutionTarget returns the target prepared for command execution.
func (*Options) MatcherFilter ¶
func (o *Options) MatcherFilter() sdk.MatcherFilter
MatcherFilter returns the matcher filter prepared for command execution.
func (*Options) PipelineRequest ¶
PipelineRequest builds the scan pipeline request for this prepared command context.
func (*Options) PluginLaunchContext ¶
func (*Options) PrepareForExecutionTarget ¶
func (*Options) ProjectDescriptor ¶
func (o *Options) ProjectDescriptor() output.ProjectDescriptor
ProjectDescriptor returns a descriptor for the main project being analyzed, summarizing its name, path, ecosystem, and package manager.
func (*Options) ProjectDescriptorForSubproject ¶
func (o *Options) ProjectDescriptorForSubproject(subproject sdk.Subproject) output.ProjectDescriptor
ProjectDescriptorForSubproject returns a descriptor for a given subproject, summarizing its name, path, ecosystem, and package manager. If the subproject's relative path is ".", it uses the main execution target's name instead.
func (*Options) Registry ¶
Registry returns the filtered scan registry prepared for command execution.
func (*Options) ResolveExecutionTarget ¶
func (o *Options) ResolveExecutionTarget(logger *zap.Logger) (sdk.ExecutionTarget, func() error, error)
ResolveExecutionTarget resolves where the scan should run: it clones a remote repository, materializes an SBOM file, or resolves a local path. The returned cleanup must be deferred by the caller. CLI commands call this directly when they want to surface a dedicated "Cloning repository" (or similar) progress step around just this phase, before calling PrepareForExecutionTarget for the subproject-indexing phase.
func (*Options) ResolveProjectPath ¶
func (*Options) Subprojects ¶
func (o *Options) Subprojects() []sdk.Subproject
Subprojects returns the subprojects prepared for command execution.
type Request ¶
type Request struct {
Registry *engine.Registry
ExecutionTarget sdk.ExecutionTarget
ForcedPackageManager sdk.PackageManager
DetectorFilter sdk.DetectorFilter
EcosystemFilter sdk.EcosystemFilter
}
Request defines the inputs required to build one execution runtime.