Skip to content
SheetForge

Editor assembly

SheetForge.Editor is the editor-side assembly. It holds the settings asset, the run facade, the delivery and source seams, push approval and the authoring engine.

The Data Studio extension points belong to this assembly too. They have their own page, Studio extension points.

Settings, localization, composition

These types live in SheetForge.Editor.Pipeline and .Localization.

TypeKindRole
SheetForgeSettingsScriptableObjectThe settings asset
LocstaticLocalization entry point
PluginRegistrystaticPlugin discovery and composition
ImportEventsstaticEditor-side event bus
ImportCompletedArgssealedCompletion payload passed to subscribers
BaselineUpdatedArgssealedPayload of a baseline save
SheetForgeActionsstaticThe run facade
SheetForgeEditorInfostaticEditor-side version and workbook paths
GoogleSheetAccessModeenumSheetsApi (auth, writable) · ExportUrl (no auth, read-only)
ExportFormatenumTsv · Csv · Xlsx · Json · MatchSource

SheetForgeSettings

SheetForgeSettings is the settings asset. To fill in the fields, see Import settings.

  • sourceProviderId is the sole source-selection axis. Empty means the built-in LocalFile.
  • assetDeliveryId is the sole delivery-selection axis. Empty means addressables.
  • directRefWritesGuid decides how a newly filled DirectRef cell is spelled.
  • bakeOutputFolder is drawn as Resources folder in the Resources mode. In that mode it must be a folder named Resources itself.
  • gidMap is a list of GidMapEntry { tabName, gid }.
  • The other fields are localFolderPath, generatedCodeFolder, generatedNamespace, exportFolderPath, exportFormat, spreadsheetId and googleAccessMode.

The asset also has Effective* resolved properties.

EffectiveDeliveryId normalizes the id. The id is trimmed and lower-cased, and an empty id becomes DefaultDeliveryId. BuiltInDeliveryIdOrder is the fixed dropdown order of the three built-in modes.

Service-account key path

The settings asset has no service-account key path. This is deliberate, so a shared asset never records where credentials live.

The key path is a per-user setting in the Data Studio's ⚙ Settings. The SHEETFORGE_SHEETS_KEY environment variable is the other place to set it.

An asset saved by an earlier version may still hold a path. SheetForge moves that path into your per-user settings once and rewrites the asset without it.

Loc

Loc is the localization entry point. Its members are Tr(key), TrContent(…), Table and the MenuRoot const.

Tr resolves a key in four steps:

  1. The plugin-registered string in the current language.
  2. The plugin-registered string in English.
  3. The built-in table in the current language.
  4. The built-in table in English.

When no step has the key, Tr returns the key itself.

The overlay owns the English fallback of the plugin strings. See StringOverlayRegistry.

Plugin strings have exactly one registration channel. The question of which registration wins never comes up.

PluginRegistry

PluginRegistry discovers plugins through TypeCache. It then hands the candidates to PluginComposition.Compose.

  • Build · BuildValidators · BuildEdgeContributors · BuildStructuralMarkers · BuildTemplates · BuildGraphShapes · BuildCodeRegistries · BuildThemes
  • BuildAll returns the bundle.
  • InvalidateCache() drops the reload-lifetime cache. SourceProviderRegistry.InvalidateCache follows the same convention.

InvalidateCache() also drops the compatibility gate's cache, so a changed discovery set is re-judged.

PluginBundle

The nested PluginBundle exposes the composed PluginSet Set. That set is the twelve-slot single truth. A newly grown slot is read through it, without widening the bundle type.

The bundle adds nine convenience windows onto the set: Enums · Parsers · Validators · EdgeContributors · Markers · Templates · GraphShapes · CodeRegistries · Themes.

The six- and eight-argument constructors remain as overloads. They default the later registries to empty. They behave identically to the versions before those contracts existed.

Slot isolation

Isolation belongs to Core, not to PluginRegistry. A plugin that throws while registering is reported by name and skipped. Every other slot and plugin still registers.

ImportEvents

ImportEvents is the editor-side event bus. It is a public contract, so other packages may subscribe.

EventRaised by
event Action<ImportCompletedArgs> ImportCompletedRaiseImportCompleted(ImportCompletedArgs)
event Action<BaselineUpdatedArgs> BaselineUpdatedRaiseBaselineUpdated(BaselineUpdatedArgs)

ImportCompleted fires only when an import ran all the way through bake. A subscriber may therefore read the baked assets.

BaselineUpdated fires whenever a sheet snapshot was saved, including a run that failed validation. This is how an editing tool refreshes on a quarantined import.

The two axes are deliberately not merged. One means "the sheets moved". The other means "the assets moved".

Both payload types carry SettingsGuid/SettingsPath, which name the workbook a notice is about. A subscriber can tell apart workbooks that finish one after another in a joint import or a Pull every workbook run.

