Skip to content

Commit 6db3048

Browse files
committed
fix VSIX-bundled server install & version artifacts
VSIX install fixes: - Skip npm install entirely when the VSIX bundle is present; the bundle already ships server/dist/, server/ql/, and server/package.json - PackInstaller now prefers bundled qlpacks from the VSIX over the npm-installed copy in globalStorage, fixing version skew between the packs being installed and the server code being run - In the unbundled fallback path (Extension Development Host), compare the npm-installed version against the extension's own version instead of short-circuiting on targetVersion === 'latest' Versioned release artifact filenames: - VSIX: codeql-development-mcp-server-vX.Y.Z.vsix (was unversioned) - CodeQL pack bundles: ql-mcp-<lang>-tools-src-vX.Y.Z.tar.gz (was unversioned) - Update release, build-and-test, and package scripts accordingly - Add *.vsix to .gitignore - Normalize docs to use vX.Y.Z placeholders consistently
1 parent dff4f58 commit 6db3048

File tree

14 files changed

+242
-52
lines changed

14 files changed

+242
-52
lines changed

.github/workflows/build-and-test-extension.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ jobs:
6969

7070
- name: Verify VSIX packaging
7171
working-directory: extensions/vscode
72-
run: npx @vscode/vsce package --no-dependencies --out codeql-development-mcp-server.vsix
72+
run: |
73+
VERSION=$(node -e "console.log(require('./package.json').version)")
74+
npx @vscode/vsce package --no-dependencies --out "codeql-development-mcp-server-v${VERSION}.vsix"
7375
7476
- name: Verify VSIX contents
7577
working-directory: extensions/vscode

.github/workflows/release-codeql.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ jobs:
115115
for lang in ${LANGUAGES}; do
116116
PACK_DIR="server/ql/${lang}/tools/src"
117117
if [ -d "${PACK_DIR}" ]; then
118-
PACK_NAME="ql-mcp-${lang}-tools-src"
118+
VERSION="${{ steps.version.outputs.version }}"
119+
PACK_NAME="ql-mcp-${lang}-tools-src-${VERSION}"
119120
OUTPUT="dist-packs/${PACK_NAME}.tar.gz"
120121
echo "📦 Bundling ${PACK_DIR} -> ${OUTPUT}..."
121122
codeql pack bundle --threads=-1 --output="${OUTPUT}" -- "${PACK_DIR}"

.github/workflows/release-vsix.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
description: 'The full version string with "v" prefix (e.g., vX.Y.Z)'
1616
value: ${{ jobs.publish-vsix.outputs.version }}
1717
vsix_name:
18-
description: 'The VSIX filename (e.g., codeql-development-mcp-server.vsix)'
18+
description: 'The VSIX filename (e.g., codeql-development-mcp-server-vX.Y.Z.vsix)'
1919
value: ${{ jobs.publish-vsix.outputs.vsix_name }}
2020

