monochange_snapshot
monochange_snapshot owns normalized, framework-neutral snapshots for command and API surfaces that monochange can render, compare, and classify.
Reach for this crate when you need an agent-readable description of a CLI or another public surface without tying downstream tooling to a single command framework.
Why use it?
- keep snapshot wire contracts separate from CLI implementation details
- render deterministic JSON for assistant workflows, review snapshots, and semantic diffing
- extract clap command definitions through the first supported extractor while leaving room for other frameworks
- classify command, option, positional, and value-contract changes as semver-impacting differences
- cap release impact for unstable or intentionally non-contractual command trees with
max_bump
Version policy
Snapshot files carry a public schema_version value in the same major.minor style as other monochange durable schemas.
- The schema version is derived from the
monochange_snapshotcrate package version by dropping the patch component. - The unreleased crate version
0.0.0emits the first public snapshot schema version,0.1. - Crate version
0.1.0emits snapshot schema version0.1; crate version1.0.0emits1.0. - Patch releases of this crate do not change emitted snapshot schema versions.
- Future breaking snapshot schema changes should advance the crate's major or minor version and add explicit migration support before old snapshots are rejected.
Example
use Command;
use ClapCommandSurfaceExtractor;
use CommandSurfaceExtractor;
use SnapshotKind;
let command = new
.about
.subcommand;
let extractor = new;
let snapshot = extractor.extract;
assert_eq!;
assert_eq!;
Public entry points
CommandSnapshotis the normalized CLI snapshot wire shape.CommandNode::max_bumpcaps the release impact for changes at or below a command path.CommandSurfaceExtractoris the framework-neutral extraction trait.ClapCommandSurfaceExtractorextracts snapshots from clap command definitions.snapshot_from_clapprovides a convenience clap extraction function.diff_command_snapshotsclassifies snapshot-to-snapshot CLI surface changes.
Scope
- normalized CLI command, option, positional, and parser metadata
- deterministic JSON rendering for snapshot files
- clap-based extraction
- semver-oriented CLI surface diff classification