mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +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:
@@ -1,5 +1,26 @@
|
||||
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
|
||||
(git+https://github.com/modelcontextprotocol/typescript-sdk.git)
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": "^7.7.2",
|
||||
"@modelcontextprotocol/sdk": "^1.15.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0",
|
||||
|
||||
@@ -4,47 +4,20 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import semver from 'semver';
|
||||
import { CliDetector, type CliDetectionResult } from './cliDetector.js';
|
||||
|
||||
export const MIN_CLI_VERSION_FOR_SESSION_METHODS = '0.4.0';
|
||||
|
||||
/**
|
||||
* CLI Feature Flags based on version
|
||||
*/
|
||||
export interface CliFeatureFlags {
|
||||
/**
|
||||
* Whether the CLI supports session/list ACP method
|
||||
*/
|
||||
supportsSessionList: boolean;
|
||||
|
||||
/**
|
||||
* Whether the CLI supports session/load ACP method
|
||||
*/
|
||||
supportsSessionLoad: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* CLI Version Information
|
||||
*/
|
||||
export interface CliVersionInfo {
|
||||
/**
|
||||
* Detected version string
|
||||
*/
|
||||
version: string | undefined;
|
||||
|
||||
/**
|
||||
* Whether the version meets the minimum requirement
|
||||
*/
|
||||
isSupported: boolean;
|
||||
|
||||
/**
|
||||
* Feature flags based on version
|
||||
*/
|
||||
features: CliFeatureFlags;
|
||||
|
||||
/**
|
||||
* Raw detection result
|
||||
*/
|
||||
detectionResult: CliDetectionResult;
|
||||
}
|
||||
|
||||
@@ -86,30 +59,19 @@ export class CliVersionManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// Simple version comparison (assuming semantic versioning)
|
||||
try {
|
||||
const versionParts = version.split('.').map(Number);
|
||||
const minVersionParts = minVersion.split('.').map(Number);
|
||||
// Use semver for robust comparison (handles v-prefix, pre-release, etc.)
|
||||
const v = semver.valid(version) ?? semver.coerce(version)?.version ?? null;
|
||||
const min =
|
||||
semver.valid(minVersion) ?? semver.coerce(minVersion)?.version ?? null;
|
||||
|
||||
for (
|
||||
let i = 0;
|
||||
i < Math.min(versionParts.length, minVersionParts.length);
|
||||
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);
|
||||
if (!v || !min) {
|
||||
console.warn(
|
||||
`[CliVersionManager] Invalid semver: version=${version}, min=${minVersion}`,
|
||||
);
|
||||
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
|
||||
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
|
||||
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.`,
|
||||
|
||||
Reference in New Issue
Block a user