Documentation
¶
Overview ¶
Package planning provides code scaffolding from validated plans.
Package planning provides plan validation and code scaffolding for proactive architecture.
Index ¶
- Constants
- func GenerateFuncStub(fn schema.FuncPlan, opts *ScaffoldOptions) (string, int)
- func GenerateModuleFile(mod schema.ModulePlan, types []schema.TypePlan, funcs []schema.FuncPlan, ...) (string, int)
- func GenerateTypeDecl(typ schema.TypePlan, opts *ScaffoldOptions) (string, int)
- func PrintScaffoldSummary(result *ScaffoldResult)
- func ValidatePlanForScaffolding(plan *schema.Plan) error
- type ScaffoldOptions
- type ScaffoldResult
- type ValidationIssue
- func CheckDependencyCycles(modules []schema.ModulePlan) []ValidationIssue
- func CheckEffects(effects []string, funcs []schema.FuncPlan) []ValidationIssue
- func CheckFunctionSignatures(funcs []schema.FuncPlan, modules []schema.ModulePlan) []ValidationIssue
- func CheckModulePaths(modules []schema.ModulePlan) []ValidationIssue
- func CheckTypeDefinitions(types []schema.TypePlan, modules []schema.ModulePlan) []ValidationIssue
- type ValidationLevel
- type ValidationResult
Constants ¶
const ( // Module validation (VAL_M##) VAL_M01 = "VAL_M01" // Invalid module path VAL_M02 = "VAL_M02" // Circular dependency VAL_M03 = "VAL_M03" // Duplicate module path VAL_M04 = "VAL_M04" // Empty exports list // Type validation (VAL_T##) VAL_T01 = "VAL_T01" // Invalid type name VAL_T02 = "VAL_T02" // Unsupported type kind VAL_T03 = "VAL_T03" // Invalid type syntax VAL_T04 = "VAL_T04" // Duplicate type name VAL_T05 = "VAL_T05" // Module not found for type // Function validation (VAL_F##) VAL_F01 = "VAL_F01" // Invalid function name VAL_F02 = "VAL_F02" // Invalid function signature VAL_F03 = "VAL_F03" // Duplicate function name VAL_F04 = "VAL_F04" // Module not found for function VAL_F05 = "VAL_F05" // Function not exported // Effect validation (VAL_E##) VAL_E01 = "VAL_E01" // Unknown effect VAL_E02 = "VAL_E02" // Effect mismatch (function uses effect not in plan) // General validation (VAL_G##) VAL_G01 = "VAL_G01" // Empty plan VAL_G02 = "VAL_G02" // Missing required field )
Validation error codes
Variables ¶
This section is empty.
Functions ¶
func GenerateFuncStub ¶
func GenerateFuncStub(fn schema.FuncPlan, opts *ScaffoldOptions) (string, int)
GenerateFuncStub generates a function stub with signature and TODO body
func GenerateModuleFile ¶
func GenerateModuleFile(mod schema.ModulePlan, types []schema.TypePlan, funcs []schema.FuncPlan, opts *ScaffoldOptions) (string, int)
GenerateModuleFile generates complete AILANG code for a module
func GenerateTypeDecl ¶
func GenerateTypeDecl(typ schema.TypePlan, opts *ScaffoldOptions) (string, int)
GenerateTypeDecl generates an AILANG type declaration
func PrintScaffoldSummary ¶
func PrintScaffoldSummary(result *ScaffoldResult)
PrintScaffoldSummary prints a human-readable summary of scaffolding
func ValidatePlanForScaffolding ¶
ValidatePlanForScaffolding performs additional checks before scaffolding
Types ¶
type ScaffoldOptions ¶
type ScaffoldOptions struct {
OutputDir string
OverwriteFiles bool
IncludeTODOs bool
IncludeComments bool
}
ScaffoldOptions configures the scaffolding behavior
func DefaultScaffoldOptions ¶
func DefaultScaffoldOptions(outputDir string) *ScaffoldOptions
DefaultScaffoldOptions returns sensible defaults
type ScaffoldResult ¶
type ScaffoldResult struct {
OutputDir string `json:"output_dir"`
FilesCreated []string `json:"files_created"`
TotalLines int `json:"total_lines"`
TotalFiles int `json:"total_files"`
Success bool `json:"success"`
ErrorMessage string `json:"error_message,omitempty"`
}
ScaffoldResult contains information about the scaffolding operation
func ScaffoldFromPlan ¶
func ScaffoldFromPlan(plan *schema.Plan, opts *ScaffoldOptions) (*ScaffoldResult, error)
ScaffoldFromPlan generates AILANG module files from a validated plan
type ValidationIssue ¶
type ValidationIssue struct {
Level ValidationLevel `json:"level"`
Code string `json:"code"`
Message string `json:"message"`
Location string `json:"location"` // e.g., "modules[0].path"
}
ValidationIssue represents a single validation error or warning
func CheckDependencyCycles ¶
func CheckDependencyCycles(modules []schema.ModulePlan) []ValidationIssue
CheckDependencyCycles detects circular dependencies between modules
func CheckEffects ¶
func CheckEffects(effects []string, funcs []schema.FuncPlan) []ValidationIssue
CheckEffects validates effect usage across the plan
func CheckFunctionSignatures ¶
func CheckFunctionSignatures(funcs []schema.FuncPlan, modules []schema.ModulePlan) []ValidationIssue
CheckFunctionSignatures validates function signatures
func CheckModulePaths ¶
func CheckModulePaths(modules []schema.ModulePlan) []ValidationIssue
CheckModulePaths validates module path syntax and uniqueness
func CheckTypeDefinitions ¶
func CheckTypeDefinitions(types []schema.TypePlan, modules []schema.ModulePlan) []ValidationIssue
CheckTypeDefinitions validates type definitions
type ValidationLevel ¶
type ValidationLevel string
ValidationLevel represents the severity of a validation issue
const ( ValidationError ValidationLevel = "error" ValidationWarning ValidationLevel = "warning" )
type ValidationResult ¶
type ValidationResult struct {
Schema string `json:"schema"`
Valid bool `json:"valid"`
Errors []ValidationIssue `json:"errors"`
Warnings []ValidationIssue `json:"warnings"`
}
ValidationResult is the result of validating a plan
func ValidatePlan ¶
func ValidatePlan(plan *schema.Plan) (*ValidationResult, error)
ValidatePlan validates a complete plan and returns all errors and warnings
func (*ValidationResult) ToJSON ¶
func (v *ValidationResult) ToJSON() ([]byte, error)
ToJSON converts validation result to JSON