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 docs Provider

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

Overview

The descriptor wiring one docs-search backend, including the optional `LibraryResolver` for library resolve/get-docs operations.

Description

The docs.Provider is the docs-search analogue of `search.Provider`. Beyond the shared descriptor fields, a docs provider may implement LibraryResolver (`ResolveLibrary`/`GetDocs`) to support the `--library`/`--resolve` flags. The hidden local FTS5 backend is registered but kept out of `AvailableBackends` until implemented. Context7 is the single production backend.

Usage

Register by appending a `*Provider()` call to the package-level `providers` slice in `docs/registry.go` (explicit, no `init()`). Resolved via `docs.NewFromConfig`.

Code Reference

Source Location

  • Repository: ketch
  • File: docs/registry.go

Signature

type Provider struct {
	ID       string
	Setup    string
	Name     string
	Hidden   bool
	Usable   func(*config.Config) bool
	Settings []config.Setting
	New      func(*config.Config) (Searcher, error)
	Probe    func(context.Context, *http.Client, *config.Config) (health.Status, string)
}

// LibraryResolver is implemented by backends that can resolve library names.
type LibraryResolver interface {
	ResolveLibrary(ctx context.Context, name string) ([]LibraryID, error)
	GetDocs(ctx context.Context, id string, tokens int) ([]Result, error)
}

func (p Provider) Required(cfg *config.Config) bool

Import

import (
	"github.com/1broseidon/ketch/docs"
	config "github.com/1broseidon/ketch/internal/configbase"
)

I/O Contract

Outputs

Name Type Description
Provider.New func Constructs the docs Searcher
LibraryResolver interface Optional: library name → IDs, ID → docs

Usage Examples

Registering the Context7 Backend

var providers = []Provider{
	context7Provider(),
	localProvider(), // hidden until implemented
}

func context7Provider() Provider {
	return Provider{
		ID:   "context7",
		Name: "Context7",
		New:  newContext7,
		// Context7 implements LibraryResolver.
	}
}

Related Pages

Implements Principle

Page Connections

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