Expand description
The everruns command-line contract: one grammar, shared by the CLI and
the agent-facing command tree.
A caller learns one CLI. What a person types in a terminal and what an
agent types in its shell are the same words, with the same flags, the same
short options, the same positionals and the same help. That only stays true
if there is one definition, so this crate is it: the grammar as data, and
the single function that turns it into a clap::Command.
It is part of the Everruns ecosystem and is consumed
by everruns-cli and by the server’s agent-facing command tree.
§Example
use everruns_cli_contract::{ArgKind, ContractArg, ContractCommand, ContractExample};
let command = ContractCommand {
wire_name: "list_agents".into(),
path: vec!["agents".into()],
verb: "list".into(),
description: "List agents in the organization.".into(),
method: "GET".into(),
http_path: "/v1/agents".into(),
args: vec![ContractArg {
field: "limit".into(),
long: "limit".into(),
short: None,
position: None,
kind: ArgKind::Integer,
required: false,
help: Some("Maximum rows to return.".into()),
choices: vec![],
}],
examples: vec![ContractExample {
intent: "List the ten most recent agents".into(),
command: "everruns agents list --limit 10".into(),
}],
};
assert_eq!(command.spelling(), "agents list");
assert!(command.after_help().contains("List the ten most recent agents:"));Re-exports§
pub use declare::CliArg;pub use declare::CliExample;pub use declare::CliRoute;
Modules§
- declare
- How a command declares its place in the command line.
- render
- A stable text rendering of a clap tree.
- schema
- Turning a command’s parameter schema into its command line.
Structs§
- Contract
Arg - One argument of one command.
- Contract
Command - One command: where it sits, what it is called on the wire, how it is reached over HTTP, and what it accepts.
- Contract
Example - One worked example, in the shape yolop’s commands use: a line saying what the caller is trying to do, then the command that does it.
Enums§
- ArgKind
- What one argument accepts.
Constants§
- POSITIONAL_
SUFFIX - Suffix that lets a bare-word spelling coexist with the same argument’s long flag. Both reach one parameter, and giving both is a conflict clap reports itself rather than a silent winner.
Functions§
- commands
- Every command the control plane routes, as a checked-in artifact.
- params_
from - Read what clap parsed back out as the parameter object a command expects.