resolver

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package resolver provides name-to-ID resolution for Linear resources.

Resolves friendly names (e.g., "Engineering", "alice@company.com") to UUIDs with caching to improve performance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache provides a file-backed TTL cache for name→ID resolution. Uses fido with local filesystem persistence to survive across MCP subprocess calls (ophis spawns new process per tool invocation).

func NewCache

func NewCache(ttl time.Duration) *Cache

NewCache creates a new cache with the specified TTL. Uses fido with local filesystem persistence.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all entries from the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (string, bool)

Get retrieves a value from the cache. Returns empty string if not found or expired.

func (*Cache) Set

func (c *Cache) Set(key, value string)

Set stores a value in the cache with TTL. Uses synchronous write to ensure reliability for name→ID mappings.

type ResolutionError

type ResolutionError struct {
	EntityType  string   // "team", "user", "label", etc.
	Input       string   // What the user provided (safe to expose)
	Reason      string   // User-facing reason
	Suggestions []string // Actionable suggestions for the user
	Internal    error    // Underlying error (for logging)
}

ResolutionError represents a name-to-ID resolution failure. Provides user-friendly messages while preserving internal context.

func (*ResolutionError) Error

func (e *ResolutionError) Error() string

Error implements the error interface.

func (*ResolutionError) ToErrorContext

func (e *ResolutionError) ToErrorContext(operation string) *linear.ErrorContext

ToErrorContext converts ResolutionError to linear.ErrorContext.

func (*ResolutionError) Unwrap

func (e *ResolutionError) Unwrap() error

Unwrap returns the wrapped error.

type Resolver

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

Resolver resolves names to IDs for Linear resources.

func New

func New(client *linear.Client) *Resolver

New creates a new resolver with a 5-minute cache TTL.

func (*Resolver) ResolveCycle

func (r *Resolver) ResolveCycle(ctx context.Context, nameOrID string) (string, error)

ResolveCycle resolves a cycle name to its ID. Accepts: cycle name or UUID.

func (*Resolver) ResolveDocument

func (r *Resolver) ResolveDocument(ctx context.Context, titleOrID string) (string, error)

ResolveDocument resolves a document title to its ID. Accepts: document title or UUID.

func (*Resolver) ResolveInitiative

func (r *Resolver) ResolveInitiative(ctx context.Context, nameOrID string) (string, error)

ResolveInitiative resolves an initiative name to its ID. Accepts: initiative name or UUID.

func (*Resolver) ResolveIssue

func (r *Resolver) ResolveIssue(ctx context.Context, identifierOrID string) (string, error)

ResolveIssue resolves an issue identifier or ID to its UUID. Accepts: issue identifier (e.g., "ENG-123"), issue number, or UUID.

func (*Resolver) ResolveLabel

func (r *Resolver) ResolveLabel(ctx context.Context, nameOrID string) (string, error)

ResolveLabel resolves a label name to its ID. Accepts: label name or UUID.

func (*Resolver) ResolveMilestone

func (r *Resolver) ResolveMilestone(ctx context.Context, idOrName string) (string, error)

ResolveMilestone resolves a milestone ID. Currently only accepts UUIDs. Name-based resolution requires knowing the project. Use: go-linear project milestone-list <project> to find milestone UUIDs.

func (*Resolver) ResolveProject

func (r *Resolver) ResolveProject(ctx context.Context, nameOrID string) (string, error)

ResolveProject resolves a project name to its ID. Accepts: project name or UUID.

func (*Resolver) ResolveProjectStatus

func (r *Resolver) ResolveProjectStatus(ctx context.Context, nameOrID string) (string, error)

ResolveProjectStatus resolves a project status name to its ID. Accepts: status name (e.g., "Backlog", "In Progress", "Completed") or UUID. Shows available statuses in error message since they're organization-specific.

func (*Resolver) ResolveState

func (r *Resolver) ResolveState(ctx context.Context, nameOrID string) (string, error)

ResolveState resolves a workflow state name to its ID. Accepts: state name, state type, common aliases (todo, done, etc.), or UUID. For aliases/types, only resolves if there's exactly one matching state. In multi-team workspaces with multiple matching states, returns an error with suggestions for disambiguation.

func (*Resolver) ResolveTeam

func (r *Resolver) ResolveTeam(ctx context.Context, nameOrID string) (string, error)

ResolveTeam resolves a team name or key to its ID. Accepts: team name, team key, or UUID.

func (*Resolver) ResolveTemplate

func (r *Resolver) ResolveTemplate(ctx context.Context, nameOrID string) (string, error)

ResolveTemplate resolves a template name to its ID. Accepts: template name or UUID.

func (*Resolver) ResolveUser

func (r *Resolver) ResolveUser(ctx context.Context, nameOrEmailOrID string) (string, error)

ResolveUser resolves a user name, email, or display name to their ID. Accepts: full name, email, display name, "me" (for current user), or UUID.

Jump to

Keyboard shortcuts

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