Skip to content
CAI
Software that uses CAICheck a score

simonbs/Runestone

62.9

Adequate · 30 September 2026

14.5k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Runestone is a Swift-based code editor framework for iOS that provides a customizable TextView with Tree-sitter powered syntax highlighting and intelligent indentation. It supports multiple programming languages, theme customization, and advanced text manipulation features such as regex-based search and replace, line navigation, and configurable indentation strategies. The system includes comprehensive documentation, an example application for integration reference, and automated testing for complex input methods.

How it got here

2020–2021 — Core infrastructure and syntax engine overhaul

12 changes.

This period focused on rebuilding the editor's core text management infrastructure by replacing ad-hoc layout storage with a generic Red-black tree for efficient line tracking. Significant enhancements were made to the syntax highlighting engine through Tree-sitter query predicate support and updated language parsers, alongside new features for indentation strategies and text highlighting navigation.

2022–2023 — Core engine and documentation launch

17 changes.

This period focused on establishing the foundational Runestone TextView core engine, integrating Tree-sitter for syntax highlighting and intelligent indentation, and defining a configurable theme system. It also involved creating comprehensive documentation, interactive tutorials, and a fully featured example application to demonstrate integration and usage.

Features

Added syntax highlighting utility and privacy manifest

Runestone now includes a \StringSyntaxHighlighter\ class that allows developers to generate syntax-highlighted attributed strings for a given text and language without requiring a \TextView\ instance, supporting configurable themes, languages, and formatting options like kerning and tab length. Additionally, a \PrivacyInfo.xcprivacy\ file has been added to declare that the library does not track users or collect/access data, ensuring compliance with Apple's privacy requirements.

Sources/Runestone · high confidence

Adds example app with keyboard tools, settings menu, and find/go-to-line features

The example application now includes a custom keyboard accessory view with undo, redo, and text-shifting buttons, alongside a main view controller that supports text persistence, theme selection, and line-number/page-guide settings. Users can access Find and Replace (on iOS 16+), Go to Line, and toggle editing/selection states via a context menu, with the interface adapting to keyboard height changes and preserving a unique text input context identifier.

Example/Example/Main · high confidence

Adds iOS example application with theme-aware UI

The Example/Example/Application directory now contains the core application entry points (AppDelegate and SceneDelegate) for an iOS example app. The app initializes with default user settings and configures the main window to respect the user's preferred interface style (light/dark mode) via the registered theme settings. On iOS, the app presents a MainViewController wrapped in a navigation controller with a standardized navigation bar appearance, while other platforms receive the MainViewController directly.

Example/Example/Application · high confidence

Adds interactive documentation tutorials for integrating Runestone

New interactive tutorials have been added to the Runestone documentation, providing step-by-step Swift code examples for integrating the library. These resources guide users through setting up a TextView, configuring appearance options such as line numbers and page guides, applying custom themes like the Tomorrow color scheme, and enabling syntax highlighting with TreeSitter.

Sources/Runestone/Documentation.docc/Tutorials · high confidence

Adds text highlight navigation and rounded corner styling

Users can now navigate between highlighted text ranges using previous/next commands, with an option to loop through results. Highlights can be styled with a custom color and rounded corners, and the system correctly handles ranges that span multiple lines or line fragments.

Sources/Runestone/TextView/Highlight · high confidence

Enhanced search and replace with regex capture groups and batch operations

The search and replace functionality now supports complex replacement strings when using regular expressions. Users can reference captured groups using $0, $1, etc., and apply case-modification modifiers (such as \\u for uppercase, \\l for lowercase) to those groups, mirroring Visual Studio Code's behavior. Additionally, replacement strings can now contain escape sequences for newlines, carriage returns, and tabs. To improve performance and user experience, multiple replacements are executed as a single batch operation, registering only one undo step for the entire set of changes.

Sources/Runestone/TextView/SearchAndReplace · high confidence

Example app adds character pair support and configurable text view settings

The example project now includes a BasicCharacterPair struct to define character pairs (such as parentheses and quotes) and configures the TextView to use these pairs by default. Additionally, the example app introduces settings for isEditable and isSelectable properties, allowing users to toggle text editing and selection capabilities within the demo.

Example/Example/Library · high confidence

Initial Example application project structure

The Example project has been added, providing a complete Xcode workspace and project configuration for the Runestone library. This includes the main application target with Swift UI components (MainView, ThemePicker), integration with Runestone frameworks (Languages, Themes), and necessary entitlements and Info.plist settings to run the demo app.

Example/Example.xcodeproj · high confidence

Initial documentation for Runestone framework

