@gapi/gcli 1.8.245 → 1.8.246
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 +125 -0
- package/README.md +55 -0
- package/docs/changelog.d/2026-10-25-workflows-workflow-commands-with-ai-drafts.md +8 -0
- package/docs/features/README.md +1 -0
- package/docs/features/workflows.md +49 -0
- package/package.json +1 -1
- package/release/index.js +3005 -1485
package/README-CLI.md
CHANGED
|
@@ -69,6 +69,16 @@ 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
|
|
72
82
|
help [command] display help for command
|
|
73
83
|
[36m
|
|
74
84
|
--- Subcommand: login ---[0m
|
|
@@ -1009,3 +1019,118 @@ Delete a local workspace and revoke its token (default: the one registered for t
|
|
|
1009
1019
|
Options:
|
|
1010
1020
|
--id <id> Workspace id (see `gcli workspace:list`)
|
|
1011
1021
|
-h, --help display help for command
|
|
1022
|
+
[36m
|
|
1023
|
+
--- Subcommand: workflow:list ---[0m
|
|
1024
|
+
Usage: gcli workflow:list [options]
|
|
1025
|
+
|
|
1026
|
+
List the project workflows
|
|
1027
|
+
|
|
1028
|
+
Options:
|
|
1029
|
+
-p, --project <project>
|
|
1030
|
+
-h, --help display help for command
|
|
1031
|
+
[36m
|
|
1032
|
+
--- Subcommand: workflow:get ---[0m
|
|
1033
|
+
Usage: gcli workflow:get [options]
|
|
1034
|
+
|
|
1035
|
+
Print a workflow as YAML (the format workflow:apply reads), or write it with -o
|
|
1036
|
+
|
|
1037
|
+
Options:
|
|
1038
|
+
-p, --project <project>
|
|
1039
|
+
-n, --name <name> Workflow name
|
|
1040
|
+
-o, --out <file> Write the YAML to this file
|
|
1041
|
+
-h, --help display help for command
|
|
1042
|
+
[36m
|
|
1043
|
+
--- Subcommand: workflow:generate ---[0m
|
|
1044
|
+
Usage: gcli workflow:generate [options]
|
|
1045
|
+
|
|
1046
|
+
Draft a workflow with AI from plain language (or change one with --name / --from). Prints or writes YAML; saves only with --apply
|
|
1047
|
+
|
|
1048
|
+
Options:
|
|
1049
|
+
-p, --project <project>
|
|
1050
|
+
-d, --description <text> What the workflow should do, e.g. "charge the card
|
|
1051
|
+
with retries, then email the receipt"
|
|
1052
|
+
-n, --name <name> Workflow name: an existing one is changed, a new
|
|
1053
|
+
one is named so
|
|
1054
|
+
--from <file> Change this workflow file instead
|
|
1055
|
+
-o, --out <file> Write the draft YAML to this file
|
|
1056
|
+
--apply Save the draft as the workflow (needs a name)
|
|
1057
|
+
-h, --help display help for command
|
|
1058
|
+
[36m
|
|
1059
|
+
--- Subcommand: workflow:apply ---[0m
|
|
1060
|
+
Usage: gcli workflow:apply [options]
|
|
1061
|
+
|
|
1062
|
+
Create or update a workflow from a YAML/JSON file (workflow: {name, description, definition})
|
|
1063
|
+
|
|
1064
|
+
Options:
|
|
1065
|
+
-p, --project <project>
|
|
1066
|
+
-f, --file <file> Workflow file
|
|
1067
|
+
-n, --name <name> Overrides workflow.name from the file
|
|
1068
|
+
-d, --description <text> Overrides workflow.description
|
|
1069
|
+
-h, --help display help for command
|
|
1070
|
+
[36m
|
|
1071
|
+
--- Subcommand: workflow:validate ---[0m
|
|
1072
|
+
Usage: gcli workflow:validate [options]
|
|
1073
|
+
|
|
1074
|
+
Check a workflow file against the cluster (lambdas exist, graph is valid)
|
|
1075
|
+
|
|
1076
|
+
Options:
|
|
1077
|
+
-p, --project <project>
|
|
1078
|
+
-f, --file <file> Workflow file
|
|
1079
|
+
-h, --help display help for command
|
|
1080
|
+
[36m
|
|
1081
|
+
--- Subcommand: workflow:delete ---[0m
|
|
1082
|
+
Usage: gcli workflow:delete [options]
|
|
1083
|
+
|
|
1084
|
+
Delete a workflow and all of its runs
|
|
1085
|
+
|
|
1086
|
+
Options:
|
|
1087
|
+
-p, --project <project>
|
|
1088
|
+
-n, --name <name> Workflow name
|
|
1089
|
+
-h, --help display help for command
|
|
1090
|
+
[36m
|
|
1091
|
+
--- Subcommand: workflow:run ---[0m
|
|
1092
|
+
Usage: gcli workflow:run [options]
|
|
1093
|
+
|
|
1094
|
+
Start a run; the JSON input is the first step request body. --wait follows it to the end
|
|
1095
|
+
|
|
1096
|
+
Options:
|
|
1097
|
+
-p, --project <project>
|
|
1098
|
+
-n, --name <name> Workflow name
|
|
1099
|
+
-i, --input <json> Run input as JSON (default {})
|
|
1100
|
+
--input-file <file> Read the run input from a JSON file
|
|
1101
|
+
-w, --wait Print each step as it happens until the run ends
|
|
1102
|
+
-h, --help display help for command
|
|
1103
|
+
[36m
|
|
1104
|
+
--- Subcommand: workflow:runs ---[0m
|
|
1105
|
+
Usage: gcli workflow:runs [options]
|
|
1106
|
+
|
|
1107
|
+
List a workflow runs, newest first
|
|
1108
|
+
|
|
1109
|
+
Options:
|
|
1110
|
+
-p, --project <project>
|
|
1111
|
+
-n, --name <name> Workflow name
|
|
1112
|
+
-l, --limit <limit> How many (default 50)
|
|
1113
|
+
-h, --help display help for command
|
|
1114
|
+
[36m
|
|
1115
|
+
--- Subcommand: workflow:status ---[0m
|
|
1116
|
+
Usage: gcli workflow:status [options]
|
|
1117
|
+
|
|
1118
|
+
Show a run: its step events, error and output (--follow until it ends)
|
|
1119
|
+
|
|
1120
|
+
Options:
|
|
1121
|
+
-p, --project <project>
|
|
1122
|
+
-n, --name <name> Workflow name
|
|
1123
|
+
-r, --run <run> Run name (see workflow:runs)
|
|
1124
|
+
-f, --follow Keep printing events until the run ends
|
|
1125
|
+
-h, --help display help for command
|
|
1126
|
+
[36m
|
|
1127
|
+
--- Subcommand: workflow:cancel ---[0m
|
|
1128
|
+
Usage: gcli workflow:cancel [options]
|
|
1129
|
+
|
|
1130
|
+
Cancel a running run
|
|
1131
|
+
|
|
1132
|
+
Options:
|
|
1133
|
+
-p, --project <project>
|
|
1134
|
+
-n, --name <name> Workflow name
|
|
1135
|
+
-r, --run <run> Run name (see workflow:runs)
|
|
1136
|
+
-h, --help display help for command
|
package/README.md
CHANGED
|
@@ -761,6 +761,61 @@ 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
|
+
The file `workflow:get` / `workflow:generate` write (and `workflow:apply`
|
|
792
|
+
reads) - a Fission `kind: Workflow` manifest or a bare `startAt` + `states`
|
|
793
|
+
works too:
|
|
794
|
+
|
|
795
|
+
```yaml
|
|
796
|
+
workflow:
|
|
797
|
+
name: order-flow
|
|
798
|
+
description: Charge, then mail the receipt
|
|
799
|
+
definition:
|
|
800
|
+
startAt: charge
|
|
801
|
+
states:
|
|
802
|
+
charge:
|
|
803
|
+
type: Task
|
|
804
|
+
function: { type: name, name: charge }
|
|
805
|
+
retry: { maxAttempts: 3, backoffBase: 2s, backoffCap: 30s }
|
|
806
|
+
next: mail
|
|
807
|
+
mail:
|
|
808
|
+
type: Task
|
|
809
|
+
function: { type: name, name: mailer }
|
|
810
|
+
end: true
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
Step types: Task (call a lambda), Choice (branch on a value), Parallel,
|
|
814
|
+
Map (once per list item), Wait (durable pause), Succeed, Fail. A step gets
|
|
815
|
+
one attempt unless it has `retry`. Runs can only be started by
|
|
816
|
+
`workflow:run` (or the UI / API) - HTTP and cron triggers cannot start a
|
|
817
|
+
workflow yet.
|
|
818
|
+
|
|
764
819
|
### Monitoring & Testing
|
|
765
820
|
|
|
766
821
|
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.
|
package/docs/features/README.md
CHANGED
|
@@ -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,49 @@
|
|
|
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` |
|
|
21
|
+
| `workflow:status -n -r run [--follow]` | `getWorkflowRun` (events, error, output) |
|
|
22
|
+
| `workflow:cancel -n -r run` | `cancelWorkflowRun` |
|
|
23
|
+
|
|
24
|
+
The workflow file (`definition.ts` `parseWorkflowFile`) accepts
|
|
25
|
+
`workflow: {name, description, clusterId, definition}`, the same without the
|
|
26
|
+
`workflow:` key, a Fission `kind: Workflow` manifest, or a bare definition;
|
|
27
|
+
`toWorkflowYaml` writes the first form. API calls are in
|
|
28
|
+
`src/services/gql-client.ts` (Workflows section), selection sets in
|
|
29
|
+
`src/services/types/workflow.fragment.ts`, types in
|
|
30
|
+
`src/commands/workflow/types.ts`.
|
|
31
|
+
|
|
32
|
+
Not granted to CI tokens (INTEGRATION role) yet: the workflow resolvers are
|
|
33
|
+
USER-only in graphql-server-lambdas, so these commands need `gcli login`.
|
|
34
|
+
|
|
35
|
+
## How to test
|
|
36
|
+
|
|
37
|
+
`npx jest --coverage=false test/workflow.spec.ts`. Real: log in to a
|
|
38
|
+
gateway whose project has `allowWorkflows`, then
|
|
39
|
+
`gcli workflow:generate -d "..." -n demo --apply` and
|
|
40
|
+
`gcli workflow:run -n demo --wait`.
|
|
41
|
+
|
|
42
|
+
## How to debug
|
|
43
|
+
|
|
44
|
+
- `No workflow "x"`: names are per project (`-p` or the `gcli login`
|
|
45
|
+
project).
|
|
46
|
+
- `Workflows are not available on your current plan`: the plan lacks
|
|
47
|
+
`allowWorkflows`.
|
|
48
|
+
- `Workflows are not enabled on this cluster`: the cluster runs Fission
|
|
49
|
+
without `workflows.enabled` (canonical doc, Requires).
|