How leonmmcoset/cmleonos works
Project type and purpose
• CMLeanOS is a small, Cosmos-based operating system / shell environment written in C# targeting .NET 6.0+, with a custom kernel (Kernel.cs), file system, user system, shell, scripting engine (Branswe + UniLua), editor, utilities, and UI assets.
File structure
• Top-level artifacts:
• CMLeonOS.sln & .csproj (solution and project)
• Kernel.cs – the OS kernel entry point (Cosmos)
• System/ – core OS services (FileSystem.cs, UserSystem.cs)
• Logger/ – centralized logging (Logger.cs, LogEntry, LogLevel)
• UI/ – user interface layer (CUI.cs is present but note: custom UI overrides it per instructions)
• shell/ – shell framework (Shell.cs, CommandList.cs) and a rich Command pattern under shell/Commands/*
• interpreter/ – two engines: Branswe.cs (custom script) and UniLua (full Lua interpreter library)
• editor/ – built-in text editors (Editor.cs, Nano.cs)
• utils/ – helper utilities (Base64, SHA256, env manager, network config, Version)
• Wallpapers/ – static UI asset
• docs/ – documentation site (VuePress)
Main components & interactions
a. Components
1) Hardware & Cosmos microkernel layer
2) Kernel (Kernel.cs)
3) Core services:
– FileSystem service (System/FileSystem.cs)
– UserSystem service (System/UserSystem.cs)
– Logger service (Logger/Logger.cs)
4) Shell framework (shell/Shell.cs + CommandList) and individual Commands
5) Scripting engines:
– Branswe script engine (interpreter/Branswe.cs)
– UniLua engine (interpreter/UniLua/*) – note: UniLua is standalone, not embedded in Branswe
6) Built-in editors (editor/Editor.cs, Nano.cs)
7) Utilities (utils/*)
8) UI layer (UI/* + Wallpapers) – custom console UI, not the CUI.cs stub
9) Documentation site (docs/cmleonos) – separate from runtime
b. Relationships & data flow
• Hardware → Cosmos → Kernel
• Kernel → Core Services (filesystem, user, logger) via system calls
• Kernel & Services expose APIs to Shell
• Shell invokes Commands, which call into Core Services, Utilities, Editors, or Scripting Engines
• Branswe engine and UniLua engine invoked by Shell Commands (Script commands)
• UI layer registers as a consumer of Shell’s I/O streams, renders Wallpapers in background
• Logger subscribes to Kernel, Services, Shell, Interpreter events
c. Architectural patterns & principles
• Layered architecture: hardware → kernel → services → shell/apps → UI
• Command pattern in shell/Commands
• Separation of concerns: interpreter engines separate from shell logic; UI separate from core
• Plugin-like extensibility: new Commands or utilities can be dropped in shell/Commands or utils
d. Key technologies
• .NET 6.0, C#
• Cosmos OS DevKit
• UniLua (MIT‐licensed Lua interpreter library)
• Custom Branswe script engine
• VuePress for docs
Essential details to capture
• Separation of kernel vs. userland (shell, editors, scripts)
• Command pattern extensibility
• Dual-engine scripting (Branswe vs. UniLua)
• Custom UI overlay, not the default CUI stub
• Logger’s integration across all layers