This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Restore dependencies
dotnet restore
# Build project
dotnet build
# Run unit tests with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run demo CLI
dotnet run --project src/Atypical.VirtualFileSystem.DemoCli/
# Run the Blazor demo app
dotnet run --project src/Atypical.VirtualFileSystem.DemoBlazorApp/
# Run benchmarks (BenchmarkDotNet)
dotnet run --project tests/Atypical.VirtualFileSystem.Benchmarks/ -c Release
# Build specific project
dotnet build src/Atypical.VirtualFileSystem.Core/- .NET SDK 10.0.x (pinned by global.json; rollForward latestMinor)
- Class libraries multi-target .NET 9.0 and .NET 10.0 (see Directory.Build.props); the Blazor demo app and Benchmarks project target .NET 10.0 only
- C# 13 (
LangVersion13) with latest language features
This is an index-based virtual file system using a SortedDictionary<VFSPath, IVirtualFileSystemNode> (VFSIndex) as the central storage mechanism. All operations are O(log n) lookups with strongly-typed path classes.
The system separates operations into focused interfaces:
IVFSCreate- File/directory creationIVFSDelete- Deletion operationsIVFSMove- Move operationsIVFSRename- Rename operationsIVirtualFileSystem- Combines all operations with fluent API
Every operation triggers events (DirectoryCreated, FileDeleted, etc.) that inherit from VFSEventArgs. These events support structured logging and power the undo/redo system.
The IChangeHistory automatically tracks all operations using event args stored in undo/redo stacks. Every VFS operation is reversible.
IRootNode (vfs://)
├── IDirectoryNode (contains Files and Directories collections)
└── IFileNode (contains Content string)
External backends are plugged in behind a provider abstraction (the Core VFS itself stays storage-agnostic):
Atypical.VirtualFileSystem.Providers.AbstractionsdefinesIStorageProvider(ImportAsync/ReadFileAsync/WriteChangesAsync/GetAccountInfoAsync),IStorageProviderAuth,ProviderCapabilities, and neutral records (ProviderLoadOptions/Result,ProviderFileChange,CommitContext,ProviderFileMetadata,AuthRequest/Result).- Branch/PR/fork are NOT base-interface methods — they are
ProviderCapabilitiesflags plusCommitContextfields, so capable providers (GitHub) honor them and others (FTP) ignore them. - Implementations:
Atypical.VirtualFileSystem.GitHub(GitHubStorageProvider, wraps the existing Octokit loader/write service via adapters — Token auth, supports branches/PR/fork) andAtypical.VirtualFileSystem.Ftp(FtpStorageProviderover FluentFTP — Credentials auth, read+write/overwrite, no branches/PR). - The Blazor app selects the active provider via
IStorageProviderRegistryand drives its UI (import dialog fields, "submit changes") fromProviderCapabilities; FTP credentials and the GitHub PAT are persisted encrypted viaProtectedLocalStorage.
VFSRootPath- Root directory (vfs://)VFSDirectoryPath- Directory paths with case-insensitive comparisonVFSFilePath- File pathsVFSPath- Base class with depth calculation and parent navigation
- Base class:
VirtualFileSystemTestsBaseprovidesCreateVFS()factory - Naming:
VirtualFileSystem_Method{Operation}_Tests.cs - Use Shouldly for readable assertions (e.g.
result.ShouldBe(...)) - xUnit as test framework with Coverlet for coverage
- Regression tests for fixed bugs live under
/SystemOperations/Regression/and/UndoRedo/
/SystemOperations/Commands/- CRUD operations/SystemOperations/Queries/- Read operations/SystemOperations/Regression/- Regression tests for specific fixed bugs/Models/- Value objects and nodes/UndoRedo/- Change history functionality
tests/Atypical.VirtualFileSystem.Benchmarksis a BenchmarkDotNet suite (file/directory/search/scale/undo-redo). Run with-c Release.
The VFSIndex class wraps SortedDictionary<VFSPath, IVirtualFileSystemNode> and provides:
- Case-insensitive path lookups via
VFSPathComparer - Separate collections for Files and Directories
- Path prefix matching for directory contents
Operations return IVirtualFileSystem for chaining:
vfs.CreateDirectory("docs")
.CreateFile("docs/readme.txt", "content")
.CreateFile("src/main.cs");Register VFS services with services.AddVirtualFileSystem() extension method from ServiceCollectionExtensions.
API documentation is auto-generated to /docs/api/ using DefaultDocumentation during build. The /docs/links file maintains cross-references.