Skip to content

refactor: split the bot's Slack code into slack/, announcing/ and answering/ - #134

Merged
ChristopherPHolder merged 1 commit into
mainfrom
refactor/slack-folders
Oct 31, 2026
Merged

ChristopherPHolder merged 1 commit into
mainfrom
refactor/slack-folders

Conversation

@ChristopherPHolder

Copy link
Copy Markdown
Collaborator

What and why

Closes #129.

Fourteen Slack-related modules sat flat in apps/bot/src. Posting what the office did, answering people, and Slack's own API were only told apart in the docs. They're now three folders, each with an index.ts that is its interface:

  • src/slack/: the adapter for Slack's Web API and Socket Mode, plus the bot's posts and history. Holds SlackClient, SlackSocket, SlackEvent, SlackMessage, BotPosts and SlackHistory.
  • src/announcing/: announcements, reminders and banter. Holds SlackNotifier, HeadlineWriter, Banter, Reminder and the new Announcement.ts. Its index.ts gives Program banter, reminders and SlackNotifier.
  • src/answering/: answering in Slack. Holds Responder, ReplyDecider, CloudflareDecisionModel, ReplyWriter and the new ReplyMessage.ts. Its index.ts exports ResponderLayer.

SlackMessage held three things, so it's split the same way the recording post was in #133:

  • slack/SlackMessage.ts keeps the Block Kit pieces and escaping.
  • announcing/Announcement.ts builds the announcement, reminder and banter messages, with their fixed phrasings.
  • answering/ReplyMessage.ts builds the reply.

Each index.ts exports only what code outside its folder uses, and that code now imports through it. Tests mirror the folders and still test internals directly. Service keys follow the paths (bot/slack/SlackClient and so on). docs/architecture.md groups the module tables by folder.

Behaviour doesn't change.

How I tested it

  • All tests pass. The formatMessage tests moved to test/announcing/Announcement.test.ts.
  • pnpm vp run ci passes, including the bundle build.

Checklist

  • vp run ci passes
  • Tests cover the change
  • Docs updated if what gets posted, the configuration, the Console or the deploy changed (module tables only)
  • New environment variables are wired through (none)
  • Ready to ship: merging this deploys it to production

@ChristopherPHolder
ChristopherPHolder enabled auto-merge (squash) October 31, 2026 11:57
@ChristopherPHolder
ChristopherPHolder merged commit fb3c735 into main Oct 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split the bot's Slack code into slack/, announcing/ and answering/

1 participant