@gravity-rail/cli 0.36.2 → 0.40.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @gravity-rail/cli
2
2
 
3
- Command-line interface for [Gravity Rail](https://gravityrail.com) — manage workspaces, AI assistants, conversations, workflows, and 40+ resource types from your terminal.
3
+ Command-line interface for [Gravity Rail](https://gravityrail.com) — manage workspaces, Agents, Chats, Workflows, and other resources from your terminal.
4
4
 
5
5
  ```
6
6
  gr workflows list -w $WORKSPACE
@@ -18,12 +18,6 @@ npx @gravity-rail/cli --help
18
18
 
19
19
  Requires Node.js 18+.
20
20
 
21
- The published `gr` binary is a single self-contained file. Runtime
22
- `dependencies` only list packages that exist on the public npm registry
23
- (`@gravity-rail/sdk`). Build-only monorepo packages such as
24
- `@gravity-rail/sandbox` (used when compiling code-interpreter bundles) stay in
25
- `devDependencies` so `npx` / `npm install -g` do not try to fetch them.
26
-
27
21
  ## Authentication
28
22
 
29
23
  ### OAuth (interactive)
@@ -65,18 +59,6 @@ export GRAVITY_RAIL_PROFILE=work
65
59
 
66
60
  `gr login` / `gr logout` remain as shortcuts for the active profile (or `--name`).
67
61
 
68
- **Local monorepo / QA (Gravity Rail developers):** after provisioning, import
69
- dev tokens into the same profile store (this replaces the old `--realm` flag):
70
-
71
- ```sh
72
- yarn gr auth import-dev # or: python scripts/sync_gr_cli_profiles.py
73
- yarn gr whoami --profile superadmin
74
- yarn gr tasks list --profile acme-demo/acme-admin # auto-sets -w
75
- ```
76
-
77
- Workspace/member names use one slash (`workspace/member`). Provisioning auto-syncs
78
- profiles; re-run import after re-seed. Worktree API ports get isolated credential files.
79
-
80
62
  ### Credential store (security)
81
63
 
82
64
  | Item | Detail |
@@ -106,7 +88,7 @@ export GRAVITY_RAIL_API_KEY=your-api-key
106
88
  gr tasks list -w $WORKSPACE
107
89
  ```
108
90
 
109
- Useful for scripts, CI/CD, and automation. Create scoped keys from workspace settings or via [`@gravity-rail/sdk`](https://www.npmjs.com/package/@gravity-rail/sdk). API keys are **not** written into the profile store.
91
+ Useful for scripts, CI/CD, and automation. Create scoped keys from [Account API Keys](https://docs.gravityrail.com/user-guide/manage/account/api-keys) or via [`@gravity-rail/sdk`](https://www.npmjs.com/package/@gravity-rail/sdk). API keys are **not** written into the profile store.
110
92
 
111
93
  ### Organizations that require SSO
112
94
 
@@ -118,6 +100,25 @@ For **non-interactive** use (CI, scripts, code-interpreter sandboxes, or any mac
118
100
  export GRAVITY_RAIL_API_KEY=your-api-key # set GRAVITY_RAIL_NO_BROWSER=1 to force the API-key hint
119
101
  ```
120
102
 
103
+ ## Search the Documentation
104
+
105
+ Search without signing in or selecting a Workspace:
106
+
107
+ ```sh
108
+ gr docs search -q "outbound workflow"
109
+ gr docs search -q "webhook signing" -o json
110
+ ```
111
+
112
+ Table output shows page titles and URLs. JSON output includes `title`, `url`, `snippet`, and `score` for each result.
113
+
114
+ ## Work with a Coding Agent
115
+
116
+ Give an agent the CLI's bootstrap instructions, then use each domain's `--help` to discover its commands:
117
+
118
+ ```sh
119
+ gr get-started --format llm
120
+ ```
121
+
121
122
  ## Command Pattern
122
123
 
123
124
  ```
@@ -147,6 +148,9 @@ The CLI is **read-only by default**. Any command that creates, updates, or delet
147
148
  ```sh
148
149
  # Reads — no flag needed
149
150
  gr members list -w $WORKSPACE
151
+ gr members list -w $WORKSPACE --search "Smith"
152
+ gr members list -w $WORKSPACE --page 2 --page-size 100
153
+ gr members list -w $WORKSPACE --all
150
154
  gr workflows get -w $WORKSPACE --id 5
151
155
 
152
156
  # Writes — must opt in
@@ -189,6 +193,7 @@ Prefer it over `| jq` in scripts and agent tooling: a mistake in the filter is
189
193
  reported as a filter error, rather than surfacing as a parse error about output
190
194
  you cannot see. It needs the `jq` binary on PATH.
191
195
 
196
+ ```sh
192
197
  # Chain commands
193
198
  gr chats list -w $WORKSPACE -o json | jq '.[0].id' | xargs -I{} gr chats get -w $WORKSPACE --id {}
194
199
  ```
@@ -287,6 +292,7 @@ not forwarded, as it may contain sensitive data. Use `resume.chatUuid` /
287
292
  | `members` | Contacts and team — CRUD, labels, filters, roles, fields, import/export |
288
293
  | `workspaces` | Workspace management — CRUD, features, themes, invitations, export/import |
289
294
  | `workflows` | Conversational workflows — CRUD, notes, contributors, templates, analytics |
295
+ | `journeys` | Journey definitions — CRUD, V2 authoring, drafts, clone |
290
296
  | `agents` | Autonomous AI members — CRUD, archive |
291
297
  | `assistants` | AI personas — CRUD with model and voice configuration |
292
298
  | `assignments` | Task-based conversations — CRUD, messages, tools |
@@ -513,11 +519,174 @@ gr concierge chat --sms --allow-write
513
519
 
514
520
  If the API returns **412** `account_phone_unverified`, run `gr account verify-phone` first.
515
521
 
522
+ ## Journey V2 authoring
523
+
524
+ The same commands are available through the internal `yarn gr` entry point.
525
+ All examples require workspace membership and `journeys:write` (which implies
526
+ `journeys:read`, also checked when cloning).
527
+
528
+ ```sh
529
+ gr journeys create -w $WORKSPACE --data '{"name":"Onboarding V2","executionModel":"v2","status":"draft"}' --allow-write
530
+ gr journeys authoring -w $WORKSPACE --id 42 -o json
531
+ gr journeys v2 put -w $WORKSPACE --id 42 --file definition.json --allow-write
532
+ gr journeys v2 validate -w $WORKSPACE --id 42 -o json
533
+ gr journeys v2 clone -w $WORKSPACE --id 12 --allow-write
534
+ ```
535
+
536
+ `v2 put` replaces the complete executable definition. Include `expectedUpdatedAt`
537
+ from the latest authoring read, ordered `touches`, and `endings`. Each touch can
538
+ carry `eventRules`, an incoming `wait`, and a `branch` with ordered routes.
539
+ Endings carry `celCondition` and/or `filterId` predicates and `eventRules`; they
540
+ need no incoming edge.
541
+ Omitting `goals` preserves them; sending an empty array removes them. A minimal
542
+ `definition.json` is:
543
+
544
+ ```json
545
+ {
546
+ "expectedUpdatedAt": "2026-09-26T00:00:00Z",
547
+ "touches": [{ "name": "Welcome", "eventRules": [] }],
548
+ "endings": []
549
+ }
550
+ ```
551
+
552
+ A branch route can include `memberPredicate`, an unnamed Query IR condition
553
+ owned by the route. For example, this branch selects Members with an email:
554
+
555
+ ```json
556
+ {
557
+ "routes": [
558
+ {
559
+ "name": "Has email",
560
+ "memberPredicate": {
561
+ "kind": "compare",
562
+ "field": "member.email",
563
+ "op": "notEmpty"
564
+ }
565
+ },
566
+ { "name": "Otherwise", "memberPredicate": null }
567
+ ]
568
+ }
569
+ ```
570
+
571
+ Use this object as a touch's `branch` in the complete definition. The owned
572
+ predicate is ANDed with any `filterId` and `celCondition`; it creates no saved
573
+ MemberFilter. Reading or changing it additionally requires `members:read` and
574
+ access to its fields. On `v2 put`, omission preserves an existing owned predicate
575
+ and explicit `null` clears it. `v2 validate` reports
576
+ `decision_rule_predicate_invalid` when a stored owned predicate cannot compile.
577
+
578
+ Existing steps and routes retain identity through their UUIDs. Omit a step or
579
+ route UUID to create it; use request-local `key` values for new rejoin targets.
580
+ EventRules require UUIDs: preserve existing ones when editing, and generate new
581
+ ones when copying actions into another Journey. Read responses are not replacement
582
+ payloads; construct the `touches`/`endings` structure explicitly.
583
+
584
+ To preserve an unfinished editor document without changing the executable
585
+ Journey, use the separate draft commands:
586
+
587
+ ```sh
588
+ gr journeys v2 draft put -w $WORKSPACE --id 42 --file draft.json --allow-write
589
+ gr journeys authoring -w $WORKSPACE --id 42 -o json
590
+ gr journeys v2 draft delete -w $WORKSPACE --id 42 --expected-updated-at '2026-09-26T00:00:00Z' --allow-write
591
+ ```
592
+
593
+ `draft.json` contains `expectedUpdatedAt` and `document` with `version`, `model`,
594
+ and optional `goalsDirty`. Use the editor's document format. Read it back as
595
+ `authoringDraft` through `journeys authoring`. Discarding that document preserves
596
+ the executable definition. Neither draft command publishes a Journey.
597
+
598
+ Use `journeys update --id 42 --data '{"status":"active"}' --allow-write` to
599
+ publish, or `status: "paused"` to pause. Publishing runs server validation;
600
+ `v2 validate` reports stored-definition issues without publishing. A stale
601
+ `expectedUpdatedAt` is rejected: reload and reconcile rather than blindly retrying.
602
+ `v2 clone` creates a separate draft from a supported legacy definition and leaves
603
+ the source and enrollments unchanged; unsupported topologies are rejected.
604
+
516
605
  ## Related
517
606
 
518
607
  - [`@gravity-rail/sdk`](https://www.npmjs.com/package/@gravity-rail/sdk) — TypeScript SDK for programmatic access (500+ methods, full type safety)
519
- - [Developer Docs](https://developer.gravityrail.com) — Full API reference and guides
608
+ - [Developer Guide](https://docs.gravityrail.com/developer) — Full API reference and guides
520
609
 
521
610
  ## License
522
611
 
523
612
  MIT
613
+
614
+ ## Publish and consume reusable Workflows
615
+
616
+ Author in the owning workspace. `workflows publish` freezes the draft and queues
617
+ its shared release. Bundles are how a published Workflow reaches another
618
+ workspace: `workflows catalog` lists released Workflow and revision UUIDs to pin
619
+ in a Bundle draft.
620
+
621
+ ```sh
622
+ # Publisher
623
+ gr workflows publish -w "$PUBLISHER" --workflow-id "$WORKFLOW" --allow-write
624
+ gr workflows catalog -w "$PUBLISHER" -o json
625
+ gr bundles create -w "$PUBLISHER" --name "Starter Kit" --allow-write
626
+ gr bundles draft set -w "$PUBLISHER" --bundle "$BUNDLE" --file items.json --allow-write
627
+ gr bundles publish -w "$PUBLISHER" --bundle "$BUNDLE" --allow-write
628
+ gr bundles grant -w "$PUBLISHER" --bundle "$BUNDLE" \
629
+ --to organization --uuid "$ORGANIZATION" --allow-write
630
+
631
+ # Consumer: installs the latest version, then opts into updates
632
+ gr bundles install -w "$CONSUMER" --bundle "$BUNDLE" --allow-write
633
+ gr bundles policy -w "$CONSUMER" --installation "$INSTALLATION" --set auto --allow-write
634
+ gr bundles readiness -w "$CONSUMER" --installation "$INSTALLATION"
635
+
636
+ # Make an independent editable copy of an installed Workflow
637
+ gr workflows clone -w "$CONSUMER" --id "$LOCAL_WORKFLOW_ID" \
638
+ --data '{"name":"My customized Workflow"}' --allow-write
639
+ ```
640
+
641
+ Installation creates the **consumer's local** Workflow ID and UUID; use those for
642
+ consumer reads and copying. Installation and policy changes require
643
+ `workflows:admin` in the destination plus publisher access;
644
+ organization-admin status is not an additional requirement.
645
+ When a Bundle upgrade changes an installed Form schema, the acting administrator
646
+ also needs `datatypes:write` and Form write permission (Form admin permission for
647
+ field-policy changes, including new fields). Missing Form authority or an archived
648
+ Form leaves the held release active and reports that repair is required; it does
649
+ not revoke the Bundle subscription.
650
+
651
+ ### Bundle lifecycle
652
+
653
+ | Task | Command |
654
+ | --- | --- |
655
+ | Find published Workflow/revision UUIDs for composition | `workflows catalog` |
656
+ | Inspect publisher subscriber versions/policies | `bundles subscribers --bundle <uuid>` |
657
+ | Edit package metadata | `bundles update --bundle <uuid> --name "Starter Kit" --description "Contents"` |
658
+ | Create a package | `bundles create --name "Starter Kit"` |
659
+ | Inspect/edit the package draft | `bundles draft get/set --bundle <uuid>` |
660
+ | Publish an immutable version | `bundles publish --bundle <uuid> --release-notes "What's new"` |
661
+ | Inspect summary and latest content | `bundles get --bundle <uuid>` |
662
+ | Inspect history or one version | `bundles versions/version --bundle <uuid>` |
663
+ | Share within the publisher organization | `bundles grant --bundle <uuid> --to organization --uuid <organization>` |
664
+ | Install the latest version (initially pinned) | `bundles install --bundle <uuid>` |
665
+ | Follow new releases | `bundles policy --installation <uuid> --set auto` |
666
+ | Hold the installed release | `bundles policy --installation <uuid> --set pinned` |
667
+ | Stop updates and keep installed content | `bundles unsubscribe --installation <uuid>` |
668
+ | Preview an upgrade | `bundles preview --installation <uuid> --to 2` |
669
+ | Apply an upgrade | `bundles upgrade --installation <uuid> --to 2` |
670
+ | Inspect missing local dependencies | `bundles readiness --installation <uuid>` |
671
+ | Supply local dependencies | `bundles bind --installation <uuid> --bindings bindings.json` |
672
+
673
+ Commands require a workspace (`-w` or a workspace profile); mutations also require
674
+ `--allow-write`. Draft item files contain `{ "items": [...] }`; Workflow items
675
+ pin `workflowUuid` and `revisionUuid`, and Form/Site items carry definitions.
676
+ Configuration is reusable software. Records and credentials stay local.
677
+
678
+ For safe editing, retain `draftGeneration` from `bundles draft get -o json` and
679
+ pass it as `--expected-generation` to `draft set` or `publish`. Omitting it reads
680
+ the current generation just before the write and only detects changes during
681
+ that request sequence. The server's refusal details are preserved.
682
+
683
+ Use `bundles get --bundle <uuid>` or `bundles install --bundle <uuid>` for direct access
684
+ to an authorized official solution, including one hidden from `bundles list`.
685
+ Private Bundles still require an existing grant or ownership.
686
+
687
+ `bundles get -o json` returns one `{ summary, version }` object; `version` is null
688
+ before publication. Revocations also return JSON when requested. Full UUIDs in
689
+ tables can be copied directly into later commands.
690
+
691
+ Bundle grants use full source visibility; restricted Bundle disclosure remains
692
+ unavailable while Form and Site definitions are copied at installation.