Skip to content

ihasq/radius

Repository files navigation

Radius

LLM-native code editing toolkit with LSP integration.

Radius is a daemon-based code editing system designed for AI coding agents. It provides semantic code operations via Language Server Protocol (LSP) integration with efficient in-memory text buffering using a Piece Tree data structure.

Features

  • LSP-powered semantic operations: Variable reading and renaming with full semantic understanding
  • Undo/redo history: Per-project change tracking with full file restoration
  • Git conflict resolution: Parse and resolve merge conflicts programmatically
  • Import-aware file renaming: Automatically update import statements across the project
  • VSCode extension support: Install extensions from Open VSX registry for language support
  • External change detection: Automatically detect and handle external file modifications
  • Memory-efficient buffering: LRU cache with Piece Tree text buffer for large file handling
  • Configurable LSP servers: User-defined LSP server mappings via JSON configuration

Installation

Quick Install

Linux / macOS:

curl -fsSL https://radius-ai.pages.dev/install.sh | bash

Windows (PowerShell):

irm https://radius-ai.pages.dev/install.ps1 | iex

The installer will:

  • Download the latest release for your platform
  • Extract binaries to ~/.radius/bin (customizable with $RADIUS_INSTALL_DIR)
  • Add to PATH automatically

Manual Installation

Download pre-built binaries from GitHub Releases:

# Linux x64
curl -LO https://github.com/ihasq/radius/releases/latest/download/radius-linux-x64.tar.gz
tar xzf radius-linux-x64.tar.gz
sudo mv radius-linux-x64 radiusd-linux-x64 /usr/local/bin/
sudo ln -s /usr/local/bin/radius-linux-x64 /usr/local/bin/radius
sudo ln -s /usr/local/bin/radiusd-linux-x64 /usr/local/bin/radiusd

Build from Source

Prerequisites:

  • Bun runtime (v1.0+)
  • Unix-like OS (Linux, macOS) or Windows
# Clone repository
git clone https://github.com/ihasq/radius.git
cd radius

# Install dependencies
bun install

# Build binaries
bun run build

# Install to system (optional)
sudo cp dist/radius dist/radiusd /usr/local/bin/

Usage

Starting the daemon

The daemon starts automatically on first command. To manually manage:

# Check daemon status
radius ping

# Stop daemon
radius daemon stop

Commands

File viewing

radius view <file>                    # View entire file
radius view <file> --range 10:20      # View lines 10-20

Variable operations (LSP-powered)

radius read-var <file> --var <name>              # Find variable definition and references
radius modify-var <file> --from <old> --to <new> # Rename variable across file

Text editing

radius str-replace <file> --old "text" --new "replacement"
radius insert <file> --line 10 --text "new line content"
radius create <file> --content "file content"

Git conflict resolution

radius solve-conflict <file>                    # Show conflicts
radius solve-conflict <file> --accept ours      # Accept our changes
radius solve-conflict <file> --accept theirs    # Accept their changes
radius solve-conflict <file> --id 1 --content "custom resolution"

File renaming with import updates

radius rename-file <old-path> --to <new-path>

Undo/Redo

radius undo    # Undo last change
radius redo    # Redo undone change

Extension management

radius ext install <publisher.name>   # Install from Open VSX
radius ext install ./local-extension  # Install local extension
radius ext list                       # List installed extensions
radius ext remove <publisher.name>    # Remove extension

LSP server management

radius lsp list    # Show registered LSP servers and their sources

Configuration

LSP servers

Create ~/.radius/lsp-servers.json to define custom LSP servers:

{
  "servers": {
    "python": {
      "command": "pylsp",
      "args": []
    },
    "go": {
      "command": "gopls",
      "args": ["serve"]
    }
  }
}

LSP resolution priority:

  1. Installed VSCode extensions (static extraction)
  2. User configuration (~/.radius/lsp-servers.json)
  3. Built-in fallback table

Architecture

radius (CLI) ─── Unix Socket IPC ───> radiusd (Daemon)
                                          │
                    ┌─────────────────────┼─────────────────────┐
                    │                     │                     │
              BufferManager          LspManager          HistoryTracker
              (Piece Tree)           (LSP clients)       (Undo/Redo)
                    │                     │
                    │              ExtensionLoader
                    │              (VSCode extensions)
                    │
              File System

Components

  • CLI (radius): Thin client that forwards commands to daemon via Unix socket
  • Daemon (radiusd): Long-running process managing buffers, LSP clients, and history
  • BufferManager: Piece Tree-based text buffer with mtime tracking and LRU eviction
  • LspManager: Per-project LSP client lifecycle management
  • ExtensionLoader: VSCode extension loading with static extraction + activate() fallback
  • HistoryTracker: Per-project changeset history for undo/redo operations

Development

Project structure

src/
  cli/           # CLI entry point and command parsing
  daemon/        # Daemon entry point and handler registry
  core/
    buffer/      # Piece Tree buffer manager
    commands/    # Command handlers
    history/     # Undo/redo tracking
    imports/     # Import statement scanning and rewriting
    conflict/    # Git conflict parsing
  lsp/           # LSP client and transport
  extension-host/# VSCode extension loading
  ipc/           # Unix socket IPC layer
  shared/        # Shared utilities

Build

bun run build    # Build both radius and radiusd binaries

Type checking

bunx tsc --noEmit

License

MIT