workflow

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package workflow loads YAML workflow files from a tai source-repo clone and exposes them to the `tai workflow list / run` verbs.

A workflow at `<clone>/workflows/<path>.yml` is addressed by its colon-namespaced lowercased name (path segments joined with `:`). See openspec/changes/pivot-to-ai-as-code/specs/workflows/spec.md for the normative spec.

Workflows are read-only state: this package never writes to the clone, and the `tai sync` flow deliberately does not copy them into configured targets — they live in the clone and AI agents pull the markdown plan on demand via `tai workflow run`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Step

type Step struct {
	Kind string
	Name string
}

Step is one entry in a workflow's `steps:` list. `Kind` is always `skill` or `command` — `agent` is rejected at load time.

type Workflow

type Workflow struct {
	// Name is the colon-namespaced lowercased addressable name (e.g.
	// "release:cut-rc"). Two files whose names collide after
	// lowercasing are reported as a load-time warning; the
	// alphabetically-earlier source path wins.
	Name string

	// Description is the workflow's one-line summary. Empty when the
	// file did not declare a description; CLI surfaces emit
	// `(missing description)` in that case.
	Description string

	// Steps is the ordered list declared in the file. Always non-empty
	// for successfully-loaded workflows (the loader rejects files with
	// no steps via WORKFLOW_INVALID).
	Steps []Step

	// SourcePath is the absolute path to the YAML file on disk. Used
	// in warnings and error messages so the operator can find the
	// offending file quickly.
	SourcePath string
}

Workflow is a parsed `<clone>/workflows/<path>.yml` file.

func Find

func Find(workflows []Workflow, name string) (Workflow, bool)

Find returns the workflow whose Name equals name, or (Workflow{}, false) when no such workflow is loaded. Used by `tai workflow run` after Load returns.

func Load

func Load(cloneDir string, warnings io.Writer) ([]Workflow, error)

Load walks `<cloneDir>/workflows/**/*.yml` and returns the loaded workflows in alphabetical order by name. The first error encountered is returned as `*errcode.Error{Code: WORKFLOW_INVALID}`; non-fatal diagnostics (case-insensitive name collisions) are written to `warnings`.

An absent or empty `workflows/` directory is not an error — Load returns an empty slice. Callers driving `tai workflow list` use the empty result to emit the `(no workflows)` line.

The function takes a `warnings` writer rather than logging to stderr directly so tests can capture the diagnostic stream.

Jump to

Keyboard shortcuts

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