run preflight (#55)

This commit is contained in:
Fan
2025-07-23 16:18:31 +08:00
committed by GitHub
parent 173246723e
commit 40ee936453
12 changed files with 62 additions and 40 deletions

View File

@@ -109,7 +109,7 @@ qwen
### Terminal-Bench ### Terminal-Bench
| Agent | Model | Accuracy | | Agent | Model | Accuracy |
|-----------|--------------------|----------| | --------- | ------------------ | -------- |
| Qwen Code | Qwen3-Coder-480A35 | 37.5 | | Qwen Code | Qwen3-Coder-480A35 | 37.5 |
## Project Structure ## Project Structure

13
package-lock.json generated
View File

@@ -1,15 +1,18 @@
{ {
"name": "@qwen-code/qwen-code", "name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@qwen-code/qwen-code", "name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
"dependencies": {
"@qwen-code/qwen-code": "^0.0.1-alpha.8"
},
"bin": { "bin": {
"qwen": "bundle/gemini.js" "qwen": "bundle/gemini.js"
}, },
@@ -11936,7 +11939,7 @@
}, },
"packages/cli": { "packages/cli": {
"name": "@qwen-code/qwen-code", "name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"dependencies": { "dependencies": {
"@qwen-code/qwen-code-core": "file:../core", "@qwen-code/qwen-code-core": "file:../core",
"@types/update-notifier": "^6.0.8", "@types/update-notifier": "^6.0.8",
@@ -12114,7 +12117,7 @@
}, },
"packages/core": { "packages/core": {
"name": "@qwen-code/qwen-code-core", "name": "@qwen-code/qwen-code-core",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"dependencies": { "dependencies": {
"@google/genai": "1.8.0", "@google/genai": "1.8.0",
"@modelcontextprotocol/sdk": "^1.11.0", "@modelcontextprotocol/sdk": "^1.11.0",
@@ -12187,7 +12190,7 @@
}, },
"packages/vscode-ide-companion": { "packages/vscode-ide-companion": {
"name": "@qwen-code/qwen-code-vscode-ide-companion", "name": "@qwen-code/qwen-code-vscode-ide-companion",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1", "@modelcontextprotocol/sdk": "^1.15.1",
"cors": "^2.8.5", "cors": "^2.8.5",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@qwen-code/qwen-code", "name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"engines": { "engines": {
"node": ">=20" "node": ">=20"
}, },
@@ -8,13 +8,12 @@
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
"private": "true",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+http://gitlab.alibaba-inc.com/Qwen-Coder/qwen-code.git" "url": "git+http://gitlab.alibaba-inc.com/Qwen-Coder/qwen-code.git"
}, },
"config": { "config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.7" "sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.8"
}, },
"scripts": { "scripts": {
"start": "node scripts/start.js", "start": "node scripts/start.js",
@@ -82,5 +81,8 @@
"typescript-eslint": "^8.30.1", "typescript-eslint": "^8.30.1",
"vitest": "^3.2.4", "vitest": "^3.2.4",
"yargs": "^18.0.0" "yargs": "^18.0.0"
},
"dependencies": {
"@qwen-code/qwen-code": "^0.0.1-alpha.8"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@qwen-code/qwen-code", "name": "@qwen-code/qwen-code",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"description": "Gemini CLI", "description": "Gemini CLI",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -25,7 +25,7 @@
"dist" "dist"
], ],
"config": { "config": {
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.7" "sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.1-alpha.8"
}, },
"dependencies": { "dependencies": {
"@qwen-code/qwen-code-core": "file:../core", "@qwen-code/qwen-code-core": "file:../core",

View File

@@ -165,7 +165,7 @@ describe('AuthDialog', () => {
); );
// Since only OpenAI is available, it should be selected by default // Since only OpenAI is available, it should be selected by default
expect(lastFrame()).toContain(' OpenAI'); expect(lastFrame()).toContain(' OpenAI');
}); });
it('should fall back to default if GEMINI_DEFAULT_AUTH_TYPE is not set', () => { it('should fall back to default if GEMINI_DEFAULT_AUTH_TYPE is not set', () => {
@@ -188,7 +188,7 @@ describe('AuthDialog', () => {
); );
// Default is OpenAI (the only option) // Default is OpenAI (the only option)
expect(lastFrame()).toContain(' OpenAI'); expect(lastFrame()).toContain(' OpenAI');
}); });
it('should show an error and fall back to default if GEMINI_DEFAULT_AUTH_TYPE is invalid', () => { it('should show an error and fall back to default if GEMINI_DEFAULT_AUTH_TYPE is invalid', () => {
@@ -214,7 +214,7 @@ describe('AuthDialog', () => {
// Since the auth dialog doesn't show GEMINI_DEFAULT_AUTH_TYPE errors anymore, // Since the auth dialog doesn't show GEMINI_DEFAULT_AUTH_TYPE errors anymore,
// it will just show the default OpenAI option // it will just show the default OpenAI option
expect(lastFrame()).toContain(' OpenAI'); expect(lastFrame()).toContain(' OpenAI');
}); });
}); });

View File

