JSPM

  • Created
  • Published
  • Downloads 888
  • Score
    100M100P100Q99564F
  • License MIT

Evident CLI - Run OpenCode locally and connect to Evident

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@evident-ai/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @connected/cli

    Run OpenCode locally and connect it to the Connected platform.

    Installation

    npm install -g @connected/cli

    Or run directly with npx:

    npx @connected/cli <command>

    Commands

    connected login

    Authenticate with Connected using your browser.

    connected login

    Options:

    • --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 logout

    connected whoami

    Show the currently authenticated user.

    connected whoami

    connected tunnel

    Establish a tunnel from your local OpenCode instance to Connected.

    connected tunnel

    Options:

    • -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-ai
    
    # Start OpenCode server in your project
    cd ~/projects/my-app
    opencode serve --port 4096

    2. Create a Local Mode sandbox

    In the Connected web app (https://app.connected.run):

    1. Click "New Sandbox"
    2. Select "Local Mode"
    3. 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           |
    +-------------------+     +-------------------+     +-------------------+
    1. The CLI connects to OpenCode running on localhost
    2. Establishes a WebSocket connection to the tunnel relay
    3. Connected routes messages through the tunnel to your local OpenCode
    4. 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:

    1. Check your internet connection
    2. Verify OpenCode is still running
    3. 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 typecheck

    License

    MIT