@gapi/gcli 1.8.265 → 1.8.267

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-CLI.md CHANGED
@@ -32,6 +32,7 @@ Commands:
32
32
  mq-trigger:list [options] List the message-queue triggers of a project
33
33
  mq-trigger:create [options] Run a lambda for every message on a RabbitMQ queue
34
34
  mq-trigger:update [options] Change a message-queue trigger (same flags as create)
35
+ mq-trigger:apply [options] Create or update the message-queue triggers listed under triggers.mq in lambforge.yaml
35
36
  mq-trigger:delete [options] Delete a message-queue trigger
36
37
  cluster:create [options] Provision a private Talos cluster, or with --virtual a virtual cluster, for a project (runs in the background; use --wait to block)
37
38
  cluster:apply [options] Make a private cluster match the `cluster:` section of lambforge.yaml: creates it if missing, then applies topology, workers, control planes, load balancer and autoscaling
@@ -59,6 +60,7 @@ Commands:
59
60
  cluster:load-balancer [options] Add or remove the cluster's load balancer (billed per hour while enabled). On a virtual cluster this is its dedicated LB - its own IP; the platform subdomain keeps working either way
60
61
  rabbitmq:create [options] Provision a RabbitMQ broker for a project (a project may have several)
61
62
  rabbitmq:list [options] List every RabbitMQ broker for a project
63
+ queue:declare [options] Declare queues on a RabbitMQ broker of the project (skips the ones it has)
62
64
  rabbitmq:delete [options] Delete a RabbitMQ broker
63
65
  plugin:list List every plugin available in the marketplace catalog
64
66
  plugin:installed [options] List plugins installed for a project (may include the same plugin on several clusters)
@@ -183,6 +185,8 @@ Options:
183
185
  --concurrency <concurrency> Maximum number of pods specialized concurrently to serve requests
184
186
  --functionTimeout <functionTimeout> Maximum time for a request to wait for the response from the function
185
187
  --specializationTimeout <specializationTimeout> Timeout for executor to wait for function pod creation
188
+ --spread <spread> Where the replicas run (newdeploy): 'machines' = on different machines of the cluster, as evenly as possible; 'none' = the scheduler decides
189
+ --spreadStrict <spreadStrict> With --spread machines: 'true' = a replica waits rather than share a machine; 'false' (default) = prefer different machines, never block a scale-up
186
190
  -h, --help display help for command
187
191
  
188
192
  --- Subcommand: lambda:update ---
@@ -226,6 +230,8 @@ Options:
226
230
  --concurrency <concurrency> Maximum number of pods specialized concurrently to serve requests
227
231
  --functionTimeout <functionTimeout> Maximum time for a request to wait for the response from the function
228
232
  --specializationTimeout <specializationTimeout> Timeout for executor to wait for function pod creation
233
+ --spread <spread> Where the replicas run (newdeploy): 'machines' = on different machines of the cluster, as evenly as possible; 'none' = the scheduler decides
234
+ --spreadStrict <spreadStrict> With --spread machines: 'true' = a replica waits rather than share a machine; 'false' (default) = prefer different machines, never block a scale-up
229
235
  -h, --help display help for command
230
236
  
231
237
  --- Subcommand: lambda:delete ---
@@ -342,6 +348,8 @@ Options:
342
348
  --concurrency <concurrency> Maximum number of pods specialized concurrently to serve requests
343
349
  --functionTimeout <functionTimeout> Maximum time for a request to wait for the response from the function
344
350
  --specializationTimeout <specializationTimeout> Timeout for executor to wait for function pod creation
351
+ --spread <spread> Where the replicas run (newdeploy): 'machines' = on different machines of the cluster, as evenly as possible; 'none' = the scheduler decides
352
+ --spreadStrict <spreadStrict> With --spread machines: 'true' = a replica waits rather than share a machine; 'false' (default) = prefer different machines, never block a scale-up
345
353
  -h, --help display help for command
346
354
  
