hof flow @server (with both CUE files in the same directory, we can omit the filenames)
server.cue
packageexamplesimport"strings"server: { @flow(server)// task: get auth from external command gcp: { @task(os.Exec) cmd: ["gcloud", "auth", "print-access-token"] stdout: string key: strings.TrimSpace(stdout) } run: { @task(api.Serve) port: "8080" routes: {// simple hello route"/hello": { method: "GET" resp: { status: 200 body: "hallo chat!" } }// echo request object back as json"/jsonecho": { method: ["GET", "POST"] req: body: {} resp: json: req }// our gemini call warpped in an API"/chat": { @flow() method: "POST"// input schema req: { body: { msg: string } }// task: api call via reusable task call: _gemini & { apikey: gcp.key msg: req.body.msg }// the response to user resp: { status: 200 body: call.final.text } } } }}
We now have a workflow we can call from the CLI or as an API.
Command
hof flow help
run workflows and tasks powered by CUE
Usage:
hof flow [cue files...] [@flow/name...] [+key=value] [flags]
hof flow [command]
Aliases:
flow, f
Available Commands:
list print available flows
Flags:
-B, --bulk string exprs for inputs to run workflow in bulk mode
-F, --flow stringArray flow labels to match and run
-h, --help help for flow
-P, --parallel int global flow parallelism (default 1)
--progress print task progress as it happens
Global Flags:
...