@qodalis/cli-core 0.0.1
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 +191 -0
- package/esm2022/lib/interfaces/index.mjs +2 -0
- package/esm2022/lib/models/index.mjs +24 -0
- package/esm2022/public-api.mjs +6 -0
- package/esm2022/qodalis-cli-core.mjs +5 -0
- package/fesm2022/qodalis-cli-core.mjs +34 -0
- package/fesm2022/qodalis-cli-core.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/interfaces/index.d.ts +385 -0
- package/lib/models/index.d.ts +85 -0
- package/package.json +26 -0
- package/public-api.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Qodalis Angular CLI
|
|
2
|
+
|
|
3
|
+
**Qodalis Angular CLI** is a web-based terminal CLI component for Angular applications. It provides a powerful and extensible interface to execute commands and streamline workflows directly within your web application. The CLI can be extended with custom command processors to suit your specific needs.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Web-Based Terminal**: A terminal interface integrated into your Angular applications.
|
|
10
|
+
- **Custom Command Processors**: Easily extend functionality by creating custom command processors.
|
|
11
|
+
- **Lightweight and Flexible**: Designed to work seamlessly with your existing Angular project.
|
|
12
|
+
- **Interactive Interface**: Enables command execution and response handling in a terminal-like UI.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Install the package using npm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @qodalis/angular-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
After installing, you can integrate the CLI component into your Angular application:
|
|
27
|
+
|
|
28
|
+
## Basic Setup
|
|
29
|
+
|
|
30
|
+
1. Import the CLI Module:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { CliModule } from "@qodalis/angular-cli";
|
|
34
|
+
|
|
35
|
+
@NgModule({
|
|
36
|
+
imports: [CliModule],
|
|
37
|
+
})
|
|
38
|
+
export class AppModule {}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Add the CLI Component to Your Template:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<app-cli [options]="cliOptions"></app-cli>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Configure the CLI:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
cliOptions = {};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Example Commands
|
|
54
|
+
|
|
55
|
+
### Built-in Commands
|
|
56
|
+
|
|
57
|
+
- **help**: Displays available commands and their descriptions.
|
|
58
|
+
- **clear**: Clears the terminal screen.
|
|
59
|
+
- **echo \<message\>**: Prints the provided message to the terminal.
|
|
60
|
+
- **ping**: Pings the server
|
|
61
|
+
- **theme**: Interact with the cli theme
|
|
62
|
+
- **cookies**: Interact with the cookies
|
|
63
|
+
- **history**: Prints the command history of the current session
|
|
64
|
+
- **local-storage**: Interact with the local storage
|
|
65
|
+
- **regex**: Provide utilities for working with regular expressions
|
|
66
|
+
- **su**: Switch user
|
|
67
|
+
- **version**: Prints the version information
|
|
68
|
+
- **whoami**: Display current user information
|
|
69
|
+
- **eval**: Evaluate a JavaScript expression
|
|
70
|
+
- **packages**: Manage packages in the cli
|
|
71
|
+
|
|
72
|
+
## Cli Packages
|
|
73
|
+
|
|
74
|
+
- Add JavaScript packages dynamically.
|
|
75
|
+
- Evaluate JavaScript expressions using added packages.
|
|
76
|
+
- Display results in a structured format.
|
|
77
|
+
|
|
78
|
+
### Usage
|
|
79
|
+
|
|
80
|
+
### Add a Package
|
|
81
|
+
|
|
82
|
+
To add a package, use the packages add command:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
root:~$ packages add <package-name>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
root:~$ packages add lodash
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This command downloads and makes the package available for evaluation.
|
|
95
|
+
|
|
96
|
+
### Remove a Package
|
|
97
|
+
|
|
98
|
+
Remove a package using the `packages remove` command:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
root:~$ packages remove lodash
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Example
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
root:~$ packages add lodash
|
|
108
|
+
root:~$ eval _.map([1, 2, 3, 4, 5], (n) => n * 2);
|
|
109
|
+
Output:
|
|
110
|
+
[
|
|
111
|
+
2,
|
|
112
|
+
4,
|
|
113
|
+
6,
|
|
114
|
+
8,
|
|
115
|
+
10
|
|
116
|
+
]
|
|
117
|
+
root:~$
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Extending with Custom Commands
|
|
121
|
+
|
|
122
|
+
You can extend the CLI by creating a class that implements the ICliCommandProcessor interface. This allows you to define new commands and their behavior.
|
|
123
|
+
|
|
124
|
+
### Creating a Custom Command Processor
|
|
125
|
+
|
|
126
|
+
1. Create a new class that extends `ICliCommandProcessor`:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { ICliCommandProcessor, CliProcessCommand, ICliExecutionContext } from "@qodalis/angular-cli";
|
|
130
|
+
|
|
131
|
+
export class MyCustomCommandProcessor implements ICliCommandProcessor {
|
|
132
|
+
command = "greet";
|
|
133
|
+
description = "Greet the user with a custom message";
|
|
134
|
+
allowUnlistedCommands = true;
|
|
135
|
+
|
|
136
|
+
async processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void> {
|
|
137
|
+
const name = command.value;
|
|
138
|
+
const message = name ? `Hello, ${name}!` : "Hello!";
|
|
139
|
+
context.writer.writeln(message);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. Register the command processor:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { CliModule, resolveCommandProcessorProvider } from "@qodalis/angular-cli";
|
|
148
|
+
|
|
149
|
+
@NgModule({
|
|
150
|
+
imports: [CliModule],
|
|
151
|
+
providers: [resolveCommandProcessorProvider(MyCustomCommandProcessor)],
|
|
152
|
+
})
|
|
153
|
+
export class AppModule {}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Custom Command Example
|
|
157
|
+
|
|
158
|
+
After registering **MyCustomCommandProcessor**, you can use the following command:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
greet John
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Output:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
Hello, John!
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Live Example
|
|
171
|
+
|
|
172
|
+
Check out a live example of the Qodalis Angular CLI on StackBlitz: [Live Example on StackBlitz](https://stackblitz.com/~/github.com/qodalis-nicolae-lupei/stackblitz-qodalis-cli-example)
|
|
173
|
+
|
|
174
|
+
## Contributing
|
|
175
|
+
|
|
176
|
+
We welcome contributions! To contribute:
|
|
177
|
+
|
|
178
|
+
1. Fork this repository.
|
|
179
|
+
2. Create a branch for your feature or bugfix.
|
|
180
|
+
3. Submit a pull request.
|
|
181
|
+
|
|
182
|
+
Please ensure all contributions follow the project coding standards.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
This project is licensed under the MIT License. See the **LICENSE** file for details.
|
|
187
|
+
|
|
188
|
+
```vbnet
|
|
189
|
+
|
|
190
|
+
You can copy this content into a file named `README.md` in your project directory. Let me know if there's anything else you'd like to adjust! 🚀
|
|
191
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiI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m9taXNlPHZvaWQ+O1xuXG4gICAgLyoqXG4gICAgICogR2V0cyBhIHVzZXIgYnkgaWRcbiAgICAgKiBAcGFyYW0gaWQgVGhlIGlkIG9mIHRoZSB1c2VyIHRvIGdldFxuICAgICAqIEByZXR1cm5zIEFuIG9ic2VydmFibGUgdGhhdCBlbWl0cyB0aGUgdXNlciB3aXRoIHRoZSBzcGVjaWZpZWQgaWRcbiAgICAgKi9cbiAgICBnZXRVc2VyKGlkOiBzdHJpbmcpOiBPYnNlcnZhYmxlPElDbGlVc2VyIHwgdW5kZWZpbmVkPjtcbn1cblxuLyoqXG4gKiBSZXByZXNlbnRzIGEgc2VydmljZSB0aGF0IHBpbmdzIHRoZSBzZXJ2ZXJcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBJQ2xpUGluZ1NlcnZlclNlcnZpY2Uge1xuICAgIC8qKlxuICAgICAqIFBpbmdzIHRoZSBzZXJ2ZXJcbiAgICAgKi9cbiAgICBwaW5nKCk6IFByb21pc2U8dm9pZD47XG59XG4iXX0=
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var CliForegroundColor;
|
|
2
|
+
(function (CliForegroundColor) {
|
|
3
|
+
CliForegroundColor["Black"] = "\u001B[30m";
|
|
4
|
+
CliForegroundColor["Red"] = "\u001B[31m";
|
|
5
|
+
CliForegroundColor["Green"] = "\u001B[32m";
|
|
6
|
+
CliForegroundColor["Yellow"] = "\u001B[33m";
|
|
7
|
+
CliForegroundColor["Blue"] = "\u001B[34m";
|
|
8
|
+
CliForegroundColor["Magenta"] = "\u001B[35m";
|
|
9
|
+
CliForegroundColor["Cyan"] = "\u001B[36m";
|
|
10
|
+
CliForegroundColor["White"] = "\u001B[37m";
|
|
11
|
+
CliForegroundColor["Reset"] = "\u001B[0m";
|
|
12
|
+
})(CliForegroundColor || (CliForegroundColor = {}));
|
|
13
|
+
export var CliBackgroundColor;
|
|
14
|
+
(function (CliBackgroundColor) {
|
|
15
|
+
CliBackgroundColor["Black"] = "\u001B[40m";
|
|
16
|
+
CliBackgroundColor["Red"] = "\u001B[41m";
|
|
17
|
+
CliBackgroundColor["Green"] = "\u001B[42m";
|
|
18
|
+
CliBackgroundColor["Yellow"] = "\u001B[43m";
|
|
19
|
+
CliBackgroundColor["Blue"] = "\u001B[44m";
|
|
20
|
+
CliBackgroundColor["Magenta"] = "\u001B[45m";
|
|
21
|
+
CliBackgroundColor["Cyan"] = "\u001B[46m";
|
|
22
|
+
CliBackgroundColor["White"] = "\u001B[47m";
|
|
23
|
+
})(CliBackgroundColor || (CliBackgroundColor = {}));
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb3JlL3NyYy9saWIvbW9kZWxzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZCQSxNQUFNLENBQU4sSUFBWSxrQkFVWDtBQVZELFdBQVksa0JBQWtCO0lBQzFCLDBDQUFrQixDQUFBO0lBQ2xCLHdDQUFnQixDQUFBO0lBQ2hCLDBDQUFrQixDQUFBO0lBQ2xCLDJDQUFtQixDQUFBO0lBQ25CLHlDQUFpQixDQUFBO0lBQ2pCLDRDQUFvQixDQUFBO0lBQ3BCLHlDQUFpQixDQUFBO0lBQ2pCLDBDQUFrQixDQUFBO0lBQ2xCLHlDQUFpQixDQUFBO0FBQ3JCLENBQUMsRUFWVyxrQkFBa0IsS0FBbEIsa0JBQWtCLFFBVTdCO0FBRUQsTUFBTSxDQUFOLElBQVksa0JBU1g7QUFURCxXQUFZLGtCQUFrQjtJQUMxQiwwQ0FBa0IsQ0FBQTtJQUNsQix3Q0FBZ0IsQ0FBQTtJQUNoQiwwQ0FBa0IsQ0FBQTtJQUNsQiwyQ0FBbUIsQ0FBQTtJQUNuQix5Q0FBaUIsQ0FBQTtJQUNqQiw0Q0FB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tcbn1cblxuLyoqXG4gKiBPcHRpb25zIGZvciB0aGUgQ0xJXG4gKi9cbmV4cG9ydCB0eXBlIENsaU9wdGlvbnMgPSB7XG4gICAgLyoqXG4gICAgICogVGhlIHdlbGNvbWUgbWVzc2FnZSB0byBkaXNwbGF5IHdoZW4gdGhlIENMSSBzdGFydHNcbiAgICAgKi9cbiAgICB3ZWxjb21lTWVzc2FnZT86IHN0cmluZztcblxuICAgIC8qKlxuICAgICAqIEhpZGUgdGhlIHByb21wdCB0byBkaXNwbGF5IHdoZW4gdGhlIENMSSBpcyByZWFkeSB0byBhY2NlcHQgaW5wdXRcbiAgICAgKi9cbiAgICBoaWRlVXNlck5hbWU/OiBib29sZWFuO1xuXG4gICAgLyoqXG4gICAgICogQ3VzdG9tIHRlcm1pbmFsIG9wdGlvbnNcbiAgICAgKi9cbiAgICB0ZXJtaW5hbE9wdGlvbnM/OiBJVGVybWluYWxPcHRpb25zICYgSVRlcm1pbmFsSW5pdE9ubHlPcHRpb25zO1xufTtcbiJdfQ==
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of core
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/models';
|
|
5
|
+
export * from './lib/interfaces';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2NvcmUvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQztBQUU3QixjQUFjLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBjb3JlXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvbW9kZWxzJztcblxuZXhwb3J0ICogZnJvbSAnLi9saWIvaW50ZXJmYWNlcyc7XG4iXX0=
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicW9kYWxpcy1jbGktY29yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2NvcmUvc3JjL3FvZGFsaXMtY2xpLWNvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var CliForegroundColor;
|
|
2
|
+
(function (CliForegroundColor) {
|
|
3
|
+
CliForegroundColor["Black"] = "\u001B[30m";
|
|
4
|
+
CliForegroundColor["Red"] = "\u001B[31m";
|
|
5
|
+
CliForegroundColor["Green"] = "\u001B[32m";
|
|
6
|
+
CliForegroundColor["Yellow"] = "\u001B[33m";
|
|
7
|
+
CliForegroundColor["Blue"] = "\u001B[34m";
|
|
8
|
+
CliForegroundColor["Magenta"] = "\u001B[35m";
|
|
9
|
+
CliForegroundColor["Cyan"] = "\u001B[36m";
|
|
10
|
+
CliForegroundColor["White"] = "\u001B[37m";
|
|
11
|
+
CliForegroundColor["Reset"] = "\u001B[0m";
|
|
12
|
+
})(CliForegroundColor || (CliForegroundColor = {}));
|
|
13
|
+
var CliBackgroundColor;
|
|
14
|
+
(function (CliBackgroundColor) {
|
|
15
|
+
CliBackgroundColor["Black"] = "\u001B[40m";
|
|
16
|
+
CliBackgroundColor["Red"] = "\u001B[41m";
|
|
17
|
+
CliBackgroundColor["Green"] = "\u001B[42m";
|
|
18
|
+
CliBackgroundColor["Yellow"] = "\u001B[43m";
|
|
19
|
+
CliBackgroundColor["Blue"] = "\u001B[44m";
|
|
20
|
+
CliBackgroundColor["Magenta"] = "\u001B[45m";
|
|
21
|
+
CliBackgroundColor["Cyan"] = "\u001B[46m";
|
|
22
|
+
CliBackgroundColor["White"] = "\u001B[47m";
|
|
23
|
+
})(CliBackgroundColor || (CliBackgroundColor = {}));
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Public API Surface of core
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generated bundle index. Do not edit.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export { CliBackgroundColor, CliForegroundColor };
|
|
34
|
+
//# sourceMappingURL=qodalis-cli-core.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qodalis-cli-core.mjs","sources":["../../../projects/core/src/lib/models/index.ts","../../../projects/core/src/public-api.ts","../../../projects/core/src/qodalis-cli-core.ts"],"sourcesContent":["import { ITerminalInitOnlyOptions, ITerminalOptions } from '@xterm/xterm';\n\nexport type CliProcessCommand = {\n /**\n * The command that was entered\n */\n command: string;\n\n /**\n * The chain of commands that were entered\n */\n chainCommands: string[];\n\n /**\n * The raw command that was entered\n */\n rawCommand: string;\n\n /**\n * The value of the command\n */\n value?: string;\n\n /**\n * The arguments that were entered\n */\n args: Record<string, any>;\n};\n\nexport enum CliForegroundColor {\n Black = '\\x1b[30m',\n Red = '\\x1b[31m',\n Green = '\\x1b[32m',\n Yellow = '\\x1b[33m',\n Blue = '\\x1b[34m',\n Magenta = '\\x1b[35m',\n Cyan = '\\x1b[36m',\n White = '\\x1b[37m',\n Reset = '\\x1b[0m',\n}\n\nexport enum CliBackgroundColor {\n Black = '\\x1b[40m',\n Red = '\\x1b[41m',\n Green = '\\x1b[42m',\n Yellow = '\\x1b[43m',\n Blue = '\\x1b[44m',\n Magenta = '\\x1b[45m',\n Cyan = '\\x1b[46m',\n White = '\\x1b[47m',\n}\n\nexport interface ICliUser extends Record<string, any> {\n /**\n * The id of the user\n */\n id: string;\n\n /**\n * The name of the user\n */\n name: string;\n\n /**\n * The email of the user\n */\n email: string;\n}\n\nexport interface ICliUserSession {\n /**\n * The user associated with the session\n */\n user: ICliUser;\n\n /**\n * The data associated with the user session\n */\n data?: Record<string, any>;\n}\n\n/**\n * Options for the CLI\n */\nexport type CliOptions = {\n /**\n * The welcome message to display when the CLI starts\n */\n welcomeMessage?: string;\n\n /**\n * Hide the prompt to display when the CLI is ready to accept input\n */\n hideUserName?: boolean;\n\n /**\n * Custom terminal options\n */\n terminalOptions?: ITerminalOptions & ITerminalInitOnlyOptions;\n};\n","/*\n * Public API Surface of core\n */\n\nexport * from './lib/models';\n\nexport * from './lib/interfaces';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"IA6BY,mBAUX;AAVD,CAAA,UAAY,kBAAkB,EAAA;AAC1B,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AAClB,IAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,YAAgB,CAAA;AAChB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AAClB,IAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,YAAmB,CAAA;AACnB,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,YAAiB,CAAA;AACjB,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,YAAoB,CAAA;AACpB,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,YAAiB,CAAA;AACjB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AAClB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,WAAiB,CAAA;AACrB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,GAU7B,EAAA,CAAA,CAAA,CAAA;IAEW,mBASX;AATD,CAAA,UAAY,kBAAkB,EAAA;AAC1B,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AAClB,IAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,YAAgB,CAAA;AAChB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AAClB,IAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,YAAmB,CAAA;AACnB,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,YAAiB,CAAA;AACjB,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,YAAoB,CAAA;AACpB,IAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,YAAiB,CAAA;AACjB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,YAAkB,CAAA;AACtB,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,GAS7B,EAAA,CAAA,CAAA;;AClDD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { Terminal } from '@xterm/xterm';
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
|
+
import { CliBackgroundColor, CliForegroundColor, CliOptions, CliProcessCommand, ICliUser, ICliUserSession } from '../models';
|
|
4
|
+
export interface ICliCommandAuthor {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the author
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The email of the author
|
|
11
|
+
*/
|
|
12
|
+
email: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Represents a command processor
|
|
16
|
+
*/
|
|
17
|
+
export interface ICliCommandProcessor {
|
|
18
|
+
/**
|
|
19
|
+
* The command that this processor handles
|
|
20
|
+
*/
|
|
21
|
+
command: string;
|
|
22
|
+
/**
|
|
23
|
+
* A description of the command
|
|
24
|
+
*/
|
|
25
|
+
description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The author of the command
|
|
28
|
+
*/
|
|
29
|
+
author?: ICliCommandAuthor;
|
|
30
|
+
/**
|
|
31
|
+
* If true, the processor can handle unlisted commands
|
|
32
|
+
*/
|
|
33
|
+
allowUnlistedCommands?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If true, the value is required
|
|
36
|
+
*/
|
|
37
|
+
valueRequired?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The version of the command processor
|
|
40
|
+
* @default '1.0.0'
|
|
41
|
+
*/
|
|
42
|
+
version?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Processors that are nested under this processor
|
|
45
|
+
*/
|
|
46
|
+
processors?: ICliCommandProcessor[];
|
|
47
|
+
/**
|
|
48
|
+
* Parameters that the command accepts
|
|
49
|
+
*/
|
|
50
|
+
parameters?: ICliCommandParameterDescriptor[];
|
|
51
|
+
/**
|
|
52
|
+
* Process the command
|
|
53
|
+
* @param command The command to process
|
|
54
|
+
* @param context The context in which the command is executed
|
|
55
|
+
*/
|
|
56
|
+
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Write the description of the command
|
|
59
|
+
* @param context The context in which the command is executed
|
|
60
|
+
*/
|
|
61
|
+
writeDescription?(context: ICliExecutionContext): void;
|
|
62
|
+
/**
|
|
63
|
+
* A function that validates the command before execution
|
|
64
|
+
* @param value The value to validate
|
|
65
|
+
* @returns An object with a valid property that indicates if the value is valid and an optional message property that contains a message to display if the value is not valid
|
|
66
|
+
*/
|
|
67
|
+
validateBeforeExecution?: (command: CliProcessCommand, context: ICliExecutionContext) => {
|
|
68
|
+
valid: boolean;
|
|
69
|
+
message?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Initialize the command processor
|
|
73
|
+
* @param context The context in which the command is executed
|
|
74
|
+
*/
|
|
75
|
+
initialize?(context: ICliExecutionContext): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Represents a command parameter
|
|
79
|
+
*/
|
|
80
|
+
export interface ICliCommandParameterDescriptor {
|
|
81
|
+
/**
|
|
82
|
+
* The name of the parameter
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Aliases for the parameter
|
|
87
|
+
*/
|
|
88
|
+
aliases?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* A description of the parameter
|
|
91
|
+
*/
|
|
92
|
+
description: string;
|
|
93
|
+
/**
|
|
94
|
+
* If true, the parameter is required
|
|
95
|
+
*/
|
|
96
|
+
required: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The type of the parameter
|
|
99
|
+
*/
|
|
100
|
+
type: string;
|
|
101
|
+
/**
|
|
102
|
+
* The default value of the parameter
|
|
103
|
+
*/
|
|
104
|
+
defaultValue?: any;
|
|
105
|
+
/**
|
|
106
|
+
* A validator function that validates the value of the parameter
|
|
107
|
+
* @param value The value to validate
|
|
108
|
+
* @returns An object with a valid property that indicates if the value is valid and an optional message property that contains a message to display if the value is not valid
|
|
109
|
+
*/
|
|
110
|
+
validator?: (value: any) => {
|
|
111
|
+
/**
|
|
112
|
+
* Indicates if the value is valid
|
|
113
|
+
*/
|
|
114
|
+
valid: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* An optional message to display if the value is not valid
|
|
117
|
+
*/
|
|
118
|
+
message?: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface ICliTerminalWriter {
|
|
122
|
+
/**
|
|
123
|
+
* Write text to the terminal
|
|
124
|
+
* @param text The text to write
|
|
125
|
+
*/
|
|
126
|
+
write(text: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Write text to the terminal followed by a newline
|
|
129
|
+
* @param text The text to write
|
|
130
|
+
*/
|
|
131
|
+
writeln(text: string): void;
|
|
132
|
+
/**
|
|
133
|
+
* Write a success message to the terminal
|
|
134
|
+
* @param messag The message to write
|
|
135
|
+
* @returns void
|
|
136
|
+
*/
|
|
137
|
+
writeSuccess: (message: string) => void;
|
|
138
|
+
/**
|
|
139
|
+
* Write an info message to the terminal
|
|
140
|
+
* @param messag The message to write
|
|
141
|
+
* @returns void
|
|
142
|
+
*/
|
|
143
|
+
writeInfo: (message: string) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Write an error message to the terminal
|
|
146
|
+
* @param message The message to write
|
|
147
|
+
* @returns void
|
|
148
|
+
*/
|
|
149
|
+
writeError: (message: string) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Write a warning message to the terminal
|
|
152
|
+
* @param message The message to write
|
|
153
|
+
* @returns void
|
|
154
|
+
*/
|
|
155
|
+
writeWarning: (message: string) => void;
|
|
156
|
+
/**
|
|
157
|
+
* Write a message to the terminal with the specified color
|
|
158
|
+
* @param message The message to write
|
|
159
|
+
* @param color The color to use
|
|
160
|
+
* @returns void
|
|
161
|
+
*/
|
|
162
|
+
wrapInColor: (text: string, color: CliForegroundColor) => string;
|
|
163
|
+
/**
|
|
164
|
+
* Write a message to the terminal with the specified background color
|
|
165
|
+
* @param message The message to write
|
|
166
|
+
* @param color The background color to use
|
|
167
|
+
* @returns void
|
|
168
|
+
*/
|
|
169
|
+
wrapInBackgroundColor: (text: string, color: CliBackgroundColor) => string;
|
|
170
|
+
/**
|
|
171
|
+
* Write a JSON object to the terminal
|
|
172
|
+
* @param json The JSON object to write
|
|
173
|
+
* @returns void
|
|
174
|
+
*/
|
|
175
|
+
writeJson: (json: any) => void;
|
|
176
|
+
/**
|
|
177
|
+
* Write content to a file
|
|
178
|
+
* @param fileName The name of the file to write to
|
|
179
|
+
* @param content The content to write to the file
|
|
180
|
+
* @returns void
|
|
181
|
+
*/
|
|
182
|
+
writeToFile: (fileName: string, content: string) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Write an object array as a table to the terminal
|
|
185
|
+
* @param objects The objects to write to the table
|
|
186
|
+
* @returns void
|
|
187
|
+
*/
|
|
188
|
+
writeObjectArrayTable(objects: any[]): void;
|
|
189
|
+
/**
|
|
190
|
+
* Write a table to the terminal
|
|
191
|
+
* @param headers The headers of the table
|
|
192
|
+
* @param rows The rows of the table
|
|
193
|
+
* @returns void
|
|
194
|
+
*/
|
|
195
|
+
writeTable(headers: string[], rows: string[][]): void;
|
|
196
|
+
}
|
|
197
|
+
export interface ICliProgressBar {
|
|
198
|
+
/**
|
|
199
|
+
* Indicates if the progress bar is running
|
|
200
|
+
*/
|
|
201
|
+
isRunning: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Show the progress bar
|
|
204
|
+
*/
|
|
205
|
+
show: () => void;
|
|
206
|
+
/**
|
|
207
|
+
* Hide the progress bar
|
|
208
|
+
*/
|
|
209
|
+
hide: () => void;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Represents a spinner for the CLI
|
|
213
|
+
*/
|
|
214
|
+
export interface ICliSpinner extends ICliProgressBar {
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Represents a progress bar for the CLI
|
|
218
|
+
*/
|
|
219
|
+
export interface ICliPercentageProgressBar extends ICliProgressBar {
|
|
220
|
+
/**
|
|
221
|
+
* Update the progress of the progress bar
|
|
222
|
+
* @param progress The progress to update to
|
|
223
|
+
* @returns void
|
|
224
|
+
*/
|
|
225
|
+
update: (progress: number) => void;
|
|
226
|
+
/**
|
|
227
|
+
* Complete the progress bar
|
|
228
|
+
* @returns void
|
|
229
|
+
*/
|
|
230
|
+
complete: () => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Represents a clipboard for the CLI
|
|
234
|
+
*/
|
|
235
|
+
export interface ICliClipboard {
|
|
236
|
+
/**
|
|
237
|
+
* Write text to the clipboard
|
|
238
|
+
* @param text The text to write to the clipboard
|
|
239
|
+
* @returns void
|
|
240
|
+
*/
|
|
241
|
+
write: (text: string) => Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Read text from the clipboard
|
|
244
|
+
* @returns The text read from the clipboard
|
|
245
|
+
*/
|
|
246
|
+
read: () => Promise<string>;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Represents a service that executes commands
|
|
250
|
+
*/
|
|
251
|
+
export interface ICliCommandExecutorService {
|
|
252
|
+
/**
|
|
253
|
+
*
|
|
254
|
+
* @param command
|
|
255
|
+
* @param context
|
|
256
|
+
*/
|
|
257
|
+
showHelp(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* List all commands
|
|
260
|
+
* @returns An array of all commands
|
|
261
|
+
*/
|
|
262
|
+
listCommands(): string[];
|
|
263
|
+
/**
|
|
264
|
+
* Find a processor for a command
|
|
265
|
+
* @param mainCommand
|
|
266
|
+
* @param chainCommands
|
|
267
|
+
*/
|
|
268
|
+
findProcessor(mainCommand: string, chainCommands: string[]): ICliCommandProcessor | undefined;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Represents the context in which a command is executed
|
|
272
|
+
*/
|
|
273
|
+
export interface ICliExecutionContext {
|
|
274
|
+
/**
|
|
275
|
+
* The current user session
|
|
276
|
+
*/
|
|
277
|
+
userSession?: ICliUserSession;
|
|
278
|
+
/**
|
|
279
|
+
* The spinner to use for showing/hiding the loader
|
|
280
|
+
*/
|
|
281
|
+
spinner?: ICliSpinner;
|
|
282
|
+
/**
|
|
283
|
+
* The progress bar to use for showing progress
|
|
284
|
+
*/
|
|
285
|
+
progressBar: ICliPercentageProgressBar;
|
|
286
|
+
/**
|
|
287
|
+
* A subject that emits when the command is aborted
|
|
288
|
+
*/
|
|
289
|
+
onAbort: Subject<void>;
|
|
290
|
+
/**
|
|
291
|
+
* The terminal to use for writing
|
|
292
|
+
*/
|
|
293
|
+
terminal: Terminal;
|
|
294
|
+
/**
|
|
295
|
+
* The writer to use for writing to the terminal
|
|
296
|
+
*/
|
|
297
|
+
writer: ICliTerminalWriter;
|
|
298
|
+
/**
|
|
299
|
+
* The command executor to use for executing commands
|
|
300
|
+
*/
|
|
301
|
+
executor: ICliCommandExecutorService;
|
|
302
|
+
/**
|
|
303
|
+
* The clipboard to use for copying/pasting
|
|
304
|
+
*/
|
|
305
|
+
clipboard: ICliClipboard;
|
|
306
|
+
/**
|
|
307
|
+
* The data store to use for storing data
|
|
308
|
+
*/
|
|
309
|
+
dataStore: ICliCommandDataStore;
|
|
310
|
+
/**
|
|
311
|
+
* The options for the CLI
|
|
312
|
+
*/
|
|
313
|
+
options?: CliOptions;
|
|
314
|
+
/**
|
|
315
|
+
* The prompt to use for prompting the user for input
|
|
316
|
+
*/
|
|
317
|
+
showPrompt: () => void;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Represents a data store for storing data associated with commands
|
|
321
|
+
*/
|
|
322
|
+
export interface ICliCommandDataStore {
|
|
323
|
+
/**
|
|
324
|
+
* The data store
|
|
325
|
+
*/
|
|
326
|
+
data: Record<string, Record<string, any>>;
|
|
327
|
+
/**
|
|
328
|
+
* Append data to the data store
|
|
329
|
+
* @param command
|
|
330
|
+
* @param key
|
|
331
|
+
* @param data
|
|
332
|
+
*/
|
|
333
|
+
appendData(command: string, key: string, data: any): void;
|
|
334
|
+
/**
|
|
335
|
+
* Get data from the data store
|
|
336
|
+
* @param command
|
|
337
|
+
* @param key
|
|
338
|
+
*/
|
|
339
|
+
getData<T = any>(command: string, key: string): T;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Represents a service that manages user sessions in the CLI
|
|
343
|
+
*/
|
|
344
|
+
export interface ICliUserSessionService {
|
|
345
|
+
/**
|
|
346
|
+
* Gets the current user session
|
|
347
|
+
* @returns An observable that emits the current user session
|
|
348
|
+
*/
|
|
349
|
+
getUserSession(): Observable<ICliUserSession | undefined>;
|
|
350
|
+
/**
|
|
351
|
+
* Sets the current user session
|
|
352
|
+
* @param session The session to set
|
|
353
|
+
*/
|
|
354
|
+
setUserSession(session: ICliUserSession): Promise<void>;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Represents a service that manages users in the CLI
|
|
358
|
+
*/
|
|
359
|
+
export interface ICliUsersStoreService {
|
|
360
|
+
/**
|
|
361
|
+
* Gets the current users
|
|
362
|
+
* @returns An observable that emits the current users
|
|
363
|
+
*/
|
|
364
|
+
getUsers(): Observable<ICliUser[]>;
|
|
365
|
+
/**
|
|
366
|
+
* Sets the current users
|
|
367
|
+
* @param users The users to set
|
|
368
|
+
*/
|
|
369
|
+
setUsers(users: ICliUser[]): Promise<void>;
|
|
370
|
+
/**
|
|
371
|
+
* Gets a user by id
|
|
372
|
+
* @param id The id of the user to get
|
|
373
|
+
* @returns An observable that emits the user with the specified id
|
|
374
|
+
*/
|
|
375
|
+
getUser(id: string): Observable<ICliUser | undefined>;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Represents a service that pings the server
|
|
379
|
+
*/
|
|
380
|
+
export interface ICliPingServerService {
|
|
381
|
+
/**
|
|
382
|
+
* Pings the server
|
|
383
|
+
*/
|
|
384
|
+
ping(): Promise<void>;
|
|
385
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ITerminalInitOnlyOptions, ITerminalOptions } from '@xterm/xterm';
|
|
2
|
+
export type CliProcessCommand = {
|
|
3
|
+
/**
|
|
4
|
+
* The command that was entered
|
|
5
|
+
*/
|
|
6
|
+
command: string;
|
|
7
|
+
/**
|
|
8
|
+
* The chain of commands that were entered
|
|
9
|
+
*/
|
|
10
|
+
chainCommands: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The raw command that was entered
|
|
13
|
+
*/
|
|
14
|
+
rawCommand: string;
|
|
15
|
+
/**
|
|
16
|
+
* The value of the command
|
|
17
|
+
*/
|
|
18
|
+
value?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The arguments that were entered
|
|
21
|
+
*/
|
|
22
|
+
args: Record<string, any>;
|
|
23
|
+
};
|
|
24
|
+
export declare enum CliForegroundColor {
|
|
25
|
+
Black = "\u001B[30m",
|
|
26
|
+
Red = "\u001B[31m",
|
|
27
|
+
Green = "\u001B[32m",
|
|
28
|
+
Yellow = "\u001B[33m",
|
|
29
|
+
Blue = "\u001B[34m",
|
|
30
|
+
Magenta = "\u001B[35m",
|
|
31
|
+
Cyan = "\u001B[36m",
|
|
32
|
+
White = "\u001B[37m",
|
|
33
|
+
Reset = "\u001B[0m"
|
|
34
|
+
}
|
|
35
|
+
export declare enum CliBackgroundColor {
|
|
36
|
+
Black = "\u001B[40m",
|
|
37
|
+
Red = "\u001B[41m",
|
|
38
|
+
Green = "\u001B[42m",
|
|
39
|
+
Yellow = "\u001B[43m",
|
|
40
|
+
Blue = "\u001B[44m",
|
|
41
|
+
Magenta = "\u001B[45m",
|
|
42
|
+
Cyan = "\u001B[46m",
|
|
43
|
+
White = "\u001B[47m"
|
|
44
|
+
}
|
|
45
|
+
export interface ICliUser extends Record<string, any> {
|
|
46
|
+
/**
|
|
47
|
+
* The id of the user
|
|
48
|
+
*/
|
|
49
|
+
id: string;
|
|
50
|
+
/**
|
|
51
|
+
* The name of the user
|
|
52
|
+
*/
|
|
53
|
+
name: string;
|
|
54
|
+
/**
|
|
55
|
+
* The email of the user
|
|
56
|
+
*/
|
|
57
|
+
email: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ICliUserSession {
|
|
60
|
+
/**
|
|
61
|
+
* The user associated with the session
|
|
62
|
+
*/
|
|
63
|
+
user: ICliUser;
|
|
64
|
+
/**
|
|
65
|
+
* The data associated with the user session
|
|
66
|
+
*/
|
|
67
|
+
data?: Record<string, any>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Options for the CLI
|
|
71
|
+
*/
|
|
72
|
+
export type CliOptions = {
|
|
73
|
+
/**
|
|
74
|
+
* The welcome message to display when the CLI starts
|
|
75
|
+
*/
|
|
76
|
+
welcomeMessage?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Hide the prompt to display when the CLI is ready to accept input
|
|
79
|
+
*/
|
|
80
|
+
hideUserName?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Custom terminal options
|
|
83
|
+
*/
|
|
84
|
+
terminalOptions?: ITerminalOptions & ITerminalInitOnlyOptions;
|
|
85
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qodalis/cli-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^16.2.0",
|
|
6
|
+
"@angular/core": "^16.2.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0",
|
|
10
|
+
"@xterm/xterm": "^5.5.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2022/qodalis-cli-core.mjs",
|
|
14
|
+
"typings": "index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"esm2022": "./esm2022/qodalis-cli-core.mjs",
|
|
22
|
+
"esm": "./esm2022/qodalis-cli-core.mjs",
|
|
23
|
+
"default": "./fesm2022/qodalis-cli-core.mjs"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
package/public-api.d.ts
ADDED