347
355
  --- Subcommand: project:list ---
@@ -596,6 +604,16 @@ Options:
596
604
  --threshold <n> Messages per replica before scaling out
597
605
  -h, --help display help for command
598
606
  
607
+ --- Subcommand: mq-trigger:apply ---
608
+ Usage: gcli mq-trigger:apply [options]
609
+
610
+ Create or update the message-queue triggers listed under triggers.mq in lambforge.yaml
611
+
612
+ Options:
613
+ -p, --project <project>
614
+ -spec, --spec <spec>
615
+ -h, --help display help for command
616
+ 
599
617
  --- Subcommand: mq-trigger:delete ---
600
618
  Usage: gcli mq-trigger:delete [options]
601
619
 
@@ -969,6 +987,20 @@ Options:
969
987
  -p, --project <project>
970
988
  -h, --help display help for command
971
989
  
990
+ --- Subcommand: queue:declare ---
991
+ Usage: gcli queue:declare [options]
992
+
993
+ Declare queues on a RabbitMQ broker of the project (skips the ones it has)
994
+
995
+ Options:
996
+ -p, --project <project>
997
+ -n, --name <name> Queue name; repeat for several. Without it:
998
+ queues.declare in lambforge.yaml
999
+ --broker <broker> Broker name or id (see rabbitmq:list); optional when
1000
+ the project has one
1001
+ -spec, --spec <spec>
1002
+ -h, --help display help for command
1003
+ 
972
1004
  --- Subcommand: rabbitmq:delete ---
973
1005
  Usage: gcli rabbitmq:delete [options]
974
1006
 
package/README.md CHANGED
@@ -55,7 +55,8 @@ Create the token in the dashboard (Project → CI/CD) with only the permissions
55
55
  | Environments: read / write / delete | `environment:list/get`, `environment:create/update`, `environment:delete` |
56
56
  | Schedules: read / write | `cron:list`, `cron:create/delete` |
57
57
  | RabbitMQ: read / install / uninstall | `rabbitmq:list`, `rabbitmq:create`, `rabbitmq:delete` |
58
- | Queue triggers: read / manage | `mq-trigger:list`, `mq-trigger:create/update/delete` |
58
+ | Queues: declare | `queue:declare` |
59
+ | Queue triggers: read / manage | `mq-trigger:list`, `mq-trigger:create/update/delete`, `mq-trigger:apply` (from `lambforge.yaml`) |
59
60
  | Plugins: read / install | `plugin:list/installed`, `plugin:install/uninstall` |
60
61
  | Clusters: read / scale / create / tear down / kubeconfig | `cluster:list/status/health/scale-events/cost`, `cluster:scale/autoscale/multi-node/single-node/load-balancer/apply`, `cluster:create/apply`, `cluster:teardown`, `cluster:kubeconfig`, `cluster:attach/nodes/pause/resume/detach` (your own machines, admin), `cluster:reset-machine`, `cluster:talosconfig` |
61
62
 
@@ -305,6 +306,34 @@ gcli mq-trigger:delete --name orders
305
306
 
306
307
  Scaling flags: `--max-retries`, `--cool-down-period`, `--polling-interval`, `--min-replicas`, `--max-replicas`, `--threshold` (messages per replica).
307
308
 
