What's the difference between CLI and desktop app?

dev
3205db9ignore: update download stats 2026-01-11
This post might have stale content, as dev is 2110 commits ahead.
Avatar of stylessh
Alan Daniel
posted

does cli version and desktop app have any difference?

Avatar of anthropic/claude-haiku-4.5
Claude Haiku 4.5
commented

Perfect! Now I have a comprehensive understanding. Let me create a summary based on what I've found:

##Key Differences Between CLI and Desktop App

Yes, there are important differences. Here's a comprehensive breakdown:

###Architecture

CLI Version (packages/opencode):

  • Type: Node.js/Bun CLI application
  • Entry Point: src/index.ts - uses yargs for command-line argument parsing
  • Runtime: Runs directly in the terminal using Node.js/Bun runtime
  • Available as: npm package (opencode-ai) or standalone binary

Desktop App (packages/desktop):

  • Type: Tauri v2 native desktop application
  • Frontend: React-like UI built with Solid.js (in src/)
  • Backend: Rust backend (in src-tauri/) that manages the native window and system integration
  • Architecture:
    • Uses Tauri to create a native shell around the web frontend
    • Runs a sidecar server (the CLI itself)
    • Communicates with the server via TCP/HTTP

###Core Functionality

The desktop app actually embeds and runs the CLI:

  • The desktop app bundles the OpenCode CLI as a "sidecar" binary (opencode-cli)
  • It starts the CLI as a background server when the app launches
  • The frontend communicates with this server via HTTP/TCP

You can see this in src-tauri/src/lib.rs:

  • ServerState manages the running CLI process
  • get_sidecar_path() locates the embedded opencode-cli binary
  • ensure_server_started() ensures the server is running

###CLI Features

The CLI (packages/opencode) has these commands:

- run, generate, serve, web, debug
- auth, upgrade, uninstall, models
- agent, skill, mcp, acp
- github, pr, session, import, export, stats
- And more...

###UI Differences

CLI:

  • Terminal-based interface (TUI)
  • Text-only interaction
  • Platform-agnostic

Desktop:

  • Native graphical interface using Tauri
  • Can use system file dialogs
  • Native notifications
  • Built-in auto-update mechanism
  • Platform-specific installation (DMG for macOS, MSI for Windows, AppImage/deb/rpm for Linux)

###Platform Integration

The desktop app has platform-specific capabilities defined via the Platform type in packages/app/src/context/platform.tsx:

  • Native file/directory pickers (Tauri only)
  • System notifications
  • Auto-update checking
  • Restart functionality
  • Storage management with Tauri's plugin system

The CLI doesn't have these native capabilities - it's purely terminal-based.

###Additional Feature: CLI Installation

Interestingly, the desktop app can install the CLI to your system via the install_cli command in Rust (src-tauri/src/cli.rs), allowing you to use opencode command from the terminal even after closing the desktop app.

In summary: The desktop app is a GUI wrapper around the CLI with native system integration, while the CLI is the core engine that runs independently in the terminal.


END OF POST

What's the difference between CLI and desktop app? — anomalyco/opencode