This project is a scaffold for creating Factorio MODs.
On Windows, use WSL2; the scripts and tasks assume a Unix shell and are not expected to work natively. Clone the repository inside the WSL filesystem.
- zsh
- mise
- A configured Git identity (
git config user.nameanduser.email). It becomes the initial commit's author and, whenMOD_LICENSE=default_mit, theLICENSE.txtcopyright holder. - GitHub CLI authentication (
gh auth login;ghitself is installed by mise) with admin access to the new repository, which./bin/initializeneeds to change repository settings, create thereleaseenvironment, and set its secret - A Factorio Mod Portal API key, created at https://factorio.com/profile, with the
ModPortal: Publish Mods,ModPortal: Upload Mods, andModPortal: Edit Modsusages../bin/initializeprompts for it to set theFACTORIO_API_KEYsecret. - Optionally, a Claude Code OAuth token from
claude setup-token, which authenticates against your Claude subscription../bin/initializeprompts for it to set theCLAUDE_CODE_OAUTH_TOKENsecret used by the weekly scaffold-drift workflow. Leave it blank to skip; the workflow no-ops until the secret is set.
-
Create a new repository from this template
- On GitHub, click the Use this template button, then clone the new repository
- Or, using the gh CLI:
gh repo create <new-repo-name> --template sakuro/factorio-mod-scaffold --clone
-
cdinto the new repository directory -
Run
mise trust -
Run
./bin/initializeThe script performs the following:
-
Install tools via
mise install -
Generate MOD files (
info.json,locale/en/<MOD_NAME>.cfg,changelog.txt) -
Replace
README.mdwith the MOD title and template repository link -
Download and set up
LICENSE.txtbased on the specified license -
Write release settings (
MOD_LICENSE,MOD_CATEGORY,MOD_TAGS) intomise.toml -
Write the
.scaffold-sync.jsonbaseline for the scaffold-drift workflow -
Remove
bin/initializeitself, amend the initial commit, and force-push it; the script stops here if either fails, before any GitHub setting is changed -
Configure GitHub repository settings
- Auto-delete merged branches
- Auto-merge for pull requests
- GitHub Discussions
- Repository topics (
factorio-mod) - Repository website (MOD portal page)
- Issue labels (project-specific additions; see Issue labels)
- Workflow permissions
releaseenvironmentFACTORIO_API_KEYsecretCLAUDE_CODE_OAUTH_TOKENsecret for the scaffold-drift workflow
-
Configure branch protection requiring pull requests
MOD_LICENSEcan be set to customize the license (defaults todefault_mit); see License identifier- Example:
MOD_LICENSE=default_gnulgplv3 ./bin/initialize - MOD name, title, and author are derived from the current directory name and the GitHub repository owner; edit
info.jsonandlocale/en/<MOD_NAME>.cfgafterward if they need to be different. MOD category and tags are written tomise.tomlwith their default values (no-categoryand empty, respectively) and can be edited there.
-
-
Your MOD scaffold will be ready
GitHub provisions its standard label set (bug, documentation, duplicate, enhancement, good first issue, help wanted, invalid, question, wontfix, accessibility) on every new repository. ./bin/initialize adds four project-specific labels:
| Label | Color | Description |
|---|---|---|
chore |
e4b429 |
Maintenance, tooling, and housekeeping |
test |
0e8a16 |
Tests and test infrastructure |
refactor |
d4c5f9 |
Code restructuring without changing external behavior |
icebox |
add8e6 |
Parked for the future; not scheduled for work |
An initialized repository ends up with 14 labels: the 10 standard ones plus these four.
.github/workflows/scaffold-drift.yml runs weekly in each generated MOD and, via Claude Code Action, opens a chore/scaffold-drift PR when this scaffold's shared infrastructure has moved ahead of the MOD. It runs only when the CLAUDE_CODE_OAUTH_TOKEN secret is set, so it does nothing on a fork. Scheduled workflows are disabled by default in a fork (not in a repository generated from the template). See CONTRIBUTING.md for how to review those PRs.