Skip to content

@saflib/workflows


@saflib/workflows

Interfaces

InterfaceDescription
AgentConfigWhen in "run" mode, specify which agent to use.
CdStepInputInput for the CdStepMachine.
CommandStepInputInput for the CommandStepMachine.
CopyStepInputInput for the CopyStepMachine.
ParsePackageNameInputArgument for the parsePackageName function.
ParsePackageNameOutputReturn value for the parsePackageName function.
ParsePathInputArgument for the parsePath function.
ParsePathOutputReturn value for the parsePath function.
PromptStepInputInput for the PromptStepMachine.
RunWorkflowOptionsArgument for the runWorkflow function.
RunWorkflowResultReturn value of the runWorkflow function.
UpdateStepInputInput for the UpdateStepMachine.
WorkflowArgumentRequired argument for the workflow, in a format the CLI tool (or other program) can use.
WorkflowCliOptionsOptions for configuring the workflow CLI
WorkflowDefinitionAn interface that includes everything that makes up a workflow.
WorkflowLoggerLogger interface for workflow operations
WorkflowLoggerOptionsOptions for creating a workflow logger

Type Aliases

Type AliasDescription
AgentCLIThe agent to use for the workflow.
CwdStepInputOld name
CwdStepMachineOld name
GetSourceUrlFunctionFunction type for getting source URLs from absolute file paths.
WorkflowExecutionModeThe mode to run the workflow in.
WorkflowStepA step in a workflow with an actor and its corresponding input.

Variables

VariableDescription
CdStepMachineUpdates the current working directory for subsequent steps, such as "copy", "update", and "command".
CommandStepMachineRuns a shell command as part of a workflow. Stops the workflow if the command fails.
CopyStepMachineCopies all templateFiles to the given directory, performing string replacements for directories, file names, and file contents.
PromptStepMachinePrompts the agent or user to do an arbitrary task.
UpdateStepMachinePrompts the agent to update one of the templateFiles that was copied over by the CopyStepMachine.

Functions

FunctionDescription
checklistToStringConvenience function to convert a checklist to a string.
defineWorkflowHelper, identity function to infer types.
getPackageNameReads the package.json for the given cwd and returns the package name.
makeLineReplaceCreates a line-replace function which will handle template interpolation, given a context.
makeWorkflowMachineTakes a WorkflowsDefinition, as well as its Context and Input types, and creates an XState machine.
parsePackageNameTakes a package name and returns a breakdown into conventional parts for templating.
parsePathTakes a target path to a file and breaks it down into conventional parts for templating.
runWorkflowConvenience function to take a WorkflowDefinition, run it in the specified mode, and return the output. Can be used to run a given workflow in checklist mode for a unit test. This is also used internally by the CLI tool.
runWorkflowCliGiven a list of workflow classes, runs a CLI for running workflows.
stepHelper function for defining a step in a workflow, enforcing types properly.