command

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: BSD-2-Clause Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const CompleteTaskCommandOperation base.CommandOperation = task.CompleteCommandOperation

CompleteTaskCommandOperation is the CQRS command operation name for task completion.

View Source
const IncrementFrontmatterCommandOperation base.CommandOperation = task.IncrementFrontmatterCommandOperation

IncrementFrontmatterCommandOperation is the CQRS command operation name for atomic field increment.

View Source
const TaskResultCommandOperation base.CommandOperation = "update"

TaskResultCommandOperation is the CQRS command operation name for task result updates.

View Source
const UpdateFrontmatterCommandOperation base.CommandOperation = task.UpdateFrontmatterCommandOperation

UpdateFrontmatterCommandOperation is the CQRS command operation name for partial frontmatter update.

Variables

This section is empty.

Functions

func NewCompleteTaskExecutor added in v0.4.0

func NewCompleteTaskExecutor(
	gitClient gitclient.GitClient,
	taskDir string,
	currentDateTime libtime.CurrentDateTimeGetter,
	m metrics.Metrics,
) cdb.CommandObjectExecutorTx

NewCompleteTaskExecutor creates a cdb.CommandObjectExecutorTx that transitions a vault task to status: completed, phase: done with a # Resolution body section carrying the recovery SHA. The watcher publishes this on a build red→green transition (spec 076).

Resolution is by task_identifier (matching the CreateCommand's deterministic UUID5). Idempotent: a task that already carries a # Resolution block is a no-op (second completion does not append a duplicate block, matching the build-fix-close-obsolete-tasks skill's existing guard).

func NewCreateTaskExecutor

func NewCreateTaskExecutor(
	gitClient gitclient.GitClient,
	taskDir string,
	vaultName string,
	currentDateTime libtime.CurrentDateTimeGetter,
	k int,
) cdb.CommandObjectExecutorTx

NewCreateTaskExecutor creates a cdb.CommandObjectExecutorTx that materializes a new vault task file for the given task_identifier. If cmd.Title passes validation the file is written at tasks/{title}.md; otherwise it falls back to tasks/{task_identifier}.md. A file that already exists at the resolved path causes ErrTaskAlreadyExists (a benign Failure on the result topic — no overwrite, no git write) UNLESS the existing file's status is terminal ("completed"/"aborted"), in which case a fresh non-terminal task is materialized at that path. Frontmatter must include "assignee" and "status"; missing fields return a wrapped validation error. Commands whose effective target vault (cmd.TargetVault or the legacy fallback) does not match vaultName are skipped without side effects (no git write, no error, no result event).

func NewIncrementFrontmatterExecutor

func NewIncrementFrontmatterExecutor(
	gitClient gitclient.GitClient,
	taskDir string,
	m metrics.Metrics,
) cdb.CommandObjectExecutorTx

NewIncrementFrontmatterExecutor creates a cdb.CommandObjectExecutorTx that atomically reads the task file, increments the named frontmatter field by delta, and commits. If trigger_count reaches an explicitly-set max_triggers the assignee is cleared and phase is preserved in the same write. An absent max_triggers means no cap: the routing assignee is never stripped on recurring tasks that accumulate trigger_count.

func NewTaskResultExecutor

func NewTaskResultExecutor(
	writer result.ResultWriter,
	retryGate PlanningRetryGate,
	vaultName string,
) cdb.CommandObjectExecutorTx

NewTaskResultExecutor creates a cdb.CommandObjectExecutorTx for update commands. Uses cdb.CommandObjectExecutorTxFunc adapter — same pattern as trading command handlers. vaultName is the controller's VAULT_NAME; a result whose target_vault frontmatter (stamped at task create, echoed by the agent) does not match is cross-vault traffic and is skipped before the write scan (no write, no not_found count, no result event).

func NewUpdateFrontmatterExecutor

func NewUpdateFrontmatterExecutor(
	gitClient gitclient.GitClient,
	taskDir string,
	m metrics.Metrics,
) cdb.CommandObjectExecutorTx

NewUpdateFrontmatterExecutor creates a cdb.CommandObjectExecutorTx that atomically reads the task file, merges only the specified key-value pairs, and commits. All other frontmatter keys are left unchanged.

Types

type PlanningRetryGate

type PlanningRetryGate interface {
	Handle(ctx context.Context, req lib.Task) (handled bool, err error)
}

PlanningRetryGate decides whether a failed pr-review planning result should be retried controller-side. Handle inspects the incoming result and the on-disk task state and, when the retry gate matches, performs the retry write (counter bump + ## Progress append + phase reset + fresh task_identifier) and returns handled=true. When the gate does not match (non-pr-review, non-planning, success/skipped, no failure marker, or counter already at cap in this prompt), it returns handled=false and the caller falls through to the default WriteResult path.

func NewPlanningRetryGate

func NewPlanningRetryGate(
	gitClient gitclient.GitClient,
	taskDir string,
	currentDateTime libtime.CurrentDateTimeGetter,
	prCommenter prcomment.PRCommenter,
	m metrics.Metrics,
) PlanningRetryGate

NewPlanningRetryGate constructs the gate.

Jump to

Keyboard shortcuts

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