Skip to content

Commit d7d9d39

Browse files
Version update js wrapper (#1523)
* readme update and js wrapper upgrade * updating js wrapper version
1 parent a036df2 commit d7d9d39

8 files changed

Lines changed: 37 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ test-resources
99
.npmrc
1010
coverage/
1111
packages/core/.npmrc
12+
/.vscode

packages/checkmarx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,4 @@ Find more integrations from our team [here](https://github.com/Checkmarx/ci-cd-i
245245
[license-shield]: https://img.shields.io/github/license/Checkmarx/ast-vscode-extension.svg
246246
[license-url]: https://github.com/Checkmarx/ast-vscode-extension/blob/master/LICENSE
247247
[installs-vscode-url]: https://marketplace.visualstudio.com/items?itemName=checkmarx.ast-results
248-
[installs-vscode-shield]: https://img.shields.io/visual-studio-marketplace/i/checkmarx.ast-results
248+
[installs-vscode-shield]: https://vsmarketplacebadges.dev/installs-short/checkmarx.ast-results.svg

packages/checkmarx/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"unit-test-core": "npx mocha"
1313
},
1414
"dependencies": {
15-
"@checkmarx/ast-cli-javascript-wrapper": "0.0.159",
15+
"@checkmarx/ast-cli-javascript-wrapper": "0.0.160",
1616
"@popperjs/core": "^2.11.8",
1717
"@vscode/codicons": "^0.0.36",
1818
"axios": "1.16.0",

packages/core/src/cx/cx.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as vscode from "vscode";
2+
import * as fs from "fs";
3+
import * as path from "path";
24
import { CxWrapper } from "@checkmarx/ast-cli-javascript-wrapper";
35
import CxScaRealtime from "@checkmarx/ast-cli-javascript-wrapper/dist/main/scaRealtime/CxScaRealTime";
46
import CxScan from "@checkmarx/ast-cli-javascript-wrapper/dist/main/scan/CxScan";
@@ -24,11 +26,14 @@ import { getMessages } from "../config/extensionMessages";
2426

2527
export class Cx implements CxPlatform {
2628
private context: vscode.ExtensionContext;
29+
private packageVersion: string | undefined;
2730

2831
constructor(context: vscode.ExtensionContext) {
2932
this.context = context;
3033
}
3134

35+
36+
3237
async scaScanCreate(sourcePath: string): Promise<CxScaRealtime | undefined> {
3338
const cx = new CxWrapper(this.getBaseAstConfiguration());
3439
let jsonResults = undefined;
@@ -315,10 +320,29 @@ export class Cx implements CxPlatform {
315320
config.additionalParameters = vscode.workspace
316321
.getConfiguration("checkmarxOne")
317322
.get("additionalParams") as string;
318-
config.agentName = isIDE(constants.kiroAgent) ? constants.kiroAgent : isIDE(constants.cursorAgent) ? constants.cursorAgent : (isIDE(constants.devinNextAgent) || isIDE(constants.devinAgent)) ? constants.devinAgent : (isIDE(constants.windsurfNextAgent) || isIDE(constants.windsurfAgent)) ? constants.windsurfAgent : constants.vsCodeAgent;
323+
const agentName = isIDE(constants.kiroAgent) ? constants.kiroAgent : isIDE(constants.cursorAgent) ? constants.cursorAgent : (isIDE(constants.devinNextAgent) || isIDE(constants.devinAgent)) ? constants.devinAgent : (isIDE(constants.windsurfNextAgent) || isIDE(constants.windsurfAgent)) ? constants.windsurfAgent : constants.vsCodeAgent;
324+
const version = this.getPackageVersion();
325+
config.agentName = version ? `${agentName}_${version}` : agentName;
326+
console.log(`Package version from VSCODE Plugin ${config.agentName}: ${config.agentName}`);
319327
return config;
320328
}
321329

330+
private getPackageVersion(): string {
331+
if (this.packageVersion !== undefined) {
332+
return this.packageVersion;
333+
}
334+
try {
335+
const packageJsonPath = path.join(this.context.extensionPath, "package.json");
336+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
337+
this.packageVersion = packageJson.version ?? "";
338+
console.log(`[Cx] Resolved package version from ${packageJsonPath}: ${this.packageVersion}`);
339+
} catch (error) {
340+
console.error(`[Cx] Failed to read package version: ${error}`);
341+
this.packageVersion = "";
342+
}
343+
return this.packageVersion;
344+
}
345+
322346
async getAstConfiguration() {
323347
const token = await this.context.secrets.get(constants.getAuthCredentialSecretKey());
324348

packages/project-ignite/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</ol>
3838
</details>
3939

40-
> This document relates to the standalone ​**Checkmarx Developer Assist**​ extension. Checkmarx One customers with a Developer Assist license should use the ​[**Checkmarx**](https://marketplace.visualstudio.com/items?itemName=checkmarx.ast-results) extension, which has Developer Assist bundeled together with the Checkmarx One platform tool. <br>The two extensions are **mutually exclusive**, so that if you want to use this extension, you must **first ​uninstall**​​ the Checkmarx extension.
40+
> This document relates to the standalone ​**Checkmarx Developer Assist**​ extension. Checkmarx One customers with a Developer Assist license should use the ​[**Checkmarx**](https://marketplace.visualstudio.com/items?itemName=checkmarx.cx-dev-assist) extension, which has Developer Assist bundeled together with the Checkmarx One platform tool. <br>The two extensions are **mutually exclusive**, so that if you want to use this extension, you must **first ​uninstall**​​ the Checkmarx extension.
4141
## Overview
4242
Checkmarx Developer Assist delivers context-aware security guidance directly within your IDE, helping prevent vulnerabilities before they reach the pipeline. As developers write or refine AI-generated and existing code, it provides real-time detection, remediation, and actionable insights—ensuring security is built in from the start.
4343
<br>
@@ -118,5 +118,5 @@ Find more integrations from our team [here](https://github.com/Checkmarx/ci-cd-i
118118
[issues-url]: https://github.com/Checkmarx/ast-vscode-extension/issues
119119
[license-shield]: https://img.shields.io/github/license/Checkmarx/ast-vscode-extension.svg
120120
[license-url]: https://github.com/Checkmarx/ast-vscode-extension/blob/master/LICENSE
121-
[installs-vscode-url]: https://marketplace.visualstudio.com/items?itemName=checkmarx.ast-results
122-
[installs-vscode-shield]: https://img.shields.io/visual-studio-marketplace/i/checkmarx.ast-results
121+
[installs-vscode-url]: https://marketplace.visualstudio.com/items?itemName=checkmarx.cx-dev-assist
122+
[installs-vscode-shield]: https://vsmarketplacebadges.dev/installs-short/checkmarx.cx-dev-assist.svg

packages/project-ignite/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)