use anyhow::{bail, Result};
use crate::install::cursor_config::plan::{CursorConfigPlan, CursorOperation};
use crate::install::cursor_config::writer::apply_plan;
pub(in crate::install) use crate::install::cursor_config::{
cursor_detected, cursor_renderer_supported, CURSOR_HOOK_FAILURE_POLICY_LINE,
CURSOR_SESSION_INIT_LINE,
};
pub(in crate::install) const CURSOR_AUTO_SKIP_DIAGNOSTIC: &str =
"cursor: skipped (no approved hook command renderer on this platform); \
Claude/Codex hosts continue unaffected";
pub(in crate::install) fn preflight(
operation: CursorOperation,
bin: &str,
) -> Result<CursorConfigPlan> {
if !cursor_renderer_supported() {
bail!(
"cursor host is unsupported on this platform (no approved hook command renderer); \
no host was modified (code=platform_unsupported)"
);
}
CursorConfigPlan::build(operation, bin)
}
pub(in crate::install) fn apply(operation: CursorOperation, bin: &str) -> Result<CursorConfigPlan> {
let plan = preflight(operation, bin)?;
apply_plan(&plan)?;
Ok(plan)
}