cmd

package
v0.0.0-...-c6b82f2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReturnToMenu = errors.New("return to main menu")

ErrReturnToMenu is a special error that signals to return to the main menu

View Source
var ErrUserQuit = errors.New("user quit")

ErrUserQuit is a special error that signals the user wants to quit

Functions

func Execute

func Execute() error

func GenerateProject

func GenerateProject() error

func InstallDependencies

func InstallDependencies(projectPath string) error

InstallDependencies runs go mod tidy to install project dependencies

func LoadExistingProject

func LoadExistingProject() error

LoadExistingProject handles loading an existing Gophex project

func OpenProjectDirectory

func OpenProjectDirectory(projectPath string) error

OpenProjectDirectory opens the project directory in the system file manager

func RunCRUDWizard

func RunCRUDWizard(projectPath string) error

RunCRUDWizard runs the interactive CRUD generation wizard

func RunChangeDetection

func RunChangeDetection(projectPath string) error

RunChangeDetection runs the change detection script

func RunDatabaseSetup

func RunDatabaseSetup(projectPath, projectType string) error

RunDatabaseSetup runs database migrations or initialization based on project type

func RunDevelopmentWorkflow

func RunDevelopmentWorkflow(projectPath, projectType string) error

RunDevelopmentWorkflow runs an automated development setup workflow

func RunEnhancedCRUDWizard

func RunEnhancedCRUDWizard(projectPath string) error

RunEnhancedCRUDWizard runs the enhanced educational CRUD generation wizard

func RunEnhancedProjectWizard

func RunEnhancedProjectWizard() error

RunEnhancedProjectWizard runs the enhanced educational project generation wizard

func RunQuickStart

func RunQuickStart(projectPath, projectType string) error

RunQuickStart provides a simplified quick start workflow

func RunTests

func RunTests(projectPath string) error

RunTests runs the project tests

func ShowPostGenerationMenu

func ShowPostGenerationMenu(opts PostGenerationOptions) error

ShowPostGenerationMenu displays the post-generation menu and handles user choices

func StartApplication

func StartApplication(projectPath, projectType string) error

StartApplication starts the generated application

func ViewDocumentation

func ViewDocumentation(projectPath string) error

ViewDocumentation displays the project documentation

Types

type APIEndpoint

type APIEndpoint struct {
	Method      string
	Path        string
	Handler     string
	Middleware  []string
	Description string
}

APIEndpoint represents an API endpoint

type ActivityTracker

type ActivityTracker struct {
	DependenciesInstalled bool `json:"dependencies_installed"`
	DatabaseSetup         bool `json:"database_setup"`
	ApplicationStarted    bool `json:"application_started"`
	TestsRun              bool `json:"tests_run"`
	HealthCheckTested     bool `json:"health_check_tested"`
	DocumentationViewed   bool `json:"documentation_viewed"`
	ChangeDetectionRun    bool `json:"change_detection_run"`
}

ActivityTracker tracks completion status of various activities

type ArchitectureLayer

type ArchitectureLayer struct {
	Name         string
	Description  string
	Files        []string
	Purpose      string
	Dependencies []string
}

ArchitectureLayer represents a layer in the clean architecture

type BusinessRule

type BusinessRule struct {
	Name        string
	Description string
	Validation  string
}

BusinessRule represents a business rule

type CRUDEntity

type CRUDEntity struct {
	Name         string
	PluralName   string
	Fields       []CRUDField
	UpdateMethod string // "put", "patch", or "both"
}

CRUDEntity represents the entity to generate CRUD for

type CRUDField

type CRUDField struct {
	Name        string
	Type        string
	JSONTag     string
	DBTag       string
	Required    bool
	Unique      bool
	Description string
}

CRUDField represents a field in the entity

type CRUDTemplateData

type CRUDTemplateData struct {
	Entity       *CRUDEntity
	ModuleName   string
	ProjectName  string
	DatabaseType string
	Timestamp    string
}

CRUDTemplateData contains all data needed for CRUD template generation

type DatabaseInfo

type DatabaseInfo struct {
	Configured              bool   `json:"configured"`
	Type                    string `json:"type,omitempty"`        // postgresql, mysql, mongodb
	ConfigType              string `json:"config_type,omitempty"` // single, read-write, cluster
	MigrationsExecuted      bool   `json:"migrations_executed"`
	InitializationCompleted bool   `json:"initialization_completed"`
	SupportsMigrations      bool   `json:"supports_migrations"`
}

DatabaseInfo tracks database configuration (no sensitive data)

type DiscoveredProject

type DiscoveredProject struct {
	Name         string
	Type         string
	Path         string
	LastUpdated  string
	RelativePath string
}

DiscoveredProject represents information about a discovered Gophex project

type DomainEvent

type DomainEvent struct {
	Name    string
	Trigger string
	Payload []string
}

DomainEvent represents a domain event

type DomainObject

type DomainObject struct {
	Entity     CRUDEntity
	Repository RepositoryConfig
	Service    ServiceConfig
	Handler    HandlerConfig
	Validation ValidationConfig
	Middleware []MiddlewareConfig
}

DomainObject represents a complete domain object with all its components

type GophexMetadata

type GophexMetadata struct {
	Version     string           `json:"version"`
	GeneratedAt string           `json:"generated_at"`
	Project     ProjectInfo      `json:"project"`
	Database    DatabaseInfo     `json:"database"`
	Redis       RedisInfo        `json:"redis"`
	Activities  ActivityTracker  `json:"activities"`
	Hierarchy   ProjectHierarchy `json:"hierarchy"`
}

GophexMetadata contains all Gophex-specific tracking data

type HandlerConfig

type HandlerConfig struct {
	Endpoints     []APIEndpoint
	Middleware    []string
	ErrorHandling bool
	Documentation bool
}

HandlerConfig represents handler layer configuration

type MiddlewareConfig

type MiddlewareConfig struct {
	Name    string
	Purpose string
	Order   int
	Enabled bool
}

MiddlewareConfig represents middleware configuration

type PostGenerationOptions

type PostGenerationOptions struct {
	ProjectPath string
	ProjectType string
	ProjectName string
}

PostGenerationOptions represents the available actions after project generation

type ProcessInfo

type ProcessInfo struct {
	Cmd         *exec.Cmd
	Name        string
	Description string
	ProjectPath string
}

ProcessInfo contains information about a running process

type ProcessManager

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

ProcessManager tracks and manages child processes started by Gophex

func GetProcessManager

func GetProcessManager() *ProcessManager

GetProcessManager returns the global process manager instance

func (*ProcessManager) AddProcess

func (pm *ProcessManager) AddProcess(name, description, projectPath string, cmd *exec.Cmd)

AddProcess adds a process to the manager

func (*ProcessManager) GetRunningProcesses

func (pm *ProcessManager) GetRunningProcesses() []*ProcessInfo

GetRunningProcesses returns a list of currently running processes

func (*ProcessManager) HandleGracefulShutdown

func (pm *ProcessManager) HandleGracefulShutdown() error

HandleGracefulShutdown handles shutdown when there are running processes

func (*ProcessManager) HasRunningProcesses

func (pm *ProcessManager) HasRunningProcesses() bool

HasRunningProcesses checks if there are any running child processes

func (*ProcessManager) RemoveProcess

func (pm *ProcessManager) RemoveProcess(name string)

RemoveProcess removes a process from the manager

func (*ProcessManager) StartProcessWithTracking

func (pm *ProcessManager) StartProcessWithTracking(name, description, projectPath string, cmd *exec.Cmd) error

StartProcessWithTracking starts a process and adds it to the manager

func (*ProcessManager) TerminateAllProcesses

func (pm *ProcessManager) TerminateAllProcesses()

TerminateAllProcesses terminates all tracked processes

type ProjectConfiguration

