Skip to main content

ForgeClient

Trait ForgeClient 

Source
pub trait ForgeClient: Send + Sync {
    // Required methods
    fn auth_status(&self) -> Result<(), ForgeError>;
    fn list_prs_for_head(
        &self,
        dir: &Path,
        head_branch: &str,
    ) -> Result<Vec<PrRecord>, ForgeError>;
    fn create_pr(
        &self,
        dir: &Path,
        head_branch: &str,
        base_branch: &str,
        title: &str,
        body: &str,
        draft: bool,
    ) -> Result<PrRecord, ForgeError>;
    fn set_pr_body(
        &self,
        dir: &Path,
        number: u64,
        body: &str,
    ) -> Result<(), ForgeError>;
    fn ci_for_sha(
        &self,
        dir: &Path,
        number: u64,
        head_sha: &str,
    ) -> Result<CiSummary, ForgeError>;

    // Provided method
    fn reopen_pr(&self, _dir: &Path, _number: u64) -> Result<(), ForgeError> { ... }
}
Expand description

The forge operations PR delivery needs, behind one vendor-neutral seam.

Commit creation and the append-only push remain plain git. This trait owns only the review artifact: authentication, pull-request reconciliation, body refresh, and checks for one exact head. Keeping those operations together is what prevents a second forge from becoming a parallel, weaker delivery path.

Required Methods§

Source

fn auth_status(&self) -> Result<(), ForgeError>

Fail with a message naming the forge credential or login remedy.

Source

fn list_prs_for_head( &self, dir: &Path, head_branch: &str, ) -> Result<Vec<PrRecord>, ForgeError>

Every pull request whose head is head_branch, in any state.

Source

fn create_pr( &self, dir: &Path, head_branch: &str, base_branch: &str, title: &str, body: &str, draft: bool, ) -> Result<PrRecord, ForgeError>

Source

fn set_pr_body( &self, dir: &Path, number: u64, body: &str, ) -> Result<(), ForgeError>

Replace a pull request’s body wholesale.

Source

fn ci_for_sha( &self, dir: &Path, number: u64, head_sha: &str, ) -> Result<CiSummary, ForgeError>

Check runs, policies, and commit statuses for one exact PR head.

Provided Methods§

Source

fn reopen_pr(&self, _dir: &Path, _number: u64) -> Result<(), ForgeError>

Reopen a closed pull request when the caller has separately established that doing so is authorized. Current delivery policy deliberately never calls this: a human close parks the round.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§