naro-cli 0.19.1 → 0.21.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/README.md CHANGED
@@ -198,6 +198,7 @@ naro policy remove todos Drop every policy on the table: back to deny
198
198
 
199
199
  naro storage Naro Storage: on or off, limits, usage, today's operations, buckets
200
200
  naro storage enable Turn it on: the project's R2 bucket, bound to the backend
201
+ naro storage disable [--yes] Turn it off and keep the files: Storage calls and file URLs answer 404 until enable (asks first)
201
202
  naro storage bucket create avatars --public --file-size-limit 5MiB --allowed-mime-types image/png,image/jpeg
202
203
  naro storage bucket update avatars --private | --file-size-limit none | --allowed-mime-types any
203
204
  naro storage bucket update docs --public (asks first: anyone with an object's URL can download it)
@@ -210,7 +211,14 @@ naro storage mv naro://docs/a.pdf naro://docs/old/a.pdf Inside one bucke
210
211
  naro storage rm naro://avatars/u1/old.png [--recursive] (asks first)
211
212
  naro storage rm naro://avatars/u1/ --recursive Everything under u1/; written u1, an object u1 too
212
213
 
213
- naro promote <deployment-id> Publish a build to production
214
+ naro realtime [status] Naro Realtime: on or not, published tables, connections now
215
+ naro realtime enable Turn Realtime on: the project's hub, bound to its backend
216
+ naro realtime tables [list] The tables whose Data API writes reach subscribers
217
+ naro realtime tables add <table>… Publish tables' changes (within about 10 seconds)
218
+ naro realtime tables remove <table>… [--yes]
219
+ Stop publishing tables' changes (asks first)
220
+
221
+ naro promote <deployment-id> [--to <environment>] Publish a build to production, or to an environment (0.20.0); says rebuild or reupload first, then asks
214
222
  naro rollback [deployment-id] Back to the previous production build
215
223
  ```
216
224
 
@@ -594,8 +602,16 @@ tables: a policy on a table that does not exist
594
602
  (`relation "nope" does not exist`), a name already taken, or a 33rd policy on
595
603
  one table fails the whole request with `400 DATABASE_QUERY_FAILED`, names the
596
604
  statement, and applies nothing — not even the `CREATE TABLE` before it. Policy
597
- statements, and statements that create, drop or rename a table, take no
598
- `params` (`400 VALIDATION_FAILED`): write the values into the SQL.
605
+ statements, statements that create, drop or rename a table, and statements
606
+ that add a generated column take no `params` (`400 VALIDATION_FAILED`): write
607
+ the values into the SQL.
608
+
609
+ `ALTER TABLE t ADD COLUMN c … AS (…)` computes the generated column for the
610
+ rows already in `t` right after it, as Postgres does: a row it cannot be
611
+ computed for (`json_extract` over text that is not JSON) fails the request
612
+ with SQLite's error (`400 DATABASE_QUERY_FAILED` `malformed JSON:
613
+ SQLITE_ERROR`) and nothing changes. Fix those rows first, in an earlier
614
+ statement.
599
615
 
600
616
  Policies go with their table, as in Postgres: `DROP TABLE` drops them, and a
601
617
  new table never inherits the leftovers of an earlier one with the same name
@@ -837,6 +853,164 @@ An `--update-check` you give replaces the default: without
837
853
 
838
854
  ## Release notes
839
855
 
856
+ ### 0.21.0
857
+
858
+ 0.20.0 went out on 2026-10-26 without these.
859
+
860
+ - `naro realtime` turns on Naro Realtime for the project and chooses the
861
+ tables whose changes reach subscribers (Realtime 3-2d). Five commands:
862
+ `naro realtime [status]`, `naro realtime enable`,
863
+ `naro realtime tables [list]`, `naro realtime tables add <table>…` and
864
+ `naro realtime tables remove <table>… [--yes]`.
865
+ - `naro realtime` prints `Realtime: on (public channels: off)`, the
866
+ published tables (`Published tables: messages, gone (dropped)`, or
867
+ `Published tables: none — naro realtime tables add <table>`) and
868
+ `Connections now: 12 · channels 30 · presences 8`. When the hub does not
869
+ answer it says
870
+ `Connections now: not known — the backend is off or not ready, or the hub did not answer`.
871
+ Before Realtime is on it prints `Realtime: not enabled` and
872
+ ``Run `naro realtime enable` to turn it on (the project's backend must be on first).``
873
+ - `naro realtime enable` needs the backend on, and is safe to run again: it
874
+ picks up an upload that stopped. It prints
875
+ `✅ Realtime is on. Publish a table with naro realtime tables add <table>.`
876
+ and the state. An upload that does not answer within 2 minutes stops
877
+ with `TIMEOUT`
878
+ ``Turning Realtime on did not answer within 2 minutes. `naro realtime` shows where it got to, and `naro realtime enable` again picks up where it stopped.``
879
+ - `naro realtime tables add messages rooms` sends one request a table, in
880
+ order, and stops at the first refusal (`404 TABLE_NOT_FOUND`
881
+ `Table nope was not found.`): the tables before it stay published. Each
882
+ prints `✅ messages now publishes its changes (within about 10 seconds).`
883
+ and the control plane's warnings as `⚠ <warning>` — for a table with no
884
+ select policy,
885
+ `⚠ messages has no select policy: only service-key connections receive its changes.`
886
+ The command ends with
887
+ `⚠ Changes made through the Data API are published; writes your app makes with env.DB are not.`
888
+ once.
889
+ - `naro realtime tables remove` asks once for all the tables —
890
+ `Stop publishing messages, rooms? Subscribers stop receiving their changes within about 10 seconds.`
891
+ — and with `--json` or without a terminal only `--yes` answers it
892
+ (`CONFIRMATION_REQUIRED`). A table that is not published stops it with
893
+ `404 TABLE_NOT_PUBLISHED` `Table nope does not publish its changes.`
894
+ - A table name no URL can carry fails before its request with
895
+ `INVALID_PATH` `The table name is not valid.`, and a command with no
896
+ table with `VALIDATION_FAILED` and its usage line.
897
+ - Until Naro Realtime is switched on for the control plane, `naro realtime enable`,
898
+ `tables add` and `tables remove` answer `503 REALTIME_DISABLED`
899
+ `Naro Realtime is not enabled on this control plane yet.` (`naro realtime`
900
+ still prints `Realtime: not enabled`). The tables commands on a project
901
+ whose Realtime is not on answer `409 REALTIME_NOT_ENABLED`
902
+ ``Realtime is not enabled for this project. Run `naro realtime enable` first.``
903
+ - There is no command that turns Realtime alone off yet:
904
+ `naro backend disable` stops it with the rest of the backend.
905
+ - It goes out with naro-js 0.6.0, whose `naro.channel()` is the client side
906
+ of Realtime (row changes, broadcast and presence, as supabase-js's
907
+ `channel()`). naro-js 0.6.0 is also the first published version with
908
+ Storage's `move()` and `copy()` (3-1i).
909
+
910
+ ### 0.20.0
911
+
912
+ 0.19.1 went out on 2026-10-24 without these.
913
+
914
+ - `naro promote <deployment-id> --to <environment>` publishes a build to a
915
+ named environment. `--to` takes `production` (what no `--to` does) or an
916
+ environment's slug; an empty value, only blanks or `preview` fails before
917
+ any request with `VALIDATION_FAILED`
918
+ `--to must be production or an environment name.` The usage line is
919
+ `Usage: naro promote <deployment-id> [--to <environment>]`.
920
+ - Before it asks, it says what the promotion will do, from the control
921
+ plane's preview (`GET …/promote?target=`, which changes nothing):
922
+ `▸ rebuild: builds the same commit again with qa's variables` or
923
+ `▸ reupload: publishes the stored build`, then each warning as
924
+ `⚠ <warning>`. Without `--to` the same line is printed for production
925
+ (`… with production's variables`); that is one request more than 0.19.1
926
+ sent.
927
+ - A build moving between an environment and another surface (a preview or
928
+ production build to `qa`, a `qa` build to `staging` or to production) is
929
+ built again from its commit with the target's variables, and counts
930
+ against the plan's builds. Any other build is published as stored: one
931
+ promoted within its own surface, and a preview to production.
932
+ - The question is `Promote <id> to qa (<subdomain>--qa)?`; for production it
933
+ is the one it always was, `Promote <id> to production (<subdomain>)?`.
934
+ `--json` or no terminal without `--yes` still fails
935
+ `CONFIRMATION_REQUIRED`.
936
+ - Progress is `▸ promoting <id> to qa (rebuild)` (`(reupload)`), and the
937
+ result `✅ qa now serves a rebuild of <id>` or `✅ qa now serves <id>`; for
938
+ production `✅ Production now serves a rebuild of <id>` or, as before,
939
+ `✅ Production now serves <id>`. A rebuild is waited for up to 15 minutes
940
+ (a published build, 5 as before), and a failed one fails with its own
941
+ code and message. While a rebuild runs its build log lines print the way
942
+ `naro logs --type build --follow` prints them (`[BUILDING] next build`,
943
+ `[BUILDING] ✗ <error>`), on stderr with `--json` so stdout stays one
944
+ object; a published build prints none.
945
+ - `--json` adds `target` (`null` without `--to`) and `mode` (`rebuild` or
946
+ `reupload`): `{ deploymentId, sourceDeploymentId, projectId, target, mode, status, url }`.
947
+ `naro rollback`'s result gains `mode` too (as MCP's `rollback_deployment`
948
+ says it) and has no `target`: a rollback is always production's.
949
+ - `409 PROMOTE_NEEDS_GIT_SOURCE`
950
+ `Only deployments built from Git can be promoted to another environment. Deploy the code again with naro deploy instead.`
951
+ for a deployment `naro deploy` uploaded. This and every other refusal of
952
+ the preview (`404 ENVIRONMENT_NOT_FOUND` `Environment not found.`) stop
953
+ it in the control plane's words before it asks, and nothing is promoted.
954
+ - A rebuild checks out the pinned commit as a detached HEAD, not the
955
+ branch, so a build script that reads the branch name from git
956
+ (`git branch --show-current`, `git rev-parse --abbrev-ref HEAD`) sees
957
+ none.
958
+ - Against a control plane from before named environments 2a, which has no
959
+ preview (it answers 405) and whose promote ignores the target and
960
+ republishes to production, `--to <environment>` stops before it promotes
961
+ anything: `PROMOTE_TARGET_UNSUPPORTED`
962
+ `This control plane cannot promote to an environment yet. Deploy the latest web first, then try again.`
963
+ With no `--to` or `--to production` the 405 is ignored: no preview line,
964
+ and the promotion goes as it always did.
965
+ - `--to` belongs to `naro promote`; `naro rollback` refuses it before any
966
+ request with `VALIDATION_FAILED`
967
+ `--to is for naro promote: naro rollback always rolls production back.`
968
+ (it always targets production, and ignoring `--to` would roll production
969
+ back for someone who named an environment).
970
+ - Any other command given `--to` fails before any request with
971
+ `VALIDATION_FAILED` `--to is only for naro promote.`, so a flag a command
972
+ does not read is never dropped silently.
973
+ - `naro promote` and `naro rollback` refuse `--env` and any word after the
974
+ deployment id before any request, with `VALIDATION_FAILED`
975
+ `--env is not an option of naro promote: use --to <environment>.`,
976
+ `--env is not an option of naro rollback: naro rollback always rolls production back.`
977
+ or the usage line (`Usage: naro promote <deployment-id> [--to <environment>]`,
978
+ `Usage: naro rollback [deployment-id]`), instead of acting on production for
979
+ someone who named an environment (`naro promote d1 --env qa --yes` and
980
+ `naro promote d1 qa --yes` promoted to production in 0.19.1).
981
+ - A control plane with named environments 2a rebuilds a deployment of an
982
+ environment that is promoted to production, which it used to refuse with
983
+ `400 DEPLOYMENT_NOT_PROMOTABLE`. `naro promote <id>` says so before it
984
+ asks (`▸ rebuild: … with production's variables`) and waits up to 15
985
+ minutes; `naro rollback <id>` waits 15 minutes for such a rebuild too and
986
+ prints `✅ Production now serves a rebuild of <id>`. The build that
987
+ `naro rollback` picks on its own is never one.
988
+ - `naro storage disable [--yes]` turns the project's Storage off and keeps
989
+ its files (Storage 3-1k). It asks first —
990
+ `Turn Storage off for this project? Its Storage calls and file URLs answer 404 until naro storage enable; buckets and files are kept.`
991
+ — and without a terminal or with `--json` only `--yes` answers it. The
992
+ backend is uploaded again without the bucket: the app's Storage calls and
993
+ file URLs answer `404 STORAGE_NOT_ENABLED` until `naro storage enable`
994
+ binds the same bucket again, and the buckets, the files and their storage
995
+ cost stay. To delete the files instead, remove the buckets with
996
+ `naro storage bucket remove <name> --empty` while Storage is on. Storage
997
+ that was never turned on prints `Storage is already off.` and changes
998
+ nothing; Storage that is already off is finished without asking again (a
999
+ turn-off whose upload stopped answers `BACKEND_PROVISION_FAILED` and says
1000
+ to run it again).
1001
+ - `naro storage` says
1002
+ `Storage: off since <YYYY-MM-DD HH:MM> UTC — buckets and files are kept`
1003
+ while it is off, with the buckets.
1004
+ - `naro storage ls`, `cp`, `mv` and `rm` read the Storage state before the
1005
+ service key and stop with `STORAGE_OFF`
1006
+ ``Storage is turned off for this project. Turn it on with `naro storage enable` first.``
1007
+ while it is off. `naro storage bucket create` on Storage that is off gets
1008
+ the control plane's `409 STORAGE_OFF`: it turns Storage on by itself only
1009
+ when Storage was never on.
1010
+ - Published naro-cli 0.19.1 and earlier show Storage that is off as `off`
1011
+ and pass the backend's `404 STORAGE_NOT_ENABLED` on from `ls`, `cp`,
1012
+ `mv` and `rm`; their `bucket create` stops at `409 STORAGE_OFF` too.
1013
+
840
1014
  ### 0.19.1
