Kickstart enhancements#2144
Open
bosesuneha wants to merge 4 commits into
Open
Conversation
The kickstart terminal helper was invoking the language model tool as
"runInTerminal" with a {command, cwd} payload, but the actual tool
registered by the Copilot extension is "run_in_terminal" and accepts
{command, explanation, goal, mode} (no cwd parameter).
- Use the correct tool name.
- Probe vscode.lm.tools first and surface a clear message when the tool
is unavailable (e.g. when Kickstart is run outside agent mode).
- Prepend a `cd <cwd> && ...` to the command since the tool runs in the
current shell cwd.
When Kickstart runs in vscode.dev / Azure Portal Cloud Shell, the workspace already has a Cloud-Shell-backed folder (azure-XXX). Cloning samples into the OS temp dir was placing them on the wrong filesystem, so subsequent operations couldn't see the cloned files. - useSample() now accepts an optional parentPath, defaulting to the previous temp root for backward compatibility. - registerKickstartCommands.useSample passes the first open workspace folder as the clone parent when one exists. Falls back to the temp root and adds the clone as a workspace folder so the chat handler can still pick up pendingSamplePath.
… manifests Previously Kickstart assumed a single root `Dockerfile` and a single `k8s/` folder, so monorepos with multiple modules would have each module overwrite the previous one's staged files, and only the last module's image would be built. Staging: - Add `moduleStagePrefix(module, projectPath)` helper. - Stage per-module artifacts at `<moduleRel>/Dockerfile` and `<moduleRel>/k8s/<file>` (forward-slash, workspace-relative). - Single-module / root-module projects keep the previous flat layout. File detection: - ExistingFilesCheckResult exposes `dockerfilePaths: string[]` (was a single `dockerfilePath`); analyze surfaces all detected Dockerfiles. - AnalysisData carries `existingDockerfilePaths` / `existingK8sManifestPaths` for downstream phases. - prepare.ts adds `isDockerfileFilename`, `isManifestFilename`, `manifestBaseFilename` to handle both flat and prefixed names. Build phase: - Iterates one build target per Dockerfile, sanitizing image names with a module-derived suffix. - Always uses the workspace as build context so Dockerfiles can reference source files there; passes `--file` for staged Dockerfiles. - Adds `--subscription` to az acr commands for correctness when the CLI is logged into a different default subscription. Deploy phase: - Collects every `<module>/k8s/` directory from staged files and applies them all with multiple `-f` flags in a single kubectl call. Chat rendering: - Replace the hardcoded flat/k8s file tree with a generic `buildNestedFileTree()` (used in orchestrator and prepare) so nested module paths render correctly. SDK call: - Resolve `modulePath` to an absolute path before passing to the containerization SDK to avoid path-resolution ambiguity. Tests updated for the renamed `dockerfilePaths` field.
…ad of overwriting When a workspace already contains a Dockerfile or Kubernetes manifests, Kickstart now reads them and asks the language model to preserve the user's existing structure (base image family, build stages, custom RUN/COPY/ENV, metadata, env vars, volumes, probes, etc.) while only improving missing best-practice bits (multi-stage builds, non-root user, HEALTHCHECK, securityContext, resources, image references, etc.). Plumbing: - New `DockerfileEnhancementInput` and `ExistingManifestInput` types carried from prepare.ts into the dockerfile/manifests steps. - prepare.ts reads existing files via Map<modulePath, …> using a longest- prefix module match (`pickModuleForRelDir`) so each module's enhancement only sees its own existing files in monorepos. - A user-visible "Enhancing N existing Dockerfile(s) / manifest(s)" message is streamed when applicable. Prompts: - DOCKERFILE_SYSTEM_PROMPT and K8S_MANIFEST_SYSTEM_PROMPT each gain an ENHANCEMENT MODE section telling the model what to preserve vs. improve, and to return the COMPLETE updated artifact (not a diff). - `buildDockerfileUserPrompt` accepts an optional override and `buildK8sManifestUserPrompt` accepts an optional list of existing manifests, each appended as guidance to the user prompt.
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.
fix(kickstart): correct run_in_terminal tool invocation — was calling "runInTerminal" with {command, cwd}; the real tool is "run_in_terminal" with {command, explanation, goal, mode} (no cwd). Probe vscode.lm.tools first and prepend cd && to the command.
feat(kickstart): clone sample repos into existing workspace folder — in vscode.dev / Cloud Shell, samples must land on the Cloud-Shell-backed folder, not os.tmpdir(). useSample() now takes an optional parentPath and the command passes the open workspace folder when one exists.
feat(kickstart): support monorepos with per-module Dockerfile and k8s manifests
Stage per-module at /Dockerfile and /k8s/ via a new moduleStagePrefix() helper; single-module projects keep the flat layout.
ExistingFilesCheckResult.dockerfilePaths: string[] (was a single path); AnalysisData carries existing Dockerfile / manifest paths.
Build phase: one target per Dockerfile with sanitized image names, workspace as build context, --file for staged Dockerfiles, --subscription on az acr calls.
Deploy phase: collects every /k8s/ dir and applies them all with multiple -f flags in one kubectl apply.
Generic buildNestedFileTree() for chat file-tree rendering of nested paths.
Resolve modulePath to absolute before SDK calls. Tests updated.
feat(kickstart): enhance existing Dockerfiles and k8s manifests instead of overwriting
prepare.ts reads existing files into Map<modulePath, …> via longest-prefix match (pickModuleForRelDir) so each module only sees its own.
Streams a "🔄 Enhancing N existing …" message when applicable.
System prompts gain an ENHANCEMENT MODE section: preserve base image family, custom RUN/COPY/ENV, metadata, env vars, volumes, probes; improve only missing best practices (multi-stage, non-root, HEALTHCHECK, securityContext, resources, image refs); return the COMPLETE artifact, not a diff.
buildDockerfileUserPrompt / buildK8sManifestUserPrompt accept the existing artifacts and append them as guidance.