Skip to content

feat: add compose pull command - #598

Open
Veer Jain (veerjain-1) wants to merge 2 commits into
microsoft:mainfrom
veerjain-1:feat/add-compose-pull
Open

Veer Jain (veerjain-1) wants to merge 2 commits into
microsoft:mainfrom
veerjain-1:feat/add-compose-pull

Conversation

@veerjain-1

@veerjain-1 Veer Jain (veerjain-1) commented Aug 30, 2026 •

Copy link
Copy Markdown

Problem

The Container Tools extension exposes compose up, down, and restart commands (both from the command palette and the right-click context menu on a docker-compose.yml file), but there is no way to run compose pull through 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.pull command, following the exact same pattern as the existing composeUp/composeDown/composeRestart commands:

  • src/commands/compose/compose.ts: new composePull function, extends the shared compose() helper's command union type with 'pull'.
  • src/commands/registerCommands.ts: registers the new command.
  • src/commands/selectCommandTemplate.ts: wires pull into 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 a containers.commands.composePull configuration point (mirrors composeUp/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:

  • Command appears in the Command Palette and runs against a workspace's compose file.
  • Right-click on a docker-compose.yml file shows "Compose Pull" in the context menu, respecting workspace-trust gating.
  • Confirmed the configured containers.commands.composePull template 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.

Copilot AI lite review requested due to automatic review settings August 30, 2026 18:29
@veerjain-1
Veer Jain (veerjain-1) requested a review from a team as a code owner August 30, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 pull variant (composePull template).
  • Adds a new vscode-containers.compose.pull command 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.

Comment on lines +2636 to +2652
"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%"
}
}
},
Comment on lines +2670 to +2674
{
"command": "vscode-containers.compose.pull",
"title": "%vscode-containers.commands.composePull%",
"category": "%vscode-containers.commands.category.docker%"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree

{
"command": "vscode-containers.compose.pull",
"when": "isWorkspaceTrusted && resourceLangId == dockercompose",
"group": "composeGroup_1_general@1_5"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"
@veerjain-1

Copy link
Copy Markdown
Author

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.

@veerjain-1

Copy link
Copy Markdown
Author

Hi team, just bumping this again! Happy to make any changes if needed.

@fiveisprime

Copy link
Copy Markdown
Member

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!

Comment on lines +2670 to +2674
{
"command": "vscode-containers.compose.pull",
"title": "%vscode-containers.commands.composePull%",
"category": "%vscode-containers.commands.category.docker%"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree

{
"command": "vscode-containers.compose.pull",
"when": "isWorkspaceTrusted && resourceLangId == dockercompose",
"group": "composeGroup_1_general@1_5"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also agree

"%vscode-containers.config.containers.orchestratorClient.finchCompose%"
]
},
"containers.commands.composePull": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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": [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:"
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@patverb

Copy link
Copy Markdown
Contributor

Also fill out the PR description.

@veerjain-1

Copy link
Copy Markdown
Author

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!

@veerjain-1

Copy link
Copy Markdown
Author

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.

@veerjain-1

Copy link
Copy Markdown
Author

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)

  • Removed the stale onCommand:vscode-containers.compose.pull activation event (implicit since VS Code 1.74)
  • Fixed command category: docker → containersGeneric (consistent with all other compose commands)
  • Fixed explorer/context menu group: composeGroup_1_general@1_5 → containers (matches siblings)
  • Added the missing editor/context menu entry (editorLangId == dockercompose, group: containers)
  • Renamed config key containers.commands.composePull → containers.commands.compose.pull and moved it next to the other containers.commands.compose.* settings
  • Added required: ["label", "template"] to the item schema so invalid objects are rejected
  • Added oneOf string alternative to match what toCommandTemplateArray accepts at runtime
  • Added tags: ["advanced"] and scope: "machine-overridable" to match siblings

NLS fixes (package.nls.json)

  • Renamed vscode-containers.commands.composePull → vscode-containers.commands.compose.pull (dotted pattern)
  • Renamed all config.template.composePull.* keys to config.template.compose.pull.*
  • Restored trailing newlines in both files

Compose group tree item (registerCommands.ts + composeGroup.ts)

  • Added composeGroupPull handler (mirrors composeGroupLogs pattern: resolves working dir, calls selectComposeCommand(context, folder, 'pull', ...))
  • Registered as vscode-containers.containers.composeGroup.pull
  • Contributed to view/item/context menu with the same when clause and group as composeGroup.down

Let me know if a unit test for the selectCommandTemplate mapping would seal it — happy to add one using the existing selectCommandTemplate.test.ts harness.

@veerjain-1

Copy link
Copy Markdown
Author

Hi Patrick Verbrugge (@patverb) — updated!

  1. Unit tests added: Added tests in selectCommandTemplate.test.ts verifying that selectComposeCommand with 'pull' correctly maps to the composePull template and command line structure for both Compose V2 (docker compose) and Compose V1 (docker-compose), as well as supporting vscode.Uri project folders. All 214 unit tests pass.
  2. Clean manifest formatting restored: Fixed the accidental 2-space indentation churn in package.json and package.nls.json, restoring 4 spaces and trailing newlines. The diff against main is now clean and minimal (~180 lines across 7 files).
  3. Setting schema & placement: Kept containers.commands.composePull aligned with the runtime lookup (commands.${command}), placed alongside the other five compose command template settings, with oneOf string support, required: ["label", "template"], and tags: ["advanced"].
  4. Command & Tree Wiring: Both vscode-containers.compose.pull (palette, editor context, explorer context) and vscode-containers.containers.composeGroup.pull (compose group tree item) are cleanly wired, typed, and registered without side effects on sibling commands.

Ready for another look whenever you have time!

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.

4 participants