lists

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package lists provides management of structured list files across all domains. Lists are JSON files containing arrays of items with validated schemas.

Index

Constants

View Source
const (
	SourceProject   = "project"
	SourcePlaybook  = "playbook"
	SourceReference = "reference"
)

Source domain constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Service)

Option is a functional option for configuring Service

func WithEmbeddedFS

func WithEmbeddedFS(efs embed.FS) Option

WithEmbeddedFS sets the embedded reference filesystem

func WithLogger

func WithLogger(logger *logging.Logger) Option

WithLogger sets the logger for the service

func WithPlaybooksDir

func WithPlaybooksDir(dir string) Option

WithPlaybooksDir sets the playbooks directory

func WithProjectsDir

func WithProjectsDir(dir string) Option

WithProjectsDir sets the projects directory

type Service

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

Service provides list operations across all domains.

func NewService

func NewService(opts ...Option) *Service

NewService creates a new lists service with functional options.

func (*Service) AddItem

func (s *Service) AddItem(source, project, playbook, listName string, item *global.ListItem) (string, error)

AddItem adds a new item to a list. The listName parameter should be the list name without .json extension. If item.ID is empty, an ID will be auto-generated (item-001, item-002, etc.). For playbook lists, complete must be false - playbook items cannot be marked complete. Returns the assigned item ID (useful when auto-generated).

func (*Service) Copy

func (s *Service) Copy(
	fromSource, fromProject, fromPlaybook, fromListName string,
	toSource, toProject, toPlaybook, toListName string,
	sample int,
) error

Copy copies a list from one location to another. This supports copying between projects, playbooks, and reference (read-only source). The from/to list names should not include .json extension. If sample > 0, randomly selects that many items from the source list.

func (*Service) Create

func (s *Service) Create(source, project, playbook, listName, name, description string, items []global.ListItem) error

Create creates a new list. The listName parameter should be the list name without .json extension.

func (*Service) CreateTasks

func (s *Service) CreateTasks(
	taskCreator TaskCreator,
	listSource, project, playbook, listName string,
	targetProject, path string,
	titleTemplate, taskType string, priority int,
	llmModelID, instructionsFile, instructionsFileSource, instructionsText, basePrompt string,
	qaTemplate *global.QAExecution,
	sample int,
	parallel bool,
) (*global.ListCreateTasksResponse, error)

CreateTasks creates tasks from list items. The listName parameter should be the list name without .json extension. The priority parameter is reserved for future use. The qaTemplate parameter, if non-nil, enables QA for all created tasks. The sample parameter, if > 0, randomly selects that many items from the list. The parallel parameter enables parallel task execution in the created taskset.

func (*Service) Delete

func (s *Service) Delete(source, project, playbook, listName string) error

Delete deletes a list. The listName parameter should be the list name without .json extension.

func (*Service) Get

func (s *Service) Get(source, project, playbook, listName string) (*global.List, error)

Get returns the full contents of a list. The listName parameter should be the list name without .json extension.

func (*Service) GetItem

func (s *Service) GetItem(source, project, playbook, listName, itemID string) (*global.ListItem, error)

GetItem returns a single item from a list. The listName parameter should be the list name without .json extension.

func (*Service) GetSummary

func (s *Service) GetSummary(source, project, playbook, listName string, completeFilter string, offset, limit int) (*global.ListGetSummaryResponse, error)

GetSummary returns a summary of a list with paginated items. The listName parameter should be the list name without .json extension. The completeFilter parameter is only used for project lists: "true", "false", or "" (no filter).

func (*Service) List

func (s *Service) List(source, project, playbook string, offset, limit int) (*global.ListListResponse, error)

List returns all lists in the specified source.

func (*Service) RemoveItem

func (s *Service) RemoveItem(source, project, playbook, listName, itemID string) error

RemoveItem removes an item from a list. The listName parameter should be the list name without .json extension.

func (*Service) Rename

func (s *Service) Rename(source, project, playbook, listName, newListName string) error

Rename renames a list. The listName and newListName parameters should be list names without .json extension.

func (*Service) RenameItem

func (s *Service) RenameItem(source, project, playbook, listName, itemID, newItemID string) error

RenameItem renames an item's ID in a list. The listName parameter should be the list name without .json extension.

func (*Service) SearchItems

func (s *Service) SearchItems(source, project, playbook, listName, query, sourceDoc, section string, tags []string, completeFilter string, offset, limit int) (*global.ListItemSearchResponse, error)

SearchItems searches for items in a list. The listName parameter should be the list name without .json extension. The completeFilter parameter is only used for project lists: "true", "false", or "" (no filter).

func (*Service) UpdateItem

func (s *Service) UpdateItem(source, project, playbook, listName, itemID string, title, content, sourceDoc, section *string, tags []string, clearTags bool, complete *bool) error

UpdateItem updates an existing item in a list. The listName parameter should be the list name without .json extension. For playbook lists, complete cannot be set to true - playbook items cannot be marked complete.

type TaskCreator

type TaskCreator interface {
	CreateTask(project, path, title, taskType string, work *global.WorkExecution, qa *global.QAExecution) (*global.Task, error)
	GetTaskSet(project, path string) (*global.TaskSet, error)
	CreateTaskSet(project, path, title, description string, templates *global.DefaultTemplates, parallel bool, limits global.Limits, skipValidation bool, callbackURL string) (*global.TaskSet, error)
}

TaskCreator interface for creating tasks and managing tasksets (to avoid circular dependency)

Jump to

Keyboard shortcuts

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