Add docker model code command for AI-powered code editing with aider#40
Draft
Add docker model code command for AI-powered code editing with aider#40
docker model code command for AI-powered code editing with aider#40Conversation
Copilot
AI
changed the title
[WIP] Add docker model code command for GitHub repos
Add Oct 18, 2025
docker model code command for AI-powered code editing with aider
First implemented with aider integration Signed-off-by: Eric Curtin <eric.curtin@docker.com>
c290d8f to
f416c1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a new
docker model codecommand that integrates AI-powered code editing into Docker Model Runner by running aider in an ephemeral Docker container. This enables developers to edit code with AI assistance while maintaining a clean, isolated environment that talks directly to Docker Model Runner.Features
Git-like Workflow
The command behaves similarly to
git commit, requiring execution from within a Git repository. When no prompt is provided, it opens your configured text editor (EDITOR/VISUAL, defaulting to vim) to compose a detailed prompt:Ephemeral Container Execution
Uses
docker run --rmto run aider in a disposable container with:/workspaceIntelligent Environment Detection
Automatically detects and configures the appropriate Model Runner endpoint:
model-runner.docker.internalDNSMODEL_RUNNER_HOSTenvironment variableUsage Examples
Implementation Details
The command:
Files Changed
cmd/cli/commands/code.go(276 lines): Main implementation with editor integration, container execution, and URL detectioncmd/cli/commands/code_test.go(226 lines): Comprehensive unit tests covering command validation, flags, editor integration, and helper functionscmd/cli/commands/root.go(1 line): Command registrationTesting
Command Line Interface
Future Enhancements
This initial implementation provides a solid foundation that could be extended with:
Closes #[issue-number]
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.