rtk-ai/rtk

Support Qwen Code CLI hooks (same as Gemini CLI integration)

Open

#1222 aperta il 11 apr 2026

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Rust (2914 fork)batch import
area:clieffort-smallenhancementgood first issuehelp wantedpriority:low

Metriche repository

Star
 (48.085 star)
Metriche merge PR
 (Merge medio 11g 1h) (45 PR mergiate in 30 g)

Descrizione

Summary

Qwen Code is an LLM-powered coding assistant with a CLI interface and BeforeTool hook system architecturally very similar to Gemini CLI. This feature request is to add first-class RTK support for Qwen Code.

Current Status

RTK currently supports 10+ AI coding tools:

  • ✅ Claude Code
  • ✅ GitHub Copilot (VS Code + CLI)
  • ✅ Cursor
  • ✅ Gemini CLI
  • ✅ Cline / Roo Code
  • ✅ Windsurf
  • ✅ Codex
  • ✅ OpenCode
  • ✅ OpenClaw
  • ⏳ Mistral Vibe (planned)

Qwen Code is missing from this list.

Why Qwen Code?

Qwen Code is gaining adoption as a powerful open-source alternative to Claude Code and Copilot. Users would benefit from RTK's 60-90% token savings just like other supported agents.

Technical Feasibility

JSON Format Similarity to Gemini CLI

Qwen Code BeforeTool Input:

{
  "tool_name": "run_shell_command",
  "tool_input": { "command": "git status" }
}

Expected RTK Output:

{
  "decision": "allow",
  "hookSpecificOutput": {
    "tool_input": { "command": "rtk git status" }
  }
}

This is virtually identical to Gemini CLI's hook format (see hooks/README.md#Gemini-CLI).

Implementation Effort

Minimal — RTK already has:

  1. Command rewrite logic (src/discover/registry.rs) — reusable
  2. Gemini CLI handler (src/hooks/hook_cmd.rs::run_gemini()) — can be reused or slightly adapted
  3. Settings.json patching (src/hooks/init.rs::patch_gemini_settings()) — template exists
  4. Installation CLI (rtk init -g --gemini) — pattern established

Proposal: Add rtk init -g --qwen command that:

  • Creates ~/.qwen/hooks/rtk-rewrite.sh (or similar)
  • Patches ~/.qwen/settings.json with BeforeTool hook entry
  • Installs QWEN.md (RTK awareness doc)

This is a straightforward extension of the existing Gemini CLI support.

Expected Outcome

After implementation, users can:

# 1. Install RTK for Qwen Code
rtk init -g --qwen

# 2. Restart Qwen Code

# 3. Commands auto-rewrite transparently
git status       # → internally: rtk git status
cargo test       # → internally: rtk cargo test
npm list         # → internally: rtk npm list
# etc. (all 100+ supported commands)

# 4. Check savings
rtk gain

Resources

Qwen Code Documentation

(If you have Qwen Code's official hook API docs, link them here. E.g., official Qwen Code repository or docs URL.)


I'm happy to:

  • ✅ Test early builds on Qwen Code
  • ✅ Provide hook API documentation if available
  • ✅ Contribute a PR if you want community implementation

Thanks for the amazing RTK project! 🚀

Guida contributor