@sharnix/agent 1.0.0 → 1.0.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 (2) hide show
  1. package/README.md +82 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @sharnix/agent
2
+
3
+ Instantly share your local app with anyone — no config, no port forwarding, no deployment.
4
+
5
+ ```bash
6
+ SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 3000
7
+ ```
8
+
9
+ ## What it does
10
+
11
+ `@sharnix/agent` opens a secure tunnel from [relay.sharnix.com](https://relay.sharnix.com) to your local machine. Visitors access your app through a shareable link — you never expose a port publicly.
12
+
13
+ - **Stable tunnel ID** per project directory — the same tunnel URL survives restarts
14
+ - **Auto-provisioned** — creates an agent credential on first run, stored in `~/.sharnix/`
15
+ - **Auto-suspends** share links when you disconnect, reactivates when you reconnect
16
+ - **Works with any framework** — Next.js, Vite, Django, Rails, anything on localhost
17
+
18
+ ## Requirements
19
+
20
+ - Node.js 18 or later
21
+ - A free Sharnix account at [relay.sharnix.com](https://relay.sharnix.com)
22
+ - An API key from **Settings → API Keys**
23
+
24
+ ## Usage
25
+
26
+ ```bash
27
+ # Tunnel port 3000
28
+ SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 3000
29
+
30
+ # Tunnel a different port with a label
31
+ SHARNIX_API_KEY=shx_... npx @sharnix/agent --port 8080 --label "staging"
32
+ ```
33
+
34
+ Set the key in your shell profile so you don't repeat it:
35
+
36
+ ```bash
37
+ # ~/.bashrc or ~/.zshrc
38
+ export SHARNIX_API_KEY=shx_...
39
+ ```
40
+
41
+ Then just:
42
+
43
+ ```bash
44
+ npx @sharnix/agent --port 3000
45
+ ```
46
+
47
+ ## Options
48
+
49
+ | Flag | Default | Description |
50
+ |------|---------|-------------|
51
+ | `--port`, `-p` | `3000` | Local port to forward |
52
+ | `--label`, `-l` | — | Human-readable label for this tunnel |
53
+ | `--name` | `local-dev` | Agent name used on first-time setup |
54
+ | `--help`, `-h` | — | Show help |
55
+
56
+ ## Environment variables
57
+
58
+ | Variable | Description |
59
+ |----------|-------------|
60
+ | `SHARNIX_API_KEY` | Your API key (required) |
61
+ | `SHARNIX_URL` | Override relay URL (default: `https://relay.sharnix.com`) |
62
+
63
+ ## Creating share links
64
+
65
+ Once the agent is running, create share links from:
66
+
67
+ - **Dashboard** — [relay.sharnix.com/app](https://relay.sharnix.com/app)
68
+ - **AI agent** — via the [`@sharnix/mcp-server`](https://www.npmjs.com/package/@sharnix/mcp-server) MCP integration
69
+ - **API** — `POST /api/v1/orgs/:slug/tunnels/:id/links`
70
+
71
+ Share links support permissions (`read-only`, `full`), expiry dates, email restrictions, and one-time view mode.
72
+
73
+ ## How it works
74
+
75
+ 1. On first run, the agent calls the Sharnix API to create a credential pair (`agentId` + `secret`), saved to `~/.sharnix/agent.json`
76
+ 2. A stable tunnel ID is generated for the current working directory and saved to `~/.sharnix/tunnel-<hash>.json`
77
+ 3. The agent opens a WebSocket to the relay and registers the tunnel
78
+ 4. When a visitor opens a share link, the relay forwards their HTTP request over the WebSocket to your local app and streams the response back
79
+
80
+ ## License
81
+
82
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharnix/agent",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Tunnel your local app through Sharnix — share previews with one command",
5
5
  "keywords": ["tunnel", "preview", "sharing", "localhost", "sharnix"],
6
6
  "homepage": "https://relay.sharnix.com",