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 ¶
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 ¶
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 ¶
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.