1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! # ironflow-templates
//!
//! Template system for the [ironflow](https://gitlab.com/ThomasTartrau/ironflow)
//! workflow engine, inspired by [shadcn/ui](https://ui.shadcn.com).
//!
//! Templates are workflow handlers hosted in external Git repositories.
//! Instead of installing them as dependencies, `ironflow-cli template add`
//! copies the source files directly into your project -- you own the code
//! and can customize it freely.
//!
//! # Template format
//!
//! A template repository contains one or more template directories, each
//! with a `template.toml` manifest and a `src/` folder:
//!
//! ```text
//! my-templates/
//! ci-pipeline/
//! template.toml
//! src/
//! ci_pipeline.rs
//! code-review/
//! template.toml
//! src/
//! code_review.rs
//! ```
//!
//! A repository dedicated to one template can keep `template.toml` and
//! `src/` at its root instead:
//!
//! ```text
//! gitlab-mr-review/
//! template.toml
//! src/
//! mod.rs
//! ```
//!
//! `template.toml` may also declare a `[requirements]` section (environment
//! variables, workflow secrets, tools expected in the runner image, notes),
//! printed after installation.
//!
//! # Quick start
//!
//! ```no_run
//! use std::path::Path;
//! use ironflow_templates::registry::discover_templates;
//!
//! # fn example() -> Result<(), ironflow_templates::error::TemplateError> {
//! let templates = discover_templates(Path::new("./my-templates"))?;
//! for (name, (manifest, _dir)) in &templates {
//! println!("{name}: {}", manifest.template.description);
//! }
//! # Ok(())
//! # }
//! ```