|
1 | 1 | # Terminal Usage |
2 | 2 |
|
3 | | -Instbyte exposes a simple HTTP API — push content directly from your terminal using `curl`, no browser needed. |
| 3 | +Instbyte has a first-class CLI for sending, watching, and checking server status — no browser needed. |
4 | 4 |
|
5 | | -Replace `192.168.x.x:3000` with the URL shown when Instbyte starts. |
| 5 | +Replace `192.168.x.x:3000` with the URL shown when Instbyte starts. If you're working in the same directory (or any subdirectory) as where the server was started, the URL is discovered automatically. |
6 | 6 |
|
7 | 7 | --- |
8 | 8 |
|
9 | | -## Send text or a link |
| 9 | +## CLI |
| 10 | + |
| 11 | +### Send a file |
10 | 12 | ```bash |
11 | | -curl -X POST http://192.168.x.x:3000/push \ |
12 | | - -H "Content-Type: text/plain" \ |
13 | | - -d "hello from terminal" |
| 13 | +instbyte send ./build.zip |
| 14 | +instbyte send ./error.log --channel projects |
| 15 | +instbyte send ./report.pdf --channel assets --passphrase myteam |
14 | 16 | ``` |
15 | 17 |
|
16 | | -Use `X-Channel` and `X-Uploader` headers to control where it lands. Both default to `general` and `terminal` if omitted. |
| 18 | +### Send text or a link |
17 | 19 | ```bash |
18 | | -curl -X POST http://192.168.x.x:3000/push \ |
19 | | - -H "Content-Type: text/plain" \ |
20 | | - -H "X-Channel: projects" \ |
21 | | - -H "X-Uploader: mohit" \ |
22 | | - -d "targeted push" |
| 20 | +instbyte send "http://staging.myapp.com" |
| 21 | +instbyte send "quick note for the team" --channel projects |
23 | 22 | ``` |
24 | 23 |
|
25 | | ---- |
| 24 | +### Pipe anything in |
| 25 | +```bash |
| 26 | +npm run build 2>&1 | instbyte send |
| 27 | +git log --oneline -20 | instbyte send |
| 28 | +docker logs my-container | instbyte send --channel projects |
| 29 | +cat error.log | instbyte send |
| 30 | +``` |
26 | 31 |
|
27 | | -## Pipe command output |
| 32 | +> Windows: use PowerShell or CMD for piping. Git Bash has a known stdin limitation with native executables. |
28 | 33 |
|
29 | | -Any command output — logs, build errors, git history — pipes directly. No quoting or escaping needed. |
| 34 | +### Watch a channel — auto-copy new text to clipboard |
30 | 35 | ```bash |
31 | | -# build output |
32 | | -npm run build 2>&1 | curl -X POST http://192.168.x.x:3000/push \ |
33 | | - -H "Content-Type: text/plain" \ |
34 | | - --data-binary @- |
35 | | - |
36 | | -# directory listing |
37 | | -ls -la | curl -X POST http://192.168.x.x:3000/push \ |
38 | | - -H "Content-Type: text/plain" \ |
39 | | - --data-binary @- |
| 36 | +instbyte watch # watches general channel |
| 37 | +instbyte watch --channel projects # specific channel |
| 38 | +instbyte watch --output # print to stdout instead of clipboard |
| 39 | +instbyte watch --output | grep "error" # pipeable |
| 40 | +``` |
40 | 41 |
|
41 | | -# git log |
42 | | -git log --oneline -20 | curl -X POST http://192.168.x.x:3000/push \ |
43 | | - -H "Content-Type: text/plain" \ |
44 | | - --data-binary @- |
| 42 | +New text items are silently copied to your clipboard. File items print the download URL. |
45 | 43 |
|
46 | | -# docker logs |
47 | | -docker logs my-container 2>&1 | curl -X POST http://192.168.x.x:3000/push \ |
48 | | - -H "Content-Type: text/plain" \ |
49 | | - --data-binary @- |
| 44 | +### Check server status |
| 45 | +```bash |
| 46 | +instbyte status |
| 47 | +instbyte status --server http://192.168.x.x:3000 |
50 | 48 | ``` |
51 | 49 |
|
52 | 50 | --- |
53 | 51 |
|
54 | | -## Send a file's contents as text |
55 | | -```bash |
56 | | -curl -X POST http://192.168.x.x:3000/push \ |
57 | | - -H "Content-Type: text/plain" \ |
58 | | - --data-binary @error.log |
59 | | -``` |
| 52 | +## Server auto-discovery |
60 | 53 |
|
61 | | -This works for any text file — logs, configs, `.env` snapshots, stack traces. The content appears in the feed with syntax highlighting if the extension is recognised. |
| 54 | +When the server starts, it writes a small runtime config to `instbyte-data/.runtime.json` with the server URL and passphrase. The CLI picks this up automatically by walking up from your current directory — the same way git finds `.git`. |
62 | 55 |
|
63 | | -> Use `/upload` instead if you want the file itself to be downloadable rather than read inline. |
| 56 | +Priority order for every CLI command: |
| 57 | +1. `--server` / `--passphrase` flags |
| 58 | +2. `INSTBYTE_URL` / `INSTBYTE_PASS` environment variables |
| 59 | +3. `instbyte-data/.runtime.json` found by walking up from cwd |
| 60 | +4. `http://localhost:3000` fallback |
64 | 61 |
|
65 | 62 | --- |
66 | 63 |
|
67 | | -## Upload a file |
| 64 | +## CI/CD |
| 65 | + |
| 66 | +Environment variables are the clean path for CI — set once as a secret, use everywhere: |
68 | 67 |
|
69 | | -Any file type — images, PDFs, zips, executables, media. |
70 | 68 | ```bash |
71 | | -curl -X POST http://192.168.x.x:3000/upload \ |
72 | | - -F "file=@./screenshot.png" \ |
73 | | - -F "channel=general" \ |
74 | | - -F "uploader=terminal" |
| 69 | +# Set in CI environment |
| 70 | +INSTBYTE_URL=http://192.168.x.x:3000 |
| 71 | +INSTBYTE_PASS=myteam |
75 | 72 | ``` |
76 | 73 |
|
77 | | ---- |
78 | | - |
79 | | -## With auth enabled |
80 | | - |
81 | | -Pass the passphrase as a header — works from any terminal or CI environment without needing a browser session. |
82 | | -```bash |
83 | | -curl -X POST http://192.168.x.x:3000/push \ |
84 | | - -H "Content-Type: text/plain" \ |
85 | | - -H "X-Passphrase: yourpassword" \ |
86 | | - --data-binary @error.log |
| 74 | +```yaml |
| 75 | +# GitHub Actions |
| 76 | +- name: Share build artifact |
| 77 | + run: npx instbyte send ./dist/app.zip --channel assets |
87 | 78 | ``` |
88 | 79 |
|
89 | | -All endpoints accept `X-Passphrase`. Upload too: |
90 | | -```bash |
91 | | -curl -X POST http://192.168.x.x:3000/upload \ |
92 | | - -H "X-Passphrase: yourpassword" \ |
93 | | - -F "file=@./build.zip" \ |
94 | | - -F "channel=assets" \ |
95 | | - -F "uploader=CI" |
| 80 | +```json |
| 81 | +// package.json scripts |
| 82 | +{ |
| 83 | + "scripts": { |
| 84 | + "build": "webpack && instbyte send ./dist/build.zip --channel assets", |
| 85 | + "test": "vitest run 2>&1 | instbyte send --channel projects" |
| 86 | + } |
| 87 | +} |
96 | 88 | ``` |
97 | 89 |
|
98 | 90 | --- |
99 | 91 |
|
100 | | -## Quick reference — headers |
| 92 | +## Options |
101 | 93 |
|
102 | | -| Header | Applies to | Default | Description | |
| 94 | +| Flag | Commands | Default | Description | |
103 | 95 | |---|---|---|---| |
104 | | -| `X-Channel` | `/push`, `/text` | `general` | Channel to post into | |
105 | | -| `X-Uploader` | `/push`, `/text` | `terminal` | Display name in the feed | |
106 | | -| `X-Passphrase` | all endpoints | — | Passphrase if auth is enabled | |
| 96 | +| `--server <url>` | all | auto-discovered | Server URL | |
| 97 | +| `--channel <name>` | send, watch | `general` | Target channel | |
| 98 | +| `--passphrase <pass>` | all | auto-discovered | Passphrase if auth is enabled | |
| 99 | +| `--uploader <name>` | send | OS username | Display name for sent items | |
| 100 | +| `--output` | watch | — | Print to stdout instead of clipboard | |
| 101 | +| `--quiet` | send | — | Suppress confirmation output | |
107 | 102 |
|
108 | 103 | --- |
109 | 104 |
|
110 | | -## Use cases |
| 105 | +## Raw HTTP (curl) |
111 | 106 |
|
112 | | -- Pipe stack traces or build output from CI straight into a shared channel |
113 | | -- Send `.env` snapshots or config dumps from a remote server |
114 | | -- Push deployment notifications to a team channel |
115 | | -- Share API responses or debug output without leaving the terminal |
116 | | -``` |
| 107 | +The HTTP API is also available directly — useful for environments without the CLI installed. |
| 108 | + |
| 109 | +```bash |
| 110 | +# Send text |
| 111 | +curl -X POST http://192.168.x.x:3000/push \ |
| 112 | + -H "Content-Type: text/plain" \ |
| 113 | + -d "hello from terminal" |
| 114 | + |
| 115 | +# Send to a specific channel |
| 116 | +curl -X POST http://192.168.x.x:3000/push \ |
| 117 | + -H "Content-Type: text/plain" \ |
| 118 | + -H "X-Channel: projects" \ |
| 119 | + -H "X-Uploader: mohit" \ |
| 120 | + -d "targeted push" |
| 121 | + |
| 122 | +# Pipe command output |
| 123 | +npm run build 2>&1 | curl -X POST http://192.168.x.x:3000/push \ |
| 124 | + -H "Content-Type: text/plain" \ |
| 125 | + --data-binary @- |
| 126 | + |
| 127 | +# Upload a file |
| 128 | +curl -X POST http://192.168.x.x:3000/upload \ |
| 129 | + -F "file=@./screenshot.png" \ |
| 130 | + -F "channel=general" \ |
| 131 | + -F "uploader=terminal" |
| 132 | + |
| 133 | +# With auth |
| 134 | +curl -X POST http://192.168.x.x:3000/push \ |
| 135 | + -H "Content-Type: text/plain" \ |
| 136 | + -H "X-Passphrase: yourpassword" \ |
| 137 | + --data-binary @error.log |
| 138 | +``` |
0 commit comments