Documentation
¶
Overview ¶
Package collector implements the CommandCollectorPlugin: a read-only transform plugin that walks the parsed AST and reports the command name of every leaf SimpleCommand it encounters.
The plugin does NOT mutate the AST. Its metadata payload is a `[]string` of command names, in source order, stored under the plugin's Name() ("command-collector") in the pipeline metadata bag and surfaced from Bash.Exec via BashExecResult.Metadata.
Index ¶
Constants ¶
const MetadataKey = "commands"
MetadataKey is the JSON-style key for the collected list within the plugin's metadata payload. The full plugin payload is exposed under
transform.BashTransformResult.Metadata[Name] = map[string]any{
MetadataKey: []string{...},
}.
const Name = "command-collector"
Name is the metadata key the plugin uses.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct{}
Plugin is the CommandCollectorPlugin instance. Stateless; safe to share across pipelines.
func (*Plugin) Transform ¶
Transform walks the script's Origin syntax tree and collects the first-argument literal of every CallExpr (which corresponds to a SimpleCommand in our typed AST). Compound commands (if / while / subshell / etc.) are recursed into transparently by mvdan/sh's syntax.Walk; their bodies' SimpleCommands are collected too.