📦 Release qwen-code CLI as a Standalone Bundled Package (#866)

This commit is contained in:
tanzhenxin
2025-10-24 17:08:59 +08:00
committed by GitHub
parent 5cf609c367
commit be633a80cc
36 changed files with 802 additions and 1077 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.14",
"version": "0.1.0",
"description": "Qwen Code",
"repository": {
"type": "git",
@@ -25,7 +25,7 @@
"dist"
],
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.14"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.1.0"
},
"dependencies": {
"@google/genai": "1.16.0",

View File

@@ -2051,7 +2051,7 @@ describe('loadCliConfig extensions', () => {
});
describe('loadCliConfig model selection', () => {
it('selects a model from settings.json if provided', async () => {
it.skip('selects a model from settings.json if provided', async () => {
process.argv = ['node', 'script.js'];
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig(
@@ -2072,7 +2072,7 @@ describe('loadCliConfig model selection', () => {
expect(config.getModel()).toBe('qwen3-coder-plus');
});
it('uses the default gemini model if nothing is set', async () => {
it.skip('uses the default gemini model if nothing is set', async () => {
process.argv = ['node', 'script.js']; // No model set.
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig(

View File

@@ -30,17 +30,17 @@ export function validateAuthMethodWithSettings(
}
export const useAuthCommand = (settings: LoadedSettings, config: Config) => {
// If no auth type is selected, start in Updating state (shows auth dialog)
const unAuthenticated =
settings.merged.security?.auth?.selectedType === undefined;
const [authState, setAuthState] = useState<AuthState>(
settings.merged.security?.auth?.selectedType === undefined
? AuthState.Updating
: AuthState.Unauthenticated,
unAuthenticated ? AuthState.Updating : AuthState.Unauthenticated,
);
const [authError, setAuthError] = useState<string | null>(null);
const [isAuthenticating, setIsAuthenticating] = useState(false);
const [isAuthDialogOpen, setIsAuthDialogOpen] = useState(false);
const [isAuthDialogOpen, setIsAuthDialogOpen] = useState(unAuthenticated);
const onAuthError = useCallback(
(error: string | null) => {

View File

@@ -20,6 +20,7 @@ import {
MCPServerStatus,
getErrorMessage,
MCPOAuthTokenStorage,
MCPOAuthProvider,
} from '@qwen-code/qwen-code-core';
import { appEvents, AppEvent } from '../../utils/events.js';
import { MessageType, type HistoryItemMcpStatus } from '../types.js';
@@ -93,9 +94,6 @@ const authCommand: SlashCommand = {
Date.now(),
);
// Import dynamically to avoid circular dependencies
const { MCPOAuthProvider } = await import('@qwen-code/qwen-code-core');
let oauthConfig = server.oauth;
if (!oauthConfig) {
oauthConfig = { enabled: false };

View File

@@ -24,6 +24,9 @@ function getAuthTypeFromEnv(): AuthType | undefined {
if (process.env['OPENAI_API_KEY']) {
return AuthType.USE_OPENAI;
}
if (process.env['QWEN_OAUTH']) {
return AuthType.QWEN_OAUTH;
}
return undefined;
}
@@ -47,7 +50,7 @@ export async function validateNonInteractiveAuth(
enforcedType || getAuthTypeFromEnv() || configuredAuthType;
if (!effectiveAuthType) {
const message = `Please set an Auth method in your ${USER_SETTINGS_PATH} or specify one of the following environment variables before running: GEMINI_API_KEY, OPENAI_API_KEY, GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_GENAI_USE_GCA`;
const message = `Please set an Auth method in your ${USER_SETTINGS_PATH} or specify one of the following environment variables before running: QWEN_OAUTH, OPENAI_API_KEY`;
throw new Error(message);
}