huskies: merge 629_refactor_migrate_commanddispatch_and_commandcontext_to_services_bundle

This commit is contained in:
dave
2026-04-25 20:41:19 +00:00
parent 2a3f88fdcf
commit 14b158d0b2
27 changed files with 407 additions and 544 deletions
+6 -13
View File
@@ -25,7 +25,7 @@ pub(super) fn handle_depends(ctx: &CommandContext) -> Option<String> {
"Usage: `{} depends <number> [dep1 dep2 ...]`\n\nExamples:\n\
• `{0} depends 484 477 478` — set depends_on: [477, 478]\n\
• `{0} depends 484` — clear all dependencies",
ctx.bot_name
ctx.services.bot_name
));
}
@@ -35,7 +35,7 @@ pub(super) fn handle_depends(ctx: &CommandContext) -> Option<String> {
if !num_str.chars().all(|c| c.is_ascii_digit()) || num_str.is_empty() {
return Some(format!(
"Invalid story number: `{num_str}`. Usage: `{} depends <number> [dep1 dep2 ...]`",
ctx.bot_name
ctx.services.bot_name
));
}
@@ -54,7 +54,7 @@ pub(super) fn handle_depends(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!(
@@ -115,22 +115,15 @@ pub(super) fn handle_depends(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 depends_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 depends {args}"))