feed

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeDiff

func AnalyzeDiff(oldContent, newContent string) ([]FieldChange, []SubtaskChange)

AnalyzeDiff compares old and new task file content, returning detected frontmatter field changes and subtask checkbox toggles.

func BuildGitLogArgs

func BuildGitLogArgs(tasksDir string, limit int, since, scope string) []string

BuildGitLogArgs constructs git log arguments for feed queries.

func BuildGitLogArgsForFile

func BuildGitLogArgsForFile(limit int, since, taskFile string) []string

BuildGitLogArgsForFile constructs git log arguments scoped to a single task file. It uses --follow so the file's history is threaded across renames, and the initial "A" commit surfaces the task's creation event.

func EnrichEntriesWithDiffAnalysis

func EnrichEntriesWithDiffAnalysis(entries []FeedEntry, gitShowFn GitShowFunc)

EnrichEntriesWithDiffAnalysis reads task files at each commit and its parent to detect field-level changes and subtask completions.

func ExtractFrontmatterFields

func ExtractFrontmatterFields(content string) map[string]string

ExtractFrontmatterFields parses YAML frontmatter (between --- delimiters) into a map of field name to value. Only handles simple key: value lines.

func ExtractSubtasks

func ExtractSubtasks(content string) map[string]bool

ExtractSubtasks finds all markdown checkbox lines (- [ ] or - [x]) in the body (after frontmatter) and returns a map of subtask text to checked state.

func ExtractTaskIDFromPath

func ExtractTaskIDFromPath(path string) string

ExtractTaskIDFromPath extracts a task ID from a file path.

func NormalizeSince

func NormalizeSince(s string) string

NormalizeSince converts shorthand durations like "2d" or "1w" into git-compatible relative date strings like "2.days.ago" or "1.weeks.ago".

func ParseSinceTime

func ParseSinceTime(since string) time.Time

ParseSinceTime converts a since string into a time.Time cutoff.

Types

type FeedEntry

type FeedEntry struct {
	Source    string       `json:"source"`
	Hash      string       `json:"hash,omitempty"`
	Author    string       `json:"author,omitempty"`
	Timestamp time.Time    `json:"timestamp"`
	Message   string       `json:"message"`
	TaskID    string       `json:"taskID,omitempty"`
	Files     []FileChange `json:"files,omitempty"`
}

FeedEntry represents a single event in the activity feed.

func MergeEntries

func MergeEntries(a, b []FeedEntry) []FeedEntry

MergeEntries merges two slices of FeedEntry sorted by timestamp descending.

func ParseGitLogOutput

func ParseGitLogOutput(output string) []FeedEntry

ParseGitLogOutput parses the output of a git log command into FeedEntry values.

func Query

func Query(opts Options) ([]FeedEntry, error)

Query executes a feed query and returns merged, sorted entries.

func ScanWorklogEntries

func ScanWorklogEntries(tasksDir, scope, since string, verbose bool) []FeedEntry

ScanWorklogEntries finds .worklogs/*.md files under tasksDir and converts their entries into FeedEntry values with Source "worklog".

type FieldChange

type FieldChange struct {
	Field    string `json:"field"`
	OldValue string `json:"oldValue"`
	NewValue string `json:"newValue"`
}

FieldChange represents a frontmatter field that changed between two versions.

type FileChange

type FileChange struct {
	Path           string          `json:"path"`
	Status         string          `json:"status"`
	TaskID         string          `json:"taskID,omitempty"`
	TaskStatus     string          `json:"taskStatus,omitempty"`
	FieldChanges   []FieldChange   `json:"fieldChanges,omitempty"`
	SubtaskChanges []SubtaskChange `json:"subtaskChanges,omitempty"`
}

FileChange represents a file changed in a commit.

type GitLogFunc

type GitLogFunc func(tasksDir string, args []string) (string, error)

GitLogFunc is a function that runs git log with the given args.

type GitShowFunc

type GitShowFunc func(hash, path string) (string, error)

GitShowFunc is a function that retrieves file content at a given commit.

type Options

type Options struct {
	TasksDir string
	Limit    int
	Since    string
	Scope    string
	Source   string
	// TaskFile, when set, scopes the query to a single task file (path
	// relative to where git runs). Enables per-task history via --follow.
	TaskFile  string
	Verbose   bool
	GitLogFn  GitLogFunc
	GitShowFn GitShowFunc
}

Options configures a feed query.

type SubtaskChange

type SubtaskChange struct {
	Text string `json:"text"`
	Done bool   `json:"done"`
}

SubtaskChange represents a subtask checkbox that was toggled.

Jump to

Keyboard shortcuts

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