shortcutkit 0.1.0 → 0.2.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 +36 -11
- package/dist/generated/actions.d.ts +1108 -153
- package/dist/index.js +15685 -12595
- package/dist/provenance.d.ts +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -7,17 +7,25 @@ Build, validate and sign Apple Shortcuts (`.shortcut`) files from TypeScript or
|
|
|
7
7
|
|
|
8
8
|
## About
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
Apple has never documented the `.shortcut` format or what its actions accept. shortcutkit
|
|
11
|
+
does not guess at either. The tools in this repository load WorkflowKit and ActionKit, the private
|
|
12
|
+
frameworks behind the Shortcuts app, and ask their own classes to describe and serialize
|
|
13
|
+
every built-in action. Every action identifier, parameter key, value encoding, icon colour, and even the
|
|
14
|
+
UTF-16 offset rule for embedded references came out of the engine, not from a person reading
|
|
15
|
+
files. The package cannot disagree with the app.
|
|
16
|
+
|
|
17
|
+
That turns an undocumented format into a typed one. In TypeScript, a wrong parameter key or a
|
|
18
|
+
string where a boolean belongs is a compile error. In Python the same checks run when you call
|
|
19
|
+
`action()`. A file built from plain code signs, imports and runs.
|
|
20
|
+
|
|
21
|
+
The data stays current the same way it was made. After a macOS update, one command re-extracts
|
|
22
|
+
everything in about a minute and prints a diff of what Apple changed, along with the semver
|
|
23
|
+
bump it deserves. `data/provenance.json` records which macOS and Shortcuts build produced the
|
|
24
|
+
files you are using.
|
|
17
25
|
|
|
18
26
|
## Features
|
|
19
27
|
|
|
20
|
-
- **Every built-in action, typed.** `actions.*` lists all
|
|
28
|
+
- **Every built-in action, typed.** `actions.*` lists all 392 identifiers, with each action's
|
|
21
29
|
name, description, summary, output and parameter keys as hover documentation.
|
|
22
30
|
- **Parameters checked before you run anything.** `{ WFStoredContentGlobalValue: "yes" }` is a
|
|
23
31
|
compile error; a switch takes a boolean or a reference. Enumeration choices are suggested.
|
|
@@ -33,6 +41,21 @@ the data came from.
|
|
|
33
41
|
parameter classes, required resources); `provenance` says which build produced the data.
|
|
34
42
|
- **Signing.** `Shortcut.sign()` wraps `shortcuts sign` so the output imports on any device.
|
|
35
43
|
|
|
44
|
+
## How it compares
|
|
45
|
+
|
|
46
|
+
Every earlier library for writing Shortcuts as code kept its action list by hand, and that is
|
|
47
|
+
how the two most used ones ended: [shortcuts-js](https://github.com/joshfarrant/shortcuts-js)
|
|
48
|
+
(TypeScript, 129 actions, archived 2023) and
|
|
49
|
+
[python-shortcuts](https://github.com/alexander-akhmetov/python-shortcuts) (Python, archived
|
|
50
|
+
2024) both stopped once keeping up with Apple became a chore.
|
|
51
|
+
[Cherri](https://github.com/electrikmilk/cherri) is the active project in this space and takes
|
|
52
|
+
a different shape: a programming language with its own compiler, editor extension and package
|
|
53
|
+
manager, whose actions are defined in that language.
|
|
54
|
+
|
|
55
|
+
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 392
|
|
57
|
+
built-in actions are covered today, and the next macOS update is one `bun run extract` away.
|
|
58
|
+
|
|
36
59
|
## Installation
|
|
37
60
|
|
|
38
61
|
```bash
|
|
@@ -121,7 +144,7 @@ python -m shortcutkit demo out.shortcut
|
|
|
121
144
|
|
|
122
145
|
- [`docs/shortcut-file-format.md`](docs/shortcut-file-format.md): the `.shortcut` format end
|
|
123
146
|
to end, every field.
|
|
124
|
-
- [`docs/builtin-actions-reference.md`](docs/builtin-actions-reference.md): all
|
|
147
|
+
- [`docs/builtin-actions-reference.md`](docs/builtin-actions-reference.md): all 392 built-in
|
|
125
148
|
actions with their parameters.
|
|
126
149
|
- [`docs/parameter-encodings.md`](docs/parameter-encodings.md): how each parameter class is
|
|
127
150
|
serialized.
|
|
@@ -161,10 +184,12 @@ Never hand-edit the generated files. Change the generator or the data and re-run
|
|
|
161
184
|
|
|
162
185
|
The extracted data is committed on purpose. It can only be produced on a Mac, through private
|
|
163
186
|
API that changes between releases, so committing it is what makes the package reproducible.
|
|
164
|
-
To refresh after a macOS update, on
|
|
187
|
+
To refresh after a macOS update, on any Mac. No Xcode is needed: the probes are JavaScript
|
|
188
|
+
for Automation scripts run by `osascript`, because ActionKit, which defines about a quarter of
|
|
189
|
+
the built-in actions, only loads into Apple's own platform binaries.
|
|
165
190
|
|
|
166
191
|
```bash
|
|
167
|
-
bun run extract # ~
|
|
192
|
+
bun run extract # ~10 s: loads WorkflowKit and ActionKit in osascript, dumps and serializes everything
|
|
168
193
|
bun install && bun test
|
|
169
194
|
bun run diff-data # what changed vs the committed data, and the semver bump it implies
|
|
170
195
|
bun run changelog # the same as a CHANGELOG.md section
|