Contributing
Last updated:
- Published on
Overview
概述
This page is for contributors working on the KitLib repository. To install the released mod only, see Install.
本文面向 KitLib 仓库贡献者。若只需安装已发布 mod,请参阅 安装。
Dev setup
开发环境
Prerequisites: .NET 9 SDK; Python 3 (for make init, release scripts, icon tooling).
First-time setup:
git clone https://github.com/WRXinYue/STS2-KitLib.git
cd STS2-KitLib
make init # detect STS2 + Godot paths, write local.propsCommon Makefile targets:
| Target | Description |
|---|---|
make init | Detect STS2 + Godot, write local.props |
make build | Artifacts under build/KitLib/ |
make sync-full | Build + deploy to game mods/KitLib/ |
make format | dotnet format KitLib.sln |
make docs | Valaxy dev server (docs/) |
make upload-all | Release zip + GitHub / Nexus / Steam |
前置条件: .NET 9 SDK;Python 3(make init、发布脚本、图标工具)。
首次配置:
git clone https://github.com/WRXinYue/STS2-KitLib.git
cd STS2-KitLib
make init常用 Makefile 目标:
| 目标 | 说明 |
|---|---|
make init | 检测 STS2、Godot,写入 local.props |
make build | 产物在 build/KitLib/ |
make sync-full | 构建并部署到游戏 mods/KitLib/ |
make format | dotnet format KitLib.sln |
make docs | Valaxy 开发服务器 |
make upload-all | 发布 zip + GitHub / Nexus / NuGet / Steam |
Code style (C#)
代码风格 (C#)
- Braces — K&R (1TBS): opening
{on the same line; closing}on its own line. - Indentation: 4 spaces per
[*.cs]in.editorconfig. Line endings LF. - Language level: C# 12, nullable enabled, file-scoped namespaces.
- Fix or narrowly suppress analyzer warnings; avoid broad
#pragmadisables.
- 花括号 — K&R (1TBS):开括号
{与声明同行;闭括号}单独一行。 - 缩进:
.editorconfig中[*.cs]为 4 空格,行尾 LF。 - 语言版本: C# 12,nullable,文件级命名空间。
- 修复或针对性抑制分析器警告,避免宽泛
#pragma。
Python scripts
Python 脚本
Scripts under scripts/ use Black (pyproject.toml) and flake8 (setup.cfg).
scripts/ 使用 Black(pyproject.toml)与 flake8(setup.cfg)。
Localization
本地化
User-visible strings live in src/KitLib.Core/Localization/eng.json and zhs.json. Add keys to both files using dot.separated.lowercase.
Docs site
文档站
Documentation lives under docs/pages/ (Valaxy). From the repo root:
make docs # dev server
make docs-build # static output → docs/dist/Markdown / Valaxy i18n: writing guide.
Extension authors: STS2 version compatibility.
文档位于 docs/pages/(Valaxy)。仓库根目录:
make docs
make docs-buildMarkdown / Valaxy 国际化:编写指南。
扩展开发:STS2 版本兼容。
Collaboration
协作规范
- Conventional Commits for PR titles (
feat:,fix:,docs:, …). - Keep changes scoped; avoid drive-by reformatting.
- Before a PR:
dotnet buildonKitLib.sln,make format, andflake8 scriptswhen touching Python. - Do not commit
local.props,.env, or generated assets undericons/.
- PR 标题使用 Conventional Commits(
feat:、fix:、docs:等)。 - 改动范围限于相关功能;避免顺手全库格式化。
- 提 PR 前:
dotnet build(KitLib.sln)、make format;改 Python 时运行flake8 scripts。 - 勿提交
local.props、.env、icons/生成物。