@holdgrenade/cli 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/dist/cli.js +36033 -0
  4. package/package.json +32 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Grenade
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,79 @@
1
+ # grenade-cli
2
+
3
+ The Mac side of Grenade: `grenaded` (daemon) and the `grenade` CLI. Runs your AI coding agents inside tmux, streams them to the Grenade phone app, and lets the phone type into them.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ brew install holdgrenade/tap/grenade # brings Node and tmux
9
+ grenade setup # hooks, start at login, relay, then a QR code for the phone
10
+ ```
11
+
12
+ `grenade setup` asks before it changes anything and skips what is already done:
13
+
14
+ 1. It checks for macOS, Node 22+, tmux 3.2+ and an agent, and offers `brew install tmux` when tmux is missing.
15
+ 2. It shows the Claude Code hooks it would add to `~/.claude/settings.json` and adds them on a yes (`grenade install-hooks --remove` takes them out).
16
+ 3. It installs a launchd agent, so `grenaded` starts at login and comes back if it stops (`grenade service remove`).
17
+ 4. It offers the relay, for reaching the Mac from any network (`grenade relay off`). Push notifications follow that answer: on with the relay, off without it, and setup says which.
18
+ 5. It shows a QR code. Scan it in the Grenade app and the phone is paired, on any network when the relay is on.
19
+
20
+ `--yes` takes the suggested answer to every question; `--no-hooks`, `--no-service`, `--no-relay` and `--no-pair` leave a step out.
21
+
22
+ Without Homebrew, with Node 22+ and tmux 3.2+ already there: `npm install -g @holdgrenade/cli`, then `grenade setup`.
23
+
24
+ From the source:
25
+
26
+ ```bash
27
+ brew install tmux
28
+ cd ../grenade-protocol && npm install && npm run build
29
+ cd ../grenade-cli && npm install && npm run build
30
+ npm link # puts `grenade` on your PATH
31
+ grenade setup
32
+ ```
33
+
34
+ `npm run release` builds the tarball and the Homebrew formula locally. Homebrew and npm install that same tarball.
35
+
36
+ ## Use
37
+
38
+ ```bash
39
+ grenade service status # is grenaded installed as a login agent, and running?
40
+ grenade daemon # or run it in the foreground yourself
41
+ # with iTerm2 installed, every session also gets its own iTerm tab (--terminal none to turn off)
42
+
43
+ grenade new grenade --cwd ~/projects/grenade --agent claude
44
+ grenade open grenade # attach your terminal to it (Ctrl-b d to detach)
45
+ grenade pair # QR code for the phone, and a code to type (6 digits, then 4 that let the phone check it is talking to this Mac)
46
+ grenade devices # the phones paired with this Mac
47
+ grenade unpair <phone> # end a phone's pairing at once (or: grenade unpair --all)
48
+ grenade ls
49
+ grenade kill grenade
50
+
51
+ grenade relay on # reach this Mac from any network via the main Grenade relay (or: grenade relay on <your relay>)
52
+ grenade relay status # online? public and local IPs, phones connected through it
53
+ grenade relay off
54
+
55
+ grenade push status # push notifications: on or off, through which relay, which phones asked for them
56
+ grenade push test # send every registered phone a test notification
57
+ grenade push on # send them also with remote access off, through the main relay
58
+ grenade push off # send none (grenade push auto: on while remote access is on, the default)
59
+ ```
60
+
61
+ Away from home the phone reaches the daemon through a relay: both sides dial out to it, and everything between them is end-to-end encrypted, so the relay only learns which Macs are online and their IP addresses. With the relay on, a phone also pairs from anywhere: the QR code carries the Mac's key and a one-time secret, and both work once, for two minutes. The typed code pairs on the same Wi‑Fi only. Host your own relay with `../grenade-relay`.
62
+
63
+ Push notifications tell the phone that an agent needs an answer or has finished, even while the app is closed. They follow remote access: with `grenade relay on` they are on and go through that relay; with remote access off they are off and the Mac talks to no relay. `grenade push on` turns them on by themselves, through the main relay. The Mac seals each one so that only your phone can read it, and the relay hands it to Apple. That relay learns the Mac's public IP address, the phone's device token and the time, never the session or the text. A push waits while you are at the Mac (keyboard or mouse used in the last two minutes; `grenade push on --at-mac 0` to never wait) and is dropped once you have answered.
64
+
65
+ The daemon listens on `:7788` (WebSocket at `/ws`) and advertises itself as `_grenade._tcp` so the phone finds it on the same Wi‑Fi. State lives in `~/.grenade/`.
66
+
67
+ On the Wi‑Fi the phone and the Mac speak the same end-to-end encryption as through the relay, so nobody else on the network can read a session or take a token. A phone app that predates this is refused; while you update it, `grenade daemon --allow-plain-lan` lets it in. A phone you have not used for 90 days is unpaired. What this does and does not protect against is in `../grenade-protocol/SECURITY.md`.
68
+
69
+ ## Develop
70
+
71
+ ```bash
72
+ npm test # unit tests
73
+ npm run dev -- daemon # run from source
74
+ node scripts/smoke.mjs # end-to-end against a running daemon
75
+ node scripts/pair-smoke.mjs --control-port 7790 # a phone that scanned the QR code
76
+ npm run release # the tarball and the Homebrew formula, locally
77
+ ```
78
+
79
+ See `CLAUDE.md` for the architecture and `../grenade-protocol/PROTOCOL.md` for the wire format.