initialize

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmOverwrite

func ConfirmOverwrite() (bool, error)

ConfirmOverwrite asks the user if they want to overwrite an existing .sley.yaml file.

func DefaultPluginNames

func DefaultPluginNames() []string

DefaultPluginNames returns the names of plugins that are enabled by default.

func FormatVersionSources

func FormatVersionSources(sources []VersionSource) string

FormatVersionSources formats the detected sources for display.

func GenerateConfigWithComments

func GenerateConfigWithComments(path string, selectedPlugins []string) ([]byte, error)

GenerateConfigWithComments creates a Config struct and returns it as YAML with helpful comments. The path parameter specifies the .version file path to use in the config. The selectedPlugins parameter should contain the names of plugins to enable.

func GenerateConfigWithDiscovery

func GenerateConfigWithDiscovery(path string, selectedPlugins []string, syncCandidates []discovery.SyncCandidate) ([]byte, error)

GenerateConfigWithDiscovery creates a Config with dependency-check configuration based on discovered sync candidates.

func GenerateWorkspaceConfigWithComments

func GenerateWorkspaceConfigWithComments(plugins []string, modules []DiscoveredModule) ([]byte, error)

GenerateWorkspaceConfigWithComments generates YAML config with workspace section. In workspace mode, the root path field is omitted since each module defines its own path.

func IsValidTemplate

func IsValidTemplate(name string) bool

IsValidTemplate checks if the given name is a valid template.

func PromptPluginSelection

func PromptPluginSelection(detectionSummary string) ([]string, error)

PromptPluginSelection shows an interactive multi-select prompt for plugin selection. Returns the list of selected plugin names or an error if the user cancels.

func Run

func Run() *cli.Command

Run returns the "init" command.

func TemplateNames

func TemplateNames() []string

TemplateNames returns the names of all available templates.

Types

type DiscoveredModule

type DiscoveredModule struct {
	Name    string
	Path    string
	RelPath string
	Version string
}

DiscoveredModule represents a .version file found during workspace discovery.

type PluginOption

type PluginOption struct {
	Name        string
	Description string
	Default     bool
}

PluginOption represents a selectable plugin with metadata.

func AllPluginOptions

func AllPluginOptions() []PluginOption

AllPluginOptions returns all available plugins with their descriptions. The order matches the desired display order in the prompt.

type ProjectContext

type ProjectContext struct {
	IsGitRepo        bool
	HasPackageJSON   bool
	HasGoMod         bool
	HasCargoToml     bool
	HasPyprojectToml bool
}

ProjectContext holds information about the detected project environment.

func DetectProjectContext

func DetectProjectContext() *ProjectContext

DetectProjectContext analyzes the current directory to detect project type and environment. This helps provide smart defaults and suggestions during initialization.

func (*ProjectContext) FormatDetectionSummary

func (ctx *ProjectContext) FormatDetectionSummary() string

FormatDetectionSummary returns a human-readable summary of detected project features.

func (*ProjectContext) HasAnyDetection

func (ctx *ProjectContext) HasAnyDetection() bool

HasAnyDetection returns true if any project features were detected.

func (*ProjectContext) SuggestedPlugins

func (ctx *ProjectContext) SuggestedPlugins() []string

SuggestedPlugins returns a list of plugin names that would be useful for this project.

type Template

type Template struct {
	Name        string
	Description string
	Plugins     []string
}

Template represents a pre-configured set of plugins for common use cases.

func AllTemplates

func AllTemplates() []Template

AllTemplates returns all available templates.

func GetTemplate

func GetTemplate(name string) (*Template, error)

GetTemplate returns the template with the given name, or an error if not found.

type VersionSource

type VersionSource struct {
	// File is the source file path.
	File string

	// Version is the extracted version string.
	Version string

	// Format describes the file format (e.g., "package.json", "Cargo.toml").
	Format string
}

VersionSource represents a detected version from an existing file.

func DetectExistingVersions

func DetectExistingVersions() []VersionSource

DetectExistingVersions searches for version information in common project files. Returns all detected versions, allowing the user to choose which to use.

func GetBestVersionSource

func GetBestVersionSource(sources []VersionSource) *VersionSource

GetBestVersionSource returns the most appropriate version source. Priority: package.json > Cargo.toml > pyproject.toml > Chart.yaml > plain text

Jump to

Keyboard shortcuts

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