@@ -47,24 +47,27 @@ export function AuthDialog({
const [showOpenAIKeyPrompt, setShowOpenAIKeyPrompt] = useState(false); const [showOpenAIKeyPrompt, setShowOpenAIKeyPrompt] = useState(false);
const items = [{ label: 'OpenAI', value: AuthType.USE_OPENAI }]; const items = [{ label: 'OpenAI', value: AuthType.USE_OPENAI }];
const initialAuthIndex = Math.max(0, items.findIndex((item) => { const initialAuthIndex = Math.max(
if (settings.merged.selectedAuthType) { 0,
return item.value === settings.merged.selectedAuthType; items.findIndex((item) => {
} if (settings.merged.selectedAuthType) {
return item.value === settings.merged.selectedAuthType;
}
const defaultAuthType = parseDefaultAuthType( const defaultAuthType = parseDefaultAuthType(
process.env.GEMINI_DEFAULT_AUTH_TYPE, process.env.GEMINI_DEFAULT_AUTH_TYPE,
); );
if (defaultAuthType) { if (defaultAuthType) {
return item.value === defaultAuthType; return item.value === defaultAuthType;
} }
if (process.env.GEMINI_API_KEY) { if (process.env.GEMINI_API_KEY) {
return item.value === AuthType.USE_GEMINI; return item.value === AuthType.USE_GEMINI;
} }
return item.value === AuthType.LOGIN_WITH_GOOGLE; return item.value === AuthType.LOGIN_WITH_GOOGLE;
})); }),
);
const handleAuthSelect = (authMethod: AuthType) => { const handleAuthSelect = (authMethod: AuthType) => {
const error = validateAuthMethod(authMethod); const error = validateAuthMethod(authMethod);

View File

@@ -56,7 +56,12 @@ export function RadioButtonSelect<T>({
showScrollArrows = false, showScrollArrows = false,
maxItemsToShow = 10, maxItemsToShow = 10,
}: RadioButtonSelectProps<T>): React.JSX.Element { }: RadioButtonSelectProps<T>): React.JSX.Element {
const [activeIndex, setActiveIndex] = useState(initialIndex); // Ensure initialIndex is within bounds
const safeInitialIndex =
items.length > 0
? Math.max(0, Math.min(initialIndex, items.length - 1))
: 0;
const [activeIndex, setActiveIndex] = useState(safeInitialIndex);
const [scrollOffset, setScrollOffset] = useState(0); const [scrollOffset, setScrollOffset] = useState(0);
// Ensure activeIndex is always within bounds when items change // Ensure activeIndex is always within bounds when items change
@@ -102,7 +107,11 @@ export function RadioButtonSelect<T>({
} }
if (key.return) { if (key.return) {
// Add bounds check before accessing items[activeIndex] // Add bounds check before accessing items[activeIndex]
if (activeIndex >= 0 && activeIndex < items.length && items[activeIndex]) { if (
activeIndex >= 0 &&
activeIndex < items.length &&
items[activeIndex]
) {
onSelect(items[activeIndex].value); onSelect(items[activeIndex].value);
} }
} }
@@ -118,7 +127,13 @@ export function RadioButtonSelect<T>({
} }
} }
}, },
{ isActive: isFocused && items.length > 0 && activeIndex >= 0 && activeIndex < items.length }, {
isActive:
isFocused &&
items.length > 0 &&
activeIndex >= 0 &&
activeIndex < items.length,
},
); );
const visibleItems = items.slice(scrollOffset, scrollOffset + maxItemsToShow); const visibleItems = items.slice(scrollOffset, scrollOffset + maxItemsToShow);

View File

@@ -1,12 +1,12 @@
{ {
"name": "@google/gemini-cli-core", "name": "@google/gemini-cli-core",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@google/gemini-cli-core", "name": "@google/gemini-cli-core",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"dependencies": { "dependencies": {
"@google/genai": "^1.4.0", "@google/genai": "^1.4.0",
"@modelcontextprotocol/sdk": "^1.11.0", "@modelcontextprotocol/sdk": "^1.11.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@qwen-code/qwen-code-core", "name": "@qwen-code/qwen-code-core",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"description": "Qwen Code Core", "description": "Qwen Code Core",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -27,7 +27,6 @@ import {
setGeminiMdFilename, setGeminiMdFilename,
GEMINI_CONFIG_DIR as GEMINI_DIR, GEMINI_CONFIG_DIR as GEMINI_DIR,
} from '../tools/memoryTool.js'; } from '../tools/memoryTool.js';
import { WebSearchTool } from '../tools/web-search.js';
import { GeminiClient } from '../core/client.js'; import { GeminiClient } from '../core/client.js';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { GitService } from '../services/gitService.js'; import { GitService } from '../services/gitService.js';
@@ -601,7 +600,7 @@ export class Config {
registerCoreTool(ReadManyFilesTool, this); registerCoreTool(ReadManyFilesTool, this);
registerCoreTool(ShellTool, this); registerCoreTool(ShellTool, this);
registerCoreTool(MemoryTool); registerCoreTool(MemoryTool);
registerCoreTool(WebSearchTool, this); // registerCoreTool(WebSearchTool, this); // Temporarily disabled
await registry.discoverTools(); await registry.discoverTools();
return registry; return registry;

View File

@@ -1,12 +1,12 @@
{ {
"name": "qwen-code-vscode", "name": "qwen-code-vscode",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "qwen-code-vscode", "name": "qwen-code-vscode",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1", "@modelcontextprotocol/sdk": "^1.15.1",
"cors": "^2.8.5", "cors": "^2.8.5",

View File

@@ -2,7 +2,7 @@
"name": "@qwen-code/qwen-code-vscode-ide-companion", "name": "@qwen-code/qwen-code-vscode-ide-companion",
"displayName": "Qwen Code VSCode IDE Companion", "displayName": "Qwen Code VSCode IDE Companion",
"description": "", "description": "",
"version": "0.0.1-alpha.7", "version": "0.0.1-alpha.8",
"engines": { "engines": {
"vscode": "^1.101.0" "vscode": "^1.101.0"
}, },