Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureCacheReady ¶
EnsureCacheReady ensures the SQLite cache database exists and has the latest schema. This function is idempotent and safe to call before any cache operation.
It will: - Create the database and run migrations if .cache.db doesn't exist - Run any pending migrations if the schema is outdated - Return nil if the database is already up-to-date (fast path)
func RunMigrations ¶
func ShouldSync ¶
ShouldSync checks if the cache needs to be synchronized with the filesystem by comparing the last sync timestamp with the modification times of ticket files
func SyncCache ¶
SyncCache synchronizes the SQLite cache with the filesystem by scanning all ticket files and updating the database
func SyncMilestones ¶
SyncMilestones reads all milestone files from .pm/milestones/ and upserts them into the milestones cache table.
Types ¶
type CachedTicket ¶
CachedTicket is a row from the tickets cache table, used by ListTickets.
func ListTickets ¶
func ListTickets(db *sql.DB, opts ListOptions) ([]CachedTicket, error)
ListTickets queries the SQLite cache and returns tickets matching opts, ordered by updated_at descending.
type ListOptions ¶
type ListOptions struct {
// ParentFilter limits results to children of this ticket ID.
// Combined with Subtree=true it returns all descendants; otherwise direct children only.
ParentFilter string
// Subtree, when true with ParentFilter, returns all descendants via materialized-path LIKE.
// When true without ParentFilter, all tickets are returned (no parent filter at all).
Subtree bool
// IncludeStates is a whitelist of statuses. Mutually exclusive with ExcludeStates.
IncludeStates []string
// ExcludeStates is a blacklist of statuses. Mutually exclusive with IncludeStates.
ExcludeStates []string
// MilestoneFilter limits results to tickets belonging to this milestone ID.
MilestoneFilter string
// DependsOn limits results to tickets whose depends_on includes this ticket ID.
DependsOn string
// Blocks limits results to tickets that block (are depended upon by) this ticket ID.
Blocks string
// Related limits results to tickets with any relationship to this ticket ID.
Related string
}
ListOptions controls filtering in ListTickets.
type SearchOptions ¶
type SearchOptions struct {
// IncludeStates is a whitelist of statuses. Mutually exclusive with ExcludeStates.
IncludeStates []string
// ExcludeStates is a blacklist of statuses. Mutually exclusive with IncludeStates.
ExcludeStates []string
}
SearchOptions controls filtering for SearchTickets.
type SearchResult ¶
type SearchResult struct {
ID string
Title string
Type string
Status string
Snippet string // short excerpt from body around the first match; empty for id/title matches
}
SearchResult is a ticket row returned by SearchTickets, including a body snippet.
func SearchTickets ¶
func SearchTickets(db *sql.DB, query string, opts SearchOptions) ([]SearchResult, error)
SearchTickets searches the tickets cache for query across id, title, and body. Results are ordered by relevance: id match first, then title, then body.