AIGuiders.Platform.Modeling.CodeCenter 0.1.0

dotnet add package AIGuiders.Platform.Modeling.CodeCenter --version 0.1.0
                    
NuGet\Install-Package AIGuiders.Platform.Modeling.CodeCenter -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AIGuiders.Platform.Modeling.CodeCenter" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AIGuiders.Platform.Modeling.CodeCenter" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AIGuiders.Platform.Modeling.CodeCenter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AIGuiders.Platform.Modeling.CodeCenter --version 0.1.0
                    
#r "nuget: AIGuiders.Platform.Modeling.CodeCenter, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AIGuiders.Platform.Modeling.CodeCenter@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AIGuiders.Platform.Modeling.CodeCenter&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AIGuiders.Platform.Modeling.CodeCenter&version=0.1.0
                    
Install as a Cake Tool

AIGuiders.Platform.Modeling.CodeCenter

A language-neutral document editing core — structural edits over a document graph, a committed-edit ledger, and replay-based undo; parsing stays behind your language profile.

What you get

  • Edit vocabulary (EditTypes):
    • MechanicalEdit — point/region/document text splice (RemovedSpan + InsertedText)
    • StructuralEdit — RenameMember, InsertBlock, RemoveBlock, MoveMember, Extract
    • InverseQuality — Exact / Partial / Unspecified
    • ProjectionDescriptor + DocumentProjectionKind (Text / Diagram / Tree / Form / Preview)
  • DocumentGraph — DocumentSnapshot (text + node map + token spans + folding regions) with pure node ops: findNodeAt, findNodeByName, listNodes, tryResolve, renameNode, insertBlock, removeBlock, moveMember, extractMember, applyMechanicalPatch; DocumentNodeIdWire for node:{counter} wire round-trip
  • Edit ledger (LedgerTypes, RePlannableThetaRegistry):
    • LedgerEntryDoc — revision, invalidation scope, theta (the edit), delta patch, phi snapshot ref, anchor, git pin, inverse edit
    • ReplayMode — DeltaRequired / RePlannable / DeltaOrReplan; CommitPolicy; registry rows for all 8 edit kinds plus satisfiesEntry
  • DocumentSession — the aggregate: ApplyMechanicalEdit (ephemeral) → CommitMechanicalBatch, ApplyStructural (commits a ledger entry with inverse + quality), TryUndo / ReplayToRevision (replay from the G0 snapshot — delta first, re-plan where the registry allows), SyncFromText with partial-parse holdback
  • Language seam (DocumentLanguageProfile): IDocumentLanguageProfile (Rebuild, PlanStructural, projection ads), SurfaceFamily (nine document surfaces), NeutralDocumentLanguageProfile, RebuildLanguageProfile
  • C# interop helpers (MechanicalEditBridge, StructuralEditBridge), completion provider types (Completion), RefreshScope instrumentation

Quick start

open AIGuiders.Platform.Modeling.CodeCenter
open AIGuiders.Platform.Modeling.Core.Identity

// Bring your own parser: text -> snapshot. Here one node per line,
// labelled "container member" style (rename edits the member token).
let rebuild (text: string) : DocumentSnapshot =
    let mutable offset = 0

    let nodes =
        text.Split('\n')
        |> Array.mapi (fun i (line: string) ->
            let id = NodeId.mint (NumericId.ofCounter (int64 i + 1L))
            let label = line.Split(' ') |> Array.truncate 2 |> String.concat " "
            let node = { Id = id; Name = label; Start = offset; End = offset + line.Length; Parent = None }
            offset <- offset + line.Length + 1
            id, node)
        |> Map.ofArray

    { Text = text; Nodes = nodes; TokenSpans = []; FoldingRegions = [] }

let session =
    DocumentSession.create "doc-1" "let add a b = a + b\nlet mul a b = a * b" rebuild

let addNode = session.GetDocumentNodes().[0]

match session.ApplyStructural(RenameMember(addNode.Id, "sum")) with
| Ok (after, entry) ->
    printfn "rev %d: %s" after.Revision after.Text   // "let sum a b = a + b ..."
    match after.TryUndo() with
    | Ok undone -> printfn "undone to rev %d" undone.Revision
    | Error e -> printfn "%s" e
| Error e -> printfn "%s" e

Problem

  • Structural edits (rename, move, extract) over an editor buffer degenerate into text splices; undo becomes a fragile inverse stack that drifts from the parse tree.
  • Every editor host forks this machinery per language, so replay and undo semantics never match between tools.

Solution

  • Edits are ledger entries: delta patch, optional inverse (with honest quality), and a snapshot-ref pin; undo replays from G0 — stored delta first, re-planning the edit where the registry allows — instead of trusting an inverse stack.
  • The document graph is language-neutral; your IDocumentLanguageProfile owns parsing and structural planning, so the session stays testable in memory.
  • Federation Code Center SSOT — ledger slice and replay semantics per ADR-0066; language profile seam per ADR-0067.

When not to use

  • Expecting a parser or an editor UI: NeutralDocumentLanguageProfile.Rebuild yields an empty graph — nodes and structural planning come only from your profile.
  • MoveMember / Extract are pilot placeholders at graph level: move ignores the target parent/index (it appends a "moved" line) and extract wraps the block as text — not real refactors.
  • Single-document scope: no multi-file transactions, and ApplyFromRelationSpec is a stub (CodeEdit TreeNode only).

Learn more


MIT · Source & issues · part of the Guiders federation

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 66 10/24/2026