models

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package models defines the core domain types (Issue, Log, Handoff, WorkSession, Board, etc.) and their validation helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidPoints

func IsValidPoints(p int) bool

IsValidPoints checks if a point value is valid

func IsValidPriority

func IsValidPriority(p Priority) bool

IsValidPriority checks if a priority is valid

func IsValidStatus

func IsValidStatus(s Status) bool

IsValidStatus checks if a status is valid

func IsValidType

func IsValidType(t Type) bool

IsValidType checks if a type is valid

func ValidPoints

func ValidPoints() []int

ValidPoints returns valid Fibonacci story points

Types

type ActionLog

type ActionLog struct {
	ID           string     `json:"id"`
	SessionID    string     `json:"session_id"`
	ActionType   ActionType `json:"action_type"`
	EntityType   string     `json:"entity_type"` // issue, dependency, file_link
	EntityID     string     `json:"entity_id"`
	PreviousData string     `json:"previous_data"` // JSON snapshot before action
	NewData      string     `json:"new_data"`      // JSON snapshot after action
	Timestamp    time.Time  `json:"timestamp"`
	Undone       bool       `json:"undone"`
}

ActionLog represents a logged action that can be undone

type ActionType

type ActionType string

ActionType represents the type of action that was performed

const (
	ActionCreate                 ActionType = "create"
	ActionUpdate                 ActionType = "update"
	ActionDelete                 ActionType = "delete"
	ActionRestore                ActionType = "restore"
	ActionStart                  ActionType = "start"
	ActionReview                 ActionType = "review"
	ActionReviewApprove          ActionType = "review_approve"
	ActionReviewChangesRequested ActionType = "review_changes_requested"
	ActionCloseAfterReview       ActionType = "close_after_review"
	ActionApprove                ActionType = "approve"
	ActionReject                 ActionType = "reject"
	ActionBlock                  ActionType = "block"
	ActionUnblock                ActionType = "unblock"
	ActionClose                  ActionType = "close"
	ActionReopen                 ActionType = "reopen"
	ActionAddDep                 ActionType = "add_dependency"
	ActionRemoveDep              ActionType = "remove_dependency"
	ActionLinkFile               ActionType = "link_file"
	ActionUnlinkFile             ActionType = "unlink_file"
	ActionHandoff                ActionType = "handoff"
	ActionBoardCreate            ActionType = "board_create"
	ActionBoardDelete            ActionType = "board_delete"
	ActionBoardUpdate            ActionType = "board_update"
	ActionBoardAddIssue          ActionType = "board_add_issue"
	ActionBoardRemoveIssue       ActionType = "board_remove_issue"
	ActionBoardMoveIssue         ActionType = "board_move_issue"
	ActionBoardSetPosition       ActionType = "board_set_position"
	ActionBoardUnposition        ActionType = "board_unposition"
	ActionWorkSessionTag         ActionType = "work_session_tag"
	ActionWorkSessionUntag       ActionType = "work_session_untag"
)

type Board added in v0.8.0

type Board struct {
	ID           string     `json:"id"`
	Name         string     `json:"name"`
	Query        string     `json:"query"`      // TDQ query defining which issues appear
	IsBuiltin    bool       `json:"is_builtin"` // Cannot delete builtin boards
	ViewMode     string     `json:"view_mode"`  // "swimlanes" or "backlog"
	LastViewedAt *time.Time `json:"last_viewed_at,omitempty"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
}

Board represents a named view into issues with custom ordering

type BoardIssue added in v0.8.0

type BoardIssue struct {
	BoardID  string    `json:"board_id"`
	IssueID  string    `json:"issue_id"`
	Position int       `json:"position"`
	AddedAt  time.Time `json:"added_at"`
}

BoardIssue represents board membership with ordering

type BoardIssueView added in v0.8.0

type BoardIssueView struct {
	BoardID     string `json:"board_id"`
	Position    int    `json:"position"`     // Valid only when HasPosition is true
	HasPosition bool   `json:"has_position"` // True if explicitly positioned
	Issue       Issue  `json:"issue"`
	Category    string `json:"category"` // Computed category (ready/blocked/reviewable/etc)
}

BoardIssueView joins BoardIssue with Issue data

type Comment

type Comment struct {
	ID        string    `json:"id"`
	IssueID   string    `json:"issue_id"`
	SessionID string    `json:"session_id"`
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"created_at"`
}

