Skip to content
SheetForge

Plugin contracts

This page lists the Core types a plugin registers through. It covers the plugin interfaces, the composition that assembles them, the registries they fill, and pipeline observation.

Plugin interfaces

The plugin registration contracts live in SheetForge.Core.Plugins. ISheetForgePlugin is the base contract. Every other interface is an opt-in add-on.

TypeKindRole
ISheetForgePlugininterfaceThe base domain-plugin contract
ISheetForgeValidatorPlugininterfaceValidation rules
ISheetForgeEdgePlugininterfaceEdge declarations
ISheetForgeMarkerPlugininterfaceCustom structural markers
ISheetForgeTemplatePlugininterfaceCreate sheet templates
ISheetForgeGraphPlugininterfacePer-tab Data Studio canvas overrides
ISheetForgeCodeRegistryPlugininterfaceCode-owned reference targets (locked virtual tabs)
ISheetForgeThemePlugininterfaceWindow color presets
ISheetForgeStudioPlugininterfaceDeclarative authoring surfaces
ISheetForgeStringsPlugininterfaceThe plugin's own UI strings per language
ISheetForgePipelinePlugininterfacePipeline observers

Interface members

TypeMembers
ISheetForgePluginstring Name · RegisterEnums(EnumRegistry) · RegisterCellParsers(CellParserRegistry)
ISheetForgeValidatorPluginRegisterValidators(DomainValidatorRegistry)
ISheetForgeEdgePluginRegisterEdgeContributors(EdgeContributorRegistry)
ISheetForgeMarkerPluginRegisterStructuralMarkers(MarkerRegistry)
ISheetForgeTemplatePluginRegisterTemplates(TemplateRegistry)
ISheetForgeGraphPluginRegisterGraphShapes(GraphShapeRegistry)
ISheetForgeCodeRegistryPluginRegisterCodeRegistries(CodeRegistryCatalog)
ISheetForgeThemePluginRegisterThemes(ThemeRegistry)
ISheetForgeStudioPluginRegisterStudioUi(StudioUiRegistry)
ISheetForgeStringsPluginRegisterStrings(StringOverlayRegistry)
ISheetForgePipelinePluginRegisterPipelineObservers(PipelineObserverRegistry)

Contracts that reach both hosts

ISheetForgeStudioPlugin registers actions, panels, column badges and cell-editor hints. It lives in Core rather than Editor, so one registration renders in both the UIToolkit editor and the browser.

ISheetForgeStringsPlugin also lives in Core, so a plugin's UI strings reach both hosts. If you upgrade a plugin that used the Editor-side pair ISheetForgeLocPlugin and PluginLocRegistry, port it to ISheetForgeStringsPlugin. That pair is retired, because it could only reach the editor. See Port retired plugin contracts.

Composition and compatibility

These types live in SheetForge.Core.Plugins.

Discovery is per host. The editor uses Unity's TypeCache. The web uses the browser's uploaded-assembly scan.

Everything after discovery is one shared Core function: instantiation, ordering, isolation of plugins from each other and the compatibility gate. The shared function keeps the two hosts from drifting slot by slot.

TypeKindRole
PluginCompositionstatic classThe single assembly path
PluginSetsealed classThe assembled result
SheetForgePluginCompatAttributesealed attribute (assembly)The compatibility declaration of one plugin assembly
SheetForgePluginFormatstatic classThe generation constants

PluginComposition

PluginComposition creates one instance per type and casts it to every contract the type implements. It has two members.

MemberRole
IReadOnlyList<Type> ContractTypesThe discovery filter
PluginSet Compose(IReadOnlyList<Type> candidateTypes, string hostVersion, ErrorCollector errors, ICollection<string> failures, Func<string,bool> isProductKey = null)The assembly call itself

The order of ContractTypes is fixed, because it decides the order diagnostics appear in.

Diagnostics and failures

Compose keeps two kinds of trouble apart.

TroubleWhere it goes
Registration conflicts and compatibility refusalsStructured diagnostics in errors
Implementation bugs, such as a construction failure or a throwing callbackEnglish lines in failures

Passing null as failures discards those lines.

The product key predicate

The string overlay has a rule: a plugin may not overwrite a product key. The trailing isProductKey predicate enforces that rule without Core ever seeing the language tables. The rule lives in Core, and the host supplies only the material.

If you omit the predicate, only that one rule is skipped.

PluginSet

PluginSet holds twelve slots:

  • Enums
  • Parsers
  • Validators
  • EdgeContributors
  • Markers
  • Templates
  • GraphShapes
  • CodeRegistries
  • Themes
  • Strings
  • StudioUi
  • PipelineObservers

A new slot reaches both hosts by being added here.

SheetForgePluginCompatAttribute

The attribute is declared once per assembly:

[assembly: SheetForgePluginCompat(SheetForgePluginFormat.Current, MinHostVersion = "…", PluginVersion = "…")]

MemberMeaning
int FormatVersionThe declared generation of the plugin format
string MinHostVersionNumeric dotted comparison. Null or empty means no requirement
string PluginVersionDisplay only, never compared

The attribute is read without instantiating anything.

It is judged per assembly. A refused assembly loses every registration rather than half-loading.

When the attribute is absent, the assembly is read as generation Minimum with no host requirement.

SheetForgePluginFormat

SheetForgePluginFormat holds the generation constants const int Current and const int Minimum.

The number moves only if the plugin format itself is replaced. Purely additive growth keeps the number where it is.

