Documentation
¶
Overview ¶
Package precommit implements the pre-commit integration using the native autoupdate command. It detects .pre-commit-config.yaml files, runs 'pre-commit autoupdate' to update hook versions, and parses the output to report changes. This follows the manifest-first philosophy by using the native tool that directly updates the configuration file.
Index ¶
- type Config
- type Hook
- type Integration
- func (i *Integration) Apply(ctx context.Context, plan *engine.UpdatePlan) (*engine.ApplyResult, error)
- func (i *Integration) Detect(ctx context.Context, repoRoot string) ([]*engine.Manifest, error)
- func (i *Integration) Name() string
- func (i *Integration) Plan(ctx context.Context, manifest *engine.Manifest, planCtx *engine.PlanContext) (*engine.UpdatePlan, error)
- func (i *Integration) Validate(ctx context.Context, manifest *engine.Manifest) error
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Repos []Repo `yaml:"repos"`
}
Config represents the structure of .pre-commit-config.yaml.
type Integration ¶
type Integration struct{}
Integration implements pre-commit hook updates using native autoupdate command.
func (*Integration) Apply ¶
func (i *Integration) Apply(ctx context.Context, plan *engine.UpdatePlan) (*engine.ApplyResult, error)
Apply executes the update using native pre-commit autoupdate command.
func (*Integration) Name ¶
func (i *Integration) Name() string
Name returns the integration identifier.
func (*Integration) Plan ¶
func (i *Integration) Plan(ctx context.Context, manifest *engine.Manifest, planCtx *engine.PlanContext) (*engine.UpdatePlan, error)
Plan determines available updates for pre-commit hooks. For pre-commit, we use the native autoupdate command in dry-run mode.
Note: The pre-commit native command doesn't support policy-based filtering. The planCtx parameter is accepted for interface compatibility but not currently used. Future versions may implement policy filtering by parsing the autoupdate output.