naro-cli 0.19.0 → 0.19.1

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
@@ -93,9 +93,12 @@ naro env add DATABASE_URL production
93
93
  naro env remove DATABASE_URL The production, preview and all values; an environment's only with its name
94
94
  (naro env remove DATABASE_URL qa)
95
95
  naro env pull [.env.local] Preview's values by default; --env production, or --env qa for an environment
96
- (its own value wins over all; an unknown name fails before anything is written)
96
+ (its own value wins over all; an unknown name fails before anything is written,
97
+ and so does a value no dotenv line reads back)
97
98
  naro env import .env.qa qa Upload every variable in a dotenv file to one target (all by default; asks first,
98
- --yes in CI; invalid keys or values over 5 KB stop it before any request)
99
+ --yes in CI; an unclosed quote, an invalid key, ASSETS or a value over 5 KB
100
+ stops it before any request, and so does a key a storage binding already uses
101
+ when there are over 100 variables; an empty value is uploaded and shown (empty))
99
102
 
100
103
  naro environments List the project's environments: address, branch, protection, and how many the plan allows
101
104
  naro environments create qa --branch qa
@@ -202,6 +205,8 @@ naro storage bucket list | empty <name> | remove <name> [--empty] (empty and r
202
205
  naro storage ls naro://avatars/u1 [--recursive] [--search <text>] Names that start with <text>, ASCII case ignored
203
206
  naro storage cp ./me.png naro://avatars/u1/me.png [--upsert] Up to the object limit, under 4 GiB (over 50 MiB in parts), with the service key
204
207
  naro storage cp naro://docs/team-1/plan.pdf ./ Replaces a local file of the same name
208
+ naro storage cp naro://docs/a.pdf naro://docs/b.pdf [--upsert] Inside one bucket, up to 5 GiB − 5 MiB
209
+ naro storage mv naro://docs/a.pdf naro://docs/old/a.pdf Inside one bucket, up to 5 GiB − 5 MiB; never replaces
205
210
  naro storage rm naro://avatars/u1/old.png [--recursive] (asks first)
206
211
  naro storage rm naro://avatars/u1/ --recursive Everything under u1/; written u1, an object u1 too
207
212
 
@@ -326,10 +331,11 @@ four actions; any other new table is closed to the Data API until you give it
326
331
  a policy (`CREATE POLICY` in a migration, or `naro policy create` or
327
332
  `naro policy set`; the command says so).
328
333
  Policies go with their table, as in Postgres and as `naro db push` does it,
329
- in the same migration: a drop removes the table's policies, and a rename
334
+ in the same migration: a drop removes the table's policies, a rename
330
335
  moves them to the new name and rewrites the policies of other tables that
331
- read it (the command says which). A rename such a policy cannot follow is
332
- refused before anything runs. A table the command creates, or renames onto a
336
+ read it, and `rename-column` rewrites every policy that reads the column,
337
+ an owner rule's column included (the command says which). A rename such a
338
+ policy cannot follow is refused before anything runs. A table the command creates, or renames onto a
333
339
  name, never inherits what an earlier table of that name left there: that is
334
340
  removed first. A change that fails changes no policy. Whatever a command
335
341
  removes it prints so it can be made again: as `CREATE POLICY` statements, which
@@ -601,6 +607,11 @@ the `CREATE POLICY` statements again after the rename, in the same migration.
601
607
  A plain `ALTER TABLE a RENAME TO b` in a migration moves `a`'s policies to `b`,
602
608
  and a policy of another table that reads `a` is written to read `b` — do not
603
609
  create them again on `b`: a policy of the same name already there is refused.
610
+ `ALTER TABLE t RENAME COLUMN c TO d` writes every policy that reads `t.c` —
611
+ `t`'s own, another table's through a subquery, an owner rule's column — to
612
+ read `t.d`, so each keeps reading the column it read, as in Postgres. A rename
613
+ a policy cannot follow, such as giving a column the name of a dropped one that
614
+ a policy still reads, is refused before anything runs.
604
615
  `naro db table`, the table editor and MCP do the same.
605
616
  The answer's `warnings` lists the policies a migration removed, with SQL you
606
617
  can paste; it also says when the project has no backend yet (the policies are
@@ -826,6 +837,173 @@ An `--update-check` you give replaces the default: without
826
837
 
827
838
  ## Release notes
828
839
 
840
+ ### 0.19.1
841
+
842
+ 0.19.0 went out on 2026-10-19 without these.
843
+
844
+ - `naro git connect` says what to do when the link alone is not enough. The
845
+ control plane now records, for each team, only the repositories the people
846
+ who connected GitHub could read themselves (known-issues #232), and for an
847
+ account the team already holds it hands out an import link
848
+ (`/api/github/authorize`) rather than an install one. Without a terminal
849
+ or with `--json` the error reads
850
+ `Naro cannot reach <owner/repo> yet. Open <url> to give Naro access (if the repository is not among the ones the Naro GitHub App was granted on GitHub, add it there first), then run: naro git connect`
851
+ (0.19.0: `… Install the Naro GitHub App at <url>, then run: naro git connect`);
852
+ in a terminal, after `Opening <url>`, it adds
853
+ `If the repository is not among the ones the Naro GitHub App was granted on GitHub, add it there first.`
854
+ - `deployDirectory`, the library export the MCP server uses, now refuses
855
+ `production: true` with any `environment` (`""` too):
856
+ `VALIDATION_FAILED` `environment and production cannot be used together.`,
857
+ the control plane's own words, before any value is read, asked for or
858
+ sent and before the deployment is created (the MCP `deploy` tool still
859
+ signs in and looks the team up first). 0.19.0 sent both and left the
860
+ refusal to the control plane (a caller passing `onMissingEnv` was asked
861
+ for missing values first); a control plane from before named
862
+ environments 1b-2 ignores `environment` and would deploy to production.
863
+ - `naro env remove KEY` with no target, for a key only environments hold,
864
+ fails `ENV_NOT_FOUND`
865
+ `No KEY variable found outside named environments. Pass the environment to remove it: qa, staging.`
866
+ (`--json` details: `key`, `environments`) and still removes nothing. It
867
+ said `No KEY variable found.`, which a key no row has still gets.
868
+ - `naro env import` refuses more before any request, in this order:
869
+ `Cannot read <file>.`, `Unclosed quote in <file> at line <n>.`,
870
+ `No variables found in <file>.`, `Invalid keys in <file>: A-B, 1X.`,
871
+ `ASSETS is reserved for the project's static files; pick another name.`
872
+ (the env route's words) or `Values over 5 KB in <file>: BIG.` An empty
873
+ value (`KEY=`) is uploaded like any other and listed as `(empty)`, so a
874
+ file `naro env pull` wrote for a project holding one imports back. Past
875
+ 100 variables, and after you say yes, it reads the project's binding
876
+ names once (its storage bindings, `ASSETS`, and `DB` on a project with
877
+ the managed database) and fails `VALIDATION_FAILED`
878
+ `<KEY> is already used by a storage binding.` for the first key of the
879
+ file that is one, before the first request; the route refuses such a
880
+ key per request, which left the batches before it saved. Up to 100
881
+ variables ask nothing: one request is atomic on the server. Any other
882
+ refusal of a later request (a role, a race) still leaves the earlier
883
+ ones saved.
884
+ - Dotenv files are read the way Next.js reads them (dotenv 16, what
885
+ `next dev` runs), for `naro env import` and for the values `naro deploy`
886
+ reads from `.env.local` once you agree, so the value saved is the one
887
+ your app saw locally. A value in `'`, `"` or `` ` `` runs to its closing
888
+ quote over several lines (a PEM key, as `.env.local` for Next.js often
889
+ holds one). Inside double quotes `\n` and `\r` are a line break and a
890
+ carriage return and every other backslash stays as written (`\\` is two,
891
+ `\"` a backslash and a quote); single quotes and backticks are read as
892
+ written. An unquoted value ends at its first `#` (`abc#def` is `abc`).
893
+ CRLF ends a line, inside quotes too. A quote that never closes stays in
894
+ the value, as Next.js reads it (`naro env import` refuses the file). Unlike
895
+ Next.js, `$VAR` and `${VAR}` are not expanded: a value built from another
896
+ variable is saved as written. Before, a multi-line value was cut to its
897
+ first line, opening quote included, and a base64 line ending in `=`
898
+ became a key of its own.
899
+ - `naro env pull` writes each value so that dotenv and `naro env import`
900
+ read it back as it was (known-issues #224): bare when nothing in it needs
901
+ quoting, else in single quotes, in backticks when it holds `'`, or in
902
+ double quotes when it holds `'` and `` ` ``. A value with a carriage
903
+ return is written in double quotes with the carriage return as `\r`
904
+ (dotenv reads a carriage return written as is for a line break). A value
905
+ ending in a backslash is written bare. Next.js reads every value back as
906
+ it was except those with a `$`: it expands `$NAME` and `${NAME}`
907
+ (dotenv-expand) whatever the quotes, so a bcrypt hash `$2b$10$…` is cut
908
+ down (to `""`, or to what follows its first `.` or `/`) and `pa$$word` is
909
+ `pa$` for `next dev`, while `naro env import` reads them
910
+ unchanged. A value no dotenv line reads back fails before the overwrite
911
+ question and before anything is written, with `VALIDATION_FAILED`
912
+ ``Cannot write KEY1, KEY2 to a dotenv file: their values hold ', " and ` together.``
913
+ or, for the rarer carriage return beside `"`, backslash at the end, or
914
+ written-out `\n` beside `'` and `` ` ``,
915
+ `Cannot write KEY to a dotenv file: dotenv would not read their values back unchanged.`
916
+ followed by how to store such a value: without carriage returns or one of
917
+ the quote characters (a service-account JSON from a CRLF file:
918
+ `tr -d '\r' < sa.json | naro env add KEY`), or read it with
919
+ `naro env list --reveal` (`--json` details: `keys`). Before, it wrote such
920
+ values in double quotes with `\` and `"` escaped, which Next.js reads with
921
+ the backslashes: pull a file an earlier version wrote
922
+ again.
923
+ - On a backend from before named policies, renaming a column answers
924
+ `409 BACKEND_OUTDATED` until `naro backend enable` runs, as creating,
925
+ dropping or renaming a table does — through `naro db table`,
926
+ `naro db push` and `naro db query` alike.
927
+ - `naro db table rename-column`, and `ALTER TABLE … RENAME COLUMN` in
928
+ `naro db push` and `naro db query`, rewrite the Data API policies that read
929
+ the column, an owner rule's column included (known-issues #90): the
930
+ command prints
931
+ `⚠ Rewrote 1 policy that read members.user_id to read members.uid: docs.team.`.
932
+ Before, a policy reading the old name answered `500 POLICY_INVALID`, and
933
+ two columns swapped in one change left it reading the other column. The
934
+ warning that told you to run `naro policy set <table> --owner <new>` is
935
+ gone. A rename a policy cannot follow is refused before anything runs.
936
+ - `naro db push` and `naro db reset` check a migration's `ALTER TABLE …
937
+ RENAME` the way the control plane now reads it: a column rename whose
938
+ names cannot be read (`ALTER TABLE t RENAME COLUMN c TO` with nothing
939
+ after it, `t.c` for the column) is
940
+ `Statement <i> of <n>: the column name could not be read.` before anything
941
+ runs. Before, it reached D1 and failed as SQLite's syntax error.
942
+ - `naro storage mv naro://<bucket>/<from> naro://<bucket>/<to>` moves an
943
+ object inside its bucket, and `naro storage cp` between two `naro://`
944
+ paths of one bucket copies one there (Storage 3-1i), each up to
945
+ 5 GiB − 5 MiB. Over that the backend answers `413 OBJECT_TOO_LARGE`:
946
+ `Objects over 5,363,466,240 bytes (5 GiB − 5 MiB) cannot be copied or moved.`
947
+ A destination ending in `/`, or the bucket alone (`naro://docs`), takes the
948
+ object's name. `mv` never replaces an
949
+ object — a name that is taken answers `409 OBJECT_EXISTS`
950
+ `Object <path> already exists in bucket <bucket>. A move never replaces an object: remove it or choose another name.`
951
+ — and takes no `--upsert`, `--content-type` or `--cache-control`; `cp`
952
+ replaces one with `--upsert` and keeps the type and cache-control
953
+ (`--content-type` and `--cache-control` are refused).
954
+ Both refuse two buckets before any request:
955
+ `naro storage cp and mv work inside one bucket: both sides must be in naro://<bucket>.`
956
+ A name an upload or a download would refuse is refused before any request,
957
+ in the same words (`INVALID_PATH`
958
+ `The object path is not valid: it has an empty segment (//).`), and
959
+ `--recursive` is refused rather than dropped:
960
+ `naro storage mv takes no --recursive: it moves one object, naro://<bucket>/<path>. --recursive is for naro storage ls and rm.`
961
+ (`cp` between two `naro://` paths:
962
+ `A copy inside Storage takes no --recursive: it copies one object, naro://<bucket>/<path>. --recursive is for naro storage ls and rm.`).
963
+ A project backend from before this release answers them with
964
+ `BACKEND_OUTDATED`:
965
+ ``The project backend is older than this Storage command. Run `naro backend enable` to update it, then try again.``
966
+ `cp` between two `naro://` paths used to answer
967
+ `Copying inside Storage is not supported yet.` `--json` of a copy carries
968
+ `object` (`{ id, path, fullPath }`).
969
+ - `naro db lint` measures a `storage.objects` move too (Storage 3-1i): a
970
+ move binds its new name at every read of the UPDATE policy's check, so a
971
+ set whose UPDATE check reads `name` many times can now be refused before
972
+ it is pushed, though an overwrite under it fits; the backend would answer
973
+ every move `500 POLICY_INVALID`. A copy's claim is an upload's and changes
974
+ nothing.
975
+ - A table's policy can read `storage.objects` in a subquery (Storage 3-1j),
976
+ and so can a `realtime.messages` policy. `naro db push --dry-run`,
977
+ `naro db reset` and `naro policy create` take such a policy here, where
978
+ 0.18.0 and 0.19.0 refused it locally, before changing anything, with
979
+ `A policy cannot read storage.objects in a subquery yet at character <n>.`,
980
+ and `naro db lint` no longer reports a stored one as `rls_policy_invalid`
981
+ (known-issues #227). `naro db reset` lists a stored one your files do not
982
+ make with the SQL that keeps it, where 0.18.0 and 0.19.0 showed
983
+ `-- Policy <p> on <t> cannot be read (…)` in its place (in `--json` too)
984
+ and, once confirmed, dropped it with no SQL to make it again. The backend reads it through the caller's
985
+ `storage.objects` policies and only files that are fully there (not still
986
+ uploading or being removed); write `bucket_id = '<bucket>'` in the
987
+ subquery (`bucket_id in ('a', 'b')` for several buckets). A check never
988
+ finds a new file being uploaded or copied, or a move's new name, as in
989
+ Postgres. A backend
990
+ from before Storage 3-1j answers such a policy with
991
+ `409 BACKEND_OUTDATED`:
992
+ ``storage.objects is not available on this backend yet. Run `naro backend enable` to update it.``
993
+ `naro db lint` measures those policies inside the table's statement, and
994
+ for a signed-in caller whose email is not verified too.
995
+ - `naro db reset` refuses, before it drops anything (and on `--dry-run`
996
+ too), migration files the backend would stop at for Storage: a policy that
997
+ reads `storage.objects` in a subquery while the backend's ledger lacks
998
+ 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
1000
+ IF EXISTS, the `naro:owner` COMMENT) on a backend from before Storage or a
1001
+ project with none. It fails `BACKEND_OUTDATED`
1002
+ ``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.``
1003
+ (`--json` details: `migration`, `statement`). Before, the checks passed,
1004
+ the schema was dropped and the re-apply stopped at the control plane's
1005
+ `409 BACKEND_OUTDATED`, with `The schema is dropped and the re-apply stopped.`
1006
+
829
1007
  ### 0.19.0
830
1008
 
831
1009
  - `naro environments` manages a project's named environments, QA or staging
@@ -905,9 +1083,10 @@ An `--update-check` you give replaces the default: without
905
1083
  deploy gets. A production deploy now lists a key set only for preview as
906
1084
  missing, and a preview deploy one set only for production; an environment
907
1085
  deploy counts the `all` values and that environment's own. On an
908
- environment deploy, the values typed at the env prompt are saved for that
909
- environment alone, so a developer, who cannot change `all`, has them saved
910
- instead of listed under `⚠ skipped env:`. Production and preview deploys
1086
+ environment deploy, the values the deploy reads from your dotenv file
1087
+ (once you agree to it) are saved for that environment alone, so a
1088
+ developer, who cannot change `all`, has them saved instead of listed under
1089
+ `⚠ skipped env:`. Production and preview deploys
911
1090
  still save them for `all`. The hint names the environment too:
912
1091
  `npx naro-cli env add DATABASE_URL qa`.
913
1092
  - `naro env add` and `naro env remove` take an environment's slug as the
@@ -948,6 +1127,11 @@ An `--update-check` you give replaces the default: without
948
1127
  reads as `KEY`. Values with `\"` or `\\` inside double quotes are read as
949
1128
  written, not unescaped, so a file `naro env pull` wrote with such a value
950
1129
  does not import back as it was (known-issues #224).
1130
+ A value in quotes that runs over several lines (a PEM key) is cut to
1131
+ its first line, opening quote included, and a base64 line ending in
1132
+ `=` becomes a key of its own, though the result says `✅ Imported`.
1133
+ The values `naro deploy` reads from `.env.local` once you agree are cut
1134
+ the same way, with no warning. Use 0.19.1 for such a file.
951
1135
  - `naro env add` with a value typed at the prompt no longer loses it to a
952
1136
  refusal. It reads the project first, so a `--project` of another team or
953
1137
  of a deleted project fails `404 NOT_FOUND "Project not found."` before the
@@ -962,6 +1146,9 @@ An `--update-check` you give replaces the default: without
962
1146
  another. A piped value works as before.
963
1147
  - `naro usage` names a project that has moved to another team
964
1148
  `Moved to another team <id>`. Before, it read `Deleted project <id>`.
1149
+ - `naro usage` prints `<1%` for a meter that is used but under 1% of its
1150
+ limit (9,056 of 1,000,000 requests). Before, it printed `0%`, as if
1151
+ nothing had been used.
965
1152
  - `naro db reset` reads the migration files the way the control plane now
966
1153
  runs them: `ALTER TABLE a RENAME TO b` moves `a`'s policies to `b`
967
1154
  (known-issues #87), so a policy a renamed table took along is no longer
@@ -1405,5 +1592,5 @@ credentials live in `~/.naro/credentials.json` (0600).
1405
1592
  | ------------------------ | ---------------------------------------------- |
1406
1593
  | `NARO_TOKEN` | CI/agent access token (skips `naro login`) |
1407
1594
  | `NARO_CONTROL_PLANE_URL` | Custom control plane (default https://naro.sh) |
1408
- | `NARO_SERVICE_KEY` | Service key for `naro storage ls\|cp\|rm` |
1595
+ | `NARO_SERVICE_KEY` | Service key for `naro storage ls\|cp\|mv\|rm` |
1409
1596
  | `NARO_SUPABASE_URL/KEY` | Auth backend override (self-hosted setups) |