condition

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package condition evaluates task execution conditions before a task is run. Conditions gate whether a task should proceed or be skipped.

Two modes are supported:

  • Shell: condition starts with "$" — the remainder is run as a shell command. Exit 0 means proceed; non-zero means skip.
  • AI: any other string — the condition text is sent to the AI provider with task context for a yes/no evaluation. "yes" means proceed; "no" means skip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// Proceed is true when the condition passes and the task should run.
	Proceed bool
	// Reason is a short human-readable explanation of the outcome.
	Reason string
}

Result is the outcome of evaluating a task condition.

func Evaluate

func Evaluate(ctx context.Context, task *pm.Task, plan *pm.Plan, p provider.Provider, opts provider.Options, workDir string) (Result, error)

Evaluate checks the task's Condition field and returns whether the task should proceed. Returns (proceed=true, reason="no condition") when the task has no condition set.

Shell conditions: condition begins with "$". The text after "$" (trimmed) is passed to "sh -c". Exit code 0 → proceed; non-zero → skip.

AI conditions: any other non-empty string. The condition is sent to the provider with task context. The response is parsed for a leading YES/NO.

Jump to

Keyboard shortcuts

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