Skip to main content

captain_config/
lib.rs

1//! Captain configuration types.
2//!
3//! This is a separate crate so build.rs can generate schemas from these types.
4
5/// Configuration read from `.config/captain/config.styx`
6#[derive(Debug, Clone, facet::Facet)]
7#[facet(derive(Default), traits(Default))]
8#[facet(rename_all = "kebab-case")]
9pub struct CaptainConfig {
10    /// Configuration for pre-commit hooks.
11    #[facet(default)]
12    pub pre_commit: PreCommitConfig,
13
14    /// Configuration for pre-push hooks.
15    #[facet(default)]
16    pub pre_push: PrePushConfig,
17}
18
19/// Configuration for pre-commit hooks.
20#[derive(Debug, Clone, facet::Facet)]
21#[facet(rename_all = "kebab-case", traits(Default), derive(Default))]
22pub struct PreCommitConfig {
23    /// Deprecated: README generation has been removed from captain.
24    /// If enabled, captain will print a recommendation to use `cargo-reedme`.
25    #[facet(default = false)]
26    pub generate_readmes: bool,
27
28    /// Format staged Rust files with `rustfmt`.
29    #[facet(default = true)]
30    pub rustfmt: bool,
31
32    /// Stage `Cargo.lock` changes automatically.
33    #[facet(default = true)]
34    pub cargo_lock: bool,
35
36    /// Create `arborium-header.html` files for enhanced rustdoc syntax highlighting.
37    #[facet(default = true)]
38    pub arborium: bool,
39
40    /// Require Rust edition 2024 in all workspace crates.
41    #[facet(default = true)]
42    pub edition_2024: bool,
43
44    /// Check for path dependencies pointing outside the workspace.
45    /// These are typically local development overrides that should not be committed.
46    #[facet(default = true)]
47    pub external_path_deps: bool,
48
49    /// Check for internal dev-dependencies that can break release-plz.
50    #[facet(default = true)]
51    pub internal_dev_deps_release_plz: bool,
52}
53
54/// Configuration for pre-push hooks.
55#[derive(Debug, Clone, facet::Facet)]
56#[facet(rename_all = "kebab-case", traits(Default), derive(Default))]
57pub struct PrePushConfig {
58    /// Run `cargo clippy` with warnings as errors.
59    #[facet(default = true)]
60    pub clippy: bool,
61
62    /// Features to pass to clippy. If `None`, uses `--all-features`.
63    #[facet(default)]
64    pub clippy_features: Option<Vec<String>>,
65
66    /// Run tests via `cargo nextest`.
67    #[facet(default = true)]
68    pub nextest: bool,
69
70    /// Run documentation tests via `cargo test --doc`.
71    #[facet(default = false)]
72    pub doc_tests: bool,
73
74    /// Features to pass to doc tests. If `None`, uses `--all-features`.
75    #[facet(default)]
76    pub doc_test_features: Option<Vec<String>>,
77
78    /// Build documentation with `cargo doc` and treat warnings as errors.
79    #[facet(default = true)]
80    pub docs: bool,
81
82    /// Features to pass to rustdoc. If `None`, uses `--all-features`.
83    #[facet(default)]
84    pub docs_features: Option<Vec<String>>,
85
86    /// Check for unused dependencies with `cargo-shear`.
87    #[facet(default = true)]
88    pub cargo_shear: bool,
89}