evoke Get started

Examples · 04 of 06

Act on the clear requests. Hold the rest for a person.

A file of requests, one per line. What is sure runs. What needs a person is queued with its ranking, and what is nobody's stays untouched. A pattern for your app, in eleven lines.

The request and the result

01

Lines in, decisions out.

The same three ops reflexes, fed a file. One line ran. One waits for a person. One fits nothing. Every line is what the terminal printed.

~/ops
$ node queue.ts < inbox.txt deployment.apps/checkout-api scaled queued · ask · "silence db-3" queued · abstain · "what is the weather like"
  1. 1A settled decision runs. The first line named everything and cleared the bar, so run() ran it.
  2. 2An ask waits for a person. «silence db-3» named no duration. The decision carries what is missing and why, so a person can answer later.
  3. 3Nothing was invented. A question about the weather fits no reflex. It is queued as an abstain, with its ranking.

The operations

02

Eleven lines around the same reflexes.

The app reads a line, decides, and runs what is settled. The reflexes are the ones from the ops example, installed beside the app as files.

inbox.txtyours
scale checkout to 6 in staging
silence db-3
what is the weather like
  1. 1decide() runs nothing. It returns a typed decision: run, confirm, ask or abstain. The app branches on it.
  2. 2Only run is acted on here. A confirm would also wait for a person in this app, since nothing answers it. Your queue decides who.
  3. 3The decision is plain data. Keep it in any queue or table. A second process can fill or confirm it later.

One boundary

03

With no terminal, a question is an exit code.

The CLI can take the same file. A line that needs an answer cannot get one from a pipe, so it exits 3 and names the command to run yourself.

evoke
$ evoke < inbox.txt
  scale service="checkout" env="staging" replicas="6"  0.90
deployment.apps/checkout-api scaled
  an ask needs a terminal  →  evoke "silence db-3"
  none 1.00 · 3 more under 0.01
[3]

Every other line is still answered. The filter exits with the first non-zero code. There is no flag that answers a question for you. Three ways in →

Before you run it

04

What this pattern needs.

The files above are the whole example. Copy them from this page.