Expand description
§monochange_config
monochange_config parses and validates the inputs that drive planning and release commands.
Reach for this crate when you need to load monochange.toml, resolve package references, or turn .changeset/*.md files into validated change signals for the planner.
§Why use it?
- centralize config parsing and validation rules in one place
- resolve package references against discovered workspace packages
- keep CLI command definitions, version groups, and change files aligned with the planner’s expectations
§Best for
- validating configuration before handing it to planning code
- parsing and resolving change files in custom automation
- keeping package-reference rules consistent across tools
§Public entry points
load_workspace_configuration(root)loads and validatesmonochange.tomlload_change_signals(root, changes_dir, packages)parses markdown change files into change signalsresolve_package_reference(reference, workspace_root, packages)maps package names, ids, and paths to discovered packagesapply_version_groups(packages, configuration)attaches configured version groups to discovered packages
§Responsibilities
- load
monochange.toml - validate version groups and CLI commands
- resolve package references against discovered packages
- parse change-input files, evidence, release-note
type/detailsfields, changelog paths, changelog format overrides, source-provider config, affected-package policy config, and command release/manifest/policy steps
§Example
use monochange_config::load_workspace_configuration;
use monochange_core::ChangelogFormat;
let root = std::env::temp_dir().join("monochange-config-changelog-format-docs");
let _ = std::fs::remove_dir_all(&root);
std::fs::create_dir_all(root.join("crates/core")).unwrap();
std::fs::write(
root.join("crates/core/Cargo.toml"),
"[package]\nname = \"core\"\nversion = \"1.0.0\"\n",
)
.unwrap();
std::fs::write(
root.join("monochange.toml"),
r#"
[defaults]
package_type = "cargo"
[defaults.changelog]
path = "{{ path }}/CHANGELOG.md"
format = "keep_a_changelog"
[package.core]
path = "crates/core"
"#,
)
.unwrap();
let configuration = load_workspace_configuration(&root).unwrap();
let package = configuration.package_by_id("core").unwrap();
assert_eq!(configuration.defaults.changelog_format, ChangelogFormat::KeepAChangelog);
assert_eq!(package.changelog.as_ref().unwrap().format, ChangelogFormat::KeepAChangelog);
assert_eq!(package.changelog.as_ref().unwrap().path, std::path::PathBuf::from("crates/core/CHANGELOG.md"));
let _ = std::fs::remove_dir_all(&root);Modules§
- lints
- Changeset lint suite for monochange.
Structs§
Constants§
Functions§
- apply_
version_ groups - Apply configured version groups to discovered packages.
- build_
changeset_ load_ context - Build reusable lookup tables for loading many
.changeset/*.mdfiles. - config_
path - Return the canonical
monochange.tomlpath underroot. - load_
change_ signals - Load change signals from one
.changeset/*.mdfile. - load_
changeset_ contents_ with_ context - Parse already-loaded changeset text with the shared lookup context.
- load_
changeset_ file - Load one
.changeset/*.mdfile into the structured changeset model. - load_
changeset_ file_ with_ context - Load a changeset file with precomputed package/group indexes.
- load_
workspace_ configuration - Load and fully validate
monochange.tomlforroot. - resolve_
package_ reference - Resolve a package reference without a pre-built context.
- validate_
versioned_ files_ content - Validate that versioned file paths exist on disk, ecosystem-typed files contain a readable version field, and regex patterns match actual file content. Returns a list of non-fatal warnings (e.g. empty glob matches).
- validate_
workspace - Validate configured changesets and their targets for
root.