309
+ Queues and triggers can also live in `lambforge.yaml`, next to the lambda they belong to, and be applied on every deploy (both commands are safe to run again):
310
+
311
+ ```yaml
312
+ queues:
313
+ broker: events-broker # broker name or id; leave out when the project has one broker
314
+ declare: [orders, orders-done, orders-failed]
315
+
316
+ triggers:
317
+ mq:
318
+ - name: orders
319
+ # lambda: order-handler # default: this file's function.name
320
+ requestTopic: orders
321
+ responseTopic: orders-done
322
+ errorTopic: orders-failed
323
+ maxRetries: 2
324
+ minReplicas: 0
325
+ maxReplicas: 3
326
+ threshold: 20
327
+ ```
328
+
329
+ ```bash
330
+ gcli queue:declare # declares queues.declare; skips the ones the broker has
331
+ gcli queue:declare -n orders -n orders-done --broker events-broker # or by flag
332
+ gcli mq-trigger:apply # creates the missing triggers, updates the others; never deletes
333
+ ```
334
+
335
+ How a message is handled: the trigger calls the lambda over HTTP with the message as the request body. A 2xx answer publishes the lambda's response to `responseTopic` and removes the message. Anything else is retried `maxRetries` times right away, then the error goes to `errorTopic` and the message stays unacknowledged (it comes back when the trigger's pod restarts). A lambda that must not be re-run forever answers 200 and reports the failure in its response.
336
+
308
337
  ### Marketplace Plugins
309
338
 
310
339
  Plugins (Redis, MongoDB, NATS, FalkorDB, ...) can be installed on the shared cluster or on any private cluster - the same plugin can be installed on several clusters at once.
