vibex-sh 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +10 -29
  2. package/index.js +14 -50
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,12 +7,6 @@ Zero-config observability CLI - pipe logs and visualize instantly.
7
7
  ```bash
8
8
  # Production (default)
9
9
  echo '{"cpu": 45, "memory": 78}' | vibex
10
-
11
- # Local development
12
- echo '{"test": 123}' | vibex --local
13
-
14
- # Custom ports
15
- echo '{"data": 123}' | vibex --web http://localhost:3000 --socket http://localhost:8080
16
10
  ```
17
11
 
18
12
  ## Installation
@@ -43,40 +37,33 @@ echo '{"more": "data"}' | vibex --session-id vibex-abc123
43
37
  | Flag | Description | Example |
44
38
  |------|-------------|---------|
45
39
  | `-s, --session-id <id>` | Reuse existing session | `vibex --session-id vibex-abc123` |
46
- | `-l, --local` | Use localhost (web: 3000, socket: 3001) | `vibex --local` |
47
- | `--web <url>` | Web server URL | `vibex --web http://localhost:3000` |
48
- | `--socket <url>` | Socket server URL | `vibex --socket http://localhost:8080` |
49
- | `--server <url>` | Shorthand for `--web` (auto-derives socket) | `vibex --server http://localhost:3000` |
40
+ | `--web <url>` | Web server URL | `vibex --web https://vibex.sh` |
41
+ | `--socket <url>` | Socket server URL | `vibex --socket wss://ingest.vibex.sh` |
42
+ | `--server <url>` | Shorthand for `--web` (auto-derives socket) | `vibex --server https://vibex.sh` |
50
43
 
51
44
  ## Server Configuration
52
45
 
53
46
  The CLI automatically derives the socket URL from the web URL, but you can override it:
54
47
 
55
48
  ```bash
56
- # Auto-derive socket (localhost:3000 → localhost:3001)
57
- vibex --web http://localhost:3000
58
-
59
- # Explicit socket URL
60
- vibex --web http://localhost:3000 --socket http://localhost:8080
61
-
62
- # Production (auto-derives socket.vibex.sh)
49
+ # Production (auto-derives socket URL)
63
50
  vibex --server https://vibex.sh
64
51
 
65
52
  # Custom domain
66
- vibex --web https://staging.vibex.sh --socket https://socket-staging.vibex.sh
53
+ vibex --web https://staging.vibex.sh --socket wss://ingest-staging.vibex.sh
67
54
  ```
68
55
 
69
56
  ## Priority Order
70
57
 
71
- 1. **Flags** (`--web`, `--socket`, `--local`, `--server`)
58
+ 1. **Flags** (`--web`, `--socket`, `--server`)
72
59
  2. **Environment variables** (`VIBEX_WEB_URL`, `VIBEX_SOCKET_URL`)
73
- 3. **Production defaults** (`https://vibex.sh`, `https://socket.vibex.sh`)
60
+ 3. **Production defaults** (`https://vibex.sh`, `wss://ingest.vibex.sh`)
74
61
 
75
62
  ## Environment Variables
76
63
 
77
64
  ```bash
78
- export VIBEX_WEB_URL=http://localhost:3000
79
- export VIBEX_SOCKET_URL=http://localhost:8080
65
+ export VIBEX_WEB_URL=https://vibex.sh
66
+ export VIBEX_SOCKET_URL=wss://ingest.vibex.sh
80
67
  ```
81
68
 
82
69
  ## Examples
@@ -85,14 +72,8 @@ export VIBEX_SOCKET_URL=http://localhost:8080
85
72
  # Production (default)
86
73
  echo '{"data": 123}' | vibex
87
74
 
88
- # Quick localhost
89
- echo '{"data": 123}' | vibex --local
90
-
91
75
  # Custom web server, auto socket
92
- echo '{"data": 123}' | vibex --server http://localhost:3000
93
-
94
- # Both custom
95
- echo '{"data": 123}' | vibex --web http://localhost:3000 --socket http://localhost:8080
76
+ echo '{"data": 123}' | vibex --server https://vibex.sh
96
77
 
97
78
  # Staging
98
79
  echo '{"data": 123}' | vibex --server https://staging.vibex.sh
package/index.js CHANGED
@@ -154,27 +154,13 @@ function normalizeToHybrid(message, level, payload) {
154
154
  }
155
155
 
156
156
  function deriveSocketUrl(webUrl) {
157
- const url = new URL(webUrl);
158
-
159
- // For localhost, use Workers dev server
160
- if (url.hostname === 'localhost' || url.hostname === '127.0.0.1') {
161
- return 'ws://localhost:8787';
162
- }
163
- // For vibex.sh domains, use Workers WebSocket endpoint
164
- else if (url.hostname.includes('vibex.sh')) {
165
- // Use Cloudflare Workers WebSocket endpoint
166
- const workerUrl = process.env.VIBEX_WORKER_URL || 'https://ingest.vibex.sh';
167
- return workerUrl.replace('https://', 'wss://').replace('http://', 'ws://');
168
- }
169
- // For other domains, derive from web URL
170
- else {
171
- const workerUrl = process.env.VIBEX_WORKER_URL || webUrl.replace(url.hostname, `ingest.${url.hostname}`);
172
- return workerUrl.replace('https://', 'wss://').replace('http://', 'ws://');
173
- }
157
+ // Always use production worker WebSocket endpoint
158
+ const workerUrl = process.env.VIBEX_WORKER_URL || 'https://ingest.vibex.sh';
159
+ return workerUrl.replace('https://', 'wss://').replace('http://', 'ws://');
174
160
  }
