@globio/cli 0.2.3 → 1.0.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 +230 -26
- package/jsr.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# @globio/cli
|
|
2
2
|
|
|
3
|
-
The official CLI for [Globio](https://globio.stanlink.online)
|
|
4
|
-
|
|
3
|
+
The official CLI for [Globio](https://globio.stanlink.online) —
|
|
4
|
+
game backend as a service built on Cloudflare Workers.
|
|
5
|
+
|
|
6
|
+
## Requirements
|
|
7
|
+
|
|
8
|
+
- Node.js 18+
|
|
9
|
+
- A Globio account — [console.globio.stanlink.online](https://console.globio.stanlink.online)
|
|
5
10
|
|
|
6
11
|
## Install
|
|
7
12
|
|
|
@@ -16,81 +21,280 @@ npm install -g @globio/cli
|
|
|
16
21
|
## Quick Start
|
|
17
22
|
|
|
18
23
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
# Log in to your Globio account
|
|
25
|
+
globio login
|
|
26
|
+
|
|
27
|
+
# Initialize a new project
|
|
28
|
+
globio init
|
|
29
|
+
|
|
30
|
+
# Or non-interactively
|
|
31
|
+
globio init --name "My Game" --org org_xxx --json
|
|
21
32
|
```
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
24
37
|
|
|
38
|
+
Globio CLI authenticates at account level using a Personal
|
|
39
|
+
Access Token (PAT). Two login methods are supported.
|
|
40
|
+
|
|
41
|
+
**Browser flow** — opens the Globio console for one-click approval:
|
|
25
42
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
--from ./serviceAccountKey.json \
|
|
29
|
-
--all
|
|
43
|
+
globio login
|
|
44
|
+
```
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
--bucket gs://my-game.appspot.com \
|
|
35
|
-
--all
|
|
46
|
+
**Token flow** — paste a PAT from console settings:
|
|
47
|
+
```bash
|
|
48
|
+
globio login --token glo_pat_xxxxx
|
|
36
49
|
```
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
**Named profiles** — manage multiple accounts:
|
|
52
|
+
```bash
|
|
53
|
+
globio login --profile work
|
|
54
|
+
globio login --profile personal
|
|
55
|
+
globio use work
|
|
56
|
+
```
|
|
40
57
|
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
Credentials are stored in `~/.globio/profiles/`
|
|
59
|
+
|
|
60
|
+
---
|
|
43
61
|
|
|
44
62
|
## Commands
|
|
45
63
|
|
|
46
64
|
### Auth
|
|
65
|
+
|
|
47
66
|
```bash
|
|
48
|
-
globio login
|
|
67
|
+
globio login # browser or token flow
|
|
68
|
+
globio login --token <pat> # non-interactive
|
|
69
|
+
globio login --profile <name> # named profile
|
|
49
70
|
globio logout
|
|
50
|
-
globio
|
|
71
|
+
globio logout --profile <name>
|
|
72
|
+
globio whoami
|
|
73
|
+
globio whoami --json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Profiles
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
globio profiles list
|
|
80
|
+
globio profiles list --json
|
|
81
|
+
globio use <profile> # switch active profile
|
|
51
82
|
```
|
|
52
83
|
|
|
53
84
|
### Projects
|
|
85
|
+
|
|
54
86
|
```bash
|
|
55
87
|
globio projects list
|
|
88
|
+
globio projects list --json
|
|
56
89
|
globio projects use <projectId>
|
|
90
|
+
globio projects create # interactive
|
|
91
|
+
globio projects create \
|
|
92
|
+
--name "My Game" \
|
|
93
|
+
--org <orgId> \
|
|
94
|
+
--json # non-interactive
|
|
57
95
|
```
|
|
58
96
|
|
|
59
97
|
### Services
|
|
98
|
+
|
|
60
99
|
```bash
|
|
61
100
|
globio services list
|
|
101
|
+
globio services list --json
|
|
62
102
|
```
|
|
63
103
|
|
|
64
|
-
### Functions (GlobalCode)
|
|
104
|
+
### Edge Functions (GlobalCode)
|
|
105
|
+
|
|
65
106
|
```bash
|
|
66
107
|
globio functions list
|
|
67
|
-
globio functions
|
|
68
|
-
globio functions
|
|
108
|
+
globio functions list --json
|
|
109
|
+
globio functions create <slug> # scaffold locally
|
|
110
|
+
globio functions deploy <slug> # deploy to Globio
|
|
69
111
|
globio functions invoke <slug> --input '{"key":"value"}'
|
|
112
|
+
globio functions invoke <slug> --input '{"key":"value"}' --json
|
|
70
113
|
globio functions logs <slug>
|
|
114
|
+
globio functions logs <slug> --json
|
|
115
|
+
globio functions watch <slug> # live log streaming
|
|
71
116
|
globio functions enable <slug>
|
|
72
117
|
globio functions disable <slug>
|
|
73
118
|
globio functions delete <slug>
|
|
74
119
|
```
|
|
75
120
|
|
|
121
|
+
### GC Hooks
|
|
122
|
+
|
|
123
|
+
GC Hooks fire automatically when events occur in your
|
|
124
|
+
Globio project. They cannot be invoked manually.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
globio hooks list
|
|
128
|
+
globio hooks list --json
|
|
129
|
+
globio hooks create <slug> # scaffold locally
|
|
130
|
+
globio hooks deploy <slug> \
|
|
131
|
+
--trigger id.onSignup # deploy with trigger
|
|
132
|
+
globio hooks logs <slug>
|
|
133
|
+
globio hooks watch <slug> # live log streaming
|
|
134
|
+
globio hooks enable <slug>
|
|
135
|
+
globio hooks disable <slug>
|
|
136
|
+
globio hooks delete <slug>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Available hook triggers:**
|
|
140
|
+
|
|
141
|
+
| Trigger | Fires when |
|
|
142
|
+
|---|---|
|
|
143
|
+
| `id.onSignup` | New user registers |
|
|
144
|
+
| `id.onSignin` | User signs in |
|
|
145
|
+
| `id.onSignout` | User signs out |
|
|
146
|
+
| `id.onPasswordReset` | Password reset completed |
|
|
147
|
+
| `doc.onCreate` | Document created |
|
|
148
|
+
| `doc.onUpdate` | Document updated |
|
|
149
|
+
| `doc.onDelete` | Document deleted |
|
|
150
|
+
| `mart.onPurchase` | In-game currency purchase |
|
|
151
|
+
| `mart.onPayment` | Fiat payment completed |
|
|
152
|
+
| `sync.onRoomCreate` | Game room created |
|
|
153
|
+
| `sync.onRoomClose` | Game room closed |
|
|
154
|
+
| `sync.onPlayerJoin` | Player joins a room |
|
|
155
|
+
| `sync.onPlayerLeave` | Player leaves a room |
|
|
156
|
+
| `vault.onUpload` | File uploaded |
|
|
157
|
+
| `vault.onDelete` | File deleted |
|
|
158
|
+
| `signal.onDeliver` | Notification delivered |
|
|
159
|
+
|
|
160
|
+
**Example hook:**
|
|
161
|
+
```javascript
|
|
162
|
+
// init-player.hook.js
|
|
163
|
+
async function handler({ userId, email }, globio) {
|
|
164
|
+
await globio.doc.set('players', userId, {
|
|
165
|
+
level: 1, xp: 0, coins: 100
|
|
166
|
+
});
|
|
167
|
+
await globio.signal.sendToUser(userId, {
|
|
168
|
+
title: 'Welcome!',
|
|
169
|
+
body: 'Your adventure begins.',
|
|
170
|
+
priority: 'high'
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
globio hooks deploy init-player --trigger id.onSignup
|
|
177
|
+
```
|
|
178
|
+
|
|
76
179
|
### Migrate from Firebase
|
|
180
|
+
|
|
181
|
+
Migrate Firestore collections and Firebase Storage
|
|
182
|
+
to Globio in one command. Non-destructive — your
|
|
183
|
+
Firebase data stays intact until you delete it manually.
|
|
184
|
+
|
|
185
|
+
GlobalDoc indexes are created automatically for every
|
|
186
|
+
field during migration. Queries work immediately after.
|
|
187
|
+
|
|
77
188
|
```bash
|
|
189
|
+
# Migrate a single Firestore collection
|
|
78
190
|
globio migrate firestore \
|
|
79
191
|
--from ./serviceAccountKey.json \
|
|
80
192
|
--collection players
|
|
81
193
|
|
|
194
|
+
# Migrate all Firestore collections
|
|
82
195
|
globio migrate firestore \
|
|
83
196
|
--from ./serviceAccountKey.json \
|
|
84
197
|
--all
|
|
85
198
|
|
|
199
|
+
# Migrate Firebase Storage
|
|
86
200
|
globio migrate firebase-storage \
|
|
87
201
|
--from ./serviceAccountKey.json \
|
|
88
202
|
--bucket gs://my-game.appspot.com \
|
|
89
203
|
--all
|
|
204
|
+
|
|
205
|
+
# Migrate a specific folder
|
|
206
|
+
globio migrate firebase-storage \
|
|
207
|
+
--from ./serviceAccountKey.json \
|
|
208
|
+
--bucket gs://my-game.appspot.com \
|
|
209
|
+
--folder /avatars
|
|
90
210
|
```
|
|
91
211
|
|
|
92
|
-
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## JSON Output and CI/CD
|
|
215
|
+
|
|
216
|
+
Every command supports `--json` for machine-readable output.
|
|
217
|
+
Use this in CI/CD pipelines, scripts, and AI agents.
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
globio whoami --json
|
|
221
|
+
globio projects list --json
|
|
222
|
+
globio functions list --json
|
|
223
|
+
globio functions invoke <slug> --input '{}' --json
|
|
224
|
+
globio hooks list --json
|
|
225
|
+
globio services list --json
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Combined with non-interactive flags for full automation:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Full CI/CD setup — no prompts
|
|
232
|
+
globio login --token $GLOBIO_PAT --profile ci --json
|
|
233
|
+
globio projects create \
|
|
234
|
+
--name "My Game" \
|
|
235
|
+
--org $ORG_ID \
|
|
236
|
+
--json
|
|
237
|
+
globio functions deploy my-function --json
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Live Log Streaming
|
|
243
|
+
|
|
244
|
+
Stream real-time function and hook execution logs
|
|
245
|
+
to your terminal — including console.log output,
|
|
246
|
+
inputs, results, and errors.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
globio functions watch matchmaking
|
|
250
|
+
globio hooks watch init-player
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Example output:
|
|
254
|
+
```
|
|
255
|
+
⇒⇒ globio 1.0.0
|
|
256
|
+
──────────────────────────────────────────
|
|
257
|
+
watching matchmaking · press Ctrl+C to stop
|
|
258
|
+
|
|
259
|
+
● connected — waiting for invocations...
|
|
260
|
+
|
|
261
|
+
✓ 2026-03-15 06:12:01 [http] 3ms
|
|
262
|
+
input {"userId":"player_001","rating":1450}
|
|
263
|
+
log Querying players with rating 1450
|
|
264
|
+
log Found 3 candidates
|
|
265
|
+
result {"matched":true,"roomId":"room_abc"}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## globio.config.ts
|
|
271
|
+
|
|
272
|
+
Running `globio init` creates a `globio.config.ts` in
|
|
273
|
+
your project root with your project already configured:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { Globio } from '@globio/sdk';
|
|
277
|
+
|
|
278
|
+
export const globio = new Globio({
|
|
279
|
+
apiKey: process.env.GLOBIO_API_KEY!,
|
|
280
|
+
projectId: 'proj_xxxxx',
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Import it anywhere in your project:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { globio } from './globio.config';
|
|
288
|
+
|
|
289
|
+
const player = await globio.doc.get('players', userId);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Links
|
|
93
295
|
|
|
94
|
-
- [SDK](https://npmjs.com/package/@globio/sdk)
|
|
296
|
+
- [SDK](https://npmjs.com/package/@globio/sdk) — `@globio/sdk`
|
|
95
297
|
- [Console](https://console.globio.stanlink.online)
|
|
96
|
-
- [Docs](https://globio.
|
|
298
|
+
- [Docs](https://docs.globio.stanl.ink)
|
|
299
|
+
- [Discord](https://discord.gg/bNDvAsVkMY)
|
|
300
|
+
- [GitHub](https://github.com/Globio-Technologies/globio-cli)
|
package/jsr.json
CHANGED