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
impl ProjectSync
Sourcepub fn from_config() -> Option<Self>
pub fn from_config() -> Option<Self>
Load from config. Returns None if project integration is not configured.
Sourcepub async fn discover_fields(project_id: &str) -> Result<Self>
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.
Sourcepub async fn list_projects() -> Result<Vec<ProjectInfo>>
pub async fn list_projects() -> Result<Vec<ProjectInfo>>
List all accessible projects for the authenticated user and their orgs.
Sourcepub async fn add_item(&self, issue_node_id: &str) -> Result<String>
pub async fn add_item(&self, issue_node_id: &str) -> Result<String>
Add an issue to the project board. Returns the project item ID.
Sourcepub async fn update_item_status(
&self,
item_id: &str,
status: &Status,
) -> Result<()>
pub async fn update_item_status( &self, item_id: &str, status: &Status, ) -> Result<()>
Update an item’s status column on the project board.
Sourcepub async fn sync_item_status(
&self,
issue_node_id: &str,
status: &Status,
) -> Result<()>
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().
Sourcepub fn status_to_column(status: &Status) -> &'static str
pub fn status_to_column(status: &Status) -> &'static str
Map orch Status to a project board column key.
Sourcepub fn status_field_id(&self) -> &str
pub fn status_field_id(&self) -> &str
Get the status field ID.
Sourcepub fn status_map(&self) -> &HashMap<String, String>
pub fn status_map(&self) -> &HashMap<String, String>
Get the status map (column key → option ID).
Sourcepub fn estimate_field_id(&self) -> Option<&str>
pub fn estimate_field_id(&self) -> Option<&str>
Get the estimate field ID, if configured.
Sourcepub fn project_id(&self) -> &str
pub fn project_id(&self) -> &str
Get the project ID.
Sourcepub async fn sync_item_estimate(
&self,
issue_node_id: &str,
estimate: u8,
) -> Result<String>
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).
Sourcepub async fn get_estimates_for_issues(
&self,
issue_node_ids: &[String],
) -> Result<HashMap<String, u8>>
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§
impl !Freeze for ProjectSync
impl !RefUnwindSafe for ProjectSync
impl !UnwindSafe for ProjectSync
impl Send for ProjectSync
impl Sync for ProjectSync
impl Unpin for ProjectSync
impl UnsafeUnpin for ProjectSync
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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