175
161
 
176
162
  function getUrls(options) {
177
- const { local, web, socket, server } = options;
163
+ const { web, socket, server } = options;
178
164
 
179
165
  // Priority 1: Explicit --web and --socket flags (highest priority)
180
166
  if (web) {
@@ -192,15 +178,7 @@ function getUrls(options) {
192
178
  };
193
179
  }
194
180
 
195
- // Priority 3: --local flag
196
- if (local) {
197
- return {
198
- webUrl: process.env.VIBEX_WEB_URL || 'http://localhost:3000',
199
- socketUrl: process.env.VIBEX_SOCKET_URL || socket || 'ws://localhost:8787',
200
- };
201
- }
202
-
203
- // Priority 4: Environment variables
181
+ // Priority 3: Environment variables
204
182
  if (process.env.VIBEX_WEB_URL) {
205
183
  return {
206
184
  webUrl: process.env.VIBEX_WEB_URL,
@@ -208,8 +186,8 @@ function getUrls(options) {
208
186
  };
209
187
  }
210
188
 
211
- // Priority 5: Production defaults
212
- // Use Worker WebSocket endpoint instead of old Socket.io server
189
+ // Priority 4: Production defaults
190
+ // Always use production worker WebSocket endpoint
213
191
  const defaultWorkerUrl = process.env.VIBEX_WORKER_URL || 'https://ingest.vibex.sh';
214
192
  return {
215
193
  webUrl: 'https://vibex.sh',
@@ -439,7 +417,6 @@ async function main() {
439
417
  // Create a separate command instance for login
440
418
  const loginCmd = new Command();
441
419
  loginCmd
442
- .option('-l, --local', 'Use localhost')
443
420
  .option('--web <url>', 'Web server URL')
444
421
  .option('--server <url>', 'Shorthand for --web');
445
422
 
@@ -459,9 +436,8 @@ async function main() {
459
436
  program
460
437
  .version(cliVersion, '-v, --version', 'Display version number')
461
438
  .option('-s, --session-id <id>', 'Reuse existing session ID')
462
- .option('-l, --local', 'Use localhost (web: 3000, socket: 3001)')
463
- .option('--web <url>', 'Web server URL (e.g., http://localhost:3000)')
464
- .option('--socket <url>', 'Socket server URL (e.g., http://localhost:3001)')
439
+ .option('--web <url>', 'Web server URL')
440
+ .option('--socket <url>', 'Socket server URL')
465
441
  .option('--server <url>', 'Shorthand for --web (auto-derives socket URL)')
466
442
  .option('--token <token>', 'Authentication token (or use VIBEX_TOKEN env var)')
467
443
  .parse();
@@ -516,10 +492,8 @@ async function main() {
516
492
 
517
493
  // Print banner for new session
518
494
  printBanner(sessionId, webUrl, authCode);
519
- const localFlag = webUrl.includes('localhost') ? ' --local' : '';
520
- const sessionSlug = sessionId.replace(/^vibex-/, ''); // Remove prefix for example
521
495
  console.log(' 💡 Tip: Use -s to send more logs to this session');
522
- console.log(` Example: echo '{"cpu": 45, "memory": 78}' | npx vibex-sh -s ${sessionSlug}${localFlag}\n`);
496
+ console.log(` Example: echo '{"cpu": 45, "memory": 78}' | npx vibex-sh -s ${sessionId}\n`);
523
497
  } catch (error) {
524
498
  console.error(` ✗ Error creating session: ${error.message}`);
525
499
  process.exit(1);
@@ -823,24 +797,14 @@ async function main() {
823
797
  };
824
798
 
825
799
  // Send logs via HTTP POST (non-blocking, same as SDKs)
826
- // Use Cloudflare Worker endpoint (port 8787 for local, or Worker URL for production)
800
+ // Always use production Cloudflare Worker endpoint
827
801
  // Token is optional - anonymous sessions can send logs without authentication
828
802
  // HTTP POST works independently of WebSocket - don't wait for WebSocket connection
829
803
  const sendLogViaHTTP = async (logData) => {
830
804
  try {
831
- // Determine ingest URL
832
- let ingestUrl;
833
- if (webUrl.includes('localhost') || webUrl.includes('127.0.0.1')) {
834
- // Local development - use Workers dev server
835
- ingestUrl = 'http://localhost:8787/api/v1/ingest';
836
- } else if (process.env.VIBEX_WORKER_URL) {
837
- // Use explicit Worker URL if set
838
- ingestUrl = `${process.env.VIBEX_WORKER_URL}/api/v1/ingest`;
839
- } else {
840
- // Production default - use Worker URL (not web URL)
841
- const defaultWorkerUrl = 'https://ingest.vibex.sh';
842
- ingestUrl = `${defaultWorkerUrl}/api/v1/ingest`;
843
- }
805
+ // Always use production worker URL
806
+ const workerUrl = process.env.VIBEX_WORKER_URL || 'https://ingest.vibex.sh';
807
+ const ingestUrl = `${workerUrl}/api/v1/ingest`;
844
808
 
845
809
  // Build headers - only include Authorization if token exists
846
810
  const headers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibex-sh",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Zero-config observability CLI - pipe logs and visualize instantly",
5
5
  "type": "module",
6
6
  "bin": {