Comment represents a comment on an issue

type Config

type Config struct {
	FocusedIssueID    string          `json:"focused_issue_id,omitempty"`
	ActiveWorkSession string          `json:"active_work_session,omitempty"`
	PaneHeights       [3]float64      `json:"pane_heights,omitempty"`  // Ratios for 3 horizontal panes (sum=1.0)
	FeatureFlags      map[string]bool `json:"feature_flags,omitempty"` // Experimental feature gates
	// FeatureStringFlags holds string-valued feature settings (e.g.
	// review_policy_mode = "strict"|"balanced"|"delegated"). Kept separate
	// from FeatureFlags so the bool-feature code paths stay simple and
	// string features are opt-in on a per-name basis.
	FeatureStringFlags map[string]string `json:"feature_string_flags,omitempty"`
	// Filter state for monitor
	SearchQuery   string `json:"search_query,omitempty"`
	SortMode      string `json:"sort_mode,omitempty"`   // "priority", "created", "updated"
	TypeFilter    string `json:"type_filter,omitempty"` // "epic", "task", "bug", "feature", "chore", ""
	IncludeClosed bool   `json:"include_closed,omitempty"`
	// Title validation limits
	TitleMinLength int `json:"title_min_length,omitempty"` // Default: 15
	TitleMaxLength int `json:"title_max_length,omitempty"` // Default: 100
	// GettingStartedSeen records that the Welcome/Getting Started modal has been
	// shown at least once in this project, so it is not re-shown on every monitor
	// launch. Set automatically the first time the modal is displayed.
	GettingStartedSeen bool `json:"getting_started_seen,omitempty"`
}

Config represents the local config state

type ExtendedStats added in v0.4.1

type ExtendedStats struct {
	// Counts
	Total      int
	ByStatus   map[Status]int
	ByType     map[Type]int
	ByPriority map[Priority]int

	// Timeline
	OldestOpen      *Issue
	NewestTask      *Issue
	LastClosed      *Issue
	CreatedToday    int
	CreatedThisWeek int

	// Points/velocity
	TotalPoints      int
	AvgPointsPerTask float64
	CompletionRate   float64 // closed / total created (or created + closed)

	// Activity
	TotalLogs         int
	TotalHandoffs     int
	MostActiveSession string
}

ExtendedStats holds detailed statistics for dashboard/stats displays

type FileRole

type FileRole string

FileRole represents the role of a linked file

const (
	FileRoleImplementation FileRole = "implementation"
	FileRoleTest           FileRole = "test"
	FileRoleReference      FileRole = "reference"
	FileRoleConfig         FileRole = "config"
)

type GitSnapshot

type GitSnapshot struct {
	ID         string    `json:"id"`
	IssueID    string    `json:"issue_id"`
	Event      string    `json:"event"` // start, handoff
	CommitSHA  string    `json:"commit_sha"`
	Branch     string    `json:"branch"`
	DirtyFiles int       `json:"dirty_files"`
	Timestamp  time.Time `json:"timestamp"`
}

GitSnapshot captures git state at a point in time

type Handoff

type Handoff struct {
	ID        string    `json:"id"`
	IssueID   string    `json:"issue_id"`
	SessionID string    `json:"session_id"`
	Done      []string  `json:"done,omitempty"`
	Remaining []string  `json:"remaining,omitempty"`
	Decisions []string  `json:"decisions,omitempty"`
	Uncertain []string  `json:"uncertain,omitempty"`
	Timestamp time.Time `json:"timestamp"`
}

Handoff represents a structured handoff state

type Issue

