@oalo-ai/cli 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/man/oalo.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH OALO 1 "" "oalo 0.4.2" "OALO CLI"
1
+ .TH OALO 1 "" "oalo 0.4.3" "OALO CLI"
2
2
  .SH NAME
3
3
  oalo \- wire a local app into your Oalo workspace
4
4
  .SH SYNOPSIS
@@ -7,6 +7,21 @@ oalo \- wire a local app into your Oalo workspace
7
7
  [\fIargs\fR] [\fIflags\fR]
8
8
  .SH DESCRIPTION
9
9
  The OALO command line: link a local app to an OALO workspace, deploy it, read and write its data, make tables searchable by bots, change bot settings, and run workflows. \fBoalo help <command>\fR prints the same detail as this page for one command; \fBoalo help \-\-json\fR prints all of it for a program or an agent to read.
10
+ .SH DEV AND PROD
11
+ .IP \(bu 2
12
+ Every workspace has two envs: dev (staging, a sandbox) and prod (live: what customers and live apps see). Tables and their rows, booking data, an app's variables, logs and releases are kept per env.
13
+ .IP \(bu 2
14
+ The project's default env is \fBenv\fR in .oalo/config.json, set by \fBoalo link \-\-env dev|prod\fR (default dev; \fBoalo deploy \-\-new\fR sets dev). data, db query, db tables, deploy, env, logs, run loop and typegen follow it; \-\-env on the command line wins.
15
+ .IP \(bu 2
16
+ Other commands don't read it: metrics, dashboards add, sources create and db dump default to prod; loops test always runs on dev; migrate \-\-apply writes prod; db restore needs \-\-env. MCP tools never read it: pass env in each call.
17
+ .IP \(bu 2
18
+ A draft (unpublished) bot reads and writes dev: it searches dev tables and books against dev booking data. A published bot uses prod. A test conversation (qa, run bot) uses the bot's env too, so set up a draft bot's tables and booking data in dev, and a published bot's in prod.
19
+ .IP \(bu 2
20
+ \fBoalo data promote <table>\fR copies a table's rows from dev to prod. Writing prod by hand needs \-\-env prod typed out (data push and delete, deploy, env changes).
21
+ .IP \(bu 2
22
+ Flows, loops and code tools have one copy, not one per env: a saved one is live. Loops fired by real triggers and schedules run on prod. Contacts and events have one copy too.
23
+ .IP \(bu 2
24
+ When it matters, pass \-\-env (MCP and \fBoalo call\fR: "env") every time instead of relying on a default.
10
25
  .SH COMMANDS
11
26
  .SS login
12
27
  Connect this machine to a workspace by approving it in the browser.
@@ -61,6 +76,8 @@ Exit codes: 0 connected and both checks passed; 1 a token failed, or the workspa
61
76
  .SS link
62
77
  Point this project at a workspace and save credentials.
63
78
  .PP
79
+ \fBEnv:\fR Sets the project's default env, \fBenv\fR in .oalo/config.json: \-\-env dev (staging, the default) or prod (live). Running link again without \-\-env sets it back to dev. Only data, db query, db tables, deploy, env, logs, run loop and typegen read it.
80
+ .PP
64
81
  \fBoalo link \-\-server <url> [\-\-token <sync token>] [\-\-cli\-token <token>] [\-\-app <slug>] [\-\-env dev|prod] [\-\-no\-skill]\fR
65
82
  .br
66
83
  \fBoalo link \-\-status\fR
@@ -79,7 +96,7 @@ CLI token (control plane), for tail and mcp. Optional.
79
96
  The app that deploy, env, logs, secrets and dockerfile use when you don't pass \-\-app (\fBoalo apps\fR lists them). \fBoalo deploy \-\-new\fR sets it.
80
97
  .TP
81
98
  \fB\-\-env dev|prod\fR
82
- Which schema later commands touch. Default dev.
99
+ The project's default env for the commands that read it. Default dev.
83
100
  .TP
84
101
  \fB\-\-status\fR
85
102
  Show the current link and re\-check reachability.
@@ -97,11 +114,16 @@ Exit codes: 0 linked; 1 verification failed; 2 missing or invalid arguments.
97
114
  .SS typegen
98
115
  Generate TypeScript bindings from the workspace's own schema: its models, and the workflows apps can call.
99
116
  .PP
100
- \fBoalo typegen [\-\-out <file>] [\-\-check]\fR
117
+ \fBEnv:\fR \-\-env dev|prod, else the project's env (\fBoalo link \-\-env\fR), else dev. It is stamped in the file's header, and \-\-dart writes it into .oalo/dart\-defines.json as OALO_ENV.
118
+ .PP
119
+ \fBoalo typegen [\-\-out <file>] [\-\-check] [\-\-env dev|prod]\fR
101
120
  .br
102
- \fBoalo typegen \-\-dart [\-\-out <project dir>] [\-\-check]\fR
121
+ \fBoalo typegen \-\-dart [\-\-out <project dir>] [\-\-check] [\-\-env dev|prod]\fR
103
122
  .br
104
123
  .TP
124
+ \fB\-\-env dev|prod\fR
125
+ Which env to read. Default: the project's, else dev.
126
+ .TP
105
127
  \fB\-\-out <file>\fR
106
128
  Output path. Default oalo.generated.ts. With \-\-dart, the Flutter project's root (default the current folder).
107
129
  .TP
@@ -155,7 +177,9 @@ Exit codes: 0 stopped cleanly; 1 could not connect; 2 no CLI token.
155
177
  .SS call
156
178
  Call any build\-surface event directly. The escape hatch.
157
179
  .PP
158
- \fBoalo call <event> ['<json params>']\fR
180
+ \fBEnv:\fR Doesn't add the project's env. An event that takes one reads only "env" in the params, with its own default: booking:* and metrics:query use prod, loops:run_now dev. For a draft bot's booking setup, pass "env": "dev".
181
+ .PP
182
+ \fBoalo call <event> ['<json params>' | @file.json | \-]\fR
159
183
  .br
160
184
  \fBoalo call \-\-list [text] [\-\-json]\fR
161
185
  .br
@@ -173,18 +197,24 @@ The build surface has ~500 events. First\-class commands cover the common ones;
173
197
  .IP \(bu 2
174
198
  Params are a JSON object. Org and user identity come from your token, never the params, so a call cannot exceed what you can do.
175
199
  .IP \(bu 2
200
+ Params can be inline JSON, @file.json to read that file, or \- to read stdin. With no params and input piped in, stdin is read.
201
+ .IP \(bu 2
176
202
  \-\-list comes from the server's own handlers and is filtered to what you may call, so it never goes stale. On an older workspace it falls back to a list of namespaces.
177
203
  .IP \(bu 2
178
204
  An unknown event returns a clean error naming what you sent. An event that exists but gets the wrong params says which params it takes.
179
205
  .IP \(bu 2
180
206
  Example: oalo call loops:run_now '{"name":"Nurture"}'
181
207
  .IP \(bu 2
208
+ From a file: oalo call loops:get @params.json. From stdin: jq \-n '{name: "Nurture"}' | oalo call loops:get
209
+ .IP \(bu 2
182
210
  Needs a CLI token.
183
211
  .PP
184
212
  Exit codes: 0 the call succeeded; 1 the call failed or was rejected; 2 bad arguments or no token.
185
213
  .SS run
186
214
  Fire a loop, or send a bot a test message, and watch what happens.
187
215
  .PP
216
+ \fBEnv:\fR loop: \-\-env dev|prod, else the project's env, else dev (a loop fired by its real trigger or schedule runs on prod). bot: no \-\-env; the bot uses its own env, dev while it's a draft, prod once published.
217
+ .PP
188
218
  \fBoalo run loop <name> [\-\-env dev|prod] [\-\-watch]\fR
189
219
  .br
190
220
  \fBoalo run bot <id> "<message>"\fR
@@ -197,7 +227,7 @@ Stream events after firing. Default on for bots.
197
227
  How long to watch. Default 30.
198
228
  .TP
199
229
  \fB\-\-env dev|prod\fR
200
- Which schema the loop runs against.
230
+ loop: which env's data it runs on. Default: the project's, else dev.
201
231
  .TP
202
232
  \fB\-\-app <slug>\fR
203
233
  Only for a loop pinned to one app: that app's slug (\fBoalo apps\fR) or id. Loops are org\-wide by default.
@@ -212,6 +242,8 @@ Exit codes: 0 ran, or watch window elapsed; 1 the run failed to start; 2 bad arg
212
242
  .SS emit
213
243
  Fire a domain event (form.submitted, order.created, ...) to test a loop's trigger.
214
244
  .PP
245
+ \fBEnv:\fR No \-\-env. The loops it fires run on prod (live data), as they do for a real event. To try a loop on dev data, use \fBoalo loops test\fR.
246
+ .PP
215
247
  \fBoalo emit <event type> [\-\-payload '<json>'] [\-\-contact <id>] [\-\-dry\-run] [\-\-json]\fR
216
248
  .br
217
249
  \fBoalo emit \-\-list [\-\-json]\fR
@@ -244,6 +276,8 @@ Exit codes: 0 emitted (or dry run done); 1 refused or failed; 2 bad arguments or
244
276
  .SS data
245
277
  Models and rows in this workspace: list, read, push (bulk upsert), delete, watch, promote, and make tables searchable by bots.
246
278
  .PP
279
+ \fBEnv:\fR \-\-env dev|prod, else the project's env (\fBoalo link \-\-env\fR), else dev. push and delete write prod only with \-\-env prod typed out. models create makes the model in both; promote copies its rows dev to prod; events fire on prod rows only; vectorize and keep\-from\-ai cover both envs of a model, and only the \-\-env copy of a plain table.
280
+ .PP
247
281
  \fBoalo data models [\-\-json]\fR
248
282
  .br
249
283
  \fBoalo data models create <name> \-\-field name:type [\-\-field ...] [\-\-owned\-by <field>]\fR
@@ -328,10 +362,12 @@ events, vectorize: turn it off. keep\-from\-ai: take the named fields off the li
328
362
  \fB\-\-json\fR
329
363
  Print the reply as JSON.
330
364
  .IP \(bu 2
331
- dev is a sandbox; live apps read prod. Push to dev, check it, then \fBoalo data promote <table>\fR copies dev rows to prod.
365
+ dev is a sandbox; live apps and published bots read prod, draft bots read dev. Push to dev, check it, then \fBoalo data promote <table>\fR copies dev rows to prod.
332
366
  .IP \(bu 2
333
367
  Reads use the saved data token (read\-only). Row writes use a write token limited to the tables written, made as you over the CLI token the first time you write a table and saved beside it (\fBoalo tokens list\fR shows it; it expires in 30 days).
334
368
  .IP \(bu 2
369
+ That write token is shared by every project on this machine for the workspace: writing a new table widens it to cover that table too. push and delete print the tables it covers.
370
+ .IP \(bu 2
335
371
  models create and promote run as you over the CLI token, so they follow your dashboard access.
336
372
  .IP \(bu 2
337
373
  push sends up to 1,000 rows per request, waits out the rate limit (120 writes a minute), retries network errors, and lists rows the server rejected.
@@ -350,6 +386,8 @@ Exit codes: 0 done; 1 failed, or some rows were rejected; 2 bad arguments or no
350
386
  .SS incidents
351
387
  A live app's outages and restart bursts, as Oalo's uptime check saw them, newest first.
352
388
  .PP
389
+ \fBEnv:\fR prod (the live app) only. The preview isn't checked; \fBoalo logs\fR shows it.
390
+ .PP
353
391
  \fBoalo incidents [\-\-app <slug>] [\-\-all] [\-\-json]\fR
354
392
  .br
355
393
  .TP
@@ -370,6 +408,8 @@ Exit codes: 0 no open incident; 1 an incident is open, or the request failed; 2
370
408
  .SS db
371
409
  Read an env's tables with SQL (your app's own included), dump all of an env's data as plain SQL to keep or take anywhere, or load an existing Postgres database into an env.
372
410
  .PP
411
+ \fBEnv:\fR query and tables: \-\-env dev|prod, else the project's env, else dev. dump: \-\-env, default prod, whatever the project's env is. restore: \-\-env is required.
412
+ .PP
373
413
  \fBoalo db query "<sql>" [\-\-env dev|prod] [\-\-limit <n>] [\-\-json]\fR
374
414
  .br
375
415
  \fBoalo db tables [\-\-env dev|prod]\fR
@@ -382,7 +422,7 @@ Read an env's tables with SQL (your app's own included), dump all of an env's da
382
422
  .br
383
423
  .TP
384
424
  \fB\-\-env dev|prod\fR
385
- query, tables: which env. Default the project's (dev). dump: which env's data. Default prod. restore: which env the data goes into, always on the command line.
425
+ query, tables: which env. Default the project's, else dev. dump: which env's data. Default prod. restore: which env the data goes into, always on the command line.
386
426
  .TP
387
427
  \fB\-\-limit <n>\fR
388
428
  query: rows to show. Default 100, at most 1000.
@@ -428,6 +468,8 @@ Exit codes: 0 a whole dump was written, or the restore (or check) passed; 1 refu
428
468
  .SS metrics
429
469
  A number from the workspace's data: count, sum or average over a model's rows, events or contacts, grouped or over time.
430
470
  .PP
471
+ \fBEnv:\fR A model's rows: prod (live) unless you pass \-\-env dev. The project's env is not read. Events and contacts have one copy, not one per env.
472
+ .PP
431
473
  \fBoalo metrics <model | events | contacts> [\-\-sum|\-\-avg|\-\-min|\-\-max|\-\-distinct <field>] [\-\-by <field>] [\-\-every day|week|month] [\-\-days N] [\-\-where <filter>] [\-\-json]\fR
432
474
  .br
433
475
  .TP
@@ -468,7 +510,7 @@ A model row counts at when it was created (default), last changed, or one of its
468
510
  Also the same over the window before (needs \-\-days).
469
511
  .TP
470
512
  \fB\-\-env dev|prod\fR
471
- A model's live (default) or dev data.
513
+ A model's live (prod, the default) or dev data. To count rows a test or a draft bot wrote, pass \-\-env dev.
472
514
  .TP
473
515
  \fB\-\-json\fR
474
516
  The answer as JSON.
@@ -481,6 +523,8 @@ Exit codes: 0 done; 1 the query failed; 2 bad arguments or no CLI token.
481
523
  .SS dashboards
482
524
  The workspace's dashboards, and a chart put on one (made when no dashboard has that name).
483
525
  .PP
526
+ \fBEnv:\fR add: a chart over a model reads prod (live) unless you pass \-\-env dev, and keeps reading that env. The project's env is not read. Event, contact and funnel charts have one copy.
527
+ .PP
484
528
  \fBoalo dashboards [\-\-json]\fR
485
529
  .br
486
530
  \fBoalo dashboards add <dashboard> <model | events | contacts> \-\-title "<title>" \-\-kind number|line|bars|table [metrics flags] [\-\-app <slug>] [\-\-width 1|2|3]\fR
@@ -508,12 +552,14 @@ The answer as JSON.
508
552
  .IP \(bu 2
509
553
  add runs the query first and refuses one that can't draw, then prints its numbers. It changes what everyone with access sees.
510
554
  .IP \(bu 2
511
- The flags after the model are the same as oalo metrics.
555
+ The flags after the model are the same as oalo metrics, \-\-env included.
512
556
  .PP
513
557
  Exit codes: 0 done; 1 the request failed; 2 bad arguments or no CLI token.
514
558
  .SS products
515
559
  What the workspace sells (Oalo commerce on its own Stripe account): list, create, rename, change a price, archive, and see orders.
516
560
  .PP
561
+ \fBEnv:\fR Not dev or prod: a product is on your Stripe test key, or on the live key with \-\-live. \-\-env does nothing here.
562
+ .PP
517
563
  \fBoalo products [\-\-all] [\-\-json]\fR
518
564
  .br
519
565
  \fBoalo products create <id> \-\-name "<name>" \-\-price <amount> \-\-once|\-\-monthly|\-\-yearly [\-\-trial <days>] [\-\-currency <code>] [\-\-description <text>] [\-\-live] [\-\-yes]\fR
@@ -694,6 +740,8 @@ Exit codes: 0 started, or (status, \-\-wait) built; 1 refused, the build failed,
694
740
  .SS sources
695
741
  Feeds that send Oalo rows from outside (another system, a webhook, an export), keeping only the fields you choose.
696
742
  .PP
743
+ \fBEnv:\fR create: rows go to prod (live) unless you pass \-\-env dev, and the source keeps that env (list and show name it). The project's env is not read. A \-\-bot source has no env: its documents are live at once.
744
+ .PP
697
745
  \fBoalo sources [list] [\-\-json]\fR
698
746
  .br
699
747
  \fBoalo sources create <name> \-\-from <sample.csv|.json|.jsonl> [\-\-table <new model>] [\-\-id\-field <field>] [\-\-mode upsert|snapshot] [\-\-auth bearer|hmac|url] [\-\-env dev|prod]\fR
@@ -760,7 +808,7 @@ create: each upload is the whole set, and rows it leaves out are deleted. Only f
760
808
  create: how a sender proves it's allowed. bearer (default): Authorization: Bearer <secret>. hmac: a signature header over the raw body (\-\-hmac\-header, default x\-signature; \-\-hmac\-format sha256=hex, hex or base64), for tools that sign their webhooks. url: the secret is the last part of the address, for tools that can only send to an address.
761
809
  .TP
762
810
  \fB\-\-env dev|prod\fR
763
- create: which copy of the model the rows go to. Default prod.
811
+ create: which env's copy of the table the rows go to. Default prod, whatever the project's env is.
764
812
  .TP
765
813
  \fB\-\-every <minutes>\fR
766
814
  fetch: how often Oalo fetches the address, 5 to 10080 minutes. Default 60.
@@ -815,6 +863,8 @@ Exit codes: 0 done; 1 refused, failed, or some records were rejected; 2 bad argu
815
863
  .SS bots
816
864
  The workspace's bots: the tables each can search, and every setting (knowledge, memory, model, replies, limits).
817
865
  .PP
866
+ \fBEnv:\fR No \-\-env. A bot's status (shown by \fBoalo bots\fR) picks its env: a draft searches dev tables and books against dev booking data, a published bot uses prod. Load a draft bot's data in dev.
867
+ .PP
818
868
  \fBoalo bots [\-\-json]\fR
819
869
  .br
820
870
  \fBoalo bots knowledge <bot> [\-\-json]\fR
@@ -868,6 +918,8 @@ Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
868
918
  .SS tokens
869
919
  List, create and revoke the workspace's sync tokens, for an app's own server.
870
920
  .PP
921
+ \fBEnv:\fR A token with env:dev or env:prod is locked to that env. Without one it can use either, and a Sync API request that doesn't pass ?env= gets prod.
922
+ .PP
871
923
  \fBoalo tokens list [\-\-json]\fR
872
924
  .br
873
925
  \fBoalo tokens create \-\-name <name> \-\-scope write:<table> [\-\-scope ...] [\-\-days N] [\-\-json]\fR
@@ -930,6 +982,8 @@ Exit codes: 0 done; 1 the workspace failed; 2 no CLI token.
930
982
  .SS deploy
931
983
  Send this repo's commits to an app and run them: the preview (dev) by default, the live release with \-\-env prod.
932
984
  .PP
985
+ \fBEnv:\fR \-\-env dev (the preview, the default) or prod (the live release). It follows the project's env, but prod must be typed as \-\-env prod. \-\-new always starts on dev and sets the project's env to dev.
986
+ .PP
933
987
  \fBoalo deploy [\-\-app <slug>] [\-\-env dev|prod] [\-\-allow\-dirty] [\-\-json]\fR
934
988
  .br
935
989
  \fBoalo deploy \-\-new [<name>] [\-\-name "Display name"]\fR
@@ -1002,6 +1056,8 @@ Exit codes: 0 deployed; 1 refused or failed; 2 bad arguments, no CLI token, or n
1002
1056
  .SS migrate
1003
1057
  Move an app from Heroku, Railway, Render, Fly.io or Primcloud: its Procfile, sizes, health path and variables, worked out from its files and that platform's CLI.
1004
1058
  .PP
1059
+ \fBEnv:\fR \-\-apply sets the variables on prod (the live app) only, whatever the project's env is. Set the preview's with \fBoalo env set ... \-\-env dev\fR.
1060
+ .PP
1005
1061
  \fBoalo migrate <heroku|railway|render|fly|primcloud> [\-\-from\-app <name>] [\-\-env\-file <file>] [\-\-json]\fR
1006
1062
  .br
1007
1063
  \fBoalo migrate <platform> \-\-apply [\-\-app <slug>]\fR
@@ -1037,6 +1093,8 @@ Exit codes: 0 the plan was shown, or applied; 1 a config file couldn't be read,
1037
1093
  .SS env
1038
1094
  An app's environment variables on Oalo (API keys, settings), per env: list, set, unset, rotate\-token.
1039
1095
  .PP
1096
+ \fBEnv:\fR \-\-env dev (the preview) or prod (the live app), else the project's env, else dev. Changing prod needs \-\-env prod typed out; listing it doesn't.
1097
+ .PP
1040
1098
  \fBoalo env [\-\-app <slug>] [\-\-env dev|prod] [\-\-json]\fR
1041
1099
  .br
1042
1100
  \fBoalo env set NAME=value [NAME=value ...] [\-\-secret | \-\-public] [\-\-no\-restart]\fR
@@ -1133,6 +1191,8 @@ Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
1133
1191
  .SS logs
1134
1192
  What an app's own processes printed (server, workers, release command), per env.
1135
1193
  .PP
1194
+ \fBEnv:\fR \-\-env dev (the preview) or prod (the live app), else the project's env, else dev.
1195
+ .PP
1136
1196
  \fBoalo logs [\-\-app <slug>] [\-\-env dev|prod] [\-\-process web|<worker>] [\-\-limit N] [\-\-follow] [\-\-json]\fR
1137
1197
  .br
1138
1198
  .TP
@@ -1140,7 +1200,7 @@ What an app's own processes printed (server, workers, release command), per env.
1140
1200
  The app (\fBoalo apps\fR lists them). Default: the app saved with \fBoalo link \-\-app\fR.
1141
1201
  .TP
1142
1202
  \fB\-\-env dev|prod\fR
1143
- dev is the preview, prod the live app. Default dev.
1203
+ dev is the preview, prod the live app. Default: the project's, else dev.
1144
1204
  .TP
1145
1205
  \fB\-\-process <name>\fR
1146
1206
  Only this process: web, a Procfile worker's name, release, build (a live build's output, with \-\-env prod), or oalo (Oalo's own notes).
@@ -1164,6 +1224,8 @@ Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
1164
1224
  .SS loops
1165
1225
  List the loops, test one (sends simulated), see its past runs, turn it on or off, or delete it, without pulling and pushing it.
1166
1226
  .PP
1227
+ \fBEnv:\fR test always runs on dev (staging) data, whatever the project's env is. A loop has one copy, so on, off and delete take no env, and its real runs (triggers, schedules) use prod.
1228
+ .PP
1167
1229
  \fBoalo loops list [\-\-json]\fR
1168
1230
  .br
1169
1231
  \fBoalo loops test <name> [\-\-sample latest|example] [\-\-input <json|@file.json>] [\-\-json]\fR
@@ -1207,6 +1269,8 @@ Exit codes: 0 done (a test passed); 1 refused, failed, or the test run failed; 2
1207
1269
  .SS flows
1208
1270
  Turn a chat flow on or off, or delete it, by bot and flow name, without pulling and pushing it.
1209
1271
  .PP
1272
+ \fBEnv:\fR No env: a flow has one copy. Its steps use the bot's env, dev while the bot is a draft, prod once published.
1273
+ .PP
1210
1274
  \fBoalo flows on <bot> <flow>\fR
1211
1275
  .br
1212
1276
  \fBoalo flows off <bot> <flow>\fR
@@ -1270,25 +1334,31 @@ Exit codes: 0 nothing in conflict; 1 a conflict, an invalid file, or a failed ch
1270
1334
  .SS lint
1271
1335
  Check flow and loop files without saving anything.
1272
1336
  .PP
1273
- \fBoalo lint [<file>...] [\-\-verbose] [\-\-json]\fR
1337
+ \fBoalo lint [<file or folder>...] [\-\-verbose] [\-\-json]\fR
1274
1338
  .br
1275
1339
  .TP
1276
1340
  \fB\-\-verbose\fR
1277
1341
  Also show info\-level findings.
1278
1342
  .TP
1279
1343
  \fB\-\-json\fR
1280
- One JSON object per file: {path, findings}.
1344
+ One JSON object per file: {path, findings}, plus a note for a tool file.
1281
1345
  .IP \(bu 2
1282
1346
  The same checks the server runs before a strict save: node types and keys against the catalog, required settings, edges and conditions, references between steps, and tools the flow or loop calls.
1283
1347
  .IP \(bu 2
1284
1348
  Each finding names the node, what is wrong and how to fix it.
1285
1349
  .IP \(bu 2
1350
+ A folder means every flow, loop and tool file inside it, e.g. oalo lint .oalo/loops.
1351
+ .IP \(bu 2
1352
+ A tool file isn't linted: its code is compiled and checked when you push it.
1353
+ .IP \(bu 2
1286
1354
  Needs a CLI token.
1287
1355
  .PP
1288
1356
  Exit codes: 0 no errors (warnings allowed); 1 errors found; 2 no token.
1289
1357
  .SS push
1290
1358
  Lint and save edited flow, loop and tool files, guarded against concurrent edits.
1291
1359
  .PP
1360
+ \fBEnv:\fR No env: flows, loops and tools have one copy, and a save is live at once. There is no dev copy to push to first.
1361
+ .PP
1292
1362
  \fBoalo push [<file>...] [\-\-dry\-run] [\-\-no\-strict] [\-\-force] [\-\-all] [\-\-verbose]\fR
1293
1363
  .br
1294
1364
  .TP
@@ -1321,6 +1391,8 @@ Exit codes: 0 every file saved; 1 a file was refused, in conflict, or failed; 2
1321
1391
  .SS qa
1322
1392
  Run a scripted test conversation with a bot and print the transcript.
1323
1393
  .PP
1394
+ \fBEnv:\fR No \-\-env. The bot uses its own env: a draft reads and writes dev (tables, bookings), a published bot prod, in a test too. Set up a draft bot's data in dev before testing it.
1395
+ .PP
1324
1396
  \fBoalo qa <bot> "<message>" ["<message>" ...] [\-\-channel web|whatsapp|instagram|sms] [\-\-flow <name>] [\-\-timeout <s>] [\-\-json]\fR
1325
1397
  .br
1326
1398
  \fBoalo qa <bot> \-\-script <file.json>\fR
@@ -1346,7 +1418,11 @@ Print the whole run as JSON: turns (replies, flow state, ms, settled), flow_path
1346
1418
  .IP \(bu 2
1347
1419
  The conversation is a preview with no phone number or external id: the inbox leaves it out and nothing is sent to WhatsApp, Instagram or SMS.
1348
1420
  .IP \(bu 2
1349
- Everything else is real: the bot's tools and flows run, collected contact details are saved, handoffs happen. Use a test bot, or flows whose side effects you are fine repeating.
1421
+ Everything else is real: the bot's tools and flows run and handoffs happen. Use a test bot, or flows whose side effects you are fine repeating.
1422
+ .IP \(bu 2
1423
+ qa only sends text. It can't fill in or submit a web form or tap a widget, so test those steps in the dashboard's chat preview.
1424
+ .IP \(bu 2
1425
+ Contact details the bot collects reach a contact only when the test chat has one linked. On whatsapp and sms the test contact is removed when the run ends.
1350
1426
  .IP \(bu 2
1351
1427
  Each message waits until the bot settles (no new message and no running flow), then the next is sent. Any flow still active at the end is cancelled and the conversation is closed.
1352
1428
  .IP \(bu 2
@@ -1358,6 +1434,8 @@ Exit codes: 0 every turn settled; 1 a turn timed out or the run failed; 2 bad ar
1358
1434
  .SS rehearse
1359
1435
  Rehearse inbound WhatsApp conversations end to end: routing, triage and the bot's reply.
1360
1436
  .PP
1437
+ \fBEnv:\fR No \-\-env. The bot that answers uses its own env: dev while it's a draft, prod once published.
1438
+ .PP
1361
1439
  \fBoalo rehearse [\-\-number <phone_number_id>] [\-\-responder <bot_...>] [\-\-timeout <s>] [\-\-json]\fR
1362
1440
  .br
1363
1441
  \fBoalo rehearse \-\-script <file.json>\fR
@@ -1413,6 +1491,8 @@ Exit codes: 0 installed or printed.
1413
1491
  .SS mcp
1414
1492
  Serve the workspace over MCP on stdio, for Claude Code or Cursor.
1415
1493
  .PP
1494
+ \fBEnv:\fR The tools never read the project's env. oalo_read_rows, oalo_list_models and oalo_db_query default to dev; oalo_query_metrics and dashboard widgets to prod; oalo_write_rows needs env. Pass env in each call.
1495
+ .PP
1416
1496
  \fBoalo mcp\fR
1417
1497
  .br
1418
1498
  .IP \(bu 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oalo-ai/cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Wire a local app into your OALO workspace: link a token, generate typed bindings, and serve the build surface over MCP.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,8 @@ description: Build and change an Oalo workspace (the person's Oalo Base) from th
8
8
  Oalo runs chatbots, chat flows, loops (background automations) and code tools in
9
9
  the cloud. You edit their definitions locally and push them; they run on the
10
10
  server. A push is a deploy: a saved flow or loop is live for real customers the
11
- moment it saves, with no staging copy. (Data and apps do have two: dev and prod.)
11
+ moment it saves, with no staging copy. (Data, booking data and apps do have two
12
+ envs: dev, which is staging, and prod, which is live. See rule 9.)
12
13
 
13
14
  Don't guess a command, flag or endpoint: `oalo help <command>` has every flag,
14
15
  `oalo docs --search "<words>"` finds Oalo's own pages, and `oalo call --list
@@ -66,8 +67,11 @@ Over MCP the same steps are `oalo_node_catalog`, `oalo_get_flow` / `oalo_get_loo
66
67
  the first message even while it's off, so test a new flow before anyone
67
68
  turns it on.
68
69
  7. **Test conversations do real work.** They never reach a customer's phone,
69
- but the bot's tools and flows run: contact details are saved, handoffs
70
- happen. Use a test bot, or flows whose side effects are fine to repeat.
70
+ but the bot's tools and flows run and handoffs happen. Use a test bot, or
71
+ flows whose side effects are fine to repeat. `oalo qa` only sends text: it
72
+ can't fill in a web form or tap a widget. Collected contact details reach a
73
+ contact only when the test chat has one linked, and a WhatsApp or SMS test
74
+ contact is removed when the run ends.
71
75
  Test a loop with `oalo loops test <name>`: sends are simulated.
72
76
  To test a loop's trigger, `oalo emit <event> --dry-run` (MCP: `oalo_emit`
73
77
  with `dry_run`) lists the loops an event would fire. Without `--dry-run` it
@@ -76,13 +80,27 @@ Over MCP the same steps are `oalo_node_catalog`, `oalo_get_flow` / `oalo_get_loo
76
80
  8. **Customer-facing words are product copy.** Keep the bot's language and
77
81
  tone, and never show customers internal names: SKUs, codes, step ids, tool
78
82
  names.
83
+ 9. **Know which env each step uses: dev is staging, prod is live.** A draft
84
+ (unpublished) bot reads and writes dev: it searches dev tables and books
85
+ against dev booking data. A published bot uses prod, in a test conversation
86
+ too. So setup for a draft bot goes to dev: rows with `oalo data push ...
87
+ --env dev`, booking types and hours with `"env": "dev"` (the booking events
88
+ default to prod). `oalo loops test` runs on dev; loops fired by real
89
+ triggers, `oalo emit` included, run on prod. `oalo metrics`, `oalo
90
+ dashboards add`, `oalo sources create` and `oalo db dump` default to prod;
91
+ data, db query, deploy, env, logs and run loop use the project's env from
92
+ `oalo link --env` (default dev); MCP tools never read it. When it matters,
93
+ don't rely on a default: pass `--env` (MCP and `oalo call`: `"env"`) every
94
+ time. Each command's `Env:` line in `oalo help <command>` says what it uses.
95
+ `oalo data promote <table>` copies rows dev to prod, only when the person
96
+ wants them live.
79
97
 
80
98
  ## Flows and loops differ
81
99
 
82
100
  | | Chat flow | Loop |
83
101
  |---|---|---|
84
102
  | First step | `graph.entry` (required) | `entry` if set, else the first node no edge points to |
85
- | Reading an earlier step | `{{state.<id>.<field>}}` | `{{<id>.<field>}}`; the previous step is `{{input}}` |
103
+ | Reading an earlier step | `{{<id>.<field>}}` (`{{state.<id>.<field>}}` still works) | `{{<id>.<field>}}`; the previous step is `{{input}}` |
86
104
  | Several conditions match | the first match wins | every match is followed |
87
105
  | No condition matches, no default edge | the flow ends quietly | the run fails |
88
106
  | Action settings | keys on the node | inside `params` |
@@ -187,7 +205,9 @@ Over MCP: `oalo_list_models`, `oalo_create_model`, `oalo_read_rows`,
187
205
  2. **Always give rows an id** (`--id-field`), usually the source system's own
188
206
  key. Then sending a row again updates it instead of adding a copy.
189
207
  3. **Write to dev, check, then promote.** Rows written to prod sync to live apps
190
- at once, so writing there needs `--env prod` and the person's go-ahead.
208
+ at once, so writing there needs `--env prod` and the person's go-ahead. A
209
+ draft bot reads dev and a published one prod, so load rows where the bot
210
+ you're testing reads them (rule 9).
191
211
  4. **For an app's own server** (mirroring its database into Oalo, reading data
192
212
  out): a server app hosted on Oalo already has `OALO_URL` and
193
213
  `OALO_SYNC_TOKEN` in its environment, locked to its own env's data. Use
@@ -389,7 +409,9 @@ oalo dashboards add Sales orders --title "Revenue by plan" --kind bars --sum tot
389
409
  ```
390
410
 
391
411
  1. **A question about numbers** (how many, how much, per week): `oalo metrics`
392
- (MCP `oalo_query_metrics`). Don't read rows and add them up.
412
+ (MCP `oalo_query_metrics`). Don't read rows and add them up. A model's rows
413
+ are counted in prod unless you pass `--env dev` (MCP `"env": "dev"`), so
414
+ rows from tests and draft bots need `--env dev`, on a chart too.
393
415
  2. **A chart the person wants to keep** goes on a dashboard with `oalo
394
416
  dashboards add` (MCP `oalo_save_dashboard_widget`); the dashboard is made
395
417
  when none has that name. Check `oalo dashboards` first: the same title
@@ -412,7 +434,8 @@ oalo channels # WhatsApp, Instagram, emai
412
434
 
413
435
  1. **To make a bot answer from a table,** vectorize the table, then attach it
414
436
  with `oalo bots knowledge`. Attaching alone does nothing for a table that
415
- isn't searchable.
437
+ isn't searchable. The rows must be in the env the bot reads: dev while it's
438
+ a draft, prod once published (`oalo bots` shows its status).
416
439
  2. **Read a setting with `--explain` before changing it.** Don't guess keys or
417
440
  values.
418
441
  3. **A published bot is live for customers.** `set` on one shows the change and
@@ -171,7 +171,9 @@ async function settings(ch, args, flags) {
171
171
 
172
172
  if (flags.explain) {
173
173
  const { settings: spec } = await ch.call("chat:bots:settings", {});
174
- const key = typeof flags.explain === "string" ? flags.explain : botId;
174
+ const asked = typeof flags.explain === "string" ? flags.explain : botId;
175
+ // `all` (as the help offers) means every setting, like no key.
176
+ const key = asked === "all" ? undefined : asked;
175
177
  const pick = key ? spec.filter((s) => s.key === key || s.key.startsWith(`${key}.`) || s.group === key) : spec;
176
178
  if (!pick.length) return fail(`no setting ${key}. \`oalo bots settings --explain\` lists them all.`, 2);
177
179
  if (flags.json) return void console.log(JSON.stringify(pick, null, 2));
@@ -1,3 +1,4 @@
1
+ import { readFileSync, fstatSync } from "node:fs";
1
2
  import { OaloChannel } from "../channel.js";
2
3
  import { resolve as resolveConfig, controlPlane, HOW_TO_CONNECT } from "../config.js";
3
4
  import { requireFeature } from "../server.js";
@@ -119,6 +120,63 @@ function printNamespaces() {
119
120
  );
120
121
  }
121
122
 
123
+ /**
124
+ * The params for a call: inline JSON, `@file.json` (that file), or `-` (stdin).
125
+ * With no argument, stdin is read only when something is piped or redirected
126
+ * into it (a FIFO or a file), so a bare call never waits on a terminal or on
127
+ * /dev/null. Errors name where the JSON came from.
128
+ */
129
+ export async function readParams(raw, { stdin = process.stdin, piped = stdinPiped() } = {}) {
130
+ let text;
131
+ let from;
132
+ if (raw === "-" || (raw === undefined && piped)) {
133
+ from = "stdin";
134
+ text = await readAll(stdin);
135
+ if (raw === undefined && !text.trim()) return {};
136
+ } else if (typeof raw === "string" && raw.startsWith("@")) {
137
+ const path = raw.slice(1);
138
+ if (!path) throw new Error("@ needs a file name: oalo call <event> @params.json");
139
+ from = path;
140
+ try {
141
+ text = readFileSync(path, "utf8");
142
+ } catch (e) {
143
+ throw new Error(`can't read params file ${path}: ${e.code === "ENOENT" ? "no such file" : e.code || e.message}`);
144
+ }
145
+ } else if (raw === undefined || raw === "") {
146
+ return {};
147
+ } else {
148
+ from = null;
149
+ text = raw;
150
+ }
151
+
152
+ let params;
153
+ try {
154
+ params = JSON.parse(text);
155
+ } catch (e) {
156
+ throw new Error(from ? `params in ${from} must be valid JSON: ${e.message}` : `params must be valid JSON: ${e.message}`);
157
+ }
158
+ if (params === null || typeof params !== "object" || Array.isArray(params)) {
159
+ throw new Error(from ? `params in ${from} must be a JSON object` : "params must be a JSON object");
160
+ }
161
+ return params;
162
+ }
163
+
164
+ function stdinPiped() {
165
+ try {
166
+ const s = fstatSync(0);
167
+ return s.isFIFO() || s.isFile();
168
+ } catch {
169
+ return false;
170
+ }
171
+ }
172
+
173
+ async function readAll(stream) {
174
+ let text = "";
175
+ stream.setEncoding?.("utf8");
176
+ for await (const chunk of stream) text += chunk;
177
+ return text;
178
+ }
179
+
122
180
  export async function call(flags, rest) {
123
181
  if (flags.list || flags.namespaces) {
124
182
  await list(flags, rest);
@@ -127,27 +185,19 @@ export async function call(flags, rest) {
127
185
 
128
186
  const event = rest[1];
129
187
  if (!event) {
130
- console.error("usage: oalo call <event> ['<json params>']\n");
188
+ console.error("usage: oalo call <event> ['<json params>' | @file.json | -]\n");
131
189
  console.error("Run `oalo call --list` to see the events you can call.");
132
190
  process.exitCode = 2;
133
191
  return;
134
192
  }
135
193
 
136
- let params = {};
137
- const raw = rest[2];
138
- if (raw) {
139
- try {
140
- params = JSON.parse(raw);
141
- } catch (e) {
142
- console.error(`params must be valid JSON: ${e.message}`);
143
- process.exitCode = 2;
144
- return;
145
- }
146
- if (params === null || typeof params !== "object" || Array.isArray(params)) {
147
- console.error("params must be a JSON object");
148
- process.exitCode = 2;
149
- return;
150
- }
194
+ let params;
195
+ try {
196
+ params = await readParams(rest[2]);
197
+ } catch (e) {
198
+ console.error(e.message);
199
+ process.exitCode = 2;
200
+ return;
151
201
  }
152
202
 
153
203
  const cfg = resolveConfig(flags);
@@ -14,6 +14,7 @@ import {
14
14
  writeGraphFile,
15
15
  removeFile,
16
16
  listGraphFiles,
17
+ expandTargets,
17
18
  locallyModified,
18
19
  standing,
19
20
  rel,
@@ -129,11 +130,11 @@ function botKey(bots, flow) {
129
130
  return bot?.public_bot_id || String(flow.bot_id);
130
131
  }
131
132
 
132
- /** Resolve the files a command acts on: the ones named, or every file. */
133
+ /** Resolve the files a command acts on: the ones named (a folder means the files in it), or every file. */
133
134
  function targetFiles(rest) {
134
135
  const named = rest.slice(1);
135
136
  if (named.length === 0) return listGraphFiles();
136
- return named.map((p) => resolvePath(p));
137
+ return expandTargets(named.map((p) => resolvePath(p)));
137
138
  }
138
139
 
139
140
  function load(path) {
@@ -311,15 +312,18 @@ export async function status(flags, rest) {
311
312
 
312
313
  // ---- lint ------------------------------------------------------------------
313
314
 
314
- export async function lint(flags, rest) {
315
+ // Lint has no check for a tool's code: it is compiled when pushed.
316
+ export const TOOL_NOT_LINTED = "not checked by lint: a tool's code is compiled and checked when you push it";
317
+
318
+ export async function lint(flags, rest, opts = {}) {
315
319
  const paths = targetFiles(rest);
316
320
  if (paths.length === 0) {
317
- console.error("no flow or loop files under .oalo/. Run `oalo pull` first, or name a file.");
321
+ console.error(rest.length > 1 ? `no flow, loop or tool files in ${rest.slice(1).join(", ")}` : "no flow or loop files under .oalo/. Run `oalo pull` first, or name a file.");
318
322
  process.exitCode = 1;
319
323
  return;
320
324
  }
321
325
 
322
- const ws = await openWorkspace(flags, "lint").catch((e) => (console.error(`lint failed: ${e.message}`), null));
326
+ const ws = await openWorkspace(flags, "lint", opts).catch((e) => (console.error(`lint failed: ${e.message}`), null));
323
327
  if (!ws) return void (process.exitCode = process.exitCode || 2);
324
328
  const { ch } = ws;
325
329
  let errors = 0;
@@ -332,6 +336,11 @@ export async function lint(flags, rest) {
332
336
  errors++;
333
337
  continue;
334
338
  }
339
+ if (file.kind === "tool") {
340
+ if (flags.json) console.log(JSON.stringify({ path: rel(path), findings: [], note: TOOL_NOT_LINTED }));
341
+ else console.log(`${rel(path)}\n ${TOOL_NOT_LINTED}`);
342
+ continue;
343
+ }
335
344
  const findings = await lintFile(ch, file);
336
345
  if (flags.json) {
337
346
  console.log(JSON.stringify({ path: rel(path), findings }));
@@ -545,7 +554,9 @@ const describeTrigger = (t) =>
545
554
  .join(" ");
546
555
 
547
556
  export async function push(flags, rest) {
548
- const explicit = rest.length > 1;
557
+ // A file named directly is pushed even when unchanged; the files in a named
558
+ // folder are pushed only when changed, like a bare push.
559
+ const named = new Set(rest.slice(1).map((p) => resolvePath(p)));
549
560
  const paths = targetFiles(rest);
550
561
  if (paths.length === 0) {
551
562
  console.error("no flow or loop files under .oalo/. Run `oalo pull` first, or name a file.");
@@ -568,7 +579,7 @@ export async function push(flags, rest) {
568
579
  continue;
569
580
  }
570
581
  // Without named files, push only what changed (or is new).
571
- if (!explicit && !locallyModified(file) && !flags.all) continue;
582
+ if (!named.has(path) && !locallyModified(file) && !flags.all) continue;
572
583
 
573
584
  console.log(`${rel(path)}`);
574
585
  const r = await pushOne(ch, path, file, flags);