Documentation
¶
Overview ¶
Package taskfile reads and updates task markdown files on disk.
It modifies YAML frontmatter fields (status, tags, dependencies, PRs) and body content while preserving the rest of the file unchanged.
Index ¶
- func ComputeNewTags(current, addTags, removeTags []string) []string
- func FindFrontmatterBounds(lines []string) (int, int)
- func FormatInlineList(fieldName string, values []string) string
- func FormatInlineTags(tags []string) string
- func ReplaceID(filePath, newID string) error
- func ReplaceReference(filePath, oldID, newID string) error
- func RewriteTitleHeading(filePath, oldTitle, newTitle string) (bool, error)
- func UpdateTaskFile(filePath string, req UpdateRequest) error
- func ValidateUpdateRequest(req UpdateRequest, efforts effort.Scale) []string
- type Heading
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeNewTags ¶
ComputeNewTags computes the resulting tag list after additions and removals.
func FindFrontmatterBounds ¶
FindFrontmatterBounds returns the line indices of the opening and closing "---" delimiters.
func FormatInlineList ¶
FormatInlineList formats a named list field as inline YAML: field: ["a", "b"]
func FormatInlineTags ¶
FormatInlineTags formats tags as inline YAML: tags: ["a", "b"]
func ReplaceReference ¶
ReplaceReference replaces occurrences of oldID with newID in dependency and parent fields within a task file's frontmatter.
func RewriteTitleHeading ¶ added in v0.4.1
RewriteTitleHeading replaces the body's level-1 heading with newTitle, but only when the existing heading matches oldTitle. It reports whether the heading was rewritten.
A heading that has diverged from the frontmatter title is a deliberate choice by the author, so it is left alone rather than silently overwritten.
func UpdateTaskFile ¶
func UpdateTaskFile(filePath string, req UpdateRequest) error
UpdateTaskFile reads a task markdown file, applies the requested changes, and writes it back.
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(req UpdateRequest, efforts effort.Scale) []string
ValidateUpdateRequest checks enum fields and returns a list of error strings.
efforts supplies the project's effort vocabulary; pass effort.Scale{} for the default small, medium, large.
Types ¶
type Heading ¶ added in v0.4.1
type Heading struct {
Found bool // whether the body has a level-1 heading at all
Line int // 0-based line index of the heading, or -1 when not found
Text string // heading text with the leading "# " stripped
}
Heading describes the level-1 markdown heading in a task file's body — the line that conventionally mirrors the frontmatter title.
func FindTitleHeading ¶ added in v0.4.1
FindTitleHeading returns the first level-1 heading in a task file's body.
Headings inside fenced code blocks are skipped: a `# comment` line in a shell snippet is not a title.
type UpdateRequest ¶
type UpdateRequest struct {
Title *string
Status *string
Priority *string
Effort *string
Type *string
Owner *string
Parent *string
Tags *[]string // replace tags entirely
AddTags []string // add to existing tags
RemTags []string // remove from existing tags
AddPRs []string // add PR URLs
RemPRs []string // remove PR URLs
AddTouches []string // add scope identifiers to touches
RemTouches []string // remove scope identifiers from touches
Phase *string
Completed *string // completed date (YYYY-MM-DD)
CancelledAt *string // cancelled date (YYYY-MM-DD)
Dependencies *[]string // replace dependencies entirely
RemoveFields []string // field keys to remove entirely from frontmatter
Body *string
}
UpdateRequest describes which fields to update. Nil pointer means "no change".