Thank you for your interest in contributing! This guide outlines how to set up, develop, and submit contributions.
- Node.js 16+ (tested with v18+)
- npm 8+
- TypeScript knowledge (codebase is TypeScript-first)
git clone https://github.com/aptdnfapt/qwen-code-oai-proxy
cd qwen-code-oai-proxy
npm install
cp .env.example .env# Typecheck
npm run typecheck
# Build
npm run build:core
# Run tests (simple validation)
npm run test:simple
# Run full test suite
npm run test
# Run dev server (headless)
npm run dev
# Start with TUI
npm run build:core
node dist/src/cli/qwen-proxy.js serve- No auto-fixes: Avoid tools that auto-correct quote styles (
'→") or other formatting. These create noise in git history. - Existing patterns: Study the codebase first — follow existing imports, library choices, and patterns.
- No comments required: Code should be self-documenting. Comments are not expected unless explaining complex logic.
- Source:
src/(TypeScript) - Compiled:
dist/(generated, do not commit) - Tests:
scripts/(validation scripts) - Documentation:
docs/(one file per feature/topic)
- Express — HTTP server & routing
- TypeScript — Type safety
- better-sqlite3 — Token usage tracking
- winston — Logging
- chalk — Terminal colors
- @mariozechner/pi-tui — Terminal UI
Do not add new dependencies without discussion. Check package.json for what's available.
All PRs must pass these checks:
# 1. Type checking
npm run typecheck
# 2. Compile
npm run build:core
# 3. Simple validation
npm run test:simple
# 4. Full test suite (requires Qwen auth setup)
npm run testnpm run test:simple— Basic proxy + auth flow validationnpm run test:auth-clean-home— Auth on fresh machine (no ~/.qwen)npm run test:first-run— First-run onboarding flownpm run test:install-smoke— Packaged npm install smoke test
Note: Full tests require valid Qwen accounts. See docs/testing-clean-home.md for details.
AI-generated code is allowed and welcome, with these requirements:
- Manual verification — Ensure the solution is correct and follows project patterns
- Test locally — Run the full test suite; all tests must pass
- No git noise — Do NOT auto-commit formatting or quote style changes
- Logic review — Verify the implementation matches the intended behavior
- Code follows existing patterns in the codebase
- Typecheck passes:
npm run typecheck - Build succeeds:
npm run build:core - All tests pass:
npm run test - No auto-formatting changes (preserve original style)
- If adding a feature, add corresponding documentation in
docs/ - Commit message is clear and descriptive
- New features → Create/update file in
docs/ - Bug fixes → No doc required unless behavior changes
- API changes → Update relevant sections in
README.mdanddocs/
- One feature = one markdown file in
docs/ - Use clear headings, code examples, and practical explanations
- Link to related docs where relevant
- Keep examples working and tested
- Run typecheck and tests
- Review your changes:
git diff - Verify no
.envor credentials are included - Use meaningful commit messages
<type>: <short description>
<optional detailed explanation>
Types: feat, fix, docs, refactor, test, chore
Examples:
feat: add multi-account rotation with round-robin scheduling
fix: handle token refresh edge case on 401 response
docs: add web search API usage guide
.envor.env.localfilesdist/directory (generated)node_modules/(generated).qwen/directory (user data)- Auto-formatting changes (quote style, spacing fixes)
- Create a feature branch:
git checkout -b feat/your-feature - Make changes in
src/ - Add documentation in
docs/(if user-facing) - Run:
npm run typecheck && npm run build:core && npm run test:simple - Submit PR with clear description
- Create branch:
git checkout -b fix/your-bug - Add a test case that reproduces the bug (if applicable)
- Fix the bug
- Run full test suite:
npm run test - Submit PR with before/after behavior description
- Edit relevant file in
docs/ - If user-facing, update
README.mdtoo - No build/test needed for docs-only changes
- Submit PR
qwen-code-oai-proxy/
├── src/
│ ├── cli/ # CLI commands & TUI
│ ├── server/ # HTTP server & endpoints
│ ├── qwen/ # Qwen API client & auth
│ ├── utils/ # Logging, token counting, etc.
│ └── types/ # TypeScript type definitions
├── docs/ # Feature documentation
├── scripts/ # Build & test scripts
├── spec/ # Test data
├── README.md # Main user guide
├── CHANGELOG.md # Feature history
├── package.json # Dependencies & npm scripts
└── tsconfig.json # TypeScript config
- Project overview: See
README.md - Architecture: Read
docs/codebase_analysis.md - Feature details: Check
docs/folder - Issues/discussions: GitHub issues & discussions
- Be respectful and constructive
- Assume good intent
- Provide detailed feedback in reviews
- Welcome diverse perspectives
Open a GitHub issue or start a discussion. We're happy to help!
Happy coding 🚀