Cherri – programming language that compiles to an Apple Shortuct (github.com)

by mihau 74 comments 355 points
Read article View on HN

74 comments

[−] alin23 46d ago
I've just used this extensively to build 200 Shortcuts for my event-based automation app on macOS [0], because some actions you simply can't do without Shortcuts: changing Focus Mode, toggling Accessibility functions like Color Filters, accessing the Private Cloud Compute model etc.

I also wrote about how Claude was able to basically learn the language from scratch and write those fully compilable Shortcuts for me [1] because it was mind boggling to me that an LLM can do that. Curiously, this is becoming more and more normal in my mind.

[0] https://lowtechguys.com/crank

[1] https://alinpanaitiu.com/blog/how-good-is-claude-really/#che...

[−] MetalSnake 46d ago
When you say Claude learned it. That's in the current context window it is able to do that, right? Or is there a more permanent way to make it learn something?
[−] junkblocker 44d ago
You ask it to read the docs or site and create a 'skill' out of it.
[−] TarqDirtyToMe 46d ago
Cool to hear Claude was able to learn it. I was planning on leveraging it in a future version of this project I was hacking on that lets you execute shortcut actions as tools (without creating actual shortcuts): https://tarq.net/posts/action-relay-shortcut-actions-mcp/
[−] bjord 45d ago
are you certain that it wasn't included in the training data?