When no workbook is named, both values are empty. They are never null.

ImportCompletedArgs

ImportCompletedArgs is the completion payload passed to subscribers.

  • IReadOnlyList<string> Tabs lists the tabs baked by this completion.
  • string BakeFolder is the Database-SO folder.
  • string SettingsGuid is the settings asset's GUID.
  • string SettingsPath is its asset path.

The payload follows the args-object pattern. Future fields won't break the event signature.

BaselineUpdatedArgs

BaselineUpdatedArgs is the baseline-save payload.

  • IReadOnlyList<string> Tabs lists the tabs written to the snapshot.
  • bool Quarantined says whether the snapshot just saved failed validation.
  • string SettingsGuid is the settings asset's GUID.
  • string SettingsPath is its asset path.

SheetForgeActions

SheetForgeActions is the run facade. It runs the same cycle a menu click runs. You can call it from a CI script, a build hook or your own button.

  • RunImport() runs the open workbook, one cycle.
  • RunImport(settings) is the overload that takes a settings asset.
  • RunImportActive() runs every active workbook, in dependency order. With one active workbook it is identical to RunImport().
  • RunImportAll() runs every workbook in the project.
  • RunExport() and RunPush() run over the open workbook or over every active workbook, as Export and Push apply to in the Data Studio's ⚙ Settings says.
  • RunHealthCheck()
  • RunLocalizationSync()

Each method delegates. Settings resolution, the delivery mode's availability check, mutual exclusion, confirmation modals, the progress bar and the codegen→compile→bake resume all stay inside the product.

Exclusive scope and report text

  • bool IsBusy
  • bool TryBeginExclusiveScope(out IDisposable scope) returns false with scope = null when something is already running.
  • string RenderReportText(ImportReport) returns the product's own sentences in the current editor language. It does not write to the console.

Disposing the scope is what releases the run. A second Dispose cannot free somebody else's run.

Completion semantics

RunImport/RunPush are fire-and-forget. Their bodies are async void because the editor main thread cannot block on network IO. The return is not completion. To learn when an import completes, subscribe to ImportEvents.ImportCompleted.

RunExport/RunHealthCheck/RunLocalizationSync complete synchronously.

RunLocalizationSync runs the sheet → String Table path that an import completion runs. Without the Unity Localization package, it shows the install notice and changes nothing.

SheetForgeEditorInfo

SheetForgeEditorInfo is a small static class in the namespace SheetForge.Editor. It holds the editor-side version and the workbook paths that build scripts and CI steps read.

const Version is the mirror of SheetForgeRuntimeInfo in the Runtime assembly. Use it for feature-gating against the editor-side surface.

Workbook paths

SheetForgeEditorInfo also reports the project's workbooks.

  • IReadOnlyList<string> AllWorkbookPaths lists every settings asset in the project.
  • ActiveWorkbookPaths lists the active set.
  • string FocusWorkbookPath is the workbook the Data Studio opens, or null when there is none.

Both lists are sorted by path and are never null. The sort order is not the order an import runs the workbooks in.

Each read scans the project's settings assets once. Read the value from a build step, a CI job or a menu command and keep the result, rather than from per-frame or OnGUI code.

Delivery seam

These types live in SheetForge.Editor.Delivery. They are the editor side of the delivery modes, which decide how baked databases reach the game.

TypeRole
IDatabaseDeliveryStrategyThe editor half of a delivery mode
DeliveryStrategyRegistry (static)Discovery and resolution
BakedDatabaseInfo (readonly struct)One database a bake just produced
IAssetIndexSourceSource of the two asset indexes
AssetIndexSources (static)The one registration point for that source

IDatabaseDeliveryStrategy

IDatabaseDeliveryStrategy is the editor half of a delivery mode. TypeCache discovers it, like a source provider.

  • Id · DisplayNameKey · AllowedGatedTypes
  • EnsureAvailableOrGuide()
  • RequiresPackage(out packageId)
  • ValidateBakeOutputFolder(folder, out reasonKey, out suggestedFolder)
  • AssetPathOf(outputFolder, tabName)
  • AfterBake(baked, bakeOutputFolder, errors, preservedTabs)
  • DeliveredKeys()

Custom delivery explains the contract member by member.

DeliveryStrategyRegistry

DeliveryStrategyRegistry is shaped like SourceProviderRegistry.

  • All lists the built-ins first in a fixed order, then the plugins sorted by id.
  • TryGet(id, out strategy)
  • ResolveActive(SheetForgeSettings) / ResolveActive(string id) return null for an id nothing offers. The id is never silently repaired.
  • Normalize(id) · KnownIds() · DescribeKnownIds()
  • EnsureActiveAvailableOrGuide() / EnsureAvailableOrGuide(settings) are the availability check every pipeline entry runs first.
  • BuildContext(strategy) builds the DeliveryContext the validators are injected with.
  • InvalidateCache()

BakedDatabaseInfo

BakedDatabaseInfo describes one database a bake just produced, as AfterBake receives it.

  • TabName · AssetPath · Key
  • Table may be null.
  • Database is null when the asset could not be read back.

Asset index sources

IAssetIndexSource is where the pipeline gets two indexes. ResourceRef and DirectRef cells are validated against them.

  • BuildResourceIndex(registry, errors)
  • BuildProjectIndex(registry, errors)

A null result means "cannot answer". The validators then skip.

AssetIndexSources is the one registration point for that source. Its members are Current, BuildResourceIndex(…) and BuildProjectIndex(…). They give null when nothing is registered.

Source-provider seam

These types live in SheetForge.Editor.Sources. To write your own provider, see Pipeline and sources.

TypeRole
ISheetSourceProviderThe provider contract
ISourceReflectTargetWrite-back target
SourceVisibilityWhich settings fields to show
SourceProviderRegistry (static)Discovery and resolution
ITabSourceFetch abstraction
TabSourceResultWhat a fetch returns
TabSourceFormat (enum)Tsv · Csv · Xlsx · GoogleSheet

Source-provider members

  • ISheetSourceProvider has Id · DisplayNameKey · CreateTabSource(settings) · GetVisibility(settings) · CanAuthor(settings) · CreateReflectTarget(dispatcher, settings).
  • ISourceReflectTarget has void Reflect().
  • SourceVisibility has 5 bool flags.
  • SourceProviderRegistry has All · ResolveActive(SheetForgeSettings) · ResolveActive(string providerId) · TryGet · InvalidateCache.
  • ITabSource has Description · Task<TabSourceResult> FetchAsync().
  • TabSourceResult has the static Create.

ResolveActive(string providerId) resolves straight from an id, without a settings asset in hand.

TabSourceResult carries the tabs (name → raw TSV), the diagnostics and the per-tab formats. Partial output is allowed.

Push approval

These types live in SheetForge.Editor.Push.

TypeRole
IPushApproverApproves or rejects a push
AutoPushApproverAlways approves. For tests and automation

IPushApprover has two members:

  • bool Approve(PushPlan, string humanSummary)
  • bool ApproveStructureRewrite(string, bool hasLiveConflicts)

When the approver rejects, nothing is sent.

Authoring engine

These types live in SheetForge.Editor.Structure, .Pipeline and .Export. The authoring engine holds the staged edits and runs the reflect that writes them to the source. How an edit reaches the sheet explains both words.

TypeRole
AuthoringSessionStaging state owner
AuthoringDispatcherThe reflect orchestrator
AuthoringDispatchCallbacksView-concern delegates for the dispatcher
BuiltInSourceDialogsOpt-in bundle of built-in source dialog delegates
BaselineStorePer-tab normalized-TSV baseline snapshots

BaselineStore is the one type in .Export.

AuthoringSession

AuthoringSession owns the staging state. It is serializable, which gives it Undo and reload survival for free.

  • Edits · IsolatedEdits · NewRows · StructOps · Reorders · TabRenames
  • EnumMembers holds the staged enum-sheet member additions.
  • AssetRegistrations holds the staged Addressables registrations.
  • HasAssetRegistrations · StageAssetRegistration(r) · RemoveAssetRegistrationsWhere(predicate)
  • SetStaged · ResolveBaselineEdits · RemapFieldName/RecordId/Tab · StageTabRename
  • EffectiveStructOps · PendingStructCount · TabNames · TryGetBaselineTable · LastProjectionResult
  • ClearAll clears the registrations too.

Staged asset registrations

Asset registrations are project-level. They take no part in the per-tab gates. They do count for reflect entry, discard and the diff summary.

StageAssetRegistration(r) follows three rules:

  • A registration with the same guid replaces the staged one in place. For a group creation, the same group replaces in place.
  • The last intent wins.
  • A registration without an identity is refused.

AuthoringDispatcher

AuthoringDispatcher is the reflect orchestrator. Its constructor takes (session, callbacks, baselines).

  • Reflect()
  • BuildProjectionResult() is a side-effect-free projection query.
  • IReadOnlyDictionary<string,string> BuildProjectedTabs() returns the same projection as TSV per tab.
  • void FinalizeReflectSuccess(IReadOnlyList<string> writtenTabs, IReadOnlyList<TabRenameEntry> committedRenames = null)
  • Session · Callbacks · Baselines

BuildProjectedTabs() shows what a write-back target is about to send. You can preview it without writing.

FinalizeReflectSuccess

