# VPF Rust SDK
Read, check and show plans in the [Verifiable Plan Format](https://verifiableplanformat.org) (VPF).
A plan says what is wanted, who does each step and what proves each step is done. This SDK reads a plan from its JSON
text, tells every problem the [specification](https://verifiableplanformat.org/specification/v1/problems) defines, and
says the plan in words a person can read before it runs. It passes every
[conformance case](https://verifiableplanformat.org/specification/v1/conformance) of VPF 1.1.
| [`vpf`](crates/vpf) | The library: read, check and show a plan. |
| [`vpf-cli`](crates/vpf-cli) | The `vpf` command. |
## The library
```rust
let text = std::fs::read_to_string("monthly-sales-report.vpf.json")?;
let report = vpf::check(&text);
if report.may_run() {
let plan = report.plan.unwrap();
print!("{}", vpf::words_text(&plan));
} else {
for problem in &report.problems {
println!("{problem}");
}
}
```
`check` returns every problem with a reason that does not change, such as `proof.missing`, the step it is about and a
sentence. `Reason::as_str` gives the id, so a program can say it in its reader's language.
## The command
```sh
cargo install --path crates/vpf-cli
vpf check plans/*.vpf.json # ends with 1 when a plan may not run
vpf check --json report.vpf.json # the problems as JSON
vpf show report.vpf.json # the plan in words
```
```text
$ vpf check conformance/plans/several-problems.vpf.json
conformance/plans/several-problems.vpf.json: 6 problems
step.id: Count: An id is not 1 to 24 small letters, digits or -, or is asked.
proof.missing: Count: A step an agent does has no proof.
...
```
## Development
```sh
cargo test
cargo clippy --all-targets -- -D warnings
cargo fmt --all --check
```
`conformance/` and `examples/` are copied from the [vpf](https://github.com/verifiableplanformat/vpf) repository;
`conformance/SOURCE.md` names the commit. Run `scripts/sync-conformance.sh path/to/vpf` to copy them again.
Commits follow [Conventional Commits](https://www.conventionalcommits.org) and are signed off under the
[Developer Certificate of Origin](https://developercertificate.org) (`git commit -s`).
## License
[Apache License 2.0](LICENSE).