Skip to content
CAI
Software that uses CAICheck a score

migueldeicaza/SwiftTerm

57.8

Adequate · 15 November 2026

78.9k

lines of production code

Swift

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Termcast tool for recording and replaying terminal sessions

Introduces the Termcast command-line application, which allows users to record terminal sessions and replay them in a format compatible with asciinema. The implementation includes a recorder that captures input, output, and resize events, and a player that replays these events with timing fidelity, exposing 'record' and 'playback' subcommands via ArgumentParser.

Sources/Termcast · high confidence

Initial project scaffolding and documentation

The repository is initialized with core project files including a MIT license, a Code of Conduct, and a Security policy. Documentation is added for performance benchmarking and a migration guide from version 1.x to 2.x. A Makefile is introduced to manage build tasks such as fuzzing and benchmarking, and a terminfo entry is provided to define terminal capabilities for the SwiftTerm emulator.

(repo-wide) · high confidence

Introduce MacTerminal sample app with Kitty protocol support and clipboard integration

The MacTerminal sample application is introduced to demonstrate the SwiftTerm library on macOS. It features a native AppKit interface with menu items for exporting buffer and selection content, and integrates the Kitty keyboard and graphics protocols. The app implements the Kitty clipboard protocol (OSC 5522), allowing terminal programs to request clipboard access with user permission prompts, and supports Base16 color themes. It also includes an IO baseline harness for measuring main-thread stall times and performance under load.

TerminalApp/MacTerminal · high confidence

Introduce off-main-thread Metal rendering via CAMetalLayer

SwiftTerm now supports rendering the terminal via Metal on a background thread by introducing a new \CAMetalLayer\-backed surface (\TerminalMetalLayerView\) alongside the existing \MTKView\ path. This change decouples the GPU render loop from the main thread's display cycle, allowing the terminal to maintain responsiveness during heavy main-thread workloads. The update includes the necessary infrastructure for this dual-surface architecture, such as the \MetalRenderTarget\ protocol, \MetalBufferingMode\ for controlling buffer strategies, and a \CoreTextGlyphRasterizer\ with configurable font smoothing, ensuring that the new off-main-thread path produces pixel-identical output to the legacy main-thread renderer.

Sources/SwiftTerm/Apple/Metal · high confidence

Introduces bidirectional text (BiDi) support and restructures terminal buffer internals

SwiftTerm now supports bidirectional text rendering for Arabic and Hebrew via the terminal-wg protocol, exposing configuration options like \BidiSupportMode\, \BidiDirection\, and \BidiPresentationState\ to control how logical text is processed and displayed. This change is accompanied by a significant internal restructuring of the terminal buffer system, including the introduction of \PackedCell\ for efficient 64-bit cell storage, a new \BufferRef\ mechanism to optimize reference counting, and the inlining of \BufferSet\ into the \Terminal\ class to improve performance and reduce memory overhead.

Sources/SwiftTerm · high confidence

Major rendering overhaul and new protocol support on Apple platforms

The Apple terminal view has been significantly reworked to support advanced rendering and new terminal protocols. Bidirectional text (Arabic/Hebrew) is now fully supported with Unicode 17.0 data, and block elements are rendered with correct geometry. The view now supports the Kitty graphics protocol (including images and Unicode placeholders) and the Kitty clipboard protocol (OSC 5522). Performance is improved by moving Metal rendering off the main thread, coalescing output, and optimizing color handling. New features include configurable bell styles, bracketed paste, and improved cursor styles.

Sources/SwiftTerm/Apple · high confidence

New RenderBench performance harness for SwiftTerm

A new benchmarking tool, RenderBench, has been added to the Tools directory to measure the combined parser, buffer, invalidation, and UI render performance of SwiftTerm. It drives a real, on-screen TerminalView without requiring a PTY or shell, using deterministic synthetic workloads to ensure reproducible results. Users can run built-in scenarios (such as dense coloring, scrolling, and Arabic text shaping) or import shared VTEBench workloads, choosing between Core Graphics and Metal renderers via command-line flags. The tool provides detailed metrics including input throughput, render rates, and frame presentation status, and includes a specific debug scenario to reproduce and verify fixes for stalled Metal renderer frames.

Tools/RenderBench · high confidence

New SwiftUI wrapper and dedicated iOS accessory keyboard

SwiftTerm now includes a SwiftUI-compatible \SwiftUITerminalView\ for easier embedding in SwiftUI apps, alongside a new \TerminalAccessory\ input view that provides a dedicated on-screen keyboard with keys for F1–F10, navigation, and modifiers like Control. This accessory view also supports auto-repeat for cursor keys and allows toggling between the on-screen keyboard and mouse reporting.

