Skip to main content

alef_core/config/
output.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value as JsonValue;
3use std::collections::HashMap;
4use std::path::PathBuf;
5
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7pub struct ExcludeConfig {
8    #[serde(default)]
9    pub types: Vec<String>,
10    #[serde(default)]
11    pub functions: Vec<String>,
12    /// Exclude specific methods: "TypeName.method_name"
13    #[serde(default)]
14    pub methods: Vec<String>,
15}
16
17#[derive(Debug, Clone, Default, Serialize, Deserialize)]
18pub struct IncludeConfig {
19    #[serde(default)]
20    pub types: Vec<String>,
21    #[serde(default)]
22    pub functions: Vec<String>,
23}
24
25#[derive(Debug, Clone, Default, Serialize, Deserialize)]
26pub struct OutputConfig {
27    pub python: Option<PathBuf>,
28    pub node: Option<PathBuf>,
29    pub ruby: Option<PathBuf>,
30    pub php: Option<PathBuf>,
31    pub elixir: Option<PathBuf>,
32    pub wasm: Option<PathBuf>,
33    pub ffi: Option<PathBuf>,
34    pub go: Option<PathBuf>,
35    pub java: Option<PathBuf>,
36    pub csharp: Option<PathBuf>,
37    pub r: Option<PathBuf>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct ScaffoldConfig {
42    pub description: Option<String>,
43    pub license: Option<String>,
44    pub repository: Option<String>,
45    pub homepage: Option<String>,
46    #[serde(default)]
47    pub authors: Vec<String>,
48    #[serde(default)]
49    pub keywords: Vec<String>,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct ReadmeConfig {
54    pub template_dir: Option<PathBuf>,
55    pub snippets_dir: Option<PathBuf>,
56    /// Deprecated: path to an external YAML config file. Prefer inline fields below.
57    pub config: Option<PathBuf>,
58    pub output_pattern: Option<String>,
59    /// Discord invite URL used in README templates.
60    pub discord_url: Option<String>,
61    /// Banner image URL used in README templates.
62    pub banner_url: Option<String>,
63    /// Per-language README configuration, keyed by language code
64    /// (e.g. "python", "typescript", "ruby"). Values are flexible JSON objects
65    /// that map directly to minijinja template context variables.
66    #[serde(default)]
67    pub languages: HashMap<String, JsonValue>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct LintConfig {
72    pub format: Option<String>,
73    pub check: Option<String>,
74    pub typecheck: Option<String>,
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize, Default)]
78pub struct TestConfig {
79    /// Command to run unit/integration tests for this language.
80    pub command: Option<String>,
81    /// Command to run e2e tests for this language.
82    pub e2e: Option<String>,
83}
84
85/// A single text replacement rule for version sync.
86#[derive(Debug, Clone, Serialize, Deserialize)]
87pub struct TextReplacement {
88    /// Glob pattern for files to process.
89    pub path: String,
90    /// Regex pattern to search for (may contain `{version}` placeholder).
91    pub search: String,
92    /// Replacement string (may contain `{version}` placeholder).
93    pub replace: String,
94}
95
96/// Configuration for the `sync-versions` command.
97#[derive(Debug, Clone, Serialize, Deserialize, Default)]
98pub struct SyncConfig {
99    /// Extra file paths to update version in (glob patterns).
100    #[serde(default)]
101    pub extra_paths: Vec<String>,
102    /// Arbitrary text replacements applied during version sync.
103    #[serde(default)]
104    pub text_replacements: Vec<TextReplacement>,
105}