storkit: merge 367_story_rename_bot_whatsup_command_to_status
This commit is contained in:
@@ -89,7 +89,7 @@ pub fn commands() -> &'static [BotCommand] {
|
|||||||
},
|
},
|
||||||
BotCommand {
|
BotCommand {
|
||||||
name: "status",
|
name: "status",
|
||||||
description: "Show pipeline status and agent availability",
|
description: "Show pipeline status and agent availability; or `status <number>` for a story triage dump",
|
||||||
handler: status::handle_status,
|
handler: status::handle_status,
|
||||||
},
|
},
|
||||||
BotCommand {
|
BotCommand {
|
||||||
@@ -127,11 +127,6 @@ pub fn commands() -> &'static [BotCommand] {
|
|||||||
description: "Show implementation summary for a merged story: `overview <number>`",
|
description: "Show implementation summary for a merged story: `overview <number>`",
|
||||||
handler: overview::handle_overview,
|
handler: overview::handle_overview,
|
||||||
},
|
},
|
||||||
BotCommand {
|
|
||||||
name: "whatsup",
|
|
||||||
description: "Show in-progress triage dump for a story: `whatsup <number>`",
|
|
||||||
handler: whatsup::handle_whatsup,
|
|
||||||
},
|
|
||||||
BotCommand {
|
BotCommand {
|
||||||
name: "start",
|
name: "start",
|
||||||
description: "Start a coder on a story: `start <number>` or `start <number> opus`",
|
description: "Start a coder on a story: `start <number>` or `start <number> opus`",
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ use std::collections::{HashMap, HashSet};
|
|||||||
use super::CommandContext;
|
use super::CommandContext;
|
||||||
|
|
||||||
pub(super) fn handle_status(ctx: &CommandContext) -> Option<String> {
|
pub(super) fn handle_status(ctx: &CommandContext) -> Option<String> {
|
||||||
Some(build_pipeline_status(ctx.project_root, ctx.agents))
|
if ctx.args.trim().is_empty() {
|
||||||
|
Some(build_pipeline_status(ctx.project_root, ctx.agents))
|
||||||
|
} else {
|
||||||
|
super::whatsup::handle_whatsup(ctx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format a short display label for a work item.
|
/// Format a short display label for a work item.
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ pub(super) fn handle_whatsup(ctx: &CommandContext) -> Option<String> {
|
|||||||
let num_str = ctx.args.trim();
|
let num_str = ctx.args.trim();
|
||||||
if num_str.is_empty() {
|
if num_str.is_empty() {
|
||||||
return Some(format!(
|
return Some(format!(
|
||||||
"Usage: `{} whatsup <number>`\n\nShows a triage dump for a story currently in progress.",
|
"Usage: `{} status <number>`\n\nShows a triage dump for a story currently in progress.",
|
||||||
ctx.bot_name
|
ctx.bot_name
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if !num_str.chars().all(|c| c.is_ascii_digit()) {
|
if !num_str.chars().all(|c| c.is_ascii_digit()) {
|
||||||
return Some(format!(
|
return Some(format!(
|
||||||
"Invalid story number: `{num_str}`. Usage: `{} whatsup <number>`",
|
"Invalid story number: `{num_str}`. Usage: `{} status <number>`",
|
||||||
ctx.bot_name
|
ctx.bot_name
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ mod tests {
|
|||||||
ambient_rooms: &ambient_rooms,
|
ambient_rooms: &ambient_rooms,
|
||||||
room_id: &room_id,
|
room_id: &room_id,
|
||||||
};
|
};
|
||||||
try_handle_command(&dispatch, &format!("@timmy whatsup {args}"))
|
try_handle_command(&dispatch, &format!("@timmy status {args}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_story_file(root: &Path, stage: &str, filename: &str, content: &str) {
|
fn write_story_file(root: &Path, stage: &str, filename: &str, content: &str) {
|
||||||
@@ -305,13 +305,13 @@ mod tests {
|
|||||||
// -- registration -------------------------------------------------------
|
// -- registration -------------------------------------------------------
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn whatsup_command_is_registered() {
|
fn whatsup_command_is_not_registered() {
|
||||||
let found = super::super::commands().iter().any(|c| c.name == "whatsup");
|
let found = super::super::commands().iter().any(|c| c.name == "whatsup");
|
||||||
assert!(found, "whatsup command must be in the registry");
|
assert!(!found, "whatsup command must not be in the registry (renamed to status)");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn whatsup_command_appears_in_help() {
|
fn status_command_appears_in_help() {
|
||||||
let result = super::super::tests::try_cmd_addressed(
|
let result = super::super::tests::try_cmd_addressed(
|
||||||
"Timmy",
|
"Timmy",
|
||||||
"@timmy:homeserver.local",
|
"@timmy:homeserver.local",
|
||||||
@@ -319,8 +319,8 @@ mod tests {
|
|||||||
);
|
);
|
||||||
let output = result.unwrap();
|
let output = result.unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("whatsup"),
|
output.contains("status"),
|
||||||
"help should list whatsup command: {output}"
|
"help should list status command: {output}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,8 +331,8 @@ mod tests {
|
|||||||
let tmp = tempfile::TempDir::new().unwrap();
|
let tmp = tempfile::TempDir::new().unwrap();
|
||||||
let output = whatsup_cmd(tmp.path(), "").unwrap();
|
let output = whatsup_cmd(tmp.path(), "").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("Usage"),
|
output.contains("Pipeline Status"),
|
||||||
"no args should show usage: {output}"
|
"no args should show pipeline status: {output}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user