Skip to main content

helm_schema_cli/cli/
mod.rs

1mod chart_args;
2mod crd_args;
3mod diag_args;
4mod emission_args;
5mod inference_args;
6mod k8s_args;
7mod output_args;
8mod perf_args;
9mod profile_args;
10
11use std::path::PathBuf;
12
13use clap::Parser;
14
15pub use chart_args::ChartArgs;
16pub use crd_args::{CrdArgs, CrdVersionLookup};
17pub use diag_args::{DiagArgs, DiagFormat};
18pub use emission_args::{EmissionArgs, PolicyToggle};
19pub use inference_args::InferenceArgs;
20pub use k8s_args::{DEFAULT_AUTO_WINDOW, K8sArgs, K8sVersionFallback};
21pub use output_args::OutputArgs;
22pub use perf_args::PerfArgs;
23pub use profile_args::SchemaProfile;
24
25/// Complete command-line interface for one schema-generation invocation.
26#[derive(Parser, Debug, Clone)]
27#[command(
28    name = "helm-schema",
29    about = "Generate JSON schema for Helm values.yaml",
30    after_long_help = "EMISSION RETENTION:\n  full  keeps mandatory facts, root/local ordinary conditionals, terminal clauses,\n        and kind partitions.\n  lean  keeps every mandatory fact and every locally anchored ordinary conditional;\n        it drops root-anchored ordinary conditionals, terminal clauses, and kind\n        partitions.\n\nMandatory facts cannot be disabled. The four emission override flags only change\nW-class refinements and therefore only widen acceptance when switched off."
31)]
32pub struct Cli {
33    /// Chart directory or packaged chart archive to analyze.
34    #[arg(value_name = "CHART_DIR")]
35    pub chart_dir: PathBuf,
36
37    /// Final output and reference-processing options.
38    #[command(flatten)]
39    pub output: OutputArgs,
40
41    /// Kubernetes schema source and version options.
42    #[command(flatten)]
43    pub k8s: K8sArgs,
44
45    /// CRD schema source and lookup options.
46    #[command(flatten)]
47    pub crd: CrdArgs,
48
49    /// API-version inference options.
50    #[command(flatten)]
51    pub inference: InferenceArgs,
52
53    /// Runtime diagnostic formatting options.
54    #[command(flatten)]
55    pub diag: DiagArgs,
56
57    /// Chart discovery and values-composition options.
58    #[command(flatten)]
59    pub chart: ChartArgs,
60
61    /// Performance tracing options.
62    #[command(flatten)]
63    pub perf: PerfArgs,
64
65    /// Read policy from this file instead of discovering `helm-schema.yaml`.
66    /// Relative paths are resolved from the invocation working directory.
67    #[arg(long, value_name = "PATH", conflicts_with = "no_config")]
68    pub config: Option<PathBuf>,
69
70    /// Ignore both discovered and explicit chart policy configuration.
71    #[arg(long, conflicts_with = "config")]
72    pub no_config: bool,
73
74    /// Print resolved policy values and their sources without analyzing the chart.
75    #[arg(long)]
76    pub print_effective_config: bool,
77
78    /// Select how much analyzed contract evidence is emitted.
79    ///
80    /// `lean` retains mandatory and locally anchored ordinary facts. It drops
81    /// root ordinary conditionals, terminals, and kind partitions, so it only
82    /// widens acceptance while reducing Helm's schema compilation cost.
83    #[arg(long, value_enum)]
84    pub profile: Option<SchemaProfile>,
85
86    /// W-class emission-policy overrides.
87    #[command(flatten)]
88    pub emission: EmissionArgs,
89
90    /// Schema files to merge on top of the inferred output, applied in
91    /// the order given. Repeatable: pass multiple `--override-schema`
92    /// flags to layer (e.g. a shared cross-chart top-level schema followed by
93    /// a chart-specific override). Overrides must carry their own definitions
94    /// rather than reference helm-schema's private `$defs` names.
95    #[arg(long)]
96    pub override_schema: Vec<PathBuf>,
97}