@@ -442,7 +471,7 @@ machine going down takes one replica, not several (use it with
442
471
  Flags: `--spread machines|none`, `--spreadStrict true|false`. Left out = the
443
472
  lambda keeps what it has. Changing it restarts the replicas once.
444
473
 
445
- The same file can also carry `cluster:`, `rabbitmq:`, `plugin:` and `triggers:` sections, read by `cluster:apply` / `cluster:create`, `rabbitmq:create`, `plugin:install` and `cron:create` respectively (each also accepts its own dedicated `--spec` file, e.g. `cluster.yaml`, if you'd rather keep them separate):
474
+ The same file can also carry `cluster:`, `rabbitmq:`, `plugin:`, `queues:` and `triggers:` sections, read by `cluster:apply` / `cluster:create`, `rabbitmq:create`, `plugin:install`, `queue:declare` and `cron:create` (`triggers.time`) / `mq-trigger:apply` (`triggers.mq`) respectively (each also accepts its own dedicated `--spec` file, e.g. `cluster.yaml`, if you'd rather keep them separate):
446
475
 
447
476
  ```yaml
448
477
  cluster: # every key: see "Declarative clusters" above
package/build.js CHANGED
@@ -5,6 +5,10 @@ require('esbuild')
5
5
  platform: 'node',
6
6
  target: 'node24',
7
7
  outfile: './release/index.js',
8
+ // `gcli --version` reads it (src/main.ts)
9
+ define: {
10
+ __GCLI_VERSION__: JSON.stringify(require('./package.json').version),
11
+ },
8
12
  external: process.env.BINARY_BUILD ? [] : ["esbuild"]
9
13
  })
10
14
  .then((data) => console.log('SUCCESS', data))
@@ -0,0 +1,26 @@
1
+ ## 2026-11-17 - mq-triggers-yaml: queue:declare, mq-trigger:apply and queues / triggers.mq in lambforge.yaml
2
+
3
+ **Feature:** mq-triggers-yaml · **Type:** feat
4
+
5
+ - `queue:declare` (new): declares queues on a broker of the project, from
6
+ `-n` (repeatable) or `queues.declare` in `lambforge.yaml`; skips queues
7
+ the broker already has. `GraphqlClienAPI.declareQueue`,
8
+ `commands/rabbitmq/declare-queue.ts`, `resolve-broker.ts` (broker by
9
+ name, id, or the only one).
10
+ - `mq-trigger:apply` (new): creates or updates the triggers listed under
11
+ `triggers.mq` in `lambforge.yaml`; `lambda` defaults to `function.name`.
12
+ `commands/triggers/message-queue/apply.ts`.
13
+ - `lambforge.yaml` schema: `queues: { broker?, declare[] }` and
14
+ `triggers.mq[]` (`load-spec.ts`). README: both commands, the yaml, and
15
+ how a message is acknowledged. `README-CLI.md` regenerated.
16
+ - **Test:** `npx jest --coverage=false
17
+ test/queue-and-mq-trigger-yaml.spec.ts` (9 tests: broker resolution,
18
+ queues to declare, yaml -> input, create vs update).
19
+ - **Debug:** `broker-needed` = several brokers and none named;
20
+ `broker-not-found` / `broker-ambiguous` = check `rabbitmq:list`;
21
+ `queue-exists-with-this-name` from the API = the queue is on the broker
22
+ but `rabbitmq:list` was stale.
23
+ - **Verification:** jest 13/13 on the two specs, `tsc --noEmit` clean; the
24
+ built CLI ran `queue:declare --help`, `rabbitmq:list` and
25
+ `mq-trigger:list` against prod (read-only). `queue:declare` and
26
+ `mq-trigger:apply` were not run against a real broker yet.
@@ -43,3 +43,4 @@ Outline (drop sections that don't apply):
43
43
  | `cli-browser-login` | [cli-browser-login.md](cli-browser-login.md) | Slice (canonical: graphql-server): `gcli login` with no token through the browser; `mcp:start` LambforgeLogin |
44
44
  | `lambda-site-url` | [lambda-site-url.md](lambda-site-url.md) | Slice (canonical: graphql-server-lambdas): `Site:` line after create/update |
45
45
  | `lambda-spread` | [lambda-spread.md](lambda-spread.md) | Slice (canonical: graphql-server-lambdas): replicas across machines (plan 33): `--spread` / `--spreadStrict`, yaml keys |
46
+ | `mq-triggers-yaml` | [mq-triggers-yaml.md](mq-triggers-yaml.md) | `queue:declare`, `mq-trigger:apply`, `queues:` / `triggers.mq` in `lambforge.yaml` (plan 34) |
@@ -0,0 +1,39 @@
1
+ # mq-triggers-yaml
2
+
3
+ **Status:** built 2026-11-17 (plan 34 step 5: the first lambda that declares
4
+ its queues and its queue trigger in `lambforge.yaml`). Not released yet.
5
+
6
+ ## What it is
7
+
8
+ - `queue:declare` - declares queues on a broker of the project. Names from
9
+ `-n` (repeatable) or `queues.declare` in `lambforge.yaml`; `--broker` /
10
+ `queues.broker` is a broker name or id, optional with one broker. Durable,
11
+ not auto-delete. A queue the broker already has is skipped, so it can run
12
+ on every deploy. (`declareQueue` existed in the API and MCP only.)
13
+ - `mq-trigger:apply` - reads `triggers.mq` (a list) and creates the missing
14
+ triggers, updates the others (same merge as `mq-trigger:update`). `lambda`
15
+ defaults to the file's `function.name`; the broker is resolved to its id.
16
+ Never deletes.
17
+ - yaml schema: `QueuesConfig`, `MqTriggerConfig` in
18
+ `src/commands/lambda/helpers/load-spec.ts`.
19
+
20
+ ## Where
21
+
22
+ | What | File |
23
+ |---|---|
24
+ | broker by name / id / the only one; queues still missing | `src/commands/rabbitmq/resolve-broker.ts` |
25
+ | `queue:declare` | `src/commands/rabbitmq/declare-queue.ts` |
26
+ | `mq-trigger:apply` | `src/commands/triggers/message-queue/apply.ts` |
27
+ | `declareQueue` mutation | `src/services/gql-client.ts` |
28
+
29
+ ## How to test
30
+
31
+ `npx jest --coverage=false test/queue-and-mq-trigger-yaml.spec.ts
32
+ test/mq-trigger.spec.ts`. Live: `gcli rabbitmq:list`, `gcli queue:declare -n
33
+ <q>`, `gcli mq-trigger:apply` in a folder with a `lambforge.yaml`.
34
+
35
+ ## Not in it
36
+
37
+ - Connector concurrency per trigger (the connector takes 10 messages at
38
+ once by default) - needs a field in the API first.
39
+ - Deleting queues / triggers that left the yaml.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.265",
3
+ "version": "1.8.267",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"