@gapi/gcli 1.8.245 → 1.8.247

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
@@ -69,6 +69,19 @@ Commands:
69
69
  workspace:start [options] Connect the current directory to the Lambforge chat as a local workspace: the AI agents can read/edit its files and run commands here (outbound connection only - works behind NAT)
70
70
  workspace:list [options] List your local workspaces (online status, directory, processes)
71
71
  workspace:delete [options] Delete a local workspace and revoke its token (default: the one registered for this directory)
72
+ workflow:list [options] List the project workflows
73
+ workflow:get [options] Print a workflow as YAML (the format workflow:apply reads), or write it with -o
74
+ workflow:generate [options] Draft a workflow with AI from plain language (or change one with --name / --from). Prints or writes YAML; saves only with --apply
75
+ workflow:apply [options] Create or update a workflow from a YAML/JSON file (workflow: {name, description, definition})
76
+ workflow:validate [options] Check a workflow file against the cluster (lambdas exist, graph is valid)
77
+ workflow:delete [options] Delete a workflow and all of its runs
78
+ workflow:run [options] Start a run; the JSON input is the first step request body. --wait follows it to the end
79
+ workflow:runs [options] List a workflow runs, newest first
80
+ workflow:status [options] Show a run: its step events, error and output (--follow until it ends)
81
+ workflow:cancel [options] Cancel a running run
82
+ workflow:trigger:add [options] Start runs from an HTTP URL (--http; the JSON body is the input) or a schedule (--cron). Needs Fission 1.26+ on the cluster
83
+ workflow:trigger:list [options] List a workflow HTTP and schedule triggers
84
+ workflow:trigger:remove [options] Remove a workflow trigger
72
85
  help [command] display help for command
73
86
  
74
87
  --- Subcommand: login ---