Added comprehensive documentation articles covering installation, getting started, creating themes, adding Tree-sitter languages, and syntax highlighting strings. The documentation also includes an overview of features, details on indentation, find and replace, character pairs, and navigation, along with an Info.plist setting default availability to iOS 14.0.

Sources/Runestone/Documentation.docc · high confidence

Initial release of the Runestone TextView core engine

This change introduces the foundational components of the Runestone code editor, including the \TextView\ class, text input handling via \TextInputView\, layout management, line movement, and content sizing. It establishes the core architecture for features such as syntax highlighting, line numbers, and text selection, replacing previous implementations with a new, modular structure.

Sources/Runestone/TextView/Core · high confidence

Introduces TreeSitter query predicate support

The TreeSitter integration now supports query predicates, allowing users to filter captures based on their text content. This change adds logic to parse and evaluate \eq?\, \not-eq?\, \match?\, and \not-match?\ predicates within TreeSitter queries, enabling more precise syntax highlighting and code analysis rules.

Sources/Runestone/TreeSitter · high confidence

Introduces configurable indentation strategies and controller for text views

The text view now supports configurable indentation via a new \IndentController\ and \IndentStrategy\ system, allowing users to choose between tab-based or space-based indentation with a specified length. This change adds logic to correctly handle shifting lines left or right, inserting line breaks with appropriate indentation levels, and detecting existing indentation strategies in the text. It also includes utilities like \IndentLevelMeasurer\ and \TabWidthMeasurer\ to accurately calculate indentation widths and levels, ensuring consistent formatting behavior regardless of whether tabs or spaces are used.

Sources/Runestone/TextView/Indent · high confidence

Introduces configurable syntax highlighting themes and page guide controls

The text view now supports customizable appearance through a new \Theme\ protocol and \DefaultTheme\ implementation, allowing users to define colors and font traits for syntax highlighting tokens (such as keywords, comments, and strings) as well as UI elements like the gutter, line numbers, and search results. Additionally, a new \PageGuideController\ and \PageGuideView\ have been added to the appearance subsystem, enabling users to configure a vertical page guide line with specific column positioning, font, and hairline styling.

Sources/Runestone/TextView/Appearance · high confidence

JavaScript language support added to the example project

The Example/Languages location now includes a Swift package for JavaScript, providing syntax highlighting, injection rules (for template literals, regex, and JSDoc), and indentation scopes. This is implemented via a bundled TreeSitter JavaScript parser and associated query files, replacing the previous TreeSitterLanguages dependency for this example.

Example/Languages · high confidence

New Theme Picker example with live preview

The example project now includes a ThemePicker feature that allows users to browse available themes and see a live code preview update instantly. This new UI component, consisting of a table view controller and a custom preview cell, demonstrates how to configure the TextView with different EditorTheme settings, including background colors, text colors, and selection highlights, providing a practical reference for integrating theme switching in applications.

Example/Example/ThemePicker · high confidence

New example themes added

The example project now includes four new syntax highlighting themes: One Dark, Plain Text, Tomorrow, and Tomorrow Night. These themes are provided as Swift packages within the Example/Themes directory, allowing users to see how the Runestone editor can be styled with different color palettes and UI settings.

Example/Themes · high confidence

New types for text navigation and location

Users can now specify how text is selected when navigating to a specific line using the new GoToLineSelection enum, which offers options to position the caret at the beginning or end of the line, or to select the entire line. Additionally, the new TextLocation struct allows for precise identification of positions within the text using zero-based line numbers and column indices, enabling more granular navigation and interaction with the text view.

Sources/Runestone/TextView/Navigation · high confidence

Behavioural changes

3 commits (1 fix) modifying Design

A change to existing behaviour in Design — 3 commits (1 fix), 2 files.

Design · medium confidence · unverified

Adds localized strings for replace, undo, and line movement actions

The app now includes localized user interface strings for German, English, Spanish, Finnish, French, and Japanese. These resources provide translations for the 'Replace' menu item and specific undo action names (Typing, Replace All, Move Lines Up, Move Lines Down), ensuring these features are displayed in the user's preferred language.

Sources/Runestone/Resources · high confidence

Introduces Tree-sitter based syntax highlighting and intelligent indentation

The syntax highlighting engine has been replaced with a new implementation powered by Tree-sitter. This change adds support for complex language features including injected languages (such as embedded JavaScript in HTML) and provides intelligent indentation that automatically adjusts based on the syntax tree structure (e.g., increasing indent after opening brackets or control flow statements). The update also includes automatic detection of indentation strategies (tabs vs. spaces) and ensures thread-safe parsing to prevent race conditions during text edits.

