diff --git a/src/init.rs b/src/init.rs index 494bef34..1a30ecb0 100644 --- a/src/init.rs +++ b/src/init.rs @@ -298,7 +298,6 @@ fn prepare_hook_paths() -> Result<(PathBuf, PathBuf)> { } /// Write hook file if missing or outdated, return true if changed -#[cfg(unix)] fn ensure_hook_installed(hook_path: &Path, verbose: u8) -> Result { let changed = if hook_path.exists() { let existing = fs::read_to_string(hook_path) @@ -326,10 +325,12 @@ fn ensure_hook_installed(hook_path: &Path, verbose: u8) -> Result { true }; - // Set executable permissions - use std::os::unix::fs::PermissionsExt; - fs::set_permissions(hook_path, fs::Permissions::from_mode(0o755)) - .with_context(|| format!("Failed to set hook permissions: {}", hook_path.display()))?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + fs::set_permissions(hook_path, fs::Permissions::from_mode(0o755)) + .with_context(|| format!("Failed to set hook permissions: {}", hook_path.display()))?; + } // Store SHA-256 hash for runtime integrity verification. // Always store (idempotent) to ensure baseline exists even for @@ -862,20 +863,6 @@ fn hook_already_present(root: &serde_json::Value, hook_command: &str) -> bool { } /// Default mode: hook + slim RTK.md + @RTK.md reference -#[cfg(not(unix))] -fn run_default_mode( - _global: bool, - _patch_mode: PatchMode, - _verbose: u8, - _install_opencode: bool, -) -> Result<()> { - eprintln!("[warn] Hook-based mode requires Unix (macOS/Linux)."); - eprintln!(" Windows: use --claude-md mode for full injection."); - eprintln!(" Falling back to --claude-md mode."); - run_claude_md_mode(_global, _verbose, _install_opencode) -} - -#[cfg(unix)] fn run_default_mode( global: bool, patch_mode: PatchMode, @@ -1009,17 +996,6 @@ fn generate_global_filters_template(verbose: u8) -> Result<()> { } /// Hook-only mode: just the hook, no RTK.md -#[cfg(not(unix))] -fn run_hook_only_mode( - _global: bool, - _patch_mode: PatchMode, - _verbose: u8, - _install_opencode: bool, -) -> Result<()> { - anyhow::bail!("Hook install requires Unix (macOS/Linux). Use WSL or --claude-md mode.") -} - -#[cfg(unix)] fn run_hook_only_mode( global: bool, patch_mode: PatchMode,