Skip to content

Latest commit

 

History

History
138 lines (103 loc) · 10.6 KB

README.md

File metadata and controls

138 lines (103 loc) · 10.6 KB

OpenCode

OpenCode (Rune)

OpenCode Desktop, rewritten from scratch in Rust on Rune.
10–100× faster and lighter. Native on macOS, Windows, and Linux — and the same app in the browser over WebGPU.

Built with OpenCode Engine: Rune Backends: Metal, DX12, Vulkan, WebGPU Electron: 0 MB Tests: 0

OpenCode (Rune) session with native GPU generative UI, vector flowchart, and split diff review

Try the dev build

No Electron, no DOM, no Chromium at startup. Download the latest dev build and point it at any running OpenCode server:

Platform Download (dev)
macOS Apple Silicon (.dmg) · Intel (.dmg)
Windows x64 setup · arm64 setup
Linux x64 AppImage · DEB · RPM
Linux arm64 AppImage · DEB · RPM

Set chmod +x on Linux AppImage files. macOS and Windows dev builds auto-update in the background. Want to test a pull request alongside dev? See docs/trying-opencode-rune.md. Release channels and signing: docs/releasing.md.

Start a local OpenCode server (opencode serve --service or open OpenCode Desktop), then launch OpenCode (Rune). It discovers http://127.0.0.1:4096 or ~/.config/opencode/service.json automatically (--server <url> or OPENCODE_SERVER_URL overrides it) and never starts a server on its own.

What's inside

Side tabs, session timeline, and Ghostty-VT terminal pane Native GPU vector sequence diagram in light mode

Settings Appearance showing Windfoil GPU outline text rendering New-session wordmark Easter egg: 800-pin 3D GPU board and lodger

  • Windfoil GPU text. Draws each glyph's exact coverage directly from its vector outline on the GPU, so text stays sharp while zooming or moving.
  • Zero Chromium at startup. The built-in browser pane (⌃⌘B / Ctrl+Alt+B) fetches an isolated CEF sidecar (apps/browser-engine) lazily on demand. If you never open it, you never pay for it.
  • Real native engines. Ghostty-VT (libghostty-vt) terminal tabs, virtualized syntax-highlighted code and split diffs (opencode-code-view), native GPU ```ui generative UI and vector diagrams (rune-parts), Word/Excel/PowerPoint previews via Vello (office-preview), local Hex voice dictation (hex-client), crash-safe SQLite with an mmap draft journal (opencode-storage), and 63 locales with RTL.
  • 0 ms UI iteration. Built-in --!strict Luau plugins (plugins/*) reload live in place with --plugin-hot without touching rustc.
  • Headless eyes, zero tests. By policy, this repo has no automated tests or mocks ("Application code is truth", see AGENTS.md). The binary renders any scene or 111-story playground view offscreen to PNG (--snap), dumps its live element tree (--tree), and replays scripted input (--script).
  • Weird things built right in. Pull on the final e of the wordmark on a new-session tab — something lives inside it, and pulling it out pops the letters into an 800-pin 3D GPU board and Brick Breaker with synthesized sound (features/egg). Press ⌘⇧⌥R (Dev › Rewind) to freeze the last minute of layout frames and scrub a glitch frame by frame.

Run from source

Start an OpenCode server locally (opencode serve --service or OpenCode Desktop), then run:

cargo run -p opencode-desktop -- --live

For fast local iteration (skips debuginfo, Office fonts, and standalone story modules, and enables Luau --plugin-hot live reload):

scripts/dev-fast.sh          # macOS / Linux
pwsh scripts/dev-fast.ps1    # Windows

To scaffold a new Luau plugin (plugins/<id>/) or decoupled Rust feature crate (features/<id>/), run scripts/new-feature.sh (or pwsh scripts/new-feature.ps1). See docs/fast-builds.md for profiles, sccache, and fast linkers, and crates/opencode-plugin-spec/docs/writing-a-plugin.md for the plugin guide.

Other targets

Target Command
Standalone session-view playground (no server) cargo run -p session-view --example read_only
Local macOS .app (~/Applications/OpenCode (Rune).app) apps/desktop/scripts/dev.sh (or --release)
Browser wasm32/WebGPU (apps/web) pwsh scripts/web.ps1

Release builds: --profile release is what ships — fat LTO, one codegen unit, plus the PGO profiles in apps/desktop/pgo/ via pwsh apps/desktop/scripts/release.ps1 (Windows x64) and apps/desktop/scripts/build-app.sh (Apple Silicon macOS). A plain cargo build --release omits the PGO profile and takes 25–60 minutes and ~10 GB RAM for one rustc. Use --profile release-quick or --profile release-thin for fast optimized iteration (docs/fast-builds.md).

Architecture

Organized by progressive disclosure across four tiers: start at Tier 1 and step down only when a feature needs lower-level metal. Full crate inventory, dependency graph, and wiring guide live in ARCHITECTURE.md.

OpenCode (Rune) four-tier progressive disclosure architecture

Tier Path Purpose
Tier 1 plugins/* Built-in --!strict Luau plugins (panels, dialogs, commands, server sources); hot-reloads without touching Rust
Tier 2 features/* Decoupled Rust feature crates (opencode-feature-*) with zero cross-feature deps and non-generic &mut dyn *Host boundaries
Tier 3 crates/* Shell kernel (opencode-kernel), UI foundation (opencode-ui), headless runtime (opencode-runtime), platform/storage/search/i18n/plugin-runtime libraries, and embeddable crates (session-view, opencode-code-view, opencode-kit, rune-parts, terminal, browser-pane, office-preview, project-icon, hex-client, otlp-lite)
Tier 4 apps/* Host shells and packaging: apps/desktop (opencode-desktop lib + native bin), apps/web (opencode-web wasm32/WebGPU), apps/installer (opencode-rune-setup), and apps/browser-engine (on-demand CEF sidecar, excluded from workspace)
Embedding session-view in another Rune app

Add git dependencies from this repository pinned to a commit rev matching your anomalyco/rune pin:

opencode-kit = { git = "https://github.com/anomalyco/opencode-rune", rev = "<rev>" }
session-view = { git = "https://github.com/anomalyco/opencode-rune", rev = "<rev>" }

Hold a session_view::ViewState on your app state (calling view.setup(waker, headless) during setup), implement session_view::TimelineHost (using session_view::delegate_view_state! for the state accessors), drive session_view::poll(s, now, tx) each frame, and render session_view::read_only(s, p, id, transcript) or session_view::timeline_area(s, p, id, transcript, pills, header) alongside session_view::overlays(s, p, cx). See crates/session-view/examples/read_only.rs for a complete minimal host.

Checks

This repo has no automated tests (see AGENTS.md). Verify changes by running the app and the cheap pre-push guardrails (architecture layers, file size, folder shape, dialog sizes, and generated tables; rules in ARCHITECTURE.md):

scripts/guardrails.sh          # macOS / Linux / Git Bash
pwsh scripts/guardrails.ps1    # Windows PowerShell

Run scripts/clippy.sh separately for workspace-wide -D warnings checks across feature sets.