huskies: merge 1032
This commit is contained in:
@@ -9,10 +9,8 @@ use serde_json::Value;
|
||||
/// Accepts a `story_id` (full filename stem, e.g. `"42_story_foo"`) and
|
||||
/// delegates to [`service::work_item::freeze::freeze`].
|
||||
pub(crate) fn tool_freeze_story(args: &Value, _ctx: &AppContext) -> Result<String, String> {
|
||||
let story_id = args
|
||||
.get("story_id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing required argument: story_id")?;
|
||||
let req = crate::validation::FreezeStoryRequest::from_json(args)?;
|
||||
let story_id = req.story_id.as_str();
|
||||
|
||||
match crate::service::work_item::freeze::freeze(story_id)? {
|
||||
FreezeStatus::AlreadyFrozen => Ok(format!("Story '{story_id}' is already frozen.")),
|
||||
@@ -27,10 +25,8 @@ pub(crate) fn tool_freeze_story(args: &Value, _ctx: &AppContext) -> Result<Strin
|
||||
/// Accepts a `story_id` (full filename stem, e.g. `"42_story_foo"`) and
|
||||
/// delegates to [`service::work_item::freeze::unfreeze`].
|
||||
pub(crate) fn tool_unfreeze_story(args: &Value, _ctx: &AppContext) -> Result<String, String> {
|
||||
let story_id = args
|
||||
.get("story_id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing required argument: story_id")?;
|
||||
let req = crate::validation::FreezeStoryRequest::from_json(args)?;
|
||||
let story_id = req.story_id.as_str();
|
||||
|
||||
match crate::service::work_item::freeze::unfreeze(story_id)? {
|
||||
UnfreezeStatus::NotFrozen => Ok(format!(
|
||||
|
||||
@@ -218,23 +218,11 @@ pub(crate) fn tool_update_story(args: &Value, ctx: &AppContext) -> Result<String
|
||||
}
|
||||
|
||||
pub(crate) fn tool_unblock_story(args: &Value, ctx: &AppContext) -> Result<String, String> {
|
||||
let story_id = args
|
||||
.get("story_id")
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing required argument: story_id")?;
|
||||
|
||||
let req = crate::validation::UnblockStoryRequest::from_json(args)?;
|
||||
let root = ctx.state.get_project_root()?;
|
||||
|
||||
// Extract the numeric prefix (e.g. "42" from "42" or from legacy "42_story_foo").
|
||||
let story_number = story_id
|
||||
.split('_')
|
||||
.next()
|
||||
.filter(|s| !s.is_empty() && s.chars().all(|c| c.is_ascii_digit()))
|
||||
.ok_or_else(|| {
|
||||
format!("Invalid story_id format: '{story_id}'. Expected a numeric ID (e.g. '42').")
|
||||
})?;
|
||||
|
||||
let result = crate::chat::commands::unblock::unblock_by_number(&root, story_number);
|
||||
let result =
|
||||
crate::chat::commands::unblock::unblock_by_number(&root, req.story_id.numeric_prefix());
|
||||
if result.contains("not blocked")
|
||||
|| result.contains("not found")
|
||||
|| result.contains("Error")
|
||||
|
||||
Reference in New Issue
Block a user