-
Notifications
You must be signed in to change notification settings - Fork 10
refactor(build-image): convert to context-providing tool #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor(build-image): convert to context-providing tool #571
Conversation
5a5331d to
6c4009f
Compare
BREAKING CHANGE: build-image tool is renamed to build-image-context The tool no longer executes Docker builds directly. Instead, it: - Analyzes the build context and Dockerfile - Returns build commands for agents to execute - Removes buildkit-decoder.ts and progress.ts (no longer needed) - Sets isReadOnly: true since it only provides context This enables agents to have full control over build execution and allows the tool to work in environments without Docker daemon access.
Updates all references from build-image to build-image-context: - Exports: buildImageContext, buildImageContextTool, buildImageContextMetadata - TOOL_NAME enum: BUILD_IMAGE_CONTEXT - SDK schemas: buildImageContextJsonSchema - MCP server, formatters, chain hints, CLI help - All test files (unit, integration, e2e) - CI workflow file - Telemetry utils and smoke tests
Updates all documentation references: - README.md: SDK examples and tool table - ADRs: 001, 002, 005, 006, 007 - Integration guides: VS Code extension, examples - Policy usage guide - Integration test README
6c4009f to
471179c
Compare
There was a problem hiding this 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 converts build-image from an execution-based tool to a context-providing tool that analyzes Dockerfiles and returns structured build guidance for agents to execute.
Changes:
- Renamed tool from
build-imagetobuild-image-contextand updated all references - Tool now returns
BuildImageResultwith security analysis, BuildKit features, Dockerfile analysis, and generated docker build commands instead of executing builds - Removed Docker client's
buildImage()method and related build execution code (BuildKit decoder, progress tracker) - Updated all tests to use new tool name and execute build commands themselves
Reviewed changes
Copilot reviewed 58 out of 58 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/tools/standardized-logging.test.ts | Updated tool name from build-image to build-image-context in test arrays |
| test/unit/telemetry-wrapper.test.ts | Updated all references to use buildImageContextTool instead of buildImageTool |
| test/unit/sdk/vscode-integration.test.ts | Updated tool name and metadata expectations for context-providing behavior |
| test/unit/sdk/schemas.test.ts | Updated schema tests to use buildImageContext and validate platform parameter |
| test/unit/sdk/index.test.ts | Updated SDK exports to use buildImageContext function name |
| test/unit/mcp/mcp-server.test.ts | Updated formatter tests for new build context result structure |
| test/unit/mcp/formatters/natural-language-formatters.test.ts | Updated test fixtures to match new BuildImageResult schema with context preparation |
| test/unit/lib/telemetry-utils.test.ts | Updated telemetry tool name to build-image-context |
| test/unit/infrastructure/docker/client.test.ts | Removed build-related tests, added tests for new operations like ping and removeImage |
| test/unit/infra/docker/progress.test.ts | Deleted file - progress tracking removed as builds are now executed by agents |
| test/unit/infra/docker/buildkit-decoder.test.ts | Deleted file - BuildKit decoding removed as builds are now executed by agents |
| test/unit/error-scenarios/validation-errors.test.ts | Updated to use buildImageContext and added platform parameter |
| test/unit/error-scenarios/docker-errors.test.ts | Refactored to test context preparation errors instead of build execution errors |
| test/unit/error-scenarios.test.ts | Updated tool references and added platform parameter |
| test/integration/workflows/docker-workflow.test.ts | Updated to prepare context then execute build commands with execSync |
| test/integration/workflows/containerization-workflow.test.ts | Updated to validate context preparation and execute builds separately |
| test/integration/workflows/complete-journey.test.ts | Updated to prepare context then execute build commands |
| test/integration/infrastructure/docker/client-error-handling.test.ts | Removed build tests, focused on image operations error handling |
| test/integration/error-recovery.test.ts | Updated to test context preparation recovery instead of build execution |
| test/integration/README.md | Updated workflow descriptions to reference build-image-context |
| test/support/utilities/mock-factories.ts | Removed createMockDockerBuildResult and updated mock clients |
| src/tools/ops/tool.ts | Updated comment to reference build-image-context instead of build-image |
| src/tools/index.ts | Renamed tool export from buildImageTool to buildImageContextTool |
| src/tools/fix-dockerfile/tool.ts | Updated chain hint to reference build-image-context |
| src/tools/build-image/tool.ts | Deleted file - replaced by build-image-context tool |
| src/tools/build-image/schema.ts | Deleted file - replaced by build-image-context schema |
| src/tools/build-image-context/tool.ts | New file implementing context preparation with security and BuildKit analysis |
| src/tools/build-image-context/schema.ts | New schema defining context preparation parameters and results |
| src/sdk/types.ts | Updated type exports to reference build-image-context schema |
| src/sdk/schemas.ts | Renamed schema export from buildImageJsonSchema to buildImageContextJsonSchema |
| src/sdk/metadata.ts | Updated metadata for context-providing tool with read-only confirmation |
| src/sdk/index.ts | Updated SDK function export from buildImage to buildImageContext |
| src/sdk/formatters.ts | Updated formatter to display context analysis instead of build results |
| src/mcp/mcp-server.ts | Updated type guard for new BuildImageResult structure |
| src/mcp/formatters/natural-language-formatters.ts | Updated formatter for context preparation with security warnings and build commands |
| src/lib/telemetry-utils.ts | Updated telemetry extraction for build-image-context tool |
| src/infra/docker/progress.ts | Deleted file - progress tracking no longer needed |
| src/infra/docker/client.ts | Removed buildImage method and related types from Docker client |
| src/infra/docker/buildkit-decoder.ts | Deleted file - BuildKit decoding no longer needed |
| src/index.ts | Updated tool export comments to reference build-image-context |
| src/cli/cli.ts | Updated CLI help text to show build-image-context |
| src/app/chain-hints.ts | Updated chain hints to reference build-image-context |
| scripts/validate-public-api.ts | Updated public API validation for renamed tool |
| scripts/smoke-journey.ts | Updated smoke test to use build-image-context |
| scripts/integration-test-complete-workflow.ts | Updated workflow to prepare context and execute builds |
| scripts/integration-test-build-image.ts | Refactored to test context preparation without executing builds |
| docs/guides/vscode-extension-integration.md | Updated documentation and examples for context-providing tool |
| docs/guides/policy-example/PLATFORM_AND_TAG_POLICY_USAGE.md | Updated references to build-image-context |
| docs/examples/README.md | Updated examples to show context preparation usage |
| docs/adr/007-sdk-decoupling.md | Updated ADR examples to use buildImageContext |
| docs/adr/006-infrastructure-organization.md | Updated architecture examples for context-providing tool |
| docs/adr/005-mcp-integration.md | Updated workflow description to reference build-image-context |
| docs/adr/002-tool-interface.md | Updated tool interface examples |
| docs/adr/001-result-pattern.md | Updated Result pattern examples |
| README.md | Updated SDK usage examples for context-providing behavior |
| .github/workflows/individual-tool-integration-tests.yml | Updated workflow to test context preparation instead of builds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 58 out of 58 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 58 out of 58 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Convert build-image from an execution-based tool to a context-providing tool that analyzes Dockerfiles and returns structured guidance for agents to execute builds.
Changes:
The agent now receives rich context about the Dockerfile and can execute the provided build command with proper environment variables.