Documentation
¶
Overview ¶
Package discover provides the "sley discover" command which scans for version sources (both .version files and manifest files like package.json, Cargo.toml, etc.) and helps users understand their project structure and configure dependency-check syncing.
Index ¶
- func DiscoverAndSuggest(ctx context.Context, cfg *config.Config, rootDir string) (*discovery.Result, *config.DependencyCheckConfig, error)
- func GenerateDependencyCheckConfig(candidates []discovery.SyncCandidate) *config.DependencyCheckConfig
- func GenerateDependencyCheckFileConfig(c discovery.SyncCandidate) config.DependencyFileConfig
- func GetFieldForManifest(filename string, format parser.Format) string
- func Run(cfg *config.Config) *cli.Command
- func SuggestDependencyCheckFromDiscovery(result *discovery.Result) *config.DependencyCheckConfig
- type Formatter
- type OutputFormat
- type Prompter
- type TUIPrompter
- func (p *TUIPrompter) Confirm(title, description string) (bool, error)
- func (p *TUIPrompter) MultiSelect(title, description string, options []huh.Option[string], defaults []string) ([]string, error)
- func (p *TUIPrompter) Select(title, description string, options []huh.Option[string]) (string, error)
- type Workflow
- type WorkspaceChoice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverAndSuggest ¶
func DiscoverAndSuggest(ctx context.Context, cfg *config.Config, rootDir string) (*discovery.Result, *config.DependencyCheckConfig, error)
DiscoverAndSuggest is a helper function that performs discovery and returns suggested dependency-check configuration.
func GenerateDependencyCheckConfig ¶
func GenerateDependencyCheckConfig(candidates []discovery.SyncCandidate) *config.DependencyCheckConfig
GenerateDependencyCheckConfig generates the full dependency check config from candidates.
func GenerateDependencyCheckFileConfig ¶
func GenerateDependencyCheckFileConfig(c discovery.SyncCandidate) config.DependencyFileConfig
GenerateDependencyCheckFileConfig generates a config.DependencyFileConfig from a SyncCandidate.
func GetFieldForManifest ¶
GetFieldForManifest returns the appropriate field path for a manifest file.
func SuggestDependencyCheckFromDiscovery ¶
func SuggestDependencyCheckFromDiscovery(result *discovery.Result) *config.DependencyCheckConfig
SuggestDependencyCheckFromDiscovery analyzes discovery results and suggests dependency-check configuration if appropriate.
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles display of discovery results.
func NewFormatter ¶
func NewFormatter(format OutputFormat) *Formatter
NewFormatter creates a new Formatter with the specified output format.
func NewFormatterWithConfig ¶ added in v0.13.0
func NewFormatterWithConfig(format OutputFormat, cfg *config.Config) *Formatter
NewFormatterWithConfig creates a new Formatter with the specified output format and config. The config is used to adjust output severity (e.g., independent versioning shows info instead of warnings).
func (*Formatter) FormatResult ¶
FormatResult formats the discovery result for display.
func (*Formatter) PrintResult ¶
PrintResult prints the formatted result to stdout.
type OutputFormat ¶
type OutputFormat string
OutputFormat controls how discovery results are displayed.
const ( // FormatText outputs human-readable text. FormatText OutputFormat = "text" // FormatJSON outputs machine-readable JSON. FormatJSON OutputFormat = "json" // FormatTable outputs tabular data. FormatTable OutputFormat = "table" )
func ParseOutputFormat ¶
func ParseOutputFormat(s string) OutputFormat
ParseOutputFormat converts a string to OutputFormat.
type Prompter ¶
type Prompter interface {
Confirm(title, description string) (bool, error)
MultiSelect(title, description string, options []huh.Option[string], defaults []string) ([]string, error)
Select(title, description string, options []huh.Option[string]) (string, error)
}
Prompter abstracts interactive prompts for testability.
type TUIPrompter ¶
type TUIPrompter struct{}
TUIPrompter implements Prompter using the tui package.
func (*TUIPrompter) Confirm ¶
func (p *TUIPrompter) Confirm(title, description string) (bool, error)
Confirm shows a yes/no confirmation prompt.
func (*TUIPrompter) MultiSelect ¶
func (p *TUIPrompter) MultiSelect(title, description string, options []huh.Option[string], defaults []string) ([]string, error)
MultiSelect shows a multi-select prompt.
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow handles the interactive discovery workflow.
func NewWorkflow ¶
NewWorkflow creates a new workflow handler.
type WorkspaceChoice ¶ added in v0.10.0
type WorkspaceChoice string
WorkspaceChoice represents the user's choice for multi-module configuration.
const ( // WorkspaceChoiceCoordinated syncs all .version files to root (coordinated versioning). WorkspaceChoiceCoordinated WorkspaceChoice = "coordinated" // WorkspaceChoiceWorkspace configures independent module versions (workspace mode). WorkspaceChoiceWorkspace WorkspaceChoice = "workspace" // WorkspaceChoiceSingleRoot uses only the root .version for all manifests. WorkspaceChoiceSingleRoot WorkspaceChoice = "single" )