1use std::path::PathBuf;
6
7use gen_types::{
8 Adapter, AdapterCtx, AdapterError, AdapterResult, ConfirmReport, DiffRef, DiffReport,
9 LockOutcome, Plan, PlanIntent, Sbom, SbomFormat,
10};
11
12pub struct HelmAdapter;
13
14impl Adapter for HelmAdapter {
15 fn name(&self) -> &'static str { "helm" }
16 fn manifest_files(&self) -> &'static [&'static str] { &["Chart.yaml"] }
17
18 fn lock(&self, _ctx: &AdapterCtx) -> AdapterResult<LockOutcome> {
19 Err(AdapterError::Unsupported("helm lock not implemented".into()))
20 }
21
22 fn build(&self, _ctx: &AdapterCtx) -> AdapterResult<gen_types::AdapterBuildSpec> {
23 Err(AdapterError::Unsupported("helm build not implemented".into()))
24 }
25
26 fn plan(&self, _ctx: &AdapterCtx, _intent: &PlanIntent) -> AdapterResult<Plan> {
27 Err(AdapterError::Unsupported("helm plan not implemented".into()))
28 }
29
30 fn confirm(&self, _ctx: &AdapterCtx) -> AdapterResult<ConfirmReport> {
31 Err(AdapterError::Unsupported("helm confirm not implemented".into()))
32 }
33
34 fn diff(&self, _ctx: &AdapterCtx, _against: &DiffRef) -> AdapterResult<DiffReport> {
35 Err(AdapterError::Unsupported("helm diff not implemented".into()))
36 }
37
38 fn sbom(&self, _ctx: &AdapterCtx, _format: SbomFormat) -> AdapterResult<Sbom> {
39 Err(AdapterError::Unsupported("helm sbom not implemented".into()))
40 }
41
42 fn quirks_registry(&self) -> Vec<gen_types::AdapterQuirkEntry> {
43 use gen_types::QuirkRegistry;
44 <crate::quirks::HelmQuirks as QuirkRegistry>::registry()
45 .into_iter()
46 .map(|(p, qs)| gen_types::AdapterQuirkEntry {
47 package: p.to_string(),
48 quirks: qs.into_iter().filter_map(|q| serde_json::to_value(&q).ok()).collect(),
49 })
50 .collect()
51 }
52
53 fn dispatcher_reflection(&self) -> Vec<gen_types::DispatcherVariant> {
54 use gen_types::TypedDispatcher;
55 <crate::quirks::HelmQuirk as TypedDispatcher>::variant_fields()
56 .into_iter()
57 .map(|(kind, fields)| gen_types::DispatcherVariant {
58 kind: kind.to_string(),
59 fields: fields.into_iter().map(str::to_string).collect(),
60 })
61 .collect()
62 }
63}
64
65pub fn ctx_for(workspace_root: PathBuf) -> AdapterCtx {
66 AdapterCtx { workspace_root, target: None }
67}
68
69inventory::submit! {
73 gen_types::AdapterRegistration {
74 make: || Box::new(HelmAdapter),
75 name: "helm",
76 }
77}