index

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitMode

type GitMode int
const (
	GitNone GitMode = iota
	GitOpenOnly
	GitAll
	GitTasks
)

type GitPolicy

type GitPolicy struct {
	Mode GitMode

	// TTL controls how long cached git stats are considered fresh.
	// If zero, a default is used.
	TTL time.Duration

	// Tasks is used when Mode == GitTasks.
	Tasks []string

	IncludeConflicts   bool
	IncludeIntegration bool
}

type Index

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

Index is a SQLite-backed cache of task metadata for fast queries.

The task files on disk remain the source of truth; the index can be rebuilt at any time.

func Open

func Open(path string) (*Index, error)

Open opens (or creates) the index database at path.

func OpenDefault

func OpenDefault() (*Index, error)

OpenDefault opens (or creates) the index database at .subtask/index.db.

func (*Index) Close

func (i *Index) Close() error

Close closes the underlying database connection.

func (*Index) Get

func (i *Index) Get(ctx context.Context, taskName string) (Record, bool, error)

func (*Index) ListAll

func (i *Index) ListAll(ctx context.Context) ([]ListItem, error)

func (*Index) ListClosed

func (i *Index) ListClosed(ctx context.Context) ([]ListItem, error)

func (*Index) ListOpen

func (i *Index) ListOpen(ctx context.Context) ([]ListItem, error)

func (*Index) Refresh

func (i *Index) Refresh(ctx context.Context, policy RefreshPolicy) error

Refresh updates the index from task files on disk.

It is safe to call frequently: when no files changed, Refresh performs no DB writes.

type ListItem

type ListItem struct {
	Name       string
	Title      string
	FollowUp   string
	BaseBranch string

	TaskStatus   task.TaskStatus
	WorkerStatus task.WorkerStatus
	Stage        string

	Workspace string
	StartedAt time.Time
	LastError string

	LastHistory time.Time
	LastActive  time.Time
	ToolCalls   int

	LastRunDurationMS int

	ProgressDone  int
	ProgressTotal int

	LinesAdded    int
	LinesRemoved  int
	CommitsBehind int

	IntegratedReason string
}

ListItem is a task summary record suitable for list output.

type Record

type Record struct {
	Task *task.Task

	TaskStatus   task.TaskStatus
	WorkerStatus task.WorkerStatus
	Stage        string

	State        *task.State
	ProgressMeta *task.Progress

	LastHistory time.Time

	ProgressDone  int
	ProgressTotal int

	LastRunDurationMS int

	LinesAdded        int
	LinesRemoved      int
	CommitsBehind     int
	ConflictFilesJSON string
	IntegratedReason  string
}

Record is the cached file-backed data for a single task.

type RefreshPolicy

type RefreshPolicy struct {
	Git GitPolicy
}

RefreshPolicy controls what work Refresh performs. File-backed fields are always refreshed; git refresh is optional.

Jump to

Keyboard shortcuts

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