Component evidence

Issue Tracker Registry (tracker/registry.go)

beads · internal/tracker/registry.go · go · MIT
crmdev-toolslang:gotag:registrytag:patternstag:architecture

A thread-safe registry for managing multiple issue tracker adapters. Reuse this to decouple tracker implementations from core application logic.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/gastownhall/beads | License: MIT | Copyright 2025 Beads Contributors
// Provided via justclaw.it.com; keep this notice with the code.
package tracker

import (
	"fmt"
	"sort"
	"sync"
)

// TrackerFactory creates a new IssueTracker instance.
type TrackerFactory func() IssueTracker

var (
	registryMu sync.RWMutex
	registry   = make(map[string]TrackerFactory)
)

// Register adds a tracker factory to the global registry.
// Typically called from an init() function in each tracker adapter package.
func Register(name string, factory TrackerFactory) {
	registryMu.Lock()
	defer registryMu.Unlock()
	registry[name] = factory
}

// Get returns the factory for the named tracker, or nil if not registered.
func Get(name string) TrackerFactory {
	registryMu.RLock()
	defer re

... (truncated -- full source via MCP)