feat: add Qwen Code adapter with Windows Bun detection#342
feat: add Qwen Code adapter with Windows Bun detection#342btxbtxbtx wants to merge 20 commits intomksglu:nextfrom
Conversation
|
Hi @btxbtxbtx! Did you test that on local? Thanks. |
Qwen Code (by Alibaba/Qwen team) uses an identical hook wire protocol to Claude Code — verified from qwen-code source (hookRunner.ts, claude-converter.ts). Same JSON stdin/stdout, same event names, same response format (hookSpecificOutput, updatedInput, additionalContext). Adapter differences from Claude Code (justified by source evidence): - Config dir: ~/.qwen/ (not ~/.claude/) - Env vars: QWEN_PROJECT_DIR, QWEN_SESSION_ID - Session ID priority: session_id field first (Claude: transcript_path) - MCP clientInfo: qwen-cli-mcp-client-* (dynamic pattern match) - No plugin registry (uses settings.json directly) Files: - src/adapters/qwen-code/index.ts — standalone adapter (not copy-paste) - src/adapters/types.ts — add "qwen-code" to PlatformId - src/adapters/client-map.ts — add qwen-code + pattern entries - src/adapters/detect.ts — env vars, config dir, clientInfo pattern match - configs/qwen-code/QWEN.md — routing instructions - tests/adapters/qwen-code.test.ts — 20 TDD tests - tests/adapters/detect.test.ts — env var + clientInfo detection tests - tests/adapters/client-map.test.ts — mapping test 348 adapter tests pass (14 files). Replaces PR #342 which was 95% copy-paste of Claude Code adapter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks @btxbtxbtx for the initiative! We've implemented Qwen Code support differently on Why we went a different route:
What shipped:
Windows Bun detection from your PR is a good general improvement — consider submitting that as a separate focused PR. |
|
Update: Windows Bun detection also shipped on README and CONTRIBUTING.md updated with Qwen Code install docs + platform matrix (13th platform). Thanks again for the initial work. |
|
checking comments |
|
Sorry for the noise — this was an accidental test comment. Please disregard. |
Thank you!! @btxbtxbtx Let's test Qwen Code. |
Summary
Adds a new platform adapter for Qwen Code (Alibaba's CLI coding agent), enabling context-mode to work with Qwen Code via its Hook system.
Changes
New files (4)
src/adapters/qwen-code/index.ts— QwenCodeAdapter class (~280 lines)src/adapters/qwen-code/hooks.ts— Hook definitions mapping Qwen Code tool namesconfigs/qwen-code/settings.json— Hook configuration templateconfigs/qwen-code/QWEN.md— Routing instructions for Qwen Code's system promptModified files (4)
src/adapters/types.ts— Added"qwen-code"to PlatformId unionsrc/adapters/client-map.ts— Added qwen-code → qwen-code mappingsrc/adapters/detect.ts— Added env var detection (QWEN_PROJECT_DIR,QWEN_SESSION_ID), config dir detection (~/.qwen/), andgetAdapter()casesrc/runtime.ts— FixedbunExists()andbunCommand()on Windows to checkD:\bun\bin,%LOCALAPPDATA%\bun\bin, and~/.bun/bin/bun.exeTesting
npm run buildsucceedsctx doctoron Qwen Code: all checks pass (FTS5, Bun detection, hooks)