ambler-node
Ambler Node
Follow these steps to create a new node in the nodes/ directory.
1. Gather requirements
Before writing any code, determine:
- Node name: The purpose of the node (e.g.,
retry,prompt,validate). The file will be named<name>.ts. - State shape: What fields does this node read or mutate? Every node has a minimum
Stateinterface that must include the fields it touches. - Edges: What named transitions can this node take? Define an
Edgetype (union of strings) for these names. - Utils: What side-effectful operations does the node perform? List them (e.g.,
print,readLine). Each becomes a field on theUtilstype with a production default indefaultUtils. - Behavior: What does the node do, and how does it choose which Edge to follow?
2. Create nodes/<name>.ts
Use the following structure exactly. Adhere to naming conventions.
More from argenkiwi/ambler-ts
ambler-init
Initializes a new Ambler state-machine project. Use this whenever a user wants to start a new Ambler project, bootstrap a state-machine app, or set up the Ambler folder structure — even if they just say "new project" or "set up ambler" or "create ambler folder".
13ambler-walk
Creates a complete Ambler walk — the TypeScript wiring file (walks/<name>.ts) and the Markdown spec (specs/<name>.md) — and ensures all required nodes exist. Use this whenever a user wants to add a new program or flow to an Ambler project, even if they say "new walk", "add a program", "wire up these nodes", or just describe what they want the app to do.
13ambler-test
Creates a test file for an Ambler node in the nodes/ directory. Use this whenever the user wants tests for a node — including "test this node", "add tests", "write tests for X", or any time a node is created without a corresponding test file.
12ambler-spec
Creates or updates a Markdown specification file for an Ambler walk in the specs/ directory. Use this whenever a user wants to document, plan, or describe a walk — including "write a spec", "document this walk", or "plan out the nodes" — even before any code exists.
12ambler-util
Creates or extracts utility modules into the utils/ directory of an Ambler project. Use this whenever a node's defaultUtils needs external npm/jsr dependencies, contains logic reusable across multiple nodes, or has implementations too complex to inline — even if the user just says "add a util", "extract this helper", "share this function", "create a utility", or "this code is getting too long for the node". When a user creates a node that imports an npm package or has complex async logic, proactively suggest using this skill.
9ambler-core
Creates a new Ambler core in the cores/ directory. Use this whenever the user wants to add a core, step, or state to an Ambler project — even if they phrase it as "add a step", "create a handler", or describe the behavior without using the word "core".
4