Skip to content

Commit 8079f5d

Browse files
committed
Create AGENTS.md with guidelines for developers
Added repository-specific instructions for agents working in ArduPilot/MissionPlanner, covering scope, environment, build validation, repository structure, plugin distinctions, and change discipline.
1 parent 87e2a13 commit 8079f5d

1 file changed

Lines changed: 165 additions & 0 deletions

File tree

AGENTS.MD

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# AGENTS.md
2+
3+
This file gives repository-specific instructions for agents working in `ArduPilot/MissionPlanner`.
4+
5+
## Scope and priorities
6+
7+
- Keep changes tightly scoped to the user request.
8+
- Prefer the smallest safe fix over broad refactors.
9+
- Do not “modernize” frameworks, package versions, project layout, or naming conventions unless the task is explicitly about that.
10+
- Avoid drive-by cleanup in this repo. It is large, Windows-first, and contains a mix of application code, libraries, plugins, generated/designer files, installers, scripts, drivers, and copied runtime assets.
11+
12+
## Environment you should assume
13+
14+
- Mission Planner is developed primarily on **Windows** and the README says **Visual Studio 2022** is the recommended build environment.
15+
- Use the repo-provided `vs2022.vsconfig` rather than guessing workloads/components.
16+
- Initialize submodules before building.
17+
- The repository contains an `ExtLibs/mono` submodule and the solution references projects under that tree.
18+
- VS Code may parse the codebase, but the README explicitly says it is **not sufficient for building** Mission Planner.
19+
20+
## Build and validation
21+
22+
Preferred validation path:
23+
24+
1. Windows machine
25+
2. Visual Studio 2022
26+
3. `git submodule update --init`
27+
4. Open `MissionPlanner.sln`
28+
5. Build `MissionPlanner`
29+
30+
If a properly provisioned Windows CLI environment is available, mirror CI behavior as closely as practical instead of inventing a new build flow.
31+
32+
Useful CI facts:
33+
34+
- CI builds `MissionPlanner.sln` in `Release | Any CPU` on Windows.
35+
- CI clears NuGet locals, initializes submodules, restores/builds with VSBuild, and archives output from `bin/Release/net461`.
36+
- Do not assume the app is a modern .NET 6 desktop app just because CI installs a .NET 6 SDK. The main app project targets .NET Framework and outputs to the legacy `net461` release folder.
37+
38+
Minimum expectations before finishing a code change:
39+
40+
- Build the solution, or at least the directly affected project(s), in the proper Windows/VS environment.
41+
- If your change touches existing tests or testable logic, run `MissionPlannerTests` as well.
42+
- If your change affects packaging, startup assets, plugin loading, drivers, or copied content, verify the expected files land in the output directory.
43+
44+
## Repository map
45+
46+
Treat the repo as a large Windows desktop solution with several layers:
47+
48+
- `MissionPlanner.sln` — main solution.
49+
- `MissionPlanner.csproj` — primary WinForms application.
50+
- `MainV2.cs`, `GCSViews/`, `Controls/` — core UI/shell/view logic.
51+
- `ExtLibs/` — a large set of supporting libraries and shared components.
52+
- `MissionPlannerTests/` — test project included in the solution.
53+
- `Plugin/Plugin.cs` — base runtime plugin API.
54+
- `Plugins/...` and some plugin projects under `plugins/...` — compiled plugin projects included in the solution.
55+
- `plugins/example*.cs` and similar files — runtime plugin examples copied to output, not normal app compilation units.
56+
- `Updater/`, `wix/`, `Msi/`, `Drivers/` — installer/update/driver related areas.
57+
- `Scripts/`, `graphs/`, `NoFly/`, XML/JSON assets at repo root — runtime content used by the application.
58+
59+
## Very important plugin distinction
60+
61+
Do not treat every `plugins/*.cs` file as normal compiled application code.
62+
63+
There are two different extension patterns in this repo:
64+
65+
### 1) Compiled plugin projects
66+
67+
The solution includes plugin projects such as:
68+
69+
- `Plugins/Shortcuts/Shortcuts.csproj`
70+
- `Plugins/FaceMap/FaceMap.csproj`
71+
- `Plugins/OpenDroneID2/OpenDroneID_Plugin.csproj`
72+
- `Plugins/TerrainMakerPlugin/TerrainMakerPlugin.csproj`
73+
- `plugins/Dowding/Dowding.csproj`
74+
75+
If you are changing one of these, treat it like normal C# project code and validate it accordingly.
76+
77+
### 2) Runtime `.cs` plugin examples/scripts
78+
79+
`MissionPlanner.csproj` explicitly copies many files like `plugins/example.cs`, `plugins/example2.cs`, etc. to the output as content, while excluding them from normal compilation.
80+
81+
If you are changing one of these files:
82+
83+
- Treat it as a runtime plugin/script artifact, not as a normal compile item.
84+
- Do not convert it into a normal app compile unit unless the task explicitly requires that architectural change.
85+
- Preserve the expected runtime loading model.
86+
87+
## Plugin API expectations
88+
89+
Runtime plugins derive from `MissionPlanner.Plugin.Plugin`.
90+
91+
Important lifecycle/API facts from `Plugin/Plugin.cs`:
92+
93+
- Required members: `Name`, `Version`, `Author`, `Init()`, `Loaded()`, `Exit()`.
94+
- Optional members include `SetupUI(...)`, `Loop()`, `NextRun`, and `loopratehz`.
95+
- `Loop()` runs on a **background thread shared with other plugins**.
96+
- `Exit()` is called on **plugin unload**, not on application exit.
97+
98+
Implications for agents:
99+
100+
- Be conservative with thread-affinity assumptions.
101+
- Do not touch WinForms controls from plugin background-loop code without proper marshaling.
102+
- Keep plugin load/unload behavior predictable.
103+
- Avoid adding blocking work in `Loop()`.
104+
105+
## WinForms and designer files
106+
107+
This is a WinForms-heavy repo.
108+
109+
When editing UI code:
110+
111+
- Prefer changing logic in the main `.cs` file unless the task actually requires designer changes.
112+
- Do not hand-edit `*.Designer.cs` or `.resx` casually.
113+
- If you must change designer-generated files, keep the related `.cs`, `.Designer.cs`, and `.resx` in sync.
114+
- Avoid accidental whitespace/reformat churn in designer files.
115+
116+
## Project and asset handling rules
117+
118+
The main project copies a large amount of runtime content to the output directory: drivers, XML/JSON, graphs, Python scripts, themes, KMZ files, plugin examples, and helper binaries.
119+
120+
Because of that:
121+
122+
- Do not rename, move, or delete runtime content files unless the task explicitly requires it.
123+
- Do not assume a file is unused just because it is not a normal C# compile item.
124+
- Be careful when touching `Drivers/`, `Scripts/`, `graphs/`, `NoFly/`, root XML/JSON, and copied helper executables.
125+
- Preserve existing copy-to-output behavior unless the task is specifically about packaging or deployment.
126+
127+
## Legacy/compatibility posture
128+
129+
This repo contains legacy .NET Framework, WinForms, installer, updater, plugin, and platform-compatibility concerns.
130+
131+
Therefore:
132+
133+
- Prefer compatibility-preserving changes.
134+
- Avoid introducing trendy abstractions or framework migrations as part of unrelated work.
135+
- Avoid broad namespace, file-layout, or solution-structure reorganizations.
136+
- Avoid replacing established project references/content behavior unless there is a clear repository-level reason.
137+
138+
## Code style and change discipline
139+
140+
- Follow the existing local style of the file you are editing.
141+
- Match naming and patterns already used nearby.
142+
- Keep diffs surgical.
143+
- Do not reformat large files just because you touched them.
144+
- Do not perform solution-wide analyzer or style cleanup as a side quest.
145+
146+
## What to mention in your final change summary
147+
148+
When you finish a change, include:
149+
150+
- What you changed
151+
- Why those files were the right place to change
152+
- What you validated
153+
- Any remaining risk or area not validated in a real Windows/Visual Studio runtime environment
154+
155+
## When to stop and reconsider
156+
157+
Pause and reassess before making broad changes if the request would require any of the following:
158+
159+
- Retargeting framework versions
160+
- Reworking build/packaging structure
161+
- Converting runtime plugin examples into compiled project code
162+
- Large-scale renames/moves of copied runtime assets
163+
- Cross-cutting WinForms designer regeneration across many screens
164+
165+
In this repo, those are high-risk changes and should only happen when explicitly requested.

0 commit comments

Comments
 (0)