@chatbotkit/cli 1.27.0 → 1.27.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.
|
@@ -47,9 +47,11 @@ exports.command = new commander_1.Command()
|
|
|
47
47
|
.description('Run a JavaScript file with @chatbotkit/* packages available')
|
|
48
48
|
.argument('<script>', 'Path to the JavaScript file to run')
|
|
49
49
|
.argument('[args...]', 'Arguments to pass to the script')
|
|
50
|
+
.helpOption(false)
|
|
51
|
+
.enablePositionalOptions()
|
|
52
|
+
.passThroughOptions()
|
|
50
53
|
.allowUnknownOption(true)
|
|
51
54
|
.allowExcessArguments(true)
|
|
52
|
-
.helpOption('-h, --help', 'Display help for the run command')
|
|
53
55
|
.addHelpText('after', `
|
|
54
56
|
Examples:
|
|
55
57
|
$ cbk run script.js
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -13,6 +13,31 @@ const commander_1 = require("commander");
|
|
|
13
13
|
Object.defineProperty(exports, "Argument", { enumerable: true, get: function () { return commander_1.Argument; } });
|
|
14
14
|
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return commander_1.Command; } });
|
|
15
15
|
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return commander_1.Option; } });
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
const path_1 = require("path");
|
|
18
|
+
const url_1 = require("url");
|
|
19
|
+
const __dirname = (0, path_1.dirname)((0, url_1.fileURLToPath)(import.meta.url));
|
|
20
|
+
function getVersion() {
|
|
21
|
+
try {
|
|
22
|
+
let pkgPath = (0, path_1.join)(__dirname, '..', 'package.json');
|
|
23
|
+
let pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf-8'));
|
|
24
|
+
if (pkg.version) {
|
|
25
|
+
return pkg.version;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
let pkgPath = (0, path_1.join)(__dirname, '..', '..', 'package.json');
|
|
32
|
+
let pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf-8'));
|
|
33
|
+
if (pkg.version) {
|
|
34
|
+
return pkg.version;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
}
|
|
39
|
+
return 'unknown';
|
|
40
|
+
}
|
|
16
41
|
function printBanner() {
|
|
17
42
|
console.log((0, color_js_1.formatBlue)(`
|
|
18
43
|
.d8888b. 888888b. 888 d8P
|
|
@@ -27,7 +52,10 @@ Y88b d88P 888 d88P 888 Y88b
|
|
|
27
52
|
}
|
|
28
53
|
async function cbk(argv = process.argv) {
|
|
29
54
|
const program = new commander_1.Command();
|
|
30
|
-
program
|
|
55
|
+
program
|
|
56
|
+
.name('cbk')
|
|
57
|
+
.description('Command line tools for ChatBotKit')
|
|
58
|
+
.version(getVersion(), '-v, --version', 'Display the CLI version');
|
|
31
59
|
if (process.stdout.isTTY) {
|
|
32
60
|
program.hook('preAction', () => {
|
|
33
61
|
printBanner();
|
|
@@ -38,5 +66,12 @@ async function cbk(argv = process.argv) {
|
|
|
38
66
|
program.addCommand(index_js_3.default);
|
|
39
67
|
program.addCommand(index_js_4.default);
|
|
40
68
|
program.addCommand(index_js_5.default);
|
|
69
|
+
const args = argv.slice(2);
|
|
70
|
+
if (args[0] === 'run' &&
|
|
71
|
+
args.length === 2 &&
|
|
72
|
+
(args[1] === '--help' || args[1] === '-h')) {
|
|
73
|
+
index_js_4.default.outputHelp();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
41
76
|
program.parse(argv);
|
|
42
77
|
}
|
|
@@ -5,7 +5,18 @@ const fs_1 = require("fs");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const url_1 = require("url");
|
|
7
7
|
const __dirname = (0, path_1.dirname)((0, url_1.fileURLToPath)(import.meta.url));
|
|
8
|
-
|
|
8
|
+
function findCliRoot() {
|
|
9
|
+
let root = (0, path_1.join)(__dirname, '..', '..');
|
|
10
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(root, 'package.json'))) {
|
|
11
|
+
return root;
|
|
12
|
+
}
|
|
13
|
+
root = (0, path_1.join)(__dirname, '..', '..', '..');
|
|
14
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(root, 'package.json'))) {
|
|
15
|
+
return root;
|
|
16
|
+
}
|
|
17
|
+
return (0, path_1.join)(__dirname, '..', '..');
|
|
18
|
+
}
|
|
19
|
+
const cliRoot = findCliRoot();
|
|
9
20
|
const cliNodeModules = (0, path_1.join)(cliRoot, 'node_modules');
|
|
10
21
|
function resolvePackageExport(packagePath, subpath) {
|
|
11
22
|
const packageJsonPath = (0, path_1.join)(packagePath, 'package.json');
|
|
@@ -44,9 +44,11 @@ export const command = new Command()
|
|
|
44
44
|
.description('Run a JavaScript file with @chatbotkit/* packages available')
|
|
45
45
|
.argument('<script>', 'Path to the JavaScript file to run')
|
|
46
46
|
.argument('[args...]', 'Arguments to pass to the script')
|
|
47
|
+
.helpOption(false)
|
|
48
|
+
.enablePositionalOptions()
|
|
49
|
+
.passThroughOptions()
|
|
47
50
|
.allowUnknownOption(true)
|
|
48
51
|
.allowExcessArguments(true)
|
|
49
|
-
.helpOption('-h, --help', 'Display help for the run command')
|
|
50
52
|
.addHelpText('after', `
|
|
51
53
|
Examples:
|
|
52
54
|
$ cbk run script.js
|
package/dist/esm/index.js
CHANGED
|
@@ -5,6 +5,31 @@ import chat from './command/chat/index.js';
|
|
|
5
5
|
import run from './command/run/index.js';
|
|
6
6
|
import solution from './command/solution/index.js';
|
|
7
7
|
import { Argument, Command, Option } from 'commander';
|
|
8
|
+
import { readFileSync } from 'fs';
|
|
9
|
+
import { dirname, join } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
function getVersion() {
|
|
13
|
+
try {
|
|
14
|
+
let pkgPath = join(__dirname, '..', 'package.json');
|
|
15
|
+
let pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
16
|
+
if (pkg.version) {
|
|
17
|
+
return pkg.version;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
let pkgPath = join(__dirname, '..', '..', 'package.json');
|
|
24
|
+
let pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
25
|
+
if (pkg.version) {
|
|
26
|
+
return pkg.version;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
}
|
|
31
|
+
return 'unknown';
|
|
32
|
+
}
|
|
8
33
|
export { Command, Option, Argument };
|
|
9
34
|
function printBanner() {
|
|
10
35
|
console.log(formatBlue(`
|
|
@@ -20,7 +45,10 @@ Y88b d88P 888 d88P 888 Y88b
|
|
|
20
45
|
}
|
|
21
46
|
export default async function cbk(argv = process.argv) {
|
|
22
47
|
const program = new Command();
|
|
23
|
-
program
|
|
48
|
+
program
|
|
49
|
+
.name('cbk')
|
|
50
|
+
.description('Command line tools for ChatBotKit')
|
|
51
|
+
.version(getVersion(), '-v, --version', 'Display the CLI version');
|
|
24
52
|
if (process.stdout.isTTY) {
|
|
25
53
|
program.hook('preAction', () => {
|
|
26
54
|
printBanner();
|
|
@@ -31,5 +59,12 @@ export default async function cbk(argv = process.argv) {
|
|
|
31
59
|
program.addCommand(chat);
|
|
32
60
|
program.addCommand(run);
|
|
33
61
|
program.addCommand(solution);
|
|
62
|
+
const args = argv.slice(2);
|
|
63
|
+
if (args[0] === 'run' &&
|
|
64
|
+
args.length === 2 &&
|
|
65
|
+
(args[1] === '--help' || args[1] === '-h')) {
|
|
66
|
+
run.outputHelp();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
34
69
|
program.parse(argv);
|
|
35
70
|
}
|
package/dist/esm/loader/hooks.js
CHANGED
|
@@ -2,7 +2,18 @@ import { existsSync, readFileSync } from 'fs';
|
|
|
2
2
|
import { dirname, join } from 'path';
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
4
4
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
|
|
5
|
+
function findCliRoot() {
|
|
6
|
+
let root = join(__dirname, '..', '..');
|
|
7
|
+
if (existsSync(join(root, 'package.json'))) {
|
|
8
|
+
return root;
|
|
9
|
+
}
|
|
10
|
+
root = join(__dirname, '..', '..', '..');
|
|
11
|
+
if (existsSync(join(root, 'package.json'))) {
|
|
12
|
+
return root;
|
|
13
|
+
}
|
|
14
|
+
return join(__dirname, '..', '..');
|
|
15
|
+
}
|
|
16
|
+
const cliRoot = findCliRoot();
|
|
6
17
|
const cliNodeModules = join(cliRoot, 'node_modules');
|
|
7
18
|
function resolvePackageExport(packagePath, subpath) {
|
|
8
19
|
const packageJsonPath = join(packagePath, 'package.json');
|