bs9 1.3.4 → 1.3.6
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 +14 -2
- package/bin/bs9 +9 -1
- package/dist/bs9-c399ds6a. +181 -0
- package/dist/bs9-d6mhpepe. +181 -0
- package/dist/bs9-zpqd24hj. +189 -0
- package/dist/bs9.js +1 -1
- package/package.json +1 -1
- package/src/alerting/config.ts +9 -0
- package/src/commands/alert.ts +9 -0
- package/src/commands/deps.ts +9 -0
- package/src/commands/export.ts +9 -0
- package/src/commands/logs.ts +9 -0
- package/src/commands/monit.ts +9 -0
- package/src/commands/profile.ts +9 -0
- package/src/commands/restart.ts +9 -0
- package/src/commands/start.ts +9 -0
- package/src/commands/status.ts +9 -0
- package/src/commands/stop.ts +9 -0
- package/src/commands/update.ts +33 -7
- package/src/commands/web.ts +9 -0
- package/src/database/pool.ts +9 -0
- package/src/discovery/consul.ts +9 -0
- package/src/injectors/otel.ts +9 -0
- package/src/loadbalancer/manager.ts +9 -0
- package/src/macos/launchd.ts +9 -0
- package/src/monitoring/advanced.ts +9 -0
- package/src/platform/detect.ts +9 -0
- package/src/storage/metrics.ts +9 -0
- package/src/web/dashboard.ts +9 -0
- package/src/windows/service.ts +9 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# BS9 (Bun Sentinel 9) 🚀
|
|
2
2
|
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://github.com/xarhang/bs9)
|
|
5
5
|
[](SECURITY.md)
|
|
6
6
|
[](PRODUCTION.md)
|
|
7
7
|
[](https://github.com/bs9/bs9)
|
|
@@ -566,7 +566,19 @@ bs9 export --service myapp --hours 24
|
|
|
566
566
|
|
|
567
567
|
## 📄 License
|
|
568
568
|
|
|
569
|
-
MIT License - see LICENSE file for details.
|
|
569
|
+
**MIT License** - see [LICENSE](LICENSE) file for details.
|
|
570
|
+
|
|
571
|
+
BS9 is 100% open source and free for everyone - no restrictions, no enterprise features, no paid tiers. All features are available to everyone under the MIT license.
|
|
572
|
+
|
|
573
|
+
### 🤝 Support Open Source
|
|
574
|
+
If you find BS9 useful, please consider:
|
|
575
|
+
- ⭐ Starring this repository
|
|
576
|
+
- 🐛 Reporting issues and feature requests
|
|
577
|
+
- 💬 Contributing code or documentation
|
|
578
|
+
- 🎯 Sponsoring the project (GitHub Sponsors)
|
|
579
|
+
- 📢 Sharing with your community
|
|
580
|
+
|
|
581
|
+
**BS9 is community-driven and will always remain free and open source.**
|
|
570
582
|
|
|
571
583
|
---
|
|
572
584
|
|
package/bin/bs9
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { join, dirname } from "node:path";
|
|
6
|
+
|
|
7
|
+
// Read version from package.json
|
|
8
|
+
const packageJsonPath = join(dirname(import.meta.path), '..', 'package.json');
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
|
|
4
12
|
import { startCommand } from "../src/commands/start.js";
|
|
5
13
|
import { stopCommand } from "../src/commands/stop.js";
|
|
6
14
|
import { restartCommand } from "../src/commands/restart.js";
|
|
@@ -25,7 +33,7 @@ const program = new Command();
|
|
|
25
33
|
program
|
|
26
34
|
.name("bs9")
|
|
27
35
|
.description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
|
|
28
|
-
.version(
|
|
36
|
+
.version(version);
|
|
29
37
|
|
|
30
38
|
program
|
|
31
39
|
.command("start")
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { startCommand } from "../src/commands/start.js";
|
|
5
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
6
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
7
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
8
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
9
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
10
|
+
import { webCommand } from "../src/commands/web.js";
|
|
11
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
12
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
13
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
14
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
15
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
16
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
17
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
18
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
19
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
20
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
21
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
22
|
+
|
|
23
|
+
const program = new Command();
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.name("bs9")
|
|
27
|
+
.description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
|
|
28
|
+
.version("1.3.6");
|
|
29
|
+
|
|
30
|
+
program
|
|
31
|
+
.command("start")
|
|
32
|
+
.description("Start a process with hardened systemd unit")
|
|
33
|
+
.argument("<file>", "Application file to start")
|
|
34
|
+
.option("-n, --name <name>", "Service name")
|
|
35
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
36
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
37
|
+
.option("--https", "Use HTTPS protocol")
|
|
38
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
39
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
40
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
41
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
42
|
+
.action(startCommand);
|
|
43
|
+
|
|
44
|
+
program
|
|
45
|
+
.command("stop")
|
|
46
|
+
.description("Stop a managed service")
|
|
47
|
+
.argument("<name>", "Service name")
|
|
48
|
+
.action(stopCommand);
|
|
49
|
+
|
|
50
|
+
program
|
|
51
|
+
.command("restart")
|
|
52
|
+
.description("Restart a managed service")
|
|
53
|
+
.argument("<name>", "Service name")
|
|
54
|
+
.action(restartCommand);
|
|
55
|
+
|
|
56
|
+
program
|
|
57
|
+
.command("status")
|
|
58
|
+
.description("Show status and SRE metrics for all services")
|
|
59
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
60
|
+
.action(statusCommand);
|
|
61
|
+
|
|
62
|
+
program
|
|
63
|
+
.command("logs")
|
|
64
|
+
.description("Show logs for a service (via journalctl)")
|
|
65
|
+
.argument("<name>", "Service name")
|
|
66
|
+
.option("-f, --follow", "Follow logs")
|
|
67
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
68
|
+
.action(logsCommand);
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("monit")
|
|
72
|
+
.description("Real-time terminal dashboard for all services")
|
|
73
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
74
|
+
.action(monitCommand);
|
|
75
|
+
|
|
76
|
+
program
|
|
77
|
+
.command("web")
|
|
78
|
+
.description("Start web-based monitoring dashboard")
|
|
79
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
80
|
+
.option("-d, --detach", "Run in background")
|
|
81
|
+
.action(webCommand);
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command("alert")
|
|
85
|
+
.description("Configure alert thresholds and webhooks")
|
|
86
|
+
.option("--enable", "Enable alerts")
|
|
87
|
+
.option("--disable", "Disable alerts")
|
|
88
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
89
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
90
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
91
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
92
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
93
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
94
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
95
|
+
.option("--list", "List current alert configuration")
|
|
96
|
+
.option("--test", "Test webhook connectivity")
|
|
97
|
+
.action(alertCommand);
|
|
98
|
+
|
|
99
|
+
program
|
|
100
|
+
.command("export")
|
|
101
|
+
.description("Export historical metrics data")
|
|
102
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
103
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
104
|
+
.option("-o, --output <file>", "Output file path")
|
|
105
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
106
|
+
.action(exportCommand);
|
|
107
|
+
|
|
108
|
+
program
|
|
109
|
+
.command("deps")
|
|
110
|
+
.description("Visualize service dependencies")
|
|
111
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
112
|
+
.option("-o, --output <file>", "Output file path")
|
|
113
|
+
.action(depsCommand);
|
|
114
|
+
|
|
115
|
+
program
|
|
116
|
+
.command("profile")
|
|
117
|
+
.description("Performance profiling for services")
|
|
118
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
119
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
120
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
121
|
+
.option("-o, --output <file>", "Output file path")
|
|
122
|
+
.action(profileCommand);
|
|
123
|
+
|
|
124
|
+
program
|
|
125
|
+
.command("loadbalancer")
|
|
126
|
+
.description("Load balancer management")
|
|
127
|
+
.argument("<action>", "Action to perform")
|
|
128
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
129
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
130
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
131
|
+
.option("--health-check", "Enable health checking", true)
|
|
132
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
133
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
134
|
+
.action(loadbalancerCommand);
|
|
135
|
+
|
|
136
|
+
program
|
|
137
|
+
.command("dbpool")
|
|
138
|
+
.description("Database connection pool management")
|
|
139
|
+
.argument("<action>", "Action to perform")
|
|
140
|
+
.option("--host <host>", "Database host", "localhost")
|
|
141
|
+
.option("--port <port>", "Database port", "5432")
|
|
142
|
+
.option("--database <name>", "Database name", "testdb")
|
|
143
|
+
.option("--username <user>", "Database username", "user")
|
|
144
|
+
.option("--password <pass>", "Database password", "password")
|
|
145
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
146
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
147
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
148
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
149
|
+
.action(dbpoolCommand);
|
|
150
|
+
|
|
151
|
+
program
|
|
152
|
+
.command("update")
|
|
153
|
+
.description("Update BS9 to latest version")
|
|
154
|
+
.option("--check", "Check for updates without installing")
|
|
155
|
+
.option("--force", "Force update even if already latest")
|
|
156
|
+
.option("--rollback", "Rollback to previous version")
|
|
157
|
+
.option("--version <version>", "Update to specific version")
|
|
158
|
+
.action(updateCommand);
|
|
159
|
+
|
|
160
|
+
program
|
|
161
|
+
.command("advanced")
|
|
162
|
+
.description("Advanced monitoring dashboard")
|
|
163
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
164
|
+
.action(advancedMonitoringCommand);
|
|
165
|
+
|
|
166
|
+
program
|
|
167
|
+
.command("consul")
|
|
168
|
+
.description("Consul service discovery")
|
|
169
|
+
.argument("<action>", "Action to perform")
|
|
170
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
171
|
+
.option("--name <name>", "Service name")
|
|
172
|
+
.option("--id <id>", "Service ID")
|
|
173
|
+
.option("--address <address>", "Service address")
|
|
174
|
+
.option("--port <port>", "Service port")
|
|
175
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
176
|
+
.option("--health-check <url>", "Health check URL")
|
|
177
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
178
|
+
.option("--service <service>", "Service name for discovery")
|
|
179
|
+
.action(consulCommand);
|
|
180
|
+
|
|
181
|
+
program.parse();
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { startCommand } from "../src/commands/start.js";
|
|
5
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
6
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
7
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
8
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
9
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
10
|
+
import { webCommand } from "../src/commands/web.js";
|
|
11
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
12
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
13
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
14
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
15
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
16
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
17
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
18
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
19
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
20
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
21
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
22
|
+
|
|
23
|
+
const program = new Command();
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.name("bs9")
|
|
27
|
+
.description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
|
|
28
|
+
.version("1.3.5");
|
|
29
|
+
|
|
30
|
+
program
|
|
31
|
+
.command("start")
|
|
32
|
+
.description("Start a process with hardened systemd unit")
|
|
33
|
+
.argument("<file>", "Application file to start")
|
|
34
|
+
.option("-n, --name <name>", "Service name")
|
|
35
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
36
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
37
|
+
.option("--https", "Use HTTPS protocol")
|
|
38
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
39
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
40
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
41
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
42
|
+
.action(startCommand);
|
|
43
|
+
|
|
44
|
+
program
|
|
45
|
+
.command("stop")
|
|
46
|
+
.description("Stop a managed service")
|
|
47
|
+
.argument("<name>", "Service name")
|
|
48
|
+
.action(stopCommand);
|
|
49
|
+
|
|
50
|
+
program
|
|
51
|
+
.command("restart")
|
|
52
|
+
.description("Restart a managed service")
|
|
53
|
+
.argument("<name>", "Service name")
|
|
54
|
+
.action(restartCommand);
|
|
55
|
+
|
|
56
|
+
program
|
|
57
|
+
.command("status")
|
|
58
|
+
.description("Show status and SRE metrics for all services")
|
|
59
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
60
|
+
.action(statusCommand);
|
|
61
|
+
|
|
62
|
+
program
|
|
63
|
+
.command("logs")
|
|
64
|
+
.description("Show logs for a service (via journalctl)")
|
|
65
|
+
.argument("<name>", "Service name")
|
|
66
|
+
.option("-f, --follow", "Follow logs")
|
|
67
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
68
|
+
.action(logsCommand);
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("monit")
|
|
72
|
+
.description("Real-time terminal dashboard for all services")
|
|
73
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
74
|
+
.action(monitCommand);
|
|
75
|
+
|
|
76
|
+
program
|
|
77
|
+
.command("web")
|
|
78
|
+
.description("Start web-based monitoring dashboard")
|
|
79
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
80
|
+
.option("-d, --detach", "Run in background")
|
|
81
|
+
.action(webCommand);
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command("alert")
|
|
85
|
+
.description("Configure alert thresholds and webhooks")
|
|
86
|
+
.option("--enable", "Enable alerts")
|
|
87
|
+
.option("--disable", "Disable alerts")
|
|
88
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
89
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
90
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
91
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
92
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
93
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
94
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
95
|
+
.option("--list", "List current alert configuration")
|
|
96
|
+
.option("--test", "Test webhook connectivity")
|
|
97
|
+
.action(alertCommand);
|
|
98
|
+
|
|
99
|
+
program
|
|
100
|
+
.command("export")
|
|
101
|
+
.description("Export historical metrics data")
|
|
102
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
103
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
104
|
+
.option("-o, --output <file>", "Output file path")
|
|
105
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
106
|
+
.action(exportCommand);
|
|
107
|
+
|
|
108
|
+
program
|
|
109
|
+
.command("deps")
|
|
110
|
+
.description("Visualize service dependencies")
|
|
111
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
112
|
+
.option("-o, --output <file>", "Output file path")
|
|
113
|
+
.action(depsCommand);
|
|
114
|
+
|
|
115
|
+
program
|
|
116
|
+
.command("profile")
|
|
117
|
+
.description("Performance profiling for services")
|
|
118
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
119
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
120
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
121
|
+
.option("-o, --output <file>", "Output file path")
|
|
122
|
+
.action(profileCommand);
|
|
123
|
+
|
|
124
|
+
program
|
|
125
|
+
.command("loadbalancer")
|
|
126
|
+
.description("Load balancer management")
|
|
127
|
+
.argument("<action>", "Action to perform")
|
|
128
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
129
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
130
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
131
|
+
.option("--health-check", "Enable health checking", true)
|
|
132
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
133
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
134
|
+
.action(loadbalancerCommand);
|
|
135
|
+
|
|
136
|
+
program
|
|
137
|
+
.command("dbpool")
|
|
138
|
+
.description("Database connection pool management")
|
|
139
|
+
.argument("<action>", "Action to perform")
|
|
140
|
+
.option("--host <host>", "Database host", "localhost")
|
|
141
|
+
.option("--port <port>", "Database port", "5432")
|
|
142
|
+
.option("--database <name>", "Database name", "testdb")
|
|
143
|
+
.option("--username <user>", "Database username", "user")
|
|
144
|
+
.option("--password <pass>", "Database password", "password")
|
|
145
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
146
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
147
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
148
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
149
|
+
.action(dbpoolCommand);
|
|
150
|
+
|
|
151
|
+
program
|
|
152
|
+
.command("update")
|
|
153
|
+
.description("Update BS9 to latest version")
|
|
154
|
+
.option("--check", "Check for updates without installing")
|
|
155
|
+
.option("--force", "Force update even if already latest")
|
|
156
|
+
.option("--rollback", "Rollback to previous version")
|
|
157
|
+
.option("--version <version>", "Update to specific version")
|
|
158
|
+
.action(updateCommand);
|
|
159
|
+
|
|
160
|
+
program
|
|
161
|
+
.command("advanced")
|
|
162
|
+
.description("Advanced monitoring dashboard")
|
|
163
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
164
|
+
.action(advancedMonitoringCommand);
|
|
165
|
+
|
|
166
|
+
program
|
|
167
|
+
.command("consul")
|
|
168
|
+
.description("Consul service discovery")
|
|
169
|
+
.argument("<action>", "Action to perform")
|
|
170
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
171
|
+
.option("--name <name>", "Service name")
|
|
172
|
+
.option("--id <id>", "Service ID")
|
|
173
|
+
.option("--address <address>", "Service address")
|
|
174
|
+
.option("--port <port>", "Service port")
|
|
175
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
176
|
+
.option("--health-check <url>", "Health check URL")
|
|
177
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
178
|
+
.option("--service <service>", "Service name for discovery")
|
|
179
|
+
.action(consulCommand);
|
|
180
|
+
|
|
181
|
+
program.parse();
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { join, dirname } from "node:path";
|
|
6
|
+
|
|
7
|
+
// Read version from package.json
|
|
8
|
+
const packageJsonPath = join(dirname(import.meta.path), '..', 'package.json');
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
|
|
12
|
+
import { startCommand } from "../src/commands/start.js";
|
|
13
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
14
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
15
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
16
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
17
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
18
|
+
import { webCommand } from "../src/commands/web.js";
|
|
19
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
20
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
21
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
22
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
23
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
24
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
25
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
26
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
27
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
28
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
29
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
30
|
+
|
|
31
|
+
const program = new Command();
|
|
32
|
+
|
|
33
|
+
program
|
|
34
|
+
.name("bs9")
|
|
35
|
+
.description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
|
|
36
|
+
.version(version);
|
|
37
|
+
|
|
38
|
+
program
|
|
39
|
+
.command("start")
|
|
40
|
+
.description("Start a process with hardened systemd unit")
|
|
41
|
+
.argument("<file>", "Application file to start")
|
|
42
|
+
.option("-n, --name <name>", "Service name")
|
|
43
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
44
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
45
|
+
.option("--https", "Use HTTPS protocol")
|
|
46
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
47
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
48
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
49
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
50
|
+
.action(startCommand);
|
|
51
|
+
|
|
52
|
+
program
|
|
53
|
+
.command("stop")
|
|
54
|
+
.description("Stop a managed service")
|
|
55
|
+
.argument("<name>", "Service name")
|
|
56
|
+
.action(stopCommand);
|
|
57
|
+
|
|
58
|
+
program
|
|
59
|
+
.command("restart")
|
|
60
|
+
.description("Restart a managed service")
|
|
61
|
+
.argument("<name>", "Service name")
|
|
62
|
+
.action(restartCommand);
|
|
63
|
+
|
|
64
|
+
program
|
|
65
|
+
.command("status")
|
|
66
|
+
.description("Show status and SRE metrics for all services")
|
|
67
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
68
|
+
.action(statusCommand);
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("logs")
|
|
72
|
+
.description("Show logs for a service (via journalctl)")
|
|
73
|
+
.argument("<name>", "Service name")
|
|
74
|
+
.option("-f, --follow", "Follow logs")
|
|
75
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
76
|
+
.action(logsCommand);
|
|
77
|
+
|
|
78
|
+
program
|
|
79
|
+
.command("monit")
|
|
80
|
+
.description("Real-time terminal dashboard for all services")
|
|
81
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
82
|
+
.action(monitCommand);
|
|
83
|
+
|
|
84
|
+
program
|
|
85
|
+
.command("web")
|
|
86
|
+
.description("Start web-based monitoring dashboard")
|
|
87
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
88
|
+
.option("-d, --detach", "Run in background")
|
|
89
|
+
.action(webCommand);
|
|
90
|
+
|
|
91
|
+
program
|
|
92
|
+
.command("alert")
|
|
93
|
+
.description("Configure alert thresholds and webhooks")
|
|
94
|
+
.option("--enable", "Enable alerts")
|
|
95
|
+
.option("--disable", "Disable alerts")
|
|
96
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
97
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
98
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
99
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
100
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
101
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
102
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
103
|
+
.option("--list", "List current alert configuration")
|
|
104
|
+
.option("--test", "Test webhook connectivity")
|
|
105
|
+
.action(alertCommand);
|
|
106
|
+
|
|
107
|
+
program
|
|
108
|
+
.command("export")
|
|
109
|
+
.description("Export historical metrics data")
|
|
110
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
111
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
112
|
+
.option("-o, --output <file>", "Output file path")
|
|
113
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
114
|
+
.action(exportCommand);
|
|
115
|
+
|
|
116
|
+
program
|
|
117
|
+
.command("deps")
|
|
118
|
+
.description("Visualize service dependencies")
|
|
119
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
120
|
+
.option("-o, --output <file>", "Output file path")
|
|
121
|
+
.action(depsCommand);
|
|
122
|
+
|
|
123
|
+
program
|
|
124
|
+
.command("profile")
|
|
125
|
+
.description("Performance profiling for services")
|
|
126
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
127
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
128
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
129
|
+
.option("-o, --output <file>", "Output file path")
|
|
130
|
+
.action(profileCommand);
|
|
131
|
+
|
|
132
|
+
program
|
|
133
|
+
.command("loadbalancer")
|
|
134
|
+
.description("Load balancer management")
|
|
135
|
+
.argument("<action>", "Action to perform")
|
|
136
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
137
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
138
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
139
|
+
.option("--health-check", "Enable health checking", true)
|
|
140
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
141
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
142
|
+
.action(loadbalancerCommand);
|
|
143
|
+
|
|
144
|
+
program
|
|
145
|
+
.command("dbpool")
|
|
146
|
+
.description("Database connection pool management")
|
|
147
|
+
.argument("<action>", "Action to perform")
|
|
148
|
+
.option("--host <host>", "Database host", "localhost")
|
|
149
|
+
.option("--port <port>", "Database port", "5432")
|
|
150
|
+
.option("--database <name>", "Database name", "testdb")
|
|
151
|
+
.option("--username <user>", "Database username", "user")
|
|
152
|
+
.option("--password <pass>", "Database password", "password")
|
|
153
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
154
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
155
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
156
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
157
|
+
.action(dbpoolCommand);
|
|
158
|
+
|
|
159
|
+
program
|
|
160
|
+
.command("update")
|
|
161
|
+
.description("Update BS9 to latest version")
|
|
162
|
+
.option("--check", "Check for updates without installing")
|
|
163
|
+
.option("--force", "Force update even if already latest")
|
|
164
|
+
.option("--rollback", "Rollback to previous version")
|
|
165
|
+
.option("--version <version>", "Update to specific version")
|
|
166
|
+
.action(updateCommand);
|
|
167
|
+
|
|
168
|
+
program
|
|
169
|
+
.command("advanced")
|
|
170
|
+
.description("Advanced monitoring dashboard")
|
|
171
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
172
|
+
.action(advancedMonitoringCommand);
|
|
173
|
+
|
|
174
|
+
program
|
|
175
|
+
.command("consul")
|
|
176
|
+
.description("Consul service discovery")
|
|
177
|
+
.argument("<action>", "Action to perform")
|
|
178
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
179
|
+
.option("--name <name>", "Service name")
|
|
180
|
+
.option("--id <id>", "Service ID")
|
|
181
|
+
.option("--address <address>", "Service address")
|
|
182
|
+
.option("--port <port>", "Service port")
|
|
183
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
184
|
+
.option("--health-check <url>", "Health check URL")
|
|
185
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
186
|
+
.option("--service <service>", "Service name for discovery")
|
|
187
|
+
.action(consulCommand);
|
|
188
|
+
|
|
189
|
+
program.parse();
|
package/dist/bs9.js
CHANGED
package/package.json
CHANGED
package/src/alerting/config.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
4
13
|
import { join } from "node:path";
|
|
5
14
|
import { homedir } from "node:os";
|
package/src/commands/alert.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { AlertManager } from "../alerting/config.js";
|
|
4
13
|
|
|
5
14
|
interface AlertOptions {
|
package/src/commands/deps.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { setTimeout } from "node:timers/promises";
|
|
5
14
|
|
package/src/commands/export.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { MetricsStorage } from "../storage/metrics.js";
|
|
4
13
|
import { writeFileSync } from "node:fs";
|
|
5
14
|
|
package/src/commands/logs.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
|
|
5
14
|
interface LogsOptions {
|
package/src/commands/monit.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { setTimeout } from "node:timers/promises";
|
|
5
14
|
|
package/src/commands/profile.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { setTimeout } from "node:timers/promises";
|
|
5
14
|
|
package/src/commands/restart.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { getPlatformInfo } from "../platform/detect.js";
|
|
5
14
|
|
package/src/commands/start.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
4
13
|
import { join, basename, resolve, dirname } from "node:path";
|
|
5
14
|
import { execSync } from "node:child_process";
|
package/src/commands/status.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { getPlatformInfo } from "../platform/detect.js";
|
|
5
14
|
import { readFileSync } from "node:fs";
|
package/src/commands/stop.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { join } from "node:path";
|
|
5
14
|
import { getPlatformInfo } from "../platform/detect.js";
|
package/src/commands/update.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { existsSync, writeFileSync, mkdirSync } from "node:fs";
|
|
5
14
|
import { join, dirname } from "node:path";
|
|
@@ -51,13 +60,22 @@ class BS9Updater {
|
|
|
51
60
|
|
|
52
61
|
private getCurrentVersion(): string {
|
|
53
62
|
try {
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
const content = fs.readFileSync(
|
|
57
|
-
const
|
|
63
|
+
// Get version from the CLI binary directly
|
|
64
|
+
const binaryPath = join(homedir(), '.bun', 'bin', 'bs9');
|
|
65
|
+
const content = fs.readFileSync(binaryPath, 'utf8');
|
|
66
|
+
const versionMatch = content.match(/version\("([^"]+)"\)/);
|
|
67
|
+
|
|
68
|
+
if (versionMatch && versionMatch[1]) {
|
|
69
|
+
return versionMatch[1];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Fallback to package.json in global installation
|
|
73
|
+
const packageJson = join(homedir(), '.bun', 'install', 'global', 'node_modules', 'bs9', 'package.json');
|
|
74
|
+
const pkgContent = fs.readFileSync(packageJson, 'utf8');
|
|
75
|
+
const pkg = JSON.parse(pkgContent);
|
|
58
76
|
return pkg.version;
|
|
59
77
|
} catch {
|
|
60
|
-
return '1.3.
|
|
78
|
+
return '1.3.4'; // Fallback version
|
|
61
79
|
}
|
|
62
80
|
}
|
|
63
81
|
|
|
@@ -68,7 +86,7 @@ class BS9Updater {
|
|
|
68
86
|
return data.version;
|
|
69
87
|
} catch (error) {
|
|
70
88
|
console.warn('⚠️ Failed to fetch latest version from npm, using fallback');
|
|
71
|
-
return '1.3.
|
|
89
|
+
return '1.3.4'; // Return current version as fallback
|
|
72
90
|
}
|
|
73
91
|
}
|
|
74
92
|
|
|
@@ -151,7 +169,7 @@ class BS9Updater {
|
|
|
151
169
|
return;
|
|
152
170
|
}
|
|
153
171
|
|
|
154
|
-
console.log(
|
|
172
|
+
console.log(`📦 Updating from ${currentVersion} to ${latestVersion}`);
|
|
155
173
|
|
|
156
174
|
// Use npm to update globally
|
|
157
175
|
console.log('📦 Installing latest version...');
|
|
@@ -159,6 +177,14 @@ class BS9Updater {
|
|
|
159
177
|
execSync(`bun install -g bs9@${latestVersion}`, { stdio: 'inherit' });
|
|
160
178
|
console.log('✅ BS9 updated successfully!');
|
|
161
179
|
console.log(` Version: ${latestVersion}`);
|
|
180
|
+
|
|
181
|
+
// Verify the update
|
|
182
|
+
const updatedVersion = this.getCurrentVersion();
|
|
183
|
+
if (updatedVersion === latestVersion) {
|
|
184
|
+
console.log('✅ Update verified successfully!');
|
|
185
|
+
} else {
|
|
186
|
+
console.log('⚠️ Update may require manual verification');
|
|
187
|
+
}
|
|
162
188
|
} catch (error) {
|
|
163
189
|
console.error('❌ Failed to update BS9:', error);
|
|
164
190
|
console.log('💡 Try: bun install -g bs9@latest');
|
package/src/commands/web.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { spawn } from "node:child_process";
|
|
5
14
|
import { randomBytes } from "node:crypto";
|
package/src/database/pool.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
// Security: Input validation functions
|
|
4
13
|
function isValidHost(host: string): boolean {
|
|
5
14
|
const hostnameRegex = /^[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*$/;
|
package/src/discovery/consul.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
|
|
5
14
|
interface ConsulService {
|
package/src/injectors/otel.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { writeFileSync, readFileSync, existsSync } from "node:fs";
|
|
4
13
|
import { join, dirname } from "node:path";
|
|
5
14
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { serve } from "bun";
|
|
4
13
|
import { setTimeout } from "node:timers/promises";
|
|
5
14
|
|
package/src/macos/launchd.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { existsSync, writeFileSync, mkdirSync } from "node:fs";
|
|
5
14
|
import { join, dirname } from "node:path";
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { serve } from "bun";
|
|
4
13
|
import { randomBytes } from "node:crypto";
|
|
5
14
|
|
package/src/platform/detect.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { platform } from "node:os";
|
|
4
13
|
|
|
5
14
|
export type Platform = 'linux' | 'darwin' | 'win32';
|
package/src/storage/metrics.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { writeFileSync, readFileSync, existsSync, mkdirSync } from "node:fs";
|
|
4
13
|
import { join } from "node:path";
|
|
5
14
|
import { homedir } from "node:os";
|
package/src/web/dashboard.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { serve } from "bun";
|
|
4
13
|
import { execSync } from "node:child_process";
|
|
5
14
|
import { join } from "node:path";
|
package/src/windows/service.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* BS9 - Bun Sentinel 9
|
|
5
|
+
* High-performance, non-root process manager for Bun
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2026 BS9 (Bun Sentinel 9)
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
* https://github.com/xarhang/bs9
|
|
10
|
+
*/
|
|
11
|
+
|
|
3
12
|
import { execSync } from "node:child_process";
|
|
4
13
|
import { existsSync, writeFileSync, mkdirSync } from "node:fs";
|
|
5
14
|
import { join, dirname } from "node:path";
|