Feat/hook ca command to aks tree#1942
Conversation
Hook "Run Container Assist (Preview)" into the CloudExplorer cluster context menu so users can launch Container Assist directly from a cluster node. Subscription and cluster are pre-filled from the tree context — only ACR, namespace, and workflow name are prompted. Changes: - Add `aks.runContainerAssistFromTree` command and menu entries in package.json (view/item/context, developDeploySubMenu, commandPalette) - Add `runContainerAssistFromTree()` handler that resolves cluster info from the tree node via `getAksClusterTreeNode()` - Add `pickWorkspaceFolder()` helper for tree-invoked flows - Add `collectAzureContextFromTree()` in azureSelections.ts that skips subscription and cluster prompts - Register new command in extension.ts - Gated behind `aks.containerAssistEnabledPreview` setting Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
…entry - Add "(Preview)" suffix to all Container Assist and OIDC command titles: - AKS: Run Container Assist For AKS Deployment Generation (Preview) - AKS: Run Container Assist (Preview) - AKS: Setup OIDC for GitHub Actions (Preview) - AKS: Set GitHub Actions Secrets (Preview) - Move Container Assist to 2_workspace group in explorer context menu so it appears near "Add Folder to Chat" instead of at the bottom Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
There was a problem hiding this comment.
Pull request overview
This PR hooks the existing Container Assist feature into the AKS cluster tree (CloudExplorer), allowing users to right-click an AKS cluster node and launch Container Assist without being re-prompted for subscription and cluster information already available from the tree context. It also adds (Preview) labels to all Container Assist and OIDC commands, and repositions the explorer context menu entry.
Changes:
- Added a new
runContainerAssistFromTreecommand that extracts cluster context from the AKS tree node and skips subscription/cluster prompts, delegating to a newcollectAzureContextFromTreefunction inazureSelections.ts - Registered the new command in
extension.tsand added menu/palette entries inpackage.json, including tree context menu placements for both normal and simplified menu structures - Updated
(Preview)labels on all Container Assist and OIDC-related commands, and moved theaks.runContainerAssistexplorer context menu entry to group2_workspace@10
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/commands/aksContainerAssist/aksContainerAssist.ts |
Adds runContainerAssistFromTree() entry point and pickWorkspaceFolder() helper |
src/commands/aksContainerAssist/azureSelections.ts |
Adds collectAzureContextFromTree() that skips subscription/cluster prompts when these are already known from the tree |
src/extension.ts |
Imports and registers the new runContainerAssistFromTree command with telemetry |
package.json |
Adds command definition, updates (Preview) titles, adds menu entries (context menu + submenu + command palette), and repositions the existing explorer context menu entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Hide runContainerAssistFromTree from command palette (when: "never") since it requires a tree node context and would show a confusing error - Extract shared action logic into executeContainerAssistActions() helper to eliminate duplication between runContainerAssist and runContainerAssistFromTree (steps: QuickPick, model picker, Azure context collection, action processing, post-generation) - Add test coverage for runContainerAssistFromTree: invalid target, missing workspace folder, and disabled feature flag Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
| { | ||
| "command": "aks.runContainerAssistFromTree", | ||
| "group": "1_developer@2", | ||
| "when": "config.aks.containerAssistEnabledPreview && workspaceFolderCount >= 1" |
There was a problem hiding this comment.
For the cmd palette option, maybe we should use the runContainerAssist function since the sub/cluster info might not be available to runContainerAssistFromTree when launching from the cmd palette
Hook Container Assist to AKS Cluster Tree
This PR takes care of #1941 , it adds a Run Container Assist command directly to the AKS cluster tree node in CloudExplorer, so users can right-click a cluster and launch Container Assist without being re-prompted for subscription and cluster information that's already available from the tree context. Also adds
(Preview)labels to all Container Assist and OIDC commands, and repositions the explorer context menu entry.Changes
1. New tree-aware Container Assist command (
aks.runContainerAssistFromTree)aksContainerAssist.ts — Added
runContainerAssistFromTree()entry point that:AksClusterTreeNodefrom the command target viagetAksClusterTreeNode()subscriptionId,resourceGroupName, andclusterNamefrom the tree nodecollectAzureContextFromTree()for remaining prompts (ACR, namespace, workflow name)processContainerAssistAction()pipelineazureSelections.ts — Added
collectAzureContextFromTree()that:subscriptionId,clusterName, andclusterResourceGroupClusterobject directly, skipping the subscription and cluster picker UXselectClusterAcr/selectAcrfallback), namespace, and workflow nameextension.ts — Registered the new command with telemetry tracking
package.json — Added command definition and menu contributions:
view/item/contextgroup8@2— appears in the AKS cluster right-click menuaks.developDeploySubMenugroup1_developer@2— appears in the simplified menu's Develop & Deploy submenucommandPalette— gated bycontainerAssistEnabledPreviewfeature flag andworkspaceFolderCount >= 12.
(Preview)labels on all Container Assist / OIDC commandsUpdated command titles in package.json:
AKS: Run Container Assist For AKS Deployment Generation→… (Preview)AKS: Run Container Assist→… (Preview)AKS: Setup OIDC for GitHub Actions→… (Preview)AKS: Set GitHub Actions Secrets→… (Preview)3. Repositioned explorer context menu entry
Moved the existing
aks.runContainerAssistentry inexplorer/contextfrom the bottom of the menu to group2_workspace@10, positioning it near standard workspace actions like "Add Folder to Chat".Testing
npx tsc --noEmit— zero errors)Thanks ❤️ and cc & FYI: @tejhan, @bosesuneha , @davidgamero , @gambtho