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:

bash
git clone https://github.com/WRXinYue/STS2-KitLib.git
cd STS2-KitLib
make init   # detect STS2 + Godot paths, write local.props

Common Makefile targets:

TargetDescription
make initDetect STS2 + Godot, write local.props
make buildArtifacts under build/KitLib/
make sync-fullBuild + deploy to game mods/KitLib/
make formatdotnet format KitLib.sln
make docsValaxy dev server (docs/)
make upload-allRelease zip + GitHub / Nexus / Steam

前置条件: .NET 9 SDKPython 3make init、发布脚本、图标工具)。

首次配置:

bash
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 formatdotnet format KitLib.sln
make docsValaxy 开发服务器
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 #pragma disables.
  • 花括号 — 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/ 使用 Blackpyproject.toml)与 flake8setup.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.

用户可见字符串位于 eng.jsonzhs.json。新键需双语,格式 dot.separated.lowercase

Docs site

文档站

Documentation lives under docs/pages/ (Valaxy). From the repo root:

bash
make docs        # dev server
make docs-build  # static output → docs/dist/

Markdown / Valaxy i18n: writing guide.

Extension authors: STS2 version compatibility.

文档位于 docs/pages/(Valaxy)。仓库根目录:

bash
make docs
make docs-build

Markdown / Valaxy 国际化:编写指南

扩展开发:STS2 版本兼容

Collaboration

协作规范

  • Conventional Commits for PR titles (feat:, fix:, docs:, …).
  • Keep changes scoped; avoid drive-by reformatting.
  • Before a PR: dotnet build on KitLib.sln, make format, and flake8 scripts when touching Python.
  • Do not commit local.props, .env, or generated assets under icons/.
  • PR 标题使用 Conventional Commitsfeat:fix:docs: 等)。
  • 改动范围限于相关功能;避免顺手全库格式化。
  • 提 PR 前:dotnet buildKitLib.sln)、make format;改 Python 时运行 flake8 scripts
  • 勿提交 local.props.envicons/ 生成物。