Documentation
¶
Overview ¶
Package types defines core data structures for the arc issue tracker.
Index ¶
- Constants
- type AIAgent
- type AISession
- type BlockedIssue
- type Comment
- type CommentType
- type Dependency
- type DependencyType
- type Event
- type EventType
- type Issue
- type IssueDetails
- type IssueFilter
- type IssueType
- type Label
- type MergeResult
- type OpenChildrenError
- type Plan
- type PlanComment
- type PlanWithContent
- type Project
- type ProjectResolution
- type SortPolicy
- type Statistics
- type Status
- type WorkFilter
- type Workspace
Constants ¶
const ( PlanStatusDraft = "draft" PlanStatusInReview = "in_review" PlanStatusApproved = "approved" PlanStatusRejected = "rejected" )
Plan status constants.
const MaxPrefixLength = 15
MaxPrefixLength is the maximum allowed project prefix length. Must match project.MaxPrefixLength (kept separate to avoid circular imports).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIAgent ¶
type AIAgent struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Description string `json:"description,omitempty"`
Prompt string `json:"prompt,omitempty"`
AgentType string `json:"agent_type,omitempty"`
Model string `json:"model,omitempty"`
Status string `json:"status"`
DurationMs *int `json:"duration_ms,omitempty"`
TotalTokens *int `json:"total_tokens,omitempty"`
ToolUseCount *int `json:"tool_use_count,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
AIAgent represents a sub-agent spawned within an AI session.
type AISession ¶
type AISession struct {
ID string `json:"id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd,omitempty"`
StartedAt time.Time `json:"started_at"`
}
AISession represents an AI coding session (e.g., a Claude Code conversation).
type BlockedIssue ¶
type BlockedIssue struct {
Issue
BlockedByCount int `json:"blocked_by_count"`
BlockedBy []string `json:"blocked_by"`
}
BlockedIssue extends Issue with blocking information.
type Comment ¶
type Comment struct {
ID int64 `json:"id"`
IssueID string `json:"issue_id"`
Author string `json:"author"`
Text string `json:"text"`
CommentType CommentType `json:"comment_type"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Comment represents a comment on an issue.
type CommentType ¶ added in v0.7.0
type CommentType string
CommentType distinguishes between different comment types.
const (
CommentTypeComment CommentType = "comment"
)
func (CommentType) IsValid ¶ added in v0.7.0
func (c CommentType) IsValid() bool
IsValid checks if the comment type value is valid.
type Dependency ¶
type Dependency struct {
IssueID string `json:"issue_id"`
DependsOnID string `json:"depends_on_id"`
Type DependencyType `json:"type"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by,omitempty"`
}
Dependency represents a relationship between issues.
type DependencyType ¶
type DependencyType string
DependencyType categorizes the relationship.
const ( DepBlocks DependencyType = "blocks" DepParentChild DependencyType = "parent-child" DepRelated DependencyType = "related" DepDiscoveredFrom DependencyType = "discovered-from" )
func AllDependencyTypes ¶
func AllDependencyTypes() []DependencyType
AllDependencyTypes returns all valid dependency type values.
func (DependencyType) AffectsReadyWork ¶
func (d DependencyType) AffectsReadyWork() bool
AffectsReadyWork returns true if this dependency type blocks work.
func (DependencyType) IsValid ¶
func (d DependencyType) IsValid() bool
IsValid checks if the dependency type value is valid.
type Event ¶
type Event struct {
ID int64 `json:"id"`
IssueID string `json:"issue_id"`
EventType EventType `json:"event_type"`
Actor string `json:"actor"`
OldValue *string `json:"old_value,omitempty"`
NewValue *string `json:"new_value,omitempty"`
Comment *string `json:"comment,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Event represents an audit trail entry.
type EventType ¶
type EventType string
EventType categorizes audit trail events.
const ( EventCreated EventType = "created" EventUpdated EventType = "updated" EventStatusChanged EventType = "status_changed" EventCommented EventType = "commented" EventClosed EventType = "closed" EventReopened EventType = "reopened" EventDependencyAdded EventType = "dependency_added" EventDependencyRemoved EventType = "dependency_removed" EventLabelAdded EventType = "label_added" EventLabelRemoved EventType = "label_removed" EventMerged EventType = "merged" )
type Issue ¶
type Issue struct {
// Core Identification
ID string `json:"id"`
ProjectID string `json:"project_id"`
ParentID string `json:"parent_id,omitempty"` // For hierarchical child IDs (e.g., parent-id.1)
// Issue Content
Title string `json:"title"`
Description string `json:"description,omitempty"`
// Status & Workflow
Status Status `json:"status"`
Priority int `json:"priority"` // 0 (critical) - 4 (backlog)
Rank int `json:"rank"` // 0 = unranked (sorts last), 1+ = lower rank = work on first
IssueType IssueType `json:"issue_type"`
// Assignment
Assignee string `json:"assignee,omitempty"`
// AI Session Tracking
AISessionID string `json:"ai_session_id,omitempty"` // Claude Code session UUID
// Timestamps
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
CloseReason string `json:"close_reason,omitempty"`
// External Integration
ExternalRef string `json:"external_ref,omitempty"` // e.g., "gh-9", "jira-ABC"
// Relational Data (populated for detail views)
Labels []string `json:"labels,omitempty"`
Dependencies []*Dependency `json:"dependencies,omitempty"`
Comments []*Comment `json:"comments,omitempty"`
}
Issue represents a trackable work item.
func (*Issue) SetDefaults ¶
func (i *Issue) SetDefaults()
SetDefaults applies default values for missing fields.
type IssueDetails ¶
type IssueDetails struct {
Issue
Labels []string `json:"labels,omitempty"`
Dependencies []*Dependency `json:"dependencies,omitempty"`
Dependents []*Dependency `json:"dependents,omitempty"`
Comments []*Comment `json:"comments,omitempty"`
}
IssueDetails extends Issue with full relational data.
type IssueFilter ¶
type IssueFilter struct {
ProjectID string // Required: filter by project
Statuses []Status // Filter by statuses (multi-select, empty means all)
Priorities []int // Filter by priorities (multi-select, empty means all)
IssueTypes []IssueType // Filter by issue types (multi-select, empty means all)
Assignee *string // Filter by assignee
AISessionID *string // Filter by AI session ID
Labels []string // AND semantics: issue must have ALL these labels
ParentID string // Filter by parent issue (via parent-child dependency)
Query string // Full-text search in title/description
IDs []string // Filter by specific issue IDs
Limit int // Maximum results to return
Offset int // Pagination offset
}
IssueFilter is used to filter issue queries.
type IssueType ¶
type IssueType string
IssueType categorizes the kind of work.
func AllIssueTypes ¶
func AllIssueTypes() []IssueType
AllIssueTypes returns all valid issue type values.
type Label ¶
type Label struct {
Name string `json:"name"`
Color string `json:"color,omitempty"`
Description string `json:"description,omitempty"`
}
Label represents a global tag that can be applied to issues.
type MergeResult ¶ added in v0.12.0
type MergeResult struct {
TargetProject *Project `json:"target_project"`
IssuesMoved int `json:"issues_moved"`
SourcesDeleted []string `json:"sources_deleted"`
}
MergeResult contains the outcome of merging one or more source projects into a target.
type OpenChildrenError ¶ added in v0.11.0
type OpenChildrenError struct {
IssueID string // The issue that cannot be closed
Children []Issue // The open child issues
}
OpenChildrenError is returned when attempting to close an issue that has open child issues.
func (*OpenChildrenError) Error ¶ added in v0.11.0
func (e *OpenChildrenError) Error() string
Error implements the error interface.
type Plan ¶ added in v0.7.0
type Plan struct {
ID string `json:"id"`
FilePath string `json:"file_path"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Plan represents an ephemeral review artifact backed by a filesystem markdown file.
type PlanComment ¶
type PlanComment struct {
ID string `json:"id"`
PlanID string `json:"plan_id"`
LineNumber *int `json:"line_number,omitempty"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
}
PlanComment is a review comment on a plan, optionally anchored to a line number.
type PlanWithContent ¶
PlanWithContent combines plan metadata with the file content read from disk.
type Project ¶ added in v0.12.0
type Project struct {
ID string `json:"id"` // Short hash ID (e.g., "proj-a1b2")
Name string `json:"name"` // Display name
Description string `json:"description,omitempty"`
Prefix string `json:"prefix"` // Issue ID prefix (e.g., "bd")
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Project represents a project that contains issues. Previously named Workspace; renamed to clarify that this is the issue container.
type ProjectResolution ¶ added in v0.12.0
type ProjectResolution struct {
ProjectID string `json:"project_id"`
ProjectName string `json:"project_name"`
PathID string `json:"path_id"`
}
ProjectResolution contains the result of resolving a project by path.
type SortPolicy ¶
type SortPolicy string
SortPolicy defines how ready work should be sorted.
const ( // SortPolicyHybrid sorts recent issues (<48h) by priority/rank, older issues by age. // This prevents backlog starvation while keeping high-priority recent work visible. SortPolicyHybrid SortPolicy = "hybrid" // SortPolicyPriority always sorts by priority -> rank -> created_at. SortPolicyPriority SortPolicy = "priority" // SortPolicyOldest always sorts by created_at (oldest first) for backlog clearing. SortPolicyOldest SortPolicy = "oldest" )
func AllSortPolicies ¶
func AllSortPolicies() []SortPolicy
AllSortPolicies returns all valid sort policy values.
func (SortPolicy) IsValid ¶
func (s SortPolicy) IsValid() bool
IsValid checks if the sort policy is valid.
type Statistics ¶
type Statistics struct {
ProjectID string `json:"project_id"`
TotalIssues int `json:"total_issues"`
OpenIssues int `json:"open_issues"`
InProgressIssues int `json:"in_progress_issues"`
ClosedIssues int `json:"closed_issues"`
BlockedIssues int `json:"blocked_issues"`
DeferredIssues int `json:"deferred_issues"`
ReadyIssues int `json:"ready_issues"`
AvgLeadTimeHours float64 `json:"avg_lead_time_hours,omitempty"`
}
Statistics provides aggregate metrics for a project.
type WorkFilter ¶
type WorkFilter struct {
ProjectID string // Required: filter by project
Status *Status // Filter by status
IssueType *IssueType // Filter by issue type
Priority *int // Filter by priority
Assignee *string // Filter by assignee
Unassigned bool // Filter for unassigned issues
Labels []string // AND semantics
SortPolicy SortPolicy // Sort policy: hybrid (default), priority, oldest
Limit int // Maximum results
}
WorkFilter is used to filter ready work queries.
type Workspace ¶
type Workspace struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
Path string `json:"path"`
Label string `json:"label,omitempty"`
Hostname string `json:"hostname,omitempty"`
GitRemote string `json:"git_remote,omitempty"`
PathType string `json:"path_type,omitempty"`
LastAccessedAt *time.Time `json:"last_accessed_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Workspace represents a directory path associated with a project. Multiple workspaces can be linked to a single project to support multi-directory projects. Previously named WorkspacePath; renamed because this IS the workspace (a directory where work happens).