shortcutkit 0.1.1 → 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 +24 -7
- package/dist/generated/actions.d.ts +1108 -153
- package/dist/index.js +15685 -12595
- package/dist/provenance.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ Build, validate and sign Apple Shortcuts (`.shortcut`) files from TypeScript or
|
|
|
8
8
|
## About
|
|
9
9
|
|
|
10
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, the private
|
|
12
|
-
behind the Shortcuts app, and ask
|
|
13
|
-
action. Every action identifier, parameter key, value encoding, icon colour, and even the
|
|
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
14
|
UTF-16 offset rule for embedded references came out of the engine, not from a person reading
|
|
15
15
|
files. The package cannot disagree with the app.
|
|
16
16
|
|
|
@@ -25,7 +25,7 @@ files you are using.
|
|
|
25
25
|
|
|
26
26
|
## Features
|
|
27
27
|
|
|
28
|
-
- **Every built-in action, typed.** `actions.*` lists all
|
|
28
|
+
- **Every built-in action, typed.** `actions.*` lists all 392 identifiers, with each action's
|
|
29
29
|
name, description, summary, output and parameter keys as hover documentation.
|
|
30
30
|
- **Parameters checked before you run anything.** `{ WFStoredContentGlobalValue: "yes" }` is a
|
|
31
31
|
compile error; a switch takes a boolean or a reference. Enumeration choices are suggested.
|
|
@@ -41,6 +41,21 @@ files you are using.
|
|
|
41
41
|
parameter classes, required resources); `provenance` says which build produced the data.
|
|
42
42
|
- **Signing.** `Shortcut.sign()` wraps `shortcuts sign` so the output imports on any device.
|
|
43
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
|
+
|
|
44
59
|
## Installation
|
|
45
60
|
|
|
46
61
|
```bash
|
|
@@ -129,7 +144,7 @@ python -m shortcutkit demo out.shortcut
|
|
|
129
144
|
|
|
130
145
|
- [`docs/shortcut-file-format.md`](docs/shortcut-file-format.md): the `.shortcut` format end
|
|
131
146
|
to end, every field.
|
|
132
|
-
- [`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
|
|
133
148
|
actions with their parameters.
|
|
134
149
|
- [`docs/parameter-encodings.md`](docs/parameter-encodings.md): how each parameter class is
|
|
135
150
|
serialized.
|
|
@@ -169,10 +184,12 @@ Never hand-edit the generated files. Change the generator or the data and re-run
|
|
|
169
184
|
|
|
170
185
|
The extracted data is committed on purpose. It can only be produced on a Mac, through private
|
|
171
186
|
API that changes between releases, so committing it is what makes the package reproducible.
|
|
172
|
-
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.
|
|
173
190
|
|
|
174
191
|
```bash
|
|
175
|
-
bun run extract # ~
|
|
192
|
+
bun run extract # ~10 s: loads WorkflowKit and ActionKit in osascript, dumps and serializes everything
|
|
176
193
|
bun install && bun test
|
|
177
194
|
bun run diff-data # what changed vs the committed data, and the semver bump it implies
|
|
178
195
|
bun run changelog # the same as a CHANGELOG.md section
|