Compare commits

..

5 Commits

11 changed files with 39 additions and 72 deletions

14
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@qwen-code/qwen-code",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"workspaces": [
"packages/*"
],
@@ -16422,7 +16422,7 @@
},
"packages/cli": {
"name": "@qwen-code/qwen-code",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"dependencies": {
"@google/genai": "1.16.0",
"@iarna/toml": "^2.2.5",
@@ -16537,7 +16537,7 @@
},
"packages/core": {
"name": "@qwen-code/qwen-code-core",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"hasInstallScript": true,
"dependencies": {
"@google/genai": "1.16.0",
@@ -16677,7 +16677,7 @@
},
"packages/sdk-typescript": {
"name": "@qwen-code/sdk",
"version": "0.1.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"license": "Apache-2.0",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.4"
@@ -19106,7 +19106,7 @@
},
"packages/test-utils": {
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"dev": true,
"license": "Apache-2.0",
"devDependencies": {
@@ -19118,7 +19118,7 @@
},
"packages/vscode-ide-companion": {
"name": "qwen-code-vscode-ide-companion",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"engines": {
"node": ">=20.0.0"
},
@@ -13,7 +13,7 @@
"url": "git+https://github.com/QwenLM/qwen-code.git"
},
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.0"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.1-nightly.20251210.5fddcd50"
},
"scripts": {
"start": "cross-env node scripts/start.js",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"description": "Qwen Code",
"repository": {
"type": "git",
@@ -33,7 +33,7 @@
"dist"
],
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.0"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.4.1-nightly.20251210.5fddcd50"
},
"dependencies": {
"@google/genai": "1.16.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-core",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"description": "Qwen Code Core",
"repository": {
"type": "git",

View File

@@ -198,52 +198,6 @@ describe('GlobTool', () => {
);
});
it('should find files even if workspace path casing differs from glob results (Windows/macOS)', async () => {
// Only relevant for Windows and macOS
if (process.platform !== 'win32' && process.platform !== 'darwin') {
return;
}
let mismatchedRootDir = tempRootDir;
if (process.platform === 'win32') {
// 1. Create a path with mismatched casing for the workspace root
// e.g., if tempRootDir is "C:\Users\...", make it "c:\Users\..."
const drive = path.parse(tempRootDir).root;
if (!drive || !drive.match(/^[A-Z]:\\/)) {
// Skip if we can't determine/manipulate the drive letter easily
return;
}
const lowerDrive = drive.toLowerCase();
mismatchedRootDir = lowerDrive + tempRootDir.substring(drive.length);
} else {
// macOS: change the casing of the path
if (tempRootDir === tempRootDir.toLowerCase()) {
mismatchedRootDir = tempRootDir.toUpperCase();
} else {
mismatchedRootDir = tempRootDir.toLowerCase();
}
}
// 2. Create a new GlobTool instance with this mismatched root
const mismatchedConfig = {
...mockConfig,
getTargetDir: () => mismatchedRootDir,
getWorkspaceContext: () =>
createMockWorkspaceContext(mismatchedRootDir),
} as unknown as Config;
const mismatchedGlobTool = new GlobTool(mismatchedConfig);
// 3. Execute search
const params: GlobToolParams = { pattern: '*.txt' };
const invocation = mismatchedGlobTool.build(params);
const result = await invocation.execute(abortSignal);
expect(result.llmContent).toContain('Found 2 file(s)');
});
it('should return error if path is outside workspace', async () => {
// Bypassing validation to test execute method directly
vi.spyOn(globTool, 'validateToolParams').mockReturnValue(null);

View File

@@ -134,21 +134,12 @@ class GlobToolInvocation extends BaseToolInvocation<
this.getFileFilteringOptions(),
);
const normalizePathForComparison = (p: string) =>
process.platform === 'win32' || process.platform === 'darwin'
? p.toLowerCase()
: p;
const filteredAbsolutePaths = new Set(
filteredPaths.map((p) =>
normalizePathForComparison(
path.resolve(this.config.getTargetDir(), p),
),
),
filteredPaths.map((p) => path.resolve(this.config.getTargetDir(), p)),
);
const filteredEntries = allEntries.filter((entry) =>
filteredAbsolutePaths.has(normalizePathForComparison(entry.fullpath())),
filteredAbsolutePaths.has(entry.fullpath()),
);
if (!filteredEntries || filteredEntries.length === 0) {

View File

@@ -391,6 +391,19 @@ describe('Shell Command Processor - Encoding Functions', () => {
expect(result).toBe('windows-1252');
});
it('should prioritize UTF-8 detection over Windows system encoding', () => {
mockedOsPlatform.mockReturnValue('win32');
mockedExecSync.mockReturnValue('Active code page: 936'); // GBK
const buffer = Buffer.from('test');
// Mock chardet to return UTF-8
mockedChardetDetect.mockReturnValue('UTF-8');
const result = getCachedEncodingForBuffer(buffer);
expect(result).toBe('utf-8');
});
it('should cache null system encoding result', () => {
// Reset the cache specifically for this test
resetEncodingCache();

View File

@@ -34,6 +34,15 @@ export function getCachedEncodingForBuffer(buffer: Buffer): string {
// If we have a cached system encoding, use it
if (cachedSystemEncoding) {
// If the system encoding is not UTF-8 (e.g. Windows CP936), but the buffer
// is detected as UTF-8, prefer UTF-8. This handles tools like 'git' which
// often output UTF-8 regardless of the system code page.
if (cachedSystemEncoding !== 'utf-8') {
const detected = detectEncodingFromBuffer(buffer);
if (detected === 'utf-8') {
return 'utf-8';
}
}
return cachedSystemEncoding;
}

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/sdk",
"version": "0.1.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"description": "TypeScript SDK for programmatic access to qwen-code CLI",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"private": true,
"main": "src/index.ts",
"license": "Apache-2.0",

View File

@@ -2,7 +2,7 @@
"name": "qwen-code-vscode-ide-companion",
"displayName": "Qwen Code Companion",
"description": "Enable Qwen Code with direct access to your VS Code workspace.",
"version": "0.4.0",
"version": "0.4.1-nightly.20251210.5fddcd50",
"publisher": "qwenlm",
"icon": "assets/icon.png",
"repository": {