shortcutkit 0.2.0 → 0.3.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 +33 -11
- package/dist/generated/actions.d.ts +42025 -3171
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4029 -46
- package/dist/provenance.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,8 @@ Build, validate and sign Apple Shortcuts (`.shortcut`) files from TypeScript or
|
|
|
10
10
|
Apple has never documented the `.shortcut` format or what its actions accept. shortcutkit
|
|
11
11
|
does not guess at either. The tools in this repository load WorkflowKit and ActionKit, the private
|
|
12
12
|
frameworks behind the Shortcuts app, and ask their own classes to describe and serialize
|
|
13
|
-
every built-in action.
|
|
13
|
+
every built-in action. Apple's own apps' actions come from the Shortcuts app's action index,
|
|
14
|
+
the only readable copy of the App Intents registry. Every action identifier, parameter key, value encoding, icon colour, and even the
|
|
14
15
|
UTF-16 offset rule for embedded references came out of the engine, not from a person reading
|
|
15
16
|
files. The package cannot disagree with the app.
|
|
16
17
|
|
|
@@ -25,8 +26,12 @@ files you are using.
|
|
|
25
26
|
|
|
26
27
|
## Features
|
|
27
28
|
|
|
28
|
-
- **Every built-in action, typed.** `actions.*` lists all
|
|
29
|
+
- **Every built-in action, typed.** `actions.*` lists all 434 identifiers, with each action's
|
|
29
30
|
name, description, summary, output and parameter keys as hover documentation.
|
|
31
|
+
- **Apple's apps too.** 1,581 App Intents actions from 80 Apple apps and system components,
|
|
32
|
+
Create Reminder, Create Note, Send Message, the System Settings toggles, under the keys the
|
|
33
|
+
Shortcuts app itself assigns them: `actions.reminders_create_reminder`. Enumeration cases are
|
|
34
|
+
typed, and the `AppIntentDescriptor` the file needs is added for you.
|
|
30
35
|
- **Parameters checked before you run anything.** `{ WFStoredContentGlobalValue: "yes" }` is a
|
|
31
36
|
compile error; a switch takes a boolean or a reference. Enumeration choices are suggested.
|
|
32
37
|
Any plain value slot also accepts an attachment, because that is how Shortcuts works.
|
|
@@ -53,8 +58,9 @@ a different shape: a programming language with its own compiler, editor extensio
|
|
|
53
58
|
manager, whose actions are defined in that language.
|
|
54
59
|
|
|
55
60
|
shortcutkit is a library, not a language. You write TypeScript or Python you already know, and
|
|
56
|
-
the action catalogue comes from the Shortcuts engine rather than from a maintainer. All
|
|
57
|
-
built-in actions are covered today, and the next macOS update is
|
|
61
|
+
the action catalogue comes from the Shortcuts engine rather than from a maintainer. All 434
|
|
62
|
+
built-in actions and 1,581 Apple App Intents are covered today, and the next macOS update is
|
|
63
|
+
one `bun run extract` away.
|
|
58
64
|
|
|
59
65
|
## Installation
|
|
60
66
|
|
|
@@ -104,10 +110,22 @@ s.action(actions.showresult, { Text: text("Nothing stored") });
|
|
|
104
110
|
s.endIf(gid);
|
|
105
111
|
```
|
|
106
112
|
|
|
113
|
+
### Apple's apps
|
|
114
|
+
|
|
115
|
+
Apple's App Intents actions are in the catalogue under the Shortcuts app's own keys. Their
|
|
116
|
+
parameters are typed like the built-ins, and the `AppIntentDescriptor` every such action
|
|
117
|
+
carries in the file is added automatically:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const r = s.action(actions.reminders_create_reminder, { title: text("Buy milk"), priorityLevel: "high" });
|
|
121
|
+
s.action(actions.notes_create_note, { name: "Shopping", content: text("Added ", ref(r)) });
|
|
122
|
+
```
|
|
123
|
+
|
|
107
124
|
### Actions from other apps
|
|
108
125
|
|
|
109
|
-
App Intents actions are not in the catalogue, so pass the identifier as a string
|
|
110
|
-
keys are then typed as `Record<string, Value>` and
|
|
126
|
+
Third-party App Intents actions are not in the catalogue, so pass the identifier as a string
|
|
127
|
+
and the descriptor yourself. Parameter keys are then typed as `Record<string, Value>` and
|
|
128
|
+
passed through as given:
|
|
111
129
|
|
|
112
130
|
```ts
|
|
113
131
|
s.action("com.example.app.CreateNote", { title: text("Hello"), body: ref(got) });
|
|
@@ -144,8 +162,10 @@ python -m shortcutkit demo out.shortcut
|
|
|
144
162
|
|
|
145
163
|
- [`docs/shortcut-file-format.md`](docs/shortcut-file-format.md): the `.shortcut` format end
|
|
146
164
|
to end, every field.
|
|
147
|
-
- [`docs/builtin-actions-reference.md`](docs/builtin-actions-reference.md): all
|
|
165
|
+
- [`docs/builtin-actions-reference.md`](docs/builtin-actions-reference.md): all 434 built-in
|
|
148
166
|
actions with their parameters.
|
|
167
|
+
- [`docs/apple-app-intents-reference.md`](docs/apple-app-intents-reference.md): the 1,581 App
|
|
168
|
+
Intents actions of Apple's apps, by app, with parameter kinds and enumeration cases.
|
|
149
169
|
- [`docs/parameter-encodings.md`](docs/parameter-encodings.md): how each parameter class is
|
|
150
170
|
serialized.
|
|
151
171
|
- [`docs/extraction.md`](docs/extraction.md): how the data was obtained, what did not work,
|
|
@@ -174,7 +194,7 @@ has no iCloud login.
|
|
|
174
194
|
|---|---|
|
|
175
195
|
| `src/` | The TypeScript package source. `src/generated/actions.ts` is produced by the tools. `bun run build` bundles it into `dist/`, which is what npm ships. |
|
|
176
196
|
| `python/` | The Python package. `actions.py` and `data/` are produced by the tools. |
|
|
177
|
-
| `data/` | Everything extracted from the engine: definitions, parameter encodings, serialization table, and `provenance.json`. |
|
|
197
|
+
| `data/` | Everything extracted from the engine: definitions, parameter encodings, serialization table, `apple-app-intents.json` from the Shortcuts app's registry, and `provenance.json`. |
|
|
178
198
|
| `docs/` | The format reference, action reference, encodings reference and extraction notes. |
|
|
179
199
|
| `tools/` | The extraction pipeline. |
|
|
180
200
|
|
|
@@ -184,9 +204,11 @@ Never hand-edit the generated files. Change the generator or the data and re-run
|
|
|
184
204
|
|
|
185
205
|
The extracted data is committed on purpose. It can only be produced on a Mac, through private
|
|
186
206
|
API that changes between releases, so committing it is what makes the package reproducible.
|
|
187
|
-
To refresh after a macOS update, on any Mac
|
|
188
|
-
for Automation scripts run by `osascript`, because
|
|
189
|
-
the built-in actions, only loads into Apple's own
|
|
207
|
+
To refresh after a macOS update, on any Mac that has opened Shortcuts.app at least once. No
|
|
208
|
+
Xcode is needed: the probes are JavaScript for Automation scripts run by `osascript`, because
|
|
209
|
+
ActionKit, which defines about a quarter of the built-in actions, only loads into Apple's own
|
|
210
|
+
platform binaries. Apple's App Intents come from the Shortcuts app's action index, which
|
|
211
|
+
Shortcuts writes on launch.
|
|
190
212
|
|
|
191
213
|
```bash
|
|
192
214
|
bun run extract # ~10 s: loads WorkflowKit and ActionKit in osascript, dumps and serializes everything
|