feature-manifest 0.2.0

Document, validate, and render Cargo feature metadata.
Documentation

feature-manifest

feature-manifest is a Rust crate plus Cargo subcommand for documenting, validating, and rendering Cargo feature flags.

It gives crate authors a structured layer on top of [features], so feature intent can live in Cargo.toml while still powering docs, CI, editor tooling, workspace audits, and release automation.

Why it exists

Cargo features are powerful, but feature intent is often trapped in a raw [features] table. feature-manifest helps maintainers:

  • keep every feature documented in one place,
  • fail CI when metadata drifts out of sync,
  • scaffold missing metadata automatically,
  • generate Markdown for docs and READMEs,
  • emit stable JSON and SARIF for tooling,
  • visualize feature relationships with Mermaid,
  • work across whole Cargo workspaces.

Installation

From crates.io:

cargo install feature-manifest

This installs the cargo-feature-manifest binary, which you invoke as cargo feature-manifest.

From source:

git clone https://github.com/funwithcthulhu/feature-manifest.git
cd feature-manifest
cargo install --path .

Commands

cargo feature-manifest check
cargo feature-manifest check --format json
cargo feature-manifest markdown --write FEATURES.md
cargo feature-manifest markdown --insert-into README.md
cargo feature-manifest json
cargo feature-manifest graph
cargo feature-manifest sync
cargo feature-manifest explain <feature>
cargo feature-manifest list-lints

The default command is check, so cargo feature-manifest is valid shorthand.

Quick Workflow

  1. Add or change features in Cargo.toml.
  2. Run cargo feature-manifest sync to scaffold missing metadata.
  3. Fill in real descriptions, visibility, and status flags.
  4. Run cargo feature-manifest check locally and in CI.
  5. Generate docs with markdown, or inject them into README.md.

Workspace Support

Point the tool at a workspace root or a single crate:

cargo feature-manifest --workspace check --manifest-path path/to/workspace
cargo feature-manifest --package my-crate explain serde --manifest-path path/to/workspace
cargo feature-manifest markdown --manifest-path path/to/crate

When a workspace has multiple members, the default behavior is intentionally strict: you must choose --workspace or --package <name>.

Markdown Output and Injection

Write a generated document directly:

cargo feature-manifest markdown --write FEATURES.md

Inject generated Markdown into an existing README using markers:

<!-- feature-manifest:start -->
<!-- feature-manifest:end -->

Then run:

cargo feature-manifest markdown --insert-into README.md

Custom markers are supported with --start-marker and --end-marker.

Validation Output Formats

check supports multiple output formats:

  • text: default human-readable output
  • json: machine-readable structured report
  • github: GitHub Actions workflow commands
  • sarif: SARIF 2.1.0 for code scanning pipelines

Example:

cargo feature-manifest check --format sarif > feature-manifest.sarif

Lint Configuration

Feature-manifest lints can be configured in Cargo.toml:

[package.metadata.feature-manifest.lints]
missing-description = "deny"
small-group = "allow"
private-enabled-by-public = "warn"

You can also override them per-run:

cargo feature-manifest check --lint missing-description=warn

See docs/metadata-format.md for the full list of lint names and meanings.

More Documentation

Fixtures and Tests

The repo includes valid Cargo fixtures for both single-package and workspace flows:

The test suite includes:

  • unit tests for parsing and validation,
  • integration tests for CLI workflows,
  • snapshot tests for Markdown, JSON, and Mermaid output.

Run everything with:

cargo test

Publish Readiness

Before publishing:

cargo fmt
cargo test
cargo publish --dry-run

For the project’s automated release flow, see docs/releasing.md.

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license