mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: update vars
This commit is contained in:
@@ -24,6 +24,12 @@ Qwen Code uses `settings.json` files for persistent configuration. There are thr
|
|||||||
- **Location:** `.qwen/settings.json` within your project's root directory.
|
- **Location:** `.qwen/settings.json` within your project's root directory.
|
||||||
- **Scope:** Applies only when running Qwen Code from that specific project. Project settings override user settings.
|
- **Scope:** Applies only when running Qwen Code from that specific project. Project settings override user settings.
|
||||||
|
|
||||||
|
- **System settings file:**
|
||||||
|
- **Location:** `/etc/qwen-code/settings.json` (Linux), `C:\ProgramData\qwen-code\settings.json` (Windows) or `/Library/Application Support/QwenCode/settings.json` (macOS). The path can be overridden using the `QWEN_CODE_SYSTEM_SETTINGS_PATH` environment variable.
|
||||||
|
- **Scope:** Applies to all Qwen Code sessions on the system, for all users. System settings override user and project settings. May be useful for system administrators at enterprises to have controls over users' Qwen Code setups.
|
||||||
|
|
||||||
|
**Note on environment variables in settings:** String values within your `settings.json` files can reference environment variables using either `$VAR_NAME` or `${VAR_NAME}` syntax. These variables will be automatically resolved when the settings are loaded. For example, if you have an environment variable `MY_API_TOKEN`, you could use it in `settings.json` like this: `"apiKey": "$MY_API_TOKEN"`.
|
||||||
|
|
||||||
### The `.qwen` directory in your project
|
### The `.qwen` directory in your project
|
||||||
|
|
||||||
In addition to a project settings file, a project's `.qwen` directory can contain other project-specific files related to Qwen Code's operation, such as:
|
In addition to a project settings file, a project's `.qwen` directory can contain other project-specific files related to Qwen Code's operation, such as:
|
||||||
@@ -374,7 +380,7 @@ The CLI automatically loads environment variables from an `.env` file. The loadi
|
|||||||
- Specifies the default OPENAI model to use.
|
- Specifies the default OPENAI model to use.
|
||||||
- Overrides the hardcoded default
|
- Overrides the hardcoded default
|
||||||
- Example: `export OPENAI_MODEL="qwen3-coder-plus"`
|
- Example: `export OPENAI_MODEL="qwen3-coder-plus"`
|
||||||
- **`QWEN_SANDBOX`**:
|
- **`GEMINI_SANDBOX`**:
|
||||||
- Alternative to the `sandbox` setting in `settings.json`.
|
- Alternative to the `sandbox` setting in `settings.json`.
|
||||||
- Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
|
- Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
|
||||||
- **`SEATBELT_PROFILE`** (macOS specific):
|
- **`SEATBELT_PROFILE`** (macOS specific):
|
||||||
@@ -534,7 +540,7 @@ Qwen Code can execute potentially unsafe operations (like shell commands and fil
|
|||||||
Sandboxing is disabled by default, but you can enable it in a few ways:
|
Sandboxing is disabled by default, but you can enable it in a few ways:
|
||||||
|
|
||||||
- Using `--sandbox` or `-s` flag.
|
- Using `--sandbox` or `-s` flag.
|
||||||
- Setting `QWEN_SANDBOX` environment variable.
|
- Setting `GEMINI_SANDBOX` environment variable.
|
||||||
- Sandbox is enabled when using `--yolo` or `--approval-mode=yolo` by default.
|
- Sandbox is enabled when using `--yolo` or `--approval-mode=yolo` by default.
|
||||||
|
|
||||||
By default, it uses a pre-built `qwen-code-sandbox` Docker image.
|
By default, it uses a pre-built `qwen-code-sandbox` Docker image.
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ Metrics are numerical measurements of behavior over time. The following metrics
|
|||||||
- `user_added_lines` (Int, if applicable): Number of lines added/changed by user in AI proposed changes.
|
- `user_added_lines` (Int, if applicable): Number of lines added/changed by user in AI proposed changes.
|
||||||
- `user_removed_lines` (Int, if applicable): Number of lines removed/changed by user in AI proposed changes.
|
- `user_removed_lines` (Int, if applicable): Number of lines removed/changed by user in AI proposed changes.
|
||||||
|
|
||||||
- `qwen_code.chat_compression` (Counter, Int): Counts chat compression operations
|
- `qwen-code.chat_compression` (Counter, Int): Counts chat compression operations
|
||||||
- **Attributes**:
|
- **Attributes**:
|
||||||
- `tokens_before`: (Int): Number of tokens in context prior to compression
|
- `tokens_before`: (Int): Number of tokens in context prior to compression
|
||||||
- `tokens_after`: (Int): Number of tokens in context after compression
|
- `tokens_after`: (Int): Number of tokens in context after compression
|
||||||
|
|||||||
@@ -1198,16 +1198,16 @@ describe('Settings Loading and Merging', () => {
|
|||||||
delete process.env['TEST_PORT'];
|
delete process.env['TEST_PORT'];
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when GEMINI_CLI_SYSTEM_SETTINGS_PATH is set', () => {
|
describe('when QWEN_CODE_SYSTEM_SETTINGS_PATH is set', () => {
|
||||||
const MOCK_ENV_SYSTEM_SETTINGS_PATH = '/mock/env/system/settings.json';
|
const MOCK_ENV_SYSTEM_SETTINGS_PATH = '/mock/env/system/settings.json';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH'] =
|
process.env['QWEN_CODE_SYSTEM_SETTINGS_PATH'] =
|
||||||
MOCK_ENV_SYSTEM_SETTINGS_PATH;
|
MOCK_ENV_SYSTEM_SETTINGS_PATH;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
delete process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH'];
|
delete process.env['QWEN_CODE_SYSTEM_SETTINGS_PATH'];
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load system settings from the path specified in the environment variable', () => {
|
it('should load system settings from the path specified in the environment variable', () => {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ export const USER_SETTINGS_PATH = path.join(USER_SETTINGS_DIR, 'settings.json');
|
|||||||
export const DEFAULT_EXCLUDED_ENV_VARS = ['DEBUG', 'DEBUG_MODE'];
|
export const DEFAULT_EXCLUDED_ENV_VARS = ['DEBUG', 'DEBUG_MODE'];
|
||||||
|
|
||||||
export function getSystemSettingsPath(): string {
|
export function getSystemSettingsPath(): string {
|
||||||
if (process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH']) {
|
if (process.env['QWEN_CODE_SYSTEM_SETTINGS_PATH']) {
|
||||||
return process.env['GEMINI_CLI_SYSTEM_SETTINGS_PATH'];
|
return process.env['QWEN_CODE_SYSTEM_SETTINGS_PATH'];
|
||||||
}
|
}
|
||||||
if (platform() === 'darwin') {
|
if (platform() === 'darwin') {
|
||||||
return '/Library/Application Support/QwenCode/settings.json';
|
return '/Library/Application Support/QwenCode/settings.json';
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export function IdeIntegrationNudge({
|
|||||||
const { displayName: ideName } = getIdeInfo(ide);
|
const { displayName: ideName } = getIdeInfo(ide);
|
||||||
// Assume extension is already installed if the env variables are set.
|
// Assume extension is already installed if the env variables are set.
|
||||||
const isExtensionPreInstalled =
|
const isExtensionPreInstalled =
|
||||||
!!process.env['GEMINI_CLI_IDE_SERVER_PORT'] &&
|
!!process.env['QWEN_CODE_IDE_SERVER_PORT'] &&
|
||||||
!!process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'];
|
!!process.env['QWEN_CODE_IDE_WORKSPACE_PATH'];
|
||||||
|
|
||||||
const OPTIONS: Array<RadioSelectItem<IdeIntegrationNudgeResult>> = [
|
const OPTIONS: Array<RadioSelectItem<IdeIntegrationNudgeResult>> = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe('IdeClient.validateWorkspacePath', () => {
|
|||||||
expect(result.isValid).toBe(true);
|
expect(result.isValid).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return invalid if GEMINI_CLI_IDE_WORKSPACE_PATH is undefined', () => {
|
it('should return invalid if QWEN_CODE_IDE_WORKSPACE_PATH is undefined', () => {
|
||||||
const result = IdeClient.validateWorkspacePath(
|
const result = IdeClient.validateWorkspacePath(
|
||||||
undefined,
|
undefined,
|
||||||
'VS Code',
|
'VS Code',
|
||||||
@@ -28,7 +28,7 @@ describe('IdeClient.validateWorkspacePath', () => {
|
|||||||
expect(result.error).toContain('Failed to connect');
|
expect(result.error).toContain('Failed to connect');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return invalid if GEMINI_CLI_IDE_WORKSPACE_PATH is empty', () => {
|
it('should return invalid if QWEN_CODE_IDE_WORKSPACE_PATH is empty', () => {
|
||||||
const result = IdeClient.validateWorkspacePath(
|
const result = IdeClient.validateWorkspacePath(
|
||||||
'',
|
'',
|
||||||
'VS Code',
|
'VS Code',
|
||||||
|
|||||||
Reference in New Issue
Block a user