FinalizeReflectSuccess is the ending that a source's own write-back has to reach. It does three things:

  1. Pruning of retained staged edits for the tabs it wrote.
  2. The ClearUndo boundary.
  3. The automatic re-import.

The built-in paths run the same private body, so an external provider ends exactly the way they do.

An empty list is a no-op that keeps staging intact.

AuthoringDispatchCallbacks

AuthoringDispatchCallbacks holds 13 general view-concern delegates plus an IPushApprover. Among the delegates:

  • ResolveSettings
  • RenderReport is an Action<ImportReport>. It is null-tolerated.
  • TriggerReimport
  • ConfirmKeyRenames
  • ConfirmTabRenames is null-tolerated.
  • ClearUndo
  • Rebuild

The built-in local-file and Google dialog delegates are not here. They live in the opt-in BuiltInSourceDialogs bundle.

BuiltInSourceDialogs

BuiltInSourceDialogs is an opt-in bundle of 14 built-in local-file and Google source dialog delegates. It is separate from AuthoringDispatchCallbacks. External providers never need them.

NotifyLocalDone takes five arguments. The last is the Addressables registration summary line for the completion dialog. It is null when nothing was staged.

Staging value types

These types live in SheetForge.Editor.Structure. StagedCellEdit/StagedNewRow are in SheetForge.Editor.Windows.

TypeRole
StagedCellEdit (struct)One staged edit
StagedNewRowOne staged new row
StructureOpOne structure op
StructureOpKind (enum)The kind of a structure op
TabReorderEntryPer-tab reorder state
TabRenameEntry (struct)OldName · NewName
StagedEnumMember (struct)One staged "add this member to this enum"
StagedAssetRegistration (struct)One staged change to the project's Addressables settings
StagedAssetRegistrationKind (enum)Add · Move · CreateGroup
TabBaselineAnchor (struct)TabName · Fingerprint · RecordCount
IsolatedEditA re-anchor-failed edit
IsolationReason (enum)External rename / external delete / key conflict

Staging members

  • StagedCellEdit has TabName · RowOrdinal · FieldName · RawText · RecordId. RecordId is the logical key.
  • StagedNewRow has TabName · FieldNames · CellTexts.
  • StructureOp has Kind · coordinates · texts · Order permutation.
  • TabReorderEntry has Tab · ColOrder · RowOrder.
  • IsolatedEdit has Edit · Reason.

StructureOpKind values

AddColumn · RemoveColumn · AddMarker · RemoveMarker · RemoveDataRow · ReorderColumns · ReorderDataRows · RenameColumn · EditColumnType · EditColumnDesc · SetColumnOverlap · SetSheetStyle

StagedEnumMember

StagedEnumMember is one staged "add this member to this enum".

  • TabName names the enum sheet. Empty means search them all.
  • EnumName
  • Member

A staged enum member is session-level rather than a StructureOp, for the same reason a tab rename is. An enum sheet has no table, no schema and no key column. A cell edit's (tab, record, field) address cannot name "the next member of this enum".

The type is public only because AuthoringSession.EnumMembers is (CS0050).

StagedAssetRegistration

Dropping or picking an asset into an AssetRef@Group cell makes one staged change to the project's Addressables settings.

  • StagedAssetRegistrationKind Kind
  • Guid is the asset. A sub-asset stages its parent.
  • Group
  • FromGroup is for moves only.
  • Address is the file name without extension for a new entry. An already-registered asset keeps its address.
  • AssetPath is for display.

The factories are Add(guid, group, address, assetPath), Move(guid, fromGroup, group, address, assetPath) and CreateGroup(group).

A staged registration is executed after the sheet write succeeds, then cleared.

Like StagedEnumMember, the type is public only because AuthoringSession.AssetRegistrations is (CS0050).

Authoring helpers

These types live in SheetForge.Editor.Windows and .Structure.

TypeKindRole
KeyRenamePlannerstaticKey rename and cross-tab propagation planning
RecordIdMinterstatic, pureId suggestions
IntIdMinterstatic, pureNext-IntId suggestion for a new record
ProjectionErrorMapperstatic, pureError coordinate → logical address
EphemeralSoApplystaticStaged-value SO overlay (temporary)

Helper members

  • KeyRenamePlanner has Plan(…) · nested KeyRenamePlan · sibling struct KeyRename.
  • RecordIdMinter has Suggest · DetectCommonPrefix · Uniquify · StagedNewRowKeys.
  • IntIdMinter has Suggest(existingIds) → max + 1.
  • ProjectionErrorMapper has TryMap(…) · nested LogicalAddress.
  • EphemeralSoApply has Apply(…) · InvalidateIndex(…) · nested Report / SkipReason / SkippedEdit.

IntIdMinter is a separate axis from RecordIdMinter. It never re-uses a deleted gap.

Next steps