From bfb9e756a01a8ddf4e20d2451c8316ab33454bb4 Mon Sep 17 00:00:00 2001 From: Coder Wayne <1418551940@qq.com> Date: Wed, 27 May 2026 22:42:26 +0800 Subject: feat: add Qoder CLI integration (#309) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add qodercli agent integration Recognize qodercli as an agent in herdr panes, with basic Idle/Working/ Blocked screen-state detection mirroring the existing claude / codex patterns. Adds an IntegrationTarget::Qodercli variant, install_target wiring for shell hooks under src/integration/assets/qodercli/, the herdr integration install qodercli CLI surface, and sound-override coverage so qodercli notifications follow the same routing rules as other agents. refs #308 * fix: detect qodercli permission required as blocked refs #308 * fix: detect qodercli ask-user prompt as blocked refs #308 * refactor: extract has_qodercli_blocked_prompt helper aligning detect_claude refs #308 * fix: tighten qodercli working state detection Combine spinner-row strictness and explicit cancel-hint matching, and stop matching the bare word 'working'. This avoids false positives when narrative output (logs, commit messages, Markdown) contains the word 'working' or when a stale braille glyph is sitting in the scrollback from a previous frame. - has_qodercli_spinner_row: require row-start braille glyph + space + alphabetic char so only an active spinner row triggers Working. - has_qodercli_working_hint: match '(esc to cancel,' as a positive signal that survives spinner masking (e.g. when a hook icon replaces the spinner glyph). refs #308 * fix: short-circuit qodercli press-again banners to idle refs #308 * fix: detect qodercli AskUser dialog by its 'Asking User' title refs #308 * feat: recognize qodercli, qoderclicn, qoder, qodercn process names Map qodercli, qoderclicn, qoder, and qodercn process names all to the Qodercli agent. Covers both international (qodercli/qoder) and CN (qoderclicn/qodercn) Qoder CLI binary names. refs #308 * feat: register qodercli hook in qoder settings.json with stdin payload Address the integration-layer feedback on #308: - `herdr integration install qodercli` now writes the bundled hook into ~/.qoder/hooks/herdr-agent-state.sh AND registers it in ~/.qoder/settings.json under the schema documented at https://docs.qoder.com/zh/cli/hooks (and confirmed against the packages/core/src/hooks/types.ts type definitions in qodercli's own source tree). The hooks object is keyed by event name — SessionStart / UserPromptSubmit / PreToolUse / PermissionRequest / Stop / SessionEnd — with each entry holding a matcher and a list of `{ type: "command", command, timeout }` invocations, mirroring how install_claude already wires claude code's settings.json. - The bundled assets/qodercli/herdr-agent-state.sh now reads the hook payload from stdin (per HookInput in qodercli's types.ts: session_id, transcript_path, cwd, hook_event_name, agent_id, ...). No environment variable is consulted to identify the event; SubagentStop and subagent release events return early so a recap or away-summary frame cannot revive an idle pane, mirroring assets/claude/herdr-agent-state.sh. - uninstall_qodercli reverses the same set of entries while preserving any foreign hook entries the user may have configured by hand. - Tests cover write / idempotency / uninstall-preserves-others and lock the stdin contract via a bundled-asset assertion. refs #308 --------- Co-authored-by: coderwayne Co-authored-by: Can Celik --- src/cli/integration.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/cli/integration.rs') diff --git a/src/cli/integration.rs b/src/cli/integration.rs index 4814d70d..d347628c 100644 --- a/src/cli/integration.rs +++ b/src/cli/integration.rs @@ -102,11 +102,15 @@ fn parse_integration_target( action: &str, ) -> std::io::Result> { let Some(target) = args.first().map(|arg| arg.as_str()) else { - eprintln!("usage: herdr integration {action} "); + eprintln!( + "usage: herdr integration {action} " + ); return Ok(None); }; if args.len() != 1 { - eprintln!("usage: herdr integration {action} "); + eprintln!( + "usage: herdr integration {action} " + ); return Ok(None); } @@ -117,9 +121,10 @@ fn parse_integration_target( "codex" => IntegrationTarget::Codex, "opencode" => IntegrationTarget::Opencode, "hermes" => IntegrationTarget::Hermes, + "qodercli" => IntegrationTarget::Qodercli, _ => { eprintln!("unknown integration target: {target}"); - eprintln!("currently supported: pi, omp, claude, codex, opencode, hermes"); + eprintln!("currently supported: pi, omp, claude, codex, opencode, hermes, qodercli"); return Ok(None); } }; @@ -135,11 +140,13 @@ fn print_integration_help() { eprintln!(" herdr integration install codex"); eprintln!(" herdr integration install opencode"); eprintln!(" herdr integration install hermes"); + eprintln!(" herdr integration install qodercli"); eprintln!(" herdr integration uninstall pi"); eprintln!(" herdr integration uninstall omp"); eprintln!(" herdr integration uninstall claude"); eprintln!(" herdr integration uninstall codex"); eprintln!(" herdr integration uninstall opencode"); eprintln!(" herdr integration uninstall hermes"); + eprintln!(" herdr integration uninstall qodercli"); eprintln!(" herdr integration status [--outdated-only]"); } -- cgit v1.2.3