Command-line interface to download, watch and publish Mesa Automations.
npm install -g mesa-cligit clone https://github.com/shoppad/mesa-cli.git
cd mesa-cli
npm install
npm run build
npm link # Makes `mesa` available globallymesa auth loginThis opens your browser to authorize the CLI with your MESA account. Once approved, credentials are stored in ~/.mesa/config.yml.
For development environments:
mesa auth login --devcd /path/to/your/automationYour directory should contain a mesa.json file with the automation configuration.
# Download scripts from MESA
mesa pull
# Upload changes to MESA
mesa push *.js mesa.json
# Watch for changes and auto-upload
mesa watchThe CLI looks for configuration in:
./config/config.yml(local, environment-specific)./config.yml(local)~/.mesa/config/config.yml(global, environment-specific)~/.mesa/config.yml(global)
uuid: your-mesa-uuid-here
key: your-api-key-here
api_url: https://api.getmesa.com/v1/admin # optionalCreate files like ./config/development.yml or ./config/production.yml, then use:
mesa -e development push
# or
ENV=development mesa pushAuthenticate with MESA using browser-based authorization.
--dev- Use development environment (dev-mesa.theshoppad.com)
Clear stored credentials.
Show current authentication status.
Upload scripts and configuration to MESA.
mesa push # Push mesa.json
mesa push *.js # Push all .js files
mesa push script.js mesa.json # Push specific filesDownload scripts from MESA.
mesa pull # Download all scripts
mesa pull script.js # Download specific file
mesa pull all # Download all scriptsWatch for file changes and automatically upload.
mesa watch
# Press Ctrl+C to stopExport an automation with all its scripts.
mesa export my-automation-key
# Downloads mesa.json and all scriptsInstall a template from the MESA library.
mesa install shopify-to-slack
mesa install -f shopify-to-slack # Force overwriteTest an automation.
mesa test my-automation
mesa test my-automation my-trigger
mesa test my-automation -p '{"key": "value"}' # With payloadReplay a previously executed task.
mesa replay 507f1f77bcf86cd799439011List all workflows in your MESA account.
mesa workflow list # Table output
mesa workflow list --json # JSON output
mesa workflow list --search "order" # Filter by name/key
mesa workflow list --limit 10 --page 2 # Pagination
mesa workflow list --sort updated_at --sort-dir desc # Sort results| Option | Description |
|---|---|
--json |
Output as JSON |
--limit <n> |
Maximum results per page (default: 50) |
--page <n> |
Page number (1-based) |
--search <term> |
Filter by name or key |
--sort <field> |
Sort by: name, updated_at, created_at |
--sort-dir <dir> |
Sort direction: asc, desc |
Enable a workflow.
mesa workflow enable # Interactive picker
mesa workflow enable --workflow-id <id> # Specific workflow by ID
mesa workflow enable --json # JSON outputDisable a workflow.
mesa workflow disable # Interactive picker
mesa workflow disable --workflow-id <id> # Specific workflow
mesa workflow disable --workflow-id <id> --yes # Skip confirmation (CI mode)Run a full workflow test execution.
mesa workflow test # Interactive: pick workflow & payload
mesa workflow test <workflowId> # Test specific workflow
mesa workflow test --workflow-id <id> # Alternative syntax
mesa workflow test <id> --payload ./data.json # Custom payload from file
mesa workflow test <id> --default-payload # Use empty payload (skip picker)
mesa workflow test <id> --non-interactive --json # CI mode with JSON output
mesa workflow test <id> --timeout 60000 # Custom timeout (ms)| Option | Description | Default |
|---|---|---|
--workflow-id <id> |
Workflow ID or key | - |
--payload <path> |
Path to JSON payload file | - |
--default-payload |
Use empty payload | false |
--json |
Output as JSON | false |
--non-interactive |
CI mode (no prompts) | false |
--timeout <ms> |
Test timeout | 300000 |
Exit codes: 0 = success, 1 = failure
Run a step test (currently executes the full workflow).
mesa workflow step test <workflowId>
mesa workflow step test <id> --payload ./data.json
mesa workflow step test <id> --non-interactive --jsonOptions are the same as workflow test.
View recent workflow executions (runs).
mesa workflow activity # Interactive picker
mesa workflow activity --workflow-id <id> # Specific workflow
mesa workflow activity --status fail # Filter by status
mesa workflow activity --badge test # Filter by badge
mesa workflow activity --limit 10 --page 2 # Pagination
mesa workflow activity --json # JSON output| Option | Description |
|---|---|
--workflow-id <id> |
Workflow ID |
--status <status> |
Filter: ready, running, success, fail, pause, skip |
--badge <badge> |
Filter: test, replay, backfill, delayed |
--limit <n> |
Results per page (default: 25) |
--page <n> |
Page number (1-based) |
--json |
Output as JSON |
Manage debug logging for workflows.
mesa workflow debug enable <workflowId> # Enable debug logging
mesa workflow debug disable <workflowId> # Disable debug logging
mesa workflow debug status # Show all workflows with debug enabled
mesa workflow debug status <workflowId> # Check specific workflow
mesa workflow debug status --json # JSON outputNote: Debug logs require both debug=true AND logging=true on the workflow.
Check status or start a backfill (time-travel) to re-run a workflow against historical data.
mesa workflow time-travel # Interactive: check status
mesa workflow time-travel --workflow-id <id> # Check status for specific workflow
mesa workflow time-travel --workflow-id <id> --from 2024-01-01 --to 2024-01-31 # Start backfill
mesa workflow time-travel --workflow-id <id> --from 2024-01-01 --limit 100 # Limit records
mesa workflow time-travel --workflow-id <id> --from 2024-01-01 --yes # Skip confirmation| Option | Description |
|---|---|
--workflow-id <id> |
Workflow ID |
--from <date> |
Start date (YYYY-MM-DD) |
--to <date> |
End date (YYYY-MM-DD) |
--limit <n> |
Maximum records to process |
--yes |
Skip confirmation |
--json |
Output as JSON |
Create a new workflow automation interactively or from JSON input.
mesa workflow createLaunches an interactive wizard that guides you through:
- Naming your workflow
- Selecting a trigger (e.g., "Shopify - Order Created")
- Adding actions (e.g., "Slack - Send Message")
- Configuring fields with optional token insertion from previous steps
- Saving or pushing the workflow
# From a JSON file
mesa workflow create --non-interactive --input workflow.json
# From stdin
echo '{"name":"My Workflow","steps":[...]}' | mesa workflow create --non-interactive
# Output options
mesa workflow create --non-interactive --input workflow.json --json # Print JSON to stdout
mesa workflow create --non-interactive --input workflow.json --push # Push directly to MESA
mesa workflow create --non-interactive --input workflow.json --output ./my-workflow.json{
"name": "Order to Email",
"key": "order_to_email",
"steps": [
{
"type": "trigger",
"app": "shopify",
"operation_id": "orders_create",
"key": "shopify_order"
},
{
"type": "action",
"app": "email",
"operation_id": "email",
"key": "email_notification",
"fields": {
"to": "{{shopify_order.order.customer.email}}",
"subject": "Order Confirmation",
"message": "Thank you for your order {{shopify_order.order.name}}"
}
}
]
}Note: Use operation_id to specify the trigger/action type. You can find available operation IDs by running the interactive wizard or checking the MESA UI.
Use {{step_key.field.path}} to reference outputs from previous steps:
{{shopify_order.order.id}}- Order ID{{shopify_order.order.customer.email}}- Customer email{{shopify_order.order.line_items.0.sku}}- First line item SKU
View recent logs with interactive automation selection.
mesa logs # Interactive: select automation from list
mesa logs <automation-id> # Logs for specific automation ID
mesa logs <automation-id> -n 10 # Last 10 logs for automation
mesa logs -n 50 # Last 50 logs (skips interactive selection)
mesa logs -v # Verbose (show metadata)When run without arguments, shows an interactive searchable list of automations with:
- π’ Enabled / βͺ Disabled status
- Last run time for each automation
- Type to filter by name
- Option to view all logs
Clear the local cache (trigger definitions, app configs).
mesa cache clearShow cache location and size.
mesa cache status| Option | Description |
|---|---|
-e, --env <name> |
Environment (config file name) |
-a, --automation <key> |
Automation key (overrides mesa.json) |
-f, --force |
Force overwrite |
-v, --verbose |
Verbose output |
-n, --number <n> |
Number of items |
-p, --payload <json> |
JSON payload for test/logs |
- Node.js 18+
- npm 9+
npm install
npm run buildnpm run cli -- --help
npm run cli -- auth status
npm run cli -- -e development pushnpm run build:watchnpm testnpm run typecheckmesa-cli/
βββ src/
β βββ cli.ts # Main CLI entry point
β βββ generate-fields.ts # Field generator utility
β βββ commands/
β β βββ workflow/ # Workflow commands
β β βββ index.ts # Command registration
β β βββ create.ts # Create subcommand
β β βββ list.ts # List workflows
β β βββ enable.ts # Enable workflow
β β βββ disable.ts # Disable workflow
β β βββ test.ts # Run workflow test
β β βββ step-test.ts # Run step test
β β βββ activity.ts # View workflow activity
β β βββ debug.ts # Debug logging commands
β β βββ time-travel.ts # Backfill commands
β βββ lib/
β β βββ automation.ts # Automation helpers
β β βββ client.ts # HTTP client
β β βββ config.ts # Config loading
β β βββ table.ts # Table formatting utilities
β β βββ workflow-picker.ts # Interactive workflow selection
β β βββ test-picker.ts # Test payload selection
β β βββ test-runner.ts # Test execution & polling
β β βββ workflow/ # Workflow builder modules
β β βββ trigger-registry.ts # App/trigger search
β β βββ step-builder.ts # Step configuration
β β βββ token-picker.ts # Token insertion
β β βββ workflow-builder.ts # Main wizard
β β βββ serializer.ts # JSON conversion
β βββ types/
β βββ index.ts # Type definitions
βββ dist/ # Compiled output (generated)
βββ package.json
βββ tsconfig.json
The authentication flow requires the MESA web app to be running.
- Start the MESA web app Docker containers
- Use
mesa auth login --devto authenticate against dev-mesa.theshoppad.com
| Environment | App URL | API URL |
|---|---|---|
| Development | https://dev-mesa.theshoppad.com | https://dev-mesa.theshoppad.com/api |
| Production | https://app.theshoppad.com | https://api.getmesa.com/v1/admin |
Run mesa auth login to authenticate, or create a config file manually:
mkdir -p ~/.mesa
cat > ~/.mesa/config.yml << EOF
uuid: your-uuid-here
key: your-api-key-here
EOFYour API key may be expired or invalid. Run mesa auth login to re-authenticate.
If you have multiple MESA stores, the authorization page will ask you to select one.
npm version patch # or minor, major
npm publishAGPL-3.0