Documentation
¶
Overview ¶
Package linear implements the Linear GraphQL adapter.
Index ¶
- Variables
- type LinearAdapter
- func (a *LinearAdapter) AddComment(ctx context.Context, externalID string, body string) error
- func (a *LinearAdapter) Capabilities() adapter.AdapterCapabilities
- func (a *LinearAdapter) Fetch(ctx context.Context, externalID string) (domain.Session, error)
- func (a *LinearAdapter) ListSelectable(ctx context.Context, opts adapter.ListOpts) (*adapter.ListResult, error)
- func (a *LinearAdapter) Name() string
- func (a *LinearAdapter) OnEvent(ctx context.Context, event domain.SystemEvent) error
- func (a *LinearAdapter) Resolve(ctx context.Context, sel adapter.Selection) (domain.Session, error)
- func (a *LinearAdapter) UpdateState(ctx context.Context, externalID string, state domain.TrackerState) error
- func (a *LinearAdapter) Watch(ctx context.Context, filter adapter.WorkItemFilter) (<-chan adapter.WorkItemEvent, error)
Constants ¶
This section is empty.
Variables ¶
var ErrRateLimited = errors.New("linear: rate limited (429)")
ErrRateLimited is returned when Linear returns HTTP 429.
Functions ¶
This section is empty.
Types ¶
type LinearAdapter ¶
type LinearAdapter struct {
// contains filtered or unexported fields
}
LinearAdapter implements adapter.WorkItemAdapter against the Linear GraphQL API.
func New ¶
func New(cfg config.LinearConfig) *LinearAdapter
New creates a LinearAdapter from the given configuration.
func (*LinearAdapter) AddComment ¶
AddComment posts a comment to the Linear issue identified by the Substrate ExternalID. The externalID ("LIN-FOO-123") is resolved to the Linear internal UUID before mutation.
func (*LinearAdapter) Capabilities ¶
func (a *LinearAdapter) Capabilities() adapter.AdapterCapabilities
Capabilities describes what the Linear adapter supports.
func (*LinearAdapter) Fetch ¶
Fetch retrieves a work item by its Substrate ExternalID (e.g. "LIN-FOO-123"). It reconstructs the Linear identifier and queries by identifier.
func (*LinearAdapter) ListSelectable ¶
func (a *LinearAdapter) ListSelectable(ctx context.Context, opts adapter.ListOpts) (*adapter.ListResult, error)
ListSelectable returns items available for interactive selection, dispatched by scope.
func (*LinearAdapter) Name ¶
func (a *LinearAdapter) Name() string
Name returns the adapter identifier.
func (*LinearAdapter) OnEvent ¶
func (a *LinearAdapter) OnEvent(ctx context.Context, event domain.SystemEvent) error
OnEvent reacts to system events: plan.approved → set in_progress; work_item.completed → set done. Malformed payloads or missing external_id are silently ignored to avoid disrupting the workflow.
func (*LinearAdapter) Resolve ¶
Resolve converts a user selection into a WorkItem, aggregating multiple items when needed.
func (*LinearAdapter) UpdateState ¶
func (a *LinearAdapter) UpdateState(ctx context.Context, externalID string, state domain.TrackerState) error
UpdateState maps the Substrate TrackerState to a Linear workflow state via StateMappings and applies the update. If no mapping is configured for the state, the call is a no-op.
func (*LinearAdapter) Watch ¶
func (a *LinearAdapter) Watch(ctx context.Context, filter adapter.WorkItemFilter) (<-chan adapter.WorkItemEvent, error)
Watch polls Linear for assigned issues and emits events when they appear or change state. It respects context cancellation and applies exponential backoff on rate limiting.