Development Environment Setup
This guide will help you set up your development environment for contributing to Qwen Code.Prerequisites
Required
-
Node.js
- Development: Use Node.js
~20.19.0(specific version required due to upstream dependency issue) - Production: Any version
>=20.0.0works for running the CLI - Recommended: Use nvm to manage Node.js versions
- Development: Use Node.js
-
Git
- For version control and repository management
Optional (but Recommended)
-
Docker or Podman
- For sandboxing feature (optional but recommended for security)
- Enables isolated code execution
-
VS Code
- Recommended IDE with excellent TypeScript support
- Pre-configured launch configurations included
Initial Setup
1. Clone the Repository
2. Install Node.js (if needed)
Using nvm (recommended):3. Install Dependencies
Build Process
Basic Build
Build all packages:Full Build (with Sandbox)
To build everything including the sandbox container:- All packages
- Sandbox Docker container
- VS Code companion extension
Build Individual Packages
Development Mode
For faster development with hot reload:Running Qwen Code
From Source
After building, run from the source directory:Link Globally
To useqwen-code command from anywhere:
With Debug Mode
Run with debugging enabled:Testing
Unit Tests
Run all unit tests:Integration Tests
Run integration tests without sandbox:Test Coverage
Generate coverage reports:Code Quality
Linting
Run ESLint:Formatting
Format code with Prettier:Type Checking
Run TypeScript type checker:Preflight Checks
Run all checks before submitting a PR:- Clean build artifacts
- Fresh install of dependencies
- Code formatting check
- Linting (CI mode)
- Full build
- Type checking
- All tests
Sandboxing Setup
Sandboxing is highly recommended for security and requires additional setup.Enable Sandboxing
Set the environment variable:Docker Setup
If using Docker:Podman Setup
If using Podman:Sandbox Providers
Supported sandbox providers:docker- Docker Desktop (recommended for most users)podman- Podman (alternative to Docker)macOS Seatbelt- macOS native sandboxingfalse- Disable sandboxing (not recommended)
Development Tools
VS Code Setup
The project includes pre-configured VS Code settings:-
Launch Configurations (
.vscode/launch.json):F5- Start with debugger attached- “Attach” - Attach to running debug session
- “Launch Program” - Debug current file
-
Recommended Extensions:
- ESLint
- Prettier
- TypeScript and JavaScript Language Features
- Debugger Usage:
React DevTools
For debugging the CLI’s React UI:Environment Configuration
Environment Variables
Key environment variables for development:Configuration Files
Configuration hierarchy:- Project settings:
.qwen/settings.json(project-specific) - User settings:
~/.qwen/settings.json(global) - Environment variables: Override any setting
- CLI arguments: Highest priority
Troubleshooting
Common Issues
Node Version Mismatch
Build Failures
Test Failures
Permission Errors (Docker)
Import Resolution Errors
Getting Help
If you encounter issues:- Check existing issues
- Review the documentation
- Ask in discussions
- Open a new issue with:
- Node.js version (
node --version) - npm version (
npm --version) - OS and version
- Error messages and stack traces
- Node.js version (
Next Steps
Now that your environment is set up:- Read the Contributing Guidelines
- Explore the Architecture Overview
- Learn about the Tools System
- Start with good first issues on GitHub
