matex-cli 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 +261 -0
- package/USAGE_GUIDE.md +180 -0
- package/bin/matex +2 -0
- package/dist/api/client.d.ts +34 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +99 -0
- package/dist/api/client.js.map +1 -0
- package/dist/commands/ask.d.ts +3 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +63 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/chat.d.ts +3 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +95 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +74 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/models.d.ts +3 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +77 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/config.d.ts +56 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +135 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/spinner.d.ts +12 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +58 -0
- package/dist/utils/spinner.js.map +1 -0
- package/package.json +44 -0
- package/src/api/client.ts +116 -0
- package/src/commands/ask.ts +62 -0
- package/src/commands/chat.ts +101 -0
- package/src/commands/config.ts +78 -0
- package/src/commands/models.ts +81 -0
- package/src/index.ts +50 -0
- package/src/utils/config.ts +120 -0
- package/src/utils/spinner.ts +57 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import ora, { Ora } from 'ora';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
export class Spinner {
|
|
5
|
+
private spinner: Ora | null = null;
|
|
6
|
+
|
|
7
|
+
start(text: string): void {
|
|
8
|
+
this.spinner = ora({
|
|
9
|
+
text: chalk.cyan(text),
|
|
10
|
+
color: 'cyan',
|
|
11
|
+
spinner: 'dots',
|
|
12
|
+
}).start();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
succeed(text?: string): void {
|
|
16
|
+
if (this.spinner) {
|
|
17
|
+
this.spinner.succeed(text ? chalk.green(text) : undefined);
|
|
18
|
+
this.spinner = null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fail(text?: string): void {
|
|
23
|
+
if (this.spinner) {
|
|
24
|
+
this.spinner.fail(text ? chalk.red(text) : undefined);
|
|
25
|
+
this.spinner = null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
warn(text?: string): void {
|
|
30
|
+
if (this.spinner) {
|
|
31
|
+
this.spinner.warn(text ? chalk.yellow(text) : undefined);
|
|
32
|
+
this.spinner = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
info(text?: string): void {
|
|
37
|
+
if (this.spinner) {
|
|
38
|
+
this.spinner.info(text ? chalk.blue(text) : undefined);
|
|
39
|
+
this.spinner = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
stop(): void {
|
|
44
|
+
if (this.spinner) {
|
|
45
|
+
this.spinner.stop();
|
|
46
|
+
this.spinner = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
updateText(text: string): void {
|
|
51
|
+
if (this.spinner) {
|
|
52
|
+
this.spinner.text = chalk.cyan(text);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const spinner = new Spinner();
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2020"
|
|
7
|
+
],
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"moduleResolution": "node"
|
|
19
|
+
},
|
|
20
|
+
"include": [
|
|
21
|
+
"src/**/*"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist"
|
|
26
|
+
]
|
|
27
|
+
}
|