huskies: merge 671_refactor_migrate_pipeline_state_consumers_from_string_comparisons_to_typed_pipelinestage_enum
This commit is contained in:
@@ -8,14 +8,15 @@ use crate::service::common::item_id::extract_item_number;
|
||||
|
||||
/// Human-readable display name for a pipeline stage directory.
|
||||
pub fn stage_display_name(stage: &str) -> &'static str {
|
||||
match stage {
|
||||
"1_backlog" => "Backlog",
|
||||
"2_current" => "Current",
|
||||
"3_qa" => "QA",
|
||||
"4_merge" => "Merge",
|
||||
"5_done" => "Done",
|
||||
"6_archived" => "Archived",
|
||||
_ => "Unknown",
|
||||
use crate::pipeline_state::Stage;
|
||||
match Stage::from_dir(stage) {
|
||||
Some(Stage::Backlog) => "Backlog",
|
||||
Some(Stage::Coding) => "Current",
|
||||
Some(Stage::Qa) => "QA",
|
||||
Some(Stage::Merge { .. }) => "Merge",
|
||||
Some(Stage::Done { .. }) => "Done",
|
||||
Some(Stage::Archived { .. }) => "Archived",
|
||||
None => "Unknown",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,23 +8,26 @@
|
||||
///
|
||||
/// Valid stage names match the `.huskies/work/N_name/` directory scheme.
|
||||
pub fn is_valid_stage(stage: &str) -> bool {
|
||||
matches!(
|
||||
stage,
|
||||
"1_backlog" | "2_current" | "3_qa" | "4_merge" | "5_done" | "6_archived"
|
||||
)
|
||||
crate::pipeline_state::Stage::from_dir(stage).is_some()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// Map a human-readable stage alias (e.g. `"backlog"`) to its directory name
|
||||
/// (e.g. `"1_backlog"`). Returns `None` for unrecognised aliases.
|
||||
pub fn stage_alias_to_dir(alias: &str) -> Option<&'static str> {
|
||||
use crate::pipeline_state::Stage;
|
||||
// Canonical directory names (e.g. "1_backlog") round-trip through the typed enum.
|
||||
if let Some(stage) = Stage::from_dir(alias) {
|
||||
return Some(stage.dir_name());
|
||||
}
|
||||
// Short human-readable aliases (user-facing input normalization).
|
||||
match alias {
|
||||
"backlog" | "1_backlog" => Some("1_backlog"),
|
||||
"current" | "2_current" => Some("2_current"),
|
||||
"qa" | "3_qa" => Some("3_qa"),
|
||||
"merge" | "4_merge" => Some("4_merge"),
|
||||
"done" | "5_done" => Some("5_done"),
|
||||
"archived" | "6_archived" => Some("6_archived"),
|
||||
"backlog" => Some("1_backlog"),
|
||||
"current" => Some("2_current"),
|
||||
"qa" => Some("3_qa"),
|
||||
"merge" => Some("4_merge"),
|
||||
"done" => Some("5_done"),
|
||||
"archived" => Some("6_archived"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user