From adab08f804b08177031d4687ae7c4049593e1d11 Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 20 Mar 2026 08:37:33 +0000 Subject: [PATCH] story-kit: done 330_refactor_consolidate_chat_transports_into_a_chat_module_with_transport_submodules --- ...ton_to_delete_a_story_from_the_pipeline.md | 23 -------- ...a_chat_module_with_transport_submodules.md | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 23 deletions(-) delete mode 100644 .story_kit/work/1_backlog/342_story_web_ui_button_to_delete_a_story_from_the_pipeline.md create mode 100644 .story_kit/work/5_done/330_refactor_consolidate_chat_transports_into_a_chat_module_with_transport_submodules.md diff --git a/.story_kit/work/1_backlog/342_story_web_ui_button_to_delete_a_story_from_the_pipeline.md b/.story_kit/work/1_backlog/342_story_web_ui_button_to_delete_a_story_from_the_pipeline.md deleted file mode 100644 index dd9eb23..0000000 --- a/.story_kit/work/1_backlog/342_story_web_ui_button_to_delete_a_story_from_the_pipeline.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: "Web UI button to delete a story from the pipeline" ---- - -# Story 342: Web UI button to delete a story from the pipeline - -## User Story - -As a project owner using the web UI, I want a delete button on work items to remove them from the pipeline, so that I can clean up obsolete or duplicate stories visually. - -## Acceptance Criteria - -- [ ] Delete button visible on work items in all pipeline stages -- [ ] Shows confirmation dialog before deleting (story title shown for clarity) -- [ ] Stops any running agent on the story before deleting -- [ ] Removes the worktree if one exists -- [ ] Deletes the story file and commits to git -- [ ] UI updates immediately to remove the item from the board -- [ ] Uses an appropriate API endpoint (new or existing) - -## Out of Scope - -- TBD diff --git a/.story_kit/work/5_done/330_refactor_consolidate_chat_transports_into_a_chat_module_with_transport_submodules.md b/.story_kit/work/5_done/330_refactor_consolidate_chat_transports_into_a_chat_module_with_transport_submodules.md new file mode 100644 index 0000000..fb5bc7f --- /dev/null +++ b/.story_kit/work/5_done/330_refactor_consolidate_chat_transports_into_a_chat_module_with_transport_submodules.md @@ -0,0 +1,52 @@ +--- +name: "Consolidate chat transports into a chat module with transport submodules" +--- + +# Refactor 330: Consolidate chat transports into a chat module with transport submodules + +## Current State + +- TBD + +## Desired State + +The chat/transport code is scattered across the codebase: transport.rs at the top level, matrix/ as a module with transport-agnostic command logic baked in, whatsapp.rs and slack.rs as top-level files. Consolidate into a unified chat/ module where common code lives at the top level and only transport-specific details live in submodules. + +Target structure: +``` +server/src/chat/ +├── mod.rs — ChatTransport trait, shared types, re-exports +├── commands/ — command registry and handlers (moved OUT of matrix/) +│ ├── mod.rs — BotCommand, CommandContext, CommandDispatch, try_handle_command +│ ├── status.rs — handle_status, build_pipeline_status +│ ├── cost.rs — handle_cost +│ ├── help.rs — handle_help +│ ├── git.rs — handle_git +│ ├── show.rs — handle_show +│ ├── overview.rs — handle_overview +│ ├── ambient.rs — handle_ambient +│ └── delete.rs — handle_delete +├── htop.rs — htop dashboard logic (moved OUT of matrix/ — works on any transport) +├── matrix/ — Matrix-specific: bot.rs, transport_impl.rs, config, notifications +├── whatsapp.rs — WhatsApp-specific: webhook, transport impl, 24h window +└── slack.rs — Slack-specific: webhook, transport impl, slash commands +``` + +The key insight: commands/, htop, and the ChatTransport trait are transport-agnostic. They currently live inside matrix/ but have nothing to do with Matrix. Only the actual Matrix SDK calls (sending messages, typing indicators, message editing, E2E encryption) are Matrix-specific. + +## Acceptance Criteria + +- [ ] transport.rs moved into chat/mod.rs (ChatTransport trait and shared types) +- [ ] commands/ moved from matrix/commands/ to chat/commands/ — no Matrix imports in command handlers +- [ ] htop.rs moved from matrix/htop.rs to chat/htop.rs — uses ChatTransport trait, not Matrix types +- [ ] whatsapp.rs moved to chat/whatsapp.rs +- [ ] slack.rs moved to chat/slack.rs +- [ ] matrix/ moved to chat/matrix/ — only contains Matrix-specific code (bot message handler, SDK calls, transport_impl, config) +- [ ] matrix/bot.rs no longer contains command dispatch logic — delegates to chat/commands/ +- [ ] All imports updated throughout the codebase +- [ ] All existing tests pass +- [ ] No public API changes from the perspective of main.rs and other modules + +## Out of Scope + +- TBD