type Issue struct {
	ID                       string     `json:"id"`
	Title                    string     `json:"title"`
	Description              string     `json:"description,omitempty"`
	Status                   Status     `json:"status"`
	Type                     Type       `json:"type"`
	Priority                 Priority   `json:"priority"`
	Points                   int        `json:"points"`
	Labels                   []string   `json:"labels,omitempty"`
	ParentID                 string     `json:"parent_id,omitempty"`
	Acceptance               string     `json:"acceptance,omitempty"`
	Sprint                   string     `json:"sprint,omitempty"`
	ImplementerSession       string     `json:"implementer_session"`
	CreatorSession           string     `json:"creator_session"`
	ReviewerSession          string     `json:"reviewer_session"`
	ReviewRequestedBySession string     `json:"review_requested_by_session,omitempty"`
	ClosedBySession          string     `json:"closed_by_session,omitempty"`
	CreatedAt                time.Time  `json:"created_at"`
	UpdatedAt                time.Time  `json:"updated_at"`
	ReviewedAt               *time.Time `json:"reviewed_at,omitempty"`
	ClosedAt                 *time.Time `json:"closed_at,omitempty"`
	DeletedAt                *time.Time `json:"deleted_at,omitempty"`
	Minor                    bool       `json:"minor"`
	CreatedBranch            string     `json:"created_branch,omitempty"`
	DeferUntil               *string    `json:"defer_until,omitempty"`
	DueDate                  *string    `json:"due_date,omitempty"`
	DeferCount               int        `json:"defer_count"`
}

Issue represents a task/issue in the system

type IssueDependency

type IssueDependency struct {
	IssueID      string `json:"issue_id"`
	DependsOnID  string `json:"depends_on_id"`
	RelationType string `json:"relation_type"` // blocks, depends_on
}

IssueDependency represents issue relationships

type IssueFile

type IssueFile struct {
	ID        string    `json:"id"`
	IssueID   string    `json:"issue_id"`
	FilePath  string    `json:"file_path"`
	Role      FileRole  `json:"role"`
	LinkedSHA string    `json:"linked_sha"`
	LinkedAt  time.Time `json:"linked_at"`
}

IssueFile represents a linked file

type IssueReview added in v0.45.0

type IssueReview struct {
	ID                 string     `json:"id"`
	IssueID            string     `json:"issue_id"`
	ReviewerSession    string     `json:"reviewer_session"`
	Decision           string     `json:"decision"` // approved | changes_requested | approved_by_parent_cascade
	Summary            string     `json:"summary,omitempty"`
	RequestedBySession string     `json:"requested_by_session,omitempty"`
	CreatedAt          time.Time  `json:"created_at"`
	SupersededAt       *time.Time `json:"superseded_at,omitempty"`
	// SelfReview marks an approval that was recorded by the issue's
	// implementer-of-record (or a session with substantive implementation
	// history) acknowledging they reviewed their own work. It is an audit
	// attribute of an approved row, not a distinct decision type.
	SelfReview bool `json:"self_review"`
}

IssueReview represents a recorded review event against an issue. Reviews are append-only: a new decision supersedes the prior active review row by setting SupersededAt rather than mutating an existing entry.

type IssueSessionAction added in v0.4.26

type IssueSessionAction string

IssueSessionAction represents actions a session can take on an issue

const (
	ActionSessionCreated   IssueSessionAction = "created"
	ActionSessionStarted   IssueSessionAction = "started"
	ActionSessionUnstarted IssueSessionAction = "unstarted"
	// ActionSessionReviewed is deprecated: new writers should use the split
	// ActionSessionReviewApproved / ActionSessionReviewChangesRequested pair.
	// It remains a valid enum value so existing rows continue to scan cleanly.
	ActionSessionReviewed               IssueSessionAction = "reviewed"
	ActionSessionReviewApproved         IssueSessionAction = "review_approved"
	ActionSessionReviewChangesRequested IssueSessionAction = "review_changes_requested"
	ActionSessionClosed                 IssueSessionAction = "closed"
)

type IssueSessionHistory added in v0.4.26

type IssueSessionHistory struct {
	ID        string             `json:"id"`
	IssueID   string             `json:"issue_id"`
	SessionID string             `json:"session_id"`
	Action    IssueSessionAction `json:"action"`
	CreatedAt time.Time          `json:"created_at"`
}

IssueSessionHistory tracks all sessions that touched an issue

type Log

type Log struct {
	ID            string    `json:"id"`
	IssueID       string    `json:"issue_id"`
	SessionID     string    `json:"session_id"`
	WorkSessionID string    `json:"work_session_id,omitempty"`
	Message       string    `json:"message"`
	Type          LogType   `json:"type"`
	Timestamp     time.Time `json:"timestamp"`
}

Log represents a session log entry

type LogType

type LogType string

LogType represents the type of log entry

const (
	LogTypeProgress      LogType = "progress"
	LogTypeSecurity      LogType = "security"
	LogTypeBlocker       LogType = "blocker"
	LogTypeDecision      LogType = "decision"
	LogTypeHypothesis    LogType = "hypothesis"
	LogTypeTried         LogType = "tried"
	LogTypeResult        LogType = "result"
	LogTypeOrchestration LogType = "orchestration"
)

