activitysmith-cli 1.4.0 → 1.7.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 +154 -18
  2. package/package.json +2 -2
  3. package/src/cli.js +109 -11
package/README.md CHANGED
@@ -5,7 +5,7 @@ CLI wrapper for the ActivitySmith API using the official Node SDK.
5
5
  ## Table of Contents
6
6
 
7
7
  - [Install](#install)
8
- - [Install Skill (Codex/Claude/Other Skills-Compatible Agents)](#install-skill-codexclaudeother-skills-compatible-agents)
8
+ - [Agent Skill](#agent-skill)
9
9
  - [Auth](#auth)
10
10
  - [Push Notifications](#push-notifications)
11
11
  - [Send Push Notification](#send-push-notification)
@@ -15,6 +15,8 @@ CLI wrapper for the ActivitySmith API using the official Node SDK.
15
15
  - [Start & Update Live Activity](#start--update-live-activity)
16
16
  - [End Live Activity](#end-live-activity)
17
17
  - [Live Activity Action](#live-activity-action)
18
+ - [Icons and Badges](#icons-and-badges)
19
+ - [Live Activity Colors](#live-activity-colors)
18
20
  - [Channels](#channels)
19
21
  - [Widgets](#widgets)
20
22
  - [Aliases](#aliases)
@@ -27,12 +29,33 @@ CLI wrapper for the ActivitySmith API using the official Node SDK.
27
29
  npm install -g activitysmith-cli
28
30
  ```
29
31
 
30
- ## Install Skill (Codex/Claude/Other Skills-Compatible Agents)
32
+ ## Agent Skill
33
+
34
+ <p align="center">
35
+ <img src="https://cdn.activitysmith.com/features/apple-shortcut-actions.png" alt="ActivitySmith Push Notification Actions with an Apple Shortcut action" width="680" />
36
+ </p>
37
+
38
+ The ActivitySmith skill helps coding agents decide when and how to notify you.
39
+
40
+ Use it for prompts like:
41
+
42
+ - "Notify me when you're done."
43
+ - "Send me a push notification if you get blocked."
44
+ - "When the task finishes, the notification tap should run my Test Shortcut."
45
+ - "Show progress on my Lock Screen while you work."
46
+
47
+ The skill maps those requests to the CLI:
48
+
49
+ - Push Notifications for completion, blockers, and review requests
50
+ - `shortcuts://` redirection for a specific iPhone Shortcut
51
+ - action buttons for follow-up links or Shortcut buttons
52
+ - Live Activities for long-running progress
53
+ - widget metrics for values that should stay visible
31
54
 
32
55
  Install the public skill from this repo:
33
56
 
34
57
  ```bash
35
- npx skills add ActivitySmithHQ/activitysmith-cli --skill activitysmith
58
+ npx -y skills@latest add ActivitySmithHQ/activitysmith-cli --skill activitysmith
36
59
  ```
37
60
 
38
61
  Skill path in this repo:
@@ -41,7 +64,7 @@ Skill path in this repo:
41
64
  skills/activitysmith
42
65
  ```
43
66
 
44
- The skill is agent-neutral and uses `ACTIVITYSMITH_API_KEY` auth plus the same CLI commands shown below.
67
+ The skill is agent-neutral and recipe-driven. It uses `ACTIVITYSMITH_API_KEY` auth plus the same CLI commands shown below.
45
68
 
46
69
  ## Auth
47
70
 
@@ -96,7 +119,7 @@ What will work:
96
119
  <img src="https://cdn.activitysmith.com/features/actionable-push-notifications-2.png" alt="Actionable push notification example" width="680" />
97
120
  </p>
98
121
 
99
- Actionable push notifications can open a URL on tap or trigger actions when someone long-presses the notification.
122
+ Push notification `--redirection` and `--actions` are optional. Use them to open HTTPS URLs, run a specific iPhone Shortcut with a `shortcuts://run-shortcut?name=...` URL, or trigger backend webhook workflows.
100
123
  Webhooks are executed by the ActivitySmith backend.
101
124
 
102
125
  ```bash
@@ -110,6 +133,11 @@ activitysmith push \
110
133
  "type": "open_url",
111
134
  "url": "https://github.com/org/repo/actions/runs/123456789"
112
135
  },
136
+ {
137
+ "title": "Chat with Jarvis",
138
+ "type": "open_url",
139
+ "url": "shortcuts://run-shortcut?name=Jarvis"
140
+ },
113
141
  {
114
142
  "title": "Create Incident",
115
143
  "type": "webhook",
@@ -135,13 +163,14 @@ activitysmith push \
135
163
 
136
164
  ## Live Activities
137
165
 
138
- There are five types of Live Activities:
166
+ There are six types of Live Activities:
139
167
 
140
168
  - `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
141
169
  - `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
142
170
  - `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
143
171
  - `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
144
172
  - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
173
+ - `timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs
145
174
 
146
175
  ### Start & Update Live Activity
147
176
 
@@ -265,13 +294,30 @@ activitysmith activity stream customer-ops \
265
294
  }'
266
295
  ```
267
296
 
268
- The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
297
+ #### Timer
269
298
 
270
- - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
271
- - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
272
- - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
299
+ <p align="center">
300
+ <img
301
+ src="https://cdn.activitysmith.com/features/timer-live-activity.png"
302
+ alt="Timer Live Activity showing a benchmark run countdown"
303
+ width="680"
304
+ />
305
+ </p>
273
306
 
274
- `icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.
307
+ ```bash
308
+ activitysmith activity stream benchmark-run \
309
+ --content-state '{
310
+ "title": "Benchmark Run",
311
+ "subtitle": "sampling",
312
+ "type": "timer",
313
+ "durationSeconds": 300,
314
+ "color": "cyan"
315
+ }'
316
+ ```
317
+
318
+ For a countdown, send `duration_seconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `duration_seconds` out unless you want to change the timer.
319
+
320
+ To start at 00:00 and count up, set `counts_down: false` and leave out `duration_seconds`.
275
321
 
276
322
  ### End Live Activity
277
323
 
@@ -293,8 +339,11 @@ activitysmith activity end-stream prod-web-1 \
293
339
 
294
340
  ### Live Activity Action
295
341
 
296
- Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
297
- For Alert Live Activities, set `color` in `--content-state` to tint the action button. `icon.color` and `badge.color` only affect the icon and badge.
342
+ Live Activities can include one optional action button.
343
+
344
+ - `open_url`: open an HTTPS URL.
345
+ - `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
346
+ - `webhook`: trigger a backend GET/POST workflow.
298
347
 
299
348
  <p align="center">
300
349
  <img
@@ -318,12 +367,30 @@ activitysmith activity stream prod-web-1 \
318
367
  ]
319
368
  }' \
320
369
  --action '{
321
- "title": "Open Dashboard",
370
+ "title": "Dashboard",
322
371
  "type": "open_url",
323
372
  "url": "https://ops.example.com/servers/prod-web-1"
324
373
  }'
325
374
  ```
326
375
 
376
+ #### Apple Shortcut action
377
+
378
+ ```bash
379
+ activitysmith activity stream deploy-payments-api \
380
+ --content-state '{
381
+ "title": "Deploying payments-api",
382
+ "subtitle": "Running database migrations",
383
+ "type": "segmented_progress",
384
+ "numberOfSteps": 5,
385
+ "currentStep": 3
386
+ }' \
387
+ --action '{
388
+ "title": "Chat with Jarvis",
389
+ "type": "open_url",
390
+ "url": "shortcuts://run-shortcut?name=Jarvis"
391
+ }'
392
+ ```
393
+
327
394
  #### Webhook action
328
395
 
329
396
  ```bash
@@ -347,6 +414,71 @@ activitysmith activity stream search-reindex \
347
414
  }'
348
415
  ```
349
416
 
417
+ ### Icons and Badges
418
+
419
+ Add more context to Live Activities with icons and badges.
420
+
421
+ #### Icon
422
+
423
+ Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
424
+
425
+ <p align="center">
426
+ <img
427
+ src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png"
428
+ alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen"
429
+ width="680"
430
+ />
431
+ </p>
432
+
433
+ ```bash
434
+ activitysmith activity stream prod-web-1 \
435
+ --content-state '{
436
+ "title": "Server Health",
437
+ "subtitle": "prod-web-1",
438
+ "type": "metrics",
439
+ "icon": { "symbol": "server.rack", "color": "blue" },
440
+ "metrics": [
441
+ { "label": "CPU", "value": 18, "unit": "%" },
442
+ { "label": "MEM", "value": 42, "unit": "%" }
443
+ ]
444
+ }'
445
+ ```
446
+
447
+ The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
448
+
449
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
450
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
451
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
452
+
453
+ #### Badge
454
+
455
+ Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
456
+
457
+ <p align="center">
458
+ <img
459
+ src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png"
460
+ alt="Progress Live Activity with a badge on the iPhone Lock Screen"
461
+ width="680"
462
+ />
463
+ </p>
464
+
465
+ ```bash
466
+ activitysmith activity stream nightly-database-backup \
467
+ --content-state '{
468
+ "title": "Nightly Database Backup",
469
+ "subtitle": "verify restore",
470
+ "type": "progress",
471
+ "badge": { "title": "S3", "color": "cyan" },
472
+ "percentage": 62
473
+ }'
474
+ ```
475
+
476
+ ### Live Activity Colors
477
+
478
+ Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
479
+
480
+ `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
481
+
350
482
  ## Channels
351
483
 
352
484
  Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
@@ -411,10 +543,14 @@ Or use flags to build the rest of the payload:
411
543
  - `--percentage <number>`
412
544
  - `--value <number>`
413
545
  - `--upper-limit <number>`
546
+ - `--duration-seconds <number>`
547
+ - `--counts-down <true|false>`
414
548
  - `--color <color>`
415
549
  - `--step-color <color>`
416
550
  - `--auto-dismiss-minutes <number>`
417
551
 
552
+ For `timer`, use `--duration-seconds` for a countdown. To start at 00:00 and count up, use `--counts-down false` and leave out `--duration-seconds`.
553
+
418
554
  Live Activity action options:
419
555
 
420
556
  - `--action <json>`
@@ -431,10 +567,10 @@ Widget metric options:
431
567
 
432
568
  Required fields:
433
569
 
434
- - `activity stream`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`, or `--value` with `--upper-limit`
435
- - `activity start`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`, or `--value` with `--upper-limit`
436
- - `activity update`: `--title`, plus `--metrics`, `--current-step`, `--percentage`, or `--value` with `--upper-limit`
437
- - `activity end`: `--title`, plus `--metrics`, `--current-step`, `--percentage`, or `--value` with `--upper-limit`
570
+ - `activity stream`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`, `--value` with `--upper-limit`, or timer fields
571
+ - `activity start`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`, `--value` with `--upper-limit`, or timer fields
572
+ - `activity update`: `--title`, plus `--metrics`, `--current-step`, `--percentage`, `--value` with `--upper-limit`, or timer fields
573
+ - `activity end`: `--title`, plus `--metrics`, `--current-step`, `--percentage`, `--value` with `--upper-limit`, or timer fields
438
574
  - `activity end-stream`: no content state is required, but if you provide one it follows the same rules as `activity end`
439
575
 
440
576
  ## Output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith-cli",
3
- "version": "1.4.0",
3
+ "version": "1.7.0",
4
4
  "description": "Command-line interface for ActivitySmith. Send push notifications and manage Live Activities from your terminal.",
5
5
  "keywords": [
6
6
  "activitysmith",
@@ -40,7 +40,7 @@
40
40
  "lint": "node --check src/cli.js"
41
41
  },
42
42
  "dependencies": {
43
- "activitysmith": "^1.4.0",
43
+ "activitysmith": "^1.7.0",
44
44
  "commander": "^12.1.0"
45
45
  }
46
46
  }
package/src/cli.js CHANGED
@@ -37,6 +37,22 @@ const parseNumberOption = (label) => (value) => {
37
37
  return parsed;
38
38
  };
39
39
 
40
+ const parseBooleanOption = (label) => (value) => {
41
+ if (typeof value !== "string") {
42
+ throw new InvalidArgumentError(`${label} must be true or false`);
43
+ }
44
+
45
+ const normalized = value.trim().toLowerCase();
46
+ if (normalized === "true") {
47
+ return true;
48
+ }
49
+ if (normalized === "false") {
50
+ return false;
51
+ }
52
+
53
+ throw new InvalidArgumentError(`${label} must be true or false`);
54
+ };
55
+
40
56
  const parseChannelsOption = (value) => {
41
57
  if (typeof value !== "string") {
42
58
  throw new InvalidArgumentError("channels must be a comma-separated string");
@@ -97,6 +113,37 @@ const normalizeHttpsUrl = (value, label) => {
97
113
  return parsed.toString();
98
114
  };
99
115
 
116
+ const normalizeUrlWithSchemes = (value, label, schemes) => {
117
+ if (typeof value !== "string" || value.trim().length === 0) {
118
+ throw new Error(`${label} must be a non-empty string`);
119
+ }
120
+
121
+ let parsed;
122
+ try {
123
+ parsed = new URL(value.trim());
124
+ } catch {
125
+ throw new Error(`${label} must be a valid URL`);
126
+ }
127
+
128
+ const allowedProtocols = schemes.map((scheme) => `${scheme}:`);
129
+ if (!allowedProtocols.includes(parsed.protocol)) {
130
+ throw new Error(`${label} must use ${schemes.join(" or ")}`);
131
+ }
132
+
133
+ return parsed.toString();
134
+ };
135
+
136
+ const normalizeActionUrl = (value, label, type) => {
137
+ if (type === "open_url") {
138
+ return normalizeUrlWithSchemes(value, label, ["https", "shortcuts"]);
139
+ }
140
+
141
+ return normalizeHttpsUrl(value, label);
142
+ };
143
+
144
+ const normalizeOpenUrl = (value, label) =>
145
+ normalizeUrlWithSchemes(value, label, ["https", "shortcuts"]);
146
+
100
147
  const addContentStateOptions = (command, { includeAutoDismiss } = {}) => {
101
148
  command
102
149
  .option("--content-state <json>", "Content state as JSON string")
@@ -107,10 +154,10 @@ const addContentStateOptions = (command, { includeAutoDismiss } = {}) => {
107
154
  .option("--subtitle <subtitle>", "Content state subtitle")
108
155
  .option("--type <type>", "Content state type")
109
156
  .option("--message <message>", "Alert message")
110
- .option("--icon-symbol <symbol>", "Alert SF Symbol name")
111
- .option("--icon-color <color>", "Alert icon color")
112
- .option("--badge-title <title>", "Alert badge title")
113
- .option("--badge-color <color>", "Alert badge color")
157
+ .option("--icon-symbol <symbol>", "SF Symbol name")
158
+ .option("--icon-color <color>", "Icon color")
159
+ .option("--badge-title <title>", "Badge title")
160
+ .option("--badge-color <color>", "Badge color")
114
161
  .option(
115
162
  "--number-of-steps <number>",
116
163
  "Content state number of steps",
@@ -136,6 +183,16 @@ const addContentStateOptions = (command, { includeAutoDismiss } = {}) => {
136
183
  "Content state upper limit",
137
184
  parseNumberOption("upper-limit")
138
185
  )
186
+ .option(
187
+ "--duration-seconds <number>",
188
+ "Timer duration in seconds",
189
+ parseNumberOption("duration-seconds")
190
+ )
191
+ .option(
192
+ "--counts-down <boolean>",
193
+ "Set to false for an elapsed timer",
194
+ parseBooleanOption("counts-down")
195
+ )
139
196
  .option("--color <color>", "Content state color")
140
197
  .option("--step-color <color>", "Content state step color");
141
198
 
@@ -270,10 +327,11 @@ const validateContentState = (contentState, mode) => {
270
327
  normalizedType !== "progress" &&
271
328
  normalizedType !== "metrics" &&
272
329
  normalizedType !== "stats" &&
273
- normalizedType !== "alert"
330
+ normalizedType !== "alert" &&
331
+ normalizedType !== "timer"
274
332
  ) {
275
333
  throw new Error(
276
- "contentState.type must be one of: segmented_progress, progress, metrics, stats, alert"
334
+ "contentState.type must be one of: segmented_progress, progress, metrics, stats, alert, timer"
277
335
  );
278
336
  }
279
337
 
@@ -287,6 +345,9 @@ const validateContentState = (contentState, mode) => {
287
345
  const hasUpperLimit = hasOwn(contentState, "upperLimit");
288
346
  const hasStepColor = hasOwn(contentState, "stepColor");
289
347
  const hasMetrics = hasOwn(contentState, "metrics");
348
+ const hasDurationSeconds = hasOwn(contentState, "durationSeconds");
349
+ const hasCountsDown = hasOwn(contentState, "countsDown");
350
+ const hasTimerFields = hasDurationSeconds || hasCountsDown;
290
351
 
291
352
  if (hasValue !== hasUpperLimit) {
292
353
  throw new Error(
@@ -313,6 +374,14 @@ const validateContentState = (contentState, mode) => {
313
374
  throw new Error("contentState.upperLimit must be greater than 0");
314
375
  }
315
376
 
377
+ if (hasDurationSeconds && contentState.durationSeconds <= 0) {
378
+ throw new Error("contentState.durationSeconds must be greater than 0");
379
+ }
380
+
381
+ if (hasCountsDown && typeof contentState.countsDown !== "boolean") {
382
+ throw new Error("contentState.countsDown must be true or false");
383
+ }
384
+
316
385
  const hasSegmentedFields = hasNumberOfSteps || hasCurrentStep || hasStepColor;
317
386
  const hasProgressFields = hasPercentage || hasValue || hasUpperLimit;
318
387
  const hasAlertFields = hasMessage || hasIcon || hasBadge;
@@ -443,6 +512,15 @@ const validateContentState = (contentState, mode) => {
443
512
  return;
444
513
  }
445
514
 
515
+ if (effectiveType === "timer") {
516
+ if (!hasDurationSeconds && contentState.countsDown !== false) {
517
+ throw new Error(
518
+ `timer ${mode} requires contentState.durationSeconds, or contentState.countsDown=false`
519
+ );
520
+ }
521
+ return;
522
+ }
523
+
446
524
  if (!hasPercentage && !hasValue) {
447
525
  throw new Error(
448
526
  `progress ${mode} requires contentState.percentage, or contentState.value with contentState.upperLimit`
@@ -483,9 +561,19 @@ const validateContentState = (contentState, mode) => {
483
561
  return;
484
562
  }
485
563
 
486
- if (!hasSegmentedFields && !hasProgressFields && !hasMetrics && !hasAlertFields) {
564
+ if (effectiveType === "timer") {
565
+ return;
566
+ }
567
+
568
+ if (
569
+ !hasSegmentedFields &&
570
+ !hasProgressFields &&
571
+ !hasMetrics &&
572
+ !hasAlertFields &&
573
+ !hasTimerFields
574
+ ) {
487
575
  throw new Error(
488
- `contentState for activity ${mode} must include metrics, segmented_progress fields, progress fields, or alert fields`
576
+ `contentState for activity ${mode} must include metrics, segmented_progress fields, progress fields, alert fields, or timer fields`
489
577
  );
490
578
  }
491
579
 
@@ -529,7 +617,7 @@ const parseAction = (value, label) => {
529
617
  const action = {
530
618
  title: value.title.trim(),
531
619
  type: normalizedType,
532
- url: normalizeHttpsUrl(value.url, `${label}.url`),
620
+ url: normalizeActionUrl(value.url, `${label}.url`, normalizedType),
533
621
  };
534
622
 
535
623
  if (value.method !== undefined) {
@@ -676,6 +764,14 @@ const buildContentStateFromOptions = (options) => {
676
764
  contentState.upperLimit = options.upperLimit;
677
765
  }
678
766
 
767
+ if (options.durationSeconds !== undefined) {
768
+ contentState.durationSeconds = options.durationSeconds;
769
+ }
770
+
771
+ if (options.countsDown !== undefined) {
772
+ contentState.countsDown = options.countsDown;
773
+ }
774
+
679
775
  if (options.color !== undefined) {
680
776
  contentState.color = options.color;
681
777
  }
@@ -714,6 +810,8 @@ const toApiContentState = (contentState) => {
714
810
  upperLimit: "upper_limit",
715
811
  stepColor: "step_color",
716
812
  autoDismissMinutes: "auto_dismiss_minutes",
813
+ durationSeconds: "duration_seconds",
814
+ countsDown: "counts_down",
717
815
  };
718
816
 
719
817
  const mapped = {};
@@ -1003,7 +1101,7 @@ program
1003
1101
  "--media <url>",
1004
1102
  "HTTPS URL for image, audio, or video shown when the notification is expanded"
1005
1103
  )
1006
- .option("--redirection <url>", "HTTPS URL opened when notification is tapped")
1104
+ .option("--redirection <url>", "HTTPS or shortcuts:// URL opened when notification is tapped")
1007
1105
  .option("--actions <json>", "Actions JSON array (max 4)")
1008
1106
  .option("--actions-file <path>", "Path to actions JSON array file")
1009
1107
  .option(
@@ -1034,7 +1132,7 @@ program
1034
1132
  : undefined,
1035
1133
  redirection:
1036
1134
  options.redirection !== undefined
1037
- ? normalizeHttpsUrl(options.redirection, "redirection")
1135
+ ? normalizeOpenUrl(options.redirection, "redirection")
1038
1136
  : undefined,
1039
1137
  actions,
1040
1138
  },