Registries

The registries live in SheetForge.Core.Model, .Validation and .Edges.

TypeRole
EnumRegistryEnum name → CLR type (codegen material)
CellParserRegistryType name → cell parser (open-closed)
DomainValidatorRegistryAppend-only validator list, order preserved
EdgeContributorRegistryAppend-only contributor list, order preserved
MarkerRegistryMarker name (no @) → custom structural marker
TemplateRegistryCreate sheet template key → template

EnumRegistry

Members:

  • Register<TEnum>()
  • Register(name, memberNames)
  • TryGetMembers
  • TryGetClrTypeName
  • TryGetClrAssemblyName
  • RegisteredEnumNames

Three further members need more detail.

MemberRole
EnumRegistry(EnumRegistry parent)Creates a child that reads through to a parent and registers only on itself
Contains(name)Looks in its own names, then the parent's. Ordinal
SetClrTypeName(name, fullTypeName)Fills in a CLR name after a string-only registration

The parent holds plugin-registered CLR enums until the next domain reload. The child holds this import's sheet-defined enums. An import therefore never mutates the shared cache.

Registering a name the parent already owns throws rather than shadowing it.

After SetClrTypeName, the assembly name stays empty because the type does not exist yet.

CellParserRegistry

Duplicate registration throws.

Members:

  • Register(ICellValueParser)
  • TryGet
  • TryGetCustomRenderer
  • RegisteredTypeNames

Wrapper types have their own members:

  • RegisterWrapper(ICellWrapperType)
  • TryGetWrapper
  • RegisteredWrapperNames

Validator and contributor registries

TypeMembers
DomainValidatorRegistryRegister(IDomainValidator) · Validators
EdgeContributorRegistryRegister(IEdgeContributor) · Contributors

MarkerRegistry

Members:

  • Register(IStructuralMarkerDefinition)
  • TryGet
  • IsEmpty
  • RegisteredMarkerNames
  • AppendMarkerTokens

Registration throws in three cases:

  • The name collides with a built-in marker.
  • The name is a duplicate.
  • The name is an invalid identifier.

The built-in markers are SheetSyntax.ReservedMarkers: @name, @type, @desc, @overlap, @style, @enum and @loc.

TemplateRegistry

Members:

  • Register(DataTemplate)
  • TryGet
  • Templates
  • IsEmpty

Registration throws in four cases:

  • The key is empty or a duplicate.
  • The display name is empty.
  • The template has zero tabs.
  • A tab's TSV is empty.

Create sheet templates

The template types live in SheetForge.Core.Model.

TypeRole
DataTemplateA plugin-registered template
DataTemplateTabOne tab of a template

DataTemplate

MemberMeaning
string KeyRegistry identity
string DisplayNamePlugin-owned text
IReadOnlyList<DataTemplateTab> TabsOne or more tabs

DataTemplateTab

Members:

  • string TabName
  • string Tsv

string Tsv is a complete normalized TSV. It holds marker rows plus example data.

Plugin UI strings

StringOverlayRegistry lives in SheetForge.Core.Model. It is both the collector and the lookup overlay for plugin-registered UI strings.

Loc.Tr in the editor and t() in the browser consult it before the product tables.

Members:

  • Register(key, language, value)
  • Register(key, IReadOnlyDictionary<string,string> byLanguage)
  • bool TryGet(key, language, out value)
  • RegisteredKeys

Language matching

language is an IETF code, such as "en", "ko", "zh-Hans" or "pt-BR". It is matched case-insensitively.

Lookup falls back in this order: requested language, English, miss. The fallback lives in the registry, so both hosts answer identically.

Refused registrations

Four registrations are refused. Each refusal records a developer-facing reason rather than failing silently.

  • A product built-in key. An overlay may add keys. It never overwrites the product's own sentences or menu paths.
  • A key and language that another plugin already registered. The first one found wins, because otherwise install order would decide the screen.
  • An empty key or value.
  • A language code the product does not know. Such a code is never folded into English.

Pipeline observation

These types live in SheetForge.Core.Plugins and .Model.

TypeRole
IPipelineObserverRead-only notification
PipelineObserverRegistryAppend-only observer list, order preserved
PipelineRunViewThe immutable snapshot an observer receives

IPipelineObserver

The interface has one member, void OnImportCompleted(PipelineRunView view). It is called once per explicit import cycle, at the end of the cycle, on success or failure.

An observer only reads. It cannot change what an import produces, because changing values and reporting problems are the jobs of a cell type and of IDomainValidator:

  • No hook alters a value or adds a diagnostic.
  • No hook runs during the pre-flight, the validation that runs before staged edits are written to the source.
  • An exception thrown by an observer is caught, and its reason is collected. The import output is unchanged.

Future observation points arrive as sibling capability interfaces, cast from the registered observer. An implementation written today keeps compiling.

PipelineObserverRegistry

Members:

  • Register(IPipelineObserver)
  • Observers

PipelineRunView

MemberMeaning
SuccessThe validation result: whether the definition registry was assembled
TablesThe tabs that parsed
DiagnosticsThe same list the report shows

The snapshot also has SkippedTabs and EnumTabs.

Success speaks for validation only. Codegen and bake outcomes are read from the diagnostics.

On a failed run, only the tabs that could not be parsed are missing from Tables. No-partial-assembly is a rule about the import's outputs, not about observation.

Collections are copied on construction. The constructor is internal, so no half-built snapshot can be handed to an observer.

Next steps