storkit: merge 376_story_rename_mcp_whatsup_tool_to_status_for_consistency
This commit is contained in:
@@ -15,7 +15,7 @@ pub mod merge_tools;
|
|||||||
pub mod qa_tools;
|
pub mod qa_tools;
|
||||||
pub mod shell_tools;
|
pub mod shell_tools;
|
||||||
pub mod story_tools;
|
pub mod story_tools;
|
||||||
pub mod whatsup_tools;
|
pub mod status_tools;
|
||||||
|
|
||||||
/// Returns true when the Accept header includes text/event-stream.
|
/// Returns true when the Accept header includes text/event-stream.
|
||||||
fn wants_sse(req: &Request) -> bool {
|
fn wants_sse(req: &Request) -> bool {
|
||||||
@@ -1124,7 +1124,7 @@ fn handle_tools_list(id: Option<Value>) -> JsonRpcResponse {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "whatsup",
|
"name": "status",
|
||||||
"description": "Get a full triage dump for an in-progress story: front matter, AC checklist, active worktree/branch, git diff --stat since master, last 5 commits, and last 20 lines of the most recent agent log. Returns a clear error if the story is not in work/2_current/.",
|
"description": "Get a full triage dump for an in-progress story: front matter, AC checklist, active worktree/branch, git diff --stat since master, last 5 commits, and last 20 lines of the most recent agent log. Returns a clear error if the story is not in work/2_current/.",
|
||||||
"inputSchema": {
|
"inputSchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -1225,7 +1225,7 @@ async fn handle_tools_call(
|
|||||||
"git_commit" => git_tools::tool_git_commit(&args, ctx).await,
|
"git_commit" => git_tools::tool_git_commit(&args, ctx).await,
|
||||||
"git_log" => git_tools::tool_git_log(&args, ctx).await,
|
"git_log" => git_tools::tool_git_log(&args, ctx).await,
|
||||||
// Story triage
|
// Story triage
|
||||||
"whatsup" => whatsup_tools::tool_whatsup(&args, ctx).await,
|
"status" => status_tools::tool_status(&args, ctx).await,
|
||||||
_ => Err(format!("Unknown tool: {tool_name}")),
|
_ => Err(format!("Unknown tool: {tool_name}")),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1341,7 +1341,7 @@ mod tests {
|
|||||||
assert!(names.contains(&"git_add"));
|
assert!(names.contains(&"git_add"));
|
||||||
assert!(names.contains(&"git_commit"));
|
assert!(names.contains(&"git_commit"));
|
||||||
assert!(names.contains(&"git_log"));
|
assert!(names.contains(&"git_log"));
|
||||||
assert!(names.contains(&"whatsup"));
|
assert!(names.contains(&"status"));
|
||||||
assert_eq!(tools.len(), 49);
|
assert_eq!(tools.len(), 49);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ async fn git_branch(dir: &Path) -> Option<String> {
|
|||||||
.flatten()
|
.flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) async fn tool_whatsup(args: &Value, ctx: &AppContext) -> Result<String, String> {
|
pub(super) async fn tool_status(args: &Value, ctx: &AppContext) -> Result<String, String> {
|
||||||
let story_id = args
|
let story_id = args
|
||||||
.get("story_id")
|
.get("story_id")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
@@ -323,16 +323,16 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn tool_whatsup_returns_error_for_missing_story() {
|
async fn tool_status_returns_error_for_missing_story() {
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempdir().unwrap();
|
||||||
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
|
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
|
||||||
let result = tool_whatsup(&json!({"story_id": "999_story_nonexistent"}), &ctx).await;
|
let result = tool_status(&json!({"story_id": "999_story_nonexistent"}), &ctx).await;
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
assert!(result.unwrap_err().contains("not found in work/2_current/"));
|
assert!(result.unwrap_err().contains("not found in work/2_current/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn tool_whatsup_returns_story_data() {
|
async fn tool_status_returns_story_data() {
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempdir().unwrap();
|
||||||
let current_dir = tmp
|
let current_dir = tmp
|
||||||
.path()
|
.path()
|
||||||
@@ -345,7 +345,7 @@ mod tests {
|
|||||||
fs::write(current_dir.join("42_story_test.md"), story_content).unwrap();
|
fs::write(current_dir.join("42_story_test.md"), story_content).unwrap();
|
||||||
|
|
||||||
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
|
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
|
||||||
let result = tool_whatsup(&json!({"story_id": "42_story_test"}), &ctx)
|
let result = tool_status(&json!({"story_id": "42_story_test"}), &ctx)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
|
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
|
||||||
@@ -14,7 +14,7 @@ mod move_story;
|
|||||||
mod overview;
|
mod overview;
|
||||||
mod show;
|
mod show;
|
||||||
mod status;
|
mod status;
|
||||||
mod whatsup;
|
mod triage;
|
||||||
|
|
||||||
use crate::agents::AgentPool;
|
use crate::agents::AgentPool;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub(super) fn handle_status(ctx: &CommandContext) -> Option<String> {
|
|||||||
if ctx.args.trim().is_empty() {
|
if ctx.args.trim().is_empty() {
|
||||||
Some(build_pipeline_status(ctx.project_root, ctx.agents))
|
Some(build_pipeline_status(ctx.project_root, ctx.agents))
|
||||||
} else {
|
} else {
|
||||||
super::whatsup::handle_whatsup(ctx)
|
super::triage::handle_triage(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//! Handler for the `whatsup` command.
|
//! Handler for the story triage dump subcommand of `status`.
|
||||||
//!
|
//!
|
||||||
//! Produces a triage dump for a story that is currently in-progress
|
//! Produces a triage dump for a story that is currently in-progress
|
||||||
//! (`work/2_current/`): metadata, acceptance criteria, worktree/branch state,
|
//! (`work/2_current/`): metadata, acceptance criteria, worktree/branch state,
|
||||||
@@ -10,8 +10,8 @@ use super::CommandContext;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
/// Handle `{bot_name} whatsup {number}`.
|
/// Handle `{bot_name} status {number}`.
|
||||||
pub(super) fn handle_whatsup(ctx: &CommandContext) -> Option<String> {
|
pub(super) fn handle_triage(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!(
|
||||||
@@ -281,7 +281,7 @@ mod tests {
|
|||||||
|
|
||||||
use super::super::{CommandDispatch, try_handle_command};
|
use super::super::{CommandDispatch, try_handle_command};
|
||||||
|
|
||||||
fn whatsup_cmd(root: &Path, args: &str) -> Option<String> {
|
fn status_triage_cmd(root: &Path, args: &str) -> Option<String> {
|
||||||
let agents = Arc::new(AgentPool::new_test(3000));
|
let agents = Arc::new(AgentPool::new_test(3000));
|
||||||
let ambient_rooms = Arc::new(Mutex::new(HashSet::new()));
|
let ambient_rooms = Arc::new(Mutex::new(HashSet::new()));
|
||||||
let room_id = "!test:example.com".to_string();
|
let room_id = "!test:example.com".to_string();
|
||||||
@@ -329,7 +329,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn whatsup_no_args_returns_usage() {
|
fn whatsup_no_args_returns_usage() {
|
||||||
let tmp = tempfile::TempDir::new().unwrap();
|
let tmp = tempfile::TempDir::new().unwrap();
|
||||||
let output = whatsup_cmd(tmp.path(), "").unwrap();
|
let output = status_triage_cmd(tmp.path(), "").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("Pipeline Status"),
|
output.contains("Pipeline Status"),
|
||||||
"no args should show pipeline status: {output}"
|
"no args should show pipeline status: {output}"
|
||||||
@@ -339,7 +339,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn whatsup_non_numeric_returns_error() {
|
fn whatsup_non_numeric_returns_error() {
|
||||||
let tmp = tempfile::TempDir::new().unwrap();
|
let tmp = tempfile::TempDir::new().unwrap();
|
||||||
let output = whatsup_cmd(tmp.path(), "abc").unwrap();
|
let output = status_triage_cmd(tmp.path(), "abc").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("Invalid"),
|
output.contains("Invalid"),
|
||||||
"non-numeric arg should return error: {output}"
|
"non-numeric arg should return error: {output}"
|
||||||
@@ -358,7 +358,7 @@ mod tests {
|
|||||||
"42_story_not_in_current.md",
|
"42_story_not_in_current.md",
|
||||||
"---\nname: Not in current\n---\n",
|
"---\nname: Not in current\n---\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "42").unwrap();
|
let output = status_triage_cmd(tmp.path(), "42").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("42"),
|
output.contains("42"),
|
||||||
"message should include story number: {output}"
|
"message should include story number: {output}"
|
||||||
@@ -380,7 +380,7 @@ mod tests {
|
|||||||
"99_story_my_feature.md",
|
"99_story_my_feature.md",
|
||||||
"---\nname: My Feature\n---\n\n## Acceptance Criteria\n\n- [ ] First thing\n- [x] Done thing\n",
|
"---\nname: My Feature\n---\n\n## Acceptance Criteria\n\n- [ ] First thing\n- [x] Done thing\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "99").unwrap();
|
let output = status_triage_cmd(tmp.path(), "99").unwrap();
|
||||||
assert!(output.contains("99"), "should show story number: {output}");
|
assert!(output.contains("99"), "should show story number: {output}");
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("My Feature"),
|
output.contains("My Feature"),
|
||||||
@@ -401,7 +401,7 @@ mod tests {
|
|||||||
"99_story_criteria_test.md",
|
"99_story_criteria_test.md",
|
||||||
"---\nname: Criteria Test\n---\n\n- [ ] First thing\n- [x] Done thing\n- [ ] Second thing\n",
|
"---\nname: Criteria Test\n---\n\n- [ ] First thing\n- [x] Done thing\n- [ ] Second thing\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "99").unwrap();
|
let output = status_triage_cmd(tmp.path(), "99").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("First thing"),
|
output.contains("First thing"),
|
||||||
"should show unchecked criterion: {output}"
|
"should show unchecked criterion: {output}"
|
||||||
@@ -426,7 +426,7 @@ mod tests {
|
|||||||
"55_story_blocked_story.md",
|
"55_story_blocked_story.md",
|
||||||
"---\nname: Blocked Story\nblocked: true\n---\n",
|
"---\nname: Blocked Story\nblocked: true\n---\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "55").unwrap();
|
let output = status_triage_cmd(tmp.path(), "55").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("blocked"),
|
output.contains("blocked"),
|
||||||
"should show blocked field: {output}"
|
"should show blocked field: {output}"
|
||||||
@@ -442,7 +442,7 @@ mod tests {
|
|||||||
"55_story_agent_story.md",
|
"55_story_agent_story.md",
|
||||||
"---\nname: Agent Story\nagent: coder-1\n---\n",
|
"---\nname: Agent Story\nagent: coder-1\n---\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "55").unwrap();
|
let output = status_triage_cmd(tmp.path(), "55").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("coder-1"),
|
output.contains("coder-1"),
|
||||||
"should show agent field: {output}"
|
"should show agent field: {output}"
|
||||||
@@ -458,7 +458,7 @@ mod tests {
|
|||||||
"77_story_no_worktree.md",
|
"77_story_no_worktree.md",
|
||||||
"---\nname: No Worktree\n---\n",
|
"---\nname: No Worktree\n---\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "77").unwrap();
|
let output = status_triage_cmd(tmp.path(), "77").unwrap();
|
||||||
// Branch name should still appear
|
// Branch name should still appear
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("feature/story-77"),
|
output.contains("feature/story-77"),
|
||||||
@@ -475,7 +475,7 @@ mod tests {
|
|||||||
"77_story_no_log.md",
|
"77_story_no_log.md",
|
||||||
"---\nname: No Log\n---\n",
|
"---\nname: No Log\n---\n",
|
||||||
);
|
);
|
||||||
let output = whatsup_cmd(tmp.path(), "77").unwrap();
|
let output = status_triage_cmd(tmp.path(), "77").unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
output.contains("no log") || output.contains("No log") || output.contains("*(no log found)*"),
|
output.contains("no log") || output.contains("No log") || output.contains("*(no log found)*"),
|
||||||
"should indicate no log exists: {output}"
|
"should indicate no log exists: {output}"
|
||||||
Reference in New Issue
Block a user