@evident-ai/cli
v0.2.0
Published
Evident CLI - Run OpenCode locally and connect to Evident
Maintainers
Readme
@connected/cli
Run OpenCode locally and connect it to the Connected platform.
Installation
npm install -g @connected/cliOr run directly with npx:
npx @connected/cli <command>Commands
connected login
Authenticate with Connected using your browser.
connected loginOptions:
--no-browser- Don't open the browser automatically (copy the URL manually)--token- Use token-based authentication (for CI/CD environments)
connected logout
Remove stored credentials from your machine.
connected logoutconnected whoami
Show the currently authenticated user.
connected whoamiconnected tunnel
Establish a tunnel from your local OpenCode instance to Connected.
connected tunnelOptions:
-s, --sandbox <id>- Connect to a specific sandbox ID-p, --port <port>- OpenCode port (default: 4096)
Getting Started
1. Install and run OpenCode locally
First, install OpenCode and start it in your project directory:
# Install OpenCode
npm install -g @opencode/cli
# Start OpenCode server in your project
cd ~/projects/my-app
opencode serve --port 40962. Create a Local Mode sandbox
In the Connected web app (https://app.connected.run):
- Click "New Sandbox"
- Select "Local Mode"
- Click "Create Sandbox"
Note the sandbox ID from the URL or dashboard.
3. Connect via the CLI
# Authenticate (first time only)
connected login
# Start the tunnel
connected tunnel --sandbox <sandbox-id>The tunnel will connect your local OpenCode to the Connected platform, enabling:
- Chat through the web interface
- WhatsApp and Slack integration
- Session history and management
How It Works
+-------------------+ +-------------------+ +-------------------+
| Your Machine | | Cloudflare Edge | | Connected API |
| | | | | |
| OpenCode (4096) <-+---->| Tunnel Relay (DO) |<--->| Cloud Run |
| | | | | |
| connected tunnel |---->| WebSocket | | Neon DB |
+-------------------+ +-------------------+ +-------------------+- The CLI connects to OpenCode running on localhost
- Establishes a WebSocket connection to the tunnel relay
- Connected routes messages through the tunnel to your local OpenCode
- Responses flow back through the same path
Troubleshooting
"OpenCode not found on port 4096"
Make sure OpenCode is running:
opencode serve --port 4096"Authentication failed"
Re-authenticate:
connected logout
connected login"Tunnel disconnected"
The CLI will automatically reconnect. If issues persist:
- Check your internet connection
- Verify OpenCode is still running
- Try restarting the tunnel
Configuration
Credentials are stored in:
- macOS/Linux:
~/.config/connected/ - Windows:
%APPDATA%\connected\
Environment variables:
CONNECTED_API_URL- Override the API URL (for development)CONNECTED_TUNNEL_URL- Override the tunnel relay URL (for development)
Development
# Install dependencies
pnpm install
# Build
pnpm build
# Run locally
pnpm start <command>
# Type check
pnpm typecheckLicense
MIT