841
1015
 
842
1016
  0.19.0 went out on 2026-10-19 without these.
@@ -996,7 +1170,7 @@ RENAME` the way the control plane now reads it: a column rename whose
996
1170
  too), migration files the backend would stop at for Storage: a policy that
997
1171
  reads `storage.objects` in a subquery while the backend's ledger lacks
998
1172
  system migration 7 (it reads the ledger only when a file has one), and
999
- any statement on `storage.objects` (CREATE POLICY, DROP POLICY without
1173
+ a statement that needs `storage.objects` (CREATE POLICY, DROP POLICY without
1000
1174
  IF EXISTS, the `naro:owner` COMMENT) on a backend from before Storage or a
1001
1175
  project with none. It fails `BACKEND_OUTDATED`
1002
1176
  ``0002_b.sql needs storage.objects (statement 2 of 2), which is not available on this backend yet, so the reset would stop there with the schema already dropped. Nothing was changed. Run `naro backend enable` to update it, then try again.``
@@ -1556,7 +1730,7 @@ not fail but no strategy can ship it, `NO_DEPLOYMENT_STRATEGY`. Either way the m
1556
1730
  what each strategy failed at.
1557
1731
 
1558
1732
  `--yes` (or `-y`) suppresses every prompt — destructive actions
1559
- (production rollback/promote, env/domain/environment removal, `naro env import`, turning off an environment's protection, database reset, backend key
1733
+ (production rollback, promote to production or to an environment, env/domain/environment removal, `naro env import`, turning off an environment's protection, database reset, backend key
1560
1734
  rotation, policy removal and drop, opening the preview with
1561
1735
  `naro protection disable`, replacing or removing the bypass secret) run
1562
1736
  unconfirmed, so use it deliberately in