bs9 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BS9 (Bun Sentinel 9)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,532 @@
1
+ # BS9 (Bun Sentinel 9)
2
+
3
+ > Mission-critical process manager CLI with real-time monitoring dashboard, historical metrics storage, alert system, container support, and enterprise-grade security.
4
+
5
+ ---
6
+
7
+ ## 🚀 Quick Start
8
+
9
+ ```bash
10
+ # One-click installer (installs Bun + BS9)
11
+ curl -fsSL https://raw.githubusercontent.com/xarhang/bs9/main/setup.sh | bash
12
+
13
+ # Or manual install
14
+ git clone https://github.com/xarhang/bs9.git
15
+ cd bs9
16
+ bun install
17
+ cp bin/bs9 ~/.local/bin/bs9
18
+ chmod +x ~/.local/bin/bs9
19
+ ```
20
+
21
+ ---
22
+
23
+ ## 📋 Complete CLI Commands
24
+
25
+ ### Service Management
26
+ ```bash
27
+ # Start service with TypeScript JIT/AOT support
28
+ bs9 start app.js # JavaScript app
29
+ bs9 start app.ts --build # TypeScript AOT compilation
30
+ bs9 start app.ts --name myapp --port 8080 --env NODE_ENV=production
31
+
32
+ # Service lifecycle
33
+ bs9 stop myapp
34
+ bs9 restart myapp
35
+ bs9 status # SRE metrics dashboard
36
+ bs9 logs myapp --follow
37
+ ```
38
+
39
+ ### Monitoring & Observability
40
+ ```bash
41
+ # Real-time terminal dashboard
42
+ bs9 monit # 2s refresh default
43
+ bs9 monit --refresh 5 # Custom refresh interval
44
+
45
+ # Web-based dashboard
46
+ bs9 web --port 8080 # Start web dashboard
47
+ bs9 web --detach --port 8080 # Run in background
48
+
49
+ # Alert management
50
+ bs9 alert --list # Show alert configuration
51
+ bs9 alert --cpu 80 --memory 85 # Set thresholds
52
+ bs9 alert --webhook https://hooks.slack.com/...
53
+ bs9 alert --test # Test webhook
54
+
55
+ # Historical data
56
+ bs9 export --format json --hours 24 # Export metrics
57
+ bs9 export --service myapp --format csv
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🎯 Key Features
63
+
64
+ ### 🔍 Real-time Monitoring
65
+ - **Terminal Dashboard**: Live terminal UI with color-coded status
66
+ - **Web Dashboard**: Browser-based monitoring with auto-refresh
67
+ - **Health Checks**: Automatic `/healthz`, `/readyz`, `/metrics` endpoints
68
+ - **SRE Metrics**: CPU, Memory, Uptime, Task tracking
69
+
70
+ ### 📊 Historical Metrics Storage
71
+ - **Local Storage**: JSON-based metrics storage in `~/.config/bs9/metrics/`
72
+ - **Data Export**: JSON and CSV export formats
73
+ - **Time-based Queries**: Filter by hours/days
74
+ - **Aggregated Analytics**: CPU/Memory averages, uptime calculations
75
+
76
+ ### 🔔 Advanced Alert System
77
+ - **Configurable Thresholds**: CPU, Memory, Error Rate, Uptime
78
+ - **Webhook Notifications**: HTTP webhook support for alerts
79
+ - **Service-specific Configs**: Per-service alert settings
80
+ - **Cooldown Period**: Prevent alert spam
81
+ - **Alert Testing**: Webhook connectivity validation
82
+
83
+ ### 🐳 Container & Orchestration
84
+ - **Docker Support**: Complete Dockerfile and docker-compose setup
85
+ - **Kubernetes**: Full K8s deployment with ServiceMonitor
86
+ - **Health Checks**: Container health endpoints
87
+ - **Resource Limits**: Memory and CPU constraints
88
+ - **Security Policies**: PodSecurityPolicy, RBAC
89
+
90
+ ### 🛡️ Enterprise Security
91
+ - **Pre-start Audit**: Scan for eval(), child_process.exec(), etc.
92
+ - **User-mode Systemd**: Zero root operation required
93
+ - **Systemd Hardening**: PrivateTmp, ProtectSystem, NoNewPrivileges
94
+ - **Resource Limits**: CPU, memory, file descriptor limits
95
+ - **Port Warnings**: Alert for privileged ports (< 1024)
96
+
97
+ ### ⚡ TypeScript JIT/AOT Support
98
+ - **JIT Mode**: Run `.ts` files directly (default)
99
+ - **AOT Mode**: Compile to optimized JS for production (`--build`)
100
+ - **Performance**: Faster startup vs runtime optimization
101
+ - **Build Directory**: `.bs9-build/` for compiled artifacts
102
+
103
+ ---
104
+
105
+ ## 📊 Monitoring Dashboards
106
+
107
+ ### Terminal Dashboard (`bs9 monit`)
108
+ ```
109
+ 🔍 BS9 Real-time Monitoring Dashboard
110
+ ========================================================================================================================
111
+ Refresh: 2s | Last update: 12:23:45 AM | Press Ctrl+C to exit
112
+
113
+ SERVICE STATE HEALTH CPU MEMORY UPTIME TASKS DESCRIPTION
114
+ ------------------------------------------------------------------------------------------------------------------------
115
+ myapp active/running ✅ OK 12.3ms 45.2MB 2h 15m 3 BS9 Service: myapp
116
+ api active/running ✅ OK 8.1ms 32.1MB 1h 42m 2 BS9 Service: api
117
+ webapp failed/failed ❌ FAIL - - - - BS9 Service: webapp
118
+
119
+ ========================================================================================================================
120
+ 📊 Summary: 2/3 services running | Total Memory: 77.3MB | Services: 3
121
+
122
+ ⚠️ ALERTS:
123
+ Failed services: webapp
124
+ Unhealthy services: webapp
125
+ ```
126
+
127
+ ### Web Dashboard (`bs9 web`)
128
+ - **Modern UI**: Responsive web interface
129
+ - **Real-time Updates**: Auto-refresh every 5 seconds
130
+ - **Service Cards**: Visual status indicators
131
+ - **Metrics Charts**: CPU, Memory, Uptime graphs
132
+ - **Historical Data**: View trends over time
133
+ - **Alert Status**: Current alert configuration
134
+
135
+ ---
136
+
137
+ ## 🔧 Alert Configuration
138
+
139
+ ### Global Alert Settings
140
+ ```bash
141
+ # Configure global thresholds
142
+ bs9 alert --cpu 80 --memory 85 --errorRate 5 --uptime 95
143
+ bs9 alert --webhook https://hooks.slack.com/services/...
144
+ bs9 alert --cooldown 300 # 5 minutes cooldown
145
+ ```
146
+
147
+ ### Service-specific Alerts
148
+ ```bash
149
+ # Configure alerts for specific service
150
+ bs9 alert --service myapp --cpu 90 --memory 90
151
+ bs9 alert --service critical-app --enable
152
+ bs9 alert --service test-app --disable
153
+ ```
154
+
155
+ ### Alert Management
156
+ ```bash
157
+ # View current configuration
158
+ bs9 alert --list
159
+
160
+ # Test webhook connectivity
161
+ bs9 alert --test
162
+
163
+ # Enable/disable alerts
164
+ bs9 alert --enable
165
+ bs9 alert --disable
166
+ ```
167
+
168
+ ---
169
+
170
+ ## 📈 Historical Metrics
171
+
172
+ ### Data Storage
173
+ - **Location**: `~/.config/bs9/metrics/`
174
+ - **Format**: JSON files with timestamp naming
175
+ - **Retention**: Automatic cleanup (1000 snapshots)
176
+ - **Compression**: Efficient JSON storage
177
+
178
+ ### Export Options
179
+ ```bash
180
+ # Export all metrics (last 24 hours)
181
+ bs9 export --format json --hours 24
182
+
183
+ # Export specific service
184
+ bs9 export --service myapp --format csv --hours 48
185
+
186
+ # Custom output file
187
+ bs9 export --format json --output my-metrics.json
188
+ ```
189
+
190
+ ### Data Analysis
191
+ ```bash
192
+ # Get aggregated metrics
193
+ const storage = new MetricsStorage();
194
+ const metrics = storage.getAggregatedMetrics(24); // Last 24 hours
195
+ console.log(`Average CPU: ${metrics.avgCpu}ms`);
196
+ console.log(`Average Memory: ${metrics.avgMemory}B`);
197
+ console.log(`Uptime: ${metrics.uptime}%`);
198
+ ```
199
+
200
+ ---
201
+
202
+ ## 🐳 Docker Deployment
203
+
204
+ ### Quick Start
205
+ ```bash
206
+ # Build and run with Docker Compose
207
+ docker-compose up -d
208
+
209
+ # Access services
210
+ # Web Dashboard: http://localhost:8080
211
+ # Grafana: http://localhost:3001
212
+ # Prometheus: http://localhost:9090
213
+ ```
214
+
215
+ ### Dockerfile Features
216
+ - **Multi-stage**: Optimized production builds
217
+ - **Security**: Non-root user, read-only filesystem
218
+ - **Health Checks**: Built-in health endpoints
219
+ - **Resource Limits**: Memory and CPU constraints
220
+
221
+ ### Docker Compose Stack
222
+ - **BS9 Manager**: Main process manager
223
+ - **Prometheus**: Metrics collection
224
+ - **Grafana**: Visualization dashboard
225
+ - **Persistent Storage**: Data volumes for metrics
226
+
227
+ ---
228
+
229
+ ## ☸️ Kubernetes Deployment
230
+
231
+ ### Quick Deploy
232
+ ```bash
233
+ # Deploy to Kubernetes
234
+ kubectl apply -f src/k8s/bs9-deployment.yaml
235
+
236
+ # Check deployment
237
+ kubectl get pods -n bs9-system
238
+ kubectl get services -n bs9-system
239
+ ```
240
+
241
+ ### K8s Features
242
+ - **Namespace Isolation**: `bs9-system` namespace
243
+ - **Service Monitor**: Prometheus integration
244
+ - **Security**: PodSecurityPolicy, RBAC
245
+ - **Health Checks**: Liveness and readiness probes
246
+ - **Resource Limits**: Memory and CPU constraints
247
+
248
+ ---
249
+
250
+ ## 🔄 Migration from PM2
251
+
252
+ | PM2 Command | BS9 Equivalent | Enhanced Features |
253
+ |-------------|----------------|------------------|
254
+ | `pm2 start app.js` | `bs9 start app.js` | Security audit, systemd hardening |
255
+ | `pm2 stop app` | `bs9 stop app` | User-mode operation |
256
+ | `pm2 restart app` | `bs9 restart app` | Health monitoring |
257
+ | `pm2 list` | `bs9 status` | SRE metrics dashboard |
258
+ | `pm2 logs app` | `bs9 logs app` | Journalctl integration |
259
+ | `pm2 monit` | `bs9 monit` | Enhanced terminal dashboard |
260
+ | - | `bs9 web` | Web-based dashboard |
261
+ | - | `bs9 alert` | Alert system with webhooks |
262
+ | - | `bs9 export` | Historical metrics |
263
+
264
+ ---
265
+
266
+ ## 🛠️ Configuration
267
+
268
+ ### BS9 Config (`~/.config/bs9/config.toml`)
269
+ ```toml
270
+ [default]
271
+ port = 3000
272
+ otel_enabled = true
273
+ prometheus_enabled = true
274
+ environment = "production"
275
+
276
+ [security]
277
+ security_audit = true
278
+ block_eval = true
279
+ block_child_process_exec = true
280
+ block_fs_access = true
281
+
282
+ [monitoring]
283
+ refresh_interval = 2
284
+ health_check_timeout = 1000
285
+
286
+ [logging]
287
+ level = "info"
288
+ structured = true
289
+ ```
290
+
291
+ ### Alert Config (`~/.config/bs9/alerts.json`)
292
+ ```json
293
+ {
294
+ "enabled": true,
295
+ "webhookUrl": "https://hooks.slack.com/services/...",
296
+ "thresholds": {
297
+ "cpu": 80,
298
+ "memory": 85,
299
+ "errorRate": 5,
300
+ "uptime": 95
301
+ },
302
+ "cooldown": 300,
303
+ "services": {
304
+ "myapp": {
305
+ "enabled": true,
306
+ "customThresholds": {
307
+ "cpu": 90
308
+ }
309
+ }
310
+ }
311
+ }
312
+ ```
313
+
314
+ ---
315
+
316
+ ## 📚 Examples
317
+
318
+ ### Simple JavaScript App
319
+ ```javascript
320
+ // examples/simple-app.js
321
+ import { serve } from "bun";
322
+
323
+ serve({
324
+ port: process.env.PORT || 3000,
325
+ fetch(req) {
326
+ const url = new URL(req.url);
327
+
328
+ if (url.pathname === "/healthz") return new Response("ok");
329
+ if (url.pathname === "/readyz") return new Response("ready");
330
+ if (url.pathname === "/metrics") {
331
+ return new Response(JSON.stringify({
332
+ uptime: process.uptime(),
333
+ memory: process.memoryUsage(),
334
+ timestamp: new Date().toISOString(),
335
+ }), {
336
+ headers: { "Content-Type": "application/json" }
337
+ });
338
+ }
339
+
340
+ return new Response("Hello from BS9!");
341
+ },
342
+ });
343
+ ```
344
+
345
+ ### TypeScript App with AOT
346
+ ```typescript
347
+ // examples/typescript-app.ts
348
+ import { serve } from "bun";
349
+
350
+ interface RequestMetrics {
351
+ method: string;
352
+ route: string;
353
+ timestamp: number;
354
+ }
355
+
356
+ const metrics: RequestMetrics[] = [];
357
+
358
+ serve({
359
+ port: Number(process.env.PORT) || 3000,
360
+ fetch(req: Request) {
361
+ const url = new URL(req.url);
362
+ const method = req.method;
363
+ const route = url.pathname;
364
+
365
+ // Record metrics
366
+ metrics.push({
367
+ method,
368
+ route,
369
+ timestamp: Date.now(),
370
+ });
371
+
372
+ if (url.pathname === "/healthz") return new Response("ok");
373
+ if (url.pathname === "/readyz") return new Response("ready");
374
+
375
+ return new Response(`Hello from TypeScript BS9 app!\nMethod: ${method}\nRoute: ${route}`);
376
+ },
377
+ });
378
+ ```
379
+
380
+ ---
381
+
382
+ ## 🔧 Development
383
+
384
+ ### Setup
385
+ ```bash
386
+ # Clone and install
387
+ git clone https://github.com/xarhang/bs9.git
388
+ cd bs9
389
+ bun install
390
+
391
+ # Run CLI in development
392
+ bun run bin/bs9 --help
393
+
394
+ # Build for distribution
395
+ bun run build
396
+ ```
397
+
398
+ ### Project Structure
399
+ ```
400
+ BS9/
401
+ ├── bin/
402
+ │ └── bs9 # CLI entry point
403
+ ├── src/
404
+ │ ├── commands/ # CLI commands
405
+ │ │ ├── start.ts # Service management
406
+ │ │ ├── stop.ts # Stop services
407
+ │ │ ├── restart.ts # Restart services
408
+ │ │ ├── status.ts # Status dashboard
409
+ │ │ ├── logs.ts # Log viewing
410
+ │ │ ├── monit.ts # Terminal dashboard
411
+ │ │ ├── web.ts # Web dashboard
412
+ │ │ ├── alert.ts # Alert management
413
+ │ │ └── export.ts # Data export
414
+ │ ├── web/ # Web dashboard
415
+ │ │ └── dashboard.ts # Web server
416
+ │ ├── storage/ # Metrics storage
417
+ │ │ └── metrics.ts # Historical data
418
+ │ ├── alerting/ # Alert system
419
+ │ │ └── config.ts # Alert management
420
+ │ ├── injectors/ # Auto-injection
421
+ │ │ └── otel.ts # OpenTelemetry
422
+ │ ├── docker/ # Docker files
423
+ │ │ └── Dockerfile # Container setup
424
+ │ └── k8s/ # Kubernetes manifests
425
+ │ └── bs9-deployment.yaml
426
+ ├── examples/ # Example apps
427
+ ├── configs/ # Configuration templates
428
+ ├── setup.sh # One-click installer
429
+ ├── docker-compose.yml # Docker stack
430
+ └── README.md
431
+ ```
432
+
433
+ ---
434
+
435
+ ## 🚀 Production Deployment
436
+
437
+ ### System Requirements
438
+ - **OS**: Linux (systemd user mode)
439
+ - **Runtime**: Bun 1.3.6+
440
+ - **Memory**: 512MB minimum per service
441
+ - **Disk**: 1GB for metrics storage
442
+
443
+ ### Installation
444
+ ```bash
445
+ # One-click install
446
+ curl -fsSL https://raw.githubusercontent.com/xarhang/bs9/main/setup.sh | bash
447
+
448
+ # Manual install
449
+ git clone https://github.com/xarhang/bs9.git
450
+ cd bs9
451
+ bun install
452
+ cp bin/bs9 ~/.local/bin/bs9
453
+ chmod +x ~/.local/bin/bs9
454
+ ```
455
+
456
+ ### Production Setup
457
+ ```bash
458
+ # Enable user services persistence
459
+ loginctl enable-linger $USER
460
+
461
+ # Start first service
462
+ bs9 start examples/simple-app.js --name production-app
463
+
464
+ # Verify monitoring
465
+ bs9 status
466
+ bs9 monit
467
+ bs9 web --detach
468
+
469
+ # Configure alerts
470
+ bs9 alert --cpu 80 --memory 85 --webhook https://hooks.slack.com/...
471
+ ```
472
+
473
+ ---
474
+
475
+ ## 🐛 Troubleshooting
476
+
477
+ ### Service Issues
478
+ ```bash
479
+ # Check service status
480
+ systemctl --user status myservice
481
+
482
+ # View logs
483
+ bs9 logs myservice --follow
484
+
485
+ # Check systemd unit
486
+ systemctl --user daemon-reload
487
+ ```
488
+
489
+ ### Monitoring Issues
490
+ ```bash
491
+ # Check web dashboard
492
+ curl http://localhost:8080/api/metrics
493
+
494
+ # Test alerts
495
+ bs9 alert --test
496
+
497
+ # Export metrics for analysis
498
+ bs9 export --format json --hours 1
499
+ ```
500
+
501
+ ### Performance Issues
502
+ ```bash
503
+ # Check resource usage
504
+ bs9 status
505
+
506
+ # Monitor with terminal dashboard
507
+ bs9 monit --refresh 1
508
+
509
+ # Export historical data
510
+ bs9 export --service myapp --hours 24
511
+ ```
512
+
513
+ ---
514
+
515
+ ## 📄 License
516
+
517
+ MIT License - see LICENSE file for details.
518
+
519
+ ---
520
+
521
+ ## 🤝 Contributing
522
+
523
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
524
+
525
+ ---
526
+
527
+ ## 🔗 Links
528
+
529
+ - **GitHub**: https://github.com/xarhang/bs9
530
+ - **Issues**: https://github.com/xarhang/bs9/issues
531
+ - **Documentation**: https://github.com/xarhang/bs9/wiki
532
+ - **Discussions**: https://github.com/xarhang/bs9/discussions
package/bin/bs9 ADDED
@@ -0,0 +1,97 @@
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
+
14
+ const program = new Command();
15
+
16
+ program
17
+ .name("bs9")
18
+ .description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
19
+ .version("1.0.0");
20
+
21
+ program
22
+ .command("start")
23
+ .description("Start a process with hardened systemd unit")
24
+ .argument("<file>", "Script or executable to run")
25
+ .option("-n, --name <name>", "Service name (defaults to filename)")
26
+ .option("-p, --port <port>", "Port to expose (for metrics/health)", "3000")
27
+ .option("--env <env...>", "Environment variables (KEY=VALUE)")
28
+ .option("--no-otel", "Disable automatic OpenTelemetry injection")
29
+ .option("--no-prometheus", "Disable automatic Prometheus metrics")
30
+ .option("--build", "Build TypeScript to optimized JavaScript for production (AOT)")
31
+ .action(startCommand);
32
+
33
+ program
34
+ .command("stop")
35
+ .description("Stop a managed service")
36
+ .argument("<name>", "Service name")
37
+ .action(stopCommand);
38
+
39
+ program
40
+ .command("restart")
41
+ .description("Restart a managed service")
42
+ .argument("<name>", "Service name")
43
+ .action(restartCommand);
44
+
45
+ program
46
+ .command("status")
47
+ .description("Show status and SRE metrics for all services")
48
+ .option("-w, --watch", "Watch mode (refresh every 2s)")
49
+ .action(statusCommand);
50
+
51
+ program
52
+ .command("logs")
53
+ .description("Show logs for a service (via journalctl)")
54
+ .argument("<name>", "Service name")
55
+ .option("-f, --follow", "Follow logs")
56
+ .option("-n, --lines <number>", "Number of lines", "50")
57
+ .action(logsCommand);
58
+
59
+ program
60
+ .command("monit")
61
+ .description("Real-time terminal dashboard for all services")
62
+ .option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
63
+ .action(monitCommand);
64
+
65
+ program
66
+ .command("web")
67
+ .description("Start web-based monitoring dashboard")
68
+ .option("-p, --port <port>", "Port for web dashboard", "8080")
69
+ .option("-d, --detach", "Run in background")
70
+ .action(webCommand);
71
+
72
+ program
73
+ .command("alert")
74
+ .description("Configure alert thresholds and webhooks")
75
+ .option("--enable", "Enable alerts")
76
+ .option("--disable", "Disable alerts")
77
+ .option("--webhook <url>", "Set webhook URL for alerts")
78
+ .option("--cpu <percentage>", "CPU threshold percentage")
79
+ .option("--memory <percentage>", "Memory threshold percentage")
80
+ .option("--errorRate <percentage>", "Error rate threshold percentage")
81
+ .option("--uptime <percentage>", "Uptime threshold percentage")
82
+ .option("--cooldown <seconds>", "Alert cooldown period in seconds")
83
+ .option("--service <name>", "Configure alerts for specific service")
84
+ .option("--list", "List current alert configuration")
85
+ .option("--test", "Test webhook connectivity")
86
+ .action(alertCommand);
87
+
88
+ program
89
+ .command("export")
90
+ .description("Export historical metrics data")
91
+ .option("-f, --format <format>", "Export format (json|csv)", "json")
92
+ .option("-h, --hours <hours>", "Hours of data to export", "24")
93
+ .option("-o, --output <file>", "Output file path")
94
+ .option("-s, --service <name>", "Export specific service metrics")
95
+ .action(exportCommand);
96
+
97
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "bs9",
3
+ "version": "1.0.0",
4
+ "description": "Bun Sentinel 9 - High-performance, non-root process manager for Bun",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "bin": {
8
+ "bs9": "./bin/bs9",
9
+ "bsn": "./bin/bs9"
10
+ },
11
+ "files": [
12
+ "bin",
13
+ "src",
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "start": "bun run src/index.ts",
20
+ "build": "bun build ./bin/bs9 --outdir ./dist --target bun",
21
+ "audit": "bun audit"
22
+ },
23
+ "keywords": [
24
+ "bun",
25
+ "process-manager",
26
+ "sentinel",
27
+ "cli",
28
+ "monitoring"
29
+ ],
30
+ "author": "xarhang",
31
+ "license": "MIT",
32
+ "dependencies": {
33
+ "@opentelemetry/api": "^1.9.0",
34
+ "@opentelemetry/auto-instrumentations-node": "^0.50.0",
35
+ "@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
36
+ "@opentelemetry/resources": "^1.23.0",
37
+ "@opentelemetry/sdk-node": "^0.50.0",
38
+ "@opentelemetry/semantic-conventions": "^1.23.0",
39
+ "commander": "^12.0.0",
40
+ "pg": "^8.12.0",
41
+ "pino": "^9.3.1",
42
+ "prom-client": "^15.1.2"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^22.10.0",
46
+ "bun-types": "^1.1.0"
47
+ }
48
+ }
package/src/.gitkeep ADDED
File without changes