Repository navigation
feat: add compose pull command - #598
Veer Jain (veerjain-1) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Docker Compose “pull” command to the Container Tools extension, integrating it into the existing command-template system and command registration flow.
Changes:
- Extends compose command template selection to support a new
pullvariant (composePulltemplate). - Adds a new
vscode-containers.compose.pullcommand implementation and registers it with the extension. - Contributes the new command, menu entry, and configuration schema/NLS strings in the extension manifest.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/vscode-containers/src/commands/selectCommandTemplate.ts | Adds composePull template type and maps pull to that template. |
| extensions/vscode-containers/src/commands/registerCommands.ts | Registers the new vscode-containers.compose.pull command. |
| extensions/vscode-containers/src/commands/compose/compose.ts | Implements composePull and extends internal compose command routing to include pull. |
| extensions/vscode-containers/package.nls.json | Adds NLS strings for the new compose pull template setting and command title. |
| extensions/vscode-containers/package.json | Contributes activation, menus, configuration for compose pull, and the command definition. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "items": { | ||
| "type": "object", | ||
| "properties": { | ||
| "template": { | ||
| "type": "string", | ||
| "description": "%vscode-containers.config.template.composePull.template%" | ||
| }, | ||
| "label": { | ||
| "type": "string", | ||
| "description": "%vscode-containers.config.template.composePull.label%" | ||
| }, | ||
| "match": { | ||
| "type": "string", | ||
| "description": "%vscode-containers.config.template.composePull.match%" | ||
| } | ||
| } | ||
| }, |
| { | ||
| "command": "vscode-containers.compose.pull", | ||
| "title": "%vscode-containers.commands.composePull%", | ||
| "category": "%vscode-containers.commands.category.docker%" | ||
| }, |
There was a problem hiding this comment.
I agree
| { | ||
| "command": "vscode-containers.compose.pull", | ||
| "when": "isWorkspaceTrusted && resourceLangId == dockercompose", | ||
| "group": "composeGroup_1_general@1_5" |
There was a problem hiding this comment.
Also agree
| "vscode-containers.config.template.composePull.label": "The label displayed to the user.", | ||
| "vscode-containers.config.template.composePull.match": "The regular expression for choosing the right template. Checked against compose YAML files, folder name, etc.", | ||
| "vscode-containers.config.template.composePull.description": "Command templates for compose pull commands.", | ||
| "vscode-containers.commands.composePull": "Compose Pull" |
|
Hi team! Friendly ping on this. Please let me know if there's anything I can do to help move this along or if you have any feedback. |
|
Hi team, just bumping this again! Happy to make any changes if needed. |
|
Hey there, we appreciate the contribution! We are currently heads down on some unrelated feature work so it will take some time for us to get back to you. Don't worry though, we'll get to it once things settle down! |
| { | ||
| "command": "vscode-containers.compose.pull", | ||
| "title": "%vscode-containers.commands.composePull%", | ||
| "category": "%vscode-containers.commands.category.docker%" | ||
| }, |
There was a problem hiding this comment.
I agree
| { | ||
| "command": "vscode-containers.compose.pull", | ||
| "when": "isWorkspaceTrusted && resourceLangId == dockercompose", | ||
| "group": "composeGroup_1_general@1_5" |
There was a problem hiding this comment.
Also agree
| "%vscode-containers.config.containers.orchestratorClient.finchCompose%" | ||
| ] | ||
| }, | ||
| "containers.commands.composePull": { |
There was a problem hiding this comment.
Also missing from this in addtion to copilot comment below:
-The oneOf string alternative is dropped, but toCommandTemplateArray explicitly accepts a plain string ( selectCommandTemplate.ts:293–296 ), so a config that works at runtime gets flagged as invalid.
-"tags": ["advanced"] is missing, so this setting surfaces in ordinary settings search unlike its siblings.
-"scope": "machine-overridable" isn't used by any other command-template settin
| }, | ||
| "homepage": "https://github.com/microsoft/vscode-containers/blob/main/extensions/vscode-containers/README.md", | ||
| "activationEvents": [ | ||
| "onCommand:vscode-containers.compose.pull", |
There was a problem hiding this comment.
The existing activationEvents array has no onCommand: entries, and with engines.vscode: ^1.109.0 VS Code generates activation events implicitly for contributed commands (since 1.74). This line can be dropped.
| "when": "never" | ||
| } | ||
| ], | ||
| "editor/context": [ |
There was a problem hiding this comment.
All five compose commands are contributed to editor/context with editorLangId == dockercompose as well as explorer/context. Pull was only added to the latter, so right-clicking inside an open compose file won't offer it. Worth adding the matching entry with "group": "containers".
| } | ||
|
|
||
| export async function selectComposeCommand(context: IActionContext, folder: vscode.WorkspaceFolder, composeCommand: 'up' | 'down' | 'upSubset' | 'downSubset', configurationFile?: string, detached?: boolean, build?: boolean): Promise<VoidCommandResponse> { | ||
| export async function selectComposeCommand(context: IActionContext, folder: vscode.WorkspaceFolder, composeCommand: 'up' | 'down' | 'upSubset' | 'downSubset' | 'pull', configurationFile?: string, detached?: boolean, build?: boolean): Promise<VoidCommandResponse> { |
There was a problem hiding this comment.
Could we get a test for the new mapping? selectCommandTemplate.test.ts already has the harness for this, and a test here would have caught the manifest issues too.
| "zod": "catalog:" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Both package.json / package.nls.json lost their trailing newline ( \ No newline at end of file in the diff). Could you restore it? It adds unrelated churn to the last line.
| "%vscode-containers.config.containers.orchestratorClient.finchCompose%" | ||
| ] | ||
| }, | ||
| "containers.commands.composePull": { |
There was a problem hiding this comment.
Setting placement. The new property sits at package.json:2633, next to containers.orchestratorClient, rather than with the five containers.commands.compose* properties at 1823–2023. Could you move it.
| registerWorkspaceCommand('vscode-containers.compose.up', composeUp); | ||
| registerWorkspaceCommand('vscode-containers.compose.up.subset', composeUpSubset); | ||
| registerWorkspaceCommand('vscode-containers.compose.down.subset', composeDownSubset); | ||
| registerWorkspaceCommand('vscode-containers.compose.pull', composePull); |
There was a problem hiding this comment.
Since we're adding compose pull, can we also wire it up for the compose group tree item? The group currently has logs/start/stop/restart/down (registered just below at 147–151), and pull is arguably most useful there — on a project you already have running.
|
Also fill out the PR description. |
|
Hi there! Just a gentle ping to check in on this. Let me know if there's anything else needed from my side to move this forward! |
|
Patrick Verbrugge (@patverb) Added the PR description above — explains the gap this fills, what each file change does, and how it was manually verified. Let me know if you'd like a unit test added, happy to follow whatever harness is preferred for the compose command handlers. |
|
Hi Patrick Verbrugge (@patverb) — thanks for the thorough review! I've pushed a follow-up commit addressing all the points raised: Manifest fixes (package.json)
NLS fixes (package.nls.json)
Compose group tree item (registerCommands.ts + composeGroup.ts)
Let me know if a unit test for the |
5c61900 to
cad154d
Compare
…lean manifest formatting
cad154d to
b22428f
Compare
|
Hi Patrick Verbrugge (@patverb) — updated!
Ready for another look whenever you have time! |
Problem
The Container Tools extension exposes compose
up,down, andrestartcommands (both from the command palette and the right-click context menu on adocker-compose.ymlfile), but there is no way to runcompose pullthrough the extension. Users have to drop to a terminal to pull the latest images for a compose project.What this adds
A new
vscode-containers.compose.pullcommand, following the exact same pattern as the existingcomposeUp/composeDown/composeRestartcommands:src/commands/compose/compose.ts: newcomposePullfunction, extends the sharedcompose()helper's command union type with'pull'.src/commands/registerCommands.ts: registers the new command.src/commands/selectCommandTemplate.ts: wirespullinto the command-template selection so it respects the configured orchestrator client (docker compose / podman compose / nerdctl compose / finch compose).package.json: adds the command contribution, a right-click context menu entry on compose files (same visibility conditions as the other compose commands:isWorkspaceTrusted && resourceLangId == dockercompose), and acontainers.commands.composePullconfiguration point (mirrorscomposeUp/composeDown) so users can override the pull command template, same as they can for the other compose actions.package.nls.json: localization strings for the new command and config description.Why it matters
Pull is one of the most common compose operations (refreshing images before
up, pulling in CI-adjacent local workflows, etc.) and every other core compose action already has a command + context-menu entry. This closes that gap using the existing extension points rather than introducing a new pattern.Testing
Manually verified in the Extension Development Host:
docker-compose.ymlfile shows "Compose Pull" in the context menu, respecting workspace-trust gating.containers.commands.composePulltemplate is honored (tested against docker compose; template substitution follows the same${composeCommand}/${configurationFile}pattern as the existing commands).No automated test coverage added — the existing compose commands (
up/down/restart) do not have unit tests either; this follows the same convention. Happy to add one if there's a preferred harness for these command handlers.