acp/sync/adapters/
cline.rs1use 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
10pub struct ClineAdapter;
12
13impl ToolAdapter for ClineAdapter {
14 fn tool(&self) -> Tool {
15 Tool::Cline
16 }
17
18 fn detect(&self, project_root: &Path) -> DetectionResult {
19 let rules_file = project_root.join(".clinerules");
20
21 DetectionResult {
22 tool: Tool::Cline,
23 detected: rules_file.exists(),
24 reason: if rules_file.exists() {
25 ".clinerules exists".into()
26 } else {
27 "Not detected".into()
28 },
29 existing_file: if rules_file.exists() {
30 Some(rules_file)
31 } else {
32 None
33 },
34 }
35 }
36
37 fn generate(&self, _context: &BootstrapContext) -> Result<String> {
38 let mut content = generate_bootstrap_markdown(Tool::Cline);
40
41 content.push_str("\n## Cline MCP Integration\n\n");
42 content.push_str("If MCP is configured, the `acp_*` tools are available.\n");
43 content.push_str("Always call `acp_check_constraints` before modifying files.\n");
44
45 Ok(content)
46 }
47}