use crate::commands::read;
use crate::core::session;
use anyhow::{Context, Result};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct GeminiPayload {
file_path: String,
}
pub fn handle(stdin_payload: &str) -> Result<String> {
let p: GeminiPayload =
serde_json::from_str(stdin_payload).context("expected { \"file_path\": ... }")?;
if std::env::var_os("DRIP_DISABLE").is_some() {
let resolved = session::resolve_path(&p.file_path);
return std::fs::read_to_string(&resolved)
.with_context(|| format!("reading {}", resolved.display()));
}
read::run(&p.file_path)
}