diff options
| author | Enrico Carlesso <enricocarlesso@gmail.com> | 2026-07-24 12:05:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-24 22:05:20 +0300 |
| commit | e9b22084e03880f43d1f1daaf5d9f45c717b77c4 (patch) | |
| tree | 343c3099fcb0b935f857b7eb00df1e4d9c83d609 /src/cli/integration.rs | |
| parent | b56baee9d60a002b5d8c0fe74d5032afad27ef30 (diff) | |
feat: add grok cli integration for native session restore (#1807)
* feat: add grok cli integration for native session restore
tl;dr: adds `herdr integration install grok` (session-identity tier: a
SessionStart hook reports the grok session id for native restore; state
stays screen-detected via the bundled manifest).
Grok merges every ~/.grok/hooks/*.json, so install writes a
self-contained hooks/herdr.json registering a SessionStart hook next to
hooks/herdr-agent-state.sh, and never touches other hook files. The hook
prefers $GROK_SESSION_ID (injected into every grok hook process) and
reports through the socket API; herdr:grok is a reserved-native-state
source so screen detection stays authoritative. Restore uses
`grok --resume <id>`. Additive JSON API change; no protocol bump; the
schema artifact is regenerated.
refs #1800
* fix: honor GROK_HOME and validate grok hook config in status
Review follow-ups: grok_dir now resolves GROK_CONFIG_DIR (herdr test
seam) before GROK_HOME (the grok CLI's own config-home override) before
~/.grok, so hook installs land where grok actually looks. Integration
status now also validates the herdr-owned hooks/herdr.json next to the
hook script — missing, corrupt, or no-longer-referencing configs report
the install as outdated instead of masking a hook grok never invokes.
refs #1800
* fix: validate the exact grok session hook command in status
The config validator matched on a filename substring, so a SessionStart
command like `echo herdr-agent-state.sh`, or one invoking the script
without the `session` action, still reported the integration as current
while grok never delivered a session id. Status now compares against the
exact command the installer writes, via a shared builder, and the
degradation tests cover both nonfunctional shapes.
refs #1800
* fix: require a command-type grok session hook in status validation
A config entry carrying the exact generated command under a non-command
hook type (e.g. "http") is never executed by grok, so it must not report
the integration as current. The validator now also requires
type = "command", with a degradation test for the mismatched-type shape.
refs #1800
* fix: validate the complete grok hook config
refs #1800
---------
Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/cli/integration.rs')
| -rw-r--r-- | src/cli/integration.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cli/integration.rs b/src/cli/integration.rs index c407278e..265bbf95 100644 --- a/src/cli/integration.rs +++ b/src/cli/integration.rs @@ -103,13 +103,13 @@ fn parse_integration_target( ) -> std::io::Result<Option<IntegrationTarget>> { let Some(target) = args.first().map(|arg| arg.as_str()) else { eprintln!( - "usage: herdr integration {action} <pi|omp|claude|codex|copilot|devin|droid|kimi|opencode|kilo|hermes|qodercli|cursor|mastracode>" + "usage: herdr integration {action} <pi|omp|claude|codex|copilot|devin|droid|kimi|opencode|kilo|hermes|qodercli|cursor|mastracode|grok>" ); return Ok(None); }; if args.len() != 1 { eprintln!( - "usage: herdr integration {action} <pi|omp|claude|codex|copilot|devin|droid|kimi|opencode|kilo|hermes|qodercli|cursor|mastracode>" + "usage: herdr integration {action} <pi|omp|claude|codex|copilot|devin|droid|kimi|opencode|kilo|hermes|qodercli|cursor|mastracode|grok>" ); return Ok(None); } @@ -129,10 +129,11 @@ fn parse_integration_target( "qodercli" => IntegrationTarget::Qodercli, "cursor" => IntegrationTarget::Cursor, "mastracode" => IntegrationTarget::Mastracode, + "grok" => IntegrationTarget::Grok, _ => { eprintln!("unknown integration target: {target}"); eprintln!( - "currently supported: pi, omp, claude, codex, copilot, devin, droid, kimi, opencode, kilo, hermes, qodercli, cursor, mastracode" + "currently supported: pi, omp, claude, codex, copilot, devin, droid, kimi, opencode, kilo, hermes, qodercli, cursor, mastracode, grok" ); return Ok(None); } @@ -157,6 +158,7 @@ fn print_integration_help() { eprintln!(" herdr integration install qodercli"); eprintln!(" herdr integration install cursor"); eprintln!(" herdr integration install mastracode"); + eprintln!(" herdr integration install grok"); eprintln!(" herdr integration uninstall pi"); eprintln!(" herdr integration uninstall omp"); eprintln!(" herdr integration uninstall claude"); @@ -171,5 +173,6 @@ fn print_integration_help() { eprintln!(" herdr integration uninstall qodercli"); eprintln!(" herdr integration uninstall cursor"); eprintln!(" herdr integration uninstall mastracode"); + eprintln!(" herdr integration uninstall grok"); eprintln!(" herdr integration status [--outdated-only]"); } |
