1use std::path::{Path, PathBuf};
7
8use super::tool::{MergeStrategy, Tool};
9use crate::error::Result;
10
11#[derive(Debug)]
13pub struct DetectionResult {
14 pub tool: Tool,
15 pub detected: bool,
16 pub reason: String,
17 pub existing_file: Option<PathBuf>,
18}
19
20#[derive(Debug)]
22pub struct BootstrapContext<'a> {
23 pub project_root: &'a Path,
24 pub tool: Tool,
25}
26
27pub trait ToolAdapter: Send + Sync {
29 fn tool(&self) -> Tool;
31
32 fn detect(&self, project_root: &Path) -> DetectionResult;
34
35 fn generate(&self, context: &BootstrapContext) -> Result<String>;
37
38 fn validate(&self, content: &str) -> Result<()> {
40 let _ = content;
41 Ok(())
42 }
43
44 fn merge_strategy(&self) -> MergeStrategy {
46 MergeStrategy::Section
47 }
48
49 fn section_markers(&self) -> (&'static str, &'static str) {
51 (
52 "<!-- BEGIN ACP GENERATED CONTENT - DO NOT EDIT -->",
53 "<!-- END ACP GENERATED CONTENT -->",
54 )
55 }
56}