@gapi/gcli 1.8.197 → 1.8.199
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 +314 -0
- package/README.md +252 -100
- package/package.json +1 -1
- package/release/esbuild +0 -0
- package/release/index.js +1755 -1565
package/README.md
CHANGED
|
@@ -1,177 +1,329 @@
|
|
|
1
|
-
|
|
1
|
+
# GCLI - The LambForge Platform CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
curl -L "https://github.com/Stradivario/gapi/releases/download/v1.8.195/gcli-linux" -o ~/.local/bin/gcli
|
|
5
|
-
```
|
|
3
|
+
`gcli` is the command-line interface for managing the LambForge platform ecosystem. It provides developers with a unified toolset for infrastructure management, serverless function deployment, AI context integration (MCP), and project configuration.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
chmod +x ~/.local/bin/gcli
|
|
9
|
-
```
|
|
5
|
+
Whether you are deploying scalable serverless functions, managing cloud environments, or integrating AI capabilities into your workflow, `gcli` is your central control plane.
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
## Table of Contents
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Authentication](#authentication)
|
|
11
|
+
- [Managing Infrastructure](#managing-infrastructure)
|
|
12
|
+
- [Serverless Functions (Lambdas)](#serverless-functions-lambdas)
|
|
13
|
+
- [AI Integration (Model Context Protocol)](#ai-integration-model-context-protocol)
|
|
14
|
+
- [Build System](#build-system)
|
|
15
|
+
- [Command Reference](#command-reference)
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
"mcpServers": {
|
|
18
|
-
"lambforge": {
|
|
19
|
-
"command": "gcli",
|
|
20
|
-
"args": ["mcp:start", "--url", "http://localhost:8000/mcp"]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
```
|
|
17
|
+
## Installation
|
|
25
18
|
|
|
26
|
-
|
|
19
|
+
You can install `gcli` using a pre-built binary or via NPM.
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
"mcpServers": {
|
|
31
|
-
"lambforge": {
|
|
32
|
-
"command": "npx",
|
|
33
|
-
"args": ["gcli", "mcp:start", "--url", "http://localhost:8000/mcp"]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
21
|
+
### Binary Installation (Linux)
|
|
38
22
|
|
|
39
|
-
|
|
23
|
+
For a standalone installation without Node.js dependencies:
|
|
40
24
|
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"lambforge": {
|
|
45
|
-
"command": "/home/user/.nvm/versions/node/v24.11.1/bin/node",
|
|
46
|
-
"args": [
|
|
47
|
-
"/home/user/.nvm/versions/node/v24.11.1/bin/npx",
|
|
48
|
-
"gcli",
|
|
49
|
-
"mcp:start",
|
|
50
|
-
"--url",
|
|
51
|
-
"http://localhost:8000/mcp"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
25
|
+
```bash
|
|
26
|
+
curl -L "https://github.com/Stradivario/gapi/releases/download/v1.8.198/gcli-linux" -o ~/.local/bin/gcli
|
|
27
|
+
chmod +x ~/.local/bin/gcli
|
|
56
28
|
```
|
|
57
29
|
|
|
58
|
-
|
|
30
|
+
### NPM Installation
|
|
31
|
+
|
|
32
|
+
To install globally using NPM:
|
|
59
33
|
|
|
60
34
|
```bash
|
|
61
35
|
npm i -g @gapi/gcli
|
|
62
36
|
```
|
|
63
37
|
|
|
64
|
-
###
|
|
38
|
+
### CI/CD Integration
|
|
65
39
|
|
|
66
|
-
|
|
67
|
-
|
|
40
|
+
For automated pipelines (e.g., GitHub Actions), you can use `npx` with a long-lived token:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
# Example Step in GitHub Actions
|
|
44
|
+
- name: Deploy with GCLI
|
|
45
|
+
run: npx gcli login --ci --token ${{ secrets.GCLI_AUTH_TOKEN }}
|
|
68
46
|
```
|
|
69
47
|
|
|
70
|
-
|
|
48
|
+
## Authentication
|
|
49
|
+
|
|
50
|
+
Before interacting with the platform, you must authenticate. You can log in using an API key or a personal access token.
|
|
71
51
|
|
|
72
52
|
```bash
|
|
73
|
-
|
|
53
|
+
# Interactive Login
|
|
54
|
+
gcli login
|
|
55
|
+
|
|
56
|
+
# Login with specific credentials
|
|
57
|
+
gcli login --token 'YOUR_GRAPHQL_TOKEN' --key 'YOUR_API_KEY' --url 'API_URL'
|
|
74
58
|
```
|
|
75
59
|
|
|
76
|
-
|
|
60
|
+
## Managing Infrastructure
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
`gcli` organizes resources into **Projects** and **Environments**.
|
|
63
|
+
|
|
64
|
+
### Project Context
|
|
81
65
|
|
|
82
|
-
|
|
66
|
+
To avoid repeating the project ID in every command, set a default project context:
|
|
83
67
|
|
|
84
68
|
```bash
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
# List available projects
|
|
70
|
+
gcli project:list
|
|
87
71
|
|
|
88
|
-
|
|
72
|
+
# Set the active project
|
|
73
|
+
gcli project:use 'my-project-id'
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
gcli
|
|
75
|
+
# Clear the active project
|
|
76
|
+
gcli project:clear
|
|
92
77
|
```
|
|
93
78
|
|
|
94
|
-
###
|
|
79
|
+
### Environments
|
|
80
|
+
|
|
81
|
+
Manage deployment targets (e.g., development, staging, production) directly from the CLI.
|
|
95
82
|
|
|
96
83
|
```bash
|
|
97
|
-
|
|
84
|
+
# List environments
|
|
85
|
+
gcli environment:list
|
|
86
|
+
|
|
87
|
+
# Create a new environment
|
|
88
|
+
gcli environment:create --name 'staging' --minCpu 100 --maxCpu 500 --minMemory 128 --maxMemory 512
|
|
89
|
+
|
|
90
|
+
# Get environment details
|
|
91
|
+
gcli environment:get --name 'staging'
|
|
98
92
|
```
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
## Serverless Functions (Lambdas)
|
|
95
|
+
|
|
96
|
+
The core of the platform is its serverless compute capability. `gcli` streamlines the entire lifecycle of a lambda function.
|
|
97
|
+
|
|
98
|
+
### Creating a Function
|
|
99
|
+
|
|
100
|
+
You can create a function from a local file, a specification, or inline code.
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
|
|
103
|
+
# Create from local source files (Recommended)
|
|
104
|
+
gcli lambda:create --name 'my-function' \
|
|
105
|
+
--route '/api/v1/my-function' \
|
|
106
|
+
--file ./index.ts \
|
|
107
|
+
--package ./package.json
|
|
108
|
+
|
|
109
|
+
# Create with inline code (Quick testing)
|
|
110
|
+
gcli lambda:create --name 'quick-test' \
|
|
111
|
+
--route '/test' \
|
|
112
|
+
--code 'export default async (ctx) => ({ status: 200, body: "Hello World" })'
|
|
104
113
|
```
|
|
105
114
|
|
|
106
|
-
###
|
|
115
|
+
### Spec-Based Deployment (YAML & JSON)
|
|
116
|
+
|
|
117
|
+
For reproducible deployments, you can use `spec.yaml` (recommended) or `spec.json`.
|
|
118
|
+
|
|
119
|
+
**Recommended: `spec.yaml`**
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
name: eye-processor
|
|
123
|
+
route: eye-processor
|
|
124
|
+
file: ./src/main.ts
|
|
125
|
+
script: build.sh
|
|
126
|
+
package: package.json
|
|
127
|
+
params: []
|
|
128
|
+
config: ''
|
|
129
|
+
secrets: ['gemini-credentials']
|
|
130
|
+
env: nodejs
|
|
131
|
+
network: ['public']
|
|
132
|
+
method: ['POST', 'OPTIONS']
|
|
133
|
+
uploadAsZip: true
|
|
134
|
+
scaleOptions:
|
|
135
|
+
minCpu: 30
|
|
136
|
+
maxCpu: 500
|
|
137
|
+
minMemory: 32
|
|
138
|
+
maxMemory: 192
|
|
139
|
+
minScale: 1
|
|
140
|
+
maxScale: 3
|
|
141
|
+
targetCpu: 80
|
|
142
|
+
executorType: newdeploy
|
|
143
|
+
idleTimeout: 120
|
|
144
|
+
concurrency: 1
|
|
145
|
+
functionTimeout: 60
|
|
146
|
+
specializationTimeout: 120
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Deploy using:
|
|
107
150
|
|
|
108
151
|
```bash
|
|
109
|
-
gcli lambda:create --
|
|
152
|
+
gcli lambda:create --spec spec.yaml
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Unified Configuration (`lambforge.yaml`)
|
|
156
|
+
|
|
157
|
+
The modern way to manage platform capabilities is via `lambforge.yaml`. This file allows you to define the function, environment, and bundler options in a single place.
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
function:
|
|
161
|
+
name: eye-processor
|
|
162
|
+
route: eye-processor
|
|
163
|
+
file: ./src/main.ts
|
|
164
|
+
script: build.sh
|
|
165
|
+
package: package.json
|
|
166
|
+
params: []
|
|
167
|
+
config: ''
|
|
168
|
+
secrets: ['gemini-credentials']
|
|
169
|
+
env: nodejs
|
|
170
|
+
network: ['public']
|
|
171
|
+
method: ['POST', 'OPTIONS']
|
|
172
|
+
uploadAsZip: true
|
|
173
|
+
scaleOptions:
|
|
174
|
+
minCpu: 30
|
|
175
|
+
maxCpu: 500
|
|
176
|
+
minMemory: 32
|
|
177
|
+
maxMemory: 192
|
|
178
|
+
minScale: 1
|
|
179
|
+
maxScale: 3
|
|
180
|
+
targetCpu: 80
|
|
181
|
+
executorType: newdeploy
|
|
182
|
+
idleTimeout: 120
|
|
183
|
+
concurrency: 1
|
|
184
|
+
functionTimeout: 60
|
|
185
|
+
specializationTimeout: 120
|
|
186
|
+
|
|
187
|
+
environment:
|
|
188
|
+
name: nodejs
|
|
189
|
+
image: rxdi/fission-node:0.0.14
|
|
190
|
+
builder: rxdi/fission-node-builder:1.0.5
|
|
191
|
+
poolSize: 0
|
|
192
|
+
minCpu: 0
|
|
193
|
+
maxCpu: 0
|
|
194
|
+
minMemory: 0
|
|
195
|
+
maxMemory: 0
|
|
196
|
+
region: EU_BALKANS
|
|
197
|
+
|
|
198
|
+
options:
|
|
199
|
+
bundler:
|
|
200
|
+
watch: ['src']
|
|
110
201
|
```
|
|
111
202
|
|
|
112
|
-
|
|
203
|
+
### Configuration Auto-Discovery (Zero-Argument Commands)
|
|
204
|
+
|
|
205
|
+
`gcli` is designed to be context-aware. If a configuration file (`lambforge.yaml`, `spec.yaml`, or `env.yaml`) is present in your current directory, you can run commands without arguments.
|
|
206
|
+
|
|
207
|
+
The CLI will automatically read the configuration and apply it to the current project context.
|
|
113
208
|
|
|
114
209
|
```bash
|
|
115
|
-
|
|
210
|
+
# If lambforge.yaml or spec.yaml exists:
|
|
211
|
+
gcli lambda:create
|
|
212
|
+
gcli lambda:update
|
|
213
|
+
|
|
214
|
+
# If lambforge.yaml or env.yaml exists:
|
|
215
|
+
gcli environment:create
|
|
216
|
+
gcli environment:update
|
|
116
217
|
```
|
|
117
218
|
|
|
118
|
-
|
|
219
|
+
### Function Lifecycle
|
|
220
|
+
|
|
221
|
+
- **Update**: `gcli lambda:update --name 'my-function' --file ./new-index.ts`
|
|
222
|
+
- **Delete**: `gcli lambda:delete --name 'my-function'`
|
|
223
|
+
- **Get Details**: `gcli lambda:get --name 'my-function'`
|
|
224
|
+
|
|
225
|
+
### Monitoring & Testing
|
|
226
|
+
|
|
227
|
+
Debug your functions directly from the terminal.
|
|
119
228
|
|
|
120
229
|
```bash
|
|
121
|
-
|
|
230
|
+
# Stream execution logs
|
|
231
|
+
gcli lambda:log --name 'my-function'
|
|
232
|
+
|
|
233
|
+
# View build logs
|
|
234
|
+
gcli lambda:build:log --name 'my-function'
|
|
235
|
+
|
|
236
|
+
# Invoke the function (Test)
|
|
237
|
+
gcli lambda:test --name 'my-function' --queryParams '?id=123' --body '{"action": "process"}'
|
|
122
238
|
```
|
|
123
239
|
|
|
124
|
-
|
|
240
|
+
## AI Integration (Model Context Protocol)
|
|
241
|
+
|
|
242
|
+
`gcli` implements the **Model Context Protocol (MCP)**, allowing AI coding assistants (like Claude or IDE extensions) to interact with your platform's context.
|
|
243
|
+
|
|
244
|
+
### Starting the MCP Server
|
|
125
245
|
|
|
126
246
|
```bash
|
|
127
|
-
gcli
|
|
247
|
+
gcli mcp:start --url "http://localhost:8000/mcp"
|
|
128
248
|
```
|
|
129
249
|
|
|
130
|
-
|
|
250
|
+
### Configuration for AI Tools
|
|
251
|
+
|
|
252
|
+
To use this with Claude Desktop or other MCP-compatible tools, add the following to your configuration file:
|
|
253
|
+
|
|
254
|
+
**For Node.js Users:**
|
|
131
255
|
|
|
132
256
|
```json
|
|
133
257
|
{
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"config": "",
|
|
141
|
-
"secret": "",
|
|
142
|
-
"env": "nodejs",
|
|
143
|
-
"method": ["GET"]
|
|
258
|
+
"mcpServers": {
|
|
259
|
+
"lambforge": {
|
|
260
|
+
"command": "gcli",
|
|
261
|
+
"args": ["mcp:start", "--url", "http://localhost:8000/mcp"]
|
|
262
|
+
}
|
|
263
|
+
}
|
|
144
264
|
}
|
|
145
265
|
```
|
|
146
266
|
|
|
147
|
-
|
|
267
|
+
**For Specific Node Versions:**
|
|
148
268
|
|
|
149
|
-
```
|
|
150
|
-
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"mcpServers": {
|
|
272
|
+
"lambforge": {
|
|
273
|
+
"command": "/path/to/node",
|
|
274
|
+
"args": [
|
|
275
|
+
"/path/to/gcli",
|
|
276
|
+
"mcp:start",
|
|
277
|
+
"--url",
|
|
278
|
+
"http://localhost:8000/mcp"
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
151
283
|
```
|
|
152
284
|
|
|
153
|
-
|
|
285
|
+
**For logged in users with selected current project**
|
|
154
286
|
|
|
155
|
-
```
|
|
156
|
-
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"mcpServers": {
|
|
290
|
+
"lambforge": {
|
|
291
|
+
"command": "gcli",
|
|
292
|
+
"args": ["mcp:start"]
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
157
296
|
```
|
|
158
297
|
|
|
159
|
-
|
|
298
|
+
## Build System & Local Development
|
|
299
|
+
|
|
300
|
+
`gcli` includes a high-performance bundler powered by **esbuild**.
|
|
160
301
|
|
|
161
302
|
```bash
|
|
162
|
-
|
|
303
|
+
# Build a project
|
|
304
|
+
gcli build --files src/index.ts --outfile dist/bundle.js --minify
|
|
305
|
+
|
|
306
|
+
# Start in watch mode (defaults to watching the bundled file)
|
|
307
|
+
gcli start --files src/index.ts
|
|
163
308
|
```
|
|
164
309
|
|
|
165
|
-
|
|
310
|
+
### Advanced Watch Options
|
|
166
311
|
|
|
167
|
-
|
|
168
|
-
|
|
312
|
+
By default, `gcli start` watches only the entry file passed to the bundle. To watch specific directories or configure advanced options, use the `lambforge.yaml` file:
|
|
313
|
+
|
|
314
|
+
```yaml
|
|
315
|
+
options:
|
|
316
|
+
bundler:
|
|
317
|
+
watch: ['src', 'lib']
|
|
169
318
|
```
|
|
170
319
|
|
|
171
|
-
|
|
320
|
+
---
|
|
172
321
|
|
|
173
|
-
|
|
322
|
+
## Command Reference
|
|
174
323
|
|
|
175
|
-
|
|
176
|
-
|
|
324
|
+
For a complete list of commands and options, use the built-in help:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
gcli --help
|
|
328
|
+
gcli lambda:create --help
|
|
177
329
|
```
|
package/package.json
CHANGED
package/release/esbuild
ADDED
|
Binary file
|