This document provides guidance for AI assistants working with the conflow codebase.
conflow is a Configuration Flow Orchestrator that intelligently orchestrates CUE, Nickel, and configuration validation workflows.
- Pipeline: A sequence of stages defined in
.conflow.yaml - Stage: A single step that runs a tool (CUE, Nickel, or shell)
- Executor: Implements tool-specific execution logic
- Cache: Content-addressed caching to avoid redundant work
- RSR Integration: Rhodium Standard Repository compliance checking
src/
├── main.rs # CLI entry point
├── lib.rs # Library exports
├── cli/ # Command handlers
│ ├── mod.rs # CLI definitions (clap)
│ ├── init.rs # `conflow init`
│ ├── analyze.rs # `conflow analyze`
│ ├── run.rs # `conflow run`
│ ├── validate.rs # `conflow validate`
│ ├── watch.rs # `conflow watch`
│ ├── graph.rs # `conflow graph`
│ ├── cache.rs # `conflow cache`
│ └── rsr.rs # `conflow rsr`
├── pipeline/ # Pipeline orchestration
│ ├── definition.rs # Pipeline, Stage, Tool types
│ ├── dag.rs # Dependency graph
│ ├── executor.rs # Pipeline execution
│ └── validation.rs # Pipeline validation
├── executors/ # Tool executors
│ ├── cue.rs # CUE executor
│ ├── nickel.rs # Nickel executor
│ └── shell.rs # Shell executor
├── cache/ # Caching system
│ ├── filesystem.rs # File-based cache
│ └── hash.rs # Content hashing (BLAKE3)
├── analyzer/ # Config analysis
│ ├── complexity.rs # Complexity metrics
│ ├── config_detector.rs # Format detection
│ └── recommender.rs # Tool recommendations
├── rsr/ # RSR integration
│ ├── compliance.rs # Compliance checking
│ ├── requirements.rs # RSR requirements
│ ├── schemas.rs # Schema registry
│ ├── hooks.rs # External integration
│ ├── remediation.rs # Auto-fix
│ ├── badges.rs # Badge generation
│ ├── diff.rs # Compliance diffs
│ ├── config.rs # .rsr.yaml loading
│ └── templates.rs # Template generation
├── errors/ # Error handling
│ ├── mod.rs # Error types (miette)
│ └── educational.rs # Helpful error messages
└── utils/ # Utilities
├── colors.rs # Terminal colors
└── spinner.rs # Progress indicators
version: "1"
name: pipeline-name
stages:
- name: stage-name
tool:
type: cue | nickel | shell
command: vet | export | eval | <shell-command>
# Tool-specific options...
input: <glob-pattern> | from_stage: <stage-name>
output: <path>
depends_on: [<stage-names>]
description: Optional description
cache:
enabled: true
directory: .conflow-cache// Pipeline definition (src/pipeline/definition.rs)
pub struct Pipeline {
pub version: String,
pub name: String,
pub stages: Vec<Stage>,
pub cache: Option<CacheConfig>,
}
// Stage definition
pub struct Stage {
pub name: String,
pub tool: Tool,
pub input: Input,
pub output: Option<Output>,
pub depends_on: Vec<String>,
pub description: Option<String>,
}
// Tool variants
pub enum Tool {
Cue { command: CueCommand, schemas: Vec<PathBuf>, ... },
Nickel { command: NickelCommand, format: OutputFormat, ... },
Shell { command: String, shell: Option<String> },
}cargo build # Debug build
cargo build --release # Release build
cargo test # Run tests
cargo clippy # Lint
cargo fmt # Format- Unit tests:
cargo test - Integration tests:
cargo test --test '*' - Specific test:
cargo test test_name
- Create
src/executors/new_tool.rs - Implement
Executortrait - Add to
src/executors/mod.rs - Add
Tool::NewToolvariant insrc/pipeline/definition.rs - Handle in executor dispatch
- Add variant to
Commandsenum insrc/cli/mod.rs - Create
src/cli/command.rswithrun()function - Add dispatch in
src/main.rs
- Use
cargo fmtfor formatting - Add SPDX headers to all source files
- Document public APIs
- Handle errors explicitly (no
.unwrap()in library code) - Prefer
miettefor user-facing errors
use conflow::pipeline::{Pipeline, PipelineExecutor, ExecutionOptions};
let pipeline = Pipeline::from_file(".conflow.yaml")?;
let executor = PipelineExecutor::new(pipeline);
let results = executor.run(ExecutionOptions::default()).await?;use conflow::rsr::ComplianceChecker;
let checker = ComplianceChecker::new();
let report = checker.check(project_root)?;
println!("Level: {:?}, Score: {:.0}%", report.level, report.score * 100.0);use conflow::rsr::TemplateGenerator;
let generator = TemplateGenerator::new();
let result = generator.generate("kubernetes", target_dir, &variables)?;This project aims for RSR Silver compliance:
- Nix flake for reproducible builds
- Justfile for task running
- Dual MIT/Apache-2.0 license
- Comprehensive documentation
- TPCF contribution framework
- Security policy
- Code of Conduct
- CUE/Nickel not found: Ensure they're in PATH or use Nix
- Cache issues: Run
conflow cache clear - Pipeline validation errors: Check
conflow validate
RUST_LOG=conflow=debug conflow run- Repository: https://gitlab.com/hyperpolymath/conflow
- RSR Standards: https://gitlab.com/hyperpolymath/rhodium-standard-repositories
- CUE: https://cuelang.org
- Nickel: https://nickel-lang.org
This file follows RSR standards for AI assistant guidance.