Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1broseidon Ketch providers slice

From Leeroopedia
Knowledge Sources
Domains Provider_Registry, Registration_Pattern
Last Updated 2026-10-27 00:00 GMT

Overview

The ordered, package-level `providers` slice in each of `search/`, `code/`, and `docs/` — the single registration point that drives config discovery, CLI/MCP descriptions, doctor, and auto/multi/random eligibility.

Description

Each of the three search universes keeps its providers in a package-level `var providers = []Provider{ … }` slice, registered by appending one `*Provider()` call per backend. Registration is explicit, without `init()`, so the order is the stable presentation order and a missing registration is a visible diff. Every shared consumer — `Providers()`, `AvailableBackends()`, `Lookup`, `Build`, config discovery, CLI/MCP descriptions, doctor probes, and auto/multi/random eligibility — derives from this slice. A new provider flows through all of them by being appended here.

Usage

When adding a new search/code/docs backend: implement it in one file, append its descriptor call to the slice, write tests, and regenerate golden fixtures (`UPDATE_REGISTRY_GOLDENS=1 go test ./cmd/ ./doctor/`).

Code Reference

Source Location

  • Repository: ketch
  • Files: search/registry.go, code/registry.go, docs/registry.go

Signature

// search/registry.go
var providers = []Provider{
	braveProvider(),
	ddgProvider(),
	searxngProvider(),
	exaProvider(),
	firecrawlProvider(),
	keenableProvider(),
	tavilyProvider(),
	tinyfishProvider(),
	parallelProvider(),
	serpbaseProvider(),
	degoogProvider(),
	serplyProvider(),
	youcomProvider(),
}

// Providers returns the descriptors in stable presentation order (cloned).
func Providers() []Provider

// AvailableBackends returns the implemented provider IDs in registry order.
func AvailableBackends() []string

// Lookup finds a provider without constructing it or accessing the network.
func Lookup(id string) (Provider, bool)

Import

import "github.com/1broseidon/ketch/search" // or code, docs

I/O Contract

Outputs

Name Type Description
Providers() []Provider Cloned snapshot of the registry
AvailableBackends() []string Non-hidden provider IDs in order

Usage Examples

Adding a Provider

// search/mybackend.go implements myBackend.Search and myProvider()
// search/registry.go:
var providers = []Provider{
	// …existing providers…
	myProvider(), // append here — order is the presentation order
}

Iterating the Registry

for _, p := range search.Providers() {
	if p.Required(cfg) {
		runDoctorProbe(p) // doctor checks selected/configured providers
	}
}

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment