adapter

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package adapter defines interfaces for all external integrations. Engines depend on these interfaces, never on concrete implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIAdapter

type AIAdapter interface {
	// Complete sends a prompt and returns the completion.
	Complete(ctx context.Context, prompt string, system string) (string, error)
	// Embed returns a vector embedding for the given text.
	// Returns nil, ErrEmbeddingsNotSupported if the provider doesn't support embeddings.
	Embed(ctx context.Context, text string) ([]float32, error)
}

AIAdapter manages LLM integration for drafting, summarisation, and embedding.

type AgentAdapter

type AgentAdapter interface {
	// Invoke spawns the agent as a subprocess. The MCP server is already running.
	// contextFile is the fallback consolidated markdown for non-MCP agents.
	// Invoke blocks until the agent exits.
	Invoke(ctx context.Context, contextFile string, workDir string) error
	// SupportsMCP returns true if the agent natively connects to MCP servers.
	SupportsMCP() bool
}

AgentAdapter manages coding agent integration.

type CommsAdapter

type CommsAdapter interface {
	// Notify sends a structured message to the configured channel.
	Notify(ctx context.Context, msg Notification) error
	// PostStandup posts a formatted standup to the standup channel.
	PostStandup(ctx context.Context, standup StandupReport) error
	// FetchMentions returns recent mentions of spec IDs in configured channels.
	FetchMentions(ctx context.Context, since time.Time) ([]Mention, error)
}

CommsAdapter sends notifications and retrieves mentions from a comms platform.

type DeployAdapter

type DeployAdapter interface {
	// Trigger initiates a deployment for the given repos to the target environment.
	Trigger(ctx context.Context, repos []string, env string) (*DeployRun, error)
	// Status polls the deployment run for current state.
	Status(ctx context.Context, run *DeployRun) (*DeployStatus, error)
}

DeployAdapter manages deployment integration.

type DeployRun

type DeployRun struct {
	ID     string
	Repo   string
	Env    string
	Status string
	URL    string
}

DeployRun represents a triggered deployment.

type DeployStatus

type DeployStatus struct {
	RunID   string
	Status  string // "pending", "running", "success", "failure"
	URL     string
	Message string
}

DeployStatus represents the current state of a deployment.

type DocsAdapter

type DocsAdapter interface {
	// FetchSections retrieves the current content of the spec from the docs provider,
	// keyed by section slug.
	FetchSections(ctx context.Context, specID string) (map[string]string, error)
	// PushFull publishes the complete spec to the docs provider.
	PushFull(ctx context.Context, specID string, content string) error
	// PageURL returns the URL of the spec's page in the docs provider.
	PageURL(ctx context.Context, specID string) (string, error)
}

DocsAdapter manages documentation tool integration.

type IntakeAdapter

type IntakeAdapter interface {
	// FetchItems returns new intake items from the external source.
	FetchItems(ctx context.Context) ([]IntakeItem, error)
}

IntakeAdapter manages external intake source integration.

type IntakeItem

type IntakeItem struct {
	Title     string
	Source    string
	SourceRef string
	Priority  string
	Body      string
}

IntakeItem represents an item from an external intake source.

type Mention

type Mention struct {
	SpecID    string
	Channel   string
	Author    string
	Preview   string
	Timestamp time.Time
}

Mention represents a comms mention of a spec.

type Notification

type Notification struct {
	SpecID  string
	Title   string
	Message string
	Channel string
	Mention string // e.g., "@alice"
}

Notification represents a structured message to send via comms.

type PMAdapter

type PMAdapter interface {
	// CreateEpic creates a new epic/issue linked to a spec.
	CreateEpic(ctx context.Context, spec SpecMeta) (epicKey string, err error)
	// UpdateStatus syncs the spec's pipeline status to the PM tool.
	UpdateStatus(ctx context.Context, epicKey string, status string) error
	// FetchUpdates returns status changes from the PM tool since last sync.
	FetchUpdates(ctx context.Context, epicKey string) (*PMUpdate, error)
}

PMAdapter manages project management tool integration.

type PMUpdate

type PMUpdate struct {
	Status    string
	Assignee  string
	UpdatedAt time.Time
}

PMUpdate represents status changes from a PM tool.

type PRDetail

type PRDetail struct {
	PullRequest
	ReviewComments    int
	UnresolvedThreads int
}

PRDetail represents detailed PR information.

type PullRequest

type PullRequest struct {
	Number    int
	Title     string
	Repo      string
	Branch    string
	Author    string
	URL       string
	Status    string // "open", "merged", "closed"
	Approved  bool
	CIStatus  string // "passing", "failing", "pending"
	CreatedAt time.Time
}

