New:Socket for Asana Is Now Available.Learn more
Get Started

opencode-ddev

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencode-ddev

Adds context about ddev setup and improves command calling

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
14
100%
Maintainers
1
Weekly downloads
 
Created
Source

opencode-ddev-plugin

DDEV Plugin for OpenCode - Automatically detects DDEV availability and wraps bash commands to execute inside the DDEV container.

Features

  • Automatic DDEV Detection: Checks if DDEV is available using ddev describe -j for structured JSON output
  • Stopped Container Detection: Detects when DDEV is available but stopped, and prompts to start it
  • Container Command Wrapping: Automatically wraps bash commands with ddev exec for container execution
  • Host-Only Commands: Preserves commands that should run on the host (git, gh, docker, ddev)
  • Path Mapping: Maps host directories to container paths correctly using JSON-based project detection
  • Session Notifications: Notifies the LLM about DDEV environment only on first bash command execution (to save tokens)
  • Custom DDEV Logs Tool: Provides a ddev_logs tool for retrieving logs from DDEV services

Installation

Add to your opencode.json or ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-ddev"]
}

OpenCode auto-installs plugins on startup.

Update

Force update to latest:

rm -rf ~/.cache/opencode Then restart OpenCode.

Usage

Once installed, the plugin will:

  • Automatically detect DDEV availability and status when a session starts
  • Adds context to start DDEV if it's detected but stopped
  • Wrap bash commands to execute inside the DDEV container (when running)
  • Preserve host-only commands (git, gh, docker, ddev) to run on the host
  • Map working directories correctly between host and container

Example commands that will be automatically wrapped:

  • ls -laddev exec --dir="/var/www/html" bash -c "ls -la"
  • npm installddev exec --dir="/var/www/html" bash -c "npm install"

Path Cleaning

Host paths in commands are automatically converted to container-compatible paths before wrapping with ddev exec:

InputOutputNotes
mkdir /Users/foo/project/srcddev exec ... "mkdir src"Current dir path → relative
cd /Users/foo/project && lsddev exec ... "ls"Redundant cd removed
cat /Users/foo/project/themes/style.cssddev exec ... "cat /var/www/html/themes/style.css"Other paths → container paths

DDEV Availability Check

The plugin checks DDEV status using ddev describe -j to determine if a project exists and whether it's running. Results are cached for 2 minutes when DDEV is running to avoid repeated checks. Stopped or unavailable states are not cached and will be re-checked on every bash command to detect when DDEV starts.

Bash tool commands that run on host (not wrapped):

  • git
  • gh
  • docker
  • ddev

Custom Tools

The plugin provides custom tools that are registered when a DDEV project is detected:

ddev_logs Tool

Retrieve logs from DDEV services for debugging and monitoring.

Arguments:

  • service (optional): Service to get logs from (e.g., 'web', 'db'). Defaults to 'web'.
  • follow (optional): Follow logs in real-time (stream as they appear). Cannot be used with tail.
  • tail (optional): Number of lines to show from the end of logs. Defaults to 50 lines if not specified. Mutually exclusive with follow.
  • time (optional): Add timestamps to log output.

Default Behavior:

  • When neither follow nor tail is specified, returns the last 50 lines to prevent context pollution.
  • The 50-line default is conservative to keep responses concise while providing sufficient debugging context.

Examples:

// Get last 50 lines from web service (default)
ddev_logs()

// Get last 100 lines from database service
ddev_logs({ service: "db", tail: 100 })

// Follow web service logs in real-time with timestamps
ddev_logs({ follow: true, time: true })

Keywords

opencode

FAQs

Package last updated on 04 Dec 2025

Related posts