Skip to main content

Crate cuenv_codeowners

Crate cuenv_codeowners 

Source
Expand description

Generate CODEOWNERS files with configurable formatting.

This crate provides a builder-based API for generating CODEOWNERS files that define code ownership rules for your repository. It is provider-agnostic; platform-specific logic (paths, section styles) belongs in provider crates like cuenv-github or cuenv-gitlab.

§Example

use cuenv_codeowners::{CodeOwners, SectionStyle, Rule};

let codeowners = CodeOwners::builder()
    .section_style(SectionStyle::Comment)  // GitHub/Bitbucket style
    .rule(Rule::new("*", ["@org/core-team"]))
    .rule(Rule::new("*.rs", ["@rust-team"]))
    .rule(Rule::new("/docs/**", ["@docs-team"]).section("Documentation"))
    .build();

let content = codeowners.generate();

§Section Styles

  • Comment: # Section Name (used by GitHub, Bitbucket)
  • Bracket: [Section Name] (used by GitLab)
  • None: No section headers

§Provider Support

The provider module provides a trait-based abstraction for syncing CODEOWNERS files. Provider implementations live in platform crates.

§Features

  • serde: Enable serde serialization/deserialization for all types
  • schemars: Enable JSON Schema generation (implies serde)

Modules§

provider
CODEOWNERS sync providers.

Structs§

CodeOwners
CODEOWNERS file configuration and generator.
CodeOwnersBuilder
Builder for CodeOwners.
Rule
A single code ownership rule.

Enums§

SectionStyle
Section formatting style for CODEOWNERS files.

Constants§

DEFAULT_CUENV_HEADER
Default cuenv header for generated CODEOWNERS files.