Skip to content

Conversation

@JUVOJustin
Copy link
Owner

This pull request introduces a new tool for accessing DDEV project information and refactors how DDEV environment data is handled in the plugin. The main focus is on modularizing the logic for fetching and parsing DDEV project details, exposing a new ddev_describe tool, and improving session notifications. It also updates dependencies to newer versions.

DDEV project info extraction and tool integration:

  • Added a new describe.ts module that defines types for DDEV describe output, provides functions to fetch and extract simplified project info, and exposes a createDdevDescribeTool for use in the plugin.
  • Integrated the new ddev_describe tool into the plugin, making it available alongside the existing ddev_logs tool.

Refactoring and code cleanup:

  • Refactored DDEV describe data fetching in index.ts to use the new getDdevDescribeData function from describe.ts, removing redundant parsing logic and type definitions. [1] [2] [3]
  • Improved session notification messages to reference the new ddev_describe tool and clarify environment variable locations.

Dependency updates:

  • Updated @opencode-ai/plugin, @opencode-ai/sdk, and @types/node to newer versions in package.json for compatibility and improvements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new ddev_describe tool to provide structured access to DDEV project information, refactors DDEV data fetching logic into a dedicated module, and updates dependencies. The changes improve code organization by separating concerns and make DDEV project information more accessible to LLMs through a dedicated tool.

  • Added a new describe.ts module that encapsulates DDEV project information fetching, parsing, and tool creation
  • Refactored index.ts to use the new getDdevDescribeData function, reducing code duplication
  • Updated session notification messages to reference the new ddev_describe tool and clarify environment variable locations

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
describe.ts New module defining types, data fetching functions, and the ddev_describe tool for accessing DDEV project information (domain, ports, status, etc.)
index.ts Refactored to use the new getDdevDescribeData function, integrated the ddev_describe tool, added 'curl' to HOST_ONLY_COMMANDS, and improved session notification messages
package.json Updated dependency versions: @opencode-ai/plugin to ^1.0.188, @opencode-ai/sdk to ^1.0.188, and @types/node to ^25.0.3
package-lock.json Updated lockfile entries to match the new dependency versions in package.json

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +167 to +171
for (const field of requestedFields) {
if (field in info) {
const value = info[field as keyof DdevProjectInfo];
result[field as keyof DdevProjectInfo] = value as any;
}
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field filtering logic doesn't validate if requested fields are valid. If a user passes an invalid field name that doesn't exist in DdevProjectInfo (e.g., a typo), it will silently be ignored. Consider adding validation to warn users about invalid field names or throw an error listing valid options.

Copilot uses AI. Check for mistakes.
const raw = await getDdevDescribeData($);

if (!raw) {
throw new Error('Failed to get DDEV project data. Make sure DDEV is running.');
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message states "Make sure DDEV is running" but DDEV might be stopped, not installed, or the project might not be configured. Consider making the error message more accurate, such as "Failed to get DDEV project data. Ensure DDEV is installed, a project is configured, and DDEV is running."

Suggested change
throw new Error('Failed to get DDEV project data. Make sure DDEV is running.');
throw new Error('Failed to get DDEV project data. Ensure DDEV is installed, a project is configured, and DDEV is running.');

Copilot uses AI. Check for mistakes.
/**
* Notifies LLM about DDEV environment on first command execution
*
* @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing space in the @link tag could cause documentation rendering issues. Remove the trailing space after the URL.

Suggested change
* @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services
* @link https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services

Copilot uses AI. Check for mistakes.
Comment on lines 17 to +20
/**
* Raw DDEV project data from `ddev describe -j`
*/
type DdevRawData = {
shortroot?: string;
approot?: string;
status?: string;
name?: string;
[key: string]: unknown;
};
type DdevRawData = DdevDescribeRaw;
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type alias DdevRawData is redundant. Since it's just aliasing DdevDescribeRaw without adding any additional semantics, consider removing it and using DdevDescribeRaw directly throughout the code. This reduces indirection and makes the code easier to follow.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants