Documentation
¶
Overview ¶
Package harvest turns repository backlogs into queue tasks.
It is the ingestion half of a self-managing agent pool: every repo's TODO_LIST.md is the shared, human-readable work backlog; the harvester repeatedly scans it and enqueues one agent task per open item, paced to at most one in-flight task per repo. Agents (see executor.AgentExecutor) do the item and mark it done in the same file, which closes the loop: done items are never re-enqueued, edited items become new work.
Index ¶
Constants ¶
const DefaultMaxPerTick = 10
DefaultMaxPerTick bounds how many new agent tasks one harvest run may enqueue across all repos — the cost throttle for unattended pools.
const DefaultPromptTemplate = `` /* 676-byte string literal not displayed */
DefaultPromptTemplate is the agent contract handed to Crush for each item. Placeholders: {{REPO_ABS}}, {{REPO}}, {{HEADING}}, {{ITEM}}.
const DefaultTodoFile = "TODO_LIST.md"
DefaultTodoFile is the backlog file scanned in each repository.
const DefaultType = "agent"
DefaultType is the task type harvest enqueues: the headless agent executor (executor.AgentExecutor, registered as "agent" by the tq CLI).
Variables ¶
This section is empty.
Functions ¶
func DiscoverRepos ¶
DiscoverRepos returns the depth-1 subdirectories of dir that contain the todo file, sorted by name.
Types ¶
type Config ¶
type Config struct {
// ProjectsDir is scanned (depth 1) for repos containing TodoFile.
ProjectsDir string
// Repos lists explicit repo directories; when set, ProjectsDir is ignored.
Repos []string
// Type is the task type enqueued (must match a registered executor).
Type string
// TodoFile is the backlog file name inside each repo.
TodoFile string
// MaxPerTick caps new enqueues per run across all repos.
MaxPerTick int
// MaxAttempts is the attempt budget for harvested tasks (0 = default).
MaxAttempts int
// Priority for harvested tasks.
Priority int
// PromptTemplate overrides DefaultPromptTemplate.
PromptTemplate string
// RequireClean passes the clean-tree policy through to agent payloads:
// nil = executor default (require a clean git tree), false lets agents
// run on dirty repos (scratch/fixtures only), true forces the check.
RequireClean *bool
// DryRun reports what a real run would enqueue, without writing to the
// queue. Result.Enqueued entries then carry an empty TaskID.
DryRun bool
}
Config controls one harvester.
type Enqueued ¶
type Enqueued struct {
Item Item
TaskID task.ID
Fresh bool // true when this run actually created the task
}
Enqueued records a task created (or already present) for an item.
type Harvester ¶
type Harvester struct {
// contains filtered or unexported fields
}
Harvester scans repos and enqueues agent tasks for open todo items.
type Item ¶
type Item struct {
Repo string // absolute repo path
RepoName string // project name (repo dir base name)
Heading string // nearest markdown heading above the item
Text string // the checkbox text, trimmed
Key string // stable dedup key: hash of repo name + item text
}
Item is one open checkbox found in a repo's todo file.
func ParseRepo ¶
ParseRepo extracts the open checkbox items from a repo's todo file.
Semantics: a line matching `- [ ]`/`* [ ]` (leading whitespace allowed) is an item; `- [x]`/`- [X]` are done and ignored. The nearest heading above the item (any level, text without the #s) is its Heading. Lines inside fenced code blocks are ignored, so TODO examples in documentation are never harvested. The Key changes when the item text changes, so editing an item re-arms it even if a previous task for the old wording exists.