Skip to content

@saflib/workflows


@saflib/workflows

Classes

ClassDescription
WorkflowAbstract superclass for XStateWorkflow. Can probably be removed since SimpleWorkflows are gone.
XStateWorkflowAbstract superclass for XStateWorkflows.

Interfaces

InterfaceDescription
ChecklistItemSimple checklist object. Machines should append one to the list for each state. If a state invokes another machine, add its checklist output as subitems to create a recursively generated checklist tree.
CLIArgumentRequired argument for the workflow, in a format the CLI tool (commander) can use.
ComposerFunctionOptionsOptions for all composer functions. These functions return an object which can be spread into an XState "states" object, for easily composing a workflow machine from common steps.
LogParamsParams for the log action.
RunNpmCommandFactoryOptionsOptions for the runNpmCommandComposer function.
RunTestsComposerOptionsOptions for the runTestsComposer function.
TemplateWorkflowContextThere are at least two machines which work on templates: creating and updating. These share some common context properties in addition to WorkflowContext properties.
UpdateTemplateFileComposerOptionsOptions for the updateTemplateComposer function.
WorkflowContextContext shared across all workflow machines.
WorkflowInputInputs every workflow machine receives.
WorkflowMetaWrapper around a ConcreteWorkflow class. Honestly might not be necessary and could likely be removed.
WorkflowOutputOutputs every workflow machine returns.
XStateMachineStatesState objects which can be passed into XStateMachine Actor Definitions. These are typed simply here because I'll be damned if I can figure out how to use the XState library's provided generics.

Type Aliases

Type AliasDescription
ConcreteWorkflowSome subclass of Workflow which implements all abstract methods and properties.

Variables

VariableDescription
workflowActionsCommon actions for workflow machines.
workflowActorsCommon actors for workflow machines.

Functions

FunctionDescription
contextFromInputHelper function to create initial WorkflowContext from WorkflowInput.
copyTemplateStateComposerComposer for copying template files to a target directory. Also replaces every instance "template-file", "template_file", "TemplateFile", and "templateFile" with the name of the thing being created, passed in via the CLI or other interface. To use this composer, the machine context must extend TemplateWorkflowContext.
getPackageNameUtility function to get the package name from the root URL.
logErrorAction builder for logging error messages.
logInfoAction builder for logging info messages.
outputFromContextHelper function to create WorkflowOutput from WorkflowContext.
promptAgentComposerComposer for prompting the agent. During normal execution, once a prompt is printed, the workflow will stop so it can be continued later.
runNpmCommandComposerComposer for running npm commands.
runTestsComposerComposer for running tests. Takes a specific file path to test.
runWorkflowCliUses Commander.js to run a CLI for running workflows.
updateTemplateComposerComposer for updating files copied by states from copyTemplateStateComposer. Use this to provide specific instructions on how to update each file. In addition to prompting the agent to make changes, this will block the agent from continuing until all "todo" strings are gone from the file.