@holdgrenade/cli 0.1.0 → 1.0.49

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 +77 -13
  2. package/dist/cli.js +6247 -879
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -1,27 +1,43 @@
1
1
  # grenade-cli
2
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.
3
+ The computer's side of [Grenade](https://www.holdgrenade.com): `grenaded` (daemon) and the `grenade` CLI, for macOS and Linux. Runs your AI coding agents inside tmux, streams them to the Grenade phone app, and lets the phone type into them.
4
+
5
+ Grenade lets you watch and answer the AI coding agents running in terminals on your Mac or your Linux computer (Claude Code, Codex, or a plain shell) from your phone or from a Mac app: every session in one list with a status (needs an answer, finished, working, idle), the live terminal, Claude Code's permissions, questions and plans as cards, and a mic to talk into. On the same Wi‑Fi the phone talks to the computer directly; from anywhere else it goes through a relay. Both ways are end-to-end encrypted, and there is no account.
6
+
7
+ [Website](https://www.holdgrenade.com) · [Install](https://www.holdgrenade.com/install) · [Guide](https://www.holdgrenade.com/guide) · [Security](https://www.holdgrenade.com/security)
4
8
 
5
9
  ## Install
6
10
 
11
+ On a Mac:
12
+
7
13
  ```bash
8
14
  brew install holdgrenade/tap/grenade # brings Node and tmux
9
- grenade setup # hooks, start at login, relay, then a QR code for the phone
15
+ grenade setup # start at login, relay, then a QR code for the phone
16
+ ```
17
+
18
+ On Linux (see [Linux](#linux) below):
19
+
20
+ ```bash
21
+ curl -fsSL https://www.holdgrenade.com/install.sh | sh # needs Node 22+; no sudo
22
+ grenade setup
10
23
  ```
11
24
 
12
25
  `grenade setup` asks before it changes anything and skips what is already done:
13
26
 
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.
27
+ 1. It checks for macOS or Linux, Node 22+, tmux 3.2+ and an agent, and offers to install tmux when it is missing (`brew install tmux`; on Linux with pacman, apt-get or dnf). iTerm2 is not needed (see below).
28
+ 2. It installs a launchd agent (on Linux a systemd user service), so `grenaded` starts at login and comes back if it stops (`grenade service remove`).
29
+ 3. It offers the relay, for reaching the computer from any network (`grenade relay off`). Push notifications follow that answer: on with the relay, off without it, and setup says which.
30
+ 4. It shows a QR code. Scan it in the Grenade app and the phone is paired, on any network when the relay is on.
31
+
32
+ Setup touches no agent's settings. Grenade starts Claude Code and Codex with its hooks (`claude --settings …`, `codex -c hooks.…`), so the phone knows when they work and wait. The first Codex session asks once to trust them; the phone shows it as a card, so tap Trust there or pick "Trust all and continue" in the terminal.
19
33
 
20
34
  `--yes` takes the suggested answer to every question; `--no-hooks`, `--no-service`, `--no-relay` and `--no-pair` leave a step out.
21
35
 
22
- Without Homebrew, with Node 22+ and tmux 3.2+ already there: `npm install -g @holdgrenade/cli`, then `grenade setup`.
36
+ On a Mac without Homebrew, with Node 22+ and tmux 3.2+ already there: `npm install -g @holdgrenade/cli`, then `grenade setup`.
37
+
38
+ Then get an app and scan the QR code: [Grenade: Agent Remote](https://apps.apple.com/app/grenade-agent-remote/id6818136871) for iPhone (iOS 17 or later), or [the Mac app](https://downloads.holdgrenade.com/mac/Grenade.dmg) (macOS 26 or later).
23
39
 
24
- From the source:
40
+ From the source, which needs the `grenade-protocol` repo checked out next to this one (it is not public, so today this works for the maintainers only):
25
41
 
26
42
  ```bash
27
43
  brew install tmux
@@ -38,7 +54,6 @@ grenade setup
38
54
  ```bash
39
55
  grenade service status # is grenaded installed as a login agent, and running?
40
56
  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
57
 
43
58
  grenade new grenade --cwd ~/projects/grenade --agent claude
44
59
  grenade open grenade # attach your terminal to it (Ctrl-b d to detach)
@@ -56,15 +71,56 @@ grenade push status # push notifications: on or off, through which relay, w
56
71
  grenade push test # send every registered phone a test notification
57
72
  grenade push on # send them also with remote access off, through the main relay
58
73
  grenade push off # send none (grenade push auto: on while remote access is on, the default)
74
+
75
+ grenade voice # your API keys for Talk and dictation: the providers, and which hold a key
76
+ grenade voice key openai # keep a key on this Mac: asked for without showing it, checked with the provider (also: gemini, wispr-flow)
77
+ grenade voice forget openai
78
+
79
+ grenade update # install the latest version now (grenaded also does it by itself)
80
+ grenade update --auto off # stop grenaded installing new versions by itself (grenade update --auto on: back)
81
+ ```
82
+
83
+ Grenade keeps itself up to date: grenaded checks for a new version every few hours, installs it with Homebrew or npm (whichever installed it; on Linux it downloads the release and checks its sha256), and switches over once no session is working; your sessions keep running. With Homebrew this also upgrades its `node` and `tmux` when they are outdated. `brew pin grenade` or `grenade update --auto off` stops it.
84
+
85
+ ### Linux
86
+
87
+ `grenaded` runs on Linux with systemd, Node 22+ and tmux 3.2+. It is tested on Arch Linux (which Omarchy is), x86_64.
88
+
89
+ - **Install.** `install.sh` reads the release Homebrew installs (the tap's formula), downloads that tarball from this repo's releases, checks its sha256, unpacks it into `~/.local/share/grenade` and links `~/.local/bin/grenade`. No sudo, no npm. Running it again updates; `grenade update` and grenaded itself do the same steps. Remove it with `grenade service remove; rm -rf ~/.local/share/grenade ~/.local/bin/grenade`.
90
+ - **Start at login.** A systemd user service, `~/.config/systemd/user/grenade.service`, handled with `systemctl --user` (`grenade service status`). It runs while you are logged in; `loginctl enable-linger $USER` keeps it running after you log out, on a machine nobody sits at.
91
+ - **Firewall.** A firewall that refuses incoming connections (ufw on Omarchy and Ubuntu) keeps a phone on the same Wi‑Fi out until you allow the port: `sudo ufw allow 7788/tcp`. `grenade setup` says so when ufw is on. Through the relay the phone gets in without it.
92
+ - **Watching sessions.** On the phone, or in any terminal with `grenade open <name>`. `grenade terminal` (iTerm2, Terminal.app) and the Mac app are for a Mac.
93
+ - **Not there yet.** A push notification is never held back while you are at the computer: on a Mac it waits while the keyboard or mouse was used in the last two minutes.
94
+
95
+ ### On the Mac
96
+
97
+ Every session is a tmux session (`gr-<name>`), so it survives any window closing; only `grenade kill` ends it. Watch them in the Grenade Mac app or on the phone; no terminal window opens by itself. `grenade open <name>` attaches any terminal, and `grenade terminal` opens every session in one for you:
98
+
99
+ ```bash
100
+ grenade terminal iterm # every session in iTerm2: a tab per group, its sessions side by side
101
+ grenade terminal terminal # every session in a Terminal.app window of its own
102
+ grenade terminal auto # iTerm2 when it is installed, else Terminal.app
103
+ grenade terminal none # the default: no windows
104
+ grenade terminal # what is set
59
105
  ```
60
106
 
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`.
107
+ It takes effect at once, also for sessions already running, and stays across restarts and updates (`~/.grenade/terminal.json`). The first time, macOS may ask whether grenaded (it says `node`) may control iTerm2 or Terminal: allow it, or no window appears. If you clicked Don't Allow: System Settings › Privacy & Security › Automation.
108
+
109
+ `grenade new` in a folder that already has a live session joins that session's **group**: `--alone` starts a group of its own, `--with <session>` joins a specific one. `grenade group` and `grenade ungroup` move sessions later; the phone does the same by drag and drop.
110
+
111
+ #### iTerm2
112
+
113
+ With `grenade terminal iterm` (or `auto` and iTerm2 installed) a group is one tab, its sessions as split panes side by side in group order, following every move. `brew install --cask iterm2` first. Closing a tab or detaching (Ctrl-b d) leaves the agent running.
114
+
115
+ 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. You can host your own relay: [Self-host a relay](https://www.holdgrenade.com/relay).
62
116
 
63
117
  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
118
 
119
+ Talk (a spoken conversation about your sessions, in the Mac app and the iPhone app) and dictation with Wispr Flow (the iPhone's mic) run at a provider, under your own API key: OpenAI or Google's Gemini for Talk, Wispr Flow for dictation. The key is kept on this Mac, in `~/.grenade/voice-keys.json` (readable by you only), and never on a phone. `grenade voice key openai` asks for the key without showing it (or reads it from stdin: `grenade voice key openai < key.txt`), checks it with the provider, and keeps it; `gemini` and `wispr-flow` work the same way. Pasting a key in an app's settings hands it to this Mac in the same way. Each time an app opens a connection to the provider it asks grenaded for a pass that lasts about a minute (fifteen for dictation), so the app never holds the key, and what you say goes straight from the app to the provider, never through grenaded or a relay. `grenade voice` lists the providers and shows a kept key masked (`sk-…a1b2`); `grenade voice forget <provider>` removes it at once (to make the key itself worthless, revoke it at the provider). The apps use this from the Mac app 1.0.78 and the iPhone app 1.0.53; earlier ones kept the key themselves.
120
+
65
121
  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
122
 
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`.
123
+ 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 on [holdgrenade.com/security](https://www.holdgrenade.com/security).
68
124
 
69
125
  ## Develop
70
126
 
@@ -76,4 +132,12 @@ node scripts/pair-smoke.mjs --control-port 7790 # a phone that scanned the QR
76
132
  npm run release # the tarball and the Homebrew formula, locally
77
133
  ```
78
134
 
79
- See `CLAUDE.md` for the architecture and `../grenade-protocol/PROTOCOL.md` for the wire format.
135
+ See `CLAUDE.md` for the architecture. The wire format is `PROTOCOL.md` in `grenade-protocol`, which is not public.
136
+
137
+ The workflow runs the tests and `scripts/smoke.mjs` in an Arch Linux container, then the tests on macOS, before a release.
138
+
139
+ ## Help
140
+
141
+ Something does not work, in any part of Grenade (this CLI, an app, the relay): [open an issue](https://github.com/holdgrenade/grenade-cli/issues). A security problem: [report it privately](https://github.com/holdgrenade/grenade-cli/security/advisories/new).
142
+
143
+ MIT license, see `LICENSE`.