Skip to content

Setup

You need Node. Wraith gets found on its own, from the Wraith app’s install or your PATH. If there isn’t one, the first build downloads it.

npm create @ratatoskr.io/plugin my-plugin

It asks a few questions, like the plugin’s name and which game it’s for. Pass --js to skip straight to JavaScript, or --yes to take the defaults.

With Wraith installed, wraith new does the same and also finds the game from its exe, so its id goes in wraith.json too.

wraith new my-plugin --language ts --game D:\Games\Kai\kai.exe
cd my-plugin
npm install
npm run dev

dev builds into dist/ and rebuilds every time you save. The first time, run the wraith dev add line it prints. A running game picks it up, and reloads it after each build.

TypeScript plugins come with these npm scripts.

Command What it does
npm run dev Builds on every change. Skips type checks for speed.
npm run build Type checks and builds dist/ once.
npm run types Refreshes the typings in .wraith/types for your editor.
npm run pack Builds and zips it as <name>-<version>.zip.

For a Lua plugin, zip the folder when you want to share it. The hub wants the files inside a folder named after the plugin’s id, like my-plugin/main.lua. TypeScript plugins have npm run pack for this. For the others, zip what the build put in dist, or zig-out for a Zig build, the same way.

Any editor that speaks TypeScript works, since the typings are plain .d.ts files. wraith.d.ts declares the "wraith" module your code imports from, and salamander.d.ts the "salamander" one.

The Wraith extension for VS Code is optional, but useful.

If autocomplete for Wraith or your own namespace stops working, run npm run types.

The Wraith extension highlights your .sal schemas and has snippets for them.

Made with ♥ by Asgard