-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert a Shortcut from a file or iCloud link to Cherri code #47
Comments
Any ideas on this? 🙂 I'm really coming to depend on some Shortcuts I use for personal automation. I recently decided I'd like to convert them to Cherri, and I'd love to have some initial automated "bones" to start from! |
Oh I just noticed the Anything ready to test yet? 😄 |
Thanks for your interest in this feature! Yes, you can test this. If you use the Keep in mind it is currently in active development so it's likely to be buggy, especially with more complex shortcuts. |
This now works very well on the Now testing decompiling LARGE Shortcuts and comparing then fixing any incorrect decompilation. 😎 |
I'm not sure we'll ever get perfect decompilation since Cherri while it tries to be as 1-1 as possible, has conveniences and doesn't always translate 1-1. However, I've been making strides in better matching actions that are split into multiple actions for ease of use. I'm excited to see how close we CAN get. |
Good to know! I've got almost a dozen shortcuts that I use on a regular basis (five of which I have set to automatically run periodically throughout the day 🙂) so I'm really looking forward to getting some of this into source control! 😄 |
Btw it turns out that this comment is not true! Lines 66 to 68 in 68974c0
It's possible to extract the raw shortcut contents from signed shortcut files. See https://theapplewiki.com/wiki/Apple_Encrypted_Archive:
I have an example of doing this using https://github.com/wader/fq for my own shortcuts repo I started a few weeks ago here: |
Hmm btw I just tested the latest $ go install github.com/electrikmilk/cherri@decomp
go: github.com/electrikmilk/[email protected] requires go >= 1.22; switching to go1.22.2
# github.com/electrikmilk/cherri
../../go/pkg/mod/github.com/electrikmilk/[email protected]/decompile.go:719:18: undefined: actionOutputs
../../go/pkg/mod/github.com/electrikmilk/[email protected]/decompile.go:720:43: undefined: actionOutputs Any ideas? |
Alright so a few updates!
There were a few issues I've noticed so far:
|
Yeah, we should probably at least put a raw action if we don't know what the action is by default, fill in the gaps from there so that it's at least there if it's not a standard action. |
This is good stuff, thanks! |
Many Shortcuts languages before Cherri had this feature, so it is possible 😅
My original thoughts on this were that Cherri abstracts away some parts of creating Shortcuts for the sake of not having to put too much effort into writing a Shortcut, so I figured Cherri would not translate as naturally.
I figured that this would be preferred because converting and then having everything in one long file which may not come out right, would not be preferred to re-writing it, and along the way, finding ways that Cherri can improve the Shortcut or the maintainability of it since you can spread a Shortcut out into multiple files with includes.
However, it's not a great experience to not at least be able to generate a best guess of how a Shortcut would be written in Cherri. Instead having to re-write the entire Shortcut in Cherri. The developer can at least take the guess from there and tweak as needed.
Not saying I'm striving for guess quality but no decompilation will ever be 100% accurate.
The text was updated successfully, but these errors were encountered: