Add LabAPI plugin dotnet new template

This commit is contained in:
2026-08-26 23:03:22 +02:00
commit 6f7cff954a
8 changed files with 369 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
# AGENTS.md
This repo is the source of a `dotnet new` template (shortName `labapi-plugin`) that
scaffolds SCP: Secret Laboratory LabAPI plugins. This file follows the
editor/vendor-agnostic [agents.md](https://agents.md) convention for AI coding tools
other than Claude Code (Cursor, Codex, etc.). **`CLAUDE.md` is this repo's primary,
detailed instructions file** — read it first if your tooling can. What follows is the
condensed subset any agent needs, kept in sync with `CLAUDE.md`.
## This is template source, not a plugin
This section applies only while `.template.config/` is present next to this file —
i.e. you're editing the template repo itself, not a plugin already generated from it.
`.template.config/template.json` makes the dotnet templating engine do a **literal,
repo-wide string replacement** at generation time (not semantic renaming): this
folder's own name (`sourceName`) becomes whatever project name a consumer picks, the
placeholder author name in `EntryPoint.cs` becomes their `--PluginAuthor`, and the
LabAPI version pinned in the `.csproj`/`EntryPoint.cs` becomes their
`--LabApiVersion`. See `template.json` for the exact current literals — don't repeat
them verbatim in prose here, since this file ships inside every generated project and
an exact match would get silently rewritten too. Don't introduce an exact match of
one of those literals elsewhere in the repo unless you mean for it to be substituted;
add a new `template.json` symbol instead of hardcoding a magic string. `EntryPoint`/
`Config` (the class names) are intentionally **not** substituted — only the namespace
tracks the project name.
## Never invent LabAPI API surface
Don't assume a LabAPI class/namespace/method/property/attribute exists. Verify it
against the restored `Northwood.LabAPI` package (`LabApi.dll`/`LabApi.xml` under
`%userprofile%\.nuget\packages\northwood.labapi\<version>\lib\net48\`) or
https://github.com/northwood-studios/LabAPI first. If you can't verify a member,
say so instead of guessing.
## Toolchain choices — don't change without being asked
`TargetFramework` is `netstandard2.1` on purpose (LabAPI itself only ships
`net48`/`net481`), chosen so the plugin still loads under the game's Mono/.NET
Framework 4.8 host. `LangVersion` is pinned to `14.0`. The `.csproj` suppresses
exactly `NU1701` (scoped to the `Northwood.LabAPI` `PackageReference`) and `MSB3270`
(via `ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=None`) because of that
netstandard2.1/net48-only-package combination — don't broaden either into a blanket
suppression or remove them.
## Code style and language
No `//`, `/* */`, or `///` comments unless the user explicitly asks for them in that
request; don't add comments restating self-explanatory code — `EntryPoint.cs`/
`Config.cs` are already comment-free, follow the same standard for new files. All
text embedded in code (log/console messages, exceptions, config descriptions,
user-facing strings) defaults to English — e.g. `Logger.Info("Plugin initialized
successfully")` — except identifiers the user requested (project name, namespace,
class/method/property/variable names), which are never translated, and text the user
explicitly asks to be in another language.
## Verifying a change
No automated tests exist. Verify by generating a real project and building it:
```bash
dotnet new uninstall . && dotnet new install .
dotnet new labapi-plugin -n VerifyPlugin -o ../_verify/VerifyPlugin
cd ../_verify/VerifyPlugin && dotnet build
```
Expect `Build succeeded. 0 Warning(s) 0 Error(s)`. See `CLAUDE.md` for the full
verification notes (cache invalidation after editing `template.json`, Windows cleanup
caveats).