@gravity-rail/cli 0.1.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 +252 -0
- package/dist/gr.js +14981 -0
- package/dist/gr.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @gravity-rail/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Gravity Rail](https://gravityrail.com) — manage workspaces, AI assistants, conversations, workflows, and 40+ resource types from your terminal.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
gr workflows list -w $WORKSPACE
|
|
7
|
+
gr chats list -w $WORKSPACE -o json | jq '.[].summary'
|
|
8
|
+
gr members create -w $WORKSPACE --data '{"first_name":"Jane","email":"jane@example.com"}' --allow-write
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install -g @gravity-rail/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Node.js 18+.
|
|
18
|
+
|
|
19
|
+
## Authentication
|
|
20
|
+
|
|
21
|
+
### OAuth (interactive)
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
gr login # opens browser for OAuth authorization
|
|
25
|
+
gr whoami # verify your identity
|
|
26
|
+
gr logout # clear cached credentials
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Credentials are cached locally per environment.
|
|
30
|
+
|
|
31
|
+
### API Key (non-interactive)
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
export GRAVITY_RAIL_API_KEY=your-api-key
|
|
35
|
+
gr tasks list -w $WORKSPACE
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
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).
|
|
39
|
+
|
|
40
|
+
## Command Pattern
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
gr <domain> <action> [options]
|
|
44
|
+
gr <domain> <sub-resource> <action> [options]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
gr tasks list -w $WORKSPACE # list tasks
|
|
49
|
+
gr tasks get -w $WORKSPACE --id 42 # get specific task
|
|
50
|
+
gr tasks create -w $WORKSPACE --data '{"name":"New"}' --allow-write # create
|
|
51
|
+
gr chats labels list -w $WORKSPACE # sub-resource
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Every domain supports `--help`:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
gr --help # all domains
|
|
58
|
+
gr tasks --help # task commands
|
|
59
|
+
gr chats labels --help # sub-resource commands
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Write Safety
|
|
63
|
+
|
|
64
|
+
The CLI is **read-only by default**. Any command that creates, updates, or deletes data requires the `--allow-write` flag:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
# Reads — no flag needed
|
|
68
|
+
gr members list -w $WORKSPACE
|
|
69
|
+
gr workflows get -w $WORKSPACE --id 5
|
|
70
|
+
|
|
71
|
+
# Writes — must opt in
|
|
72
|
+
gr members create -w $WORKSPACE --data '{"first_name":"Test"}' --allow-write
|
|
73
|
+
gr tasks delete -w $WORKSPACE --id 42 --allow-write
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This prevents accidental mutations when exploring production data or running under automation.
|
|
77
|
+
|
|
78
|
+
## Output Formats
|
|
79
|
+
|
|
80
|
+
Output adapts to context: human-readable tables in interactive terminals, JSON when piped.
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
# Table (default in TTY)
|
|
84
|
+
gr tasks list -w $WORKSPACE
|
|
85
|
+
|
|
86
|
+
# JSON (default when piped, or explicit)
|
|
87
|
+
gr tasks list -w $WORKSPACE -o json
|
|
88
|
+
|
|
89
|
+
# JSONL (one object per line — great for streaming)
|
|
90
|
+
gr tasks list -w $WORKSPACE -o jsonl
|
|
91
|
+
|
|
92
|
+
# Pipe to jq
|
|
93
|
+
gr members list -w $WORKSPACE -o json | jq '.[].email'
|
|
94
|
+
|
|
95
|
+
# Chain commands
|
|
96
|
+
gr chats list -w $WORKSPACE -o json | jq '.[0].id' | xargs -I{} gr chats get -w $WORKSPACE --id {}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Data Input
|
|
100
|
+
|
|
101
|
+
Pass data for create/update operations via inline JSON, file, or stdin:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
# Inline JSON
|
|
105
|
+
gr tasks create -w $WORKSPACE --data '{"name":"My Task"}' --allow-write
|
|
106
|
+
|
|
107
|
+
# From file
|
|
108
|
+
gr workflows create -w $WORKSPACE --file workflow.json --allow-write
|
|
109
|
+
|
|
110
|
+
# From stdin (pipe)
|
|
111
|
+
echo '{"name":"Piped Task"}' | gr tasks create -w $WORKSPACE --allow-write
|
|
112
|
+
cat member.json | gr members update -w $WORKSPACE --id 42 --allow-write
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Global Options
|
|
116
|
+
|
|
117
|
+
| Flag | Description |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `--api-url <url>` | Override API base URL |
|
|
120
|
+
| `-w, --workspace <uuid>` | Workspace UUID (required for most commands) |
|
|
121
|
+
| `-o, --output-format <fmt>` | Output format: `json`, `jsonl`, `table` |
|
|
122
|
+
| `-v, --verbose` | Verbose output to stderr |
|
|
123
|
+
| `--allow-write` | Required for create/update/delete operations |
|
|
124
|
+
| `--id <id>` | Entity ID (for get/update/delete) |
|
|
125
|
+
| `-d, --data <json>` | Inline JSON payload |
|
|
126
|
+
| `-f, --file <path>` | Read JSON payload from file |
|
|
127
|
+
| `--help` | Show help |
|
|
128
|
+
| `--version` | Show version |
|
|
129
|
+
|
|
130
|
+
## Environment Variables
|
|
131
|
+
|
|
132
|
+
| Variable | Description |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `GRAVITY_RAIL_API_KEY` | API key for non-interactive authentication |
|
|
135
|
+
| `GRAVITY_RAIL_API_URL` | Override API base URL (default: `https://api.gravityrail.com`) |
|
|
136
|
+
| `GRAVITY_RAIL_FRONTEND_URL` | Override frontend URL (default: `https://app.gravityrail.com`) |
|
|
137
|
+
|
|
138
|
+
## Commands
|
|
139
|
+
|
|
140
|
+
### Core
|
|
141
|
+
|
|
142
|
+
| Domain | Description |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `tasks` | Workflow tasks — CRUD, archive, clone, convert-to-abilities |
|
|
145
|
+
| `chats` | Conversations — CRUD, labels, filters, messages, export, summaries |
|
|
146
|
+
| `members` | Contacts and team — CRUD, labels, filters, roles, fields, import/export |
|
|
147
|
+
| `workspaces` | Workspace management — CRUD, features, themes, invitations, export/import |
|
|
148
|
+
| `workflows` | Conversational workflows — CRUD, notes, contributors, templates, analytics |
|
|
149
|
+
| `agents` | Autonomous AI members — CRUD, archive |
|
|
150
|
+
| `assistants` | AI personas — CRUD with model and voice configuration |
|
|
151
|
+
| `assignments` | Task-based conversations — CRUD, messages, tools |
|
|
152
|
+
|
|
153
|
+
### Data & Content
|
|
154
|
+
|
|
155
|
+
| Domain | Description |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `data-types` | Schema-driven forms and records — CRUD, field indexing, computed fields |
|
|
158
|
+
| `files` | Documents and folders — CRUD, sharing, semantic search, labels |
|
|
159
|
+
| `sites` | Customer portals — CRUD, pages, menus, web crawling |
|
|
160
|
+
| `events` | Automation rules — triggers, CEL conditions, delayed actions, webhooks |
|
|
161
|
+
| `calendars` | Scheduling — calendars, events, event types, availability, Google sync |
|
|
162
|
+
| `qualifications` | Skills evaluation — requirements, submissions, scoring |
|
|
163
|
+
|
|
164
|
+
### Communication
|
|
165
|
+
|
|
166
|
+
| Domain | Description |
|
|
167
|
+
|---|---|
|
|
168
|
+
| `phone-numbers` | Voice and SMS phone numbers — provisioning, calls, messages |
|
|
169
|
+
| `inboxes` | Email inboxes — threads, attachments, routing |
|
|
170
|
+
| `operator-groups` | Live operator routing — groups, presence, strategies |
|
|
171
|
+
| `notification-rules` | Alert configuration — event-based notifications |
|
|
172
|
+
|
|
173
|
+
### Integrations
|
|
174
|
+
|
|
175
|
+
| Domain | Description |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `discord-bots` | Discord bot management — slash commands, threads, account linking |
|
|
178
|
+
| `slack-apps` | Slack app management — installations, threads, accounts |
|
|
179
|
+
| `fhir-connections` | FHIR healthcare connections — patients, practitioners, encounters |
|
|
180
|
+
| `app-connections` | Platform app integrations |
|
|
181
|
+
| `monday` | Monday.com — boards, columns, webhooks |
|
|
182
|
+
|
|
183
|
+
### Platform
|
|
184
|
+
|
|
185
|
+
| Domain | Description |
|
|
186
|
+
|---|---|
|
|
187
|
+
| `api-keys` | API key management — workspace and global scopes |
|
|
188
|
+
| `subscriptions` | Subscription management |
|
|
189
|
+
| `reports` | Usage reports — AI tokens, voice minutes, SMS, storage |
|
|
190
|
+
| `ai-models` | Available AI models (no workspace required) |
|
|
191
|
+
| `features` | Feature registry (no workspace required) |
|
|
192
|
+
| `custom-toolkits` | Custom tool definitions |
|
|
193
|
+
| `mcp-servers` | MCP server connections |
|
|
194
|
+
| `milestones` | Goal tracking |
|
|
195
|
+
| `supervisors` | AI supervisor management |
|
|
196
|
+
| `access-grants` | Temporary access delegation |
|
|
197
|
+
| `pronunciations` | Voice pronunciation overrides |
|
|
198
|
+
| `apps` | OAuth app management |
|
|
199
|
+
| `oauth` | OAuth provider connections |
|
|
200
|
+
| `auth` | Two-factor authentication, credentials, and password management |
|
|
201
|
+
| `org` | Organization membership and invitations |
|
|
202
|
+
|
|
203
|
+
## Recipes
|
|
204
|
+
|
|
205
|
+
### Export all chats as JSON
|
|
206
|
+
|
|
207
|
+
```sh
|
|
208
|
+
gr chats list -w $WORKSPACE -o json > chats.json
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Find members by label
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
gr members list -w $WORKSPACE -o json | jq '[.[] | select(.labels[]?.name == "VIP")]'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Bulk create from a file
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
# members.jsonl — one JSON object per line
|
|
221
|
+
cat members.jsonl | while read line; do
|
|
222
|
+
echo "$line" | gr members create -w $WORKSPACE --allow-write
|
|
223
|
+
done
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Pipe workspace config between environments
|
|
227
|
+
|
|
228
|
+
```sh
|
|
229
|
+
gr workspaces get -w $SOURCE_WORKSPACE -o json | \
|
|
230
|
+
gr workspaces create --data "$(cat -)" --allow-write
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### List all workflows with their task counts
|
|
234
|
+
|
|
235
|
+
```sh
|
|
236
|
+
gr workflows list -w $WORKSPACE -o json | jq '.[] | {name, task_count: (.tasks | length)}'
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Check who's live as an operator
|
|
240
|
+
|
|
241
|
+
```sh
|
|
242
|
+
gr operator-groups list -w $WORKSPACE -o json | jq '.[].name'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Related
|
|
246
|
+
|
|
247
|
+
- [`@gravity-rail/sdk`](https://www.npmjs.com/package/@gravity-rail/sdk) — TypeScript SDK for programmatic access (500+ methods, full type safety)
|
|
248
|
+
- [Developer Docs](https://developer.gravityrail.com) — Full API reference and guides
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT
|