@revenexx/cli 0.2.1 → 0.3.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.
Files changed (124) hide show
  1. package/README.md +60 -4
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.mjs +12592 -7107
  4. package/dist/index.cjs +2 -64
  5. package/dist/index.js +2 -64
  6. package/dist/lib/client.d.ts +0 -46
  7. package/dist/lib/client.d.ts.map +1 -1
  8. package/dist/lib/commands/generators/base.d.ts +1 -1
  9. package/dist/lib/commands/generic.d.ts.map +1 -1
  10. package/dist/lib/commands/repl.d.ts.map +1 -1
  11. package/dist/lib/commands/services/carts-io.d.ts +3 -0
  12. package/dist/lib/commands/services/carts-io.d.ts.map +1 -0
  13. package/dist/lib/commands/services/carts-items.d.ts +3 -0
  14. package/dist/lib/commands/services/carts-items.d.ts.map +1 -0
  15. package/dist/lib/commands/services/customers-contacts.d.ts +3 -0
  16. package/dist/lib/commands/services/customers-contacts.d.ts.map +1 -0
  17. package/dist/lib/commands/services/customers-organizations.d.ts +3 -0
  18. package/dist/lib/commands/services/customers-organizations.d.ts.map +1 -0
  19. package/dist/lib/commands/services/customers-roles.d.ts +3 -0
  20. package/dist/lib/commands/services/customers-roles.d.ts.map +1 -0
  21. package/dist/lib/commands/services/customers-segments.d.ts +3 -0
  22. package/dist/lib/commands/services/customers-segments.d.ts.map +1 -0
  23. package/dist/lib/commands/services/customers-value-lists.d.ts +3 -0
  24. package/dist/lib/commands/services/customers-value-lists.d.ts.map +1 -0
  25. package/dist/lib/commands/services/customers.d.ts.map +1 -1
  26. package/dist/lib/commands/services/health.d.ts +3 -0
  27. package/dist/lib/commands/services/health.d.ts.map +1 -0
  28. package/dist/lib/commands/services/inventories-locations.d.ts +3 -0
  29. package/dist/lib/commands/services/inventories-locations.d.ts.map +1 -0
  30. package/dist/lib/commands/services/inventories-reservations.d.ts +3 -0
  31. package/dist/lib/commands/services/inventories-reservations.d.ts.map +1 -0
  32. package/dist/lib/commands/services/inventories-stock.d.ts +3 -0
  33. package/dist/lib/commands/services/inventories-stock.d.ts.map +1 -0
  34. package/dist/lib/commands/services/io.d.ts.map +1 -1
  35. package/dist/lib/commands/services/pages-collaboration.d.ts +3 -0
  36. package/dist/lib/commands/services/pages-collaboration.d.ts.map +1 -0
  37. package/dist/lib/commands/services/pages-delivery.d.ts +3 -0
  38. package/dist/lib/commands/services/pages-delivery.d.ts.map +1 -0
  39. package/dist/lib/commands/services/pages-editor.d.ts +3 -0
  40. package/dist/lib/commands/services/pages-editor.d.ts.map +1 -0
  41. package/dist/lib/commands/services/payments-ledger.d.ts +3 -0
  42. package/dist/lib/commands/services/payments-ledger.d.ts.map +1 -0
  43. package/dist/lib/commands/services/payments-methods.d.ts +3 -0
  44. package/dist/lib/commands/services/payments-methods.d.ts.map +1 -0
  45. package/dist/lib/commands/services/payments-providers.d.ts +3 -0
  46. package/dist/lib/commands/services/payments-providers.d.ts.map +1 -0
  47. package/dist/lib/commands/services/products-assets.d.ts +3 -0
  48. package/dist/lib/commands/services/products-assets.d.ts.map +1 -0
  49. package/dist/lib/commands/services/products-categories.d.ts +3 -0
  50. package/dist/lib/commands/services/products-categories.d.ts.map +1 -0
  51. package/dist/lib/commands/services/products-data-model.d.ts +3 -0
  52. package/dist/lib/commands/services/products-data-model.d.ts.map +1 -0
  53. package/dist/lib/commands/services/products-references.d.ts +3 -0
  54. package/dist/lib/commands/services/products-references.d.ts.map +1 -0
  55. package/dist/lib/commands/services/shipping-carriers.d.ts +3 -0
  56. package/dist/lib/commands/services/shipping-carriers.d.ts.map +1 -0
  57. package/dist/lib/commands/services/shipping-methods.d.ts +3 -0
  58. package/dist/lib/commands/services/shipping-methods.d.ts.map +1 -0
  59. package/dist/lib/commands/services/shipping-value-lists.d.ts +3 -0
  60. package/dist/lib/commands/services/shipping-value-lists.d.ts.map +1 -0
  61. package/dist/lib/commands/tui.d.ts.map +1 -1
  62. package/dist/lib/commands/watch.d.ts +23 -0
  63. package/dist/lib/commands/watch.d.ts.map +1 -0
  64. package/dist/lib/constants.d.ts +1 -1
  65. package/dist/lib/parser.d.ts.map +1 -1
  66. package/dist/lib/sdks.d.ts.map +1 -1
  67. package/dist/lib/tui/app.d.ts.map +1 -1
  68. package/dist/lib/tui/command-tree.d.ts +3 -2
  69. package/dist/lib/tui/command-tree.d.ts.map +1 -1
  70. package/dist/lib/tui/slash-commands.d.ts +62 -0
  71. package/dist/lib/tui/slash-commands.d.ts.map +1 -0
  72. package/dist/lib/tui/watch-create.d.ts +17 -0
  73. package/dist/lib/tui/watch-create.d.ts.map +1 -0
  74. package/dist/lib/tui/watch-pane.d.ts +7 -0
  75. package/dist/lib/tui/watch-pane.d.ts.map +1 -0
  76. package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
  77. package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
  78. package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
  79. package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
  80. package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
  81. package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
  82. package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
  83. package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -1
  84. package/dist/lib/watch/condition.d.ts +51 -0
  85. package/dist/lib/watch/condition.d.ts.map +1 -0
  86. package/dist/lib/watch/duration.d.ts +28 -0
  87. package/dist/lib/watch/duration.d.ts.map +1 -0
  88. package/dist/lib/watch/field-path.d.ts +54 -0
  89. package/dist/lib/watch/field-path.d.ts.map +1 -0
  90. package/dist/lib/watch/notify.d.ts +49 -0
  91. package/dist/lib/watch/notify.d.ts.map +1 -0
  92. package/dist/lib/watch/registry.d.ts +25 -0
  93. package/dist/lib/watch/registry.d.ts.map +1 -0
  94. package/dist/lib/watch/run-queue.d.ts +55 -0
  95. package/dist/lib/watch/run-queue.d.ts.map +1 -0
  96. package/dist/lib/watch/scheduler.d.ts +78 -0
  97. package/dist/lib/watch/scheduler.d.ts.map +1 -0
  98. package/dist/lib/watch/session.d.ts +17 -0
  99. package/dist/lib/watch/session.d.ts.map +1 -0
  100. package/dist/lib/watch/types.d.ts +144 -0
  101. package/dist/lib/watch/types.d.ts.map +1 -0
  102. package/dist/lib/watch/use-watchers.d.ts +25 -0
  103. package/dist/lib/watch/use-watchers.d.ts.map +1 -0
  104. package/dist/tests/watch-condition.test.d.ts +2 -0
  105. package/dist/tests/watch-condition.test.d.ts.map +1 -0
  106. package/dist/tests/watch-field-path.test.d.ts +2 -0
  107. package/dist/tests/watch-field-path.test.d.ts.map +1 -0
  108. package/dist/tests/watch-notify.test.d.ts +2 -0
  109. package/dist/tests/watch-notify.test.d.ts.map +1 -0
  110. package/dist/tests/watch-registry.test.d.ts +2 -0
  111. package/dist/tests/watch-registry.test.d.ts.map +1 -0
  112. package/dist/tests/watch-run-queue.test.d.ts +2 -0
  113. package/dist/tests/watch-run-queue.test.d.ts.map +1 -0
  114. package/dist/tests/watch-scheduler.test.d.ts +2 -0
  115. package/dist/tests/watch-scheduler.test.d.ts.map +1 -0
  116. package/package.json +1 -1
  117. package/dist/lib/commands/services/inventories.d.ts +0 -3
  118. package/dist/lib/commands/services/inventories.d.ts.map +0 -1
  119. package/dist/lib/commands/services/payments.d.ts +0 -3
  120. package/dist/lib/commands/services/payments.d.ts.map +0 -1
  121. package/dist/lib/commands/services/shipping.d.ts +0 -3
  122. package/dist/lib/commands/services/shipping.d.ts.map +0 -1
  123. package/dist/lib/commands/services/tokens.d.ts +0 -3
  124. package/dist/lib/commands/services/tokens.d.ts.map +0 -1
