@boltic/cli 1.0.39 → 1.0.41
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 +123 -5
- package/api/serverless.js +174 -0
- package/cli.js +8 -0
- package/commands/serverless.js +1940 -0
- package/helper/serverless.js +1932 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ⚡ Boltic CLI
|
|
2
2
|
|
|
3
|
-
> **Professional CLI for interacting with the Boltic platform — create, manage, and publish integrations, workflows, MCPs, and more with enterprise-grade features and a seamless developer experience.**
|
|
3
|
+
> **Professional CLI for interacting with the Boltic platform — create, manage, and publish integrations, serverless functions, workflows, MCPs, and more with enterprise-grade features and a seamless developer experience.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@boltic/cli)
|
|
6
6
|
[](https://github.com/bolticio/cli)
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
- [🔐 Authentication](#-authentication)
|
|
30
30
|
- [🧩 Integration Management](#-integration-management)
|
|
31
31
|
- [🧠 MCP](#-mcp-model-context-protocol)
|
|
32
|
+
- [⚡ Serverless Functions](#-serverless-functions)
|
|
32
33
|
- [📚 Command Reference](#-command-reference)
|
|
33
34
|
- [🛠️ Development Workflow](#️-development-workflow)
|
|
34
35
|
- [🔧 Configuration](#-configuration)
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
|
|
45
46
|
- 🔐 **Secure Authentication** - Enterprise-grade token management with secure storage
|
|
46
47
|
- 🚀 **Rapid Development** - Create workflows, integrations, and more in minutes, not hours
|
|
48
|
+
- ⚡ **Serverless Functions** - Deploy functions in Node.js, Python, Golang, or Java with local testing
|
|
47
49
|
- 📦 **Smart Project Management** - Automated folder structure and configuration
|
|
48
50
|
- 🔄 **Real-time Synchronization** - Instant sync with Boltic Cloud platform
|
|
49
51
|
- 🎯 **Type-safe Development** - Support for Workflow Activities and Triggers
|
|
@@ -69,11 +71,14 @@ boltic login
|
|
|
69
71
|
# Create your first integration
|
|
70
72
|
boltic integration create
|
|
71
73
|
|
|
72
|
-
#
|
|
73
|
-
boltic
|
|
74
|
+
# Or create a serverless function
|
|
75
|
+
boltic serverless create --type blueprint --name my-api --language nodejs
|
|
74
76
|
|
|
75
|
-
#
|
|
76
|
-
boltic
|
|
77
|
+
# Test locally
|
|
78
|
+
boltic serverless test
|
|
79
|
+
|
|
80
|
+
# Deploy to Boltic Cloud
|
|
81
|
+
boltic serverless publish
|
|
77
82
|
```
|
|
78
83
|
|
|
79
84
|
---
|
|
@@ -299,6 +304,107 @@ boltic mcp setup https://mcp.boltic.io/sse my-boltic --client claude
|
|
|
299
304
|
|
|
300
305
|
---
|
|
301
306
|
|
|
307
|
+
## ⚡ Serverless Functions
|
|
308
|
+
|
|
309
|
+
Create, test, and deploy serverless functions on the Boltic platform with support for multiple languages and deployment types.
|
|
310
|
+
|
|
311
|
+
### Supported Languages
|
|
312
|
+
|
|
313
|
+
| Language | Version | Handler |
|
|
314
|
+
|----------|---------|---------|
|
|
315
|
+
| Node.js | 20 | `handler.handler` |
|
|
316
|
+
| Python | 3 | `index.handler` |
|
|
317
|
+
| Golang | 1.22 | `Handler` |
|
|
318
|
+
| Java | 17 | `Handler` |
|
|
319
|
+
|
|
320
|
+
### Deployment Types
|
|
321
|
+
|
|
322
|
+
| Type | Description |
|
|
323
|
+
|------|-------------|
|
|
324
|
+
| **Blueprint** | Write code directly in the CLI-generated project |
|
|
325
|
+
| **Git** | Deploy from a Git repository |
|
|
326
|
+
| **Container** | Deploy a Docker container |
|
|
327
|
+
|
|
328
|
+
### Creating Serverless Functions
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Interactive mode (prompts for all options)
|
|
332
|
+
boltic serverless create
|
|
333
|
+
|
|
334
|
+
# Create a blueprint serverless function
|
|
335
|
+
boltic serverless create --type blueprint --name my-api --language nodejs
|
|
336
|
+
|
|
337
|
+
# Create a git-based serverless function
|
|
338
|
+
boltic serverless create --type git --name my-git-func --language python
|
|
339
|
+
|
|
340
|
+
# Create a container-based serverless function
|
|
341
|
+
boltic serverless create --type container --name my-container
|
|
342
|
+
|
|
343
|
+
# Specify custom directory
|
|
344
|
+
boltic serverless create --type blueprint --name my-function --language python --directory ./projects
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### Generated Project Structure
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
my-serverless/
|
|
351
|
+
├── boltic.yaml # Configuration file with serverless settings
|
|
352
|
+
├── handler.js # Handler file (Node.js) or index.py (Python), etc.
|
|
353
|
+
└── package.json # Dependencies (for Node.js projects)
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Testing Locally
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Auto-detect language and run on default port (8080)
|
|
360
|
+
boltic serverless test
|
|
361
|
+
|
|
362
|
+
# Specify custom port
|
|
363
|
+
boltic serverless test --port 3000
|
|
364
|
+
|
|
365
|
+
# Test from specific directory
|
|
366
|
+
boltic serverless test --directory ./my-function
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Publishing
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Publish from current directory
|
|
373
|
+
boltic serverless publish
|
|
374
|
+
|
|
375
|
+
# Publish from specific directory
|
|
376
|
+
boltic serverless publish --directory ./my-function
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Pulling Existing Functions
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
# Pull a serverless function (interactive selection)
|
|
383
|
+
boltic serverless pull
|
|
384
|
+
|
|
385
|
+
# Pull to a specific path
|
|
386
|
+
boltic serverless pull --path ./projects
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Listing Functions
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
# List all serverless functions
|
|
393
|
+
boltic serverless list
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Checking Status
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Check status (interactive selection)
|
|
400
|
+
boltic serverless status
|
|
401
|
+
|
|
402
|
+
# Check status by name
|
|
403
|
+
boltic serverless status --name my-function
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
302
408
|
## 📚 Command Reference
|
|
303
409
|
|
|
304
410
|
### Core Commands
|
|
@@ -329,6 +435,18 @@ boltic mcp setup https://mcp.boltic.io/sse my-boltic --client claude
|
|
|
329
435
|
| `boltic mcp help` | Show help for MCP sub-commands | |
|
|
330
436
|
| `boltic mcp setup` | Configure an MCP server for a specific client| `--client <name>` `--name <alias>`|
|
|
331
437
|
|
|
438
|
+
### Serverless Commands
|
|
439
|
+
|
|
440
|
+
| Command | Description | Options |
|
|
441
|
+
| ---------------------------- | ------------------------------------ | ---------------------------------------------------- |
|
|
442
|
+
| `boltic serverless create` | Create a new serverless function | `--type, -t` `--name, -n` `--language, -l` `--directory, -d` |
|
|
443
|
+
| `boltic serverless test` | Test serverless function locally | `--port, -p` `--language, -l` `--directory, -d` |
|
|
444
|
+
| `boltic serverless publish` | Publish/deploy serverless function | `--directory, -d` |
|
|
445
|
+
| `boltic serverless pull` | Pull existing serverless function | `--path` |
|
|
446
|
+
| `boltic serverless list` | List all serverless functions | |
|
|
447
|
+
| `boltic serverless status` | Show status of a serverless function | `--name, -n` |
|
|
448
|
+
| `boltic serverless help` | Show help for serverless commands | |
|
|
449
|
+
|
|
332
450
|
### Help and Documentation
|
|
333
451
|
|
|
334
452
|
```bash
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import FormData from "form-data";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import https from "https";
|
|
5
|
+
import { handleError } from "../helper/error.js";
|
|
6
|
+
import { logApi } from "../helper/verbose.js";
|
|
7
|
+
|
|
8
|
+
const getHttpsAgentForUrl = (baseUrl) => {
|
|
9
|
+
try {
|
|
10
|
+
const host = new URL(baseUrl).hostname;
|
|
11
|
+
if (
|
|
12
|
+
host.endsWith("fcz0.de") ||
|
|
13
|
+
host.endsWith("uat.fcz0.de") ||
|
|
14
|
+
host.endsWith("fyndx1.de") ||
|
|
15
|
+
process.env.BOLTCI_INSECURE_TLS === "true"
|
|
16
|
+
) {
|
|
17
|
+
return new https.Agent({ rejectUnauthorized: false });
|
|
18
|
+
}
|
|
19
|
+
} catch (_) {
|
|
20
|
+
// ignore URL parse errors and fall back to default agent
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const listAllServerless = async (
|
|
26
|
+
apiUrl,
|
|
27
|
+
token,
|
|
28
|
+
accountId,
|
|
29
|
+
session,
|
|
30
|
+
query = null
|
|
31
|
+
) => {
|
|
32
|
+
if (!token || !session || !accountId) {
|
|
33
|
+
console.error(
|
|
34
|
+
"\x1b[31mError:\x1b[0m Authentication credentials are required."
|
|
35
|
+
);
|
|
36
|
+
console.log("\n🔹 Please log in first using:");
|
|
37
|
+
console.log("\x1b[32m$ boltic login\x1b[0m\n");
|
|
38
|
+
process.exit(1); // Exit the CLI with an error code
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const params = {
|
|
42
|
+
page: 1,
|
|
43
|
+
limit: 999,
|
|
44
|
+
sortBy: "CreatedAt",
|
|
45
|
+
sortOrder: "desc",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Add query parameter if provided
|
|
49
|
+
if (query) {
|
|
50
|
+
params.q = query;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const axiosOptions = {
|
|
54
|
+
method: "get",
|
|
55
|
+
url: `${apiUrl}/service/panel/serverless/v1.0/apps`,
|
|
56
|
+
params,
|
|
57
|
+
headers: {
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
Authorization: `Bearer ${token}`,
|
|
60
|
+
Cookie: session,
|
|
61
|
+
},
|
|
62
|
+
httpsAgent: getHttpsAgentForUrl(apiUrl),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const response = await axios(axiosOptions);
|
|
66
|
+
logApi(axiosOptions.method, axiosOptions.url, response.status);
|
|
67
|
+
return response.data.data;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
handleError(error);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const pullServerless = async (apiUrl, token, accountId, session, id) => {
|
|
74
|
+
if (!token || !session || !accountId) {
|
|
75
|
+
console.error(
|
|
76
|
+
"\x1b[31mError:\x1b[0m Authentication credentials are required."
|
|
77
|
+
);
|
|
78
|
+
console.log("\n🔹 Please log in first using:");
|
|
79
|
+
console.log("\x1b[32m$ boltic login\x1b[0m\n");
|
|
80
|
+
process.exit(1); // Exit the CLI with an error code
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const response = await axios({
|
|
84
|
+
method: "get",
|
|
85
|
+
url: `${apiUrl}/service/panel/serverless/v1.0/apps/${id}`,
|
|
86
|
+
headers: {
|
|
87
|
+
"Content-Type": "application/json",
|
|
88
|
+
Authorization: `Bearer ${token}`,
|
|
89
|
+
Cookie: session,
|
|
90
|
+
},
|
|
91
|
+
httpsAgent: getHttpsAgentForUrl(apiUrl),
|
|
92
|
+
});
|
|
93
|
+
return response?.data;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
handleError(error);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const publishServerless = async (apiUrl, token, session, payload) => {
|
|
100
|
+
if (!token || !session) {
|
|
101
|
+
console.error(
|
|
102
|
+
"\x1b[31mError:\x1b[0m Authentication credentials are required."
|
|
103
|
+
);
|
|
104
|
+
console.log("\n🔹 Please log in first using:");
|
|
105
|
+
console.log("\x1b[32m$ boltic login\x1b[0m\n");
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const axiosOptions = {
|
|
111
|
+
method: "post",
|
|
112
|
+
url: `${apiUrl}/service/panel/serverless/v1.0/apps`,
|
|
113
|
+
headers: {
|
|
114
|
+
"Content-Type": "application/json",
|
|
115
|
+
Authorization: `Bearer ${token}`,
|
|
116
|
+
Cookie: session,
|
|
117
|
+
},
|
|
118
|
+
data: payload,
|
|
119
|
+
httpsAgent: getHttpsAgentForUrl(apiUrl),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const response = await axios(axiosOptions);
|
|
123
|
+
logApi(axiosOptions.method, axiosOptions.url, response.status);
|
|
124
|
+
return response.data;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
handleError(error);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const updateServerless = async (
|
|
132
|
+
apiUrl,
|
|
133
|
+
token,
|
|
134
|
+
session,
|
|
135
|
+
serverlessId,
|
|
136
|
+
payload
|
|
137
|
+
) => {
|
|
138
|
+
if (!token || !session) {
|
|
139
|
+
console.error(
|
|
140
|
+
"\x1b[31mError:\x1b[0m Authentication credentials are required."
|
|
141
|
+
);
|
|
142
|
+
console.log("\n🔹 Please log in first using:");
|
|
143
|
+
console.log("\x1b[32m$ boltic login\x1b[0m\n");
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
const axiosOptions = {
|
|
149
|
+
method: "put",
|
|
150
|
+
url: `${apiUrl}/service/panel/serverless/v1.0/apps/${serverlessId}`,
|
|
151
|
+
headers: {
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
Authorization: `Bearer ${token}`,
|
|
154
|
+
Cookie: session,
|
|
155
|
+
},
|
|
156
|
+
data: payload,
|
|
157
|
+
httpsAgent: getHttpsAgentForUrl(apiUrl),
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const response = await axios(axiosOptions);
|
|
161
|
+
logApi(axiosOptions.method, axiosOptions.url, response.status);
|
|
162
|
+
return response.data;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
handleError(error);
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
listAllServerless,
|
|
171
|
+
pullServerless,
|
|
172
|
+
publishServerless,
|
|
173
|
+
updateServerless,
|
|
174
|
+
};
|
package/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import EnvironmentCommands from "./commands/env.js";
|
|
|
6
6
|
import IntegrationCommands from "./commands/integration.js";
|
|
7
7
|
import AuthCommands from "./commands/login.js";
|
|
8
8
|
import McpCommands from "./commands/mcp.js";
|
|
9
|
+
import ServerlessCommands from "./commands/serverless.js";
|
|
9
10
|
|
|
10
11
|
// Create a CLI module with functional approach
|
|
11
12
|
import { findSimilarCommands } from "./helper/command-suggestions.js";
|
|
@@ -110,6 +111,10 @@ const createCLI = (consoleUrl, apiUrl, serviceName, env) => {
|
|
|
110
111
|
description: "Display the version of the CLI.",
|
|
111
112
|
action: () => showVersion(),
|
|
112
113
|
},
|
|
114
|
+
serverless: {
|
|
115
|
+
description: "Manage serverless (create, list, test)",
|
|
116
|
+
action: (args) => handleServerless(args),
|
|
117
|
+
},
|
|
113
118
|
};
|
|
114
119
|
|
|
115
120
|
return {
|
|
@@ -235,6 +240,9 @@ async function handleMcp(args) {
|
|
|
235
240
|
await McpCommands.execute(args);
|
|
236
241
|
}
|
|
237
242
|
|
|
243
|
+
async function handleServerless(args) {
|
|
244
|
+
await ServerlessCommands.execute(args);
|
|
245
|
+
}
|
|
238
246
|
async function showVersion() {
|
|
239
247
|
let version = "1.0.0";
|
|
240
248
|
try {
|