type Note added in v0.33.0

type Note struct {
	ID        string     `json:"id"`
	Title     string     `json:"title"`
	Content   string     `json:"content"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	Pinned    bool       `json:"pinned"`
	Archived  bool       `json:"archived"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

Note represents a freeform note (synced via sidecar)

type Priority

type Priority string

Priority represents issue priority

const (
	PriorityP0 Priority = "P0" // critical
	PriorityP1 Priority = "P1" // high
	PriorityP2 Priority = "P2" // medium (default)
	PriorityP3 Priority = "P3" // low
	PriorityP4 Priority = "P4" // none
)

func NormalizePriority added in v0.4.17

func NormalizePriority(p string) Priority

NormalizePriority converts alternate priority formats to canonical form Accepts: "0"-"4" as aliases, case-insensitive "p0"-"p4" or "P0"-"P4" Also accepts word forms: critical/highest→P0, high→P1, medium/normal→P2, low→P3, lowest/none→P4

type ReviewUndoPayload added in v0.45.0

type ReviewUndoPayload struct {
	// Issue is the post-action issue snapshot. When parsed from a legacy bare
	// Issue JSON (action pre-dates Step 2), Issue holds the whole object.
	Issue *Issue `json:"issue,omitempty"`
	// CreatedReviewID is the issue_reviews.id inserted by this action (if any).
	// Empty for actions that didn't create a review row.
	CreatedReviewID string `json:"created_review_id,omitempty"`
	// PriorActiveReviewID is the id of the review row that was active before
	// this action superseded it. Empty if no prior approval was superseded.
	PriorActiveReviewID string `json:"prior_active_review_id,omitempty"`
}

ReviewUndoPayload is the extended JSON shape used by review-aware action log entries (ActionReviewApprove, ActionReviewChangesRequested, ActionApprove, ActionCloseAfterReview). Stored in NewData alongside the serialized issue so the undo path can:

  • delete or supersede the issue_reviews row that the action created
  • restore a prior active approval review that was superseded by this action

Backward compat: when a consumer reads NewData expecting a bare Issue JSON, it can either ignore the extra fields (JSON decoders ignore unknown fields by default) or look for the "issue" sub-object. The undo path calls UnmarshalReviewUndoPayload which accepts both the extended shape and the legacy bare-Issue shape.

type Status

type Status string

Status represents issue status

const (
	StatusOpen       Status = "open"
	StatusInProgress Status = "in_progress"
	StatusBlocked    Status = "blocked"
	StatusInReview   Status = "in_review"
	StatusClosed     Status = "closed"
)

func NormalizeStatus added in v0.4.17

func NormalizeStatus(s string) Status

NormalizeStatus converts alternate status names to canonical form Accepts: "review" as alias for "in_review", hyphens converted to underscores

type Type

type Type string

Type represents issue type

const (
	TypeBug     Type = "bug"
	TypeFeature Type = "feature"
	TypeTask    Type = "task"
	TypeEpic    Type = "epic"
	TypeChore   Type = "chore"
)

func NormalizeType added in v0.4.17

func NormalizeType(t string) Type

NormalizeType converts alternate type names to canonical form Accepts: "story" as alias for "feature"

type WorkSession

type WorkSession struct {
	ID           string     `json:"id"`
	Name         string     `json:"name"`
	SessionID    string     `json:"session_id"`
	WorktreeID   string     `json:"worktree_id,omitempty"`
	WorktreeRoot string     `json:"worktree_root,omitempty"`
	RepoRoot     string     `json:"repo_root,omitempty"`
	StartedAt    time.Time  `json:"started_at"`
	EndedAt      *time.Time `json:"ended_at,omitempty"`
	StartSHA     string     `json:"start_sha,omitempty"`
	EndSHA       string     `json:"end_sha,omitempty"`
}

WorkSession represents a multi-issue work session

type WorkSessionIssue

type WorkSessionIssue struct {
	WorkSessionID string    `json:"work_session_id"`
	IssueID       string    `json:"issue_id"`
	TaggedAt      time.Time `json:"tagged_at"`
}

WorkSessionIssue links a work session to an issue

Jump to

Keyboard shortcuts

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