Sources/SwiftTerm/iOS · high confidence

New SwiftUI-based SSH login interface for iOS Terminal

The iOS Terminal app now features a redesigned login experience built with SwiftUI. A new SSHLoginView presents a styled card for entering local SSH credentials (username and password), which triggers the connection to localhost:22. This SwiftUI view is hosted within the existing UIKit ViewController, replacing the previous setup flow. The underlying terminal connection logic remains handled by the existing UIKit-based terminal views.

TerminalApp/iOSTerminal · high confidence

New developer tooling for Kitty graphics parity, fuzz corpus import, and PTY benchmarking

Added three new scripts in the Tools directory to support development and testing workflows: \generate\_kitty\_parity\_matrix.py\ generates a documentation matrix mapping Ghostty's Kitty graphics tests to iiSwiftTerm test coverage; \import-ghostty-fuzz-corpus.swift\ imports Ghostty fuzzing corpus data into SwiftTerm test fixtures; and \run-pty-benchmark.py\ provides a framework for building and comparing MacTerminal PTY performance metrics across different code versions.

Tools · high confidence

New macOS terminal view components and caret rendering

The macOS AppKit front-end now includes a dedicated MacCaretView for rendering the terminal cursor with support for focus tracking, blinking styles, and transparency, alongside a TerminalFindBarView for search functionality. The MacTerminalView has been updated to use an overlay scroller indicator and manages mouse-move events via a window-scoped fallback for macOS 26+, while MacLocalTerminalView provides a convenient interface for launching local processes with a dedicated delegate protocol for process lifecycle and clipboard events.

Sources/SwiftTerm/Mac · high confidence

New visual BidiHarness tool for testing bidirectional terminal rendering

A new macOS application, BidiHarness, has been added to the Tools directory to visually test and validate bidirectional (BiDi) terminal text rendering. The harness provides a split-view interface displaying both a SwiftTerm-based terminal and a WebKit reference view, allowing users to load predefined scenarios (stored as JSON) that exercise complex text layouts, CJK scrolling, box-drawing, and selection behaviors. It supports switching between Core Graphics and Metal renderers, captures visual artifacts for regression comparison, and exposes a socket-based control interface for automated testing.

Tools/BidiHarness · high confidence

Web Terminal client-side rendering and testing infrastructure

The Web Terminal now includes a client-side rendering engine and a comprehensive suite of browser-based tests. The \app.js\ module introduces a \ShellClient\ that manages WebSocket connections, handles terminal resizing, and processes server control frames (ready, exit, error). A new \ClipboardController\ in \clipboard.js\ manages clipboard permissions and data exchange. To ensure reliability, the \BrowserTests\ directory now contains smoke tests (\server-smoke.mjs\, \backend-live.mjs\) that verify WebSocket connectivity and shell interaction, unit tests (\client.test.mjs\, \clipboard.test.mjs\) for the client logic, and live UI/performance tests (\ui-live.mjs\, \performance-live.mjs\) using Playwright to measure rendering speed and input latency.

TerminalApp/WebTerminal, Web · high confidence

Removals

Removed default iOS view controller scaffold

The default \ViewController.swift\ file, which provided a basic \UIViewController\ subclass for the iOS application, has been removed from the project. This eliminates the boilerplate view controller that was previously included in the SwiftTerm package.

SwiftTerm · high confidence

Architecture

MacTerminal project reorganized into TerminalApp directory

The MacTerminal Xcode project has been moved into the TerminalApp directory and is now referenced from the SwiftTerm.xcworkspace. This restructuring updates the project file paths and workspace references to reflect the new location, ensuring the build system correctly locates the MacTerminal.app target and its dependencies (SwiftTerm and VTEBenchWorkloads).

TerminalApp/MacTerminal.xcodeproj · high confidence

Behavioural changes

12 commits (1 fix) modifying Tools/SwiftTermBenchmarks

A change to existing behaviour in Tools/SwiftTermBenchmarks — 12 commits (1 fix), 17 files: “Fuzzed branch: trying to keep the performance from regressing”; “Fix test suite, do not crash on a race; Add Kitty benchmarks”; “Osc 7501 (\#746)”; and 9 more (refs \#746, \#809, \#780, \#792, \#796).

Tools/SwiftTermBenchmarks · medium confidence · unverified

Added iOSTerminal workspace configuration

The iOSTerminal project is now included in the Xcode workspace, enabling it to be built and run alongside the main TerminalApp. This change introduces the necessary workspace data files and updates the IDE workspace checks configuration to reflect the new project structure.

TerminalApp/iOSTerminal.xcodeproj/project.xcworkspace · high confidence

Build-time generation of terminal capability and version metadata

A new build plugin now generates Swift source files at compile time to embed Git repository information (branch, tag, commit, and dirty status) and a static table of terminfo capabilities. The generated version metadata is exposed via \SwiftTermBuildInfo.version\ for diagnostic purposes, while the terminfo data is compiled into \SwiftTermTerminfo.xtgettcapReplies\ to support XTGETTCAP queries. This approach ensures build stability by only writing output files when content changes and excludes the generated code from embedded builds via \\#if !SWIFTTERM\_EMBEDDED\.

Sources/SwiftTermBuildInfoGenerator · high confidence

Pin Swift WASM builds to version 6.4 and add build automation scripts

The build process for WebAssembly targets is now pinned to the Swift 6.4.0 release toolchain (via \scripts/wasm-toolchain.env\), ensuring consistent compiler and SDK versions for both browser and smoke-test builds. A new \scripts/build-wasm.sh\ script automates the build, export verification, and artifact generation, supported by \scripts/wasm-artifact.mjs\ for WASM inspection and stripping, and \scripts/check-wasm-exports.sh\ for ABI validation. Additionally, \scripts/regen\_unicode\_width\_data.py\ has been added to regenerate terminal-width lookup data based on Unicode 17.0.0 specifications. Also in this area: 1 commit (0 fixes) modifying TerminalApp, scripts; Added script to generate the esctest allowlist.

scripts · medium confidence · unverified

Stable build-time generation of SwiftTerm version and terminfo data

The SwiftTerm build plugin now generates SwiftTermBuildInfo.swift and SwiftTermTerminfo.swift files at build time, incorporating source-control metadata (branch, tag, commit, dirty state) and terminfo capabilities. By carefully selecting stable input files (such as Package.swift, swifterm-terminfo, and specific .git state files) rather than the entire source tree, the plugin ensures that generated outputs remain consistent across builds, preventing unnecessary rebuilds of SwiftTerm when unrelated files change.

Plugins/SwiftTermBuildInfoPlugin · high confidence

iOS sample app renamed to iOSTerminal with modern SSH stack

The iOS sample application has been renamed from SwiftTerm to iOSTerminal, and the project structure has been updated to replace the legacy SSH implementation with a modern stack using NIOSSH and NIOPosix. This change introduces new source files (SSHLoginView.swift, TerminalHostViewController.swift, UIKitSshTerminalView.swift) and updates the build configuration to embed these frameworks, resulting in a rebuilt app bundle named iOSTerminal.app.

TerminalApp/iOSTerminal.xcodeproj · high confidence

Test coverage

8 commits adding/updating tests in Tests/SwiftTermTests/Fixtures; Added Ghostty-style fuzzer entry point for SwiftTerm; Added Unicode column-width benchmark; Added WebAssembly terminal test suite; Added performance test baseline for SwiftTermTests; Added test coverage for terminal subsystems; Added tests for embedded terminal core functionality; Added unit tests for HeadlessTerminal behavior; Removal of default SwiftTerm test file.

Dependencies

Update Swift and Web dependencies to Swift 6.2 toolchain and Playwright 1.55.1

The project updates its Swift Package Manager manifests to use the Swift 6.2 toolchain, introducing support for Embedded and WebAssembly (Wasm) build traits, conditional platform exclusions, and new executable targets like Termcast and SwiftTermFuzz. It also bumps the Web directory's Playwright dependency to version 1.55.1 and updates various Swift packages (such as swift-argument-parser, swift-nio, and hummingbird) across the root, WebTerminal, and benchmark tool packages to ensure compatibility with the new toolchain and platform targets.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 55 → 58 (+3.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 59 → 55 (-3.7)
  • Architecture 96 → 96 (+0.7)
  • Maturity 87 → 67 (-19.3)
  • Readiness 42 → 48 (+6.4)
  • Security 74 → 83 (+9.1)
  • Domain Modelling 100 → 100 (+0.0)
  • Accessibility 59 → 70 (+11.6)
  • Performance 81 → 91 (+10.6)

Resolved (95)

  • ArtifactCapture.captureWindow (cognitive 18) (Tools/BidiHarness/BidiHarness/ArtifactCapture.swift)
  • ArtifactCapture.captureWindow (cyclomatic 17) (Tools/BidiHarness/BidiHarness/ArtifactCapture.swift)
  • Attribute.toSgr (cognitive 27) (Sources/SwiftTerm/CharData.swift)
  • Attribute.toSgr (cyclomatic 16) (Sources/SwiftTerm/CharData.swift)
  • ByteRunScanner.firstC0OrByte (cognitive 17) (Sources/SwiftTerm/ByteRunScanner.swift)
  • CircularBufferLineList.shiftUpAndRecycle (cognitive 18) (Sources/SwiftTerm/CircularList.swift)
  • ClassTooLong: HarnessViewController (Tools/BidiHarness/BidiHarness/HarnessViewController.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Mac/MacTerminalView.swift)
  • Duplicated block (10 lines × 3) (Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift)
  • Duplicated block (10–13 lines × 4) (Sources/SwiftTerm/CharSets.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/CharData.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Mac/MacTerminalView.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/SelectionService.swift)
  • Duplicated block (12 lines × 2) (Docs/prototypes/futex-ticket-lock/main.swift)
  • Duplicated block (12–14 lines × 2) (Sources/SwiftTerm/SearchEngine.swift)
  • Duplicated block (13 lines × 2) (Sources/SwiftTerm/Buffer.swift)
  • …and 75 more

New (211)

  • Attribute.sgrParameters (cognitive 16) (Sources/SwiftTerm/CharData.swift)
  • Attribute.sgrParameters (cyclomatic 21) (Sources/SwiftTerm/CharData.swift)
  • Buffer.insertCharacter (cyclomatic 18) (Sources/SwiftTerm/Buffer.swift)
  • Buffer.insertScalarRun (cyclomatic 18) (Sources/SwiftTerm/Buffer.swift)
  • CircularBufferLineList.shiftUpAndRecycleLines (cognitive 18) (Sources/SwiftTerm/CircularList.swift)
  • ClassTooLong: TerminalKeyboardRouter (Sources/SwiftTerm/Mac/MacKeyboardRouter.swift)
  • CoreGraphicsPaintHost.drawRunAttributes (cognitive 37) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • CoreGraphicsPaintHost.drawRunAttributes (cyclomatic 23) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • CoreGraphicsPaintHost.drawTerminalContents (cognitive 240) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • CoreGraphicsPaintHost.drawTerminalContents (cyclomatic 101) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (10 lines × 2) (Sources/SwiftTerm/Mac/MacCaretView.swift)
  • Duplicated block (10–11 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Apple/AppleTerminalView.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/SelectionService.swift)
  • Duplicated block (11 lines × 2) (Sources/SwiftTerm/Terminal.swift)
  • Duplicated block (11 lines × 3) (Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift)
  • Duplicated block (12 lines × 2) (Docs/prototypes/futex-ticket-lock/main.swift)
  • …and 191 more

Changes since last survey

  • 57 commits — 53 feature/other, 4 fixes

By area

  • Sources/SwiftTerm — 42 commits
  • Tests/SwiftTermTests — 7 commits
  • (root) — 2 commits
  • Tools/SwiftTermBenchmarks — 2 commits
  • (repo) — 1 commit
  • .github/workflows — 1 commit
  • TerminalApp/iOSTerminal — 1 commit
  • TerminalApp/iOSTerminal.xcodeproj — 1 commit

Notable commits

  • fix: Fix APC UTF-8 continuation bytes across input chunks (#799)
  • fix: Fix out-of-range read in reflowNarrower; ignore DECSLRM with left >= right
  • fix: Fix three CI failures on main (#794)
  • fix: fix: duplicate primary PTY descriptors under the session lock (#842)
  • change: Add DECSET_DECAWM_OffRespectsLeftRightMargin to the esctest allowlist
  • change: Add OSC 110/111 and DECSET 41; TAB keeps the pending wrap
  • change: Add a CI check for run-time field layout in hot-path types
  • change: Add a code layout report for benchmark A/B runs
  • change: Add pending-wrap tests
  • change: Add small sanmple program to test iOS keyboard input without creating a real SSH account
  • change: Add the reverse wraparound tests to the esctest allowlist
  • change: Add wrap-heavy benchmark workloads
  • change: Apply sync-end and cursor-style updates at the next frame tick
  • change: Clear warnings on github for the sample app
  • change: Coalesce OSC 12/112 cursor color changes on the frame driver
  • change: Content snapshots: buffer selection, whole-buffer and ranged regions, palette, and an ANSI export (#753)
  • change: DECCRA follows origin mode for the destination; DECFI scrolls from the pending wrap
  • change: Drop inline images from lines that EL, ED 0/1 and ECH erase (#815)
  • change: Drop the glyph atlas CPU copy and start the color atlas smaller (#816)
  • change: End OSC 8 links on an empty URI with params (#834)
  • …and 37 more

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

migueldeicaza/SwiftTerm was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit e1ff7f7b763dc194365f91dfd69cbbfc3810e13f — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.