Initial commit: Azure DevOps TUI client
A terminal-based user interface for browsing and managing Azure DevOps work items. Features include: - Browse work items with filtering by area, iteration, state, and type - View work item details with markdown rendering - Open work items in browser - Create git branches from work items - Update work item state - Keyboard-driven navigation 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// WorkItemType represents the type of work item
|
||||
type WorkItemType string
|
||||
|
||||
const (
|
||||
WorkItemTypeStory WorkItemType = "User Story"
|
||||
WorkItemTypeTask WorkItemType = "Task"
|
||||
WorkItemTypeBug WorkItemType = "Bug"
|
||||
WorkItemTypeFeature WorkItemType = "Feature"
|
||||
WorkItemTypeEpic WorkItemType = "Epic"
|
||||
)
|
||||
|
||||
// WorkItemState represents the state of a work item
|
||||
type WorkItemState string
|
||||
|
||||
const (
|
||||
WorkItemStateNew WorkItemState = "New"
|
||||
WorkItemStateActive WorkItemState = "Active"
|
||||
WorkItemStateResolved WorkItemState = "Resolved"
|
||||
WorkItemStateClosed WorkItemState = "Closed"
|
||||
)
|
||||
|
||||
// WorkItem represents an Azure DevOps work item
|
||||
type WorkItem struct {
|
||||
ID int `json:"id"`
|
||||
Rev int `json:"rev"`
|
||||
Title string `json:"title"`
|
||||
State WorkItemState `json:"state"`
|
||||
Type WorkItemType `json:"type"`
|
||||
AssignedTo string `json:"assignedTo"`
|
||||
IterationPath string `json:"iterationPath"`
|
||||
AreaPath string `json:"areaPath"`
|
||||
Description string `json:"description"`
|
||||
Tags []string `json:"tags"`
|
||||
ParentID int `json:"parentId"`
|
||||
ParentTitle string `json:"parentTitle"`
|
||||
Priority int `json:"priority"`
|
||||
CreatedDate time.Time `json:"createdDate"`
|
||||
ChangedDate time.Time `json:"changedDate"`
|
||||
URL string `json:"url"`
|
||||
WebURL string `json:"webUrl"`
|
||||
}
|
||||
|
||||
// ShortType returns a short version of the work item type
|
||||
func (w *WorkItem) ShortType() string {
|
||||
switch w.Type {
|
||||
case WorkItemTypeStory:
|
||||
return "Story"
|
||||
case WorkItemTypeTask:
|
||||
return "Task"
|
||||
case WorkItemTypeBug:
|
||||
return "Bug"
|
||||
case WorkItemTypeFeature:
|
||||
return "Feature"
|
||||
case WorkItemTypeEpic:
|
||||
return "Epic"
|
||||
default:
|
||||
return string(w.Type)
|
||||
}
|
||||
}
|
||||
|
||||
// SprintName extracts the sprint name from the iteration path
|
||||
func (w *WorkItem) SprintName() string {
|
||||
// IterationPath is like "MyProject\\Sprint 42"
|
||||
// Return just "Sprint 42"
|
||||
for i := len(w.IterationPath) - 1; i >= 0; i-- {
|
||||
if w.IterationPath[i] == '\\' {
|
||||
return w.IterationPath[i+1:]
|
||||
}
|
||||
}
|
||||
return w.IterationPath
|
||||
}
|
||||
|
||||
// AreaName extracts the area name from the area path
|
||||
func (w *WorkItem) AreaName() string {
|
||||
for i := len(w.AreaPath) - 1; i >= 0; i-- {
|
||||
if w.AreaPath[i] == '\\' {
|
||||
return w.AreaPath[i+1:]
|
||||
}
|
||||
}
|
||||
return w.AreaPath
|
||||
}
|
||||
|
||||
// WorkItemStateInfo represents state metadata from Azure DevOps
|
||||
type WorkItemStateInfo struct {
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"`
|
||||
Category string `json:"category"` // Proposed, InProgress, Resolved, Completed, Removed
|
||||
}
|
||||
Reference in New Issue
Block a user