Sources/Runestone/TextView/SyntaxHighlighting · high confidence

Introduces a new Red-black tree-based line management system

The LineManager component now uses a generic Red-black tree (DocumentLineTree) to track document lines, replacing the previous implementation. This change introduces new internal structures including DocumentLineNodeData for storing line metrics (height, byte count, delimiter length), LineChangeSet for tracking inserted, removed, and edited lines, and LinePosition for row/column coordinates. The system now rebuilds the line tree from a StringView, calculates content height based on the rightmost node, and supports operations like inserting and removing characters with proper line merging and splitting logic.

Sources/Runestone/LineManager · high confidence

Introduces core text-editing infrastructure and iOS 17 caret compatibility

The library adds foundational types for byte-level text management (ByteCount, ByteRange) and helper extensions for string and range operations, establishing the basis for precise text manipulation. It also introduces a KeyboardObserver to manage keyboard visibility and a QuickTapGestureRecognizer to improve text interaction responsiveness. Additionally, the update adds specific workarounds for iOS 17 to ensure the text cursor (caret) remains visible and blinks correctly by accessing private UITextInput APIs.

Sources/Runestone/Library · high confidence

Introduces generic Red-Black Tree implementation for document layout

The \Sources/Runestone/RedBlackTree\ location now contains a new, generic Red-Black Tree data structure (\RedBlackTree\) designed to store and manage document line frames. This implementation replaces previous ad-hoc layout storage with a balanced tree that supports efficient insertion, removal, and location-based lookups via methods like \node(containingLocation:)\ and \nodePosition(at:)\. The change introduces generic constraints (\NodeID\, \NodeValue\, \NodeData\) to allow flexible node data, adds a \ClosedRangeValueSearchQuery\ for range-based searches, and provides an iterator for sequential traversal, fundamentally changing how the editor tracks and accesses line positions internally.

Sources/Runestone/RedBlackTree · high confidence

Refactors line layout and introduces configurable line break modes

The line controller's layout logic has been restructured to support distinct line break behaviors. A new \LineBreakSuggester\ system allows the text view to wrap lines either by word (defaulting to whitespace preference) or by character, addressing issues where ligatures were broken incorrectly or breaks occurred in the middle of character pairs. Additionally, the rendering pipeline now processes each line fragment individually rather than typesetting entire lines at once, which improves layout precision and performance for long lines.

Sources/Runestone/TextView/LineController · high confidence

Updated embedded Tree-sitter language parsers to version 13

The embedded Tree-sitter grammar sources for HTML, JavaScript, JSON, Python, and YAML in the test suite have been updated to the latest version (LANGUAGE\_VERSION 13). This upgrade refreshes the internal parser tables and external scanners for these languages, ensuring the test suite validates against the current upstream grammar definitions.

Sources/TestTreeSitterLanguages · high confidence

Test coverage

Added unit tests for core text handling and language-specific indentation; Automated UI test scripts for Chinese and Korean input; New UI test host app and JavaScript language support for text input validation.

Dependencies

Upgrades to Tree-sitter 0.20.9 and Swift 5.5 toolchain

The Runestone package now depends on Tree-sitter version 0.20.9 and requires the Swift 5.5 toolchain, raising the minimum supported platform to iOS 14. This update introduces a new \TestTreeSitterLanguages\ target to support testing and includes a \PrivacyInfo.xcprivacy\ resource in the main library.

(dependencies) · high confidence

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

How this codebase got here

Score

  • CAI 64 → 63 (-0.8)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 94 → 94 (-0.1)
  • Architecture 99 → 93 (-6.5)
  • Maturity 53 → 53 (+0.0)
  • Readiness 72 → 75 (+2.4)
  • Security 60 → 60 (+0.0)

Resolved (3)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

New (6)

  • ContentSizeService.longestLineWidth (cognitive 19) (Sources/Runestone/TextView/Core/ContentSizeService.swift)
  • Coverage not measured — Swift suite
  • Outdated: tree-sitter
  • Projects may be oversized for their cohesion
  • Redundant method signatures across concrete theme types. All concrete theme implementations expose the exact same method signature fontTraits(for: String). This duplication mirrors the textColor issue.
  • Redundant method signatures across concrete theme types. All concrete theme implementations expose the exact same method signature textColor(for: String). Since these types likely conform to a common Theme protocol (or share a base structure), this method is duplicated across every implementation rather than being defined once in the protocol/base type.

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

Survey your own repository

simonbs/Runestone 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 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 592434a103a4d1ab83e14f87ac6eef569dd7a99d — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.