Skip to content

feat(qwen): add Qwen Code CLI hook support (#1222)#1230

Open
ousamabenyounes wants to merge 2 commits intortk-ai:developfrom
ousamabenyounes:fix/issue-1222
Open

feat(qwen): add Qwen Code CLI hook support (#1222)#1230
ousamabenyounes wants to merge 2 commits intortk-ai:developfrom
ousamabenyounes:fix/issue-1222

Conversation

@ousamabenyounes
Copy link
Copy Markdown
Contributor

Summary

Fixes #1222

  • Adds rtk hook qwen — BeforeTool hook processor for Qwen Code CLI (delegates to Gemini logic since the JSON format is identical)
  • Adds rtk init -g --qwen — installs ~/.qwen/hooks/rtk-hook-qwen.sh, patches ~/.qwen/settings.json, and installs QWEN.md
  • Adds QWEN_HOOK_FILE and QWEN_DIR constants to constants.rs

Qwen Code uses the same tool_name/tool_input/command BeforeTool JSON format as Gemini CLI, so the hook processor delegates directly to run_gemini() with no duplication.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • New test test_qwen_format_identical_to_gemini verifies the shared rewrite logic applies to Qwen Code commands
  • Manual flow: rtk init -g --qwen creates hook script and patches settings

Generated by Claude Code
Vibe coded by ousamabenyounes

ousamabenyounes and others added 2 commits April 11, 2026 16:23
…t/--pretty

Two bugs affected `git log` with custom format flags:

1. RTK added `--no-merges` even for custom `--format`/`--pretty`/`--oneline`
   requests. Scripting users rely on exact commit selection (e.g. reading
   the date of a merge commit at HEAD); silently skipping merges causes the
   wrong commit to appear.

2. `filter_log_output` truncated individual lines at 80 chars when
   `user_format=true`. This corrupts programmatic output — full 40-char SHAs,
   ISO date strings, and any line longer than 80 chars were silently cut.

Fix: when `has_format_flag=true`, skip `--no-merges` injection and copy
output lines verbatim (no per-line truncation). RTK still applies the
commit-count cap (-50 default or user's -N) so output stays bounded.

Closes rtk-ai#1058

Co-Authored-By: Claude <noreply@anthropic.com>
Qwen Code uses the identical BeforeTool JSON format as Gemini CLI
(tool_name/tool_input/command). Add first-class support:

- `rtk hook qwen` — BeforeTool hook processor (delegates to run_gemini)
- `rtk init -g --qwen` — installs ~/.qwen/hooks/rtk-hook-qwen.sh,
  patches ~/.qwen/settings.json, and installs QWEN.md
- New QWEN_HOOK_FILE and QWEN_DIR constants in constants.rs

Generated by Claude Code
Vibe coded by ousamabenyounes

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant