@botpress/cli 0.0.2
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/build.ts +12 -0
- package/dist/app/api-utils.js +105 -0
- package/dist/app/base.js +35 -0
- package/dist/app/cache.js +95 -0
- package/dist/app/errors.js +145 -0
- package/dist/app/esbuild.js +89 -0
- package/dist/app/generator/action.js +76 -0
- package/dist/app/generator/channel.js +51 -0
- package/dist/app/generator/configuration.js +40 -0
- package/dist/app/generator/const.js +31 -0
- package/dist/app/generator/event.js +47 -0
- package/dist/app/generator/index.js +83 -0
- package/dist/app/generator/integration-impl.js +147 -0
- package/dist/app/generator/integration-instance.js +85 -0
- package/dist/app/generator/message.js +47 -0
- package/dist/app/generator/module.js +115 -0
- package/dist/app/generator/strings.js +38 -0
- package/dist/app/generator/typings.js +16 -0
- package/dist/app/index.js +68 -0
- package/dist/app/integration-ref.js +61 -0
- package/dist/app/project.js +502 -0
- package/dist/app/typings.js +16 -0
- package/dist/app/user.js +198 -0
- package/dist/config.js +245 -0
- package/dist/const.js +87 -0
- package/dist/index.js +276 -0
- package/dist/index.js.map +7 -0
- package/dist/init.js +45 -0
- package/dist/init.js.map +7 -0
- package/dist/logger/base-logger.js +159 -0
- package/dist/logger/index.js +79 -0
- package/dist/paths.js +69 -0
- package/dist/requires.js +49 -0
- package/dist/type-utils.js +16 -0
- package/dist/worker/child-entrypoint.js +61 -0
- package/dist/worker/config.js +58 -0
- package/dist/worker/index.js +55 -0
- package/dist/worker/is-child.js +52 -0
- package/dist/worker/listen-child.js +89 -0
- package/init.js +1 -0
- package/package.json +54 -0
- package/readme.md +24 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var listen_child_exports = {};
|
|
20
|
+
__export(listen_child_exports, {
|
|
21
|
+
listenChild: () => listenChild
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(listen_child_exports);
|
|
24
|
+
const listenChild = async (child, logger) => {
|
|
25
|
+
let isClosed = false;
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
child.on("close", (code) => {
|
|
28
|
+
if (isClosed) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
isClosed = true;
|
|
32
|
+
const msg = `Child process closed with code ${code}`;
|
|
33
|
+
if (code) {
|
|
34
|
+
logger.error(msg);
|
|
35
|
+
reject(new Error(msg));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
logger.log(msg);
|
|
39
|
+
resolve();
|
|
40
|
+
});
|
|
41
|
+
child.on("disconnect", () => {
|
|
42
|
+
if (isClosed) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const msg = "Child process disconnected";
|
|
46
|
+
logger.debug(msg);
|
|
47
|
+
});
|
|
48
|
+
child.on("exit", (code, signal) => {
|
|
49
|
+
if (isClosed) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
isClosed = true;
|
|
53
|
+
const msg = `Child process exited with code ${code} and signal ${signal}`;
|
|
54
|
+
if (code || signal) {
|
|
55
|
+
logger.error(msg);
|
|
56
|
+
reject(new Error(msg));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
logger.debug(msg);
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
child.on("error", (err) => {
|
|
63
|
+
if (isClosed) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const msg = `Child process error: ${err.message}`;
|
|
67
|
+
logger.error(msg);
|
|
68
|
+
reject(err);
|
|
69
|
+
});
|
|
70
|
+
child.on("message", (message) => {
|
|
71
|
+
if (isClosed) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const msg = `Child process message: ${message}`;
|
|
75
|
+
logger.log(msg);
|
|
76
|
+
});
|
|
77
|
+
child.on("spawn", () => {
|
|
78
|
+
if (isClosed) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const msg = "Child process spawned";
|
|
82
|
+
logger.debug(msg);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
listenChild
|
|
89
|
+
});
|
package/init.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./dist/init.js");
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@botpress/cli",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "pnpm run type-check && pnpm run bundle",
|
|
7
|
+
"dev": "ts-node -T src/index.ts",
|
|
8
|
+
"start": "node dist/index.js",
|
|
9
|
+
"type-check": "tsc --noEmit",
|
|
10
|
+
"bundle": "ts-node -T build.ts"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bin": {
|
|
16
|
+
"bp": "dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@botpress/client": "0.0.6",
|
|
21
|
+
"@bpinternal/yargs-extra": "^0.0.2",
|
|
22
|
+
"@types/lodash": "^4.14.191",
|
|
23
|
+
"@types/node": "^18.11.17",
|
|
24
|
+
"@types/verror": "^1.10.6",
|
|
25
|
+
"axios": "^1.2.5",
|
|
26
|
+
"bluebird": "^3.7.2",
|
|
27
|
+
"chalk": "^4.1.2",
|
|
28
|
+
"chokidar": "^3.5.3",
|
|
29
|
+
"esbuild": "^0.15.18",
|
|
30
|
+
"json-schema-to-typescript": "^11.0.2",
|
|
31
|
+
"lodash": "^4.17.21",
|
|
32
|
+
"prompts": "^2.4.2",
|
|
33
|
+
"radash": "^9.5.0",
|
|
34
|
+
"semver": "^7.3.8",
|
|
35
|
+
"typescript": "^4.9.4",
|
|
36
|
+
"uuid": "^9.0.0",
|
|
37
|
+
"verror": "^1.10.1",
|
|
38
|
+
"winston": "^3.8.2",
|
|
39
|
+
"zod": "^3.20.6",
|
|
40
|
+
"zod-to-json-schema": "^3.20.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@botpress/sdk": "0.0.5",
|
|
44
|
+
"@types/bluebird": "^3.5.38",
|
|
45
|
+
"@types/prompts": "^2.0.14",
|
|
46
|
+
"@types/semver": "^7.3.11",
|
|
47
|
+
"@types/uuid": "^9.0.1",
|
|
48
|
+
"glob": "^9.3.4",
|
|
49
|
+
"ts-node": "^10.9.1"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Botpress CLI
|
|
2
|
+
|
|
3
|
+
Official Botpress CLI. Made to query to BotpressAPI and simplify the development of bots and integrations as code.
|
|
4
|
+
|
|
5
|
+
## Disclaimer ⚠️
|
|
6
|
+
|
|
7
|
+
This package is still in development and is not ready for production use. Use it at your own risk.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save @botpress/cli # for npm
|
|
13
|
+
yarn add @botpress/cli # for yarn
|
|
14
|
+
pnpm add @botpress/cli # for pnpm
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bp login --workspaceId $YOUR_WORKSPACE_ID --token $YOUR_TOKEN
|
|
21
|
+
bp bots ls # list all bots
|
|
22
|
+
|
|
23
|
+
bp --help # list all commands
|
|
24
|
+
```
|