Restructure into a library crate with modular bot and irc

Split the single-binary crate into a reusable `rustbot` library (src/lib.rs)
plus a thin supervisor binary. The monolithic irc.rs and bot.rs become module
folders:

  irc/    message (wire parsing), connection (TCP/TLS transport), encoding
  bot/    mod (state + event loop), caps (IRCv3 cap negotiation + SASL),
          commands (message routing + command table)
  config  Config + layered loading, moved out of main.rs and bot.rs

main.rs is now just the per-network connect/reconnect supervisor over the
library API. Unit tests move out of the source files into tests/ integration
tests (config.rs, protocol.rs) that drive the public surface — prefix parsing
is now covered through Message::parse, and config layering through the new
public config::parse_str. Behavior is unchanged; no new dependencies.
This commit is contained in:
Jean Chevronnet 2026-07-29 15:38:55 +00:00
parent b9e95430f5
commit a15fb4f9a9
16 changed files with 1189 additions and 1116 deletions

View file

@ -6,11 +6,15 @@ description = "A modular, dependency-free IRC bot in Rust with a hand-rolled IRC
license = "MIT"
authors = ["a.srenov"]
[lib]
name = "rustbot"
path = "src/lib.rs"
[[bin]]
name = "rustbot"
path = "src/main.rs"
# The IRC protocol layer is hand-rolled in `src/irc.rs` (modern IRC client
# The IRC protocol layer is hand-rolled in `src/irc/` (modern IRC client
# spec: https://modern.ircdocs.horse/). The sole dependency is native-tls for
# the optional TLS transport; it wraps the system OpenSSL, so TLS security
# fixes arrive through normal OS updates rather than a vendored crypto crate.