huskies: merge 629_refactor_migrate_commanddispatch_and_commandcontext_to_services_bundle
This commit is contained in:
@@ -24,7 +24,7 @@ pub(super) fn handle_move(ctx: &CommandContext) -> Option<String> {
|
||||
None => {
|
||||
return Some(format!(
|
||||
"Usage: `{} move <number> <stage>`\n\nValid stages: {}",
|
||||
ctx.bot_name,
|
||||
ctx.services.bot_name,
|
||||
VALID_STAGES.join(", ")
|
||||
));
|
||||
}
|
||||
@@ -33,7 +33,7 @@ pub(super) fn handle_move(ctx: &CommandContext) -> Option<String> {
|
||||
if num_str.is_empty() || !num_str.chars().all(|c| c.is_ascii_digit()) {
|
||||
return Some(format!(
|
||||
"Invalid story number: `{num_str}`. Usage: `{} move <number> <stage>`",
|
||||
ctx.bot_name
|
||||
ctx.services.bot_name
|
||||
));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ pub(super) fn handle_move(ctx: &CommandContext) -> Option<String> {
|
||||
|
||||
// Find the story by numeric prefix: CRDT → content store → filesystem.
|
||||
let (story_id, _stage_dir, _path, content) =
|
||||
match crate::chat::lookup::find_story_by_number(ctx.project_root, num_str) {
|
||||
match crate::chat::lookup::find_story_by_number(ctx.effective_root(), num_str) {
|
||||
Some(found) => found,
|
||||
None => {
|
||||
return Some(format!(
|
||||
@@ -62,7 +62,7 @@ pub(super) fn handle_move(ctx: &CommandContext) -> Option<String> {
|
||||
|
||||
let display_name = found_name.as_deref().unwrap_or(&story_id);
|
||||
|
||||
match move_story_to_stage(ctx.project_root, &story_id, &target_stage) {
|
||||
match move_story_to_stage(ctx.effective_root(), &story_id, &target_stage) {
|
||||
Ok((from_stage, to_stage)) => Some(format!(
|
||||
"Moved **{display_name}** from **{from_stage}** to **{to_stage}**."
|
||||
)),
|
||||
@@ -76,22 +76,15 @@ pub(super) fn handle_move(ctx: &CommandContext) -> Option<String> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::agents::AgentPool;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use super::super::{CommandDispatch, try_handle_command};
|
||||
|
||||
fn move_cmd_with_root(root: &std::path::Path, args: &str) -> Option<String> {
|
||||
let agents = Arc::new(AgentPool::new_test(3000));
|
||||
let ambient_rooms = Arc::new(Mutex::new(HashSet::new()));
|
||||
let services = crate::services::Services::new_test(root.to_path_buf(), "Timmy".to_string());
|
||||
let room_id = "!test:example.com".to_string();
|
||||
let dispatch = CommandDispatch {
|
||||
bot_name: "Timmy",
|
||||
services: &services,
|
||||
project_root: &services.project_root,
|
||||
bot_user_id: "@timmy:homeserver.local",
|
||||
project_root: root,
|
||||
agents: &agents,
|
||||
ambient_rooms: &ambient_rooms,
|
||||
room_id: &room_id,
|
||||
};
|
||||
try_handle_command(&dispatch, &format!("@timmy move {args}"))
|
||||
|
||||
Reference in New Issue
Block a user