bbsbot
2026-02-18
Sweeping architectural refactor decomposing six monolithic files into packages with game-agnostic abstractions
110 files · 15,332+ · 11,595-
cli_impl.py decomposed into game_actions/ package
8 files changed
__init__.pyNew package init re-exporting public namesaction_executor.pyAction execution logic extractedcargo_ledger.pyCargo ledger logic extractedgame_loop.pyGame loop logic extractedguard_logic.pyGuard logic extractedguard_routing.pyGuard routing extractedprompt_handlers.pyPrompt handlers extractedstate_bridge.pyState bridge extracted
- Renamed cli_impl to game_actions and split into focused modules: action_executor, cargo_ledger, game_loop, guard_logic, guard_routing, prompt_handlers, and state_bridge
decouple
architectural
3 files
action_executor.pycargo_ledger.pygame_loop.py
- Orphaned cli_impl.py deleted after all callers updated
decouple
internal
1 file
cli_impl.py
worker.py decomposed into worker/ package
10 files changed
__init__.pyPublic names re-exported for backward compatibility__main__.pyEntry point for python -m invocationbot_worker.pyMain WorkerBot and click entrypointactivity.pyActivity tracking modulediagnostics.pyDiagnostics modulehijack_manager.pyHijack management moduleidentity.pyBot identity modulestatus_reporter.pyStatus reporting moduletelemetry.pyTelemetry modulevaluation.pyValuation module
- Split into: bot_worker (main WorkerBot/click entrypoint), activity, diagnostics, hijack_manager, identity, status_reporter, telemetry, valuation
decouple
architectural
3 files
bot_worker.pyactivity.pytelemetry.py
- Added main.py for python -m bbsbot.games.tw2002.worker invocation
instantiate
internal
1 file
__main__.py
profitable_pairs.py decomposed into profitable_pairs/ package
7 files changed
__init__.pyPackage initstrategy.pyCore strategy logicpair_discovery.pyPair discovery logicaction_helpers.pyAction helper utilitiesanti_collapse.pyAnti-collapse logicfailure_tracking.pyFailure trackingtrade_phases.pyTrade phase management
- Split into: strategy, pair_discovery, action_helpers, anti_collapse, failure_tracking, trade_phases
decouple
architectural
2 files
strategy.pypair_discovery.py
login.py decomposed into login/ package
5 files changed
__init__.pyPackage initphases.pyLogin phases logicsequence.pyLogin sequence logiccharacter_creation.pyCharacter creation logicutils.pyLogin utilities
- Split into: phases, sequence, character_creation, utils
decouple
architectural
2 files
phases.pysequence.py
API routes decomposed into packages
10 files changed
__init__.pySwarm API packagemodels.pySwarm API modelsspawn.pySpawn endpointstatus.pyStatus endpointbot_ops.pyBot operations endpointbot_update.pyBot update endpoint__init__.pyTerminal API packagehub.pyTermHub modulerest_routes.pyREST routesws_routes.pyWebSocket routes
- swarm_routes.py (856 LOC) split into api/swarm/ package: models, spawn, status, bot_ops, bot_update
interface
behavioral
2 files
spawn.pybot_ops.py
- term_routes.py (860 LOC) split into api/term/ package: models, hub (TermHub), rest_routes, ws_routes
interface
behavioral
2 files
hub.pyrest_routes.py
MCP server split
5 files changed
app_factory.pyApp factory modulebbs_bridge.pyBBS bridge modulebbs_debug.pyBBS debug modulebbs_tools.pyBBS tools moduleserver.pySlimmed server module
manager.py decomposed into manager/ package
3 files changed
__init__.pyManager package init__main__.pyEntry point for python -m invocationmodels.pyBotStatus, BotStatusTW2002, SwarmStatus models extracted
- Extracted manager/models.py for BotStatus, BotStatusTW2002, BotStatusBase, SwarmStatus, DashboardStaticFiles
decouple
internal
1 file
models.py
- Added manager/main.py entry point for python -m bbsbot.manager
instantiate
internal
1 file
__main__.py
- Added missing telemetry fields to BotStatusTW2002 (warp_telemetry and others)
instantiate
behavioral
1 file
models.py
Game-agnostic SwarmManager
3 files changed
game_bot.pyGameBot abstract base class with get_activity() interfaceregistry.pyAddonRegistry for plugin managementbot.pyTradingBot now extends GameBot
Code quality improvements
2 files changed
constants.pyMagic numbers extracted into constantsparsing.pyConsolidated screen parsers
- Migrated all @dataclass uses to Pydantic BaseModel
decouple
internal
1 file
models.py
- Extracted TW2002 magic numbers into games/tw2002/constants.py
decouple
internal
1 file
constants.py
- Consolidated screen parsers into a single canonical parsing.py
decouple
internal
1 file
parsing.py
- Replaced module-level assert guards with FastAPI Depends() dependency injection in swarm API routes
qualify
behavioral
1 file
spawn.py
Security hardening
2 files changed
dashboard.htmlCORS middleware added with non-localhost binding warningsession_logger.pyPassword redaction from session logs
- Added CORS middleware to the dashboard; logs a warning when binding to non-localhost addresses
harden
behavioral
1 file
dashboard.html
- Prevented passwords from being captured in session log files
harden
behavioral
1 file
session_logger.py
Login loop fix
1 file changed
character_creation.pyFixed character-creation prompt looping after Y echo
- Stopped character-creation prompt from looping after the Y confirmation echo was misidentified
remediate
behavioral
1 file
character_creation.py
Documentation
1 file changed
tw2002-mcp-tools.mdComprehensive API reference for all TW2002 MCP tools (1,244 lines)
- Added docs/reference/tw2002-mcp-tools.md (1,244 lines) — comprehensive API reference for all TW2002 MCP tools exposed to LLM agents
specify
behavioral
1 file
tw2002-mcp-tools.md