acp/sync/adapters/
windsurf.rs

1//! Windsurf adapter
2
3use std::path::Path;
4
5use crate::error::Result;
6use crate::sync::adapter::{BootstrapContext, DetectionResult, ToolAdapter};
7use crate::sync::content::generate_bootstrap_markdown;
8use crate::sync::tool::Tool;
9
10/// Windsurf adapter - generates .windsurfrules
11pub struct WindsurfAdapter;
12
13impl ToolAdapter for WindsurfAdapter {
14    fn tool(&self) -> Tool {
15        Tool::Windsurf
16    }
17
18    fn detect(&self, project_root: &Path) -> DetectionResult {
19        let rules_file = project_root.join(".windsurfrules");
20        let windsurf_dir = project_root.join(".windsurf");
21
22        DetectionResult {
23            tool: Tool::Windsurf,
24            detected: rules_file.exists() || windsurf_dir.exists(),
25            reason: if rules_file.exists() {
26                ".windsurfrules exists".into()
27            } else if windsurf_dir.exists() {
28                ".windsurf/ directory exists".into()
29            } else {
30                "Not detected".into()
31            },
32            existing_file: if rules_file.exists() {
33                Some(rules_file)
34            } else {
35                None
36            },
37        }
38    }
39
40    fn generate(&self, _context: &BootstrapContext) -> Result<String> {
41        Ok(generate_bootstrap_markdown(Tool::Windsurf))
42    }
43}