This document defines the current architecture of ArbSh as an Arabic-first shell and terminal platform.
Current Version: 0.8.0-alpha Status: Phase 5 Completed - GUI Terminal Baseline Stable Next Phase: Phase 6 - Baa Language & External Process Integration
ArbSh now uses a host-agnostic core engine with separate presentation hosts:
ArbSh.Corecontains parsing, execution, cmdlets, and BiDi/i18n logic.ArbSh.Consoleis the legacy/compatibility console host.ArbSh.Terminalis the new Avalonia GUI terminal host.
ArbSh/
├── docs/
│ ├── CHANGELOG.md
│ ├── PROJECT_ORGANIZATION.md
│ ├── USAGE_EXAMPLES.md
│ ├── BIDI_P_RULES_DESIGN.md
│ ├── BIDI_X_RULES_DESIGN.md
│ ├── BIDI_W_RULES_DESIGN.md
│ ├── BIDI_N_RULES_DESIGN.md
│ ├── BIDI_I_RULES_DESIGN.md
│ └── BIDI_L_RULES_DESIGN.md
├── src_csharp/
│ ├── ArbSh.sln
│ ├── ArbSh.Core/
│ │ ├── Commands/
│ │ ├── Hosting/
│ │ ├── I18n/
│ │ ├── Models/
│ │ ├── Parsing/
│ │ ├── Executor.cs
│ │ ├── Parser.cs
│ │ └── ShellEngine.cs
│ ├── ArbSh.Console/
│ │ ├── I18n/
│ │ ├── ConsoleExecutionSink.cs
│ │ └── Program.cs
│ ├── ArbSh.Terminal/
│ │ ├── Assets/
│ │ │ └── Fonts/
│ │ ├── Input/
│ │ │ ├── TerminalInputBuffer.cs
│ │ │ ├── OutputSelectionBuffer.cs
│ │ │ └── SelectionRange.cs
│ │ ├── Rendering/
│ │ │ ├── AnsiSgrParser.cs
│ │ │ ├── AnsiColorSpec.cs
│ │ │ ├── AnsiStyleModel.cs
│ │ │ ├── AnsiPalette.cs
│ │ │ ├── TerminalTheme.cs
│ │ │ ├── TerminalSurface.cs
│ │ │ ├── TerminalTextPipeline.cs
│ │ │ ├── TerminalLayoutEngine.cs
│ │ │ ├── TerminalFrameLayout.cs
│ │ │ ├── PromptLayoutSnapshot.cs
│ │ │ └── TerminalRenderConfig.cs
│ │ ├── ViewModels/
│ │ ├── Models/
│ │ ├── App.axaml
│ │ ├── MainWindow.axaml
│ │ └── Program.cs
│ └── ArbSh.Test/
│ ├── BidiAlgorithmTests.cs
│ ├── BidiTestConformanceTests.cs
│ ├── ArabicShapingTests.cs
│ ├── TerminalTextPipelineTests.cs
│ ├── TerminalLayoutEngineTests.cs
│ ├── LogicalVisualSeparationTests.cs
│ ├── TerminalInputBufferTests.cs
│ ├── AnsiSgrParserTests.cs
│ └── AnsiPaletteTests.cs
├── ROADMAP.md
└── System.md
| Layer | Project | Responsibility |
|---|---|---|
| Core Engine | src_csharp/ArbSh.Core |
Parsing, tokenization, parameter binding, cmdlet execution, pipeline, BiDi logic. |
| Host Abstraction | src_csharp/ArbSh.Core/Hosting |
IExecutionSink and sink-aware output boundary between logic and rendering. |
| Console Host | src_csharp/ArbSh.Console |
CLI host loop, console-specific I/O, backward-compatible execution sink. |
| GUI Terminal Host | src_csharp/ArbSh.Terminal |
Avalonia app, view models, rendering surface, RTL-first terminal UX. |
| Test Suite | src_csharp/ArbSh.Test |
Unit and conformance tests for BiDi and core behavior. |
- Logical vs Visual Split: Logical command text and pipeline state remain in
ArbSh.Core. Visual ordering/shaping belongs to host/rendering layers only. - Arabic-First UX: Arabic command aliases and UAX #9 compliance are first-class requirements.
- Host Independence: Core execution must not directly write to
System.Console; all output routes through execution sinks. - Concurrency Safety: Pipeline stages use task-based execution and
BlockingCollection<T>patterns. - MVVM for GUI: Avalonia host follows view/viewmodel separation for terminal state and rendering.
# Build full solution
dotnet build src_csharp/ArbSh.sln
# Run console host
dotnet run --project src_csharp/ArbSh.Console
# Run Avalonia terminal host
dotnet run --project src_csharp/ArbSh.Terminal
# Run tests
dotnet test src_csharp/ArbSh.Test- Extracted shared engine into
ArbSh.Core. - Moved cmdlets/models/parser/executor/BiDi code into the core project.
- Added sink-based host boundary (
IExecutionSink,CoreConsole,ShellEngine). - Added Avalonia terminal bootstrap project (
ArbSh.Terminal). - Added packaged font assets for terminal rendering and configured asset-first font fallback.
- Added a terminal rendering pipeline that converts logical text to visual display text at the UI boundary only.
- Implemented
TerminalTextPipelineandTerminalLayoutEnginefor line shaping/reordering and frame composition. - Refactored
TerminalSurfaceto consume draw instructions instead of performing ad-hoc reordering logic inline. - Added runtime Arabic/Latin font fallback configuration for terminal text rendering.
- Added ANSI SGR parsing and span-based style metadata generation (16/256/truecolor).
- Added ArbSh navy theme + ANSI palette mapping in terminal rendering config.
- Updated output rendering to apply ANSI foreground/background/styles without mutating logical text.
- Added a dedicated input subsystem for logical text, caret, and selection state (
TerminalInputBuffer). - Implemented visual caret movement and hit-testing for mixed Arabic/Latin prompt input using Avalonia text layout APIs.
- Added pointer-based caret placement and drag selection on the prompt line.
- Added clipboard copy/cut/paste support for selected input text.
- Closed typography and color/theming remaining tasks from Phase 5.1 and 5.2.
- Kept prompt/caret behavior untouched while extending output styling path.
- Added scrollback offset virtualization with mouse wheel and PageUp/PageDown navigation.
- Kept prompt pinned to bottom while output viewport moves through history.
- Added output-line selection and logical-order clipboard copy (
Ctrl+C) for scrollback content.
- Changelog is maintained in
docs/CHANGELOG.md. - Architecture and planning state live in
ROADMAP.mdand this document. - BiDi algorithm changes must be reflected in the specific
docs/BIDI_*_RULES_DESIGN.mdfiles.