patch

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine handles patch generation using templates

func NewEngine

func NewEngine(cfg *config.Config) *Engine

NewEngine creates a new patch engine

func (*Engine) CreateCustomTemplate

func (e *Engine) CreateCustomTemplate(name, content string) error

CreateCustomTemplate creates a custom template

func (*Engine) ExportTemplate

func (e *Engine) ExportTemplate(templateName, outputPath string) error

ExportTemplate exports a template to a file

func (*Engine) GeneratePatch

func (e *Engine) GeneratePatch(request PatchRequest) PatchResult

GeneratePatch generates a patch for the given finding

func (*Engine) GeneratePullRequest

func (e *Engine) GeneratePullRequest(findings []types.Finding, repoPath string) error

GeneratePullRequest generates a pull request with patches for multiple findings

func (*Engine) GetAvailableTemplates

func (e *Engine) GetAvailableTemplates() []string

GetAvailableTemplates returns a list of available templates

func (*Engine) GetTemplateInfo

func (e *Engine) GetTemplateInfo(templateName string) (map[string]interface{}, error)

GetTemplateInfo returns information about a template

func (*Engine) LoadTemplates

func (e *Engine) LoadTemplates() error

LoadTemplates loads patch templates from the templates directory

func (*Engine) ValidateTemplate

func (e *Engine) ValidateTemplate(templateName string) error

ValidateTemplate validates a template

type PatchRequest

type PatchRequest struct {
	Finding    types.Finding          `json:"finding"`
	TargetFile string                 `json:"target_file"`
	Language   string                 `json:"language"`
	PatchType  string                 `json:"patch_type"`
	Variables  map[string]interface{} `json:"variables"`
}

PatchRequest represents a request to generate a patch

type PatchResult

type PatchResult struct {
	Success     bool   `json:"success"`
	PatchData   string `json:"patch_data"`
	Description string `json:"description"`
	Error       string `json:"error,omitempty"`
}

PatchResult represents the result of patch generation

type PatchTemplate

type PatchTemplate struct {
	Name        string            `json:"name"`
	Language    string            `json:"language"`
	CryptoType  string            `json:"crypto_type"`
	Algorithm   string            `json:"algorithm"`
	Template    string            `json:"template"`
	Variables   map[string]string `json:"variables"`
	Description string            `json:"description"`
}

PatchTemplate represents a patch template

Jump to

Keyboard shortcuts

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