pub enum PrsCommand {
Status,
Plan,
Explain {
number: u64,
},
Refresh,
Drain {
max: usize,
dry_run: bool,
refresh: bool,
continuous: bool,
interval: u64,
resume_after_failure: bool,
},
Cleanup {
apply: bool,
dry_run: bool,
},
Repair {
target: String,
apply: bool,
dry_run: bool,
},
Events,
Trains,
Brief,
ProveDryRun,
}Expand description
The subcommands of majordomus prs. status, plan, explain and events render the
recorded observation offline; refresh, drain and cleanup reach the forge, and a
drain is bounded by --max merges and, without --dry-run, holds the base branch’s
integration lease while it acts.
§Example
use majordomus_cli::cli::{Cli, Command, PrsCommand};
use clap::Parser;
let cli = Cli::try_parse_from(["majordomus", "prs", "drain", "--max", "3", "--refresh"]).unwrap();
let Command::Prs(args) = cli.command else { panic!("not the prs command") };
assert!(matches!(
args.command,
Some(PrsCommand::Drain { max: 3, dry_run: false, refresh: true, continuous: false, .. })
));
// continuous: drain, wait, drain again — never together with a dry run
let cli = Cli::try_parse_from(["majordomus", "prs", "drain", "--continuous", "--interval", "60"]).unwrap();
let Command::Prs(args) = cli.command else { panic!() };
assert!(matches!(args.command, Some(PrsCommand::Drain { continuous: true, interval: 60, .. })));
assert!(Cli::try_parse_from(["majordomus", "prs", "drain", "--continuous", "--dry-run"]).is_err());
assert!(Cli::try_parse_from(["majordomus", "prs", "drain", "--continuous", "--interval", "5"]).is_err());
// a repair is a dry run unless it is applied, and never both
let cli = Cli::try_parse_from(["majordomus", "prs", "repair", "137"]).unwrap();
let Command::Prs(args) = cli.command else { panic!() };
assert!(matches!(args.command, Some(PrsCommand::Repair { apply: false, .. })));
assert!(Cli::try_parse_from(["majordomus", "prs", "repair", "137", "--apply", "--dry-run"]).is_err());
// with no subcommand it is `status`
let cli = Cli::try_parse_from(["majordomus", "prs"]).unwrap();
let Command::Prs(args) = cli.command else { panic!() };
assert!(args.command.is_none());Variants§
Status
Every open pull request with its disposition, risk and reason, in rank order, from the last recorded observation; exit 10 when the observation is stale or absent
Plan
What the executor would do next: the next merge, the pull requests that need master brought in, and the lanes; nothing is changed
Explain
Why one pull request is where it is: the revisions it was decided against, every piece of evidence, its rank and the factors behind it
Refresh
Observe the forge now (the GitHub CLI and one git fetch) and record the observation; the only read that reaches the network
Drain
Merge the next ready pull request, verify it landed, observe again, and repeat — at most --max merges; --dry-run decides without acting
Fields
refresh: boolWhen nothing is ready, bring master into the first pull request that needs it (a merge commit with the derived driver and a fresh derive, pushed as a fast-forward), so that its checks run against the current master
continuous: boolDrain, wait --interval seconds, and drain again until stopped, holding the lease throughout; each cycle is bounded by --max and observes before every step. Ctrl-C or SIGTERM lets the step in progress finish, then releases the lease; a second signal ends it at once. Never with --dry-run, and refused (exit 10) until the audit trail holds five verified merges since the last one that could not be verified: the last stage of the rollout (ADR 0101 §13)
Cleanup
Close the pull requests whose work is provably on master already; without --apply it only lists them
Fields
Repair
Bring master into one named pull request whose only conflict with it is over derived (merge=derived) files. Eligible only when the classification says it is behind master and its merge conflicts on no authored path; an authored conflict is refused, naming the files. A dry run by default, decided offline on the last recorded observation, like status. With --apply it takes the integration lease, observes the forge again, records the act on the trail first, and merges master in a scratch worktree, derives, commits and pushes a fast-forward leased on the observed head; it never merges into master. Exit 10 on a refusal or an absent observation, 12 when it could not act
Fields
Events
The audit trail: every selection, merge, refusal, stale decision and closure this checkout’s executor recorded
Trains
The trains of stacked pull requests, in landing order: each link’s disposition, relation to master, prepared head under refs/prep/<n> (pushed or pending) and turn. Offline and read-only, from the last recorded observation; exit 10 when it is stale or absent
Brief
One line for a session briefing: the last queue built in this checkout (open, by lane, the next merge, the starving), who holds the integration lease and whether it reaches across machines, the last merge, and the last refresh, failure or stale decision. Offline, decides no relation, and prints nothing where the forge was never observed
ProveDryRun
Prove the non-mutating cycle moves nothing: snapshot origin’s refs, the open pull requests, the audit trail, the lease and the local refs, run refresh, plan, drain –dry-run and cleanup (listing), snapshot again and compare; the refresh’s fetched mirrors must equal what origin serves. Exit 10 naming what moved. Takes no flag: there is nothing to turn on
Trait Implementations§
Source§impl Debug for PrsCommand
impl Debug for PrsCommand
Source§impl FromArgMatches for PrsCommand
impl FromArgMatches for PrsCommand
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for PrsCommand
impl Subcommand for PrsCommand
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command] so it can instantiate self via
[FromArgMatches::update_from_arg_matches_mut] Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommand