thinkncollab-shell 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 +26 -0
- package/bin/thinknsh.js +68 -0
- package/package.json +42 -0
- package/src/core/shell.js +974 -0
- package/src/core/websocket.js +385 -0
- package/src/events/notifications.js +198 -0
- package/src/utils/logger.js +169 -0
package/Readme.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ThinkNCollab Shell
|
|
2
|
+
|
|
3
|
+
A powerful collaborative shell with WebSocket integration for real-time team collaboration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Custom Shell** - Full-featured command-line interface
|
|
8
|
+
- 🔌 **WebSocket Integration** - Real-time communication with ThinkNCollab servers
|
|
9
|
+
- 👥 **Room Collaboration** - Join rooms and collaborate with team members
|
|
10
|
+
- 💬 **Messaging** - Send and receive messages in real-time
|
|
11
|
+
- 🔔 **Notifications** - Get notified of important events
|
|
12
|
+
- 📁 **File System** - Built-in file system commands
|
|
13
|
+
- ⚡ **Command System** - Extensible command registration
|
|
14
|
+
- 🔧 **Aliases** - Create custom command aliases
|
|
15
|
+
- 📊 **Variables** - Shell variables support
|
|
16
|
+
- 📜 **History** - Command history with persistence
|
|
17
|
+
- 🎨 **Colored Output** - Beautiful colored terminal output
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install globally
|
|
23
|
+
npm install -g thinkncollab-shell
|
|
24
|
+
|
|
25
|
+
# Or install locally
|
|
26
|
+
npm install thinkncollab-shell
|
package/bin/thinknsh.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ThinkNCollab Shell - CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* thinknsh - Start interactive shell
|
|
8
|
+
* thinknsh <command> - Run single command
|
|
9
|
+
* thinknsh --help - Show help
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const chalk = require('chalk');
|
|
14
|
+
const ThinkNCollabShell = require('../src/core/shell');
|
|
15
|
+
|
|
16
|
+
// Parse arguments
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
|
|
19
|
+
// Show help
|
|
20
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
21
|
+
console.log(`
|
|
22
|
+
${chalk.cyan('ThinkNCollab Shell - CLI')}
|
|
23
|
+
|
|
24
|
+
${chalk.yellow('Usage:')}
|
|
25
|
+
thinknsh Start interactive shell
|
|
26
|
+
thinknsh <command> Run single command
|
|
27
|
+
thinknsh --help Show this help
|
|
28
|
+
thinknsh --version Show version
|
|
29
|
+
|
|
30
|
+
${chalk.yellow('Examples:')}
|
|
31
|
+
thinknsh
|
|
32
|
+
thinknsh join room-123
|
|
33
|
+
thinknsh status
|
|
34
|
+
thinknsh help
|
|
35
|
+
|
|
36
|
+
${chalk.dim('For more commands, type "help" in the interactive shell')}
|
|
37
|
+
`);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Show version
|
|
42
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
43
|
+
const pkg = require('../package.json');
|
|
44
|
+
console.log(pkg.version);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Create and start shell
|
|
49
|
+
const shell = new ThinkNCollabShell({
|
|
50
|
+
serverUrl: process.env.THINKNCOLLAB_SERVER || 'https://api.thinkncollab.com',
|
|
51
|
+
autoConnect: process.env.THINKNCOLLAB_AUTO_CONNECT === 'true'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// If arguments provided, execute command and exit
|
|
55
|
+
if (args.length > 0) {
|
|
56
|
+
shell.execute(args.join(' ')).then(() => {
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}).catch((error) => {
|
|
59
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
// Start interactive shell
|
|
64
|
+
shell.start().catch((error) => {
|
|
65
|
+
console.error(chalk.red(`Fatal error: ${error.message}`));
|
|
66
|
+
process.exit(1);
|
|
67
|
+
});
|
|
68
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "thinkncollab-shell",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "ThinkNCollab Custom Shell with WebSocket collaboration",
|
|
5
|
+
"main": "src/core/shell.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"thinknsh": "./bin/thinknsh.js",
|
|
8
|
+
"tnc": "./bin/thinknsh.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node bin/thinknsh.js",
|
|
12
|
+
"dev": "nodemon bin/thinknsh.js",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"prepublishOnly": ""
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"shell",
|
|
18
|
+
"terminal",
|
|
19
|
+
"websocket",
|
|
20
|
+
"collaboration",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"author": "ThinkNCollab",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"socket.io-client": "^4.7.2",
|
|
27
|
+
"chalk": "^4.1.2",
|
|
28
|
+
"fs-extra": "^11.1.1",
|
|
29
|
+
"inquirer": "^8.2.6",
|
|
30
|
+
"os-locale": "^6.0.2",
|
|
31
|
+
"node-machine-id": "^1.1.12",
|
|
32
|
+
"figlet": "^1.6.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=14.0.0"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin/",
|
|
39
|
+
"src/",
|
|
40
|
+
"README.md"
|
|
41
|
+
]
|
|
42
|
+
}
|