Documentation
¶
Overview ¶
Package workitem provides a provider-agnostic abstraction for interacting with project management items like issues, tasks, and user stories.
The core of this package is the Provider interface, which defines a standard set of operations (e.g., List, Get, Create) for work items. Concrete implementations, such as one for the GitHub API, will satisfy this interface.
This decoupling allows the CLI commands to operate on the generic WorkItem struct without needing to know the specifics of the backend (GitHub, GitLab, etc.), making the system extensible.
internal/workitem/provider.go
internal/workitem/types.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListOptions ¶
ListOptions provides filters and pagination for listing work items.
type Provider ¶
type Provider interface {
// ListItems retrieves a collection of work items based on the provided options.
ListItems(ctx context.Context, options ListOptions) ([]WorkItem, error)
// GetItem retrieves a single work item by its public number, optionally fetching comments.
GetItem(ctx context.Context, number int, withComments bool) (*WorkItem, error)
// CreateItem creates a new work item in the backend system.
CreateItem(ctx context.Context, item WorkItem) (*WorkItem, error)
// UpdateItem updates an existing work item in the backend system.
UpdateItem(ctx context.Context, number int, item WorkItem) (*WorkItem, error)
// SearchItems uses a provider-specific query string to find work items.
SearchItems(ctx context.Context, query string) ([]WorkItem, error)
// CreateLabel creates a new label in the backend system.
CreateLabel(ctx context.Context, label Label) (*Label, error)
}
Provider defines the interface for a work item management system. This allows for abstracting the backend (GitHub, GitLab, etc.).
type WorkItem ¶
type WorkItem struct {
// Provider-specific ID (e.g., GitHub's GraphQL node ID).
ID string
// Publicly visible number for the item (e.g., GitHub issue #123).
Number int
// The title or summary of the work item.
Title string
// The detailed description or body of the work item.
Body string
// The current state of the item.
State State
// The classification of the item.
Type Type
// The web URL to view the item in its native system.
URL string
// The username of the author.
Author string
// A list of associated labels or tags.
Labels []string
// A list of usernames assigned to the item.
Assignees []string
// When the item was created.
CreatedAt time.Time
// When the item was last updated.
UpdatedAt time.Time
// A list of comments on the item.
Comments []Comment
// A slice of child work items to represent a hierarchy.
Children []*WorkItem
}
WorkItem is the generic, provider-agnostic representation of a work item. It includes a Children slice to allow for building hierarchical trees.