Documentation
¶
Index ¶
- func GetSupportedExtensions() []string
- type ContextLine
- type EnhancedError
- type ErrorContext
- type ErrorReporter
- func (r *ErrorReporter) AddError(err *EnhancedError)
- func (r *ErrorReporter) AddSimpleError(message string, pos ast.Position, category string)
- func (r *ErrorReporter) GetErrors() []*EnhancedError
- func (r *ErrorReporter) GetWarnings() []*EnhancedError
- func (r *ErrorReporter) HasErrors() bool
- func (r *ErrorReporter) HasWarnings() bool
- func (r *ErrorReporter) ToError() error
- type ErrorSeverity
- type ErrorSuggestion
- type HighlightInfo
- type MultiErrorEnhanced
- type Parser
- type ParserOption
- type SemanticValidator
- type SuggestedFix
- type YAMLParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSupportedExtensions ¶
func GetSupportedExtensions() []string
GetSupportedExtensions returns the list of supported file extensions
Types ¶
type ContextLine ¶
type ContextLine struct {
Number int `json:"number"`
Content string `json:"content"`
IsError bool `json:"is_error"`
}
ContextLine represents a line of source code with context
type EnhancedError ¶
type EnhancedError struct {
ID string `json:"id"`
Severity ErrorSeverity `json:"severity"`
Title string `json:"title"`
Message string `json:"message"`
Position ast.Position `json:"position"`
Context *ErrorContext `json:"context,omitempty"`
Suggestion *ErrorSuggestion `json:"suggestion,omitempty"`
RelatedErrors []string `json:"related_errors,omitempty"`
Category string `json:"category"`
}
EnhancedError represents a detailed error with rich context
func (*EnhancedError) Error ¶
func (e *EnhancedError) Error() string
Error implements the error interface
type ErrorContext ¶
type ErrorContext struct {
Lines []ContextLine `json:"lines"`
Highlight HighlightInfo `json:"highlight"`
SourceFile string `json:"source_file,omitempty"`
}
ErrorContext provides source code context around the error
type ErrorReporter ¶
type ErrorReporter struct {
// contains filtered or unexported fields
}
ErrorReporter collects and formats multiple errors
func NewErrorReporter ¶
func NewErrorReporter(source []byte, filename string) *ErrorReporter
NewErrorReporter creates a new error reporter
func (*ErrorReporter) AddError ¶
func (r *ErrorReporter) AddError(err *EnhancedError)
AddError adds an error to the reporter
func (*ErrorReporter) AddSimpleError ¶
func (r *ErrorReporter) AddSimpleError(message string, pos ast.Position, category string)
AddSimpleError adds a simple error with automatic enhancement
func (*ErrorReporter) GetErrors ¶
func (r *ErrorReporter) GetErrors() []*EnhancedError
GetErrors returns all errors
func (*ErrorReporter) GetWarnings ¶
func (r *ErrorReporter) GetWarnings() []*EnhancedError
GetWarnings returns all warnings
func (*ErrorReporter) HasErrors ¶
func (r *ErrorReporter) HasErrors() bool
HasErrors returns true if there are any errors
func (*ErrorReporter) HasWarnings ¶
func (r *ErrorReporter) HasWarnings() bool
HasWarnings returns true if there are any warnings
func (*ErrorReporter) ToError ¶
func (r *ErrorReporter) ToError() error
ToError converts the reporter to a standard error if there are errors
type ErrorSeverity ¶
type ErrorSeverity string
ErrorSeverity represents the severity level of an error
const ( SeverityError ErrorSeverity = "error" SeverityWarning ErrorSeverity = "warning" SeverityInfo ErrorSeverity = "info" DocsURL = "https://lacquer.ai/docs" )
type ErrorSuggestion ¶
type ErrorSuggestion struct {
Title string `json:"title"`
Description string `json:"description"`
Fixes []SuggestedFix `json:"fixes,omitempty"`
Examples []string `json:"examples,omitempty"`
DocsURL string `json:"docs_url,omitempty"`
}
ErrorSuggestion provides actionable advice for fixing the error
type HighlightInfo ¶
type HighlightInfo struct {
StartColumn int `json:"start_column"`
EndColumn int `json:"end_column"`
Length int `json:"length"`
}
HighlightInfo specifies how to highlight the error in the source
type MultiErrorEnhanced ¶
type MultiErrorEnhanced struct {
Errors []*EnhancedError `json:"errors"`
Warnings []*EnhancedError `json:"warnings"`
Filename string `json:"filename,omitempty"`
}
MultiErrorEnhanced represents multiple enhanced errors
func (*MultiErrorEnhanced) Error ¶
func (e *MultiErrorEnhanced) Error() string
Error implements the error interface
func (*MultiErrorEnhanced) GetAllIssues ¶
func (e *MultiErrorEnhanced) GetAllIssues() []*EnhancedError
GetAllIssues returns both errors and warnings
type Parser ¶
type Parser interface {
ParseFile(filename string) (*ast.Workflow, error)
ParseBytes(data []byte, filename string) (*ast.Workflow, error)
}
Parser interface defines the contract for workflow parsing
type ParserOption ¶
type ParserOption func(*YAMLParser)
ParserOption configures the YAML parser
func WithSemanticValidator ¶
func WithSemanticValidator(validator *SemanticValidator) ParserOption
WithSemanticValidator sets a custom semantic validator
type SemanticValidator ¶
type SemanticValidator struct {
}
SemanticValidator provides comprehensive semantic validation for workflows
func NewSemanticValidator ¶
func NewSemanticValidator() *SemanticValidator
NewSemanticValidator creates a new semantic validator
func (*SemanticValidator) ValidateWorkflow ¶
func (sv *SemanticValidator) ValidateWorkflow(w *ast.Workflow) *ast.ValidationResult
ValidateWorkflow performs comprehensive semantic validation
type SuggestedFix ¶
type SuggestedFix struct {
Description string `json:"description"`
OldText string `json:"old_text,omitempty"`
NewText string `json:"new_text"`
Position *ast.Position `json:"position,omitempty"`
}
SuggestedFix represents a specific fix that could be applied
type YAMLParser ¶
type YAMLParser struct {
// contains filtered or unexported fields
}
YAMLParser implements the Parser interface using go-yaml/v3
func NewYAMLParser ¶
func NewYAMLParser(opts ...ParserOption) (*YAMLParser, error)
NewYAMLParser creates a new YAML parser with the given options
func (*YAMLParser) ParseBytes ¶
ParseBytes parses workflow data from bytes
func (*YAMLParser) ParseFile ¶
func (p *YAMLParser) ParseFile(filename string) (*ast.Workflow, error)
ParseFile parses a workflow file
func (*YAMLParser) ParseWorkflowNode ¶
ParseWorkflowNode parses a workflow from a YAML node (for advanced use cases)