From fd9137f94af226ad93e9d6418ab64be992c52cff Mon Sep 17 00:00:00 2001 From: tauraamui Date: Thu, 16 Oct 2025 10:16:46 +0100 Subject: [PATCH] docs(notes): add contextual helpful comments as part of my previewing --- internal/config/load.go | 2 ++ internal/config/provider.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/internal/config/load.go b/internal/config/load.go index c63a9663613bdfdea6a9c9ccef9f53d375e35c74..ab8c35f7bd1cfaf6077cb841d4ba6e8e4dee1403 100644 --- a/internal/config/load.go +++ b/internal/config/load.go @@ -74,6 +74,8 @@ func Load(workingDir, dataDir string, debug bool) (*Config, error) { assignIfNil(&cfg.Options.TUI.Completions.MaxItems, items) } + // NOTE(tauraamui): current entrypoint for invoking providers fetch for + // the rest of the app as a whole. // Load known providers, this loads the config from catwalk providers, err := Providers(cfg) if err != nil { diff --git a/internal/config/provider.go b/internal/config/provider.go index 671c348f71da3a79f65c14c624bdaf2adc011411..0e664e0b48e7a5f61778e580c7c120ecd2a8a255 100644 --- a/internal/config/provider.go +++ b/internal/config/provider.go @@ -78,6 +78,11 @@ func loadProvidersFromCache(path string) ([]catwalk.Provider, error) { return providers, nil } +// NOTE(tauraamui) : there seems to be duplication of logic for updating +// the providers cache/from catwalk, in that this method is only invoked/used by the +// catwalk CLI command, when it should probably be the exact same behaviour that +// crush carries out internally as well when it does the sync internally/automatically +// see (REF#2) func UpdateProviders(pathOrUrl string) error { var providers []catwalk.Provider pathOrUrl = cmp.Or(pathOrUrl, os.Getenv("CATWALK_URL"), defaultCatwalkURL) @@ -113,6 +118,8 @@ func UpdateProviders(pathOrUrl string) error { return nil } +// NOTE(tauraamui) : see note (REF#1), basically this looks like some logic +// should be shared/consolidated. func Providers(cfg *Config) ([]catwalk.Provider, error) { providerOnce.Do(func() { catwalkURL := cmp.Or(os.Getenv("CATWALK_URL"), defaultCatwalkURL)