feat(ghook): add Droid CLI route#5
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe pull request introduces version 0.4.0 of ghook, adding support for Factory's Droid CLI as a first-class source. The daemon recognizes incoming droid envelopes with Changes
Sequence DiagramsequenceDiagram
actor User
participant ghook as ghook CLI
participant Daemon as Unified Daemon
participant DroidCLI as Droid CLI
User->>ghook: Invoke hook (from Droid CLI context)
ghook->>ghook: Detect source: "droid"<br/>(CliConfig::for_cli)
ghook->>ghook: Create Envelope<br/>(source: "droid",<br/>hook_type, input_data)
ghook->>Daemon: POST /hook<br/>(envelope JSON)
Daemon->>DroidCLI: Execute hook
DroidCLI-->>Daemon: Return response
Daemon-->>ghook: 200 OK<br/>{continue: true/false,<br/>reason, ...}
alt continue: false (Block)
ghook->>ghook: Extract reason
ghook-->>User: exit 2, stdout: response JSON<br/>stderr: reason
else continue: true (Success)
ghook-->>User: exit 0, stdout: response JSON
end
alt Daemon Transport Error
Daemon-->>ghook: Connection error / Timeout
ghook-->>User: exit 1, stderr: error message
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds Factory droid as a first-class ghook host CLI (--cli=droid), wiring it through diagnose/dispatch flows and updating versioning/docs to reflect the new integration.
Changes:
- Register
droidin the per-CLI config/diagnose surfaces and preserve droid hook payload + source through the envelope/POST request. - Implement Droid-specific response/exit-code handling for daemon success/failure responses.
- Bump
gobby-hooksto0.4.0and update docs/schemas/changelog accordingly.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/guides/ghook-user-guide.md | Documents --cli=droid and Droid-specific behavior; updates sample diagnose output to 0.4.0. |
| docs/guides/ghook-development-guide.md | Updates architecture/module docs for Droid + version 0.4.0 references. |
| crates/ghook/src/transport.rs | Adds a droid-focused POST test ensuring the request contains source: "droid" and uses the unified endpoint. |
| crates/ghook/src/main.rs | Adds Droid-specific success/failure response handling and unit tests. |
| crates/ghook/src/envelope.rs | Adds a test asserting droid envelope preserves PascalCase hook type + source: "droid". |
| crates/ghook/src/diagnose.rs | Adds a test ensuring --diagnose recognizes droid and reports noncritical/no terminal context. |
| crates/ghook/src/cli_config.rs | Registers droid as a recognized CLI with empty critical/terminal-context sets. |
| crates/ghook/schemas/inbox-envelope.v1.schema.json | Updates schema description to include droid as a valid source identifier. |
| crates/ghook/README.md | Adds Factory droid to the supported host-CLI list. |
| crates/ghook/Cargo.toml | Bumps gobby-hooks version to 0.4.0. |
| Cargo.lock | Updates lockfile entry for gobby-hooks 0.4.0. |
| CHANGELOG.md | Adds gobby-hooks 0.4.0 release notes for the droid integration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `ghook` is invoked by host AI CLIs (Claude Code, Codex, Gemini CLI, Qwen | ||
| CLI) on lifecycle and tool-use events. It enqueues an envelope to | ||
| CLI, Factory droid) on lifecycle and tool-use events. It enqueues an envelope to | ||
| `~/.gobby/hooks/inbox/` *before* attempting to POST to the local Gobby |
| assert!(request.contains("\"hook_type\":\"PreToolUse\"")); | ||
| assert!(request.contains("\"source\":\"droid\"")); | ||
| assert!(request.contains("\"input_data\":{\"hook_event_name\":\"PreToolUse\"")); | ||
| assert!(request.contains("\"tool_input\":{\"file_path\":\"src/main.rs\"}")); |
| | `qwen` | `SessionStart` | `SessionStart` | | ||
| | `droid` | none | none | | ||
|
|
||
| Droid uses PascalCase hook types (`SessionStart`, `PreToolUse`, `PostToolUse`, `UserPromptSubmit`, `Notification`, `Stop`, `SubagentStop`, `PreCompact`, `SessionEnd`) and ghook forwards droid's stdin payload unchanged to the daemon with `source: "droid"`. Droid-specific block handling differs slightly from the other CLIs: daemon responses containing `continue:false` exit 2, while other meaningful response JSON is written to stdout with exit 0. |
|
|
||
| ```text | ||
| host AI CLI (Claude Code / Codex / Gemini / Qwen) | ||
| host AI CLI (Claude Code / Codex / Gemini / Qwen / Droid) |
Adds Factory Droid as a first-class ghook source via --cli=droid, including diagnose support, inbox envelope source handling, daemon forwarding to /api/hooks/execute with source droid, and Droid-specific success/failure exit behavior.
Validation:
Summary by CodeRabbit
New Features
Documentation