A fast, reproducible build tool and dependency manager tailored specifically for SourceMod (SourcePawn) plugin development.
SourceKnight brings modern package management concepts to the SourceMod ecosystem, eliminating manual include header management, SDK extraction scripts, and the need to commit third-party vendor code into your plugin repositories.
| Traditional Workflow | With SourceKnight |
|---|---|
Manually downloading and unzipping SourceMod builds (spcomp). |
Declare type: smdrop (e.g. 1.12.x) and let SourceKnight manage the compiler automatically. |
Committing vendor .inc files directly into your repository. |
Declare dependencies in sourceknight.yaml; keep your repository clean and modular. |
Slow serial compilation across multiple .sp plugin targets. |
Parallel compilation (-j / --parallel) leveraging multi-core CPUs. |
| Verbose manual unpack rules for include folders. | Zero-config heuristic include discovery across standard directory structures. |
| Complex CI/CD shell scripts to set up include paths. | Single-step GitHub Action (SparkyCloudy/sourceknight@master) with built-in caching. |
- Multi-Source Dependency Management: Acquire dependencies from Git repositories, pre-built binary releases (GitHub, GitLab, Gitea), AlliedModders SMDrop builds, and archive files.
- Parallel Compilation (
-j/--parallel): Concurrently compiles multiple.sptargets in parallel. - Zero-Config Include Resolution: Automatically scans and maps
addons/,include/,scripting/, and loose.incheaders into the virtual build tree without requiring manual unpack mapping. - Native Packaging & Distribution Engine: Smart auto-discovery and bundling of compiled
.smxbinaries alongside runtime assets (translations,configs,gamedata,cfg,sound,models,materials,common) into structured package directories or compressed release archives (.zip/.tar.gz). - Resilient Compilation Loop: Builds all targets and reports overall status, with optional
--fail-fastand--report jsonoutput. - Formatted & Colorized Diagnostics: Highlights compiler errors and warnings with ANSI colors in terminals and generates inline annotations in GitHub Actions.
- Dynamic Dependency Overrides: Override dependency versions at runtime via CLI flags (
--override-dep) or environment variables (SK_OVERRIDE_<NAME>) for CI matrix testing. - Official GitHub Action: Pre-packaged composite action with standalone binary download and dependency caching support.
Download the pre-compiled binary executable for your platform from the latest GitHub Release:
-
Linux (x86_64):
curl -fsSL https://github.com/SparkyCloudy/sourceknight/releases/latest/download/sourceknight-linux-x86_64 -o /usr/local/bin/sourceknight chmod +x /usr/local/bin/sourceknight
-
Windows (x86_64): Download
sourceknight-windows-x86_64.exeand add it to your systemPATH.
Install via pip from GitHub:
pip install git+https://github.com/SparkyCloudy/sourceknight.gitOr clone and install locally in editable mode:
git clone https://github.com/SparkyCloudy/sourceknight.git
cd sourceknight
pip install -e .Requires Python >= 3.12 (for pip installation).
my-plugin/
├── sourceknight.yaml
└── addons/
└── sourcemod/
├── scripting/
│ ├── my_plugin.sp
│ └── include/
│ └── my_plugin_internal.inc
├── translations/
│ └── my_plugin.phrases.txt
└── configs/
└── my_plugin.cfg
project:
sourceknight: 0.7
name: my-plugin
dependencies:
# Official SourceMod compiler & core headers
- name: sourcemod
type: smdrop
version: 1.12.x
# Third-party Git repository (auto-extracts include headers)
- name: multicolors
type: git
repo: https://github.com/srcdslab/sm-plugin-MultiColors
# Pre-built binary release asset (GitHub, GitLab, or Gitea)
- name: ptah
type: release
repo: komashchenko/PTaH
version: latest
# Root source directory containing your plugin
root: /addons/sourcemod/scripting
# List of target .sp files to compile (without .sp extension)
targets:
- my_plugin
# Optional: Custom packaging & release distribution settings
package:
output: build/package
archive: zip # Options: "zip", "tar.gz", "both", or false# Build only
sourceknight build
# Build and package for distribution in one command
sourceknight build --package -o dist/This command runs the entire pipeline automatically:
update: Concurrently downloads and caches all declared dependencies.unpack: Stages headers and assets into an isolated build tree at.sourceknight/build/.compile: Concurrently invokesspcompacross targets and outputs.smxbinaries.package: Auto-discovers and bundles.smxbinaries and runtime assets intodist/.
For projects with multiple plugin targets, compile concurrently across all available CPU cores:
sourceknight build -j 4Bundle compiled plugins and assets directly into .zip or .tar.gz release archives:
# Package into custom directory
sourceknight package -o /tmp/package
# Package and create both .zip and .tar.gz archives
sourceknight package -o dist/ --zip --tarGenerate a structured JSON compilation report and fail fast if desired:
sourceknight build --report json --fail-fastDriver (type) |
Description | Example Configuration |
|---|---|---|
smdrop |
AlliedModders official SourceMod builds | name: sourcemodtype: smdropversion: 1.12.x |
git |
Git repository (shallow clone) | name: multicolorstype: gitrepo: https://github.com/srcdslab/sm-plugin-MultiColorsversion: master |
release |
Release asset from GitHub / GitLab / Gitea | name: ptahtype: releaserepo: komashchenko/PTaHversion: latestasset_pattern: "*linux*.zip" |
zip |
Remote .zip archive URL |
name: libtype: ziplocation: https://example.com/lib.zip |
tar |
Remote .tar / .tar.gz archive URL |
name: libtype: tarlocation: https://example.com/lib.tar.gz |
file |
Local directory or archive in project | name: local-sdktype: filelocation: ./vendor/sdk.zip |
Use the official SourceKnight action in .github/workflows/ci.yml for fast, zero-boilerplate builds and packaging:
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup SourceKnight
uses: SparkyCloudy/sourceknight@master
- name: Build and Package
run: sourceknight build --package -o /tmp/package
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: Linux
path: /tmp/package| Command | Description |
|---|---|
sourceknight build |
Runs the full build cycle (update → unpack → compile). |
sourceknight package (alias pack) |
Assembles compiled binaries and assets into a distribution package directory or archive. |
sourceknight update |
Concurrently fetches and updates all dependencies into .sourceknight/cache. |
sourceknight unpack |
Extracts dependencies from cache into .sourceknight/build. |
sourceknight compile [targets...] |
Compiles all or specific targets using the resolved compiler. |
sourceknight status |
Displays cache and unpack version state for all dependencies. |
-P, --package: Run packaging step after successful compilation (sourceknight build -P).-o, --output <path>: Specify destination output directory for packaging or compilation.--zip: Generate a compressed.ziprelease archive when packaging.--tar, --tar-gz: Generate a compressed.tar.gzrelease archive when packaging.-j, --jobs, --parallel <N>: Set maximum concurrent compilation worker threads.--fail-fast: Abort compilation immediately on the first target failure.--report json: Generatecompile_report.jsonwith detailed target metrics.--no-color: Disable ANSI color rendering in compiler diagnostics.--override-dep <name>=<version>: Override dependency versions at runtime.--clean(forunpack/package): Clean destination directories before unpacking or packaging.
SourceKnight is open-source software licensed under the MIT License.