activitysmith-cli 1.11.0 → 1.12.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 (3) hide show
  1. package/README.md +49 -37
  2. package/package.json +2 -2
  3. package/src/cli.js +20 -8
package/README.md CHANGED
@@ -158,33 +158,41 @@ activitysmith push \
158
158
 
159
159
  Choose the Live Activity type that matches what you want to show:
160
160
 
161
- ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png)
161
+ - ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png) **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
162
162
 
163
- **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
163
+ - ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png) **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
164
164
 
165
- ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
165
+ - ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png) **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
166
166
 
167
- **Metrics**: Track two related values with segmented bars, such as CPU and memory.
167
+ - ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) **Metrics**: Track two related values with segmented bars, such as CPU and memory.
168
168
 
169
- ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png)
169
+ - ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png) **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
170
170
 
171
- **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
171
+ - ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png) **Progress**: Show percentage progress for jobs that move continuously toward completion.
172
172
 
173
- ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png)
173
+ - ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png) **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
174
174
 
175
- **Progress**: Show percentage progress for jobs that move continuously toward completion.
176
-
177
- ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png)
175
+ ### Start & Update Live Activity
178
176
 
179
- **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
177
+ 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.
180
178
 
181
- ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png)
179
+ #### Value
182
180
 
183
- **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
181
+ ![Value Live Activity stream example](https://cdn.activitysmith.com/features/value-live-activity.png)
184
182
 
185
- ### Start & Update Live Activity
183
+ ```bash
184
+ activitysmith activity stream revenue-today \
185
+ --content-state '{
186
+ "title": "Revenue",
187
+ "type": "value",
188
+ "value": "$1,240",
189
+ "color": "green",
190
+ "icon": { "symbol": "dollarsign.circle", "color": "green" },
191
+ "badge": { "title": "↑ 18%", "color": "purple" }
192
+ }'
193
+ ```
186
194
 
187
- 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.
195
+ Send a string or number in `value`. Strings keep their formatting, including currency symbols, units, and decimal places.
188
196
 
189
197
  #### Stats
190
198
 
@@ -207,6 +215,27 @@ activitysmith activity stream sales-hourly \
207
215
  }'
208
216
  ```
209
217
 
218
+ #### Alert
219
+
220
+ ![Alert Live Activity stream example](https://cdn.activitysmith.com/features/alert-live-activity.png)
221
+
222
+ ```bash
223
+ activitysmith activity stream customer-ops \
224
+ --content-state '{
225
+ "title": "Reactivation",
226
+ "message": "Lumen came back after 2 weeks",
227
+ "type": "alert",
228
+ "icon": {
229
+ "symbol": "cloud.sun",
230
+ "color": "yellow"
231
+ },
232
+ "badge": {
233
+ "title": "Customer",
234
+ "color": "magenta"
235
+ }
236
+ }'
237
+ ```
238
+
210
239
  #### Metrics
211
240
 
212
241
  ![Metrics Live Activity stream example](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
@@ -253,27 +282,6 @@ activitysmith activity stream search-reindex \
253
282
  }'
254
283
  ```
255
284
 
256
- #### Alert
257
-
258
- ![Alert Live Activity stream example](https://cdn.activitysmith.com/features/alert-live-activity.png)
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
285
  #### Timer
278
286
 
279
287
  ![Timer Live Activity stream example](https://cdn.activitysmith.com/features/timer-live-activity.png)
@@ -434,7 +442,7 @@ activitysmith activity stream search-reindex \
434
442
 
435
443
  Use `--secondary-action` when you want a second button beside the primary `--action`.
436
444
 
437
- The secondary action button is supported for `alert`, `progress`, and `segmented_progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes.
445
+ 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
446
 
439
447
  ```bash
440
448
  activitysmith activity stream agent-approval \
@@ -601,3 +609,7 @@ The CLI exits non-zero on non-2xx responses and prints the API error body. That
601
609
  ### [NPM Package](https://www.npmjs.com/package/activitysmith-cli)
602
610
 
603
611
  Install the ActivitySmith CLI from npm
612
+
613
+ ### [Source Code](https://github.com/ActivitySmithHQ/activitysmith-cli)
614
+
615
+ View the CLI source on GitHub
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith-cli",
3
- "version": "1.11.0",
3
+ "version": "1.12.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.11.0",
45
+ "activitysmith": "^1.12.0",
46
46
  "commander": "^12.1.0"
47
47
  }
48
48
  }
package/src/cli.js CHANGED
@@ -214,9 +214,8 @@ const addContentStateOptions = (command, { includeAutoDismiss, includeAutoDismis
214
214
  parseNumberOption("percentage")
215
215
  )
216
216
  .option(
217
- "--value <number>",
218
- "Content state value",
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) {