@@ -1009,3 +1022,158 @@ Delete a local workspace and revoke its token (default: the one registered for t
1009
1022
  Options:
1010
1023
  --id <id> Workspace id (see `gcli workspace:list`)
1011
1024
  -h, --help display help for command
1025
+ 
1026
+ --- Subcommand: workflow:list ---
1027
+ Usage: gcli workflow:list [options]
1028
+
1029
+ List the project workflows
1030
+
1031
+ Options:
1032
+ -p, --project <project>
1033
+ -h, --help display help for command
1034
+ 
1035
+ --- Subcommand: workflow:get ---
1036
+ Usage: gcli workflow:get [options]
1037
+
1038
+ Print a workflow as YAML (the format workflow:apply reads), or write it with -o
1039
+
1040
+ Options:
1041
+ -p, --project <project>
1042
+ -n, --name <name> Workflow name
1043
+ -o, --out <file> Write the YAML to this file
1044
+ -h, --help display help for command
1045
+ 
1046
+ --- Subcommand: workflow:generate ---
1047
+ Usage: gcli workflow:generate [options]
1048
+
1049
+ Draft a workflow with AI from plain language (or change one with --name / --from). Prints or writes YAML; saves only with --apply
1050
+
1051
+ Options:
1052
+ -p, --project <project>
1053
+ -d, --description <text> What the workflow should do, e.g. "charge the card
1054
+ with retries, then email the receipt"
1055
+ -n, --name <name> Workflow name: an existing one is changed, a new
1056
+ one is named so
1057
+ --from <file> Change this workflow file instead
1058
+ -o, --out <file> Write the draft YAML to this file
1059
+ --apply Save the draft as the workflow (needs a name)
1060
+ -h, --help display help for command
1061
+ 
1062
+ --- Subcommand: workflow:apply ---
1063
+ Usage: gcli workflow:apply [options]
1064
+
1065
+ Create or update a workflow from a YAML/JSON file (workflow: {name, description, definition})
1066
+
1067
+ Options:
1068
+ -p, --project <project>
1069
+ -f, --file <file> Workflow file
1070
+ -n, --name <name> Overrides workflow.name from the file
1071
+ -d, --description <text> Overrides workflow.description
1072
+ -h, --help display help for command
1073
+ 
1074
+ --- Subcommand: workflow:validate ---
1075
+ Usage: gcli workflow:validate [options]
1076
+
1077
+ Check a workflow file against the cluster (lambdas exist, graph is valid)
1078
+
1079
+ Options:
1080
+ -p, --project <project>
1081
+ -f, --file <file> Workflow file
1082
+ -h, --help display help for command
1083
+ 
1084
+ --- Subcommand: workflow:delete ---
1085
+ Usage: gcli workflow:delete [options]
1086
+
1087
+ Delete a workflow and all of its runs
1088
+
1089
+ Options:
1090
+ -p, --project <project>
1091
+ -n, --name <name> Workflow name
1092
+ -h, --help display help for command
1093
+ 
1094
+ --- Subcommand: workflow:run ---
1095
+ Usage: gcli workflow:run [options]
1096
+
1097
+ Start a run; the JSON input is the first step request body. --wait follows it to the end
1098
+
1099
+ Options:
1100
+ -p, --project <project>
1101
+ -n, --name <name> Workflow name
1102
+ -i, --input <json> Run input as JSON (default {})
1103
+ --input-file <file> Read the run input from a JSON file
1104
+ -w, --wait Print each step as it happens until the run ends
1105
+ -h, --help display help for command
1106
+ 
1107
+ --- Subcommand: workflow:runs ---
1108
+ Usage: gcli workflow:runs [options]
1109
+
1110
+ List a workflow runs, newest first
1111
+
1112
+ Options:
1113
+ -p, --project <project>
1114
+ -n, --name <name> Workflow name
1115
+ -l, --limit <limit> How many (default 50)
1116
+ -h, --help display help for command
1117
+ 
1118
+ --- Subcommand: workflow:status ---
1119
+ Usage: gcli workflow:status [options]
1120
+
1121
+ Show a run: its step events, error and output (--follow until it ends)
1122
+
1123
+ Options:
1124
+ -p, --project <project>
1125
+ -n, --name <name> Workflow name
1126
+ -r, --run <run> Run name (see workflow:runs)
1127
+ -f, --follow Keep printing events until the run ends
1128
+ -h, --help display help for command
1129
+ 
1130
+ --- Subcommand: workflow:cancel ---
1131
+ Usage: gcli workflow:cancel [options]
1132
+
1133
+ Cancel a running run
1134
+
1135
+ Options:
1136
+ -p, --project <project>
1137
+ -n, --name <name> Workflow name
1138
+ -r, --run <run> Run name (see workflow:runs)
1139
+ -h, --help display help for command
1140
+ 
1141
+ --- Subcommand: workflow:trigger:add ---
1142
+ Usage: gcli workflow:trigger:add [options]
1143
+
1144
+ Start runs from an HTTP URL (--http; the JSON body is the input) or a schedule (--cron). Needs Fission 1.26+ on the cluster
1145
+
1146
+ Options:
1147
+ -p, --project <project>
1148
+ -n, --name <name> Workflow name
1149
+ --http An HTTP trigger: <router>/<project>/workflows/<path>
1150
+ --path <path> HTTP path under /workflows/ (default: the workflow
1151
+ name)
1152
+ --method <methods> HTTP methods, comma separated (default POST)
1153
+ --cron <schedule> A schedule: "@every 1h", "0 9 * * 1-5", "@daily"
1154
+ (UTC)
1155
+ -i, --input <json> Schedule: the input of every run (default {})
1156
+ --input-file <file> Schedule: read the run input from a JSON file
1157
+ -h, --help display help for command
1158
+ 
1159
+ --- Subcommand: workflow:trigger:list ---
1160
+ Usage: gcli workflow:trigger:list [options]
1161
+
1162
+ List a workflow HTTP and schedule triggers
1163
+
1164
+ Options:
1165
+ -p, --project <project>
1166
+ -n, --name <name> Workflow name
1167
+ -h, --help display help for command
1168
+ 
1169
+ --- Subcommand: workflow:trigger:remove ---
1170
+ Usage: gcli workflow:trigger:remove [options]
1171
+
1172
+ Remove a workflow trigger
1173
+
1174
+ Options:
1175
+ -p, --project <project>
1176
+ -n, --name <name> Workflow name
1177
+ -t, --trigger <trigger> Trigger id, path or schedule (see
1178
+ workflow:trigger:list)
1179
+ -h, --help display help for command
package/README.md CHANGED
@@ -761,6 +761,79 @@ gcli cron:list
761
761
  gcli cron:delete --lambdaName 'my-function'
762
762
  ```
763
763
 
764
+ ### Workflows
765
+
766
+ A workflow runs several lambdas as one process: each step gets the previous
767
+ step's response, steps can retry, branch (Choice), fan out (Parallel / Map)
768
+ or wait, and every run is recorded step by step. Workflows must be included
769
+ in the project's plan (`allowWorkflows`).
770
+
771
+ ```bash
772
+ # Draft one with AI from plain language (MiniMax), review the YAML, save it
773
+ gcli workflow:generate -d "charge the card with retries; if it fails wait 1h and email the customer; otherwise send the receipt" -o order-flow.yaml
774
+ gcli workflow:apply -f order-flow.yaml --name order-flow # create or update by name
775
+
776
+ # Or change an existing one in place
777
+ gcli workflow:generate --name order-flow -d "add a 5 minute wait before the email" --apply
778
+
779
+ # Run it and watch each step
780
+ gcli workflow:run --name order-flow --input '{"orderId": 42}' --wait
781
+ gcli workflow:runs --name order-flow
782
+ gcli workflow:status --name order-flow --run order-flow-abc12 --follow
783
+ gcli workflow:cancel --name order-flow --run order-flow-abc12
784
+
785
+ gcli workflow:list
786
+ gcli workflow:get --name order-flow -o order-flow.yaml # edit, then workflow:apply
787
+ gcli workflow:validate -f order-flow.yaml
788
+ gcli workflow:delete --name order-flow # also deletes its runs
789
+ ```
790
+
791
+ **Triggers** start runs without anyone calling `workflow:run` (Fission 1.26+
792
+ on the workflow's cluster creates the run itself):
793
+
794
+ ```bash
795
+ # An HTTP URL: every request starts a run, the JSON body is the run input,
796
+ # the answer is 202 {"run": "..."}; default path = the workflow name, POST
797
+ gcli workflow:trigger:add --name order-flow --http --path orders --method POST
798
+ curl -X POST 'https://functions.lambforge.com/<projectId>/workflows/orders' -d '{"orderId": 42}'
799
+
800
+ # A schedule (UTC) with a fixed run input
801
+ gcli workflow:trigger:add --name nightly-report --cron "0 6 * * *" --input '{"scope": "all"}'
802
+
803
+ gcli workflow:trigger:list --name order-flow
804
+ gcli workflow:trigger:remove --name order-flow --trigger orders # id, path or schedule
805
+ ```
806
+
807
+ `workflow:runs` shows how each run started (`manual`, `http`, `schedule`).
808
+
809
+ The file `workflow:get` / `workflow:generate` write (and `workflow:apply`
810
+ reads) - a Fission `kind: Workflow` manifest or a bare `startAt` + `states`
811
+ works too:
812
+
813
+ ```yaml
814
+ workflow:
815
+ name: order-flow
816
+ description: Charge, then mail the receipt
817
+ definition:
818
+ startAt: charge
819
+ states:
820
+ charge:
821
+ type: Task
822
+ function: { type: name, name: charge }
823
+ retry: { maxAttempts: 3, backoffBase: 2s, backoffCap: 30s }
824
+ next: mail
825
+ mail:
826
+ type: Task
827
+ function: { type: name, name: mailer }
828
+ end: true
829
+ ```
830
+
831
+ Step types: Task (call a lambda), Choice (branch on a value), Parallel,
832
+ Map (once per list item), Wait (durable pause), Succeed, Fail. A step gets
833
+ one attempt unless it has `retry`. Runs can only be started by
834
+ `workflow:run` (or the UI / API) - HTTP and cron triggers cannot start a
835
+ workflow yet.
836
+
764
837
  ### Monitoring & Testing
765
838
 
766
839
  Debug your functions directly from the terminal.
@@ -0,0 +1,8 @@
1
+ ## 2026-10-25 - workflows: workflow commands with AI drafts
2
+
3
+ **Feature:** workflows · **Type:** feat
4
+
5
+ - New `workflow:*` commands (`src/commands/workflow/`): list, get (YAML), generate (AI draft via `generateWorkflowDraft`, from plain language or as a change to an existing workflow / file; `-o` writes YAML, `--apply` saves), apply (create or update by name), validate, delete, run (`--wait` prints each step event live until the run ends), runs, status (`--follow`), cancel. Workflows are addressed by name. Files: `workflow: {name, description, definition}`, a `kind: Workflow` manifest, or a bare definition. API in `gql-client.ts` (Workflows section), fragments in `services/types/workflow.fragment.ts`.
6
+ - **Test:** `npx jest --coverage=false test/workflow.spec.ts` (file shapes, input parsing, event rendering, apply create/update, generate change + apply, run --wait).
7
+ - **Debug:** see `docs/features/workflows.md`; the commands need a user login (not granted to CI tokens yet).
8
+ - **Verification:** jest 6/6; tsc + eslint clean; build OK and `--help` lists the 10 commands (`release/index.js` restored, README-CLI.md regenerated); all 10 GraphQL documents validated against the live local gateway schema. Not run end to end here: the gcli login points at production, which has no workflows yet.
@@ -0,0 +1,23 @@
1
+ ## 2026-10-26 - workflows: workflow:trigger commands for HTTP and schedule triggers
2
+
3
+ **Feature:** workflows · **Type:** feat
4
+
5
+ - `workflow:trigger:add` (`--http [--path] [--method]` or `--cron
6
+ "<schedule>" [-i | --input-file]`), `workflow:trigger:list`,
7
+ `workflow:trigger:remove -t <id | path | schedule | Fission name>`
8
+ (`src/commands/workflow/trigger-*.ts`), on the graphql-server-lambdas
9
+ `addWorkflowTrigger` / `removeWorkflowTrigger` (Fission 1.26+ fork
10
+ `workflow-triggers` creates the runs).
11
+ - Option handling and output are pure (`triggers.ts`: `buildTriggerInput`,
12
+ `findTrigger`, `triggerRow`, `runSource`); `workflow:runs` gained a `by`
13
+ column (manual / http / schedule). `WorkflowFragment.triggers`,
14
+ `WorkflowRunFragment.triggerKind / triggerName`; client calls in
15
+ `gql-client.ts`.
16
+ - README Workflows section + regenerated `README-CLI.md`.
17
+ - **Test:** `npx jest --coverage=false test/workflow.spec.ts` (11 pass, 5 new).
18
+ - **Debug:** `Workflow triggers need Fission 1.26 or newer on this cluster`
19
+ is the backend saying the cluster is too old; `Pass either --http or
20
+ --cron` is the option check.
21
+ - **Verification:** gcli jest 114/114; tsc + eslint clean; the new
22
+ mutations and fragments validated against the local gateway schema;
23
+ not run against production (gcli login points at production).
@@ -35,3 +35,4 @@ Outline (drop sections that don't apply):
35
35
  | `lambforge-agent-skill` | [lambforge-agent-skill.md](lambforge-agent-skill.md) | The agent skill that teaches gcli + `mcp:start`; canonical doc in gql-fission |
36
36
  | `dedicated-platform-cluster` | [dedicated-platform-cluster.md](dedicated-platform-cluster.md) | `cluster:status/health/scale/autoscale/...` commands; canonical doc in lambforge-agent |
37
37
  | `ci-token-scopes` | [ci-token-scopes.md](ci-token-scopes.md) | Which permission each command needs; `mq-trigger:*` commands; canonical doc in graphql-server |
38
+ | `workflows` | [workflows.md](workflows.md) | `workflow:*` commands incl. AI drafts (`workflow:generate`); canonical doc in graphql-server-lambdas |
@@ -0,0 +1,64 @@
1
+ # Workflows — gcli slice
2
+
3
+ **Feature slug:** `workflows` · canonical doc:
4
+ `graphql-server-lambdas/docs/features/workflows.md` (AI drafts:
5
+ `graphql-server/docs/features/workflows.md`).
6
+
7
+ `workflow:*` commands (`src/commands/workflow/`), all as the `gcli login`
8
+ user through the gateway; workflows are addressed by **name** (resolved to
9
+ the id with `listWorkflows`):
10
+
11
+ | Command | API |
12
+ |---|---|
13
+ | `workflow:list` | `listWorkflows` |
14
+ | `workflow:get -n [-o file]` | `listWorkflows` → YAML |
15
+ | `workflow:generate -d "..." [-n name \| --from file] [-o file] [--apply]` | `generateWorkflowDraft` (graphql-server, MiniMax M3.1 Flash); `--apply` = `workflow:apply` |
16
+ | `workflow:apply -f file [-n] [-d]` | `createWorkflow`, or `updateWorkflow` when the name exists |
17
+ | `workflow:validate -f file` | `validateWorkflow` (graph + lambdas on the cluster) |
18
+ | `workflow:delete -n` | `deleteWorkflow` (runs too) |
19
+ | `workflow:run -n [-i json \| --input-file] [--wait]` | `startWorkflowRun`; `--wait` polls `getWorkflowRun` every 2 s and prints each new event until the run is terminal |
20
+ | `workflow:runs -n [-l]` | `listWorkflowRuns` (column `by`: manual / http / schedule, from `triggerKind`) |
21
+ | `workflow:status -n -r run [--follow]` | `getWorkflowRun` (events, error, output) |
22
+ | `workflow:cancel -n -r run` | `cancelWorkflowRun` |
23
+ | `workflow:trigger:add -n (--http [--path] [--method a,b] \| --cron "<schedule>" [-i json \| --input-file])` | `addWorkflowTrigger`; prints the trigger and, for HTTP, a `curl` line |
24
+ | `workflow:trigger:list -n` | the workflow's `triggers` (id, kind, URL or schedule, input) |
25
+ | `workflow:trigger:remove -n -t <id \| path \| schedule \| Fission name>` | `removeWorkflowTrigger` |
26
+
27
+ Triggers (2026-10-26) are HTTP URLs (`<router>/<projectId>/workflows/<path>`,
28
+ the JSON body is the run input, 202 `{run}`) and schedules (cron, UTC, with a
29
+ fixed input) that start runs. Fission 1.26+ (fork `workflow-triggers`) on the
30
+ workflow's cluster creates the run. The option handling is pure and tested:
31
+ `src/commands/workflow/triggers.ts` (`buildTriggerInput`, `findTrigger`,
32
+ `triggerRow`, `runSource`).
33
+
34
+ The workflow file (`definition.ts` `parseWorkflowFile`) accepts
35
+ `workflow: {name, description, clusterId, definition}`, the same without the
36
+ `workflow:` key, a Fission `kind: Workflow` manifest, or a bare definition;
37
+ `toWorkflowYaml` writes the first form. API calls are in
38
+ `src/services/gql-client.ts` (Workflows section), selection sets in
39
+ `src/services/types/workflow.fragment.ts`, types in
40
+ `src/commands/workflow/types.ts`.
41
+
42
+ Not granted to CI tokens (INTEGRATION role) yet: the workflow resolvers are
43
+ USER-only in graphql-server-lambdas, so these commands need `gcli login`.
44
+
45
+ ## How to test
46
+
47
+ `npx jest --coverage=false test/workflow.spec.ts`. Real: log in to a
48
+ gateway whose project has `allowWorkflows`, then
49
+ `gcli workflow:generate -d "..." -n demo --apply` and
50
+ `gcli workflow:run -n demo --wait`; triggers:
51
+ `gcli workflow:trigger:add -n demo --http`, then `curl -X POST <url> -d '{}'`
52
+ and `gcli workflow:runs -n demo` shows the run `by` http.
53
+
54
+ ## How to debug
55
+
56
+ - `No workflow "x"`: names are per project (`-p` or the `gcli login`
57
+ project).
58
+ - `Workflows are not available on your current plan`: the plan lacks
59
+ `allowWorkflows`.
60
+ - `Workflows are not enabled on this cluster`: the cluster runs Fission
61
+ without `workflows.enabled` (canonical doc, Requires).
62
+ - `Workflow triggers need Fission 1.26 or newer on this cluster`: the
63
+ cluster's Fission CRDs predate workflow triggers.
64
+ - `Pass either --http or --cron`: exactly one of them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.245",
3
+ "version": "1.8.247",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"