mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
chore(vscode-ide-companion): bump version to 0.4.1 and add semver dependency and improve cli version checking with semver package
This commit is contained in:
3
package-lock.json
generated
3
package-lock.json
generated
@@ -20189,7 +20189,7 @@
|
|||||||
},
|
},
|
||||||
"packages/vscode-ide-companion": {
|
"packages/vscode-ide-companion": {
|
||||||
"name": "qwen-code-vscode-ide-companion",
|
"name": "qwen-code-vscode-ide-companion",
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"license": "LICENSE",
|
"license": "LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||||
@@ -20198,6 +20198,7 @@
|
|||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
|
"semver": "^7.7.2",
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
This file contains third-party software notices and license terms.
|
This file contains third-party software notices and license terms.
|
||||||
|
|
||||||
|
============================================================
|
||||||
|
semver@7.7.2
|
||||||
|
(git+https://github.com/npm/node-semver.git)
|
||||||
|
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
============================================================
|
============================================================
|
||||||
@modelcontextprotocol/sdk@1.15.1
|
@modelcontextprotocol/sdk@1.15.1
|
||||||
(git+https://github.com/modelcontextprotocol/typescript-sdk.git)
|
(git+https://github.com/modelcontextprotocol/typescript-sdk.git)
|
||||||
|
|||||||
@@ -152,6 +152,7 @@
|
|||||||
"vitest": "^3.2.4"
|
"vitest": "^3.2.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"semver": "^7.7.2",
|
||||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
|
|||||||
@@ -4,47 +4,20 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import semver from 'semver';
|
||||||
import { CliDetector, type CliDetectionResult } from './cliDetector.js';
|
import { CliDetector, type CliDetectionResult } from './cliDetector.js';
|
||||||
|
|
||||||
export const MIN_CLI_VERSION_FOR_SESSION_METHODS = '0.4.0';
|
export const MIN_CLI_VERSION_FOR_SESSION_METHODS = '0.4.0';
|
||||||
|
|
||||||
/**
|
|
||||||
* CLI Feature Flags based on version
|
|
||||||
*/
|
|
||||||
export interface CliFeatureFlags {
|
export interface CliFeatureFlags {
|
||||||
/**
|
|
||||||
* Whether the CLI supports session/list ACP method
|
|
||||||
*/
|
|
||||||
supportsSessionList: boolean;
|
supportsSessionList: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the CLI supports session/load ACP method
|
|
||||||
*/
|
|
||||||
supportsSessionLoad: boolean;
|
supportsSessionLoad: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* CLI Version Information
|
|
||||||
*/
|
|
||||||
export interface CliVersionInfo {
|
export interface CliVersionInfo {
|
||||||
/**
|
|
||||||
* Detected version string
|
|
||||||
*/
|
|
||||||
version: string | undefined;
|
version: string | undefined;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the version meets the minimum requirement
|
|
||||||
*/
|
|
||||||
isSupported: boolean;
|
isSupported: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* Feature flags based on version
|
|
||||||
*/
|
|
||||||
features: CliFeatureFlags;
|
features: CliFeatureFlags;
|
||||||
|
|
||||||
/**
|
|
||||||
* Raw detection result
|
|
||||||
*/
|
|
||||||
detectionResult: CliDetectionResult;
|
detectionResult: CliDetectionResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,30 +59,19 @@ export class CliVersionManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// Use semver for robust comparison (handles v-prefix, pre-release, etc.)
|
||||||
// Simple version comparison (assuming semantic versioning)
|
const v = semver.valid(version) ?? semver.coerce(version)?.version ?? null;
|
||||||
try {
|
const min =
|
||||||
const versionParts = version.split('.').map(Number);
|
semver.valid(minVersion) ?? semver.coerce(minVersion)?.version ?? null;
|
||||||
const minVersionParts = minVersion.split('.').map(Number);
|
|
||||||
|
|
||||||
for (
|
if (!v || !min) {
|
||||||
let i = 0;
|
console.warn(
|
||||||
i < Math.min(versionParts.length, minVersionParts.length);
|
`[CliVersionManager] Invalid semver: version=${version}, min=${minVersion}`,
|
||||||
i++
|
);
|
||||||
) {
|
|
||||||
if (versionParts[i] > minVersionParts[i]) {
|
|
||||||
return true;
|
|
||||||
} else if (versionParts[i] < minVersionParts[i]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If all compared parts are equal, check if version has more parts
|
|
||||||
return versionParts.length >= minVersionParts.length;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('[CliVersionManager] Failed to parse version:', error);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
console.log(`[CliVersionManager] Version ${v} meets requirements: ${min}`);
|
||||||
|
return semver.gte(v, min);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,10 +56,6 @@ export class QwenConnectionHandler {
|
|||||||
|
|
||||||
// Show warning if CLI version is below minimum requirement
|
// Show warning if CLI version is below minimum requirement
|
||||||
if (!versionInfo.isSupported) {
|
if (!versionInfo.isSupported) {
|
||||||
console.warn(
|
|
||||||
`[QwenAgentManager] CLI version ${versionInfo.version} is below minimum required version ${MIN_CLI_VERSION_FOR_SESSION_METHODS}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Wait to determine release version number
|
// Wait to determine release version number
|
||||||
vscode.window.showWarningMessage(
|
vscode.window.showWarningMessage(
|
||||||
`Qwen Code CLI version ${versionInfo.version} is below the minimum required version. Some features may not work properly. Please upgrade to version ${MIN_CLI_VERSION_FOR_SESSION_METHODS} or later.`,
|
`Qwen Code CLI version ${versionInfo.version} is below the minimum required version. Some features may not work properly. Please upgrade to version ${MIN_CLI_VERSION_FOR_SESSION_METHODS} or later.`,
|
||||||
|
|||||||
Reference in New Issue
Block a user