activitysmith-cli 1.11.0 → 1.13.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 +108 -26
- package/package.json +2 -2
- package/src/cli.js +34 -9
package/README.md
CHANGED
|
@@ -57,6 +57,19 @@ activitysmith push \
|
|
|
57
57
|
--subtitle "main"
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Custom Push Notification Icons
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
Set `--icon` to a publicly accessible HTTPS image URL to show an avatar or service logo alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit the subtitle from the notification.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
activitysmith push \
|
|
68
|
+
--title 'MRR just crossed $10,000 🎉' \
|
|
69
|
+
--message "Up 18% this month from 31 new subscriptions." \
|
|
70
|
+
--icon "https://cdn.activitysmith.com/integrations/icons/stripe.png"
|
|
71
|
+
```
|
|
72
|
+
|
|
60
73
|
### Rich Push Notifications with Media
|
|
61
74
|
|
|
62
75
|

|
|
@@ -154,14 +167,65 @@ activitysmith push \
|
|
|
154
167
|
--actions-file "./actions.json"
|
|
155
168
|
```
|
|
156
169
|
|
|
170
|
+
### Push Notification Interruption Levels
|
|
171
|
+
|
|
172
|
+

|
|
173
|
+
|
|
174
|
+
Use `--interruption-level` to choose how urgently iOS presents a Push Notification. Omit it for normal delivery. Explicit `active` has the same behavior as the default.
|
|
175
|
+
|
|
176
|
+
| Value | Behavior |
|
|
177
|
+
| --- | --- |
|
|
178
|
+
| `passive` | Appears quietly in the notification list, without sound or waking the screen. |
|
|
179
|
+
| `active` | Normal delivery, subject to the device's notification settings and Focus. This is the default. |
|
|
180
|
+
| `time-sensitive` | Can bypass Scheduled Summary and Focus when the user allows Time Sensitive Notifications for ActivitySmith. |
|
|
181
|
+
|
|
182
|
+
See Apple's [interruption levels](https://developer.apple.com/documentation/usernotifications/unnotificationinterruptionlevel) for the system behavior.
|
|
183
|
+
|
|
184
|
+
#### Passive
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
activitysmith push \
|
|
188
|
+
--title "Daily summary" \
|
|
189
|
+
--message "All scheduled jobs completed successfully." \
|
|
190
|
+
--interruption-level "passive"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### Active (default)
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
activitysmith push \
|
|
197
|
+
--title "Deployment complete" \
|
|
198
|
+
--message "Your latest changes are live." \
|
|
199
|
+
--interruption-level "active"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Removing the interruption level from this example produces the same delivery behavior.
|
|
203
|
+
|
|
204
|
+
#### Time Sensitive
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
activitysmith push \
|
|
208
|
+
--title "🚨 checkout-api is down" \
|
|
209
|
+
--message "500 errors on 62% of requests. Customers can't complete payments." \
|
|
210
|
+
--interruption-level "time-sensitive"
|
|
211
|
+
```
|
|
212
|
+
|
|
157
213
|
## Live Activities
|
|
158
214
|
|
|
159
215
|
Choose the Live Activity type that matches what you want to show:
|
|
160
216
|
|
|
217
|
+

|
|
218
|
+
|
|
219
|
+
**Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
|
|
220
|
+
|
|
161
221
|

|
|
162
222
|
|
|
163
223
|
**Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
|
|
164
224
|
|
|
225
|
+

|
|
226
|
+
|
|
227
|
+
**Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
|
|
228
|
+
|
|
165
229
|

|
|
166
230
|
|
|
167
231
|
**Metrics**: Track two related values with segmented bars, such as CPU and memory.
|
|
@@ -174,10 +238,6 @@ Choose the Live Activity type that matches what you want to show:
|
|
|
174
238
|
|
|
175
239
|
**Progress**: Show percentage progress for jobs that move continuously toward completion.
|
|
176
240
|
|
|
177
|
-

|
|
178
|
-
|
|
179
|
-
**Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
|
|
180
|
-
|
|
181
241
|

|
|
182
242
|
|
|
183
243
|
**Timer**: Count down from a duration, or count up from 00:00 while a job runs.
|
|
@@ -186,6 +246,24 @@ Choose the Live Activity type that matches what you want to show:
|
|
|
186
246
|
|
|
187
247
|
Use a stable `stream_key` to identify the metric, job, deployment, or system you want to keep visible. The first `activity stream` command starts the Live Activity. Later commands with the same `stream_key` update it.
|
|
188
248
|
|
|
249
|
+
#### Value
|
|
250
|
+
|
|
251
|
+

|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
activitysmith activity stream revenue-today \
|
|
255
|
+
--content-state '{
|
|
256
|
+
"title": "Revenue",
|
|
257
|
+
"type": "value",
|
|
258
|
+
"value": "$1,240",
|
|
259
|
+
"color": "green",
|
|
260
|
+
"icon": { "symbol": "dollarsign.circle", "color": "green" },
|
|
261
|
+
"badge": { "title": "↑ 18%", "color": "purple" }
|
|
262
|
+
}'
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Send a string or number in `value`. Strings keep their formatting, including currency symbols, units, and decimal places.
|
|
266
|
+
|
|
189
267
|
#### Stats
|
|
190
268
|
|
|
191
269
|

|
|
@@ -207,6 +285,27 @@ activitysmith activity stream sales-hourly \
|
|
|
207
285
|
}'
|
|
208
286
|
```
|
|
209
287
|
|
|
288
|
+
#### Alert
|
|
289
|
+
|
|
290
|
+

