activitysmith-cli 1.20.0 → 1.21.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 +110 -17
- package/package.json +1 -1
- package/src/approvals.js +26 -14
- package/src/cli.js +127 -34
package/README.md
CHANGED
|
@@ -279,6 +279,25 @@ activitysmith push \
|
|
|
279
279
|
--interruption-level "time-sensitive"
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
+
### Push Notification Sounds
|
|
283
|
+
|
|
284
|
+
Use `--sound` to choose the sound a Push Notification plays. Omit it to play the Push Notifications sound picked in the ActivitySmith app under Settings > Sounds.
|
|
285
|
+
|
|
286
|
+
| Value | Behavior |
|
|
287
|
+
| --- | --- |
|
|
288
|
+
| `default` | Plays the sound picked on the device. This is the same as omitting `--sound`. |
|
|
289
|
+
| `none` | Plays no sound. |
|
|
290
|
+
| A sound name | Plays one of the sounds bundled with the app: `arrive`, `bell`, `bells`, `bitflip`, `bloom`, `callout`, `chime`, `coin`, `corrupt`, `crest`, `cue`, `ding`, `drop`, `ember`, `emblem`, `flourish`, `glimmer`, `glint`, `glitch`, `lantern`, `nightfall`, `nudge`, `pixel`, `pop`, `signal`, `streak`, `tally`, `wand`, `whoosh`, or `zip`. |
|
|
291
|
+
|
|
292
|
+
Passive Push Notifications play no sound.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
activitysmith push \
|
|
296
|
+
--title "💸 New sale" \
|
|
297
|
+
--message "Pro plan, \$29/month" \
|
|
298
|
+
--sound "coin"
|
|
299
|
+
```
|
|
300
|
+
|
|
282
301
|
### Replace a Push Notification
|
|
283
302
|
|
|
284
303
|
Every `push` prints a `Notification ID`. Pass it to `--replace` to update a Push Notification you already sent, for example when an incident you alerted on is resolved. The replacement takes the old notification's place on the Lock Screen and in history instead of stacking a second one. It arrives silently, without sound or waking the screen, and goes to the same recipients as the original, so `--channels` and `--interruption-level` don't apply.
|
|
@@ -476,6 +495,19 @@ For a countdown, send `durationSeconds`. Leave it out on later stream updates to
|
|
|
476
495
|
|
|
477
496
|
To start at 00:00 and count up, set `countsDown` to `false` and leave out `durationSeconds`.
|
|
478
497
|
|
|
498
|
+
To count down to a set time, send `timerEndAt` instead of `durationSeconds`. If the timer started earlier, also send `timerStartAt`. The progress bar then shows the time already gone.
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
activitysmith activity stream nightly-backup \
|
|
502
|
+
--content-state '{
|
|
503
|
+
"title": "Nightly Backup",
|
|
504
|
+
"subtitle": "uploading archive",
|
|
505
|
+
"type": "timer",
|
|
506
|
+
"timerStartAt": "2026-11-19T01:00:00Z",
|
|
507
|
+
"timerEndAt": "2026-11-19T02:00:00Z"
|
|
508
|
+
}'
|
|
509
|
+
```
|
|
510
|
+
|
|
479
511
|
### End Live Activity
|
|
480
512
|
|
|
481
513
|
Call `activity end-stream` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. Use `--auto-dismiss-seconds` or `--auto-dismiss-minutes` to delay dismissal. Use `0` for immediate dismissal. Seconds take precedence if both are set. JSON content state also accepts `autoDismissSeconds` or `auto_dismiss_seconds`.
|
|
@@ -651,6 +683,23 @@ activitysmith activity stream agent-approval \
|
|
|
651
683
|
}'
|
|
652
684
|
```
|
|
653
685
|
|
|
686
|
+
### Live Activity Sounds
|
|
687
|
+
|
|
688
|
+
Starting a Live Activity plays the Live Activities sound picked in the ActivitySmith app. Updates and ends are silent. Set `--sound` on a start, update, or end to choose its sound, with the same values as [Push Notification Sounds](#push-notification-sounds). A sound on an update or end also expands the Live Activity on the Lock Screen, so use it for moments that need attention, such as a failed step.
|
|
689
|
+
|
|
690
|
+
```bash
|
|
691
|
+
activitysmith activity stream deploy-api \
|
|
692
|
+
--content-state '{
|
|
693
|
+
"title": "Deploying API",
|
|
694
|
+
"subtitle": "Step 3 failed",
|
|
695
|
+
"type": "segmented_progress",
|
|
696
|
+
"numberOfSteps": 4,
|
|
697
|
+
"currentStep": 3,
|
|
698
|
+
"color": "red"
|
|
699
|
+
}' \
|
|
700
|
+
--sound "glitch"
|
|
701
|
+
```
|
|
702
|
+
|
|
654
703
|
## Lock Screen Widgets
|
|
655
704
|
|
|
656
705
|

|
|
@@ -710,9 +759,7 @@ activitysmith badge 0
|
|
|
710
759
|
|
|
711
760
|
## Approvals
|
|
712
761
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
Let your agents ask for your approval before they act, such as sending an email to customers or deploying to production. The request reaches your iPhone as a Live Activity or an actionable Push Notification, both with two buttons. The agent waits until you tap one and continues only when you approve.
|
|
762
|
+
Let your agents ask for your approval before they act, such as sending an email to customers or deploying to production. The request reaches your iPhone as a Time Sensitive Push Notification. Tap it to open the request on a review screen in the ActivitySmith app. Approve or reject it, or write a reply. The agent waits for your answer and continues only when you approve.
|
|
716
763
|
|
|
717
764
|
```bash
|
|
718
765
|
activitysmith approval request "Send the pricing update email to 214 customers?" \
|
|
@@ -732,10 +779,12 @@ Exit codes for `approval request` and `approval wait`:
|
|
|
732
779
|
- `1`: Rejected, timed out after 30 minutes, or cancelled. Do not continue.
|
|
733
780
|
- `2`: The request failed, for example because no device is paired.
|
|
734
781
|
- `3`: Still pending after `--timeout`, or sent with `--no-wait`.
|
|
782
|
+
- `4`: Replied. The reply text follows `Reply:`. Follow the reply instead of the original action.
|
|
783
|
+
- `5`: Chosen. The chosen option follows `Chosen:` and `Option ID:`. Do that option.
|
|
735
784
|
|
|
736
785
|
### Show the exact command
|
|
737
786
|
|
|
738
|
-
Add `--command` with the exact command that waits for approval. The
|
|
787
|
+
Add `--command` with the exact command that waits for approval. The review screen shows the command and the current directory:
|
|
739
788
|
|
|
740
789
|
```bash
|
|
741
790
|
activitysmith approval request "Run the database migration?" \
|
|
@@ -743,7 +792,61 @@ activitysmith approval request "Run the database migration?" \
|
|
|
743
792
|
--command "npm run db:migrate -- --env production"
|
|
744
793
|
```
|
|
745
794
|
|
|
746
|
-
Add `--details` for
|
|
795
|
+
Add `--details` for context, up to 4,000 characters. Add `--scope` to show where the action applies, such as `environment:production`.
|
|
796
|
+
|
|
797
|
+
### Add changes, links, and screenshots
|
|
798
|
+
|
|
799
|
+
Give the review screen what you need to decide:
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
activitysmith approval request "Deploy the new checkout to production?" \
|
|
803
|
+
--approve-label "Deploy" \
|
|
804
|
+
--git-changes main...HEAD \
|
|
805
|
+
--link "Pull request=https://github.com/acme/shop/pull/42" \
|
|
806
|
+
--screenshot "shots/checkout.png=New checkout"
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
- `--git-changes` adds a summary of `git diff`: how many files changed, the lines added and removed, and the 2 most changed files. Without a range, it uses the uncommitted changes.
|
|
810
|
+
- `--change <path:added:removed>` adds one file by hand, such as `src/app.ts:12:3`. Repeat it to add more files. Each file adds to the same summary.
|
|
811
|
+
- `--link <title=url>` adds an https link that opens in the app. Add up to 5.
|
|
812
|
+
- `--screenshot <file=title>` uploads a PNG, JPEG, or WebP file of up to 2 MB. The title is optional. Add up to 5.
|
|
813
|
+
|
|
814
|
+
Screenshots are deleted 7 days after the decision.
|
|
815
|
+
|
|
816
|
+
### Offer options
|
|
817
|
+
|
|
818
|
+
Ask the user to pick one of 2 to 4 options instead of approve or reject. Give each option an ID and a label. Add `--recommended` to mark the option you would pick:
|
|
819
|
+
|
|
820
|
+
```bash
|
|
821
|
+
activitysmith approval request "Which settings layout should I ship?" \
|
|
822
|
+
--option "tabs=Tabs across the top" \
|
|
823
|
+
--option "sidebar=Sidebar navigation" \
|
|
824
|
+
--recommended sidebar \
|
|
825
|
+
--option-screenshot tabs=shots/tabs.png \
|
|
826
|
+
--option-screenshot sidebar=shots/sidebar.png
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
The review screen letters the options A to D. When you choose one, the command prints the option and exits with code `5`:
|
|
830
|
+
|
|
831
|
+
```text
|
|
832
|
+
Chosen: Sidebar navigation
|
|
833
|
+
Option ID: sidebar
|
|
834
|
+
Do the chosen option.
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
Without an ID, as in `--option "Sidebar navigation"`, the options get the IDs `a`, `b`, `c`, and `d`.
|
|
838
|
+
|
|
839
|
+
### Read a reply
|
|
840
|
+
|
|
841
|
+
On the review screen, you can write a reply instead of a decision, such as "Send it tomorrow at 9 instead." The command then prints the reply and exits with code `4`:
|
|
842
|
+
|
|
843
|
+
```text
|
|
844
|
+
Replied. Read the reply and follow it. Do not run the original action unless the reply says to.
|
|
845
|
+
Reply:
|
|
846
|
+
Send it tomorrow at 9 instead.
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
Add `--json` to get the full approval with `status`, `reply`, `selected_option_id`, and `selected_option`.
|
|
747
850
|
|
|
748
851
|
### Wait in steps
|
|
749
852
|
|
|
@@ -761,19 +864,9 @@ activitysmith approval get apr_Xk3pQ8mV2nR7tL9w
|
|
|
761
864
|
activitysmith approval cancel apr_Xk3pQ8mV2nR7tL9w
|
|
762
865
|
```
|
|
763
866
|
|
|
764
|
-
Cancel a request when the action is no longer needed. Its
|
|
765
|
-
|
|
766
|
-
### Change how the request looks
|
|
867
|
+
Cancel a request when the action is no longer needed. Its Push Notification is removed from your devices.
|
|
767
868
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
```bash
|
|
771
|
-
activitysmith approval request "Refund order #4821 for $129?" \
|
|
772
|
-
--approve-label "Refund" \
|
|
773
|
-
--badge "Billing" \
|
|
774
|
-
--color orange \
|
|
775
|
-
--icon creditcard
|
|
776
|
-
```
|
|
869
|
+
`--delivery`, `--color`, `--icon`, and `--badge` are no longer used. The CLI still accepts them so older scripts keep working, and ignores them.
|
|
777
870
|
|
|
778
871
|
## Metadata
|
|
779
872
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.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",
|
package/src/approvals.js
CHANGED
|
@@ -7,8 +7,10 @@ export const APPROVAL_LIMITS = {
|
|
|
7
7
|
minOptions: 2,
|
|
8
8
|
maxOptions: 4,
|
|
9
9
|
optionLabel: 80,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
maxTopFiles: 2,
|
|
11
|
+
topFileName: 500,
|
|
12
|
+
maxFilesChanged: 1_000_000,
|
|
13
|
+
maxChangedLines: 1_000_000_000,
|
|
12
14
|
maxLinks: 5,
|
|
13
15
|
linkTitle: 120,
|
|
14
16
|
linkUrl: 2000,
|
|
@@ -133,19 +135,29 @@ export const readGitChanges = async (range, { cwd = process.cwd() } = {}) => {
|
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
|
|
136
|
-
//
|
|
138
|
+
// The name the review screen shows: the last path component.
|
|
139
|
+
export const changedFileName = (path) => {
|
|
140
|
+
const trimmed = path.trim().replace(/[\\/]+$/, "");
|
|
141
|
+
const name = trimmed.slice(Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\")) + 1) || trimmed;
|
|
142
|
+
return name.slice(0, APPROVAL_LIMITS.topFileName);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Reduces changed files to what the review screen shows: the file count, the line totals, and the
|
|
146
|
+
// names of the 2 most changed files (added plus removed). Returns undefined when nothing changed.
|
|
137
147
|
export const buildApprovalChanges = (files) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
const changed = files.filter((file) => file.path && file.path.trim());
|
|
149
|
+
if (changed.length === 0) return undefined;
|
|
150
|
+
// Array sort is stable, so files with the same line count keep their order.
|
|
151
|
+
const topFiles = [...changed]
|
|
152
|
+
.sort((a, b) => b.added + b.removed - (a.added + a.removed))
|
|
153
|
+
.slice(0, APPROVAL_LIMITS.maxTopFiles)
|
|
154
|
+
.map((file) => changedFileName(file.path));
|
|
155
|
+
return {
|
|
156
|
+
files_changed: Math.min(APPROVAL_LIMITS.maxFilesChanged, changed.length),
|
|
157
|
+
lines_added: Math.min(APPROVAL_LIMITS.maxChangedLines, changed.reduce((total, file) => total + file.added, 0)),
|
|
158
|
+
lines_removed: Math.min(APPROVAL_LIMITS.maxChangedLines, changed.reduce((total, file) => total + file.removed, 0)),
|
|
159
|
+
top_files: topFiles,
|
|
160
|
+
};
|
|
149
161
|
};
|
|
150
162
|
|
|
151
163
|
// Reads the type from the file signature, as the API does, so a renamed file fails before upload.
|
package/src/cli.js
CHANGED
|
@@ -73,6 +73,13 @@ const parseNumberOption = (label) => (value) => {
|
|
|
73
73
|
return parsed;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
const parseDateOption = (label) => (value) => {
|
|
77
|
+
if (typeof value !== "string" || Number.isNaN(Date.parse(value))) {
|
|
78
|
+
throw new InvalidArgumentError(`${label} must be an ISO 8601 date-time`);
|
|
79
|
+
}
|
|
80
|
+
return new Date(value).toISOString();
|
|
81
|
+
};
|
|
82
|
+
|
|
76
83
|
const parseBooleanOption = (label) => (value) => {
|
|
77
84
|
if (typeof value !== "string") {
|
|
78
85
|
throw new InvalidArgumentError(`${label} must be true or false`);
|
|
@@ -123,6 +130,19 @@ const parseTagsOption = (value, previous = []) => {
|
|
|
123
130
|
return [...previous, ...tags];
|
|
124
131
|
};
|
|
125
132
|
|
|
133
|
+
// The API also accepts sound names outside the bundled list, so only the length is checked here.
|
|
134
|
+
const parseSoundOption = (value) => {
|
|
135
|
+
if (typeof value !== "string" || value.trim() === "" || value.length > 50) {
|
|
136
|
+
throw new InvalidArgumentError("sound must be 1-50 characters, such as chime, default, or none");
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const SOUND_HELP = "Sound to play: a bundled sound name, default, or none";
|
|
142
|
+
const LIVE_ACTIVITY_CHANGE_SOUND_HELP = `${SOUND_HELP}. Silent by default; a sound also expands the Live Activity on the Lock Screen`;
|
|
143
|
+
|
|
144
|
+
const withSound = (request, sound) => (sound === undefined ? request : { ...request, sound });
|
|
145
|
+
|
|
126
146
|
const parseMetricValueArgument = (value) => {
|
|
127
147
|
if (typeof value !== "string") {
|
|
128
148
|
throw new InvalidArgumentError("value must be a string or number");
|
|
@@ -252,6 +272,16 @@ const addContentStateOptions = (command, { includeAutoDismiss, includeAutoDismis
|
|
|
252
272
|
"Timer duration in seconds",
|
|
253
273
|
parseNumberOption("duration-seconds")
|
|
254
274
|
)
|
|
275
|
+
.option(
|
|
276
|
+
"--timer-start-at <date>",
|
|
277
|
+
"Timer start time as an ISO 8601 date-time",
|
|
278
|
+
parseDateOption("timer-start-at")
|
|
279
|
+
)
|
|
280
|
+
.option(
|
|
281
|
+
"--timer-end-at <date>",
|
|
282
|
+
"Timer end time as an ISO 8601 date-time (instead of --duration-seconds)",
|
|
283
|
+
parseDateOption("timer-end-at")
|
|
284
|
+
)
|
|
255
285
|
.option(
|
|
256
286
|
"--counts-down <boolean>",
|
|
257
287
|
"Set to false for an elapsed timer",
|
|
@@ -442,7 +472,27 @@ const validateContentState = (contentState, mode) => {
|
|
|
442
472
|
const hasMetrics = hasOwn(contentState, "metrics");
|
|
443
473
|
const hasDurationSeconds = hasOwn(contentState, "durationSeconds");
|
|
444
474
|
const hasCountsDown = hasOwn(contentState, "countsDown");
|
|
445
|
-
const
|
|
475
|
+
const hasTimerStartAt =
|
|
476
|
+
hasOwn(contentState, "timerStartAt") || hasOwn(contentState, "timer_start_at");
|
|
477
|
+
const hasTimerEndAt =
|
|
478
|
+
hasOwn(contentState, "timerEndAt") || hasOwn(contentState, "timer_end_at");
|
|
479
|
+
const hasTimerFields =
|
|
480
|
+
hasDurationSeconds || hasCountsDown || hasTimerStartAt || hasTimerEndAt;
|
|
481
|
+
|
|
482
|
+
for (const key of ["timerStartAt", "timer_start_at", "timerEndAt", "timer_end_at"]) {
|
|
483
|
+
if (!hasOwn(contentState, key)) continue;
|
|
484
|
+
const value = contentState[key];
|
|
485
|
+
if (typeof value !== "string" || Number.isNaN(Date.parse(value))) {
|
|
486
|
+
throw new Error(`contentState.${key} must be an ISO 8601 date-time`);
|
|
487
|
+
}
|
|
488
|
+
contentState[key] = new Date(value).toISOString();
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (hasDurationSeconds && hasTimerEndAt) {
|
|
492
|
+
throw new Error(
|
|
493
|
+
"Provide either contentState.durationSeconds or contentState.timerEndAt, not both"
|
|
494
|
+
);
|
|
495
|
+
}
|
|
446
496
|
|
|
447
497
|
for (const key of ["autoDismissSeconds", "auto_dismiss_seconds"]) {
|
|
448
498
|
if (hasOwn(contentState, key) &&
|
|
@@ -625,9 +675,14 @@ const validateContentState = (contentState, mode) => {
|
|
|
625
675
|
}
|
|
626
676
|
|
|
627
677
|
if (effectiveType === "timer") {
|
|
628
|
-
if (
|
|
678
|
+
if (
|
|
679
|
+
mode === "start" &&
|
|
680
|
+
!hasDurationSeconds &&
|
|
681
|
+
!hasTimerEndAt &&
|
|
682
|
+
contentState.countsDown !== false
|
|
683
|
+
) {
|
|
629
684
|
throw new Error(
|
|
630
|
-
`timer ${mode} requires contentState.durationSeconds, or contentState.countsDown=false`
|
|
685
|
+
`timer ${mode} requires contentState.durationSeconds or contentState.timerEndAt, or contentState.countsDown=false`
|
|
631
686
|
);
|
|
632
687
|
}
|
|
633
688
|
return;
|
|
@@ -908,6 +963,14 @@ const buildContentStateFromOptions = (options) => {
|
|
|
908
963
|
contentState.durationSeconds = options.durationSeconds;
|
|
909
964
|
}
|
|
910
965
|
|
|
966
|
+
if (options.timerStartAt !== undefined) {
|
|
967
|
+
contentState.timerStartAt = options.timerStartAt;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (options.timerEndAt !== undefined) {
|
|
971
|
+
contentState.timerEndAt = options.timerEndAt;
|
|
972
|
+
}
|
|
973
|
+
|
|
911
974
|
if (options.countsDown !== undefined) {
|
|
912
975
|
contentState.countsDown = options.countsDown;
|
|
913
976
|
}
|
|
@@ -957,6 +1020,8 @@ const toApiContentState = (contentState) => {
|
|
|
957
1020
|
autoDismissSeconds: "auto_dismiss_seconds",
|
|
958
1021
|
durationSeconds: "duration_seconds",
|
|
959
1022
|
countsDown: "counts_down",
|
|
1023
|
+
timerStartAt: "timer_start_at",
|
|
1024
|
+
timerEndAt: "timer_end_at",
|
|
960
1025
|
};
|
|
961
1026
|
|
|
962
1027
|
const mapped = {};
|
|
@@ -1325,6 +1390,11 @@ const pushCommand = program
|
|
|
1325
1390
|
"time-sensitive",
|
|
1326
1391
|
])
|
|
1327
1392
|
)
|
|
1393
|
+
.option(
|
|
1394
|
+
"--sound <name>",
|
|
1395
|
+
`${SOUND_HELP} (defaults to your Push Notifications sound)`,
|
|
1396
|
+
parseSoundOption
|
|
1397
|
+
)
|
|
1328
1398
|
.option("--redirection <url>", "HTTPS or shortcuts:// URL opened when notification is tapped")
|
|
1329
1399
|
.option("--actions <json>", "Actions JSON array (max 4)")
|
|
1330
1400
|
.option("--actions-file <path>", "Path to actions JSON array file")
|
|
@@ -1356,9 +1426,13 @@ const pushCommand = program
|
|
|
1356
1426
|
actions,
|
|
1357
1427
|
});
|
|
1358
1428
|
if (options.replace !== undefined) {
|
|
1359
|
-
if (
|
|
1429
|
+
if (
|
|
1430
|
+
options.channels !== undefined ||
|
|
1431
|
+
options.interruptionLevel !== undefined ||
|
|
1432
|
+
options.sound !== undefined
|
|
1433
|
+
) {
|
|
1360
1434
|
throw new Error(
|
|
1361
|
-
"--channels
|
|
1435
|
+
"--channels, --interruption-level, and --sound cannot be combined with --replace. Replacements go to the original recipients and arrive silently."
|
|
1362
1436
|
);
|
|
1363
1437
|
}
|
|
1364
1438
|
if (options.replace.trim() === "") {
|
|
@@ -1380,6 +1454,7 @@ const pushCommand = program
|
|
|
1380
1454
|
? normalizeHttpsUrl(options.icon, "icon")
|
|
1381
1455
|
: undefined,
|
|
1382
1456
|
interruption_level: options.interruptionLevel,
|
|
1457
|
+
sound: options.sound,
|
|
1383
1458
|
redirection:
|
|
1384
1459
|
options.redirection !== undefined
|
|
1385
1460
|
? normalizeOpenUrl(options.redirection, "redirection")
|
|
@@ -1567,6 +1642,11 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1567
1642
|
parseTagsOption
|
|
1568
1643
|
)
|
|
1569
1644
|
.option("--clear-tags", "Remove all Tags from this stream")
|
|
1645
|
+
.option(
|
|
1646
|
+
"--sound <name>",
|
|
1647
|
+
`${SOUND_HELP}. A new stream defaults to your Live Activities sound; updates are silent by default, and a sound also expands the Live Activity on the Lock Screen`,
|
|
1648
|
+
parseSoundOption
|
|
1649
|
+
)
|
|
1570
1650
|
.option("--metadata <json>", "Metadata JSON object shown in ActivitySmith details")
|
|
1571
1651
|
.option("--metadata-file <path>", "Path to a Metadata JSON object file")
|
|
1572
1652
|
.action(async (streamKey, options) => {
|
|
@@ -1584,17 +1664,20 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1584
1664
|
|
|
1585
1665
|
const response = await client.liveActivities.stream(
|
|
1586
1666
|
streamKey,
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1667
|
+
withSound(
|
|
1668
|
+
withTags(
|
|
1669
|
+
withTargetChannels(
|
|
1670
|
+
toApiLiveActivityStreamRequest(
|
|
1671
|
+
contentState,
|
|
1672
|
+
action,
|
|
1673
|
+
secondaryAction
|
|
1674
|
+
),
|
|
1675
|
+
options.channels
|
|
1593
1676
|
),
|
|
1594
|
-
options.
|
|
1677
|
+
options.clearTags ? [] : options.tags,
|
|
1678
|
+
await loadMetadata(options)
|
|
1595
1679
|
),
|
|
1596
|
-
options.
|
|
1597
|
-
await loadMetadata(options)
|
|
1680
|
+
options.sound
|
|
1598
1681
|
)
|
|
1599
1682
|
);
|
|
1600
1683
|
|
|
@@ -1626,6 +1709,11 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1626
1709
|
"Comma-separated tags for organizing history (repeatable)",
|
|
1627
1710
|
parseTagsOption
|
|
1628
1711
|
)
|
|
1712
|
+
.option(
|
|
1713
|
+
"--sound <name>",
|
|
1714
|
+
`${SOUND_HELP} (defaults to your Live Activities sound)`,
|
|
1715
|
+
parseSoundOption
|
|
1716
|
+
)
|
|
1629
1717
|
.option("--metadata <json>", "Metadata JSON object shown in ActivitySmith details")
|
|
1630
1718
|
.option("--metadata-file <path>", "Path to a Metadata JSON object file")
|
|
1631
1719
|
.action(async (options) => {
|
|
@@ -1639,17 +1727,20 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1639
1727
|
const secondaryAction = await loadLiveActivitySecondaryAction(options);
|
|
1640
1728
|
|
|
1641
1729
|
const response = await client.liveActivities.startLiveActivity({
|
|
1642
|
-
liveActivityStartRequest:
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1730
|
+
liveActivityStartRequest: withSound(
|
|
1731
|
+
withTags(
|
|
1732
|
+
withTargetChannels(
|
|
1733
|
+
toApiLiveActivityStartRequest(
|
|
1734
|
+
contentState,
|
|
1735
|
+
action,
|
|
1736
|
+
secondaryAction
|
|
1737
|
+
),
|
|
1738
|
+
options.channels
|
|
1648
1739
|
),
|
|
1649
|
-
options.
|
|
1740
|
+
options.tags,
|
|
1741
|
+
await loadMetadata(options)
|
|
1650
1742
|
),
|
|
1651
|
-
options.
|
|
1652
|
-
await loadMetadata(options)
|
|
1743
|
+
options.sound
|
|
1653
1744
|
),
|
|
1654
1745
|
});
|
|
1655
1746
|
|
|
@@ -1671,6 +1762,7 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1671
1762
|
.requiredOption("--activity-id <id>", "Live Activity ID")
|
|
1672
1763
|
.option("--tags <tags>", "Replace Tags for this Live Activity (repeatable)", parseTagsOption)
|
|
1673
1764
|
.option("--clear-tags", "Remove all Tags from this Live Activity")
|
|
1765
|
+
.option("--sound <name>", LIVE_ACTIVITY_CHANGE_SOUND_HELP, parseSoundOption)
|
|
1674
1766
|
.option("--metadata <json>", "Metadata JSON object shown in ActivitySmith details")
|
|
1675
1767
|
.option("--metadata-file <path>", "Path to a Metadata JSON object file")
|
|
1676
1768
|
.action(async (options) => {
|
|
@@ -1687,12 +1779,12 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1687
1779
|
const secondaryAction = await loadLiveActivitySecondaryAction(options);
|
|
1688
1780
|
|
|
1689
1781
|
const response = await client.liveActivities.updateLiveActivity({
|
|
1690
|
-
liveActivityUpdateRequest: withTags(toApiLiveActivityUpdateRequest(
|
|
1782
|
+
liveActivityUpdateRequest: withSound(withTags(toApiLiveActivityUpdateRequest(
|
|
1691
1783
|
options.activityId,
|
|
1692
1784
|
contentState,
|
|
1693
1785
|
action,
|
|
1694
1786
|
secondaryAction
|
|
1695
|
-
), options.clearTags ? [] : options.tags, await loadMetadata(options)),
|
|
1787
|
+
), options.clearTags ? [] : options.tags, await loadMetadata(options)), options.sound),
|
|
1696
1788
|
});
|
|
1697
1789
|
|
|
1698
1790
|
outputResult(response, globalOptions, [
|
|
@@ -1712,6 +1804,7 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1712
1804
|
.requiredOption("--activity-id <id>", "Live Activity ID")
|
|
1713
1805
|
.option("--tags <tags>", "Replace Tags for this Live Activity (repeatable)", parseTagsOption)
|
|
1714
1806
|
.option("--clear-tags", "Remove all Tags from this Live Activity")
|
|
1807
|
+
.option("--sound <name>", LIVE_ACTIVITY_CHANGE_SOUND_HELP, parseSoundOption)
|
|
1715
1808
|
.option("--metadata <json>", "Metadata JSON object shown in ActivitySmith details")
|
|
1716
1809
|
.option("--metadata-file <path>", "Path to a Metadata JSON object file")
|
|
1717
1810
|
.action(async (options) => {
|
|
@@ -1728,12 +1821,12 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1728
1821
|
const secondaryAction = await loadLiveActivitySecondaryAction(options);
|
|
1729
1822
|
|
|
1730
1823
|
const response = await client.liveActivities.endLiveActivity({
|
|
1731
|
-
liveActivityEndRequest: withTags(toApiLiveActivityEndRequest(
|
|
1824
|
+
liveActivityEndRequest: withSound(withTags(toApiLiveActivityEndRequest(
|
|
1732
1825
|
options.activityId,
|
|
1733
1826
|
contentState,
|
|
1734
1827
|
action,
|
|
1735
1828
|
secondaryAction
|
|
1736
|
-
), options.clearTags ? [] : options.tags, await loadMetadata(options)),
|
|
1829
|
+
), options.clearTags ? [] : options.tags, await loadMetadata(options)), options.sound),
|
|
1737
1830
|
});
|
|
1738
1831
|
|
|
1739
1832
|
outputResult(response, globalOptions, [
|
|
@@ -1754,6 +1847,7 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1754
1847
|
.argument("<stream-key>", "Stable stream key")
|
|
1755
1848
|
.option("--tags <tags>", "Comma-separated Tags", parseTagsOption)
|
|
1756
1849
|
.option("--clear-tags", "Clear existing Tags")
|
|
1850
|
+
.option("--sound <name>", LIVE_ACTIVITY_CHANGE_SOUND_HELP, parseSoundOption)
|
|
1757
1851
|
.option("--metadata <json>", "Metadata as a JSON object")
|
|
1758
1852
|
.option("--metadata-file <path>", "Metadata JSON file path")
|
|
1759
1853
|
.action(async (streamKey, options) => {
|
|
@@ -1772,7 +1866,8 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1772
1866
|
const request =
|
|
1773
1867
|
contentState !== undefined ||
|
|
1774
1868
|
action !== undefined ||
|
|
1775
|
-
secondaryAction !== undefined || tags !== undefined || metadata !== undefined
|
|
1869
|
+
secondaryAction !== undefined || tags !== undefined || metadata !== undefined ||
|
|
1870
|
+
options.sound !== undefined
|
|
1776
1871
|
? toApiLiveActivityStreamDeleteRequest(
|
|
1777
1872
|
contentState,
|
|
1778
1873
|
action,
|
|
@@ -1782,6 +1877,7 @@ addLiveActivityActionOptions(addContentStateOptions(
|
|
|
1782
1877
|
|
|
1783
1878
|
if (tags !== undefined) request.tags = tags;
|
|
1784
1879
|
if (metadata !== undefined) request.metadata = metadata;
|
|
1880
|
+
if (options.sound !== undefined) request.sound = options.sound;
|
|
1785
1881
|
const response = await client.liveActivities.endStream(streamKey, request);
|
|
1786
1882
|
|
|
1787
1883
|
const activityId = response?.activityId ?? response?.activity_id;
|
|
@@ -2087,9 +2183,9 @@ approvalCommand
|
|
|
2087
2183
|
)
|
|
2088
2184
|
.option(
|
|
2089
2185
|
"--git-changes [range]",
|
|
2090
|
-
"Show the
|
|
2186
|
+
"Show the file count, line totals, and the 2 most changed file names from git diff: uncommitted changes, or a range such as main...HEAD"
|
|
2091
2187
|
)
|
|
2092
|
-
.option("--change <path:added:removed>", "A changed file and its line counts, such as src/app.ts:12:3. Repeatable", repeatable(parseChangeArgument))
|
|
2188
|
+
.option("--change <path:added:removed>", "A changed file and its line counts, such as src/app.ts:12:3. Repeatable. Adds to the same summary", repeatable(parseChangeArgument))
|
|
2093
2189
|
.option("--link <[title=]url>", "An https link to open from the review screen, such as a pull request. Repeatable, 5 at most", repeatable(parseLinkArgument))
|
|
2094
2190
|
.option("--channels <slugs>", "Comma-separated channel slugs. Omit to ask on every paired device")
|
|
2095
2191
|
.option("--timeout <seconds>", "Stop waiting after this many seconds and exit 3 if still pending", parsePositiveSeconds)
|
|
@@ -2124,10 +2220,7 @@ approvalCommand
|
|
|
2124
2220
|
...(options.gitChanges !== undefined ? await readGitChanges(options.gitChanges) : []),
|
|
2125
2221
|
...(options.change ?? []),
|
|
2126
2222
|
];
|
|
2127
|
-
const
|
|
2128
|
-
if (omitted > 0 && !globalOptions.json) {
|
|
2129
|
-
console.error(`Showing the ${APPROVAL_LIMITS.maxChangedFiles} most changed files. ${omitted} more are left out.`);
|
|
2130
|
-
}
|
|
2223
|
+
const changes = buildApprovalChanges(changedFiles);
|
|
2131
2224
|
const channels = String(options.channels ?? "")
|
|
2132
2225
|
.split(",")
|
|
2133
2226
|
.map((slug) => slug.trim())
|