ticket

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Type      EntryType `yaml:"type"`
	Author    string    `yaml:"author"`
	Timestamp time.Time `yaml:"timestamp"`
	Content   string    `yaml:"content"`
}

Entry represents a prompt or comment on a ticket.

type EntryType

type EntryType string

EntryType represents the type of a ticket entry.

const (
	EntryTypePrompt  EntryType = "prompt"
	EntryTypeComment EntryType = "comment"
)

type FileStore

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

FileStore implements Store using the filesystem.

func NewFileStore

func NewFileStore(ticketsDir, project string) *FileStore

NewFileStore creates a new filesystem-based ticket store.

func (*FileStore) Create

func (s *FileStore) Create(ctx context.Context, prompt string) (*Ticket, error)

Create creates a new ticket with the given prompt.

func (*FileStore) Get

func (s *FileStore) Get(ctx context.Context, id string) (*Ticket, error)

Get returns a ticket by ID.

func (*FileStore) List

func (s *FileStore) List(ctx context.Context, status *Status) ([]Ticket, error)

List returns all tickets, optionally filtered by status.

func (*FileStore) NextPending

func (s *FileStore) NextPending(ctx context.Context) (*Ticket, error)

NextPending returns the oldest pending ticket.

func (*FileStore) Stats

func (s *FileStore) Stats(ctx context.Context) (map[Status]int, error)

Stats returns ticket counts by status.

func (*FileStore) Update

func (s *FileStore) Update(ctx context.Context, ticket *Ticket) error

Update saves changes to a ticket.

type Processor

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

Processor handles ticket-to-job orchestration.

func NewProcessor

func NewProcessor(cfg *config.Config) *Processor

NewProcessor creates a new ticket processor.

func (*Processor) Process

func (p *Processor) Process(ctx context.Context, project string, ticketID string) (*Ticket, error)

Process processes a ticket by running it as a job. If ticketID is empty, processes the next pending ticket. Returns the updated ticket after processing.

type Status

type Status string

Status represents the current state of a ticket.

const (
	StatusPending    Status = "pending"
	StatusInProgress Status = "in_progress"
	StatusError      Status = "error"
	StatusCompleted  Status = "completed"
)

func AllStatuses

func AllStatuses() []Status

AllStatuses returns all valid ticket statuses.

type Store

type Store interface {
	List(ctx context.Context, status *Status) ([]Ticket, error)
	Get(ctx context.Context, id string) (*Ticket, error)
	Create(ctx context.Context, prompt string) (*Ticket, error)
	Update(ctx context.Context, ticket *Ticket) error
	Stats(ctx context.Context) (map[Status]int, error)
	NextPending(ctx context.Context) (*Ticket, error)
}

Store defines the interface for ticket storage.

type Ticket

type Ticket struct {
	ID        string    `yaml:"id"`
	Project   string    `yaml:"project"`
	Status    Status    `yaml:"status"`
	CreatedAt time.Time `yaml:"created_at"`
	JobID     string    `yaml:"job_id,omitempty"`
	Entries   []Entry   `yaml:"entries"`
}

Ticket represents a task to be processed.

func New

func New(project string) *Ticket

New creates a new ticket with a generated ID.

func (*Ticket) AddEntry

func (t *Ticket) AddEntry(entryType EntryType, author, content string)

AddEntry adds an entry to the ticket.

func (*Ticket) PromptContent

func (t *Ticket) PromptContent() string

PromptContent returns the content of the first prompt entry.

func (*Ticket) PromptPreview

func (t *Ticket) PromptPreview(maxLen int) string

PromptPreview returns a truncated preview of the prompt.

Jump to

Keyboard shortcuts

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