qqq-cli 0.12.0

Local-first task queue for coding agent sessions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde_json::Value;
use std::process::Output;

/// A valid next response exits 1 for no pickup, otherwise 0.
pub fn json(output: Output) -> Value {
    assert!(
        output.stderr.is_empty(),
        "{}",
        String::from_utf8_lossy(&output.stderr)
    );
    let task: Value = serde_json::from_slice(&output.stdout).expect("JSON next response");
    assert_eq!(
        output.status.code(),
        Some(if task.is_null() { 1 } else { 0 })
    );
    task
}