I saw someone do this awhile ago with a low resource language (I think it might've been Abkhaz?) with seemingly-incredible results, and eventually everyone came to understood that, even though it wasn't officially supported, Abkhaz materials had been in the training data

[−] 6thbit 46d ago
Yeah having this opens up the LLM assisting path to build shortcuts. Which is great! Maintaining them by hand is not
[−] alsetmusic 46d ago
Well, that’s a domain that has caught my attention so I’ll give this more weight (ltg). I recall novel Mac apps that weren’t quite right for me but seemed thoughtful.
[−] lemontheme 46d ago
Cool! As a professional programmer few things consistently succeed in making me feel inept like trying to build an Apple Shortcut
[−] vjvjvjvjghv 46d ago
AppleScript was just a little weird but I could get my head around it. Shortcuts just doesn’t make sense. Even the simplest things are hard to do and the scripts are totally unmaintainable. I don’t know why Apple is doing this.
[−] x187463 45d ago
I got my first MacOS device, a Macbook Air, recently and was annoyed to find the toggle for 'natural scrolling' is unified between the trackpad and the mouse. I use the macbook docked 90% of the time. So, I asked ChatGPT if there was a way to script toggling the natural scrolling setting. ChatGPT immediately produced a working script and the instructions to create the Shortcut and assign it to a keyboard shortcut. Now I can press Ctrl-Shift-S and toggle natural scrolling.

Even as a programmer, I would have never spent the time necessary to learn the relevant scripting language for this task. I've got other things to do. But ChatGPT knew exactly what to do and now to implement the task, even on the newest version of MacOS.

[−] Defman 45d ago
As an alternative to a script, I can suggest Mos[1], which i've been using for 6 years I think. This is the first app I install on a fresh MacOS because I'm also using my MacBook while it's docked.

[1]: https://github.com/Caldis/Mos

[−] hbn 45d ago
There exists free tools that fix that behaviour too (Apple hasn't seemed to care because if you buy a mouse from them, it scrolls with a touch sensor so natural scrolling feels correct. And I do happen to be one of the few people who likes the Magic Mouse)
[−] 1bpp 46d ago
It feels actively hostile to programmers sometimes
[−] reflexco 46d ago
I always suspected there's a step in Apple's software design process that goes like this:

- Is the app convenient to use for power users? Then careful, you must have mindlessly went with what's intuitive for you, but what's actually intuitive for normal people is, has to be, different. Go back and find (or invent if you must), the "naturally" intuitive design.

[−] vjvjvjvjghv 46d ago
Not just sometimes. Pretty much always.
[−] zimpenfish 46d ago
I felt really smart after I made a fancy Shortcut that did complex playlist generation based on rules and whatnots.

Of course, adding music to a playlist broke a couple of updates down the line and, as far as I'm aware, still doesn't work properly several years later.

(I moved to Marvis Pro[0] because it has reasonably complex smart playlists that just about mimic what I was doing with my generator except they're transient and not saved as mine were. Win some, lose some.)

[0] No link, sorry, because it'd either be iOS App Store or ad-laden bloat sites "reviewing" it. https://www.reddit.com/r/MarvisApp/ might be worth a read though.

[−] mulmen 46d ago
This is what prevents me from putting any effort in to shortcuts. I have zero confidence in Apple respecting my time by committing to compatibility or even just not breaking things. The constant feature churn from new PM’s tearing down Chesterton’s fence to make way for their own career ambitions makes Apple user hostile.
[−] wombatpm 46d ago
Apple doesn’t respect its users with constant changes to iTunes and then Music. My wife is still mad that after redoing her 12,900 songs, and correcting Meta Data, Apple Music said your wrong and changed at least 10% of her music in some way.
[−] wiether 46d ago
Oh boy!

Creating/maintaining Shortcuts is such a pain!

Having to do it on a small iPhone screen with a touchscreen keyboard, through a no-code interface...

I want an actual text editor, I want to version things with git...

It feels like with Cherri I'll finally be able to actually do things!

Thanks!

[−] luckypeter 46d ago
[dead]
[−] RationPhantoms 46d ago
Still confused on why there is no social component of this? What is the best place to find examples of actual useful Apple Shortcuts?
[−] wlesieutre 46d ago
A lot of examples from Federico Viticci / MacStories (scroll down past the Automation Academy ad)

https://www.macstories.net/shortcuts/

[−] chrisaiv 46d ago
This has everything. https://routinehub.co/
[−] nunez 46d ago
/r/Shortcuts is your best bet.
[−] doc_ick 46d ago
Probably Reddit.
[−] zimpenfish 46d ago
Specifically https://www.reddit.com/r/shortcuts/ since it appears to be the last one standing.
[−] wwalexander 46d ago
I take it this only supports Apple’s built-in actions, and doesn’t plug into the broader AppIntents system? AppIntents includes a packaging concept, would be cool to see if this could use third-party AppIntents in a similar way to how scientific Python uses C modules for performance critical sections.
[−] electrikmilk 45d ago
[dead]
[−] kbd 46d ago
What can you do on a Mac with Shortcuts vs AppleScript vs Hammerspoon?
[−] alin23 46d ago
There are some things that are only available in Shortcuts because Apple gave the app entitlements to communicate with parts of the system that an AppleScript or other apps can't. Things like setting/getting the Focus Mode, changing some system settings like Airdrop Receiving, Color Filters, Background Sounds etc.

Also some apps export Shortcut actions that can run in-app code: for example my Lunar app has an action that can help fixing arrangement when monitors flip around [1]

It's much easier to implement a struct for a Shortcut, than exporting AppleScript sdef files or creating IPC command-line tools, so a lot of apps take this route for code that needs access to the memory of the running app.

[1] https://lunar.fyi/shortcuts#fix-monitor-arrangement

[−] hrmtst93837 46d ago
[flagged]
[−] Pakvothe 46d ago
Love this approach of compiling a readable language to a platform-specific format. Same pattern works well for i18n. Write in one language, compile/translate to the target formats automatically. The developer experience of writing real code instead of clicking through a GUI (Shortcuts app in this case) is always the right bet for power users
[−] hmartin 46d ago
Could you explain more about how the signing setup works?

(That's what held me back most for spending more effort on shortcuts.)

[−] simquat 46d ago
Looks quite cool and I'd like to give a try. What is the main use case for compiling code to shortcuts? I ask because I'm working on a tool[0] that in a way does the opposite.

[0] https://breadboards.io

[−] gigatexal 46d ago
I wish Apple hadn’t gone with shortcuts. Instead I wish they’d given us a proper sdk for iOS and macOS as a Python module.

Python is so easy to pick up they could have given it a low code drag and drop front end but for us who can code why not a proper language ?

[−] threecheese 49d ago
I’m interested to understand how this is different than Jelly; they seem to be similar. Same for Scriptable. I’ve been looking at this to hand over to Claude to build Shortcuts, something which has a terrible development experience.
[−] wateralien 46d ago
I'm guessing that if Apple can get it right with the next LLM based Siri, generating or editing Shortcuts may get easier anyway.
[−] swiftcoder 46d ago

> Cherri (pronounced cherry)

Why would you spell it like that if you don't want me to pronounce it chéri/sherry?

[−] pseudosavant 46d ago
This makes me want to spend some time with Codex just to figure out something fun to do with Shortcuts!
[−] qubex 45d ago
Of course what we need is a native IDE that runs on an iPhone and produces executable scripts…
[−] _doctor_love 46d ago
Very cool! IMHO Apple Shortcuts will finally get the love they're due in the age of AI.
[−] mwkaufma 46d ago
"shortuct"
[−] caycep 46d ago
whither AppleScript?
[−] xihe-forge 46d ago
[dead]
[−] gverrilla 46d ago
typo in title: "Shortuct" instead of "Shortcut" - is this how we're gonna distinguish from llm? /s