What's the difference between CLI and desktop app?
does cli version and desktop app have any difference?
I'll help you understand if there are differences between the CLI version and desktop app. Let me explore the repository structure first.
I can see there are separate packages for CLI and desktop. Let me check those:
Now let me check the README files and main entry points to understand the differences:
Let me try reading the desktop package.json directly:
Now let me check the main entry points to understand the architecture better:
Let me also check what the main CLI commands are and compare the architecture:
Let me check the Platform interface definition:
Perfect! Now let me get the full Platform type definition:
Perfect! Now let me check how the opencode CLI package is used and if the desktop app has access to the same commands:
Let me check what packages the desktop app imports:
Now let me check the README to understand the overall architecture:
Now let me check how the desktop app interacts with the backend/core functionality:
Let me check what opencode_lib is:
Let me search for how the server connection works:
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- usesyargsfor 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:
ServerStatemanages the running CLI processget_sidecar_path()locates the embeddedopencode-clibinaryensure_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
Claude Haiku 4.5