Repository navigation
Command Discovery
Append -o routine-step to any CLI command to output its YAML step definition instead of executing it. This is the primary way to discover command signatures for building routines — it shows you exactly how to wire a command into a routine, including which args are required and which are optional.
Without the flag, a command runs normally:
apijack pets create-pet --name "Buddy" --species dog --age 3
# Output: { "id": 6, "name": "Buddy", "species": "dog", "age": 3, "status": "available" }With -o routine-step, nothing is executed. Instead, the YAML step definition is printed:
apijack pets create-pet --name "Buddy" --species dog --age 3 -o routine-stepOutput:
- name: create-pet
command: pets create-pet
args:
--name: "Buddy"
--species: "dog"
--age: "3"Copy this directly into a routine file as a starting point.
The step output tells you everything you need to know about a command's interface.
Required args appear as active (uncommented) lines with the values you provided:
args:
--name: "Buddy"
--species: "dog"
--age: "3"Optional args appear as commented-out lines with an # optional annotation and a description of accepted values:
apijack pets list -o routine-step- name: list
command: pets list
args:
# --species: "" # optional — Filter pets by species [dog, cat, bird, fish, rabbit]
# --status: "" # optional — Filter pets by status [available, pending, adopted]To use an optional arg, uncomment the line and fill in the value. The annotations show accepted values, so you can see constraints without consulting separate documentation.
The typical workflow for authoring a new routine:
- Run the command you want with
-o routine-step - Copy the YAML output into your routine file
- Replace hardcoded values with variables (
$variable_name) - Add
output:to capture results for later steps - Connect steps with variable references (
$alias.field)
This example builds a routine that creates a pet and then retrieves it to confirm the result.
apijack pets create-pet --name "Buddy" --species dog --age 3 -o routine-step- name: create-pet
command: pets create-pet
args:
--name: "Buddy"
--species: "dog"
--age: "3"apijack pets get --id 1 -o routine-step- name: get
command: pets get
args:
--id: "1"With both signatures in hand, compose a routine. Add output: created to the first step to capture its response, then reference $created.id in the second step:
name: create-and-verify-pet
description: Create a pet and retrieve it to confirm the result
variables:
pet_name: "Buddy"
pet_species: "dog"
pet_age: "3"
steps:
- name: create-pet
command: pets create-pet
args:
--name: "$pet_name"
--species: "$pet_species"
--age: "$pet_age"
output: created
- name: get-pet
command: pets get
args:
--id: "$created.id"Run it:
apijack routine run create-and-verify-pet
# or override a variable at runtime:
apijack routine run create-and-verify-pet --set pet_name="Luna"See Writing Routines for the full routine YAML reference, including conditions, loops, and assertions.
Essentials
Using a CLI
Authoring Routines
- Writing Routines
- Variables
- Output Capture
- Conditions & Assertions
- Loops
- Error Handling
- Sub-Routines & Meta-Commands
- Routine Testing
Building a CLI
- Building a CLI
- Authentication Strategies
- Session Auth
- Project Mode
- MCP Server Integration
- Code Generation Internals
Reference