|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
activitysmith activity stream customer-ops \
|
|
294
|
+
--content-state '{
|
|
295
|
+
"title": "Reactivation",
|
|
296
|
+
"message": "Lumen came back after 2 weeks",
|
|
297
|
+
"type": "alert",
|
|
298
|
+
"icon": {
|
|
299
|
+
"symbol": "cloud.sun",
|
|
300
|
+
"color": "yellow"
|
|
301
|
+
},
|
|
302
|
+
"badge": {
|
|
303
|
+
"title": "Customer",
|
|
304
|
+
"color": "magenta"
|
|
305
|
+
}
|
|
306
|
+
}'
|
|
307
|
+
```
|
|
308
|
+
|
|
210
309
|
#### Metrics
|
|
211
310
|
|
|
212
311
|

|
|
@@ -253,27 +352,6 @@ activitysmith activity stream search-reindex \
|
|
|
253
352
|
}'
|
|
254
353
|
```
|
|
255
354
|
|
|
256
|
-
#### Alert
|
|
257
|
-
|
|
258
|
-

|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
activitysmith activity stream customer-ops \
|
|
262
|
-
--content-state '{
|
|
263
|
-
"title": "Reactivation",
|
|
264
|
-
"message": "Lumen came back after 2 weeks",
|
|
265
|
-
"type": "alert",
|
|
266
|
-
"icon": {
|
|
267
|
-
"symbol": "cloud.sun",
|
|
268
|
-
"color": "yellow"
|
|
269
|
-
},
|
|
270
|
-
"badge": {
|
|
271
|
-
"title": "Customer",
|
|
272
|
-
"color": "magenta"
|
|
273
|
-
}
|
|
274
|
-
}'
|
|
275
|
-
```
|
|
276
|
-
|
|
277
355
|
#### Timer
|
|
278
356
|
|
|
279
357
|

|
|
@@ -434,7 +512,7 @@ activitysmith activity stream search-reindex \
|
|
|
434
512
|
|
|
435
513
|
Use `--secondary-action` when you want a second button beside the primary `--action`.
|
|
436
514
|
|
|
437
|
-
The secondary action button is supported for `alert`, `
|
|
515
|
+
The secondary action button is supported for `value`, `alert`, `segmented_progress`, and `progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes.
|
|
438
516
|
|
|
439
517
|
```bash
|
|
440
518
|
activitysmith activity stream agent-approval \
|
|
@@ -601,3 +679,7 @@ The CLI exits non-zero on non-2xx responses and prints the API error body. That
|
|
|
601
679
|
### [NPM Package](https://www.npmjs.com/package/activitysmith-cli)
|
|
602
680
|
|
|
603
681
|
Install the ActivitySmith CLI from npm
|
|
682
|
+
|
|
683
|
+
### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-cli)
|
|
684
|
+
|
|
685
|
+
View the CLI source on GitHub
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Command-line interface for ActivitySmith. Send Push Notifications, start, update, and end Live Activities, and set App Icon Badge Counts from your terminal.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"activitysmith",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test": "node --test"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"activitysmith": "^1.
|
|
45
|
+
"activitysmith": "^1.13.0",
|
|
46
46
|
"commander": "^12.1.0"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { Command, InvalidArgumentError } from "commander";
|
|
3
|
+
import { Command, InvalidArgumentError, Option } from "commander";
|
|
4
4
|
import { loadMetadata } from "./metadata.js";
|
|
5
5
|
import ActivitySmith from "activitysmith";
|
|
6
6
|
import { createRequire } from "module";
|
|
@@ -214,9 +214,8 @@ const addContentStateOptions = (command, { includeAutoDismiss, includeAutoDismis
|
|
|
214
214
|
parseNumberOption("percentage")
|
|
215
215
|
)
|
|
216
216
|
.option(
|
|
217
|
-
"--value <
|
|
218
|
-
"
|
|
219
|
-
parseNumberOption("value")
|
|
217
|
+
"--value <value>",
|
|
218
|
+
"Formatted Value readout, or numeric progress value"
|
|
220
219
|
)
|
|
221
220
|
.option(
|
|
222
221
|
"--upper-limit <number>",
|
|
@@ -388,10 +387,11 @@ const validateContentState = (contentState, mode) => {
|
|
|
388
387
|
normalizedType !== "metrics" &&
|
|
389
388
|
normalizedType !== "stats" &&
|
|
390
389
|
normalizedType !== "alert" &&
|
|
391
|
-
normalizedType !== "timer"
|
|
390
|
+
normalizedType !== "timer" &&
|
|
391
|
+
normalizedType !== "value"
|
|
392
392
|
) {
|
|
393
393
|
throw new Error(
|
|
394
|
-
"contentState.type must be one of: segmented_progress, progress, metrics, stats, alert, timer"
|
|
394
|
+
"contentState.type must be one of: segmented_progress, progress, metrics, stats, alert, timer, value"
|
|
395
395
|
);
|
|
396
396
|
}
|
|
397
397
|
|
|
@@ -416,7 +416,7 @@ const validateContentState = (contentState, mode) => {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
if (hasValue !== hasUpperLimit) {
|
|
419
|
+
if (normalizedType !== "value" && hasValue !== hasUpperLimit) {
|
|
420
420
|
throw new Error(
|
|
421
421
|
"contentState.value and contentState.upperLimit must be provided together"
|
|
422
422
|
);
|
|
@@ -450,7 +450,7 @@ const validateContentState = (contentState, mode) => {
|
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
const hasSegmentedFields = hasNumberOfSteps || hasCurrentStep || hasStepColor;
|
|
453
|
-
const hasProgressFields = hasPercentage || hasValue || hasUpperLimit;
|
|
453
|
+
const hasProgressFields = hasPercentage || (hasValue && normalizedType !== "value") || hasUpperLimit;
|
|
454
454
|
const hasAlertFields = hasMessage || hasIcon || hasBadge;
|
|
455
455
|
|
|
456
456
|
if (hasIcon) {
|
|
@@ -549,6 +549,16 @@ const validateContentState = (contentState, mode) => {
|
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
+
if (normalizedType === "value") {
|
|
553
|
+
if (!hasValue || !(typeof contentState.value === "string" || Number.isFinite(contentState.value))) {
|
|
554
|
+
throw new Error("Value requires contentState.value as a string or finite number");
|
|
555
|
+
}
|
|
556
|
+
if (hasProgressFields || hasSegmentedFields || hasMetrics || hasTimerFields || hasMessage) {
|
|
557
|
+
throw new Error("Do not mix Value with other Live Activity type fields");
|
|
558
|
+
}
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
|
|
552
562
|
const effectiveType = normalizedType;
|
|
553
563
|
|
|
554
564
|
if (mode === "start" || mode === "stream") {
|
|
@@ -850,7 +860,9 @@ const buildContentStateFromOptions = (options) => {
|
|
|
850
860
|
}
|
|
851
861
|
|
|
852
862
|
if (options.value !== undefined) {
|
|
853
|
-
contentState.value = options.value
|
|
863
|
+
contentState.value = options.type === "value"
|
|
864
|
+
? options.value
|
|
865
|
+
: parseNumberOption("value")(options.value);
|
|
854
866
|
}
|
|
855
867
|
|
|
856
868
|
if (options.upperLimit !== undefined) {
|
|
@@ -1253,6 +1265,14 @@ program
|
|
|
1253
1265
|
"--media <url>",
|
|
1254
1266
|
"HTTPS URL for image, audio, or video shown when the notification is expanded"
|
|
1255
1267
|
)
|
|
1268
|
+
.option("--icon <url>", "HTTPS image URL for the notification icon, such as an avatar or service logo")
|
|
1269
|
+
.addOption(
|
|
1270
|
+
new Option("--interruption-level <level>", "Notification interruption level").choices([
|
|
1271
|
+
"passive",
|
|
1272
|
+
"active",
|
|
1273
|
+
"time-sensitive",
|
|
1274
|
+
])
|
|
1275
|
+
)
|
|
1256
1276
|
.option("--redirection <url>", "HTTPS or shortcuts:// URL opened when notification is tapped")
|
|
1257
1277
|
.option("--actions <json>", "Actions JSON array (max 4)")
|
|
1258
1278
|
.option("--actions-file <path>", "Path to actions JSON array file")
|
|
@@ -1289,6 +1309,11 @@ program
|
|
|
1289
1309
|
options.media !== undefined
|
|
1290
1310
|
? normalizeHttpsUrl(options.media, "media")
|
|
1291
1311
|
: undefined,
|
|
1312
|
+
icon:
|
|
1313
|
+
options.icon !== undefined
|
|
1314
|
+
? normalizeHttpsUrl(options.icon, "icon")
|
|
1315
|
+
: undefined,
|
|
1316
|
+
interruption_level: options.interruptionLevel,
|
|
1292
1317
|
redirection:
|
|
1293
1318
|
options.redirection !== undefined
|
|
1294
1319
|
? normalizeOpenUrl(options.redirection, "redirection")
|