{"id":50745064,"url":"https://github.com/compnerd/VirtualTerminal","last_synced_at":"2026-06-27T23:00:49.840Z","repository":{"id":308999907,"uuid":"1033568900","full_name":"compnerd/VirtualTerminal","owner":"compnerd","description":"A Performance-Focused Terminal Rendering Framework","archived":false,"fork":false,"pushed_at":"2025-12-31T00:52:12.000Z","size":91,"stargazers_count":62,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-29T00:28:42.069Z","etag":null,"topics":["macos","terminal","tui","windows"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compnerd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-07T02:57:47.000Z","updated_at":"2026-05-21T20:17:46.000Z","dependencies_parsed_at":"2025-08-09T07:13:52.020Z","dependency_job_id":"0e680312-284c-49d1-8c6a-a3e0271c5257","html_url":"https://github.com/compnerd/VirtualTerminal","commit_stats":null,"previous_names":["compnerd/virtualterminal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/compnerd/VirtualTerminal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compnerd%2FVirtualTerminal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compnerd%2FVirtualTerminal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compnerd%2FVirtualTerminal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compnerd%2FVirtualTerminal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compnerd","download_url":"https://codeload.github.com/compnerd/VirtualTerminal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compnerd%2FVirtualTerminal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34870654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["macos","terminal","tui","windows"],"created_at":"2026-06-10T20:00:38.587Z","updated_at":"2026-06-27T23:00:49.833Z","avatar_url":"https://github.com/compnerd.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# VirtualTerminal\n\n**Modern, high-performance terminal UI library for Swift**\n\nBuild beautiful, fast command-line applications with native Swift. VirtualTerminal provides efficient rendering, cross-platform compatibility, and Swift 6 concurrency support—without the complexity of C bindings.\n\n## Why VirtualTerminal?\n\n### 🚀 **Built for Performance**\n- **Damage-based rendering**: Only redraw changed cells, not entire screens\n- **Intelligent cursor optimization**: Minimal escape sequences for movement\n- **Double buffering**: Smooth animations without screen tearing\n- **Output batching**: Batch multiple operations into fewer writes\n\n### 🛡️ **Swift-Native Design**\n- **Memory safety**: No unsafe pointers or C interop required\n- **Modern concurrency**: Built on Swift 6 actors and async/await\n- **Type safety**: Compile-time guarantees for colors, positions, and styles\n- **Zero dependencies**: Pure Swift implementation\n\n### 🌍 **True Cross-Platform**\n- **macOS, Linux, Windows**: Single codebase, platform-optimized internals\n- **Consistent APIs**: Write once, run everywhere\n- **Native input handling**: Platform-specific optimizations under the hood\n\n## Quick Example\n\n```swift\nimport VirtualTerminal\n\n// Create a high-performance terminal renderer\nlet renderer = try await VTRenderer(mode: .raw)\n\n// Render at 60 FPS with automatic optimization\ntry await renderer.rendering(fps: 60) { buffer in\n    buffer.write(\"Hello, World!\", \n                 at: VTPosition(row: 1, column: 1),\n                 style: VTStyle(foreground: .green, attributes: [.bold]))\n}\n\n// Handle input events with modern Swift concurrency\nfor await event in renderer.terminal.input {\n    switch event {\n    case .key(let key) where key.character == \"q\":\n        return  // Clean exit\n    case .resize(let size):\n        renderer.resize(to: size)\n    default:\n        break\n    }\n}\n```\n\n## Core Features\n\n### Efficient Rendering\n- **Damage detection**: Only update changed regions\n- **Style optimization**: Minimize escape sequence overhead  \n- **Cursor movement**: Intelligent positioning algorithms\n- **Unicode support**: Proper width calculation for CJK, emoji, and symbols\n\n### Modern Input Handling\n```swift\n// AsyncSequence-based input processing\nfor await event in terminal.input {\n    switch event {\n    case .key(let key):\n        handleKeyPress(key)\n    case .mouse(let mouse):\n        handleMouseEvent(mouse)\n    case .resize(let size):\n        handleResize(size)\n    }\n}\n```\n\n### Rich Styling\n```swift\nlet style = VTStyle(foreground: .rgb(red: 255, green: 100, blue: 50),\n                    background: .ansi(.blue),\n                    attributes: [.bold, .italic])\nbuffer.write(\"Styled text\", at: position, style: style)\n```\n\n### Structured Terminal Control Sequences\n\nBeyond high-level UI rendering, VirtualTerminal provides a structured, type-safe API for formulating terminal escape sequences. Rather than hardcoding string literals like `\"\\033[31;1m\"`, you express terminal commands using semantic Swift types.\n\nThe `ControlSequence` enum covers ISO 6429/ECMA-48 compliant terminal operations:\n\n```swift\nimport VirtualTerminal\n\n// Type-safe cursor positioning and styling\nawait terminal \u003c\u003c\u003c .CursorPosition(10, 20)\nawait terminal \u003c\u003c\u003c .SelectGraphicRendition([.bold, .foreground(.red)])\nawait terminal \u003c\u003c\u003c \"Important text\"\nawait terminal \u003c\u003c\u003c .SelectGraphicRendition([.reset])\n\n// Structured screen manipulation\nawait terminal \u003c\u003c\u003c .EraseDisplay(.EntireDisplay)\nawait terminal \u003c\u003c\u003c .SetMode([.DEC(.UseAlternateScreenBuffer)])\n```\n\nThis approach offers:\n- **Semantic clarity**: Express intent with Swift types, not escape code memorization\n- **Compile-time validation**: Prevents malformed sequences and parameter errors\n- **Encoding abstraction**: Handles 7-bit vs 8-bit encoding automatically\n- **Composability**: Chain operations with fluent syntax using the `\u003c\u003c\u003c` operator\n\nThe library generates correct ANSI/VT100 escape sequences from these structured commands, making it both a UI toolkit and a robust terminal control sequence generator.\n\n## Installation\n\nAdd to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/compnerd/VirtualTerminal.git\", branch: \"main\")\n],\ntargets: [\n    .target(name: \"YourCLI\", dependencies: [\"VirtualTerminal\"])\n]\n```\n\n## Requirements\n\n- **Swift 6.0+**\n- **macOS 14+**, **Linux**, or **Windows 10+**\n- Terminal with basic ANSI support (any modern terminal)\n- libunistring is required for Linux GNU\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompnerd%2FVirtualTerminal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompnerd%2FVirtualTerminal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompnerd%2FVirtualTerminal/lists"}