activitysmith-cli 1.6.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.
- package/README.md +90 -13
- package/package.json +2 -2
- package/src/cli.js +71 -4
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
|
-
- [
|
|
8
|
+
- [Agent Skill](#agent-skill)
|
|
9
9
|
- [Auth](#auth)
|
|
10
10
|
- [Push Notifications](#push-notifications)
|
|
11
11
|
- [Send Push Notification](#send-push-notification)
|
|
@@ -29,12 +29,33 @@ CLI wrapper for the ActivitySmith API using the official Node SDK.
|
|
|
29
29
|
npm install -g activitysmith-cli
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
##
|
|
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
|
|
33
54
|
|
|
34
55
|
Install the public skill from this repo:
|
|
35
56
|
|
|
36
57
|
```bash
|
|
37
|
-
npx skills add ActivitySmithHQ/activitysmith-cli --skill activitysmith
|
|
58
|
+
npx -y skills@latest add ActivitySmithHQ/activitysmith-cli --skill activitysmith
|
|
38
59
|
```
|
|
39
60
|
|
|
40
61
|
Skill path in this repo:
|
|
@@ -43,7 +64,7 @@ Skill path in this repo:
|
|
|
43
64
|
skills/activitysmith
|
|
44
65
|
```
|
|
45
66
|
|
|
46
|
-
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.
|
|
47
68
|
|
|
48
69
|
## Auth
|
|
49
70
|
|
|
@@ -98,7 +119,7 @@ What will work:
|
|
|
98
119
|
<img src="https://cdn.activitysmith.com/features/actionable-push-notifications-2.png" alt="Actionable push notification example" width="680" />
|
|
99
120
|
</p>
|
|
100
121
|
|
|
101
|
-
|
|
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.
|
|
102
123
|
Webhooks are executed by the ActivitySmith backend.
|
|
103
124
|
|
|
104
125
|
```bash
|
|
@@ -112,6 +133,11 @@ activitysmith push \
|
|
|
112
133
|
"type": "open_url",
|
|
113
134
|
"url": "https://github.com/org/repo/actions/runs/123456789"
|
|
114
135
|
},
|
|
136
|
+
{
|
|
137
|
+
"title": "Chat with Jarvis",
|
|
138
|
+
"type": "open_url",
|
|
139
|
+
"url": "shortcuts://run-shortcut?name=Jarvis"
|
|
140
|
+
},
|
|
115
141
|
{
|
|
116
142
|
"title": "Create Incident",
|
|
117
143
|
"type": "webhook",
|
|
@@ -137,13 +163,14 @@ activitysmith push \
|
|
|
137
163
|
|
|
138
164
|
## Live Activities
|
|
139
165
|
|
|
140
|
-
There are
|
|
166
|
+
There are six types of Live Activities:
|
|
141
167
|
|
|
142
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
|
|
143
169
|
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
|
|
144
170
|
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
|
|
145
171
|
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
|
|
146
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
|
|
147
174
|
|
|
148
175
|
### Start & Update Live Activity
|
|
149
176
|
|
|
@@ -267,6 +294,31 @@ activitysmith activity stream customer-ops \
|
|
|
267
294
|
}'
|
|
268
295
|
```
|
|
269
296
|
|
|
297
|
+
#### Timer
|
|
298
|
+
|
|
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>
|
|
306
|
+
|
|
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`.
|
|
321
|
+
|
|
270
322
|
### End Live Activity
|
|
271
323
|
|
|
272
324
|
Call `activity end-stream` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `autoDismissMinutes` to choose a different dismissal time, including `0` for immediate dismissal.
|
|
@@ -287,8 +339,11 @@ activitysmith activity end-stream prod-web-1 \
|
|
|
287
339
|
|
|
288
340
|
### Live Activity Action
|
|
289
341
|
|
|
290
|
-
Live Activities can include one optional action button.
|
|
291
|
-
|
|
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.
|
|
292
347
|
|
|
293
348
|
<p align="center">
|
|
294
349
|
<img
|
|
@@ -312,12 +367,30 @@ activitysmith activity stream prod-web-1 \
|
|
|
312
367
|
]
|
|
313
368
|
}' \
|
|
314
369
|
--action '{
|
|
315
|
-
"title": "
|
|
370
|
+
"title": "Dashboard",
|
|
316
371
|
"type": "open_url",
|
|
317
372
|
"url": "https://ops.example.com/servers/prod-web-1"
|
|
318
373
|
}'
|
|
319
374
|
```
|
|
320
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
|
+
|
|
321
394
|
#### Webhook action
|
|
322
395
|
|
|
323
396
|
```bash
|
|
@@ -470,10 +543,14 @@ Or use flags to build the rest of the payload:
|
|
|
470
543
|
- `--percentage <number>`
|
|
471
544
|
- `--value <number>`
|
|
472
545
|
- `--upper-limit <number>`
|
|
546
|
+
- `--duration-seconds <number>`
|
|
547
|
+
- `--counts-down <true|false>`
|
|
473
548
|
- `--color <color>`
|
|
474
549
|
- `--step-color <color>`
|
|
475
550
|
- `--auto-dismiss-minutes <number>`
|
|
476
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
|
+
|
|
477
554
|
Live Activity action options:
|
|
478
555
|
|
|
479
556
|
- `--action <json>`
|
|
@@ -490,10 +567,10 @@ Widget metric options:
|
|
|
490
567
|
|
|
491
568
|
Required fields:
|
|
492
569
|
|
|
493
|
-
- `activity stream`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`,
|
|
494
|
-
- `activity start`: `--title`, `--type`, plus `--metrics`, `--number-of-steps` and `--current-step`, `--percentage`,
|
|
495
|
-
- `activity update`: `--title`, plus `--metrics`, `--current-step`, `--percentage`,
|
|
496
|
-
- `activity end`: `--title`, plus `--metrics`, `--current-step`, `--percentage`,
|
|
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
|
|
497
574
|
- `activity end-stream`: no content state is required, but if you provide one it follows the same rules as `activity end`
|
|
498
575
|
|
|
499
576
|
## Output
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith-cli",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
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");
|
|
@@ -167,6 +183,16 @@ const addContentStateOptions = (command, { includeAutoDismiss } = {}) => {
|
|
|
167
183
|
"Content state upper limit",
|
|
168
184
|
parseNumberOption("upper-limit")
|
|
169
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
|
+
)
|
|
170
196
|
.option("--color <color>", "Content state color")
|
|
171
197
|
.option("--step-color <color>", "Content state step color");
|
|
172
198
|
|
|
@@ -301,10 +327,11 @@ const validateContentState = (contentState, mode) => {
|
|
|
301
327
|
normalizedType !== "progress" &&
|
|
302
328
|
normalizedType !== "metrics" &&
|
|
303
329
|
normalizedType !== "stats" &&
|
|
304
|
-
normalizedType !== "alert"
|
|
330
|
+
normalizedType !== "alert" &&
|
|
331
|
+
normalizedType !== "timer"
|
|
305
332
|
) {
|
|
306
333
|
throw new Error(
|
|
307
|
-
"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"
|
|
308
335
|
);
|
|
309
336
|
}
|
|
310
337
|
|
|
@@ -318,6 +345,9 @@ const validateContentState = (contentState, mode) => {
|
|
|
318
345
|
const hasUpperLimit = hasOwn(contentState, "upperLimit");
|
|
319
346
|
const hasStepColor = hasOwn(contentState, "stepColor");
|
|
320
347
|
const hasMetrics = hasOwn(contentState, "metrics");
|
|
348
|
+
const hasDurationSeconds = hasOwn(contentState, "durationSeconds");
|
|
349
|
+
const hasCountsDown = hasOwn(contentState, "countsDown");
|
|
350
|
+
const hasTimerFields = hasDurationSeconds || hasCountsDown;
|
|
321
351
|
|
|
322
352
|
if (hasValue !== hasUpperLimit) {
|
|
323
353
|
throw new Error(
|
|
@@ -344,6 +374,14 @@ const validateContentState = (contentState, mode) => {
|
|
|
344
374
|
throw new Error("contentState.upperLimit must be greater than 0");
|
|
345
375
|
}
|
|
346
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
|
+
|
|
347
385
|
const hasSegmentedFields = hasNumberOfSteps || hasCurrentStep || hasStepColor;
|
|
348
386
|
const hasProgressFields = hasPercentage || hasValue || hasUpperLimit;
|
|
349
387
|
const hasAlertFields = hasMessage || hasIcon || hasBadge;
|
|
@@ -474,6 +512,15 @@ const validateContentState = (contentState, mode) => {
|
|
|
474
512
|
return;
|
|
475
513
|
}
|
|
476
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
|
+
|
|
477
524
|
if (!hasPercentage && !hasValue) {
|
|
478
525
|
throw new Error(
|
|
479
526
|
`progress ${mode} requires contentState.percentage, or contentState.value with contentState.upperLimit`
|
|
@@ -514,9 +561,19 @@ const validateContentState = (contentState, mode) => {
|
|
|
514
561
|
return;
|
|
515
562
|
}
|
|
516
563
|
|
|
517
|
-
if (
|
|
564
|
+
if (effectiveType === "timer") {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (
|
|
569
|
+
!hasSegmentedFields &&
|
|
570
|
+
!hasProgressFields &&
|
|
571
|
+
!hasMetrics &&
|
|
572
|
+
!hasAlertFields &&
|
|
573
|
+
!hasTimerFields
|
|
574
|
+
) {
|
|
518
575
|
throw new Error(
|
|
519
|
-
`contentState for activity ${mode} must include metrics, segmented_progress fields, progress fields, or
|
|
576
|
+
`contentState for activity ${mode} must include metrics, segmented_progress fields, progress fields, alert fields, or timer fields`
|
|
520
577
|
);
|
|
521
578
|
}
|
|
522
579
|
|
|
@@ -707,6 +764,14 @@ const buildContentStateFromOptions = (options) => {
|
|
|
707
764
|
contentState.upperLimit = options.upperLimit;
|
|
708
765
|
}
|
|
709
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
|
+
|
|
710
775
|
if (options.color !== undefined) {
|
|
711
776
|
contentState.color = options.color;
|
|
712
777
|
}
|
|
@@ -745,6 +810,8 @@ const toApiContentState = (contentState) => {
|
|
|
745
810
|
upperLimit: "upper_limit",
|
|
746
811
|
stepColor: "step_color",
|
|
747
812
|
autoDismissMinutes: "auto_dismiss_minutes",
|
|
813
|
+
durationSeconds: "duration_seconds",
|
|
814
|
+
countsDown: "counts_down",
|
|
748
815
|
};
|
|
749
816
|
|
|
750
817
|
const mapped = {};
|