package/README.md CHANGED
@@ -28,7 +28,7 @@ Once the installation is complete, you can verify the install using
28
28
 
29
29
  ```sh
30
30
  $ revenexx -v
31
- 0.2.1
31
+ 0.3.0
32
32
  ```
33
33
 
34
34
  ### MacOS / Linux via [Homebrew](https://brew.sh)
@@ -70,7 +70,7 @@ On Windows, use `npm` — or download the `.exe` from the same release page.
70
70
  Once the installation completes, you can verify your install using
71
71
  ```
72
72
  $ revenexx -v
73
- 0.2.1
73
+ 0.3.0
74
74
  ```
75
75
 
76
76
  ## Getting Started
@@ -132,9 +132,10 @@ $ revenexx p ls # built-in aliases: same as `products list`
132
132
  $ revenexx alias set deploy "apps create-deployment --activate true"
133
133
  $ revenexx repl # interactive shell — many commands, one session
134
134
  $ revenexx tui # full-screen app — browse commands, forms, results
135
+ $ revenexx watch add --until 'status terminal' -- imports get --id imp_42
135
136
  ```
136
137
 
137
- A **production safety banner** is printed before most commands showing which tenant/endpoint you're hitting (prominent and red for production). Silence it with `-q`/`--quiet`. See [Command aliases](../README.md#command-aliases), [Production safety banner](../README.md#production-safety-banner), [`status`](../README.md#status), [Interactive shell (`repl`)](../README.md#interactive-shell-repl) and [Full-screen app (`tui`)](../README.md#full-screen-app-tui) in the README.
138
+ A **production safety banner** is printed before most commands showing which tenant/endpoint you're hitting (prominent and red for production). Silence it with `-q`/`--quiet`. See [Command aliases](../README.md#command-aliases), [Production safety banner](../README.md#production-safety-banner), [`status`](../README.md#status), [Interactive shell (`repl`)](../README.md#interactive-shell-repl), [Full-screen app (`tui`)](../README.md#full-screen-app-tui) and [Background watchers (`watch`)](../README.md#background-watchers-watch) in the README.
138
139
 
139
140
  > ### Note
140
141
  > By default, requests to domains with self-signed SSL certificates (or no certificates) are rejected. If you trust the host, you can bypass certificate validation using
@@ -152,6 +153,8 @@ The CLI has one command tree reachable three ways — every service command, plu
152
153
  | **Interactive shell** ([`repl`](#interactive-shell-repl)) | `revenexx repl` | Fire several commands in a row without re-typing `revenexx`. |
153
154
  | **Direct / one-shot** | `revenexx products list --json …` | Scripting, CI, pipes — flag-driven and non-interactive. |
154
155
 
156
+ Any of the interactive modes can also leave a [background watcher](#background-watchers-watch) polling a resource while you carry on.
157
+
155
158
  Running `revenexx` with no arguments on an interactive terminal launches the **full-screen app**. A partial or named invocation (`revenexx p`, `revenexx products`) still opens the guided command picker and resolves to a single one-shot command. Anything non-interactive — a pipe, CI, `--json`, or `--help` — prints help and never opens an interactive surface, so scripts stay byte-stable.
156
159
 
157
160
  **Opting out of the TUI default:** set `REVENEXX_NO_TUI=1` (any value other than `0`/`false`) to make a bare `revenexx` fall back to the guided picker. For a per-project default, add a `defaultMode:` key to `.revenexx.yaml` — `tui` (default), `guided` (the picker), or `help` (print usage). Explicit subcommands (`repl`, `tui`, any service command) always win regardless of this setting.
@@ -346,6 +349,7 @@ revenexx> exit
346
349
 
347
350
  - **Tab** completes top-level command names, then a service's subcommands.
348
351
  - `help` (or `?`) prints the command list; `exit` (or `quit`, `q`, Ctrl-D) leaves the shell.
352
+ - `watch add …` leaves a [background watcher](#background-watchers-watch) polling while you keep typing; it prints a line and rings the bell when it finishes.
349
353
  - Missing required options **prompt interactively** just like they do outside the shell (search/select), so `p get` will ask for the product id. Ctrl-C cancels the current line without leaving the shell.
350
354
  - The [production safety banner](#production-safety-banner) is shown before **every** command in the session (prominent and red for production) — the safeguard matters most in a rapid-fire shell. Launch with `revenexx --quiet repl` to silence it for the session.
351
355
 
@@ -366,8 +370,60 @@ $ revenexx tui # explicit, always works
366
370
  - **Forms:** `Tab`/`Shift+Tab` move between fields, `←`/`→`/`Space` cycle toggles and choices, `Enter` advances or runs, `^r` runs from any field. Values are validated on submit; secrets (password/token/api-key) are masked. Resource-id fields open the matching list as a **filterable table** — type to narrow it (server-side when the endpoint supports `search`, otherwise across the loaded rows), `↑`/`↓` to move, `Enter` to pick the highlighted record's id.
367
371
  - **JSON body fields:** an `object` parameter (e.g. `--data`) opens a full-screen **key/value editor** — `Enter` adds a field (or appends an array item), `Tab` switches between the key and value cell, `^d` deletes the focused field, `^s` saves it back to the form. Values are entered as JSON (`"text"`, `42`, `true`) and validated live, so the request body round-trips exactly. **Nested JSON** is edited in place: a value that is an object or array shows as `{ n fields }` / `[ n items ]`, and `→` drills into it one level deeper (breadcrumb `data › meta › [0]`, any depth); `Esc` goes back up a level (and cancels at the top). Type `{}` or `[]` into a value to start a nested container.
368
372
  - **Results:** table with `↑`/`↓` rows, `Enter` for row detail, `/` to filter the loaded rows (type to narrow across all columns, `Esc` clears), `←`/`→` to scroll columns, `n`/`p` to page, `o` to cycle output format (`table`/`json`/`jsonl`/`csv`), `y` to copy (`Y` copies the whole output), `c` to open the matching `create` form, `u` to open the matching `update` pre-filled, `d` to `delete` the record (behind the confirm modal), `e` to edit parameters. `u`/`d` act on the row under the cursor in a list, or on the single record from a `get`; `c` needs no row, so it works from an empty list too.
373
+ - **Watchlist:** type `/watch` to set up a background watcher and `/watchlist` to see them — see [Background watchers](#background-watchers-watch).
369
374
  - The header carries a persistent, filled yellow `▲ PRODUCTION` chip (the same [production safety](#production-safety-banner) signal) for the whole session.
370
- - Not browsable in the TUI (still available as one-shot commands): `tui`, `repl`, `update`, `generate`, `types`, `completion`.
375
+ - Not browsable in the TUI (still available as one-shot commands): `tui`, `repl`, `watch`, `update`, `generate`, `types`, `completion`.
376
+
377
+ ## Background watchers (`watch`)
378
+
379
+ A long-running operation — an import, a deployment, an order going through — usually ends with re-running the same `get` by hand until the status moves. A **watcher** does that for you: it polls one get-by-id command in the background and tells you when a field reaches the condition you named.
380
+
381
+ ```sh
382
+ # Block until the import finishes, then carry on (exit code says how it ended)
383
+ $ revenexx watch add --until 'status terminal' -- imports get --id imp_42 \
384
+ && revenexx products list
385
+ ```
386
+
387
+ Inside `repl` or `tui` the same command registers a watcher and hands the prompt straight back, so you keep working while it polls:
388
+
389
+ ```sh
390
+ revenexx> watch add --until 'status terminal' --every 5s -- imports get --id imp_42
391
+ ✓ watcher #1 · imports get imp_42 · status terminal · every 5s
392
+ revenexx> products list # keep working
393
+
394
+ ⏱ watcher #1 satisfied · status: processing → done · 42s ← prints itself, and rings the bell
395
+ ```
396
+
397
+ **Sub-commands**
398
+
399
+ | Command | Does |
400
+ |---|---|
401
+ | `watch add --until <expr> -- <get command>` | Start a watcher. Outside a session it blocks until the watcher settles. |
402
+ | `watch list` | Show this session's watchers with live state (`--json` for the full records). |
403
+ | `watch rm <id>` / `watch rm --all` | Cancel one, or every active one. |
404
+
405
+ **Conditions** — `--until` takes an optional field path followed by one of:
406
+
407
+ | Condition | Fires when the field… |
408
+ |---|---|
409
+ | `terminal` | stops moving — `done`, `ready`, `failed`, `cancelled`, … (both the wins **and** the failures, so a failed job stops the watcher instead of running out the clock) |
410
+ | `changed` | differs from its value on the first poll |
411
+ | `equals <value>` | matches exactly, case-insensitively (`equals 200` matches the number `200`) |
412
+ | `matches <regex>` | matches a regular expression (`/pattern/flags` also accepted) |
413
+ | `truthy` | becomes non-empty — `[]`, `{}`, `""`, `"false"` and `"0"` all count as empty |
414
+
415
+ Override the terminal set per watcher with `terminal(ready,failed)`, or process-wide with `REVENEXX_WATCH_TERMINAL_STATES`.
416
+
417
+ **Field paths** are dot paths into the response: `status`, `items.0.state`, `page.total`, `items.length`. There is no implicit descent into a list envelope — a page has as many statuses as it has rows, so say which one you mean. A field that isn't there yet is *not* an error; the watcher keeps polling until it appears or the budget runs out.
418
+
419
+ **Flags:** `--every` (interval, default 5s, floor 2s), `--for` (give up after, default 5m), `--field` (if you'd rather keep the path out of `--until`), `--wait-for-create` (treat `404` as "not yet" rather than fatal).
420
+
421
+ **Exit codes** for the blocking form, extending [the CLI's table](#machine-readable-errors--exit-codes): `0` satisfied, `7` timed out, `130` cancelled, otherwise the failing poll's own code (so `4` still means auth and `8` still means rate-limited).
422
+
423
+ - Watchers are **session-scoped and in-memory**: they live for the length of the `repl`/`tui` session (or the blocking command) and are torn down on exit. Nothing survives the process.
424
+ - Polling goes through the same transport as everything else, so the request timeout, retry/backoff and `429 Retry-After` handling all apply. The interval has a floor and ±15% jitter, and at most 8 watchers run at once.
425
+ - A poll already in flight cannot be cut short (the gateway client has no cancellation), so a watcher can overrun `--for` by up to one poll.
426
+ - Needs an interactive terminal. In a script, write the loop yourself around `<get command> --json` — that keeps piped output byte-identical.
371
427
 
372
428
  ## Global Configuration
373
429
 
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AA2DvB,OAAO,gCAAgC,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../cli.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AAgFvB,OAAO,gCAAgC,CAAC"}