Skip to main content

PrsCommand

Enum PrsCommand 

Source
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

Fields

§number: u64

The pull request number.

§

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

§max: usize

At most this many merges.

§dry_run: bool

Observe and decide, change nothing.

§refresh: bool

When 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: bool

Drain, 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)

§interval: u64

With --continuous: seconds between cycles, 30 to 900

§resume_after_failure: bool

A merge an earlier drain could not verify stops every drain until a person has looked at it: this records that someone has (failure_acknowledged on the trail), then drains. Never with --dry-run

§

Cleanup

Close the pull requests whose work is provably on master already; without --apply it only lists them

Fields

§apply: bool

Close them: each one observed again first and closed only if it is still superseded at the head that was decided on.

§dry_run: bool

List them and close nothing: the default, spelled out.

§

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

§target: String

The pull request: its number, or its head branch.

§apply: bool

Act: take the lease, observe the forge again, record the act, merge, derive, commit and push. Without it nothing is changed, fetched or recorded.

§dry_run: bool

Decide and change nothing: the default, spelled out.

§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for PrsCommand

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for PrsCommand

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more