@oalo-ai/cli 0.6.0 → 0.8.0
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 +80 -21
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/skills/oalo/SKILL.md +90 -25
- package/src/bot-settings.json +2 -2
- package/src/commands/db.js +110 -11
- package/src/commands/heal.js +141 -0
- package/src/commands/skill.js +15 -5
- package/src/coord-release.json +9 -9
- package/src/help.js +52 -18
- package/src/index.js +4 -0
- package/src/mcp/describe.js +1 -1
- package/src/mcp/tools.js +32 -5
- package/src/serve/model.js +7 -1
package/man/oalo.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH OALO 1 "" "oalo 0.
|
|
1
|
+
.TH OALO 1 "" "oalo 0.8.0" "OALO CLI"
|
|
2
2
|
.SH NAME
|
|
3
3
|
oalo \- wire a local app into your Oalo workspace
|
|
4
4
|
.SH SYNOPSIS
|
|
@@ -396,6 +396,39 @@ vectorize sends the text of the chosen fields to the embedding provider (Voyage)
|
|
|
396
396
|
keep\-from\-ai names fields a bot's data tools (data_search, data_related, table_search, search) leave out of what they hand its AI model, and that can't be embedded. They're still stored, synced to your apps, and read by workflows. A field that's embedded now has to be vectorized away first. With no fields, the list.
|
|
397
397
|
.PP
|
|
398
398
|
Exit codes: 0 done; 1 failed, or some rows were rejected; 2 bad arguments or no token.
|
|
399
|
+
.SS heal
|
|
400
|
+
Inspect runtime errors, run/suggest integration tests, and run or approve self\-healing patches (Base or \-\-local).
|
|
401
|
+
.PP
|
|
402
|
+
\fBoalo heal list \-\-app <slug> [\-\-json]\fR
|
|
403
|
+
.br
|
|
404
|
+
\fBoalo heal inspect <error_id> [\-\-json]\fR
|
|
405
|
+
.br
|
|
406
|
+
\fBoalo heal run <error_id> [\-\-local] [\-\-mode branch_and_pr|diagnose_only|auto_deploy]\fR
|
|
407
|
+
.br
|
|
408
|
+
\fBoalo heal approve|reject <heal_id>\fR
|
|
409
|
+
.br
|
|
410
|
+
\fBoalo heal tests \-\-app <slug> [\-\-env dev|prod]\fR
|
|
411
|
+
.br
|
|
412
|
+
\fBoalo heal suggest\-tests \-\-app <slug> [\-\-auto]\fR
|
|
413
|
+
.br
|
|
414
|
+
.TP
|
|
415
|
+
\fB\-\-app <slug>\fR
|
|
416
|
+
The app. Default: the one saved with \fBoalo link \-\-app\fR.
|
|
417
|
+
.TP
|
|
418
|
+
\fB\-\-local\fR
|
|
419
|
+
Download the error bundle and switch to a local fix branch instead of running on the Base.
|
|
420
|
+
.TP
|
|
421
|
+
\fB\-\-auto\fR
|
|
422
|
+
Apply suggested tests immediately into .oalo/tests/smoke.json.
|
|
423
|
+
.TP
|
|
424
|
+
\fB\-\-json\fR
|
|
425
|
+
Raw JSON output.
|
|
426
|
+
.IP \(bu 2
|
|
427
|
+
Runs on the Base by default (opening a Forgejo PR in branch_and_pr mode), or pass \-\-local to download the error bundle and patch on your own machine.
|
|
428
|
+
.IP \(bu 2
|
|
429
|
+
High\-risk diffs (auth, migrations, billing, >5 files, >200 lines) always require explicit \fBoalo heal approve\fR or Dashboard 1\-click approval.
|
|
430
|
+
.PP
|
|
431
|
+
Exit codes: 0 done; 1 failed or failing tests; 2 bad arguments or no token.
|
|
399
432
|
.SS incidents
|
|
400
433
|
A live app's outages and restart bursts, as Oalo's uptime check saw them, newest first.
|
|
401
434
|
.PP
|
|
@@ -419,32 +452,50 @@ Each one says what was seen: which process, how many restarts, a memory kill wit
|
|
|
419
452
|
.PP
|
|
420
453
|
Exit codes: 0 no open incident; 1 an incident is open, or the request failed; 2 bad arguments or no CLI token.
|
|
421
454
|
.SS db
|
|
422
|
-
Read
|
|
455
|
+
Read tables with SQL (including isolated app schemas), inspect schemas and cross\-app grants, share one app's tables with another app, dump an env as SQL, or restore an existing Postgres database.
|
|
423
456
|
.PP
|
|
424
|
-
\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.
|
|
457
|
+
\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. schemas, grant and revoke cover both dev and prod.
|
|
425
458
|
.PP
|
|
426
|
-
\fBoalo db query "<sql>" [\-\-env dev|prod] [\-\-limit <n>] [\-\-json]\fR
|
|
459
|
+
\fBoalo db query "<sql>" [\-\-env dev|prod] [\-\-app <slug>] [\-\-limit <n>] [\-\-json]\fR
|
|
460
|
+
.br
|
|
461
|
+
\fBoalo db tables [\-\-env dev|prod] [\-\-app <slug>]\fR
|
|
462
|
+
.br
|
|
463
|
+
\fBoalo db schemas [\-\-json]\fR
|
|
427
464
|
.br
|
|
428
|
-
\fBoalo db
|
|
465
|
+
\fBoalo db grant <owner\-app|workspace> \-\-to <grantee\-app> [\-\-read\-only]\fR
|
|
429
466
|
.br
|
|
430
|
-
\fBoalo db
|
|
467
|
+
\fBoalo db revoke <owner\-app|workspace> \-\-from <grantee\-app>\fR
|
|
431
468
|
.br
|
|
432
|
-
\fBoalo db
|
|
469
|
+
\fBoalo db dump [\-\-env dev|prod] [\-\-app <slug>] [\-\-out <file.sql>] [\-\-force]\fR
|
|
433
470
|
.br
|
|
434
|
-
\fBoalo db restore
|
|
471
|
+
\fBoalo db restore <file> \-\-env dev|prod [\-\-app <slug>] [\-\-schema <name>] [\-\-check] [\-\-yes]\fR
|
|
472
|
+
.br
|
|
473
|
+
\fBoalo db restore \-\-from\-env <VAR> \-\-env dev|prod [\-\-app <slug>] [\-\-schema <name>] [\-\-check] [\-\-yes]\fR
|
|
435
474
|
.br
|
|
436
475
|
.TP
|
|
437
476
|
\fB\-\-env dev|prod\fR
|
|
438
477
|
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.
|
|
439
478
|
.TP
|
|
479
|
+
\fB\-\-app <slug>\fR
|
|
480
|
+
Target a specific server app's isolated schema (\fBapp_<slug>_dev\fR / \fBapp_<slug>_prod\fR) instead of the shared workspace schema (\fBdev\fR / \fBprod\fR).
|
|
481
|
+
.TP
|
|
482
|
+
\fB\-\-to <grantee\-app>\fR
|
|
483
|
+
grant: the app slug receiving SQL access to the owner's schema.
|
|
484
|
+
.TP
|
|
485
|
+
\fB\-\-from <grantee\-app>\fR
|
|
486
|
+
revoke: the app slug whose access to the owner's schema is removed.
|
|
487
|
+
.TP
|
|
488
|
+
\fB\-\-read\-only\fR
|
|
489
|
+
grant: allow SELECT only (default is read/write: SELECT, INSERT, UPDATE, DELETE).
|
|
490
|
+
.TP
|
|
440
491
|
\fB\-\-limit <n>\fR
|
|
441
492
|
query: rows to show. Default 100, at most 1000.
|
|
442
493
|
.TP
|
|
443
494
|
\fB\-\-json\fR
|
|
444
|
-
query
|
|
495
|
+
query, schemas, grant, revoke: structured JSON output.
|
|
445
496
|
.TP
|
|
446
497
|
\fB\-\-out <file.sql>\fR
|
|
447
|
-
Where to write it. Default <workspace
|
|
498
|
+
Where to write it. Default <workspace>\-[<app>\-]<env>\-<date>.sql here.
|
|
448
499
|
.TP
|
|
449
500
|
\fB\-\-force\fR
|
|
450
501
|
Replace the file if it exists.
|
|
@@ -461,17 +512,21 @@ restore: do everything but the write, and report what would happen. Nothing is w
|
|
|
461
512
|
\fB\-\-yes\fR
|
|
462
513
|
restore: go ahead with prod without asking. Needed for prod when there's no terminal to ask at.
|
|
463
514
|
.IP \(bu 2
|
|
464
|
-
|
|
515
|
+
New imported/created server apps get isolated schemas (\fBapp_<slug>_dev\fR and \fBapp_<slug>_prod\fR) with their own Postgres login, so multiple apps can each keep their own \fBproducts\fR, \fBorders\fR, \fBusers\fR or ORM migrations without colliding. Existing shared apps stay in \fBdev\fR/\fBprod\fR.
|
|
516
|
+
.IP \(bu 2
|
|
517
|
+
Sharing data across apps without duplication: (1) for shared business data (users, CRM, commerce, Oalo models), have both apps call Oalo's Sync/platform APIs with their injected \fBOALO_URL\fR and \fBOALO_SYNC_TOKEN\fR; (2) when App B needs direct SQL read/write on App A's app\-specific tables, run \fBoalo db grant <app\-a> \-\-to <app\-b>\fR (or \fB\-\-read\-only\fR). Postgres grants privileges on current and future tables in both dev and prod, and App B receives \fBAPP_SCHEMA_<APP_A>\fR and \fBOALO_SHARED_SCHEMAS\fR in its environment so it can query \fB"${process.env.APP_SCHEMA_<APP_A>}".<table>\fR without hardcoding dev/prod. Pass \fBworkspace\fR as the owner to grant direct SQL access to the workspace's \fBdev\fR/\fBprod\fR schema.
|
|
465
518
|
.IP \(bu 2
|
|
466
|
-
|
|
519
|
+
query reads only: one statement (SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW), run as the env's (or \fB\-\-app\fR's) database login in a read\-only transaction that is rolled back, with a 10 second limit. \fBoalo data\fR is for Oalo models; this is for any table, your app's own included. Available to workspace admins and members with Developer access.
|
|
520
|
+
.IP \(bu 2
|
|
521
|
+
dump is workspace admins only: without \fB\-\-app\fR, it dumps the workspace schema plus every isolated app schema for that env; with \fB\-\-app <slug>\fR, it dumps only that app's schema. Restore it into any Postgres with psql \-f.
|
|
467
522
|
.IP \(bu 2
|
|
468
523
|
Your code is in git (oalo deploy \-\-pull); this is the data. Together they are everything you need to run your apps elsewhere.
|
|
469
524
|
.IP \(bu 2
|
|
470
|
-
restore loads a dump file made by pg_dump (like Heroku's latest.dump), up to 10 GB, or copies from a database URL. Admins only, and one restore at a time per Base.
|
|
525
|
+
restore loads a dump file made by pg_dump (like Heroku's latest.dump), up to 10 GB, or copies from a database URL. Admins only, and one restore at a time per Base. Pass \fB\-\-app <slug>\fR to restore directly into an isolated server app's schema.
|
|
471
526
|
.IP \(bu 2
|
|
472
|
-
The tables land in the
|
|
527
|
+
The tables land in the target schema, owned by the app's database login, so its Procfile \fBrelease:\fR migrations can alter them. Your app reads them at DATABASE_URL.
|
|
473
528
|
.IP \(bu 2
|
|
474
|
-
It's refused if a table name already exists there, and the names are listed. A failed restore leaves the
|
|
529
|
+
It's refused if a table name already exists there, and the names are listed. A failed restore leaves the target schema as it was.
|
|
475
530
|
.IP \(bu 2
|
|
476
531
|
The URL is never a flag value, since that stays in your shell history. Put it in a variable and pass \-\-from\-env VAR.
|
|
477
532
|
.IP \(bu 2
|
|
@@ -968,7 +1023,9 @@ A source is a table made searchable with \fBoalo data vectorize <table> \-\-fiel
|
|
|
968
1023
|
.IP \(bu 2
|
|
969
1024
|
The same as ticking a table in the bot's Knowledge pane in the dashboard, with the same access as there.
|
|
970
1025
|
.IP \(bu 2
|
|
971
|
-
settings go through the dashboard's own actions, with the same checks and access. A change sets only the settings it names: the model without the provider keeps the provider, one limit keeps the others, one context.* key keeps the rest of the context config.
|
|
1026
|
+
settings go through the dashboard's own actions, with the same checks and access. A change sets only the settings it names: the model without the provider keeps the provider (except a provider/model id with a slash, which automatically sets provider=opencode), one limit keeps the others, one context.* key keeps the rest of the context config.
|
|
1027
|
+
.IP \(bu 2
|
|
1028
|
+
Pick a bot's model with \fBoalo bots settings <bot> set model=<tier\-or\-id>\fR, for example \fBbalanced\fR, \fBgoogle/gemini\-4\-argon\fR, \fBbedrock/us.amazon.ergo\-1.0\fR, \fBopenrouter/thinkingmachines/inkling\-2\-mini\fR, \fBopenrouter/deepseek/deepseek\-v4.1\-flash\fR, \fBclaude\-sonnet\-4\-6\fR, or a \fBbyo\-...\fR own model. Run \fBoalo docs ai\-steps\-and\-providers\fR for the full hosted model table.
|
|
972
1029
|
.IP \(bu 2
|
|
973
1030
|
Every setting is described in \fBman oalo\fR (BOT SETTINGS) and by \fBoalo bots settings \-\-explain\fR.
|
|
974
1031
|
.IP \(bu 2
|
|
@@ -1262,13 +1319,15 @@ The Oalo app the variables go to. Default: the app this folder is linked to (oal
|
|
|
1262
1319
|
\fB\-\-json\fR
|
|
1263
1320
|
The plan as JSON: names only, never a value.
|
|
1264
1321
|
.IP \(bu 2
|
|
1265
|
-
Run it in the app's repo.
|
|
1322
|
+
Run it in the app's repo. Your existing host keeps serving traffic with zero downtime until you point DNS at Oalo.
|
|
1323
|
+
.IP \(bu 2
|
|
1324
|
+
It reads fly.toml, railway.json or railway.toml, render.yaml, app.json and the Procfile, and asks the platform's CLI for variables (heroku, railway), secret names (fly) and dyno sizes (heroku) when it's installed and signed in.
|
|
1266
1325
|
.IP \(bu 2
|
|
1267
1326
|
Variables: PORT and each platform's own (HEROKU_*, RAILWAY_*, RENDER_*, FLY_*) are left out, and DATABASE_URL becomes EXTERNAL_DATABASE_URL, since DATABASE_URL on Oalo is the Base's own Postgres. Values are never printed or written to a file; \-\-apply sends them to prod without restarting the app.
|
|
1268
1327
|
.IP \(bu 2
|
|
1269
|
-
It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large.
|
|
1328
|
+
It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large (2 CPUs, 4 GB).
|
|
1270
1329
|
.IP \(bu 2
|
|
1271
|
-
|
|
1330
|
+
Exact execution order: (1) Ensure Node apps have a committed lockfile (package\-lock.json, yarn.lock or pnpm\-lock.yaml) and a Procfile \fBweb:\fR line listening on $PORT (or package.json start). (2) Run \fBoalo migrate <platform> [\-\-from\-app <name>]\fR to inspect the plan and warnings. (3) Run \fBoalo migrate <platform> [\-\-from\-app <name>] \-\-apply\fR to write Procfile / .oalo/app.json with mapped sizes. (4) Commit those files (\fBgit add Procfile .oalo/app.json && git commit\fR). (5) Run \fBoalo deploy \-\-new <slug>\fR to create the app and dev preview (if deploy updates .gitignore, commit .gitignore). (6) Run \fBoalo migrate <platform> [\-\-from\-app <name>] \-\-apply\fR a second time to push prod variables now that the app exists. (7) Optionally move Postgres with \fBoalo db restore \-\-from\-env SOURCE_DATABASE_URL \-\-env prod \-\-check\fR then without \fB\-\-check\fR, unset EXTERNAL_DATABASE_URL, and run \fBoalo deploy \-\-app <slug> \-\-env prod\fR. See \fBoalo docs migrating\-from\-<platform>\fR.
|
|
1272
1331
|
.PP
|
|
1273
1332
|
Exit codes: 0 the plan was shown, or applied; 1 a config file couldn't be read, or the variables couldn't be set; 2 bad arguments, an unknown platform, or no CLI token.
|
|
1274
1333
|
.SS env
|
|
@@ -2223,12 +2282,12 @@ Values: true or false. Default: false.
|
|
|
2223
2282
|
.SS model
|
|
2224
2283
|
.TP
|
|
2225
2284
|
\fBmodel\fR
|
|
2226
|
-
The AI model this bot answers with. default: the workspace's default model.
|
|
2285
|
+
The AI model this bot answers with: a tier (cheap, balanced, max), a hosted id (for example google/gemini\-4\-argon, bedrock/us.amazon.ergo\-1.0, openrouter/thinkingmachines/inkling\-2\-mini, openrouter/deepseek/deepseek\-v4\-pro, openrouter/deepseek/deepseek\-v4.1\-flash, claude\-sonnet\-4\-6), or an own model id (byo\-...). Any provider/model id with a slash automatically sets provider=opencode. default: the workspace's default model. See \fBoalo docs ai\-steps\-and\-providers\fR for the full list.
|
|
2227
2286
|
.br
|
|
2228
2287
|
Values: text, or default. Default: default.
|
|
2229
2288
|
.TP
|
|
2230
2289
|
\fBprovider\fR
|
|
2231
|
-
How the model is reached:
|
|
2290
|
+
How the model is reached: opencode (Gemini, Amazon Bedrock, Thinking Machines, DeepSeek, Qwen, GLM, MiniMax, Llama, OpenAI, and own models; default) or anthropic (Claude directly). Setting a provider/model id automatically picks opencode.
|
|
2232
2291
|
.br
|
|
2233
2292
|
Values: anthropic | opencode, or default. Default: default.
|
|
2234
2293
|
.TP
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oalo",
|
|
3
|
-
"description": "Work on an Oalo workspace from Claude Code: edit chat flows, loops and code tools,
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Work on an Oalo workspace from Claude Code: edit chat flows, loops and code tools, deploy and migrate apps, inspect and self-heal runtime errors, and run test conversations with a bot.",
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": { "name": "Oalo" },
|
|
6
6
|
"mcpServers": {
|
|
7
7
|
"oalo": {
|
|
@@ -191,14 +191,17 @@ oalo data push orders_mirror orders.csv --id-field order_no --dry-run # chec
|
|
|
191
191
|
oalo data push orders_mirror orders.csv --id-field order_no # upsert into dev
|
|
192
192
|
oalo data list orders_mirror --limit 5 # look at what landed
|
|
193
193
|
oalo data promote orders_mirror # copy dev rows to prod, when the person wants it live
|
|
194
|
-
oalo db
|
|
195
|
-
oalo db
|
|
194
|
+
oalo db schemas # list workspace + isolated app schemas and cross-app grants (MCP: oalo_db_schemas)
|
|
195
|
+
oalo db tables [--app <slug>] # tables in workspace dev/prod or an isolated app's schema
|
|
196
|
+
oalo db query "select * from quotes order by id desc limit 5" [--app <slug>] # read-only SQL (MCP: oalo_db_query)
|
|
197
|
+
oalo db grant <owner-app|workspace> --to <grantee-app> [--read-only] # let one server app read/write another app's tables
|
|
198
|
+
oalo db revoke <owner-app|workspace> --from <grantee-app> # remove cross-app SQL access
|
|
196
199
|
oalo data routes # the Sync API's endpoints, scopes and limits
|
|
197
200
|
```
|
|
198
201
|
|
|
199
202
|
Over MCP: `oalo_list_models`, `oalo_create_model`, `oalo_read_rows`,
|
|
200
203
|
`oalo_write_rows` (env required; prod needs `confirm`), `oalo_promote_model`,
|
|
201
|
-
`oalo_sync_routes`.
|
|
204
|
+
`oalo_db_schemas`, `oalo_db_query`, `oalo_sync_routes`.
|
|
202
205
|
|
|
203
206
|
1. **Look before you create.** Reuse a model that exists (`oalo data models`).
|
|
204
207
|
Use `--owned-by <field>` only when each app user owns their rows.
|
|
@@ -208,11 +211,21 @@ Over MCP: `oalo_list_models`, `oalo_create_model`, `oalo_read_rows`,
|
|
|
208
211
|
at once, so writing there needs `--env prod` and the person's go-ahead. A
|
|
209
212
|
draft bot reads dev and a published one prod, so load rows where the bot
|
|
210
213
|
you're testing reads them (rule 9).
|
|
211
|
-
4. **
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
4. **Sharing data across apps without duplication:**
|
|
215
|
+
- **Shared business data** (users, CRM, commerce, Oalo models): both apps use
|
|
216
|
+
their injected `OALO_URL` and `OALO_SYNC_TOKEN` (already in every hosted
|
|
217
|
+
server app's env; no token to make). For a server hosted elsewhere, the
|
|
218
|
+
person runs `oalo tokens create --name <what> --scope write:<table>`.
|
|
219
|
+
- **App-specific Postgres tables:** new server apps get isolated schemas
|
|
220
|
+
(`app_<slug>_dev` / `app_<slug>_prod`) so table names like `products`,
|
|
221
|
+
`orders`, `users`, or `_prisma_migrations` never collide. Check
|
|
222
|
+
`oalo db schemas` first. When App B needs to read or modify App A's SQL
|
|
223
|
+
tables directly, run `oalo db grant <app-a> --to <app-b>` (add `--read-only`
|
|
224
|
+
for SELECT-only). App B automatically gets `APP_SCHEMA_<APP_A>` and
|
|
225
|
+
`OALO_SHARED_SCHEMAS` in its env so it can run schema-qualified SQL
|
|
226
|
+
(`"${process.env.APP_SCHEMA_<APP_A>}".<table>`) across dev and prod cleanly.
|
|
227
|
+
Oalo workflows and code tools (`db_query`) already have holistic access
|
|
228
|
+
across all app schemas and `workspace.*` in one query.
|
|
216
229
|
prints the token once) and stores it in that host's secrets. Don't run it
|
|
217
230
|
yourself: the token would land in your context. The app calls
|
|
218
231
|
`/api/sync/v1`; `oalo docs sync-rest-api` explains it and `oalo data routes`
|
|
@@ -303,25 +316,68 @@ oalo build --app shop --download # a Flutter or Expo app's store files (.ipa
|
|
|
303
316
|
after the copy starts is lost. `oalo docs migrating-from-heroku` (or
|
|
304
317
|
`-railway`, `-render`, `-fly`, `-primcloud`) has each platform's steps.
|
|
305
318
|
8. **Moving an app from another platform** (Heroku, Railway, Render, Fly.io,
|
|
306
|
-
Primcloud
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
Primcloud; the old host stays live with zero downtime until DNS flips):
|
|
320
|
+
execute in this exact order inside the app's repo:
|
|
321
|
+
1. **Pre-flight files:** Confirm Node apps have a committed lockfile
|
|
322
|
+
(`package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`) and a `Procfile`
|
|
323
|
+
`web:` line listening on `$PORT` (or `package.json` `start`, or a
|
|
324
|
+
`Dockerfile`).
|
|
325
|
+
2. **Plan first (read-only):** Run `oalo migrate <platform> --from-app
|
|
326
|
+
<name>` and show the person the plan + warnings (sizes mapped into
|
|
327
|
+
`.oalo/app.json`, `Aptfile`, cron/scheduler, `> large` 4 GB dynos). It
|
|
328
|
+
changes nothing and never prints secret values.
|
|
329
|
+
3. **Write config files:** Run `oalo migrate <platform> --from-app <name>
|
|
330
|
+
--apply` (writes `Procfile` / `.oalo/app.json` without overwriting an
|
|
331
|
+
existing `Procfile`), then `git add Procfile .oalo/app.json && git
|
|
332
|
+
commit`.
|
|
333
|
+
4. **Create the app & preview:** Run `oalo deploy --new <slug>`. If it adds
|
|
334
|
+
`.oalo/credentials*` to `.gitignore`, commit `.gitignore` before the next
|
|
335
|
+
deploy.
|
|
336
|
+
5. **Push prod variables:** Run the exact same `oalo migrate <platform>
|
|
337
|
+
--from-app <name> --apply` a second time (now the app exists, it sends
|
|
338
|
+
the prod vars safely without restarting or printing values, renaming
|
|
339
|
+
`DATABASE_URL` to `EXTERNAL_DATABASE_URL`). For platforms whose CLI
|
|
340
|
+
can't read secret values back (Fly secrets, Primcloud), have the person
|
|
341
|
+
put them in an uncommitted `.env` file and pass `--env-file`. Don't copy
|
|
342
|
+
secrets by hand with `oalo env set NAME=value`.
|
|
343
|
+
6. **Move Postgres (optional, rule 7):** If moving the database into Oalo,
|
|
344
|
+
run `oalo db restore --from-env SOURCE_DATABASE_URL --env prod --check`,
|
|
345
|
+
then without `--check` once writes stop, then `oalo env unset
|
|
346
|
+
EXTERNAL_DATABASE_URL --env prod`.
|
|
347
|
+
7. **Go live when the person says so:** Run `oalo deploy --app <slug> --env
|
|
348
|
+
prod` (zero-downtime health-checked swap; web/server self-healing
|
|
349
|
+
telemetry starts automatically with no code changes).
|
|
318
350
|
9. **App Store and Google Play files** (a Flutter or Expo app): `oalo deploy`
|
|
319
351
|
updates only the web preview. `oalo build --app shop --download` makes a
|
|
320
352
|
store build (15 to 60 minutes, both platforms) and saves the `.ipa` and
|
|
321
|
-
`.aab` where you run it.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
353
|
+
`.aab` where you run it. When Apple App Store Connect or Google Play
|
|
354
|
+
credentials are connected in Integrations, Oalo can also publish Expo
|
|
355
|
+
JS-only fixes over the air (EAS Update) and submit native builds to Apple
|
|
356
|
+
App Review and a 10% Google Play staged rollout from **Apps > Logs &
|
|
357
|
+
Errors**; otherwise deliver the `.ipa` with Transporter and upload the
|
|
358
|
+
`.aab` in Google Play Console. Each build raises the version code, so start
|
|
359
|
+
one only when asked. Don't build them locally with Xcode, Gradle,
|
|
360
|
+
`flutter build` or `eas build`.
|
|
361
|
+
10. **Self-healing, error telemetry, and integration tests** (`oalo docs
|
|
362
|
+
self-healing`):
|
|
363
|
+
- **Hosted web & server apps** get error capture automatically (HTML gets
|
|
364
|
+
`/_oalo/error-beacon.js`; proxied server routes capture `5xx`, `502`,
|
|
365
|
+
status regressions, and JSON shape drift). In React apps, forward caught
|
|
366
|
+
`ErrorBoundary` errors via `window.__oaloReportError?.(error, {
|
|
367
|
+
component_stack: info.componentStack })`.
|
|
368
|
+
- **Native mobile apps (Expo / Flutter) and off-box frontends** do not go
|
|
369
|
+
through Oalo's HTML proxy: wire a global crash handler that POSTs to
|
|
370
|
+
`<OALO_ORIGIN>/_oalo/errors` (`{ app, env, platform, message, stack,
|
|
371
|
+
route, app_version }`). Copy the exact snippet from `oalo docs
|
|
372
|
+
self-healing`.
|
|
373
|
+
- **Write `.oalo/tests/smoke.json`** as you add API routes (`tests: [{
|
|
374
|
+
name, method, path, expect_status, expect_json_keys, expect_json_shape,
|
|
375
|
+
max_ms }]`) and verify with `oalo heal tests --app <slug>` (or `oalo
|
|
376
|
+
heal suggest-tests --app <slug>`).
|
|
377
|
+
- **Investigate and fix runtime errors** with `oalo heal list --app
|
|
378
|
+
<slug>`, `oalo heal inspect <error_id>`, `oalo heal run <error_id>`
|
|
379
|
+
(Base PR by default, or `--local` to download the error bundle and fix
|
|
380
|
+
locally), and `oalo heal approve|reject <heal_id>`.
|
|
325
381
|
|
|
326
382
|
## An app's environment variables
|
|
327
383
|
|
|
@@ -369,6 +425,7 @@ writing it: the endpoints, headers and shapes are there.
|
|
|
369
425
|
| Give the live app more CPU or memory, a health check, or required variables | All in one committed file, `.oalo/app.json`: `{"sizes": {"web": "medium"}, "health": "/healthz", "env": {"required": ["STRIPE_KEY"]}}`. A live deploy is refused while a required variable isn't set for prod. There is no `infra.json`. | `live-server-apps` |
|
|
370
426
|
| Show the app's own numbers to its users (a chart in the app) | `queryMetric({ table: "sessions", every: "week", days: 90, by: "coach_id" })` from `oalo typegen`, called on the app's server. | `dashboards` |
|
|
371
427
|
| Work on an app made from Oalo's Flutter template on this machine | `oalo typegen --dart` (the models, and `.oalo/dart-defines.json`), then `flutter run -d chrome --dart-define-from-file=.oalo/dart-defines.json`. | `flutter-on-your-machine` |
|
|
428
|
+
| Wire self-healing error telemetry & `.oalo/tests/smoke.json` | Web & server capture is automatic; forward React `ErrorBoundary` via `window.__oaloReportError`, POST native Expo/Flutter crashes to `/_oalo/errors`, and add `.oalo/tests/smoke.json` checked with `oalo heal tests`. | `self-healing` |
|
|
372
429
|
|
|
373
430
|
## Selling: products and paid content
|
|
374
431
|
|
|
@@ -429,6 +486,8 @@ oalo bots knowledge bot_ABC --add products # let the bot search it
|
|
|
429
486
|
oalo bots tools bot_ABC --add order_status # let it call a tool
|
|
430
487
|
oalo bots graph bot_ABC [--build] [--search "<q>"] [--export f.json] [--import f.json] [--resync] [--reset --yes]
|
|
431
488
|
oalo bots settings --explain model # what each setting does
|
|
489
|
+
oalo bots settings bot_ABC set model=bedrock/us.amazon.ergo-1.0 --dry-run
|
|
490
|
+
oalo bots settings bot_ABC set model=openrouter/thinkingmachines/inkling-2-mini --dry-run
|
|
432
491
|
oalo bots settings bot_ABC set <key>=<value> --dry-run
|
|
433
492
|
oalo channels # WhatsApp, Instagram, email, web chat: which bot answers
|
|
434
493
|
```
|
|
@@ -438,7 +497,13 @@ oalo channels # WhatsApp, Instagram, emai
|
|
|
438
497
|
isn't searchable. The rows must be in the env the bot reads: dev while it's
|
|
439
498
|
a draft, prod once published (`oalo bots` shows its status).
|
|
440
499
|
2. **Read a setting with `--explain` before changing it.** Don't guess keys or
|
|
441
|
-
values.
|
|
500
|
+
values. For AI models (bots, flow `agent_prompt`/`collect` nodes, and loop
|
|
501
|
+
definitions or `agent_prompt` nodes), pass a tier (`cheap`, `balanced`,
|
|
502
|
+
`max`) or a hosted model id such as `google/gemini-4-argon`,
|
|
503
|
+
`bedrock/us.amazon.ergo-1.0`, `openrouter/thinkingmachines/inkling-2-mini`,
|
|
504
|
+
`openrouter/deepseek/deepseek-v4.1-flash`, or `claude-sonnet-4-6` (any
|
|
505
|
+
`provider/model` id automatically routes through OpenCode). Run `oalo docs
|
|
506
|
+
ai-steps-and-providers` for the complete model table and vision support.
|
|
442
507
|
3. **A published bot is live for customers.** `set` on one shows the change and
|
|
443
508
|
saves nothing unless you pass `--yes`: show the person the `--dry-run` and
|
|
444
509
|
use `--yes` only when they say so.
|
package/src/bot-settings.json
CHANGED
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
{
|
|
313
313
|
"clear_word": "default",
|
|
314
314
|
"default": null,
|
|
315
|
-
"doc": "The AI model this bot answers with. default: the workspace's default model.",
|
|
315
|
+
"doc": "The AI model this bot answers with: a tier (cheap, balanced, max), a hosted id (for example google/gemini-4-argon, bedrock/us.amazon.ergo-1.0, openrouter/thinkingmachines/inkling-2-mini, openrouter/deepseek/deepseek-v4-pro, openrouter/deepseek/deepseek-v4.1-flash, claude-sonnet-4-6), or an own model id (byo-...). Any provider/model id with a slash automatically sets provider=opencode. default: the workspace's default model. See `oalo docs ai-steps-and-providers` for the full list.",
|
|
316
316
|
"effect": null,
|
|
317
317
|
"group": "model",
|
|
318
318
|
"key": "model",
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
{
|
|
323
323
|
"clear_word": "default",
|
|
324
324
|
"default": null,
|
|
325
|
-
"doc": "How the model is reached:
|
|
325
|
+
"doc": "How the model is reached: opencode (Gemini, Amazon Bedrock, Thinking Machines, DeepSeek, Qwen, GLM, MiniMax, Llama, OpenAI, and own models; default) or anthropic (Claude directly). Setting a provider/model id automatically picks opencode.",
|
|
326
326
|
"effect": null,
|
|
327
327
|
"group": "model",
|
|
328
328
|
"key": "provider",
|
package/src/commands/db.js
CHANGED
|
@@ -7,22 +7,117 @@ import { resolve as resolveConfig, controlPlane, HOW_TO_CONNECT } from "../confi
|
|
|
7
7
|
import { dim } from "../events.js";
|
|
8
8
|
|
|
9
9
|
const USAGE =
|
|
10
|
-
"usage: oalo db query \"<sql>\" [--env dev|prod] [--limit <n>] [--json]\n" +
|
|
11
|
-
" oalo db tables [--env dev|prod]\n" +
|
|
12
|
-
" oalo db
|
|
13
|
-
" oalo db
|
|
14
|
-
" oalo db
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
"usage: oalo db query \"<sql>\" [--env dev|prod] [--app <slug>] [--limit <n>] [--json]\n" +
|
|
11
|
+
" oalo db tables [--env dev|prod] [--app <slug>]\n" +
|
|
12
|
+
" oalo db schemas [--json]\n" +
|
|
13
|
+
" oalo db grant <owner-app|workspace> --to <grantee-app> [--read-only]\n" +
|
|
14
|
+
" oalo db revoke <owner-app|workspace> --from <grantee-app>\n" +
|
|
15
|
+
" oalo db dump [--env dev|prod] [--app <slug>] [--out <file.sql>]\n" +
|
|
16
|
+
" oalo db restore <file> --env dev|prod [--app <slug>] [--schema <name>] [--check] [--yes]\n" +
|
|
17
|
+
" oalo db restore --from-env <VAR> --env dev|prod [--app <slug>] [--schema <name>] [--check] [--yes]";
|
|
18
|
+
|
|
19
|
+
/** `oalo db dump`, `oalo db restore`, `oalo db query`, `oalo db tables`, `oalo db schemas`, `oalo db grant`, `oalo db revoke`. */
|
|
17
20
|
export async function db(flags, rest, opts = {}) {
|
|
18
21
|
const sub = rest[1];
|
|
19
22
|
if (sub === "query") return query(flags, rest[2], opts);
|
|
20
23
|
if (sub === "tables") return query(flags, TABLES_SQL, opts, { tables: true });
|
|
24
|
+
if (sub === "schemas") return schemas(flags, opts);
|
|
25
|
+
if (sub === "grant") return grant(flags, rest[2], opts);
|
|
26
|
+
if (sub === "revoke") return revoke(flags, rest[2], opts);
|
|
21
27
|
if (sub === "dump") return dump(flags, opts);
|
|
22
28
|
if (sub === "restore") return restore(flags, rest, opts);
|
|
23
29
|
return fail(USAGE, 2);
|
|
24
30
|
}
|
|
25
31
|
|
|
32
|
+
async function schemas(flags, opts) {
|
|
33
|
+
const { url, token } = controlPlane(resolveConfig(flags));
|
|
34
|
+
if (!url || !token) return fail(`oalo db schemas needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
35
|
+
|
|
36
|
+
const doFetch = opts.fetch || fetch;
|
|
37
|
+
let res;
|
|
38
|
+
try {
|
|
39
|
+
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/schemas`, {
|
|
40
|
+
headers: { authorization: `Bearer ${token}` },
|
|
41
|
+
});
|
|
42
|
+
} catch (e) {
|
|
43
|
+
return fail(`could not reach ${url} (${e.message})`, 1);
|
|
44
|
+
}
|
|
45
|
+
const body = await res.json().catch(() => ({}));
|
|
46
|
+
if (!res.ok) return fail(body?.error?.message || `could not list schemas (HTTP ${res.status})`, 1);
|
|
47
|
+
if (flags.json) return void console.log(JSON.stringify(body, null, 2));
|
|
48
|
+
|
|
49
|
+
const rows = [
|
|
50
|
+
["workspace", "dev", "prod"],
|
|
51
|
+
...(body.apps || []).map((a) => [a.slug, a.dev_schema, a.prod_schema]),
|
|
52
|
+
];
|
|
53
|
+
printTable(["app", "dev_schema", "prod_schema"], rows);
|
|
54
|
+
|
|
55
|
+
const grants = body.grants || [];
|
|
56
|
+
if (grants.length > 0) {
|
|
57
|
+
console.log("");
|
|
58
|
+
printTable(
|
|
59
|
+
["owner", "grantee", "access", "env_var"],
|
|
60
|
+
grants.map((g) => [g.owner, g.grantee, g.access, g.env_var || ""]),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function grant(flags, owner, opts) {
|
|
66
|
+
const grantee = typeof flags.to === "string" ? flags.to.trim() : "";
|
|
67
|
+
if (typeof owner !== "string" || !owner.trim() || !grantee) {
|
|
68
|
+
return fail("usage: oalo db grant <owner-app|workspace> --to <grantee-app> [--read-only]", 2);
|
|
69
|
+
}
|
|
70
|
+
const { url, token } = controlPlane(resolveConfig(flags));
|
|
71
|
+
if (!url || !token) return fail(`oalo db grant needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
72
|
+
|
|
73
|
+
const access = flags["read-only"] ? "read" : "write";
|
|
74
|
+
const doFetch = opts.fetch || fetch;
|
|
75
|
+
let res;
|
|
76
|
+
try {
|
|
77
|
+
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/grants`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
80
|
+
body: JSON.stringify({ owner: owner.trim(), grantee, access }),
|
|
81
|
+
});
|
|
82
|
+
} catch (e) {
|
|
83
|
+
return fail(`could not reach ${url} (${e.message})`, 1);
|
|
84
|
+
}
|
|
85
|
+
const body = await res.json().catch(() => ({}));
|
|
86
|
+
if (!res.ok) return fail(body?.error?.message || `could not grant schema access (HTTP ${res.status})`, 1);
|
|
87
|
+
if (flags.json) return void console.log(JSON.stringify(body, null, 2));
|
|
88
|
+
|
|
89
|
+
console.log(
|
|
90
|
+
`granted ${body.access} on ${body.owner} (${body.dev_schema} / ${body.prod_schema}) to ${body.grantee}. ` +
|
|
91
|
+
dim(`Restart or redeploy ${body.grantee} to receive ${body.env_var} in its environment.`),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function revoke(flags, owner, opts) {
|
|
96
|
+
const grantee = typeof flags.from === "string" ? flags.from.trim() : "";
|
|
97
|
+
if (typeof owner !== "string" || !owner.trim() || !grantee) {
|
|
98
|
+
return fail("usage: oalo db revoke <owner-app|workspace> --from <grantee-app>", 2);
|
|
99
|
+
}
|
|
100
|
+
const { url, token } = controlPlane(resolveConfig(flags));
|
|
101
|
+
if (!url || !token) return fail(`oalo db revoke needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
102
|
+
|
|
103
|
+
const doFetch = opts.fetch || fetch;
|
|
104
|
+
let res;
|
|
105
|
+
try {
|
|
106
|
+
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/grants`, {
|
|
107
|
+
method: "DELETE",
|
|
108
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
109
|
+
body: JSON.stringify({ owner: owner.trim(), grantee }),
|
|
110
|
+
});
|
|
111
|
+
} catch (e) {
|
|
112
|
+
return fail(`could not reach ${url} (${e.message})`, 1);
|
|
113
|
+
}
|
|
114
|
+
const body = await res.json().catch(() => ({}));
|
|
115
|
+
if (!res.ok) return fail(body?.error?.message || `could not revoke schema access (HTTP ${res.status})`, 1);
|
|
116
|
+
if (flags.json) return void console.log(JSON.stringify(body, null, 2));
|
|
117
|
+
|
|
118
|
+
console.log(`revoked ${body.owner} schema access from ${body.grantee}.`);
|
|
119
|
+
}
|
|
120
|
+
|
|
26
121
|
// The env's tables: an app's own and the Oalo models', with Postgres's row
|
|
27
122
|
// estimate (blank until it has counted; `select count(*)` for the exact number).
|
|
28
123
|
const TABLES_SQL =
|
|
@@ -45,13 +140,14 @@ async function query(flags, sql, opts, { tables = false } = {}) {
|
|
|
45
140
|
if (!url || !token) return fail(`oalo db ${tables ? "tables" : "query"} needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
46
141
|
|
|
47
142
|
const limit = tables ? 1000 : Number.parseInt(flags.limit, 10) || undefined;
|
|
143
|
+
const app = typeof flags.app === "string" && flags.app.trim() ? flags.app.trim() : undefined;
|
|
48
144
|
const doFetch = opts.fetch || fetch;
|
|
49
145
|
let res;
|
|
50
146
|
try {
|
|
51
147
|
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/query`, {
|
|
52
148
|
method: "POST",
|
|
53
149
|
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
54
|
-
body: JSON.stringify({ env, sql, ...(limit ? { limit } : {}) }),
|
|
150
|
+
body: JSON.stringify({ env, sql, ...(app ? { app } : {}), ...(limit ? { limit } : {}) }),
|
|
55
151
|
});
|
|
56
152
|
} catch (e) {
|
|
57
153
|
return fail(`could not reach ${url} (${e.message})`, 1);
|
|
@@ -94,13 +190,15 @@ async function dump(flags, opts) {
|
|
|
94
190
|
if (!url || !token) return fail(`oalo db dump needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
95
191
|
|
|
96
192
|
const host = new URL(url).hostname.split(".")[0];
|
|
97
|
-
const
|
|
193
|
+
const app = typeof flags.app === "string" && flags.app.trim() ? flags.app.trim() : undefined;
|
|
194
|
+
const out = typeof flags.out === "string" ? flags.out : `${host}-${app ? `${app}-` : ""}${env}-${new Date().toISOString().slice(0, 10)}.sql`;
|
|
98
195
|
if (existsSync(out) && !flags.force) return fail(`${out} exists. Choose another --out, or add --force to replace it.`, 2);
|
|
99
196
|
|
|
100
197
|
const doFetch = opts.fetch || fetch;
|
|
198
|
+
const dumpQ = new URLSearchParams({ env, ...(app ? { app } : {}) });
|
|
101
199
|
let res;
|
|
102
200
|
try {
|
|
103
|
-
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/dump
|
|
201
|
+
res = await doFetch(`${url.replace(/\/$/, "")}/api/cli/v1/db/dump?${dumpQ}`, { headers: { authorization: `Bearer ${token}` } });
|
|
104
202
|
} catch (e) {
|
|
105
203
|
return fail(`could not reach ${url} (${e.message})`, 1);
|
|
106
204
|
}
|
|
@@ -188,7 +286,8 @@ async function restore(flags, rest, opts) {
|
|
|
188
286
|
}
|
|
189
287
|
|
|
190
288
|
const scrub = scrubber(source.url);
|
|
191
|
-
const
|
|
289
|
+
const app = typeof flags.app === "string" && flags.app.trim() ? flags.app.trim() : undefined;
|
|
290
|
+
const q = new URLSearchParams({ env, ...(app ? { app } : {}), ...(typeof flags.schema === "string" ? { schema: flags.schema } : {}), ...(check ? { check: "true" } : {}) });
|
|
192
291
|
const endpoint = `${url.replace(/\/$/, "")}/api/cli/v1/db/restore?${q}`;
|
|
193
292
|
console.error(dim(`${check ? "checking" : "restoring"} ${source.file ? `${source.file} (${size(source.bytes)})` : `the database at ${source.host}`} ${check ? "against" : "into"} ${env} on ${url}`));
|
|
194
293
|
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { OaloChannel } from "../channel.js";
|
|
5
|
+
import { resolve as resolveConfig, controlPlane, HOW_TO_CONNECT } from "../config.js";
|
|
6
|
+
import { dim } from "../events.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `oalo heal`: inspect runtime errors, run/suggest integration tests, and run
|
|
10
|
+
* self-healing either on the Base or locally (`--local`), plus approve/reject
|
|
11
|
+
* generated fix PRs.
|
|
12
|
+
*/
|
|
13
|
+
export async function heal(flags, rest, opts = {}) {
|
|
14
|
+
const cfg = resolveConfig(flags);
|
|
15
|
+
const { url, token } = controlPlane(cfg);
|
|
16
|
+
if (!url || !token) return fail(`oalo heal needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
|
|
17
|
+
|
|
18
|
+
const sub = rest[1] || "list";
|
|
19
|
+
const arg = rest[2];
|
|
20
|
+
const app = typeof flags.app === "string" ? flags.app : cfg.appId;
|
|
21
|
+
|
|
22
|
+
const ch = (opts.channel || ((o) => new OaloChannel(o)))({ url, token });
|
|
23
|
+
try {
|
|
24
|
+
await ch.connect();
|
|
25
|
+
|
|
26
|
+
if (sub === "list") {
|
|
27
|
+
if (!app) return fail("Pass --app <slug> or link an app with `oalo link --app <slug>`.", 2);
|
|
28
|
+
const r = await ch.call("apps:heal:list", { app });
|
|
29
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
30
|
+
const errors = r.errors || [];
|
|
31
|
+
const runs = r.runs || [];
|
|
32
|
+
console.log(`${r.app} policy: mode=${r.policy?.mode} runner=${r.policy?.runner}`);
|
|
33
|
+
if (!errors.length) {
|
|
34
|
+
console.log(" No runtime errors recorded.");
|
|
35
|
+
} else {
|
|
36
|
+
for (const e of errors) {
|
|
37
|
+
console.log(` #${e.id} [${e.status}] (${e.occurrences}x) ${e.platform}/${e.source}: ${e.title}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (runs.length) {
|
|
41
|
+
console.log("\nRecent heal runs:");
|
|
42
|
+
for (const h of runs) {
|
|
43
|
+
console.log(` heal #${h.id} (error #${h.error_id}) [${h.status}] branch=${h.branch || "-"}${h.pr_url ? ` ${dim(h.pr_url)}` : ""}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (sub === "inspect") {
|
|
50
|
+
if (!arg) return fail("Usage: oalo heal inspect <error_id>", 2);
|
|
51
|
+
const b = await ch.call("apps:heal:bundle", { error_id: arg });
|
|
52
|
+
if (flags.json) return void console.log(JSON.stringify(b, null, 2));
|
|
53
|
+
const e = b.error;
|
|
54
|
+
console.log(`Error #${e.id} [${e.status}] on ${e.slug} (${e.env}, ${e.platform}/${e.source})`);
|
|
55
|
+
console.log(`Title: ${e.title}`);
|
|
56
|
+
console.log(`Route: ${e.method || ""} ${e.route || "/"} (HTTP ${e.status_code ?? "-"}) · ${e.occurrences}x`);
|
|
57
|
+
if (e.diagnosis) console.log(`\nDiagnosis:\n${e.diagnosis}`);
|
|
58
|
+
if (e.stack_trace) console.log(`\nStack:\n${e.stack_trace}`);
|
|
59
|
+
if (e.sample_logs) console.log(`\nLogs:\n${e.sample_logs}`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (sub === "run") {
|
|
64
|
+
if (!arg) return fail("Usage: oalo heal run <error_id> [--local] [--mode branch_and_pr|diagnose_only|auto_deploy]", 2);
|
|
65
|
+
if (flags.local) {
|
|
66
|
+
const b = await ch.call("apps:heal:bundle", { error_id: arg });
|
|
67
|
+
const dir = join(process.cwd(), ".oalo", "heal");
|
|
68
|
+
mkdirSync(dir, { recursive: true });
|
|
69
|
+
const outPath = join(dir, `error-${b.error.id}.json`);
|
|
70
|
+
writeFileSync(outPath, JSON.stringify(b, null, 2) + "\n", "utf8");
|
|
71
|
+
const branch = b.branch || `oalo/fix-${b.error.id}`;
|
|
72
|
+
const git = spawnSync("git", ["checkout", "-B", branch], { encoding: "utf8" });
|
|
73
|
+
if (flags.json) {
|
|
74
|
+
return void console.log(JSON.stringify({ ok: true, bundle_path: outPath, branch, git_switched: git.status === 0 }, null, 2));
|
|
75
|
+
}
|
|
76
|
+
console.log(`Saved error bundle to ${outPath}`);
|
|
77
|
+
if (git.status === 0) console.log(`Switched local git branch to ${branch}`);
|
|
78
|
+
console.log(`Fix error #${b.error.id} (${b.error.title}), run tests, and push branch ${branch} to Forgejo.`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const r = await ch.call("apps:heal:start", {
|
|
83
|
+
error_id: arg,
|
|
84
|
+
...(typeof flags.mode === "string" ? { mode: flags.mode } : {}),
|
|
85
|
+
runner: "base",
|
|
86
|
+
});
|
|
87
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
88
|
+
console.log(`Heal #${r.run?.id} ${r.run?.status} on branch ${r.run?.branch}`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (sub === "approve") {
|
|
93
|
+
if (!arg) return fail("Usage: oalo heal approve <heal_id>", 2);
|
|
94
|
+
const r = await ch.call("apps:heal:approve", { id: arg });
|
|
95
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
96
|
+
console.log(`Heal #${r.run?.id} approved and merged (${r.run?.status}).`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (sub === "reject") {
|
|
101
|
+
if (!arg) return fail("Usage: oalo heal reject <heal_id>", 2);
|
|
102
|
+
const r = await ch.call("apps:heal:reject", { id: arg });
|
|
103
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
104
|
+
console.log(`Heal #${r.run?.id} rejected and closed.`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (sub === "tests") {
|
|
109
|
+
if (!app) return fail("Pass --app <slug>.", 2);
|
|
110
|
+
const r = await ch.call("apps:tests:run", { app, env: typeof flags.env === "string" ? flags.env : "dev" });
|
|
111
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
112
|
+
const run = r.run || {};
|
|
113
|
+
console.log(`${app} tests (${run.status}): ${run.passed_count} passed, ${run.failed_count} failed (${run.duration_ms}ms)`);
|
|
114
|
+
for (const tc of run.results || []) {
|
|
115
|
+
console.log(` ${tc.passed ? "ok " : "FAIL"} ${tc.name} (${tc.status ?? "err"}, ${tc.duration_ms}ms)`);
|
|
116
|
+
for (const f of tc.failures || []) console.log(` - ${f}`);
|
|
117
|
+
}
|
|
118
|
+
if (run.failed_count > 0) process.exitCode = 1;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (sub === "suggest-tests") {
|
|
123
|
+
if (!app) return fail("Pass --app <slug>.", 2);
|
|
124
|
+
const r = await ch.call("apps:tests:suggest", { app, auto: Boolean(flags.auto) });
|
|
125
|
+
if (flags.json) return void console.log(JSON.stringify(r, null, 2));
|
|
126
|
+
console.log(`Suggestion #${r.suggestion?.id} [${r.suggestion?.status}]: ${r.suggestion?.title}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return fail(`Unknown heal subcommand: ${sub}. Use list, inspect, run, approve, reject, tests, or suggest-tests.`, 2);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
return fail(e.message, 1);
|
|
133
|
+
} finally {
|
|
134
|
+
ch.close();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function fail(msg, code) {
|
|
139
|
+
console.error(msg);
|
|
140
|
+
process.exitCode = code;
|
|
141
|
+
}
|
package/src/commands/skill.js
CHANGED
|
@@ -38,9 +38,10 @@ export function skillHash() {
|
|
|
38
38
|
|
|
39
39
|
const body = (md) => md.replace(/^---\n[\s\S]*?\n---\n+/, "");
|
|
40
40
|
const skillPath = (cwd) => join(cwd, ".claude", "skills", "oalo", "SKILL.md");
|
|
41
|
+
const openSkillPath = (cwd) => join(cwd, ".agents", "skills", "oalo", "SKILL.md");
|
|
41
42
|
|
|
42
43
|
// The packaged skill with a stamp line after its front matter (the front matter
|
|
43
|
-
// must stay first for
|
|
44
|
+
// must stay first for agent harnesses to read it).
|
|
44
45
|
function stamped() {
|
|
45
46
|
const md = readFileSync(SKILL, "utf8");
|
|
46
47
|
const stamp = `<!-- oalo-cli ${CLI_VERSION} (skill ${skillHash()}) wrote this copy; \`oalo skill\` updates it. -->\n\n`;
|
|
@@ -49,8 +50,9 @@ function stamped() {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
* Write the skill into `cwd`
|
|
53
|
-
*
|
|
53
|
+
* Write the skill into `cwd` for both the open cross-harness standard
|
|
54
|
+
* (`.agents/skills/oalo/SKILL.md`) and Claude Code (`.claude/skills/oalo/SKILL.md`),
|
|
55
|
+
* plus the `AGENTS.md` section when `agents` is true or `AGENTS.md` already has one.
|
|
54
56
|
*/
|
|
55
57
|
export function installSkill(cwd = process.cwd(), { agents = false } = {}) {
|
|
56
58
|
const md = stamped();
|
|
@@ -58,6 +60,10 @@ export function installSkill(cwd = process.cwd(), { agents = false } = {}) {
|
|
|
58
60
|
mkdirSync(dirname(target), { recursive: true });
|
|
59
61
|
writeFileSync(target, md);
|
|
60
62
|
|
|
63
|
+
const openTarget = openSkillPath(cwd);
|
|
64
|
+
mkdirSync(dirname(openTarget), { recursive: true });
|
|
65
|
+
writeFileSync(openTarget, md);
|
|
66
|
+
|
|
61
67
|
const agentsPath = join(cwd, "AGENTS.md");
|
|
62
68
|
const current = existsSync(agentsPath) ? readFileSync(agentsPath, "utf8") : "";
|
|
63
69
|
const at = current.indexOf(START);
|
|
@@ -74,7 +80,11 @@ export function installSkill(cwd = process.cwd(), { agents = false } = {}) {
|
|
|
74
80
|
agentsResult = at >= 0 ? "updated" : "added";
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
return {
|
|
83
|
+
return {
|
|
84
|
+
path: target.slice(cwd.length + 1),
|
|
85
|
+
openPath: openTarget.slice(cwd.length + 1),
|
|
86
|
+
agents: agentsResult,
|
|
87
|
+
};
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
/**
|
|
@@ -136,7 +146,7 @@ export async function skill(flags) {
|
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
const r = installSkill(process.cwd(), { agents: !!flags.agents });
|
|
139
|
-
console.log(`installed ${r.path}`);
|
|
149
|
+
console.log(`installed ${r.openPath} and ${r.path}`);
|
|
140
150
|
if (r.agents) console.log(`${r.agents} the Oalo section in AGENTS.md`);
|
|
141
151
|
console.log(dim(`From CLI ${CLI_VERSION}. Run \`oalo skill\` again after updating the CLI.`));
|
|
142
152
|
}
|
package/src/coord-release.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.8.0",
|
|
3
3
|
"targets": {
|
|
4
4
|
"darwin-arm64": {
|
|
5
5
|
"file": "oalo-coord-darwin-arm64.gz",
|
|
6
|
-
"sha256": "
|
|
7
|
-
"bytes":
|
|
6
|
+
"sha256": "63e9527d03eb8f6521a86078fb2083a2c4e1216737c95ab220e0eaac30ea4534",
|
|
7
|
+
"bytes": 24875224
|
|
8
8
|
},
|
|
9
9
|
"darwin-x64": {
|
|
10
10
|
"file": "oalo-coord-darwin-x64.gz",
|
|
11
|
-
"sha256": "
|
|
12
|
-
"bytes":
|
|
11
|
+
"sha256": "5a8e3d4045d351c0e90d16d330dd39202db7c2219f6e1f4920aaee324a5665a5",
|
|
12
|
+
"bytes": 27014412
|
|
13
13
|
},
|
|
14
14
|
"linux-x64": {
|
|
15
15
|
"file": "oalo-coord-linux-x64.gz",
|
|
16
|
-
"sha256": "
|
|
17
|
-
"bytes":
|
|
16
|
+
"sha256": "7ddba63fb1e62579dcdc2359aec11ee2fd41de6adf651cafe91247afb169c677",
|
|
17
|
+
"bytes": 36906273
|
|
18
18
|
},
|
|
19
19
|
"linux-arm64": {
|
|
20
20
|
"file": "oalo-coord-linux-arm64.gz",
|
|
21
|
-
"sha256": "
|
|
22
|
-
"bytes":
|
|
21
|
+
"sha256": "caea90592aabe555d8f6f3819d1afc36161aa250b4a21e2c9d8142e7b5ab538b",
|
|
22
|
+
"bytes": 37146886
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
package/src/help.js
CHANGED
|
@@ -243,6 +243,29 @@ export const COMMANDS = [
|
|
|
243
243
|
],
|
|
244
244
|
exits: { 0: "done", 1: "failed, or some rows were rejected", 2: "bad arguments or no token" },
|
|
245
245
|
},
|
|
246
|
+
{
|
|
247
|
+
name: "heal",
|
|
248
|
+
summary: "Inspect runtime errors, run/suggest integration tests, and run or approve self-healing patches (Base or --local).",
|
|
249
|
+
usage: [
|
|
250
|
+
"oalo heal list --app <slug> [--json]",
|
|
251
|
+
"oalo heal inspect <error_id> [--json]",
|
|
252
|
+
"oalo heal run <error_id> [--local] [--mode branch_and_pr|diagnose_only|auto_deploy]",
|
|
253
|
+
"oalo heal approve|reject <heal_id>",
|
|
254
|
+
"oalo heal tests --app <slug> [--env dev|prod]",
|
|
255
|
+
"oalo heal suggest-tests --app <slug> [--auto]",
|
|
256
|
+
],
|
|
257
|
+
flags: [
|
|
258
|
+
{ flag: "--app <slug>", desc: "The app. Default: the one saved with `oalo link --app`." },
|
|
259
|
+
{ flag: "--local", desc: "Download the error bundle and switch to a local fix branch instead of running on the Base." },
|
|
260
|
+
{ flag: "--auto", desc: "Apply suggested tests immediately into .oalo/tests/smoke.json." },
|
|
261
|
+
{ flag: "--json", desc: "Raw JSON output." },
|
|
262
|
+
],
|
|
263
|
+
notes: [
|
|
264
|
+
"Runs on the Base by default (opening a Forgejo PR in branch_and_pr mode), or pass --local to download the error bundle and patch on your own machine.",
|
|
265
|
+
"High-risk diffs (auth, migrations, billing, >5 files, >200 lines) always require explicit `oalo heal approve` or Dashboard 1-click approval.",
|
|
266
|
+
],
|
|
267
|
+
exits: { 0: "done", 1: "failed or failing tests", 2: "bad arguments or no token" },
|
|
268
|
+
},
|
|
246
269
|
{
|
|
247
270
|
name: "incidents",
|
|
248
271
|
summary: "A live app's outages and restart bursts, as Oalo's uptime check saw them, newest first.",
|
|
@@ -261,20 +284,27 @@ export const COMMANDS = [
|
|
|
261
284
|
},
|
|
262
285
|
{
|
|
263
286
|
name: "db",
|
|
264
|
-
summary: "Read
|
|
265
|
-
env: "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.",
|
|
287
|
+
summary: "Read tables with SQL (including isolated app schemas), inspect schemas and cross-app grants, share one app's tables with another app, dump an env as SQL, or restore an existing Postgres database.",
|
|
288
|
+
env: "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. schemas, grant and revoke cover both dev and prod.",
|
|
266
289
|
usage: [
|
|
267
|
-
'oalo db query "<sql>" [--env dev|prod] [--limit <n>] [--json]',
|
|
268
|
-
"oalo db tables [--env dev|prod]",
|
|
269
|
-
"oalo db
|
|
270
|
-
"oalo db
|
|
271
|
-
"oalo db
|
|
290
|
+
'oalo db query "<sql>" [--env dev|prod] [--app <slug>] [--limit <n>] [--json]',
|
|
291
|
+
"oalo db tables [--env dev|prod] [--app <slug>]",
|
|
292
|
+
"oalo db schemas [--json]",
|
|
293
|
+
"oalo db grant <owner-app|workspace> --to <grantee-app> [--read-only]",
|
|
294
|
+
"oalo db revoke <owner-app|workspace> --from <grantee-app>",
|
|
295
|
+
"oalo db dump [--env dev|prod] [--app <slug>] [--out <file.sql>] [--force]",
|
|
296
|
+
"oalo db restore <file> --env dev|prod [--app <slug>] [--schema <name>] [--check] [--yes]",
|
|
297
|
+
"oalo db restore --from-env <VAR> --env dev|prod [--app <slug>] [--schema <name>] [--check] [--yes]",
|
|
272
298
|
],
|
|
273
299
|
flags: [
|
|
274
300
|
{ flag: "--env dev|prod", desc: "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." },
|
|
301
|
+
{ flag: "--app <slug>", desc: "Target a specific server app's isolated schema (`app_<slug>_dev` / `app_<slug>_prod`) instead of the shared workspace schema (`dev` / `prod`)." },
|
|
302
|
+
{ flag: "--to <grantee-app>", desc: "grant: the app slug receiving SQL access to the owner's schema." },
|
|
303
|
+
{ flag: "--from <grantee-app>", desc: "revoke: the app slug whose access to the owner's schema is removed." },
|
|
304
|
+
{ flag: "--read-only", desc: "grant: allow SELECT only (default is read/write: SELECT, INSERT, UPDATE, DELETE)." },
|
|
275
305
|
{ flag: "--limit <n>", desc: "query: rows to show. Default 100, at most 1000." },
|
|
276
|
-
{ flag: "--json", desc: "query
|
|
277
|
-
{ flag: "--out <file.sql>", desc: "Where to write it. Default <workspace
|
|
306
|
+
{ flag: "--json", desc: "query, schemas, grant, revoke: structured JSON output." },
|
|
307
|
+
{ flag: "--out <file.sql>", desc: "Where to write it. Default <workspace>-[<app>-]<env>-<date>.sql here." },
|
|
278
308
|
{ flag: "--force", desc: "Replace the file if it exists." },
|
|
279
309
|
{ flag: "--from-env <VAR>", desc: "restore: copy from a running database instead of a file. VAR is the environment variable that holds its postgres:// or postgresql:// URL. Only its host is ever shown." },
|
|
280
310
|
{ flag: "--schema <name>", desc: "restore: the source schema to load. Default public, or the only one when there's just one." },
|
|
@@ -282,12 +312,14 @@ export const COMMANDS = [
|
|
|
282
312
|
{ flag: "--yes", desc: "restore: go ahead with prod without asking. Needed for prod when there's no terminal to ask at." },
|
|
283
313
|
],
|
|
284
314
|
notes: [
|
|
285
|
-
"
|
|
286
|
-
"
|
|
315
|
+
"New imported/created server apps get isolated schemas (`app_<slug>_dev` and `app_<slug>_prod`) with their own Postgres login, so multiple apps can each keep their own `products`, `orders`, `users` or ORM migrations without colliding. Existing shared apps stay in `dev`/`prod`.",
|
|
316
|
+
"Sharing data across apps without duplication: (1) for shared business data (users, CRM, commerce, Oalo models), have both apps call Oalo's Sync/platform APIs with their injected `OALO_URL` and `OALO_SYNC_TOKEN`; (2) when App B needs direct SQL read/write on App A's app-specific tables, run `oalo db grant <app-a> --to <app-b>` (or `--read-only`). Postgres grants privileges on current and future tables in both dev and prod, and App B receives `APP_SCHEMA_<APP_A>` and `OALO_SHARED_SCHEMAS` in its environment so it can query `\"${process.env.APP_SCHEMA_<APP_A>}\".<table>` without hardcoding dev/prod. Pass `workspace` as the owner to grant direct SQL access to the workspace's `dev`/`prod` schema.",
|
|
317
|
+
"query reads only: one statement (SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW), run as the env's (or `--app`'s) database login in a read-only transaction that is rolled back, with a 10 second limit. `oalo data` is for Oalo models; this is for any table, your app's own included. Available to workspace admins and members with Developer access.",
|
|
318
|
+
"dump is workspace admins only: without `--app`, it dumps the workspace schema plus every isolated app schema for that env; with `--app <slug>`, it dumps only that app's schema. Restore it into any Postgres with psql -f.",
|
|
287
319
|
"Your code is in git (oalo deploy --pull); this is the data. Together they are everything you need to run your apps elsewhere.",
|
|
288
|
-
"restore loads a dump file made by pg_dump (like Heroku's latest.dump), up to 10 GB, or copies from a database URL. Admins only, and one restore at a time per Base.",
|
|
289
|
-
"The tables land in the
|
|
290
|
-
"It's refused if a table name already exists there, and the names are listed. A failed restore leaves the
|
|
320
|
+
"restore loads a dump file made by pg_dump (like Heroku's latest.dump), up to 10 GB, or copies from a database URL. Admins only, and one restore at a time per Base. Pass `--app <slug>` to restore directly into an isolated server app's schema.",
|
|
321
|
+
"The tables land in the target schema, owned by the app's database login, so its Procfile `release:` migrations can alter them. Your app reads them at DATABASE_URL.",
|
|
322
|
+
"It's refused if a table name already exists there, and the names are listed. A failed restore leaves the target schema as it was.",
|
|
291
323
|
"The URL is never a flag value, since that stays in your shell history. Put it in a variable and pass --from-env VAR.",
|
|
292
324
|
"Run it with --check first. prod asks before it writes; without a terminal it needs --yes. Stop writes to the old database before the copy: writes made after it starts are lost.",
|
|
293
325
|
],
|
|
@@ -565,7 +597,8 @@ export const COMMANDS = [
|
|
|
565
597
|
"<bot> is the bot's public id (bot_...), as `oalo bots` prints it.",
|
|
566
598
|
"A source is a table made searchable with `oalo data vectorize <table> --fields ...`. A bot always searches its own knowledge base (documents) too. knowledge lists those documents, and which have priority.",
|
|
567
599
|
"The same as ticking a table in the bot's Knowledge pane in the dashboard, with the same access as there.",
|
|
568
|
-
"settings go through the dashboard's own actions, with the same checks and access. A change sets only the settings it names: the model without the provider keeps the provider, one limit keeps the others, one context.* key keeps the rest of the context config.",
|
|
600
|
+
"settings go through the dashboard's own actions, with the same checks and access. A change sets only the settings it names: the model without the provider keeps the provider (except a provider/model id with a slash, which automatically sets provider=opencode), one limit keeps the others, one context.* key keeps the rest of the context config.",
|
|
601
|
+
"Pick a bot's model with `oalo bots settings <bot> set model=<tier-or-id>`, for example `balanced`, `google/gemini-4-argon`, `bedrock/us.amazon.ergo-1.0`, `openrouter/thinkingmachines/inkling-2-mini`, `openrouter/deepseek/deepseek-v4.1-flash`, `claude-sonnet-4-6`, or a `byo-...` own model. Run `oalo docs ai-steps-and-providers` for the full hosted model table.",
|
|
569
602
|
"Every setting is described in `man oalo` (BOT SETTINGS) and by `oalo bots settings --explain`.",
|
|
570
603
|
"The knowledge graph links a bot's passages: each document's sections, and the sections like each other, so a match can bring in related ones and the topics above it. A bot has none until `oalo bots graph <bot> --build`. graph shows its size and whether links are labeled; how answers use it is in settings (graph_retrieval, ancestor_preload_depth, graph_classify_edges). Markdown front matter's related: list links pages by name.",
|
|
571
604
|
],
|
|
@@ -739,10 +772,11 @@ export const COMMANDS = [
|
|
|
739
772
|
{ flag: "--json", desc: "The plan as JSON: names only, never a value." },
|
|
740
773
|
],
|
|
741
774
|
notes: [
|
|
742
|
-
"Run it in the app's repo.
|
|
775
|
+
"Run it in the app's repo. Your existing host keeps serving traffic with zero downtime until you point DNS at Oalo.",
|
|
776
|
+
"It reads fly.toml, railway.json or railway.toml, render.yaml, app.json and the Procfile, and asks the platform's CLI for variables (heroku, railway), secret names (fly) and dyno sizes (heroku) when it's installed and signed in.",
|
|
743
777
|
"Variables: PORT and each platform's own (HEROKU_*, RAILWAY_*, RENDER_*, FLY_*) are left out, and DATABASE_URL becomes EXTERNAL_DATABASE_URL, since DATABASE_URL on Oalo is the Base's own Postgres. Values are never printed or written to a file; --apply sends them to prod without restarting the app.",
|
|
744
|
-
"It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large.",
|
|
745
|
-
"
|
|
778
|
+
"It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large (2 CPUs, 4 GB).",
|
|
779
|
+
"Exact execution order: (1) Ensure Node apps have a committed lockfile (package-lock.json, yarn.lock or pnpm-lock.yaml) and a Procfile `web:` line listening on $PORT (or package.json start). (2) Run `oalo migrate <platform> [--from-app <name>]` to inspect the plan and warnings. (3) Run `oalo migrate <platform> [--from-app <name>] --apply` to write Procfile / .oalo/app.json with mapped sizes. (4) Commit those files (`git add Procfile .oalo/app.json && git commit`). (5) Run `oalo deploy --new <slug>` to create the app and dev preview (if deploy updates .gitignore, commit .gitignore). (6) Run `oalo migrate <platform> [--from-app <name>] --apply` a second time to push prod variables now that the app exists. (7) Optionally move Postgres with `oalo db restore --from-env SOURCE_DATABASE_URL --env prod --check` then without `--check`, unset EXTERNAL_DATABASE_URL, and run `oalo deploy --app <slug> --env prod`. See `oalo docs migrating-from-<platform>`.",
|
|
746
780
|
],
|
|
747
781
|
exits: { 0: "the plan was shown, or applied", 1: "a config file couldn't be read, or the variables couldn't be set", 2: "bad arguments, an unknown platform, or no CLI token" },
|
|
748
782
|
},
|
package/src/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { sources } from "./commands/sources.js";
|
|
|
29
29
|
import { setup } from "./commands/setup.js";
|
|
30
30
|
import { build } from "./commands/build.js";
|
|
31
31
|
import { incidents } from "./commands/incidents.js";
|
|
32
|
+
import { heal } from "./commands/heal.js";
|
|
32
33
|
import { channels } from "./commands/channels.js";
|
|
33
34
|
import { products } from "./commands/products.js";
|
|
34
35
|
import { metrics, dashboards } from "./commands/metrics.js";
|
|
@@ -183,6 +184,9 @@ async function dispatch(cmd) {
|
|
|
183
184
|
case "incidents":
|
|
184
185
|
await incidents(flags, rest);
|
|
185
186
|
break;
|
|
187
|
+
case "heal":
|
|
188
|
+
await heal(flags, rest);
|
|
189
|
+
break;
|
|
186
190
|
case "channels":
|
|
187
191
|
await channels(flags, rest);
|
|
188
192
|
break;
|
package/src/mcp/describe.js
CHANGED
|
@@ -17,7 +17,7 @@ export const TOOL_GROUPS = {
|
|
|
17
17
|
"look around": ["oalo_describe", "oalo_list_apps", "oalo_list_bots", "oalo_get_bot", "oalo_list_loops", "oalo_docs", "oalo_jobs"],
|
|
18
18
|
"chat flows": ["oalo_node_catalog", "oalo_list_flows", "oalo_get_flow", "oalo_lint_flow", "oalo_save_flow", "oalo_set_flow_enabled", "oalo_delete_flow", "oalo_test_conversation", "oalo_flow_runs", "oalo_get_conversation"],
|
|
19
19
|
"loops (workflows)": ["oalo_get_loop", "oalo_lint_loop", "oalo_save_loop", "oalo_loop_triggers", "oalo_test_loop", "oalo_loop_runs", "oalo_set_loop_enabled", "oalo_run_loop_now", "oalo_delete_loop", "oalo_emit", "oalo_loop_docs"],
|
|
20
|
-
"data": ["oalo_list_models", "oalo_create_model", "oalo_read_rows", "oalo_write_rows", "oalo_promote_model", "oalo_db_query", "oalo_query_metrics", "oalo_sync_routes", "oalo_list_dashboards", "oalo_save_dashboard_widget", "oalo_sources"],
|
|
20
|
+
"data": ["oalo_list_models", "oalo_create_model", "oalo_read_rows", "oalo_write_rows", "oalo_promote_model", "oalo_db_query", "oalo_db_schemas", "oalo_query_metrics", "oalo_sync_routes", "oalo_list_dashboards", "oalo_save_dashboard_widget", "oalo_sources"],
|
|
21
21
|
"code tools": ["oalo_list_functions", "oalo_generate_tool", "oalo_get_tool_source", "oalo_save_tool_source", "oalo_tool_templates", "oalo_bot_tools"],
|
|
22
22
|
"apps": ["oalo_app_logs", "oalo_releases", "oalo_incidents", "oalo_secrets"],
|
|
23
23
|
"channels and sales": ["oalo_widgets", "oalo_wa_templates", "oalo_rehearse_inbound", "oalo_pipelines"],
|
package/src/mcp/tools.js
CHANGED
|
@@ -204,8 +204,15 @@ export const TOOLS = [
|
|
|
204
204
|
max_iterations: { type: "number" },
|
|
205
205
|
max_cost_usd: { type: "number" },
|
|
206
206
|
session_mode: { type: "string", enum: ["recursive", "persistent"] },
|
|
207
|
-
provider: {
|
|
208
|
-
|
|
207
|
+
provider: {
|
|
208
|
+
type: "string",
|
|
209
|
+
enum: ["anthropic", "opencode"],
|
|
210
|
+
description: "Default AI provider (opencode covers Gemini, Amazon Bedrock, OpenRouter/Thinking Machines/DeepSeek/Qwen/MiniMax/Llama, GLM, OpenAI, and own models; anthropic is Claude). Auto-selected when model contains '/'.",
|
|
211
|
+
},
|
|
212
|
+
model: {
|
|
213
|
+
type: "string",
|
|
214
|
+
description: "Default AI model tier (cheap, balanced, max) or concrete id (e.g. google/gemini-4-argon, bedrock/us.amazon.ergo-1.0, openrouter/thinkingmachines/inkling-2-mini, openrouter/deepseek/deepseek-v4-pro, claude-sonnet-4-6).",
|
|
215
|
+
},
|
|
209
216
|
base_version: { type: "number", description: "The `version` from oalo_get_loop. Enables the conflict check." },
|
|
210
217
|
strict: { type: "boolean", description: "Refuse the save on any error-level lint finding (default true)." },
|
|
211
218
|
},
|
|
@@ -748,20 +755,26 @@ export const TOOLS = [
|
|
|
748
755
|
{
|
|
749
756
|
name: "oalo_db_query",
|
|
750
757
|
description:
|
|
751
|
-
"One read-only SQL statement against an env's tables, as the app's own database login sees them (the server
|
|
758
|
+
"One read-only SQL statement against an env's (or isolated app's) tables, as the app's own database login sees them (the server app's own tables and/or Oalo models; not the platform's). Pass `app` (slug) to target an isolated server app's dedicated schema (`app_<slug>_<env>`). Use it to check rows an app wrote to its own table, which oalo_read_rows can't see (it reads Oalo models only). SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW; run in a read-only transaction that is rolled back, 10 second limit. List the tables with: select relname from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = current_schema() and relkind = 'r'. Workspace admins and members with Developer access. Rows can hold customers' details: never repeat those. Read-only.",
|
|
752
759
|
inputSchema: S(
|
|
753
760
|
{
|
|
754
761
|
sql: { type: "string", description: "One statement" },
|
|
755
762
|
env: { type: "string", enum: ["dev", "prod"], description: "dev (staging, the default) or prod (live)" },
|
|
763
|
+
app: { type: "string", description: "Optional app slug for an isolated server app (`app_<slug>_<env>`)" },
|
|
756
764
|
limit: { type: "integer", description: "Rows, default 100, at most 1000" },
|
|
757
765
|
},
|
|
758
766
|
["sql"],
|
|
759
767
|
),
|
|
760
|
-
run: async (_oalo, { sql, env, limit }, ctx) => {
|
|
768
|
+
run: async (_oalo, { sql, env, app, limit }, ctx) => {
|
|
761
769
|
const res = await fetch(`${String(ctx.url).replace(/\/$/, "")}/api/cli/v1/db/query`, {
|
|
762
770
|
method: "POST",
|
|
763
771
|
headers: { authorization: `Bearer ${ctx.token}`, "content-type": "application/json" },
|
|
764
|
-
body: JSON.stringify({
|
|
772
|
+
body: JSON.stringify({
|
|
773
|
+
sql,
|
|
774
|
+
env: env === "prod" ? "prod" : "dev",
|
|
775
|
+
...(app ? { app } : {}),
|
|
776
|
+
...(limit ? { limit } : {}),
|
|
777
|
+
}),
|
|
765
778
|
});
|
|
766
779
|
const body = await res.json().catch(() => ({}));
|
|
767
780
|
if (res.status === 404) throw new Error("this workspace doesn't have db queries yet (it comes with a newer Base)");
|
|
@@ -769,6 +782,20 @@ export const TOOLS = [
|
|
|
769
782
|
return body;
|
|
770
783
|
},
|
|
771
784
|
},
|
|
785
|
+
{
|
|
786
|
+
name: "oalo_db_schemas",
|
|
787
|
+
description:
|
|
788
|
+
"List the workspace's Postgres schemas (`dev`, `prod`), every isolated server app's dedicated schemas (`app_<slug>_dev`, `app_<slug>_prod`), and any active cross-app schema grants (`oalo db grant <owner> --to <grantee>`). Call this before `oalo_db_query` or before wiring one app to read/write another app's tables so you know the exact schema names and injected `APP_SCHEMA_<OWNER>` env vars. Read-only.",
|
|
789
|
+
inputSchema: S({}),
|
|
790
|
+
run: async (_oalo, _args, ctx) => {
|
|
791
|
+
const res = await fetch(`${String(ctx.url).replace(/\/$/, "")}/api/cli/v1/db/schemas`, {
|
|
792
|
+
headers: { authorization: `Bearer ${ctx.token}` },
|
|
793
|
+
});
|
|
794
|
+
const body = await res.json().catch(() => ({}));
|
|
795
|
+
if (!res.ok) throw new Error(body?.error?.message || `could not list schemas (HTTP ${res.status})`);
|
|
796
|
+
return body;
|
|
797
|
+
},
|
|
798
|
+
},
|
|
772
799
|
{
|
|
773
800
|
name: "oalo_query_metrics",
|
|
774
801
|
description:
|
package/src/serve/model.js
CHANGED
|
@@ -187,6 +187,7 @@ export class ModelRequests {
|
|
|
187
187
|
method: "POST",
|
|
188
188
|
headers: upstreamHeaders(h, this.env, stream ? "text/event-stream" : "application/json"),
|
|
189
189
|
body: JSON.stringify(body),
|
|
190
|
+
redirect: "error",
|
|
190
191
|
signal: controller.signal,
|
|
191
192
|
});
|
|
192
193
|
} catch (e) {
|
|
@@ -297,7 +298,12 @@ export async function discoverModels({ baseUrl, server, only, key, fetchImpl = g
|
|
|
297
298
|
const headers = { accept: "application/json" };
|
|
298
299
|
if (key) headers.authorization = `Bearer ${key}`;
|
|
299
300
|
const get = async (url, init = {}) => {
|
|
300
|
-
const r = await fetchImpl(url, {
|
|
301
|
+
const r = await fetchImpl(url, {
|
|
302
|
+
...init,
|
|
303
|
+
redirect: "error",
|
|
304
|
+
headers: { ...headers, ...(init.headers || {}) },
|
|
305
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
306
|
+
});
|
|
301
307
|
const text = await r.text();
|
|
302
308
|
if (!r.ok) throw Object.assign(new Error(`${r.status}: ${text.slice(0, 200)}`), { status: r.status });
|
|
303
309
|
return JSON.parse(text);
|