bscript-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/BScript.js +233 -0
- package/Docs/BScript/BSCRIPT-REFERENCE-CLI.md +502 -0
- package/Docs/Images/BScript-baner.png +0 -0
- package/Docs/Images/BooleanType.png +0 -0
- package/Docs/Images/FuncionType.png +0 -0
- package/Docs/Images/Logo.png +0 -0
- package/Docs/Images/NumberType.png +0 -0
- package/Docs/Images/ObjectType.png +0 -0
- package/Docs/Images/PromiseType.png +0 -0
- package/Docs/Images/RawType.png +0 -0
- package/Docs/Images/RefType.png +0 -0
- package/Docs/Images/TextType.png +0 -0
- package/Docs/README.md +157 -0
- package/Docs/REFERENCE.md +602 -0
- package/Docs/TECHNICAL.md +1143 -0
- package/Docs/TUTORIAL.md +604 -0
- package/SRC/BScriptHistory.js +98 -0
- package/SRC/CMDPermissions.js +4 -0
- package/SRC/utils/utils.js +63 -0
- package/TerminalCommandController.js +193 -0
- package/bin/bscript.js +94 -0
- package/commands/.default/BScript/$arg.js +9 -0
- package/commands/.default/BScript/$val.js +19 -0
- package/commands/.default/BScript/Input.js +10 -0
- package/commands/.default/BScript/bool.js +9 -0
- package/commands/.default/BScript/delay.js +10 -0
- package/commands/.default/BScript/eval.js +9 -0
- package/commands/.default/BScript/import.js +17 -0
- package/commands/.default/BScript/js_new.js +9 -0
- package/commands/.default/BScript/js_require.js +9 -0
- package/commands/.default/BScript/jstype.js +9 -0
- package/commands/.default/BScript/num.js +9 -0
- package/commands/.default/BScript/object.js +19 -0
- package/commands/.default/BScript/print.js +9 -0
- package/commands/.default/BScript/raw.js +9 -0
- package/commands/.default/BScript/ref.js +65 -0
- package/commands/.default/BScript/run-with-await.js +13 -0
- package/commands/.default/BScript/run.js +11 -0
- package/commands/.default/BScript/script.js +13 -0
- package/commands/.default/BScript/str.js +9 -0
- package/commands/.default/DebugOnly/clear.js +8 -0
- package/commands/.default/DebugOnly/update-commands.js +8 -0
- package/commands/.default/help.js +20 -0
- package/commands/snapshot.md +421 -0
- package/index.js +8 -0
- package/package.json +12 -0
- package/postinstall.js +12 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Docs/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<img src="./Images/BScript-baner.png" width="300" alt="BScript"/>
|
|
2
|
+
|
|
3
|
+
# BScript-CLI <img src="./Images/Logo.png" width="24" alt=""/>
|
|
4
|
+
|
|
5
|
+
**Interactive Command-Line Script Interpreter with Dynamic Command Loading**
|
|
6
|
+
|
|
7
|
+
BScript is a powerful Node.js-based command-line interface framework that allows you to create interactive terminal applications with dynamically loaded commands, permission-based access control, and built-in command history management.
|
|
8
|
+
|
|
9
|
+
[](https://nodejs.org/)
|
|
10
|
+
[](https://www.npmjs.com/package/bscript)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✨ Key Features
|
|
16
|
+
|
|
17
|
+
- ✅ **Dynamic Command Loading** — Load commands from multiple directories with hot-reload support
|
|
18
|
+
- ✅ **Permission System** — Fine-grained role-based access control for commands
|
|
19
|
+
- ✅ **Interactive Terminal UI** — Full terminal control with cursor positioning and formatting
|
|
20
|
+
- ✅ **Command History** — Persistent command history with navigation
|
|
21
|
+
- ✅ **Script Execution** — Execute inline scripts or load from files with `-e` and `script` commands
|
|
22
|
+
- ✅ **Event-Driven Architecture** — Built on Node.js EventEmitter for extensibility
|
|
23
|
+
- ✅ **Custom Sandboxing** — Safe command execution with isolated contexts
|
|
24
|
+
- ✅ **Command Aliases** — Support multiple names for a single command
|
|
25
|
+
- ✅ **Loader Animation** — Async operation feedback with visual animations
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📌 Useful Links
|
|
30
|
+
|
|
31
|
+
| Link | Description |
|
|
32
|
+
|------|-------------|
|
|
33
|
+
| **[Syntax Reference](https://github.com/BEISER901/bscript-runner/blob/main/Docs/BScript/SYNTAX.md)** | A complete reference for the BScript language syntax. |
|
|
34
|
+
| **[CLI Reference](./BScript/REFERENCE-CLI.md)** | Available BScript commands and their declaration. |
|
|
35
|
+
| **[bscript-runner](https://github.com/BEISER901/bscript-runner)** | The bscript-runner trans-compiler. |
|
|
36
|
+
| **[Getting Started](./TUTORIAL.md)** | Installation and first steps |
|
|
37
|
+
| **[API Reference](./REFERENCE.md)** | Complete public API documentation |
|
|
38
|
+
| **[Technical](./TECHNICAL.md)** | Internal architecture and implementation |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🚀 Quick Start
|
|
43
|
+
|
|
44
|
+
### Installation
|
|
45
|
+
|
|
46
|
+
#### Global Installation
|
|
47
|
+
|
|
48
|
+
**Using npm**
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g @beiser/bscript-cli
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Using pnpm**
|
|
54
|
+
```bash
|
|
55
|
+
pnpm add -g @beiser/bscript-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Using yarn**
|
|
59
|
+
```bash
|
|
60
|
+
yarn global add @beiser/bscript-cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Basic Usage
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
const BScript = require("@beiser/bscript-cli");
|
|
69
|
+
|
|
70
|
+
// Create a new BScript instance
|
|
71
|
+
const cmd = new BScript();
|
|
72
|
+
|
|
73
|
+
// Set default permissions
|
|
74
|
+
cmd.cmdRootPermissions = [cmd.perrmissionsKeys.default];
|
|
75
|
+
|
|
76
|
+
// Load commands from default locations
|
|
77
|
+
cmd.updateCommands();
|
|
78
|
+
|
|
79
|
+
// Start interactive mode
|
|
80
|
+
cmd.Start();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Command-Line Interface
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Start interactive mode
|
|
89
|
+
bscript
|
|
90
|
+
|
|
91
|
+
# Execute inline script
|
|
92
|
+
bscript -e "your script code"
|
|
93
|
+
|
|
94
|
+
# Load and execute a script file
|
|
95
|
+
bscript script path/to/file.js
|
|
96
|
+
|
|
97
|
+
# Show help
|
|
98
|
+
bscript --help
|
|
99
|
+
|
|
100
|
+
# Show version
|
|
101
|
+
bscript --version
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### Getting Started
|
|
107
|
+
|
|
108
|
+
1. Install the package via npm
|
|
109
|
+
2. Create a BScript instance with desired configuration
|
|
110
|
+
3. Define commands in `.js` files within your commands directory
|
|
111
|
+
4. Update commands to load them into the system
|
|
112
|
+
5. Start the interactive interface or execute scripts
|
|
113
|
+
|
|
114
|
+
For a complete guide see **[TUTORIAL.md](./TUTORIAL.md)**.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 📚 Documentation
|
|
119
|
+
|
|
120
|
+
- **[Getting Started](./TUTORIAL.md)** — Installation and usage guide
|
|
121
|
+
- **[API Reference](./REFERENCE.md)** — Full public API documentation
|
|
122
|
+
- **[Technical](./TECHNICAL.md)** — Architecture and internal implementation
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🛠 Core Modules
|
|
127
|
+
|
|
128
|
+
- **BScript** — Main class for managing commands, permissions, and terminal interaction
|
|
129
|
+
- **TerminalCommandController** — Handles terminal I/O and user input processing
|
|
130
|
+
- **BScriptHistory** — Manages persistent command history across sessions
|
|
131
|
+
- **CMDPermissions** — Permission constants for access control
|
|
132
|
+
- **BScriptRunner** — Script execution engine (external dependency)
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📦 Requirements
|
|
137
|
+
|
|
138
|
+
- Node.js **18+**
|
|
139
|
+
- npm / pnpm / yarn
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 🤝 Contributing
|
|
144
|
+
|
|
145
|
+
Contributions are welcome. Please read **[TECHNICAL.md](./TECHNICAL.md)** before submitting a Pull Request.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 📄 License
|
|
150
|
+
|
|
151
|
+
This project is licensed under the **MIT License**.
|
|
152
|
+
|
|
153
|
+
See the **[LICENSE](./LICENSE)** file for details.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
**Made with ❤️ for the Node.js ecosystem**
|