bs9 1.4.3 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # BS9 (Bun Sentinel 9) 🚀
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
- [![Version](https://img.shields.io/badge/version-1.4.3-blue.svg)](https://github.com/xarhang/bs9)
4
+ [![Version](https://img.shields.io/badge/version-1.4.5-blue.svg)](https://github.com/xarhang/bs9)
5
5
  [![Security](https://img.shields.io/badge/security-Enterprise-green.svg)](SECURITY.md)
6
6
  [![Production Ready](https://img.shields.io/badge/production-Ready-brightgreen.svg)](PRODUCTION.md)
7
7
  [![Cross-Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg)](https://github.com/bs9/bs9)
@@ -40,20 +40,20 @@ chmod +x ~/.local/bin/bs9
40
40
  #### 🍎 macOS
41
41
  - **Service Manager**: Launchd
42
42
  - **Features**: Native macOS integration, automatic recovery
43
- - **Commands**: All commands + `bs9 macos` for launchd management
43
+ - **Commands**: All commands work automatically on macOS
44
44
 
45
45
  #### 🪟 Windows
46
46
  - **Service Manager**: Windows Services
47
47
  - **Features**: PowerShell automation, event log integration
48
- - **Commands**: All commands + `bs9 windows` for service management
48
+ - **Commands**: All commands work automatically on Windows
49
49
 
50
50
  ```bash
51
- # Check your platform
52
- bs9 platform
51
+ # Check your platform (auto-detected)
52
+ bs9 --help # Shows platform info in help
53
53
 
54
- # Platform-specific service management
55
- bs9 macos create --name my-app --file app.js # macOS
56
- bs9 windows create --name my-app --file app.js # Windows
54
+ # Platform-specific service management (auto-detected)
55
+ bs9 start app.js # Works on Linux, macOS, Windows
56
+ bs9 deploy app.js # Works on all platforms
57
57
  ```
58
58
 
59
59
  ### 🚀 Killer Feature: Zero-Config Deployment
@@ -599,11 +599,23 @@ BS9/
599
599
 
600
600
  ## 🚀 Production Deployment
601
601
 
602
- ### System Requirements
603
- - **OS**: Linux (systemd user mode)
604
- - **Runtime**: Bun 1.3.6+
605
- - **Memory**: 512MB minimum per service
606
- - **Disk**: 1GB for metrics storage
602
+ ### System Requirements & Health Check
603
+ ```bash
604
+ # Check BS9 installation and system compatibility
605
+ bs9 doctor # Basic health check
606
+ bs9 doctor --verbose # Detailed system information
607
+ bs9 doctor --check platform # Check platform-specific setup
608
+ bs9 -V # Show BS9 version
609
+
610
+ # System inspection
611
+ bs9 inspect # Basic inspection
612
+ bs9 inspect --full # Complete system inspection
613
+ bs9 inspect --security # Security inspection only
614
+ bs9 inspect --performance # Performance inspection only
615
+ bs9 inspect --configuration # Configuration inspection only
616
+ bs9 inspect --compliance # Compliance inspection only
617
+ bs9 inspect --report json # Export inspection report
618
+ ```
607
619
 
608
620
  ### Installation
609
621
  #### One-Click Install (Recommended)
package/bin/bs9 CHANGED
@@ -31,6 +31,8 @@ import { updateCommand } from "../src/commands/update.js";
31
31
  import { dbpoolCommand } from "../src/database/pool.js";
32
32
  import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
33
33
  import { consulCommand } from "../src/discovery/consul.js";
34
+ import { doctorCommand } from "../src/commands/doctor.js";
35
+ import { inspectCommand } from "../src/commands/inspect.js";
34
36
 
35
37
  const program = new Command();
36
38
 
@@ -244,4 +246,24 @@ program
244
246
  .option("--service <service>", "Service name for discovery")
245
247
  .action(consulCommand);
246
248
 
249
+ program
250
+ .command("doctor")
251
+ .description("Perform comprehensive health check")
252
+ .option("--check <type>", "Specific check to run (dependencies|configuration|platform)")
253
+ .option("-v, --verbose", "Verbose output with system information")
254
+ .action(doctorCommand);
255
+
256
+ program
257
+ .command("inspect")
258
+ .description("Comprehensive system inspection and analysis")
259
+ .option("--security", "Security inspection only")
260
+ .option("--performance", "Performance inspection only")
261
+ .option("--configuration", "Configuration inspection only")
262
+ .option("--compliance", "Compliance inspection only")
263
+ .option("--full", "Complete system inspection")
264
+ .option("--report <format>", "Export report (json|csv)")
265
+ .option("--deep", "Deep system analysis")
266
+ .option("-v, --verbose", "Verbose output with detailed analysis")
267
+ .action(inspectCommand);
268
+
247
269
  program.parse();
@@ -0,0 +1,269 @@
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 { deleteCommand } from "../src/commands/delete.js";
24
+ import { saveCommand } from "../src/commands/save.js";
25
+ import { resurrectCommand } from "../src/commands/resurrect.js";
26
+ import { deployCommand } from "../src/commands/deploy.js";
27
+ import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
28
+ import { windowsCommand } from "../src/windows/service.js";
29
+ import { launchdCommand } from "../src/macos/launchd.js";
30
+ import { updateCommand } from "../src/commands/update.js";
31
+ import { dbpoolCommand } from "../src/database/pool.js";
32
+ import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
33
+ import { consulCommand } from "../src/discovery/consul.js";
34
+ import { doctorCommand } from "../src/commands/doctor.js";
35
+ import { inspectCommand } from "../src/commands/inspect.js";
36
+
37
+ const program = new Command();
38
+
39
+ program
40
+ .name("bs9")
41
+ .description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
42
+ .version(version);
43
+
44
+ program
45
+ .command("start")
46
+ .description("Start a process with hardened systemd unit")
47
+ .argument("<file>", "Application file to start")
48
+ .option("-n, --name <name>", "Service name")
49
+ .option("-p, --port <port>", "Port number", "3000")
50
+ .option("-h, --host <host>", "Host address", "localhost")
51
+ .option("--https", "Use HTTPS protocol")
52
+ .option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
53
+ .option("--otel", "Enable OpenTelemetry instrumentation", true)
54
+ .option("--prometheus", "Enable Prometheus metrics", true)
55
+ .option("--build", "Build TypeScript to JavaScript before starting")
56
+ .action(startCommand);
57
+
58
+ program
59
+ .command("stop")
60
+ .description("Stop a managed service")
61
+ .argument("<name>", "Service name")
62
+ .action(stopCommand);
63
+
64
+ program
65
+ .command("restart")
66
+ .description("Restart a managed service")
67
+ .argument("<name>", "Service name")
68
+ .action(restartCommand);
69
+
70
+ program
71
+ .command("status")
72
+ .description("Show status and SRE metrics for all services")
73
+ .option("-w, --watch", "Watch mode (refresh every 2s)")
74
+ .action(statusCommand);
75
+
76
+ program
77
+ .command("logs")
78
+ .description("Show logs for a service (via journalctl)")
79
+ .argument("<name>", "Service name")
80
+ .option("-f, --follow", "Follow logs")
81
+ .option("-n, --lines <number>", "Number of lines", "50")
82
+ .action(logsCommand);
83
+
84
+ program
85
+ .command("monit")
86
+ .description("Real-time terminal dashboard for all services")
87
+ .option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
88
+ .action(monitCommand);
89
+
90
+ program
91
+ .command("web")
92
+ .description("Start web-based monitoring dashboard")
93
+ .option("-p, --port <port>", "Port for web dashboard", "8080")
94
+ .option("-d, --detach", "Run in background")
95
+ .action(webCommand);
96
+
97
+ program
98
+ .command("alert")
99
+ .description("Configure alert thresholds and webhooks")
100
+ .option("--enable", "Enable alerts")
101
+ .option("--disable", "Disable alerts")
102
+ .option("--webhook <url>", "Set webhook URL for alerts")
103
+ .option("--cpu <percentage>", "CPU threshold percentage")
104
+ .option("--memory <percentage>", "Memory threshold percentage")
105
+ .option("--errorRate <percentage>", "Error rate threshold percentage")
106
+ .option("--uptime <percentage>", "Uptime threshold percentage")
107
+ .option("--cooldown <seconds>", "Alert cooldown period in seconds")
108
+ .option("--service <name>", "Configure alerts for specific service")
109
+ .option("--list", "List current alert configuration")
110
+ .option("--test", "Test webhook connectivity")
111
+ .action(alertCommand);
112
+
113
+ program
114
+ .command("export")
115
+ .description("Export historical metrics data")
116
+ .option("-f, --format <format>", "Export format (json|csv)", "json")
117
+ .option("-h, --hours <hours>", "Hours of data to export", "24")
118
+ .option("-o, --output <file>", "Output file path")
119
+ .option("-s, --service <name>", "Export specific service metrics")
120
+ .action(exportCommand);
121
+
122
+ program
123
+ .command("deps")
124
+ .description("Visualize service dependencies")
125
+ .option("-f, --format <format>", "Output format (text|dot|json)", "text")
126
+ .option("-o, --output <file>", "Output file path")
127
+ .action(depsCommand);
128
+
129
+ program
130
+ .command("profile")
131
+ .description("Performance profiling for services")
132
+ .option("-d, --duration <seconds>", "Profiling duration", "60")
133
+ .option("-i, --interval <ms>", "Sampling interval", "1000")
134
+ .option("-s, --service <name>", "Service name to profile")
135
+ .option("--flamegraph", "Generate flame graph")
136
+ .option("--top <number>", "Show top N functions", "10")
137
+ .action(profileCommand);
138
+
139
+ program
140
+ .command("delete")
141
+ .description("Delete managed services")
142
+ .argument("[name]", "Service name (optional)")
143
+ .option("-a, --all", "Delete all services")
144
+ .option("-f, --force", "Force deletion without errors")
145
+ .option("-r, --remove", "Remove service configuration files")
146
+ .option("-t, --timeout <seconds>", "Timeout for graceful shutdown (default: 30)")
147
+ .action(deleteCommand);
148
+
149
+ program
150
+ .command("save")
151
+ .description("Save service configurations to backup")
152
+ .argument("[name]", "Service name (optional)")
153
+ .option("-a, --all", "Save all services")
154
+ .option("-f, --force", "Force save without errors")
155
+ .option("-b, --backup", "Create timestamped backup")
156
+ .action(saveCommand);
157
+
158
+ program
159
+ .command("resurrect")
160
+ .description("Resurrect services from backup")
161
+ .argument("[name]", "Service name (optional)")
162
+ .option("-a, --all", "Resurrect all services")
163
+ .option("-f, --force", "Force resurrection without errors")
164
+ .option("-c, --config <file>", "Configuration file to use")
165
+ .action(resurrectCommand);
166
+
167
+ program
168
+ .command("deploy")
169
+ .description("🚀 Deploy applications with zero-config production setup")
170
+ .argument("<file>", "Application file to deploy")
171
+ .option("-n, --name <name>", "Service name")
172
+ .option("-p, --port <port>", "Port number", "3000")
173
+ .option("-h, --host <host>", "Host address", "localhost")
174
+ .option("-e, --env <env>", "Environment variables (multiple)", (value, previous) => [...(previous || []), value])
175
+ .option("-i, --instances <number>", "Number of instances")
176
+ .option("--memory <memory>", "Memory limit")
177
+ .option("--cpu <cpu>", "CPU limit")
178
+ .option("--log-level <level>", "Log level")
179
+ .option("--log-file <file>", "Log file path")
180
+ .option("--restart <policy>", "Restart policy")
181
+ .option("--no-health", "Skip health check")
182
+ .option("--no-metrics", "Disable metrics")
183
+ .option("--no-otel", "Disable OpenTelemetry")
184
+ .option("--no-prometheus", "Disable Prometheus")
185
+ .option("--https", "Enable HTTPS")
186
+ .option("--no-linger", "Don't enable linger")
187
+ .option("-f, --force", "Force deployment")
188
+ .option("--reload", "Reload existing service")
189
+ .option("--build", "Build TypeScript")
190
+ .action(deployCommand);
191
+
192
+ program
193
+ .command("loadbalancer")
194
+ .description("Load balancer management")
195
+ .argument("<action>", "Action to perform")
196
+ .option("-p, --port <port>", "Load balancer port", "8080")
197
+ .option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
198
+ .option("-b, --backends <list>", "Backend servers (host:port,host:port)")
199
+ .option("--health-check", "Enable health checking", true)
200
+ .option("--health-path <path>", "Health check path", "/healthz")
201
+ .option("--health-interval <ms>", "Health check interval", "10000")
202
+ .action(loadbalancerCommand);
203
+
204
+ program
205
+ .command("dbpool")
206
+ .description("Database connection pool management")
207
+ .argument("<action>", "Action to perform")
208
+ .option("--host <host>", "Database host", "localhost")
209
+ .option("--port <port>", "Database port", "5432")
210
+ .option("--database <name>", "Database name", "testdb")
211
+ .option("--username <user>", "Database username", "user")
212
+ .option("--password <pass>", "Database password", "password")
213
+ .option("--max-connections <num>", "Maximum connections", "10")
214
+ .option("--min-connections <num>", "Minimum connections", "2")
215
+ .option("--concurrency <num>", "Test concurrency", "10")
216
+ .option("--iterations <num>", "Test iterations", "100")
217
+ .action(dbpoolCommand);
218
+
219
+ program
220
+ .command("update")
221
+ .description("Update BS9 to latest version")
222
+ .option("--check", "Check for updates without installing")
223
+ .option("--force", "Force update even if already latest")
224
+ .option("--rollback", "Rollback to previous version")
225
+ .option("--version <version>", "Update to specific version")
226
+ .action(updateCommand);
227
+
228
+ program
229
+ .command("advanced")
230
+ .description("Advanced monitoring dashboard")
231
+ .option("--port <port>", "Dashboard port", "8090")
232
+ .action(advancedMonitoringCommand);
233
+
234
+ program
235
+ .command("consul")
236
+ .description("Consul service discovery")
237
+ .argument("<action>", "Action to perform")
238
+ .option("--consul-url <url>", "Consul URL", "http://localhost:8500")
239
+ .option("--name <name>", "Service name")
240
+ .option("--id <id>", "Service ID")
241
+ .option("--address <address>", "Service address")
242
+ .option("--port <port>", "Service port")
243
+ .option("--tags <tags>", "Service tags (comma-separated)")
244
+ .option("--health-check <url>", "Health check URL")
245
+ .option("--meta <json>", "Service metadata (JSON)")
246
+ .option("--service <service>", "Service name for discovery")
247
+ .action(consulCommand);
248
+
249
+ program
250
+ .command("doctor")
251
+ .description("Perform comprehensive health check")
252
+ .option("--check <type>", "Specific check to run (dependencies|configuration|platform)")
253
+ .option("-v, --verbose", "Verbose output with system information")
254
+ .action(doctorCommand);
255
+
256
+ program
257
+ .command("inspect")
258
+ .description("Comprehensive system inspection and analysis")
259
+ .option("--security", "Security inspection only")
260
+ .option("--performance", "Performance inspection only")
261
+ .option("--configuration", "Configuration inspection only")
262
+ .option("--compliance", "Compliance inspection only")
263
+ .option("--full", "Complete system inspection")
264
+ .option("--report <format>", "Export report (json|csv)")
265
+ .option("--deep", "Deep system analysis")
266
+ .option("-v, --verbose", "Verbose output with detailed analysis")
267
+ .action(inspectCommand);
268
+
269
+ program.parse();
@@ -0,0 +1,269 @@
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 { deleteCommand } from "../src/commands/delete.js";
24
+ import { saveCommand } from "../src/commands/save.js";
25
+ import { resurrectCommand } from "../src/commands/resurrect.js";
26
+ import { deployCommand } from "../src/commands/deploy.js";
27
+ import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
28
+ import { windowsCommand } from "../src/windows/service.js";
29
+ import { launchdCommand } from "../src/macos/launchd.js";
30
+ import { updateCommand } from "../src/commands/update.js";
31
+ import { dbpoolCommand } from "../src/database/pool.js";
32
+ import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
33
+ import { consulCommand } from "../src/discovery/consul.js";
34
+ import { doctorCommand } from "../src/commands/doctor.js";
35
+ import { inspectCommand } from "../src/commands/inspect.js";
36
+
37
+ const program = new Command();
38
+
39
+ program
40
+ .name("bs9")
41
+ .description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
42
+ .version(version);
43
+
44
+ program
45
+ .command("start")
46
+ .description("Start a process with hardened systemd unit")
47
+ .argument("<file>", "Application file to start")
48
+ .option("-n, --name <name>", "Service name")
49
+ .option("-p, --port <port>", "Port number", "3000")
50
+ .option("-h, --host <host>", "Host address", "localhost")
51
+ .option("--https", "Use HTTPS protocol")
52
+ .option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
53
+ .option("--otel", "Enable OpenTelemetry instrumentation", true)
54
+ .option("--prometheus", "Enable Prometheus metrics", true)
55
+ .option("--build", "Build TypeScript to JavaScript before starting")
56
+ .action(startCommand);
57
+
58
+ program
59
+ .command("stop")
60
+ .description("Stop a managed service")
61
+ .argument("<name>", "Service name")
62
+ .action(stopCommand);
63
+
64
+ program
65
+ .command("restart")
66
+ .description("Restart a managed service")
67
+ .argument("<name>", "Service name")
68
+ .action(restartCommand);
69
+
70
+ program
71
+ .command("status")
72
+ .description("Show status and SRE metrics for all services")
73
+ .option("-w, --watch", "Watch mode (refresh every 2s)")
74
+ .action(statusCommand);
75
+
76
+ program
77
+ .command("logs")
78
+ .description("Show logs for a service (via journalctl)")
79
+ .argument("<name>", "Service name")
80
+ .option("-f, --follow", "Follow logs")
81
+ .option("-n, --lines <number>", "Number of lines", "50")
82
+ .action(logsCommand);
83
+
84
+ program
85
+ .command("monit")
86
+ .description("Real-time terminal dashboard for all services")
87
+ .option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
88
+ .action(monitCommand);
89
+
90
+ program
91
+ .command("web")
92
+ .description("Start web-based monitoring dashboard")
93
+ .option("-p, --port <port>", "Port for web dashboard", "8080")
94
+ .option("-d, --detach", "Run in background")
95
+ .action(webCommand);
96
+
97
+ program
98
+ .command("alert")
99
+ .description("Configure alert thresholds and webhooks")
100
+ .option("--enable", "Enable alerts")
101
+ .option("--disable", "Disable alerts")
102
+ .option("--webhook <url>", "Set webhook URL for alerts")
103
+ .option("--cpu <percentage>", "CPU threshold percentage")
104
+ .option("--memory <percentage>", "Memory threshold percentage")
105
+ .option("--errorRate <percentage>", "Error rate threshold percentage")
106
+ .option("--uptime <percentage>", "Uptime threshold percentage")
107
+ .option("--cooldown <seconds>", "Alert cooldown period in seconds")
108
+ .option("--service <name>", "Configure alerts for specific service")
109
+ .option("--list", "List current alert configuration")
110
+ .option("--test", "Test webhook connectivity")
111
+ .action(alertCommand);
112
+
113
+ program
114
+ .command("export")
115
+ .description("Export historical metrics data")
116
+ .option("-f, --format <format>", "Export format (json|csv)", "json")
117
+ .option("-h, --hours <hours>", "Hours of data to export", "24")
118
+ .option("-o, --output <file>", "Output file path")
119
+ .option("-s, --service <name>", "Export specific service metrics")
120
+ .action(exportCommand);
121
+
122
+ program
123
+ .command("deps")
124
+ .description("Visualize service dependencies")
125
+ .option("-f, --format <format>", "Output format (text|dot|json)", "text")
126
+ .option("-o, --output <file>", "Output file path")
127
+ .action(depsCommand);
128
+
129
+ program
130
+ .command("profile")
131
+ .description("Performance profiling for services")
132
+ .option("-d, --duration <seconds>", "Profiling duration", "60")
133
+ .option("-i, --interval <ms>", "Sampling interval", "1000")
134
+ .option("-s, --service <name>", "Service name to profile")
135
+ .option("--flamegraph", "Generate flame graph")
136
+ .option("--top <number>", "Show top N functions", "10")
137
+ .action(profileCommand);
138
+
139
+ program
140
+ .command("delete")
141
+ .description("Delete managed services")
142
+ .argument("[name]", "Service name (optional)")
143
+ .option("-a, --all", "Delete all services")
144
+ .option("-f, --force", "Force deletion without errors")
145
+ .option("-r, --remove", "Remove service configuration files")
146
+ .option("-t, --timeout <seconds>", "Timeout for graceful shutdown (default: 30)")
147
+ .action(deleteCommand);
148
+
149
+ program
150
+ .command("save")
151
+ .description("Save service configurations to backup")
152
+ .argument("[name]", "Service name (optional)")
153
+ .option("-a, --all", "Save all services")
154
+ .option("-f, --force", "Force save without errors")
155
+ .option("-b, --backup", "Create timestamped backup")
156
+ .action(saveCommand);
157
+
158
+ program
159
+ .command("resurrect")
160
+ .description("Resurrect services from backup")
161
+ .argument("[name]", "Service name (optional)")
162
+ .option("-a, --all", "Resurrect all services")
163
+ .option("-f, --force", "Force resurrection without errors")
164
+ .option("-c, --config <file>", "Configuration file to use")
165
+ .action(resurrectCommand);
166
+
167
+ program
168
+ .command("deploy")
169
+ .description("🚀 Deploy applications with zero-config production setup")
170
+ .argument("<file>", "Application file to deploy")
171
+ .option("-n, --name <name>", "Service name")
172
+ .option("-p, --port <port>", "Port number", "3000")
173
+ .option("-h, --host <host>", "Host address", "localhost")
174
+ .option("-e, --env <env>", "Environment variables (multiple)", (value, previous) => [...(previous || []), value])
175
+ .option("-i, --instances <number>", "Number of instances")
176
+ .option("--memory <memory>", "Memory limit")
177
+ .option("--cpu <cpu>", "CPU limit")
178
+ .option("--log-level <level>", "Log level")
179
+ .option("--log-file <file>", "Log file path")
180
+ .option("--restart <policy>", "Restart policy")
181
+ .option("--no-health", "Skip health check")
182
+ .option("--no-metrics", "Disable metrics")
183
+ .option("--no-otel", "Disable OpenTelemetry")
184
+ .option("--no-prometheus", "Disable Prometheus")
185
+ .option("--https", "Enable HTTPS")
186
+ .option("--no-linger", "Don't enable linger")
187
+ .option("-f, --force", "Force deployment")
188
+ .option("--reload", "Reload existing service")
189
+ .option("--build", "Build TypeScript")
190
+ .action(deployCommand);
191
+
192
+ program
193
+ .command("loadbalancer")
194
+ .description("Load balancer management")
195
+ .argument("<action>", "Action to perform")
196
+ .option("-p, --port <port>", "Load balancer port", "8080")
197
+ .option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
198
+ .option("-b, --backends <list>", "Backend servers (host:port,host:port)")
199
+ .option("--health-check", "Enable health checking", true)
200
+ .option("--health-path <path>", "Health check path", "/healthz")
201
+ .option("--health-interval <ms>", "Health check interval", "10000")
202
+ .action(loadbalancerCommand);
203
+
204
+ program
205
+ .command("dbpool")
206
+ .description("Database connection pool management")
207
+ .argument("<action>", "Action to perform")
208
+ .option("--host <host>", "Database host", "localhost")
209
+ .option("--port <port>", "Database port", "5432")
210
+ .option("--database <name>", "Database name", "testdb")
211
+ .option("--username <user>", "Database username", "user")
212
+ .option("--password <pass>", "Database password", "password")
213
+ .option("--max-connections <num>", "Maximum connections", "10")
214
+ .option("--min-connections <num>", "Minimum connections", "2")
215
+ .option("--concurrency <num>", "Test concurrency", "10")
216
+ .option("--iterations <num>", "Test iterations", "100")
217
+ .action(dbpoolCommand);
218
+
219
+ program
220
+ .command("update")
221
+ .description("Update BS9 to latest version")
222
+ .option("--check", "Check for updates without installing")
223
+ .option("--force", "Force update even if already latest")
224
+ .option("--rollback", "Rollback to previous version")
225
+ .option("--version <version>", "Update to specific version")
226
+ .action(updateCommand);
227
+
228
+ program
229
+ .command("advanced")
230
+ .description("Advanced monitoring dashboard")
231
+ .option("--port <port>", "Dashboard port", "8090")
232
+ .action(advancedMonitoringCommand);
233
+
234
+ program
235
+ .command("consul")
236
+ .description("Consul service discovery")
237
+ .argument("<action>", "Action to perform")
238
+ .option("--consul-url <url>", "Consul URL", "http://localhost:8500")
239
+ .option("--name <name>", "Service name")
240
+ .option("--id <id>", "Service ID")
241
+ .option("--address <address>", "Service address")
242
+ .option("--port <port>", "Service port")
243
+ .option("--tags <tags>", "Service tags (comma-separated)")
244
+ .option("--health-check <url>", "Health check URL")
245
+ .option("--meta <json>", "Service metadata (JSON)")
246
+ .option("--service <service>", "Service name for discovery")
247
+ .action(consulCommand);
248
+
249
+ program
250
+ .command("doctor")
251
+ .description("Perform comprehensive health check")
252
+ .option("--check <type>", "Specific check to run (dependencies|configuration|platform)")
253
+ .option("-v, --verbose", "Verbose output with system information")
254
+ .action(doctorCommand);
255
+
256
+ program
257
+ .command("inspect")
258
+ .description("Comprehensive system inspection and analysis")
259
+ .option("--security", "Security inspection only")
260
+ .option("--performance", "Performance inspection only")
261
+ .option("--configuration", "Configuration inspection only")
262
+ .option("--compliance", "Compliance inspection only")
263
+ .option("--full", "Complete enterprise inspection")
264
+ .option("--report <format>", "Export report (json|csv)")
265
+ .option("--deep", "Deep system analysis")
266
+ .option("-v, --verbose", "Verbose output with detailed analysis")
267
+ .action(inspectCommand);
268
+
269
+ program.parse();