GitHub Copilot instructions

Base rules for every agent: AGENTS.md. Rules for certain files load by path from .github/instructions/ (generated from .agents/rules/): code-generation, dependencies, github, plc4c, plc4go, plc4j, plc4net, plc4py, protocols, website. Procedures are skills in .agents/skills/ (AGENTS.md, “Task → Skill Routing”).

Review-critical rules

The AGENTS.md sections marked (review-critical): what a review can check in a diff, a commit message or a PR title.

⛔ A protocol or driver change covers every language

One protocol is implemented in up to five languages (plc4j, plc4go, plc4c, plc4net, plc4py), generated from one mspec plus hand-written driver code. A change to an mspec or a shared test suite (protocols/**), to a generator or template (code-generation/**, plc4net/tools/code-gen/**), or to a driver feature (connection-string parameter, tag syntax, data type, default, behaviour) lists in the PR body every language that implements that protocol and, for each, either carries the update (regenerated code, hand-written helpers, tests) or says why not (“plc4c: no driver for this protocol”, “plc4py: follow-up issue #N”). How to find the languages: the protocols rule. A review flags an mspec change whose regenerated code is missing for a language that generates that protocol, and a driver feature added in one language without that list.

⛔ Generated code is regenerated, never hand-edited

Generated code is checked in for every language: plc4j/drivers/*/src/main/generated/, plc4go/protocols/*/readwrite/, plc4c/generated-sources/, plc4net/drivers/*/model/, plc4py/plc4py/protocols/*/readwrite/. Its files say Code generated ... DO NOT EDIT. Change the mspec or the template instead, regenerate (regenerate-code skill) and commit the regenerated files in the same PR. A review flags an edit to a generated file without the source change that produces it, and a source change without the regenerated files. Hand-written helpers next to the generated code (StaticHelper.java/.go/.py, *_static.c, *.Manual.cs, __init__.py) are edited by hand.

⛔ Every new file carries the Apache license header

ASF policy; the RAT check (apache-rat-plugin, phase test) fails the build without it. Copy the header in the file's comment syntax from a neighbouring file (Markdown: an HTML comment, after the frontmatter if there is one; AsciiDoc: // lines). Do not add a file to the RAT excludes to make the check pass. Never copy code or text from a source whose license is not Apache-compatible (ASF third-party policy, generative tooling guidance); vendor protocol specifications are usually copyrighted: describe the structure, do not paste their text.

⛔ Commit messages and PR titles follow Conventional Commits

<type>(<scope>): <summary>
  • type: feat, fix, docs, test, refactor, perf, build, ci, chore, revert
  • scope: plc4<lang>/<component> for one language (plc4go/bacnet, plc4j/modbus, plc4net/s7), the protocol alone for a change across languages (s7), codegen/<lang> for a template, deps for dependencies
  • summary: lowercase, imperative, no trailing period, says what changed

Pull requests are squash-merged (the only merge button in .asf.yaml): the PR title becomes the commit subject on develop, so it follows the same format. Issues are referenced in the PR body (Fixes #N), not in the title.

⛔ Generative-AI assistance is disclosed

A contribution produced with the help of a generative AI tool says so, as the ASF generative tooling guidance recommends: a Generated-by: <name of tool> <version> token in the commit message (a trailer line at the end) and a note in the PR description. The tool's terms must not restrict use of its output in ways that conflict with the Open Source Definition, and its output must not include third-party material that is not used with permission; the guidance has the exact conditions.

⛔ Tests come with the change

New behaviour and bug fixes come with a test that fails without the change. A change to parsing or serializing gets a case in the protocol's shared test suite (protocols/<name>/src/test/resources/**), which every language runs. Parsers treat bytes from the wire as untrusted (THREAT-MODEL.md): malformed input ends in an error, never in a panic, a crash, an endless loop or an allocation sized by the input.