result

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearAssigneeIfHumanReview

func ClearAssigneeIfHumanReview(merged lib.TaskFrontmatter) string

ClearAssigneeIfHumanReview enforces the spec-039 / spec-042 doctrine: when merged frontmatter has phase == "human_review", clear assignee via clearAssignee (which captures the prior assignee into previous_assignee if non-empty, then sets assignee to ""). Returns the prior assignee name (empty string when no clear happened OR when the prior assignee was already empty). This is the single chokepoint for the human_review assignee-clear invariant; both the result writer and the partial-update executor (spec 042) route through here.

func ExtractBody

func ExtractBody(ctx context.Context, content []byte) (string, error)

ExtractBody returns the file body — the bytes after the closing "---\n" delimiter. Returns an empty string if the body is empty; error if delimiters are missing.

func ExtractFrontmatter

func ExtractFrontmatter(ctx context.Context, content []byte) (string, error)

ExtractFrontmatter returns the YAML frontmatter string between the opening and closing "---" delimiters. Returns an error if delimiters are missing.

func FindTaskFilePath

func FindTaskFilePath(
	ctx context.Context,
	gitClient gitclient.GitClient,
	taskDir string,
	id lib.TaskIdentifier,
) (string, lib.TaskFrontmatter, error)

FindTaskFilePath lists files in taskDir via gitClient and returns the relative path of the .md file whose frontmatter has task_identifier == id, plus the parsed existing frontmatter. Returns ("", nil, nil) when no match is found (not an error). Returns ("", nil, err) naming both paths when more than one file carries id: the match is ambiguous, so no caller may write. Callers must check the error before treating an empty path as "not found" — the two outcomes mean opposite things.

Types

type GuardDecision added in v0.6.2

type GuardDecision struct {
	Field    string
	Kept     any
	Rejected any
}

GuardDecision records a single ownership-guard discard: the merge kept the on-disk value of a controller-owned field (or the pinned terminal status) and rejected a differing incoming value. Equal values produce no decision.

func MergeFrontmatter added in v0.6.2

func MergeFrontmatter(
	existing, incoming lib.TaskFrontmatter,
) (lib.TaskFrontmatter, []GuardDecision)

MergeFrontmatter returns a new frontmatter map with all keys from existing, overridden by all keys from incoming, then applies the field-ownership guard: controller-owned counters take the on-disk value when present on disk and are absent from the result when not; a terminal on-disk status is pinned. The returned decisions name every field whose differing incoming value was discarded (equal values produce no decision). Neither input map is modified.

type ResultWriter

type ResultWriter interface {
	WriteResult(ctx context.Context, req lib.Task) error
}

ResultWriter writes a Task back to the vault task file.

func NewResultWriter

func NewResultWriter(
	gitClient gitclient.GitClient,
	taskDir string,
	currentDateTime libtime.CurrentDateTimeGetter,
	m metrics.Metrics,
) ResultWriter

NewResultWriter creates a ResultWriter that locates task files in the vault and writes the result, committing via gitClient.

Jump to

Keyboard shortcuts

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