PullRequest represents a PR from a repo provider.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry resolves configuration to concrete adapter implementations.

func NewRegistry

func NewRegistry(cfg *config.TeamConfig) *Registry

NewRegistry creates a new adapter registry from team configuration. Concrete adapters are injected via With* methods. Unconfigured adapters are set to their noop implementations by the caller.

func (*Registry) AI

func (r *Registry) AI() AIAdapter

AI returns the AI adapter.

func (*Registry) Agent

func (r *Registry) Agent() AgentAdapter

Agent returns the agent adapter.

func (*Registry) Comms

func (r *Registry) Comms() CommsAdapter

Comms returns the comms adapter.

func (*Registry) Config

func (r *Registry) Config() *config.TeamConfig

Config returns the team configuration.

func (*Registry) Deploy

func (r *Registry) Deploy() DeployAdapter

Deploy returns the deploy adapter.

func (*Registry) Docs

func (r *Registry) Docs() DocsAdapter

Docs returns the docs adapter.

func (*Registry) PM

func (r *Registry) PM() PMAdapter

PM returns the PM adapter.

func (*Registry) Repo

func (r *Registry) Repo() RepoAdapter

Repo returns the repo adapter.

func (*Registry) WithAI

func (r *Registry) WithAI(a AIAdapter) *Registry

WithAI sets the AI adapter.

func (*Registry) WithAgent

func (r *Registry) WithAgent(a AgentAdapter) *Registry

WithAgent sets the agent adapter.

func (*Registry) WithComms

func (r *Registry) WithComms(a CommsAdapter) *Registry

WithComms sets the comms adapter.

func (*Registry) WithDeploy

func (r *Registry) WithDeploy(a DeployAdapter) *Registry

WithDeploy sets the deploy adapter.

func (*Registry) WithDocs

func (r *Registry) WithDocs(a DocsAdapter) *Registry

WithDocs sets the docs adapter.

func (*Registry) WithPM

func (r *Registry) WithPM(a PMAdapter) *Registry

WithPM sets the PM adapter.

func (*Registry) WithRepo

func (r *Registry) WithRepo(a RepoAdapter) *Registry

WithRepo sets the repo adapter.

type RepoAdapter

type RepoAdapter interface {
	// ListPRs returns open PRs matching a spec's branch pattern across its repos.
	ListPRs(ctx context.Context, repos []string, specID string) ([]PullRequest, error)
	// PRStatus returns the review/CI status of a specific PR.
	PRStatus(ctx context.Context, repo string, prNumber int) (*PRDetail, error)
	// SetPRDescription updates a PR's description.
	SetPRDescription(ctx context.Context, repo string, prNumber int, body string) error
	// RequestedReviews returns PRs where the current user is a requested reviewer.
	RequestedReviews(ctx context.Context, user string) ([]PullRequest, error)
}

RepoAdapter manages code repository integration.

type SpecMeta

type SpecMeta struct {
	ID      string
	Title   string
	Status  string
	EpicKey string
	Repos   []string
}

SpecMeta is a lightweight spec summary for adapter use.

type StandupReport

type StandupReport struct {
	UserName  string
	Date      string
	Yesterday []string
	Today     []string
	Blockers  []string
}

StandupReport represents a formatted standup.

Directories

Path Synopsis
Package anthropic implements AIAdapter using the Anthropic Messages API.
Package anthropic implements AIAdapter using the Anthropic Messages API.
Package claude implements AgentAdapter for Claude Code.
Package claude implements AgentAdapter for Claude Code.
Package confluence implements DocsAdapter using the Confluence REST API v2.
Package confluence implements DocsAdapter using the Confluence REST API v2.
Package github implements RepoAdapter and DeployAdapter using the GitHub API.
Package github implements RepoAdapter and DeployAdapter using the GitHub API.
Package jira implements PMAdapter using the Jira REST API v3.
Package jira implements PMAdapter using the Jira REST API v3.
Package noop provides no-op adapter implementations for unconfigured integrations.
Package noop provides no-op adapter implementations for unconfigured integrations.
Package ollama implements AIAdapter using the Ollama local API.
Package ollama implements AIAdapter using the Ollama local API.
Package resolve creates concrete adapter implementations from team config.
Package resolve creates concrete adapter implementations from team config.
Package slack implements CommsAdapter using the Slack API.
Package slack implements CommsAdapter using the Slack API.
Package teams implements CommsAdapter using Microsoft Teams webhooks.
Package teams implements CommsAdapter using Microsoft Teams webhooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL