Documentation
¶
Overview ¶
Package entrypoint provides entry point selection for multi-binary projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyRepoPath is returned when the repository path is empty. ErrEmptyRepoPath = errors.New("repository path is empty") // ErrRepoNotFound is returned when the repository path does not exist. ErrRepoNotFound = errors.New("repository not found") // ErrEmptyEntryPoint is returned when the entry point is empty. ErrEmptyEntryPoint = errors.New("entry point is empty") // ErrEntryPointNotFound is returned when the specified entry point does not exist. ErrEntryPointNotFound = errors.New("entry point not found") // ErrInvalidEntryPoint is returned when the entry point is not valid. ErrInvalidEntryPoint = errors.New("invalid entry point") // ErrNoEntryPointsFound is returned when no entry points are detected. ErrNoEntryPointsFound = errors.New("no entry points found") // ErrUnsupportedLanguage is returned when the language is not supported. ErrUnsupportedLanguage = errors.New("unsupported language") )
var GoEntryPointDirs = []string{
"cmd",
"apps",
"services",
}
GoEntryPointDirs lists directories to check for main packages in Go repositories. **Validates: Requirements 19.1, 19.2, 19.3, 19.4**
Functions ¶
func MergeConfig ¶
func MergeConfig(detected map[string]interface{}, userConfig *models.BuildConfig) *models.BuildConfig
MergeConfig merges a user-provided BuildConfig with detected values from DetectionResult. User-provided values always override detected values.
Types ¶
type EntryPoint ¶
type EntryPoint struct {
Path string `json:"path"` // e.g., "cmd/api", "src/main.py"
Name string `json:"name"` // e.g., "api", "main"
IsDefault bool `json:"is_default"` // Heuristically determined default
Description string `json:"description"` // Auto-generated description
}
EntryPoint represents a buildable binary/script.
type EntryPointSelector ¶
type EntryPointSelector interface {
// ListEntryPoints returns all detected entry points.
ListEntryPoints(ctx context.Context, repoPath string, language string) ([]EntryPoint, error)
// SelectDefault returns the default entry point based on heuristics.
SelectDefault(entryPoints []EntryPoint) *EntryPoint
// Validate checks if a specified entry point exists.
Validate(ctx context.Context, repoPath string, entryPoint string) error
}
EntryPointSelector handles multi-binary project selection.
type Selector ¶
type Selector struct{}
Selector implements the EntryPointSelector interface.
func (*Selector) ListEntryPoints ¶
func (s *Selector) ListEntryPoints(ctx context.Context, repoPath string, language string) ([]EntryPoint, error)
ListEntryPoints returns all detected entry points for the given language.
func (*Selector) SelectDefault ¶
func (s *Selector) SelectDefault(entryPoints []EntryPoint) *EntryPoint
SelectDefault returns the default entry point based on heuristics. Priority order: 1. Entry point already marked as default 2. Entry point named "main", "app", "server", or "api" 3. Entry point in root directory 4. First entry point alphabetically