2121
# Note: This workflow is called exclusively via workflow_call from release.yml.
@@ -85,7 +85,8 @@ jobs:
8585
id: package
8686
working-directory: extensions/vscode
8787
run: |
88-
VSIX_NAME="codeql-development-mcp-server.vsix"
88+
VERSION="${{ steps.version.outputs.version }}"
89+
VSIX_NAME="codeql-development-mcp-server-${VERSION}.vsix"
8990
npx @vscode/vsce package --no-dependencies --out "${VSIX_NAME}"
9091
echo "vsix_name=${VSIX_NAME}" >> $GITHUB_OUTPUT
9192
echo "✅ Packaged ${VSIX_NAME}"

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ jobs:
243243
files: |
244244
codeql-development-mcp-server-${{ needs.resolve-version.outputs.version }}.tar.gz
245245
dist-packs/*.tar.gz
246-
dist-vsix/codeql-development-mcp-server.vsix
246+
dist-vsix/codeql-development-mcp-server-${{ needs.resolve-version.outputs.version }}.vsix
247247
generate_release_notes: true
248248
tag_name: ${{ needs.resolve-version.outputs.version }}
249249

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ codeql-development-mcp-server.code-workspace
2626
*.swo
2727
*.tgz
2828
*.tar.gz
29+
*.vsix
2930
*~
3031

3132
.vscode/mcp.json

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ npx -y codeql-development-mcp-server
4747
### From GitHub Releases
4848

4949
1. Download the latest release from [Releases](https://github.com/advanced-security/codeql-development-mcp-server/releases)
50-
2. Extract: `tar -xzf codeql-development-mcp-server-vX.X.X.tar.gz -C /path/to/destination`
50+
2. Extract: `tar -xzf codeql-development-mcp-server-vX.Y.Z.tar.gz -C /path/to/destination`
5151

5252
### From Source
5353

docs/vscode/extension.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ to do by hand.
1717

1818
### From `.vsix` (GitHub Releases)
1919

20-
Download `codeql-development-mcp-server.vsix` from the latest
20+
Download `codeql-development-mcp-server-vX.Y.Z.vsix` from the latest
2121
[GitHub Release](https://github.com/advanced-security/codeql-development-mcp-server/releases),
2222
then install:
2323

2424
```bash
25-
code --install-extension codeql-development-mcp-server.vsix
25+
code --install-extension codeql-development-mcp-server-vX.Y.Z.vsix
2626
```
2727

2828
Or in VS Code: **Extensions** sidebar → `` menu → **Install from VSIX…** → select the file.
@@ -40,7 +40,7 @@ From the repository root:
4040

4141
```bash
4242
npm run package:vsix
43-
code --install-extension extensions/vscode/codeql-development-mcp-server.vsix
43+
code --install-extension extensions/vscode/codeql-development-mcp-server-vX.Y.Z.vsix
4444
```
4545

4646
The extension requires the [CodeQL extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql) (`GitHub.vscode-codeql`) and will prompt you to install it if missing.

extensions/vscode/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A VS Code extension that automatically installs, configures, and manages the [Co
1313
### From `.vsix`
1414

1515
```bash
16-
code --install-extension codeql-development-mcp-server.vsix
16+
code --install-extension codeql-development-mcp-server-vX.Y.Z.vsix
1717
```
1818

1919
Or in VS Code: **Extensions** sidebar → `` menu → **Install from VSIX…** → select the file.
@@ -23,7 +23,7 @@ Or in VS Code: **Extensions** sidebar → `⋯` menu → **Install from VSIX…*
2323
```bash
2424
cd extensions/vscode
2525
npm run package
26-
code --install-extension codeql-development-mcp-server.vsix
26+
code --install-extension codeql-development-mcp-server-vX.Y.Z.vsix
2727
```
2828

2929
## What It Does

extensions/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"clean": "rm -rf dist server *.vsix",
141141
"lint": "eslint src/ test/",
142142
"lint:fix": "eslint src/ test/ --fix",
143-
"package": "vsce package --no-dependencies --out codeql-development-mcp-server.vsix",
143+
"package": "vsce package --no-dependencies --out codeql-development-mcp-server-v$(node -e 'process.stdout.write(require(`./package.json`).version)').vsix",
144144
"test": "npm run test:coverage && npm run test:integration",
145145
"test:coverage": "vitest --run --coverage",
146146
"test:integration": "vscode-test",

extensions/vscode/src/extension.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,7 @@ export async function activate(
172172
// Run in background — don't block activation
173173
void (async () => {
174174
try {
175-
const freshInstall = await serverManager.ensureInstalled();
176-
if (freshInstall) {
177-
logger.info('Fresh npm install completed — running CodeQL pack setup...');
178-
} else {
179-
logger.info('npm package already present — checking CodeQL packs...');
180-
}
175+
await serverManager.ensureInstalled();
181176
await packInstaller.installAll();
182177
mcpProvider.fireDidChange();
183178
logger.info('✅ MCP server setup complete. Server is ready to be started.');

0 commit comments

Comments
 (0)