Skip to content

Commit ec85f4d

Browse files
committed
feat: Implement core engine for system orchestration and secure, multi-file transfer with progress tracking.
1 parent c5307e3 commit ec85f4d

5 files changed

Lines changed: 135 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ celerybeat.pid
9999
*.sage.py
100100

101101
# --- Package Managers ---
102+
node_modules/
102103
# Pipfile.lock
103104
# uv.lock
104105
# poetry.lock

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ Mesh-Pulse turns your terminal into a **Command Center** for your local network.
3434

3535
### 1. Installation
3636

37-
Mesh-Pulse requires **Python 3.10+**. Clone the repository and install the dependencies:
37+
**Via NPM (Recommended)**
38+
You can easily install and run Mesh-Pulse globally using NPM:
39+
40+
```bash
41+
npm install -g mesh-pulse
42+
```
43+
44+
**Via Git (For Development)**
45+
Alternatively, clone the repository and install the Python dependencies directly:
3846

3947
```bash
4048
git clone https://github.com/radikonreturn/mesh_pulse.git
@@ -44,15 +52,28 @@ pip install -r requirements.txt
4452

4553
### 2. Running the Dashboard
4654

47-
Start the application with default settings:
55+
If you installed via NPM globally, you can start the dashboard from anywhere:
56+
57+
```bash
58+
mesh-pulse
59+
```
60+
61+
Alternatively, you can run it via `npx` without installing:
62+
63+
```bash
64+
npx mesh-pulse
65+
```
66+
67+
**Running from Source (Python)**
68+
If you are running from the cloned repository:
4869

4970
```bash
5071
python -m mesh_pulse
5172
```
5273

53-
For advanced configuration, you can pass custom port settings:
74+
For advanced configuration, you can pass custom port settings (works identically for `mesh-pulse` and `python -m mesh_pulse`):
5475
```bash
55-
python -m mesh_pulse --broadcast-port 9999 --transfer-port 10000
76+
mesh-pulse --broadcast-port 9999 --transfer-port 10000
5677
```
5778

5879
---

bin/install.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env node
2+
const { execSync, spawnSync } = require('child_process');
3+
const path = require('path');
4+
const fs = require('fs');
5+
6+
const venvPath = path.join(__dirname, '..', '.venv');
7+
const reqPath = path.join(__dirname, '..', 'requirements.txt');
8+
9+
try {
10+
if (!fs.existsSync(venvPath)) {
11+
console.log('Creating Python virtual environment...');
12+
// Try python3 first, fallback to python
13+
try {
14+
execSync('python3 -m venv .venv', {
15+
cwd: path.join(__dirname, '..'),
16+
stdio: 'inherit'
17+
});
18+
} catch (e) {
19+
execSync('python -m venv .venv', {
20+
cwd: path.join(__dirname, '..'),
21+
stdio: 'inherit'
22+
});
23+
}
24+
} else {
25+
console.log('Python virtual environment already exists.');
26+
}
27+
28+
const pipCmd = process.platform === 'win32'
29+
? path.join(venvPath, 'Scripts', 'pip')
30+
: path.join(venvPath, 'bin', 'pip');
31+
32+
console.log('Installing Python dependencies...');
33+
const pipArgs = ['install', '-r', reqPath];
34+
const result = spawnSync(pipCmd, pipArgs, {
35+
cwd: path.join(__dirname, '..'),
36+
stdio: 'inherit'
37+
});
38+
39+
if (result.error || result.status !== 0) {
40+
throw new Error(`pip install failed with status ${result.status}`);
41+
}
42+
console.log('Installation complete.');
43+
} catch (error) {
44+
console.error('Failed to setup Python environment:', error.message);
45+
process.exit(1);
46+
}

bin/run.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
const { spawnSync } = require('child_process');
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
const venvPath = path.join(__dirname, '..', '.venv');
7+
const pythonCmd = process.platform === 'win32'
8+
? path.join(venvPath, 'Scripts', 'python')
9+
: path.join(venvPath, 'bin', 'python');
10+
11+
if (!fs.existsSync(pythonCmd)) {
12+
console.error(`Error: Python executable not found at ${pythonCmd}`);
13+
console.error('The virtual environment may not have been created correctly.');
14+
console.error('Try running: npm run postinstall');
15+
process.exit(1);
16+
}
17+
18+
const args = ['-m', 'mesh_pulse', ...process.argv.slice(2)];
19+
20+
// TUI apps need stdin, stdout, and stderr as raw context usually.
21+
// stdio: "inherit" passes through perfectly to Textual/Rich.
22+
const result = spawnSync(pythonCmd, args, {
23+
cwd: process.cwd(),
24+
stdio: 'inherit'
25+
});
26+
27+
if (result.error) {
28+
console.error(`Failed to launch mesh_pulse: ${result.error.message}`);
29+
process.exit(1);
30+
}
31+
32+
process.exit(result.status !== null ? result.status : 1);

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "mesh-pulse",
3+
"version": "1.0.0",
4+
"description": "A TUI-based Network Mesh & System Resource Monitor",
5+
"main": "bin/run.js",
6+
"bin": {
7+
"mesh-pulse": "./bin/run.js"
8+
},
9+
"scripts": {
10+
"postinstall": "node bin/install.js"
11+
},
12+
"keywords": [
13+
"tui",
14+
"network",
15+
"mesh",
16+
"monitor",
17+
"python",
18+
"textual"
19+
],
20+
"author": "Mesh-Pulse Team",
21+
"license": "MIT",
22+
"dependencies": {},
23+
"files": [
24+
"bin",
25+
"mesh_pulse",
26+
"requirements.txt",
27+
"pyproject.toml",
28+
"README.md",
29+
"LICENSE"
30+
]
31+
}

0 commit comments

Comments
 (0)