type ProjectConfiguration struct {
	Name           string
	Type           string
	Framework      string
	DatabaseConfig *generator.DatabaseConfig
	RedisConfig    *generator.RedisConfig
	Path           string
	Features       []ProjectFeature
}

ProjectConfiguration represents the complete project configuration

type ProjectFeature

type ProjectFeature struct {
	Name        string
	Description string
	Enabled     bool
	Educational string
}

ProjectFeature represents a feature that can be enabled in the project

type ProjectHierarchy

type ProjectHierarchy struct {
	Cmd        map[string]interface{} `json:"cmd,omitempty"`
	Internal   map[string]interface{} `json:"internal,omitempty"`
	Migrations []string               `json:"migrations,omitempty"`
	Scripts    []string               `json:"scripts,omitempty"`
	Web        map[string]interface{} `json:"web,omitempty"`
	RootFiles  []string               `json:"root_files"`
}

ProjectHierarchy represents the file structure of the generated project

type ProjectInfo

type ProjectInfo struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Path       string `json:"path"`
	ModuleName string `json:"module_name"`
}

ProjectInfo contains basic project information

type ProjectMetadata

type ProjectMetadata struct {
	Gophex GophexMetadata `json:"gophex"`
}

ProjectMetadata represents the complete project tracking information

type ProjectTracker

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

ProjectTracker manages project metadata operations

func NewProjectTracker

func NewProjectTracker(projectPath string) *ProjectTracker

NewProjectTracker creates a new project tracker for the given project path

func (*ProjectTracker) CreateInitialMetadata

func (pt *ProjectTracker) CreateInitialMetadata(projectType, projectName, projectPath string, dbConfig *generator.DatabaseConfig, redisConfig *generator.RedisConfig) error

CreateInitialMetadata creates and saves initial project metadata

func (*ProjectTracker) GetActivityPrefix

func (pt *ProjectTracker) GetActivityPrefix(activity string) string

GetActivityPrefix returns "Re-" if activity is completed, empty string otherwise

func (*ProjectTracker) GetMetadata

func (pt *ProjectTracker) GetMetadata() *ProjectMetadata

GetMetadata returns the current metadata

func (*ProjectTracker) IsActivityCompleted

func (pt *ProjectTracker) IsActivityCompleted(activity string) bool

IsActivityCompleted checks if a specific activity has been completed

func (*ProjectTracker) LoadMetadata

func (pt *ProjectTracker) LoadMetadata() error

LoadMetadata loads existing project metadata from gophex.md

func (*ProjectTracker) SaveMetadata

func (pt *ProjectTracker) SaveMetadata() error

SaveMetadata saves the current metadata to gophex.md

func (*ProjectTracker) UpdateActivity

func (pt *ProjectTracker) UpdateActivity(activity string, completed bool) error

UpdateActivity updates the status of a specific activity

func (*ProjectTracker) UpdateDatabaseStatus

func (pt *ProjectTracker) UpdateDatabaseStatus(migrationsExecuted, initializationCompleted bool) error

UpdateDatabaseStatus updates database-related status

type RedisInfo

type RedisInfo struct {
	Configured bool `json:"configured"`
	Enabled    bool `json:"enabled"`
}

RedisInfo tracks Redis configuration (no sensitive data)

type RepositoryConfig

type RepositoryConfig struct {
	Interface    string
	Methods      []string
	Caching      bool
	Transactions bool
	Pagination   bool
}

RepositoryConfig represents repository layer configuration

type ServiceConfig

type ServiceConfig struct {
	BusinessRules []BusinessRule
	Events        []DomainEvent
	Validation    bool
	Logging       bool
}

ServiceConfig represents service layer configuration

type UpdateMethodChoice

type UpdateMethodChoice struct {
	Value       string
	Description string
	UseCase     string
	Example     string
}

UpdateMethodChoice represents the update method selection

type ValidationConfig

type ValidationConfig struct {
	InputValidation    bool
	BusinessValidation bool
	CustomValidators   []string
}

ValidationConfig represents validation configuration

Jump to

Keyboard shortcuts

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