Documentation
¶
Overview ¶
Package sync provides options and utilities for synchronizing the catalog with provider APIs.
Index ¶
- type Option
- func WithAutoApprove(autoApprove bool) Option
- func WithAutoInstallDeps(autoInstall bool) Option
- func WithCleanModelsDevRepo(cleanup bool) Option
- func WithDryRun(dryRun bool) Option
- func WithFailFast(failFast bool) Option
- func WithFresh(fresh bool) Option
- func WithOutputPath(path string) Option
- func WithProvider(providerID catalogs.ProviderID) Option
- func WithReformat(reformat bool) Option
- func WithRequireAllSources(require bool) Option
- func WithSkipDepPrompts(skip bool) Option
- func WithSources(types ...sources.ID) Option
- func WithSourcesDir(dir string) Option
- func WithTimeout(timeout time.Duration) Option
- type Options
- type ProviderResult
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
Option is a function that configures sync Options.
func WithAutoApprove ¶
WithAutoApprove configures auto approval.
func WithAutoInstallDeps ¶ added in v0.0.17
WithAutoInstallDeps configures whether to automatically install missing dependencies.
func WithCleanModelsDevRepo ¶
WithCleanModelsDevRepo configures whether to remove temporary models.dev repository after update.
func WithFailFast ¶
WithFailFast configures fail-fast behavior.
func WithOutputPath ¶
WithOutputPath configures the output path for saving.
func WithProvider ¶
func WithProvider(providerID catalogs.ProviderID) Option
WithProvider configures syncing for a specific provider only.
func WithReformat ¶
WithReformat configures whether to reformat providers.yaml file even without changes.
func WithRequireAllSources ¶ added in v0.0.17
WithRequireAllSources configures whether all sources are required to succeed.
func WithSkipDepPrompts ¶ added in v0.0.17
WithSkipDepPrompts configures whether to skip dependency prompts.
func WithSources ¶
WithSources configures which sources to use.
func WithSourcesDir ¶
WithSourcesDir configures the directory for external source data (models.dev cache/git).
func WithTimeout ¶
WithTimeout configures the sync timeout.
type Options ¶
type Options struct {
// Orchestration control
DryRun bool // Show changes without applying them
AutoApprove bool // Skip confirmation prompts
FailFast bool // Stop on first source error instead of continuing
Timeout time.Duration // Timeout for the entire sync operation
// Source selection
Sources []sources.ID // Which sources to use (empty means all)
ProviderID *catalogs.ProviderID // Filter for specific provider
// Output control (used AFTER merging)
OutputPath string // Where to save final catalog (empty means default location)
// Source behavior control
Fresh bool // Delete existing models and fetch fresh from APIs (destructive)
CleanModelsDevRepo bool // Remove temporary models.dev repository after update
Reformat bool // Reformat providers.yaml file even without changes
SourcesDir string // Directory for external source data (models.dev cache/git)
// Dependency control
AutoInstallDeps bool // Automatically install missing dependencies without prompting
SkipDepPrompts bool // Skip dependency prompts and continue without optional dependencies
RequireAllSources bool // Require all sources to succeed (fail if any dependencies are missing)
}
Options controls the overall sync orchestration in Starmap.Sync().
func (*Options) SourceOptions ¶
SourceOptions converts sync options to properly typed source options.
type ProviderResult ¶
type ProviderResult struct {
ProviderID catalogs.ProviderID // The provider that was synced
Added []catalogs.Model // New models not in catalog
Updated []differ.ModelUpdate // Existing models with changes
Removed []catalogs.Model // Models in catalog but not in API (informational only)
// Summary counts
AddedCount int // Number of models added
UpdatedCount int // Number of models updated
RemovedCount int // Number of models removed from API (not deleted from catalog)
// Metadata
APIModelsCount int // Total models fetched from API
ExistingModelsCount int // Total models that existed in catalog
EnhancedCount int // Number of models enhanced with models.dev data
}
ProviderResult represents sync results for a single provider.
func (*ProviderResult) HasChanges ¶
func (spr *ProviderResult) HasChanges() bool
HasChanges returns true if the provider result contains any changes.
func (*ProviderResult) Summary ¶
func (spr *ProviderResult) Summary() string
Summary returns a human-readable summary of the provider result.
type Result ¶
type Result struct {
// Overall statistics
TotalChanges int // Total number of changes across all providers
ProvidersChanged int // Number of providers with changes
ProviderResults map[catalogs.ProviderID]*ProviderResult // Results per provider
// Operation metadata
DryRun bool // Whether this was a dry run
Fresh bool // Whether this was a fresh sync
OutputDir string // Where files were written (empty means default)
}
Result represents the complete result of a sync operation.
func ChangesetToResult ¶
func ChangesetToResult(changeset *differ.Changeset, dryRun bool, outputDir string, providerAPICounts map[catalogs.ProviderID]int, modelProviderMap map[string]catalogs.ProviderID) *Result
ChangesetToResult converts a reconcile.Changeset to a SyncResult.
func (*Result) HasChanges ¶
HasChanges returns true if the sync result contains any changes.