project

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCheckCmd

func NewCheckCmd() *cobra.Command

func NewExecCmd

func NewExecCmd() *cobra.Command

NewExecCmd creates the exec command

func NewInitCmd

func NewInitCmd() *cobra.Command

func NewListCmd

func NewListCmd() *cobra.Command

func NewProjectCmd

func NewProjectCmd() *cobra.Command

NewProjectCmd creates the project command which manages project architecture and rules.

func NewRedoCmd

func NewRedoCmd() *cobra.Command

func NewUpdateCmd

func NewUpdateCmd() *cobra.Command

func RunAnalysisAndConfig

func RunAnalysisAndConfig(createRules bool, forceRules bool) error

RunAnalysisAndConfig shared logic for init and redo.

Types

type Action

type Action struct {
	Name        string            `mapstructure:"name" yaml:"name"`
	Description string            `mapstructure:"description" yaml:"description"`
	Parameters  []ActionParameter `mapstructure:"parameters" yaml:"parameters"`
	Steps       []ActionStep      `mapstructure:"steps" yaml:"steps"`
}

Action defines a project-specific action (e.g., creating a slice, service, etc.).

type ActionParameter

type ActionParameter struct {
	Name        string `mapstructure:"name" yaml:"name"`
	Description string `mapstructure:"description" yaml:"description"`
	Type        string `mapstructure:"type" yaml:"type"` // string, boolean, etc.
	Required    bool   `mapstructure:"required" yaml:"required"`
}

ActionParameter defines a parameter for an action.

type ActionStep

type ActionStep struct {
	Tool        string            `mapstructure:"tool" yaml:"tool"`               // create_file, edit_file, etc.
	Instruction string            `mapstructure:"instruction" yaml:"instruction"` // What to do
	Parameters  map[string]string `mapstructure:"parameters" yaml:"parameters"`   // Additional static params if needed
}

ActionStep defines a specific step in an action workflow.

type AnalysisResult

type AnalysisResult struct {
	Architecture string   `json:"architecture"`
	ProjectType  string   `json:"project_type"`
	Actions      []Action `json:"actions"`
}

AnalysisResult represents the output of the ArchitectureAgent.

type ArchitectureAgent

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

ArchitectureAgent analyzes the project structure.

func NewArchitectureAgent

func NewArchitectureAgent(runtime *shared.RuntimeContext) *ArchitectureAgent

func (*ArchitectureAgent) Analyze

func (a *ArchitectureAgent) Analyze(rootPath string) (*AnalysisResult, error)

Analyze scans the directory and uses LLM to identify architecture and suggested actions.

type Executor

type Executor struct {
	Agent         *GeneratorAgent
	Runtime       *shared.RuntimeContext
	Cwd           string
	Architecture  string
	ProjectType   string
	CurrentAction Action
	CurrentParams map[string]string
}

Executor handles the execution of action steps.

func NewExecutor

func NewExecutor(runtime *shared.RuntimeContext, cwd, arch, pType string, action Action, params map[string]string) *Executor

NewExecutor creates a new Executor.

func (*Executor) ExecuteSteps

func (e *Executor) ExecuteSteps(steps []ActionStep) error

ExecuteSteps runs the defined steps sequentially.

type FileContent

type FileContent struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

type FileGenerationPlan

type FileGenerationPlan struct {
	Files []GeneratedFile `json:"files"`
}

type GeneratedFile

type GeneratedFile struct {
	Path        string `json:"path"`
	Description string `json:"description"`
}

type GeneratorAgent

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

GeneratorAgent generates code based on actions.

func NewGeneratorAgent

func NewGeneratorAgent(runtime *shared.RuntimeContext) *GeneratorAgent

func (*GeneratorAgent) GenerateContent

func (g *GeneratorAgent) GenerateContent(rootPath, architecture, projectType string, action Action, params map[string]string, file GeneratedFile) (*FileContent, error)

GenerateContent generates the content for a specific file.

func (*GeneratorAgent) PlanGeneration

func (g *GeneratorAgent) PlanGeneration(rootPath string, architecture, projectType string, action Action, params map[string]string) (*FileGenerationPlan, error)

PlanGeneration asks LLM which files to create.

func (*GeneratorAgent) UpdateContent

func (g *GeneratorAgent) UpdateContent(filePath, originalContent, instruction, architecture, projectType string) (*FileContent, error)

UpdateContent updates an existing file based on instructions.

type MagiConfig

type MagiConfig struct {
	Actions      []Action               `mapstructure:"actions" yaml:"actions"`
	RulesPath    string                 `mapstructure:"rules_path" yaml:"rules_path"`
	Architecture string                 `mapstructure:"architecture" yaml:"architecture"`
	ProjectType  string                 `mapstructure:"project_type" yaml:"project_type"`
	Remaining    map[string]interface{} `mapstructure:",remain" yaml:",inline"`
}

MagiConfig represents the .magi.yaml configuration file.

type ReviewerAgent

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

ReviewerAgent checks project compliance.

func NewReviewerAgent

func NewReviewerAgent(runtime *shared.RuntimeContext) *ReviewerAgent

func (*ReviewerAgent) ReviewCompliance

func (r *ReviewerAgent) ReviewCompliance(rootPath string, rulesContent string) (string, error)

ReviewCompliance checks if the project structure matches the rules.

type ValidatorAgent

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

ValidatorAgent validates and corrects the AnalysisResult.

func NewValidatorAgent

func NewValidatorAgent(runtime *shared.RuntimeContext) *ValidatorAgent

func (*ValidatorAgent) Validate

func (v *ValidatorAgent) Validate(result *AnalysisResult) (*AnalysisResult, error)

Validate checks the analysis result for common issues and attempts to fix them via LLM.

Jump to

Keyboard shortcuts

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