Skip to main content

ProjectSync

Struct ProjectSync 

Source
pub struct ProjectSync { /* private fields */ }
Expand description

Keeps a GitHub Projects V2 board in sync with orch task statuses.

Config keys (in ~/.orch/config.yml):

gh:
  project_id: "PVT_kwHO..."
  project_status_field_id: "PVTSSF_..."
  project_status_map:
    backlog: "option-id-1"
    in_progress: "option-id-2"
    review: "option-id-3"
    done: "option-id-4"

Implementations§

Source§

impl ProjectSync

Source

pub fn from_config() -> Option<Self>

Load from config. Returns None if project integration is not configured.

Source

pub async fn discover_fields(project_id: &str) -> Result<Self>

Discover the Status field ID and option IDs from a project.

Queries the project’s fields via GraphQL and finds the single-select “Status” field, returning a ProjectSync populated with field/option IDs. Also discovers the “Estimate” number field if present.

Source

pub async fn list_projects() -> Result<Vec<ProjectInfo>>

List all accessible projects for the authenticated user and their orgs.

Source

pub async fn add_item(&self, issue_node_id: &str) -> Result<String>

Add an issue to the project board. Returns the project item ID.

Source

pub async fn update_item_status( &self, item_id: &str, status: &Status, ) -> Result<()>

Update an item’s status column on the project board.

Source

pub async fn sync_item_status( &self, issue_node_id: &str, status: &Status, ) -> Result<()>

Sync an issue’s project board status: add to project if needed, then update column.

This is the main entry point called from update_status().

Source

pub fn status_to_column(status: &Status) -> &'static str

Map orch Status to a project board column key.

Source

pub fn status_field_id(&self) -> &str

Get the status field ID.

Source

pub fn status_map(&self) -> &HashMap<String, String>

Get the status map (column key → option ID).

Source

pub fn estimate_field_id(&self) -> Option<&str>

Get the estimate field ID, if configured.

Source

pub fn project_id(&self) -> &str

Get the project ID.

Source

pub async fn sync_item_estimate( &self, issue_node_id: &str, estimate: u8, ) -> Result<String>

Update an item’s Estimate number field on the project board.

Returns the project item ID (either found or newly added).

Source

pub async fn get_estimates_for_issues( &self, issue_node_ids: &[String], ) -> Result<HashMap<String, u8>>

Batch-fetch estimate values for multiple project items by their content (issue) node IDs.

Returns a map from content node ID → estimate value (0 if not set or field absent). Only queries the estimate field — the result is used to populate orch’s estimate during task ingestion when tasks.estimate is still 0.

GitHub’s GraphQL API doesn’t support querying items by arbitrary node IDs directly, so we fetch all project items and their field values, then match by content ID. This is acceptable for projects with reasonable item counts (< 1000).

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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