Documentation
¶
Index ¶
- Variables
- func AppendDomain(username, domain string) string
- func CreateCommentFile(ticketID string, author string, body string, baseDir string) (string, error)
- func GenerateCommentFilename(author string, timestamp time.Time) string
- func ParseFieldValue(fieldName, value string) (interface{}, error)
- func RemoveRelationshipFromAllFields(pmPath, sourceID, targetID string) (bool, error)
- func UpdateCommentFile(commentPath string, body string, updatedAt time.Time) error
- func UpdateRelationshipWithSymmetry(pmPath, sourceID, targetID, relType string, add bool) (bool, error)
- type Comment
- type CommentMetadata
- type FieldSpec
- type FieldType
- type Ticket
Constants ¶
This section is empty.
Variables ¶
var FieldRegistry = map[string]FieldSpec{ "labels": {Type: FieldTypeArray}, "milestones": {Type: FieldTypeArray}, "depends_on": {Type: FieldTypeArray}, "blocks": {Type: FieldTypeArray}, "related": {Type: FieldTypeArray}, "points": {Type: FieldTypeInt}, "id": {Type: FieldTypeString}, "title": {Type: FieldTypeString}, "assignee": {Type: FieldTypeString}, "parent": {Type: FieldTypeString}, "created_at": {Type: FieldTypeString}, "updated_at": {Type: FieldTypeString}, "status": {Type: FieldTypeEnum}, "type": {Type: FieldTypeEnum, AllowedValues: []string{"epic", "story", "task", "bug"}}, "priority": {Type: FieldTypeEnum, AllowedValues: []string{"low", "medium", "high", "critical"}}, }
FieldRegistry maps field names to their specifications
Functions ¶
func AppendDomain ¶
AppendDomain appends a domain suffix to a username if:
- domain is non-empty
- username does not already contain "@"
func CreateCommentFile ¶
CreateCommentFile writes a new comment file Creates the ticket comment directory if it doesn't exist Returns the relative path to the created comment file
func GenerateCommentFilename ¶
GenerateCommentFilename creates a filesystem-safe filename for a comment Format: {ISO8601-timestamp}-{author}.md Example: 2026-02-03T14-30-00Z-alice.md
func ParseFieldValue ¶
ParseFieldValue parses a string value according to the field's type
func RemoveRelationshipFromAllFields ¶
RemoveRelationshipFromAllFields removes a target ID from all relationship arrays in a ticket Used by pm unlink when no type is specified Returns (wasNotLinked, error)
func UpdateCommentFile ¶
UpdateCommentFile updates an existing comment file with a new body and updated_at timestamp. It preserves the original author and created_at fields.
func UpdateRelationshipWithSymmetry ¶
func UpdateRelationshipWithSymmetry(pmPath, sourceID, targetID, relType string, add bool) (bool, error)
UpdateRelationshipWithSymmetry manages array-based ticket relationships with automatic symmetry. For depends-on/blocks pairs, modifying one ticket automatically updates the inverse in the other. For related links, only the source ticket is modified.
Parameters:
- sourceID: The ticket being modified (e.g., GPM-5)
- targetID: The related ticket (e.g., GPM-10)
- relType: Relationship type (depends-on, blocks, related)
- add: true to add relationship, false to remove
Returns (alreadyExists, error):
- alreadyExists: true if relationship already existed (for add operations)
- error: if validation fails or file operations fail
On symmetry operation failure, rolls back the source ticket.
Types ¶
type Comment ¶
type Comment struct {
Author string `yaml:"author"`
CreatedAt time.Time `yaml:"-"` // Stored as ISO8601 string in YAML
UpdatedAt time.Time `yaml:"-"` // Stored as ISO8601 string in YAML
Body string `yaml:"-"`
Path string `yaml:"-"`
}
Comment represents a single comment on a ticket.
func ListCommentsForTicket ¶
ListCommentsForTicket returns all comments for a ticket, sorted by created_at ascending
func ParseCommentFile ¶
ParseCommentFile reads and parses a comment file Returns the metadata and body content separately
type CommentMetadata ¶
type CommentMetadata struct {
Author string `yaml:"author"`
Timestamp string `yaml:"timestamp,omitempty"` // Legacy ISO8601 format
CreatedAt string `yaml:"created_at,omitempty"` // ISO8601 format
UpdatedAt string `yaml:"updated_at,omitempty"` // ISO8601 format
}
CommentMetadata is the YAML front-matter of a comment file
type Ticket ¶
type Ticket struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Type string `yaml:"type"`
Status string `yaml:"status"`
Priority string `yaml:"priority,omitempty"`
Points int `yaml:"points,omitempty"`
Parent string `yaml:"parent,omitempty"`
DependsOn []string `yaml:"depends_on,omitempty"`
Blocks []string `yaml:"blocks,omitempty"`
Related []string `yaml:"related,omitempty"`
Labels []string `yaml:"labels,omitempty"`
Milestones []string `yaml:"milestones,omitempty"`
Assignee string `yaml:"assignee,omitempty"`
CreatedAt string `yaml:"created_at"`
UpdatedAt string `yaml:"updated_at"`
Body string `yaml:"-"`
}