Loathers.netOctober 4, 2026 // Scripting Resources
EDITORâS NOTE: This guide is an amalgamation of two posts, one by Frazazel and one by Sweaty Bill. Using the dark magicks of reading comprehension and guile, I have stitched them together into one guide. We will try to keep this a bit more updated than some of the older guides! â Scotch
Letâs say youâve read the JS Overview and decided TypeScript is the way to go for your new script. Youâre staring blankly at an empty folder, wondering whatâs next. Good news! This guide is what you need to figure that out. While this guide was originally written for Windows users, weâve tried to add some cross-OS notes when things differ.
Before we start, one encouraging notion: the TypeScript ecosystem exists well outside of KoL scripting. Nearly everything mentioned in this guide is used by millions of developers worldwide (possibly including Mr. Worldwide), so virtually any error you hit along the way is eminently Googleable. Searching for âinstall vscode windowsâ or pasting an error message will usually get you an answer in the first link or two. (Well, it did before AI overviews started messing with Google results. But you probably can still find it if youâre crafty.)
The full list of what weâll be installing:
Download the installer for Visual Studio Code. Run the installer and leave the default options checked. (If youâre on Mac, download the Mac version.)
Download and install Node.js. If youâre given a choice of versions, pick the LTS (long-term support) version; the latest release can (occasionally) be too cutting-edge for some tools.
If you expect to be juggling several projects that need different versions of Node, you can instead install Node Version Manager (nvm), to manage separate node versions. The process slightly differs by operating system:
nvm install lts followed by nvm use lts. Microsoft has a good walkthrough of this approach. This is entirely optional; the regular installer works just fine, and will be sufficient for most users.Git differs a bit depending on operating systems as well.
git --version in the terminal (which spawns an installation prompt that will install Xcode command line tools, including Git), or brew install git if you already have Homebrew installed.sudo apt install git or the distroâs equivalent. (That works for Debian-based distributions, while others may use yum, pacman, or dnf instead of apt.)Once Git is installed, run the following in your terminal, using your name and email associated with your GitHub account:
git config --global init.defaultBranch main
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Open VSCode and install the following extensions:
You may see older guides recommend the Prettier extension as well; it is no longer recommended. Just run yarn run format before you commit.
First, pick where you want your scripting projects to live. (As an example, one may have a Documents/GitHub/ folder.) Open the folder in VSCode via File > Open Folder, and then open VSCodeâs built-in terminal with Ctrl+` .
In your terminal, run the following two commands to install yarn:
npm install -g corepack
corepack enable
corepack enable may not print anything, which is fine; no news is good news. You only need to do this once per computer, not once per script. (If you are on Mac or Linux, and did not use the nvm route discussed earlier, you may need to use a sudo command to install corepack.)
In your terminal, run:
yarn create kolmafia-script scriptname
Answer its questions, and choose to install libram. Choose to install grimoire if you want to use it for adventuring tasks or for its argument handling. It will then install a whole bunch of stuff and configure it with great defaults. It should add most of the packages you need, and it will also create a git repository for you. Donât be alarmed by the very large node_modules folder it creates; thatâs where all of those packages live, and itâs supposed to be there.
In your terminal, change directory into the folder it just created:
cd scriptname
Open src/main.ts in VSCode. (We recommend opening the containing folder of your script with âFile > Open Folderâ and selecting that file through the left-hand sidebar). Write some TypeScript code to do something, and save it.
In your terminal, run:
yarn run build
After a few seconds, it will create a .js script in a new dist/scripts/scriptname/ folder.
For this step, we need to place a symlink in your KoLmafia folder so that you donât need to copy the script over to mafia every time you build it. The default location of your mafia folder varies by OS, which will lightly vary the installation command needed:
.jar file you use to start mafia lived. You will need to find that path and pass it to a new install command, which should look like yarn run install-mafia "C:\Users\YourName\Documents\KoLmafia", replacing the path to wherever you are currently storing your mafia files.yarn run install-mafia. (In case youâre curious, the Mac default location is ~/Library/Application Support/KoLmafia.) If youâve moved it, pass the path like the Windows example.yarn run install-mafia. (In case youâre curious, the Linux default location is ~/.kolmafia.) If youâve moved it, pass the path like the Windows example.Open KoLmafia, type scriptname into the GCLI, and watch it do its thing.
Once everything is set up, your day-to-day loop looks like this:
yarn run build. The symlink we set up in Step 11 allows KoLmafia to see the newly generated script. (Consider enabling rebuild-on-save with yarn run watch â this means you donât need to run build all the time, which can be nice for your development flow.)The tools you installed in Steps 1 through 6 are also everything you need to work on someone elseâs TypeScript script, like garbage-collector. Rather than creating a new script, youâll fork the project on GitHub, clone your fork, and install its dependencies:
git clone https://github.com/your-username/garbage-collector.git
cd garbage-collector
yarn install
yarn run build
If the build finishes without errors, everything is working. Our guide on how to submit a pull request covers forking, branching, and getting your changes back into the original project in much more detail.
There are a number of things this guide doesnât address, but that you should probably know about:
release branch every time you push to main. Players can then install it with git checkout yourname/scriptname release; we recommend putting that in your README.md for ease of use.package.json, rollup, TypeScript, and ESLint via their saved configuration files is sometimes a thing you should do, but thatâs too much for this guide. Just know that these configuration files are there, and you can change them!