Script Kit
Scripting isn't so bad y'all

Hey hey; Iโm back again and today I wanna talk about Script Kit; I heard about it from Kent (in passing) whilst attending Epic Conf! In short, itโs primary purpose is to help developers automate tedious parts of their workflows with an easy to use scripting platform. All the scripts you write are in JS and TS (see ya later bash) and by virtue of making JS + TS first class citizens, you can do some real nifty things.
There are 4 reasons why I like Script Kit
and Iโll be elaborating on each. If
youโre too busy or too lazy to read the rest of the article (both of which are
fine reasons to not read anything), hereโs the tldr:
- It allows you to automate tedious tasks with its nifty scripting features.
- Itโs super fun to learn (if youโre into that kinda thing, which I am).
- It lowers the barrier to entry for scripting to include people who mostly us JS + TS and not things like bash or python.
- Your scripts can run in a GUI or the CLI; great because you canโt really drag and drop things in the CLI.
Automate All the Things
I once heard of a developer that would automate any task that he had to repeat more than twice in a given week (or something to that effect). This man wrote a script that would send out a text to his wife at 5:00 pm if he has not logged off his work computer, giving her some randomized excuse for why he was running late. I mean, Iโm not saying I would do that but Iโm not saying that I wouldnโt either โ although my script would give her the honest reason (work has been chaotic and chances are something is most likely on fire ๐). While I donโt think Iโd ever go as far as automating something if I had to do it more than twice in a week, there is something to be said about the spirit of automating tedious tasks that have to get done but arenโt necessarily a good use of our time!
In my case, whenever we do a release to production at work, I, like a lot of
folks, need to wait for our cache to invalidate before I can tell our QA
Engineers to kick off regression tests. Ideally, there would be some sort of
webhook that gets fired once the cache has been invalidated in our CI process
but, like a lot of companies, weโve got bigger fish to fry than improving our CI
process and improving our developer experience. Prior to Script Kit
, I would
wait around for 10ish minutes and check the version manually because within that
10ish minutes, there was a pretty good chance (not an absolute chance) that the
version would update. Essentially the flow looked like the below:
However, it was equally likely that the version could update within one minute or within ten minutes so the ten minutes I listed above is the upper bound for the longest time estimate. My coworker Daniele didnโt like that we had to manually check and you can imagine why: one canโt enter flow state because theyโve got the looming release on their mind and if they do enter flow state, they might accidentally forget to notify folks that the production release is ready for testing โ Iโm guilty of the latter where the cache invalidates within 5 minutes but because I was busy writing code for another feature, I ended up not telling folks until 30ish minutes later ๐ .
Daniele wrote up a quick node script (him and Copilot I presume) that would ping
the prod server for ten minutes and upon either timeout or successful version
change, heโd get a notification on his phone (and apple watch) about the status
of the change. I personally didnโt use his script โ not because it wasnโt good
but because it seemed like a hassle to set up another alias on my bash profile
to execute some random node script. Iโm lazy, I know ๐. However, after
Epic Conf, I decided to give Script Kit
a try and
tweaked his version checker script for Script Kit
โ which was pretty easy
since his code was already written in JS. Not only did his script work, but I
was also able to improve on it by removing some verbosity around fetch calls as
Script Kit
has nice little helpers like get
and open
available in the
runtime! You can see the example here:
// Name: Version pinger
// Author: Taran Bains
import "@johnlindquist/kit";
const url = await arg("Set URL:", []);
// I use ntfy to subscribe to messages
const topic = await arg("Set ntfy topic:", [""]);
async function sendNotify(msg: string) {
try {
await $`curl -d "${msg}" ntfy.sh/${topic}`;
} catch (error) {
console.error("Notification Error:", error.message);
}
}
let firstVersion = (await get(url))?.data?.version;
let lastVersion = firstVersion;
const startTime = Date.now();
const timeLimit = 10 * 60 * 1000;
async function checkVersionChange() {
try {
const response = await get(url);
const newVersion = response.data.version;
if (newVersion !== lastVersion) {
await sendNotify(`Version changed from ${lastVersion} to ${newVersion}`);
lastVersion = newVersion;
return false; // Stop checking after version change
}
return true; // Continue checking
} catch (error) {
console.error("Error fetching version:", error.message);
}
}
async function startPinging() {
const interval = setInterval(async () => {
if (Date.now() - startTime > timeLimit) {
clearInterval(interval);
await sendNotify("Timed out checking version");
} else {
const shouldContinue = await checkVersionChange();
// log the date in a human readable way
let prettyDate = new Date().toLocaleString();
console.log(
`${prettyDate} - Pinging ${url}. Old Version: ${firstVersion}`,
);
if (!shouldContinue) {
clearInterval(interval);
notify("Finished running script");
}
}
}, 3000);
}
startPinging();
Iโll be honest, after creating that first script, I got a little trigger happy and automated a few more tasks ๐ณ. I automated opening up the URL for my deployed feature branches, I automated querying my open pull requests by Jira ticket number, and I automated opening the current running CI pipeline for specific feature branches โ all these things were easy enough to do manually but theyโd require me clicking around the browser a handful of times, which while not bad in and of itself, was definitely annoying.
Super Fun
If it isnโt abundantly clear to you by now, I absolutely love to learn (I also
curse like a sailor). So when I say it was fun to learn about scripting and
Script Kit
, you shouldnโt be surprised.
What made it fun, at least for me, was that I had found a new way to improve
upon my life! Iโm constantly chasing progress and improvement โ not because Iโm
not content, I am, but because getting better is incredibly invigorating. That
feeling of being level 1 and getting to level 5, oof, it just hits different.
Also, as yโall know, I am a Sikh
and the world Sikh
in Punjabi literally
translates into to learn
, so thereโs a certain fulfillment I feel when I learn
something new, irrespective of whether or not itโs related to faith.
เจตเจฟเจฆเจฟเจ เจตเฉเจเจพเจฐเฉ เจคเจพเจ เจชเจฐเจเจชเจเจพเจฐเฉ เฅฅ Consider and contemplate upon knowledge, and you will become a benefactor to others.
-Guru Nanak Dev Ji
Plus, and Iโve said this before, variety is the spice of life! Try something new! Whether thatโs scripting or trying to do a backflip, donโt allow yourself to fall into a rut โ invoke that beginners mindset and whatโs an easier way than, you know, trying something new ๐!
Scripting for All
Scripting felt like this magical far away skill reserved for linux system admins
who had a profound and intimate knowledge of bash
โ not a full stack (but
mostly frontend) developer such as myself. It legitimately felt like it was
going to be way too much effort to get started learning how to script
properly because it required me to learn bash and other tools. And yes, I
know, I write TypeScript
for a living (script is in the name) and yes, I know,
tools like google/zx exist to help make
scripting easier, but still, it didnโt feel like the friction I was going to
face when getting started was going to be worth the eventual payoff. Unlike the
traditional meme developer, I donโt like to spend 6 hours of my life automating
a task that only takes me a minute to do.
Another thing about scripting and this is unrelated to anything really to do
with the tooling, but I didnโt feel empowered
to easily share my
scripts/automations with my coworkers. As I mentioned above, the whole reason I
didnโt want to use my coworkers node script is because I was lazy and not in
the right way (but I guess maybe in the right way, because if I wasnโt this kind
of lazy, then Scriptkit wouldnโt be a thing). But another reason is that I
didnโt want to have to deal with the whole โwell it works on my machine and my
version of nodeโ issue if I ever shared a script with a colleague. The whole
point of scripting was to help make my life easier โ not make it harder by
having me answer and provide help to my colleagues when my tiny script to ping
our prod server failed to work for them ๐ฅ.
Look how easy and small the script to empty your trash is! After the set up of
Script Kit
, itโs as easy as running empty-trash
from the terminal to empty
my Macโs trash (or Windows Recycle Bin)!
// Name: Empty Trash
// Author: Ricardo Gonรงalves Bassete
import "@johnlindquist/kit"
import emptyTrash from 'empty-trash'
await emptyTrash()
A Gui + Terminal Interface
Alright, yโall know it, I know it, my family even knows it โ I love the
terminal! I picked up neovim
2 years ago and havenโt looked back! However,
that isnโt to say that I donโt use GUIs โ GUIs definitely have their place in
my toolbelt. GUIs are greatโฆ and thatโs why itโs awesome that Script Kit
includes a GUI and a CLI for us to use.

One script I use pretty often is cloudinary upload. I already tried using it from the terminal and it doesnโt work ๐ since we donโt have a drag and drop interface for the terminal (at least not one that Iโm aware of). Thatโs why itโs super great to have the GUI โ if there are certain elements that require a GUI, we get that.
However, the chrome-bookmark script that I wrote can run in the terminal (it has no dependency on GUI elements) so I lovingly use it in the terminal. Check it out when you get a chance! Isnโt that so cool; You get the best of both worlds!
Closing Thoughts
Okay so, automation is great. Script Kit is great. However, if youโre not careful and donโt understand the inherent risks of scripting, hold off and ask for help! We donโt want to be willy nilly installing packages to our machines and executing the code.
Check it out and publish your scripts to the community; if you have any cool scripts that youโve written, send them my way!