Add compile-copilot-extension-full-build task for copilot#310159
Open
insilications wants to merge 1 commit intomicrosoft:mainfrom
Open
Add compile-copilot-extension-full-build task for copilot#310159insilications wants to merge 1 commit intomicrosoft:mainfrom
compile-copilot-extension-full-build task for copilot#310159insilications wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new build pipeline for packaging the built-in Copilot extension from source in a VSIX-equivalent way (correct .vscodeignore-based dependency filtering), and optionally materializes native shims into the packaged output to match what CI ships.
Changes:
- Add
packageCopilotExtensionFullStream()to packageextensions/copilotusingvsce.listFileswithPackageManager.Npm(respects.vscodeignore) plus.moduleignorecleanup andpackage.jsonstripping. - Add
prepareCopilotExtensionNativeShims(outputDir)to materializenode-ptyandripgrepshims into the packaged Copilot SDK layout (warning-only on failure for local builds). - Add gulp task
compile-copilot-extension-full-buildto clean, package, and then generate shims into.build/extensions/copilot/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| build/lib/extensions.ts | Implements VSIX-equivalent Copilot packaging stream and a helper to materialize native shims into the packaged output. |
| build/gulpfile.extensions.ts | Introduces compile-copilot-extension-full-build task wiring (clean → package → shims) targeting .build/extensions/copilot/. |
…ackaged copilot build The existing `compile-copilot-extension-build` task (from microsoft#309079) uses `packageCopilotExtensionStream`, which calls `fromLocalEsbuild` with `PackageManager.None` and then merges in all production dependencies via `getProductionDependencies`. This bypasses `.vscodeignore` filtering for `node_modules`, resulting in hundreds of redundant dependencies that are already bundled into `dist/extension.js` by esbuild. In CI this is not an issue because a pre-built VSIX (packaged with `PackageManager.Npm`, which respects `.vscodeignore`) is downloaded instead. Add a new `compile-copilot-extension-full-build` gulp task backed by two new functions in `build/lib/extensions.ts`: - `packageCopilotExtensionFullStream()`: builds the copilot extension using `vsce.listFiles` with `PackageManager.Npm` so `.vscodeignore` is the single authority on which files and dependencies are included. - `prepareCopilotExtensionNativeShims()`: materializes node-pty and ripgrep binaries into the copilot SDK's expected locations via `prepareBuiltInCopilotExtensionShims`, so the extension does not need to create shims at runtime. The output at `.build/extensions/copilot/` matches the structure of the copilot extension in released VS Code builds.
79faac7 to
ecf4d85
Compare
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.
Summary
Adds a new
compile-copilot-extension-full-buildgulp task that builds the built-in copilot extension from source with correctly filterednode_modules, producing output equivalent to what CI ships from the pre-built VSIX. This also materializes native dependency shims (node-pty, ripgrep) into the extension output.Motivation
The
compile-copilot-extension-buildtask introduced in #309079 enables building the copilot extension from source for local (non-CI) builds. However, it produces a bloatednode_modulesdirectory containing every production dependency fromextensions/copilot/package.json, even though nearly all of them are already bundled intodist/extension.jsby esbuild. This is bloated for the purpose of daily driving a bleeding-edge with the latest Copilot from source via, for example,--extensionDevelopmentPath.This happens because
packageCopilotExtensionStreammerges two streams:fromLocalEsbuild— runs.esbuild.ts, then callsvsce.listFiles({ packageManager: PackageManager.None }).PackageManager.Noneskips dependency scanning, so.vscodeignorefiltering is not applied tonode_modules.getProductionDependencies('extensions/copilot')— runsnpm ls --all --omit=devand blindly globs every resolved dependency path into the output.In CI this is not a problem because
packageCopilotExtensionStreamis never used — CI downloads a pre-built.vsix(viadownloadCopilotVsix.ts) that was packaged byvsce packagewithPackageManager.Npm, which respects.vscodeignoreand only includes the@vscode/copilot-typescript-server-pluginand@github/copilot(SDK subtree) dependencies.What this PR does
build/lib/extensions.tspackageCopilotExtensionFullStream()— A new packaging function that:.esbuild.tsto compile the extension (same as existing)vsce.listFiles({ packageManager: PackageManager.Npm })instead ofPackageManager.None, so.vscodeignoreis applied to both source files andnode_modulesdependenciespackage.json(removesscripts,dependencies,devDependencies)prepareCopilotExtensionNativeShims(outputDir)— CallsprepareBuiltInCopilotExtensionShimsfrombuild/lib/copilot.tsto materializenode-ptyandripgrepbinaries into the copilot SDK's expected locations, using the rootnode_modules/as the source. Failures are logged as warnings since the extension can create shims at runtime.build/gulpfile.extensions.tscompile-copilot-extension-full-build— A new gulp task that runs three steps in series:clean-copilot-build— removes.build/extensions/copilot/package-copilot-extension-full— runspackageCopilotExtensionFullStreamand writes to.build/copilot-extension-native-shims— runsprepareCopilotExtensionNativeShimson the outputUsage
Comparison
compile-copilot-extension-build:compile-copilot-extension-full-build:This matches the structure of the copilot extension in released VS Code Insiders builds.
Notes
compile-copilot-extension-buildtask andpackageCopilotExtensionStreamare left unchanged — this PR is purely additive.Fixes #310156
cc @joaomoreno