@pingroom/cli 0.4.0 → 0.6.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.
- package/README.md +158 -2
- package/bin/pingroom.js +1138 -28
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Send PingRoom pings — and ask a human a question and block for their answer —
|
|
4
4
|
from CI, scripts, and agents. Delivered as push straight to your phone.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
One dependency (`qrcode-terminal`, used only to draw the pairing QR). Works
|
|
7
|
+
anywhere Node ≥ 20 runs.
|
|
7
8
|
|
|
8
9
|
```bash
|
|
9
10
|
npx @pingroom/cli ping -w "$PINGROOM_WEBHOOK_URL" -m "Deploy succeeded ✅"
|
|
@@ -11,9 +12,61 @@ npx @pingroom/cli ping -w "$PINGROOM_WEBHOOK_URL" -m "Deploy succeeded ✅"
|
|
|
11
12
|
|
|
12
13
|
Commands: `ping` (send), `ask` (ask a human), `watch` (block on an existing
|
|
13
14
|
question), `list`, `cancel`, `handoff` (hand a decision to a specific human),
|
|
14
|
-
|
|
15
|
+
`handoffs` (list open or recent Handoffs), `live` (lock-screen progress card),
|
|
16
|
+
`hook` (Claude Code), `config`, and `logout`.
|
|
15
17
|
Run `pingroom --help` for the full reference.
|
|
16
18
|
|
|
19
|
+
## Connecting
|
|
20
|
+
|
|
21
|
+
Run `pingroom` with no arguments. It prints a QR code — scan it with the PingRoom
|
|
22
|
+
app and pick both the account and the room the agent delivers to — or take the
|
|
23
|
+
emailed-code fallback.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
$ pingroom
|
|
27
|
+
Not connected. How do you want to connect?
|
|
28
|
+
1) Scan a QR code with the PingRoom app
|
|
29
|
+
2) Email me a code
|
|
30
|
+
Choose [1]:
|
|
31
|
+
|
|
32
|
+
[QR]
|
|
33
|
+
Or open: https://pingroom.io/app/agents/pair?token=…
|
|
34
|
+
Waiting for approval… ✓ Connected as @agt_ab12cd34ef → #Project X
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
There is deliberately no `login` command: being unconnected is a state the tool
|
|
38
|
+
resolves, not one you have to discover. Once connected, bare `pingroom` prints
|
|
39
|
+
that status line followed by the usual help.
|
|
40
|
+
|
|
41
|
+
The credential lands in `~/.pingroom/credentials.json` (mode `0600`, inside a
|
|
42
|
+
`0700` directory). `PINGROOM_HOME` moves that directory; `pingroom logout`
|
|
43
|
+
clears it.
|
|
44
|
+
|
|
45
|
+
**CI is unaffected.** `PINGROOM_TOKEN` in the environment always outranks the
|
|
46
|
+
stored credential, and a non-interactive shell never prompts and never draws a
|
|
47
|
+
QR — a command that needs a credential and has none fails with exit `2` pointing
|
|
48
|
+
at `PINGROOM_TOKEN`.
|
|
49
|
+
|
|
50
|
+
### Local settings
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pingroom config set default_room ab12cd # fallback for --room
|
|
54
|
+
pingroom config set api_url https://api.pingroom.io
|
|
55
|
+
pingroom config get default_room
|
|
56
|
+
pingroom config list
|
|
57
|
+
pingroom config set api_url "" # an empty value clears the key
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Precedence, highest first:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
explicit flag > env var > ~/.pingroom/config.json > built-in default
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
So `--room` beats `PINGROOM_ROOM` beats `default_room` (and, last of all, the
|
|
67
|
+
room the credential was paired to); `--api` beats `PINGROOM_API_URL` beats
|
|
68
|
+
`api_url`.
|
|
69
|
+
|
|
17
70
|
## Getting a webhook URL
|
|
18
71
|
|
|
19
72
|
In the PingRoom app, open a room → **Connections → Incoming webhooks → Add**. Copy the
|
|
@@ -28,6 +81,8 @@ pingroom ping [options]
|
|
|
28
81
|
-t, --title <text> Ping title (<= 40 chars)
|
|
29
82
|
-a, --action <1-4> Quick-action slot to attribute the ping to
|
|
30
83
|
-d, --data <json> Extra JSON data, e.g. '{"commit":"abc123"}'
|
|
84
|
+
--url <https-url> Make the ping a tappable link (absolute http(s) URL)
|
|
85
|
+
--button-label <t> Link button text (<= 26 chars; requires --url)
|
|
31
86
|
--require-ack Keep the ping open until an eligible recipient acknowledges it
|
|
32
87
|
--ack-timeout <s> Ack deadline in seconds (requires --require-ack)
|
|
33
88
|
-w, --webhook <url> Room webhook URL (or env PINGROOM_WEBHOOK_URL)
|
|
@@ -48,9 +103,110 @@ pingroom ping -w "$PINGROOM_WEBHOOK_URL" -m "Production health check failed" \
|
|
|
48
103
|
Webhook timeouts accept 1–86400 seconds. Agent-token room pings accept
|
|
49
104
|
60–86400 seconds.
|
|
50
105
|
|
|
106
|
+
To attach a tappable link button (a "link ping"), add `--url` and optionally
|
|
107
|
+
`--button-label`. They fold into the structured `data` object as
|
|
108
|
+
`{"url": ..., "button_label": ...}` — the same convention accepted raw via
|
|
109
|
+
`--data`:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pingroom ping -w "$PINGROOM_WEBHOOK_URL" -m "Build 512 ready" \
|
|
113
|
+
--url https://ci.example.com/builds/512 --button-label "Open build"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The URL must be absolute http(s) (≤ 2048 chars); the label caps at 26 chars.
|
|
117
|
+
|
|
51
118
|
Exit codes: `0` success · `1` delivery failed · `2` bad usage. So CI fails loudly if a
|
|
52
119
|
ping doesn't land.
|
|
53
120
|
|
|
121
|
+
## Live Activities (`pingroom live`)
|
|
122
|
+
|
|
123
|
+
A **live-status stream** is one long-running thing shown as a self-updating card
|
|
124
|
+
on the Lock Screen (iOS Live Activity / Dynamic Island, Android live update, and
|
|
125
|
+
a full inline card in the app). `start` opens it with one alert, `update` moves
|
|
126
|
+
it **silently**, `end` closes it with one completion alert.
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
pingroom live <start|update|end|get> [options]
|
|
130
|
+
|
|
131
|
+
-c, --correlation-id <id> The stream key — reuse it for every ping (required)
|
|
132
|
+
--template <name> start only: status | steps | progress | metrics |
|
|
133
|
+
countdown | question | matchup (fixed at creation)
|
|
134
|
+
--steps <a,b,c> start only: 2-8 comma-separated step labels
|
|
135
|
+
-m, --message <text> The card's live message line
|
|
136
|
+
--progress <0..1> Progress bar / Dynamic Island gauge
|
|
137
|
+
--step <n> Current step index (steps template)
|
|
138
|
+
--metric <label:value> Repeatable, up to 3 (metrics template)
|
|
139
|
+
--deadline-at <epoch> Countdown target (countdown template)
|
|
140
|
+
--eta-at <epoch> Live ETA (status/progress templates)
|
|
141
|
+
--prompt <text> The ask (question template)
|
|
142
|
+
--option <value:label> Repeatable, up to 4 (question template)
|
|
143
|
+
--left <label:value> Left side (matchup template)
|
|
144
|
+
--right <label:value> Right side (matchup template)
|
|
145
|
+
--center <text> Center score/clock, <= 40 (matchup template)
|
|
146
|
+
--accent-override <#rrggbb> Semantic accent for this frame
|
|
147
|
+
--failed end only: finish as failed instead of done
|
|
148
|
+
-t, --title <text> Card title (<= 40 chars)
|
|
149
|
+
-a, --action <1-4> Quick-action slot supplying the icon and sound
|
|
150
|
+
--require-ack Add an Acknowledge button
|
|
151
|
+
--ack-timeout <s> Ack deadline in seconds
|
|
152
|
+
-w, --webhook <url> Room webhook URL instead of a token
|
|
153
|
+
--token <token> Agent access token (or env PINGROOM_TOKEN)
|
|
154
|
+
--room <code> Room invite code (used with --token)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Works with either an agent token (`--token`, needs the `pingroom:live:write`
|
|
158
|
+
scope) or a room's incoming webhook (`--webhook`, Pro) — both speak the same
|
|
159
|
+
`live_status` contract.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Track a deploy end to end.
|
|
163
|
+
pingroom live start -c deploy-42 --template steps \
|
|
164
|
+
--steps "Build,Test,Deploy,Verify" -t "Release 1.4.0"
|
|
165
|
+
pingroom live update -c deploy-42 --step 2 -m "Deploying to prod"
|
|
166
|
+
pingroom live end -c deploy-42 -m "Shipped 1.4.0" # add --failed to fail it
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
All 7 templates are expressible:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# question — up to 4 options. A bare token is both value and label.
|
|
173
|
+
pingroom live start -c q1 --template question \
|
|
174
|
+
--prompt "Deploy where?" --option prod:Production --option staging:Staging
|
|
175
|
+
|
|
176
|
+
# matchup — two sides plus a center score/clock.
|
|
177
|
+
pingroom live start -c game-3 --template matchup \
|
|
178
|
+
--left ARS:2 --right CHE:1 --center "68'"
|
|
179
|
+
|
|
180
|
+
# metrics — up to 3 counters.
|
|
181
|
+
pingroom live start -c host-1 --template metrics --metric "CPU:45%" --metric "RPS:1.2k"
|
|
182
|
+
|
|
183
|
+
# countdown — a large live timer.
|
|
184
|
+
pingroom live start -c win-9 --template countdown --deadline-at 1750003600
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`--accent-override` takes `#rrggbb` **or** a bare `rrggbb` (case-insensitive;
|
|
188
|
+
it is normalized to lowercase with the `#` before it is sent). Pass it bare, or
|
|
189
|
+
quote it — an *unquoted* `#` starts a comment in `sh`, `bash` and `zsh`, which
|
|
190
|
+
eats the hex and the rest of the line, and the CLI then exits `2` with
|
|
191
|
+
`option --accent-override needs a value`:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
pingroom live update -c deploy-42 --accent-override e33122 # ok
|
|
195
|
+
pingroom live update -c deploy-42 --accent-override '#e33122' # ok
|
|
196
|
+
pingroom live update -c deploy-42 --accent-override #e33122 # shell eats it
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Always `end` a stream.** Terminal `done`/`failed` pings are never rate-limited
|
|
200
|
+
or quota-blocked, precisely so a card can't be metered into hanging open on
|
|
201
|
+
someone's Lock Screen. Abandoned streams are swept after ~15 minutes.
|
|
202
|
+
|
|
203
|
+
`--template` and `--steps` are fixed when the stream is created; passing them to
|
|
204
|
+
`update`/`end` is a usage error rather than a silent no-op. `pingroom live get`
|
|
205
|
+
(agent token only) reads a stream back — every stored field — so a restarted
|
|
206
|
+
producer reconciles instead of opening a duplicate.
|
|
207
|
+
|
|
208
|
+
Full protocol: <https://pingroom.io/liveactivities.md>
|
|
209
|
+
|
|
54
210
|
## GitHub Actions
|
|
55
211
|
|
|
56
212
|
```yaml
|