src/Robots: core library.Robots.csprojbuilds for Rhino3dm/net8,Robots.Rhino.csprojfor RhinoCommon, and both shareRobots.props.src/Robots.Grasshopper: Rhino 8 Grasshopper plug-in and theRobots.Rhinodeveloper NuGet package.src/Package.props: shared product/package metadata used by packable product projects and RhinoPackager. RootDirectory.Build.propsis for repo-wide build defaults only.build/Robots.Build: release packaging through RhinoPackager.tests/Robots.Tests: regression tests.
- Generated robot code is safety-sensitive. Do not change postprocessor output, target ordering, motion types, zones, speeds, frames, tools, configurations, or formatting unless fixing a confirmed bug or proving equivalence; report possible output changes and run the relevant golden tests.
- Prefer this library's managed implementation over native/Rhino equivalents when both exist, but verify equivalence when behavior matters.
- Prefer the simplest coherent design. Keep one implementation per behavior and remove unnecessary layers, fallbacks, indirection, defensive branches, and speculative flexibility.
- Fail fast on missing or invalid data and broken invariants. Do not substitute guessed defaults; catch only for expected recovery, cleanup followed by rethrow, or deliberate boundary handling.
- Use
nullonly for meaningful absence and validate deserialized configuration immediately. With nullable references enabled, avoid redundant null-only guards; validation that also checks null, such asThrowIfNullOrWhiteSpace, is fine. - Use modern C# features supported by the project's configured language version, including collection expressions and target-typed
new. PreferList<T> items = new();overvar items = new List<T>();, and use inlinenew(...)where the target type is known. Do not add statements, declarations, or variables solely to enable target-typednew; retain an explicit constructor when needed. Check touched C# code for these conventions before finishing. - Omit access modifiers when the default is intended; a member cannot be more visible than its containing type. Use an
Asyncsuffix only when a synchronous counterpart exists or a framework requires it, andsealedonly with intent. - Prefer records and primary constructors for immutable data carriers; use classes for services, mutable state, exceptions, and framework lifecycle types.
- Keep C#
usingdirectives in one contiguous block with no blank lines. Order normal imports by source:System, third-party,Rhino,Grasshopper, thenRobots; place aliases and static imports after normal imports. - Leave a blank line before an unbraced single-statement
if, unless it starts the block, and after a multiline statement. - Prefer arrays for fixed or known-size geometry data. Materialize sequences before counting, indexing, retaining, mutating, or repeated enumeration.
- Treat RhinoCommon geometry, arrays, and domain objects as immutable by convention. Copy only at mutation or ownership boundaries; short-lived owned mutation is fine in hot paths.
- New components and parameters should normally derive from the custom
ComponentandParambase classes. - Keep component bodies to
RegisterInputParams,RegisterOutputParams, andSolveComponent; use helpers and domain types, and keepGH_*wrappers in goo, parameter, and data-access infrastructure. - Domain goo wrappers should inherit the shared
Goo<T, TGoo>base and add only real custom casting, preview, validation, or serialization behavior. - Let the shared component base catch exceptions and show runtime messages; component code should throw clear exceptions instead of propagating failure state.
- If code reads an input by visible parameter name, update it when the parameter name changes.
- Obsolete components must keep old GUIDs and port layouts so files deserialize and wires stay attached. Hide them, mark them obsolete, and fail immediately with a clear replacement message.
- Icons should normally be named after the component/parameter class and loaded by convention.
- Prefer SDK defaults and CLI arguments for one-off variants. Add props or targets only for consumer/runtime contracts, and separate project files only for stable
ProjectReferencetargets or outputs that must remain distinct. Robots.Rhinois compile-time-only for consumers: useref/<tfm>/, keep runtime assemblies out of consumer output, and forward required McNeel props/targets.- Use
None Pack="true"for package-only files andContentonly for real project content. Keep package assets under the owning project'sResources/Packagefolder, with exactPackagePath,TargetPath, and casing. - If suppressing a NuGet warning, add a short comment explaining the package contract.
- Run the narrowest useful checks, but include
dotnet buildwhen code changes warrant it. - For formatting-sensitive edits, run
dotnet format whitespace Robots.slnx --verify-no-changes --no-restore --verbosity minimaland resolve code-style warnings from the build. Review import order manually because the combined and style formatters force alphabetical imports instead of the repository's source-group order. - For package-resource changes, run
dotnet packand inspect.nupkgcontents. - For
Robots.Rhinopackage changes, verify a disposablenet8.0consumer builds and its output lacks Robots, RhinoCommon, and Grasshopper runtime assemblies. - Do not run build and tests in parallel when they write the same output DLLs; build first, then test with
--no-build. - When testing same-version local packages, use a workspace-local
NUGET_PACKAGESfolder or clear the relevant cache.