validation

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright © 2025 KubeRocketAI Team

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSimpleSuccess

func FormatSimpleSuccess(insights *FrameworkInsights, processTime time.Duration) string

FormatSimpleSuccess formats a simple success message

Types

type ComponentCounts

type ComponentCounts struct {
	Agents    int `json:"agents"`
	Tasks     int `json:"tasks"`
	Templates int `json:"templates"`
	Data      int `json:"data"`
}

ComponentCounts tracks the number of each component type

type ComponentRelationship

type ComponentRelationship struct {
	Agent      string   `json:"agent"`
	Tasks      []string `json:"tasks"`
	LocalTasks []string `json:"local_tasks"` // Local tasks from .krci-ai/local/tasks/
	Templates  []string `json:"templates"`
	DataFiles  []string `json:"data_files"`
}

ComponentRelationship represents agent → task → template/data flows

type EmbeddedAssetAnalyzer added in v0.28.0

type EmbeddedAssetAnalyzer interface {
	// AnalyzeEmbeddedDependencies analyzes dependencies from embedded filesystem
	AnalyzeEmbeddedDependencies(ctx context.Context, embeddedAssets fs.FS, agentNames []string) (*FrameworkInsights, error)

	// ValidateEmbeddedAgentDependencies validates dependencies exist in embedded assets
	ValidateEmbeddedAgentDependencies(ctx context.Context, embeddedAssets fs.FS, agentNames []string) ([]ValidationIssue, error)
}

EmbeddedAssetAnalyzer provides dependency analysis for embedded assets before installation

type FrameworkAnalyzer

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

FrameworkAnalyzer provides comprehensive framework validation

func NewFrameworkAnalyzer

func NewFrameworkAnalyzer(baseDir string) *FrameworkAnalyzer

NewFrameworkAnalyzer creates a new framework analyzer

func (*FrameworkAnalyzer) AnalyzeEmbeddedDependencies added in v0.28.0

func (a *FrameworkAnalyzer) AnalyzeEmbeddedDependencies(ctx context.Context, embeddedAssets fs.FS, agentNames []string) (*FrameworkInsights, error)

AnalyzeEmbeddedDependencies implements EmbeddedAssetAnalyzer interface

func (*FrameworkAnalyzer) AnalyzeFramework

func (a *FrameworkAnalyzer) AnalyzeFramework() ([]ValidationIssue, *FrameworkInsights, error)

AnalyzeFramework performs comprehensive framework analysis

func (*FrameworkAnalyzer) OptimizedAnalyzeFramework

func (a *FrameworkAnalyzer) OptimizedAnalyzeFramework() ([]ValidationIssue, *FrameworkInsights, error)

OptimizedAnalyzeFramework uses caching for better performance

func (*FrameworkAnalyzer) ValidateEmbeddedAgentDependencies added in v0.28.0

func (a *FrameworkAnalyzer) ValidateEmbeddedAgentDependencies(ctx context.Context, embeddedAssets fs.FS, agentNames []string) ([]ValidationIssue, error)

ValidateEmbeddedAgentDependencies implements EmbeddedAssetAnalyzer interface Simple validation that ensures all agent dependencies exist in embedded assets

type FrameworkInsights

type FrameworkInsights struct {
	ComponentCounts ComponentCounts         `json:"component_counts"`
	Relationships   []ComponentRelationship `json:"relationships"`
	UsageStatistics UsageStatistics         `json:"usage_statistics"`
	TotalReferences int                     `json:"total_references"`
}

FrameworkInsights provides component statistics and relationship analysis

func (*FrameworkInsights) FormatInsights

func (insights *FrameworkInsights) FormatInsights() string

FormatInsights formats the insights for display

type FrameworkScanner added in v0.26.0

type FrameworkScanner interface {
	OptimizedAnalyzeFramework() ([]ValidationIssue, *FrameworkInsights, error)
}

FrameworkScanner abstracts analyzer behavior for commands

type Severity

type Severity int

Severity levels for validation issues

const (
	SeverityInfo Severity = iota
	SeverityWarning
	SeverityError
	SeverityCritical
)

func (Severity) String

func (s Severity) String() string

type UsageStatistics

type UsageStatistics struct {
	MostUsedTemplate   string `json:"most_used_template"`
	MostUsedData       string `json:"most_used_data"`
	TemplateUsageCount int    `json:"template_usage_count"`
	DataUsageCount     int    `json:"data_usage_count"`
}

UsageStatistics provides insights about component usage patterns

type ValidationIssue

type ValidationIssue struct {
	Type        string
	Severity    Severity
	File        string
	Line        int
	Message     string
	FixGuidance string
}

ValidationIssue represents a single validation issue

type ValidationReport

type ValidationReport struct {
	Issues        []ValidationIssue
	Insights      *FrameworkInsights
	ProcessTime   time.Duration
	IsValid       bool
	HasCritical   bool
	HasWarnings   bool
	CriticalCount int
	WarningCount  int
	InfoCount     int
}

ValidationReport represents the complete validation report

func NewValidationReport

func NewValidationReport(issues []ValidationIssue, insights *FrameworkInsights, processTime time.Duration) *ValidationReport

NewValidationReport creates a new validation report

func (*ValidationReport) FormatReport

func (r *ValidationReport) FormatReport(verbose bool) string

FormatReport formats the validation report for console output

func (*ValidationReport) GetExitCode

func (r *ValidationReport) GetExitCode() int

GetExitCode returns the appropriate exit code

Jump to

Keyboard shortcuts

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