Fixes and integration tests for MCP-provided prompts and VSIX bundle#71
Fixes and integration tests for MCP-provided prompts and VSIX bundle#71data-douser merged 6 commits intomainfrom
Conversation
- Inline .prompt.md files at build time via esbuild text loader so prompts resolve correctly in npm-installed and VSIX-installed layouts (fixes ENOENT) - Rewrite prompt-loader.ts to use static imports instead of filesystem reads - Add Vitest plugin to transform .prompt.md imports during test runs - Add TypeScript declarations for .prompt.md module imports - Wire up @vscode/test-cli with three profiles (noWorkspace, singleFolder, multiRoot) for Extension Host integration tests - Add try/catch around registerMcpServerDefinitionProvider for resilience on older VS Code versions - Rename build-extension.yml → build-and-test-extension.yml and add integration test step with xvfb-run - Update docs/testing.md to document all four test layers - Add .vscode-test/ to extensions/vscode/.gitignore
This commit: - updates MCP-hosted prompts to remove references to the deprecated 'profile_codeql_query' tool in favor of the new 'profile_codeql_query_from_logs' tool; - fixes the "npm run package:vsix" script to ensure that the server dist is built before packaging it in VSIX.
There was a problem hiding this comment.
@data-douser has requested to close this alert
There was a problem hiding this comment.
@data-douser has requested to close this alert
Dependency ReviewThe following issues were found:
|
There was a problem hiding this comment.
Pull request overview
This pull request addresses a critical packaging bug in the VSIX bundle and comprehensively enhances the testing infrastructure for the CodeQL Development MCP Server. The key fix ensures that all NodeJS package dependencies of the MCP server are properly bundled into the VSIX extension by removing an overly restrictive external configuration from esbuild. The PR also introduces Extension Host integration tests as a fourth testing layer, updates prompt documentation to use consistent tool reference formatting, and refactors the prompt loading mechanism to use static imports with embedded file contents.
Changes:
- Fixed VSIX packaging bug by removing
externaldependencies from server esbuild config, ensuring dependencies likeexpress,cors, andzodare bundled rather than excluded - Added Extension Host integration tests (Layer 2b) using
@vscode/test-cliand Mocha, providing comprehensive end-to-end validation of extension behavior inside VS Code - Refactored prompt loading from runtime filesystem reads to build-time static imports, making prompts available in all deployment scenarios (monorepo, npm, VSIX)
- Updated all prompt files to use
#tool_nameformat for tool references instead of backticks, improving consistency
Reviewed changes
Copilot reviewed 21 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/esbuild.config.js | Removed external dependencies array to fix VSIX bundling bug; added .md loader and createRequire shim |
| server/vitest.config.ts | Added plugin to transform .prompt.md imports into string literals for test compatibility |
| server/src/types/markdown.d.ts | New TypeScript declaration for .prompt.md module imports |
| server/src/prompts/prompt-loader.ts | Refactored from runtime fs.readFileSync to static imports with embedded template map |
| server/test/src/prompts/prompt-loader.test.ts | Enhanced test to validate all 9 prompt files are properly embedded |
| server/src/prompts/*.prompt.md | Updated tool references from backticks to # format for consistency |
| extensions/vscode/src/extension.ts | Wrapped MCP server registration in try-catch for backward compatibility with older VS Code |
| extensions/vscode/package.json | Updated description, added test dependencies, improved scripts |
| extensions/vscode/.vscode-test.mjs | New configuration defining three test profiles (noWorkspace, singleFolder, multiRoot) |
| extensions/vscode/.gitignore | Added .vscode-test/ directory exclusion |
| extensions/vscode/.vscodeignore | Added .vscode-test.mjs exclusion from VSIX |
| .github/workflows/build-and-test-extension.yml | Renamed and expanded workflow to include Extension Host integration tests |
| docs/testing.md | Updated to document all four testing layers including new Extension Host tests |
| docs/getting-started.md | Fixed command from package:vscode to package:vsix |
| docs/vscode/extension.md | Fixed command from package:vscode to package:vsix |
| package.json | Added clean:test-dbs script and updated package:vsix script |
| package-lock.json | Added @vscode/test-cli, @vscode/test-electron, and transitive dependencies |
Summary of Changes
This pull request (PR):
Outline of Changes
Testing infrastructure and documentation:
@vscode/test-cliand Mocha, with configuration in the new.vscode-test.mjsfile, and updated documentation indocs/testing.mdto describe all four layers and their commands. [1] [2] [3] [4].gitignoreand.vscodeignoreto exclude@vscode/test-cliruntime data and configuration files from the extension package. [1] [2]Build and CI workflow improvements:
build-and-test-extension.yml, adding steps to run extension integration tests in CI, and updated summary output to reflect new test layers. [1] [2]Extension package and scripts:
package.jsonscripts to support separate packaging of the VSIX, cleaning of test databases, and running the new integration tests; updated dependencies to include@vscode/test-cliand related tools. [1] [2] [3] [4]Documentation and usability fixes:
npm run package:vsix), and clarified test commands for each layer. [1] [2]Extension robustness:
Build tooling:
server/esbuild.config.jsto embed.prompt.mdfiles as string literals and improved compatibility for bundled CJS dependencies.Prompt documentation:
document-codeql-query.prompt.mdto use the correct tool name.