diff --git a/README.md b/README.md index 08afcf0..4a283cc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Modules are added or removed via a single `MODULES` env var. Each module registe - **Three visibility levels out of the box.** Public commands show in Telegram's `/` menu and `/help`; protected show only in `/help`; private are hidden slash-command easter eggs. One namespace, loud conflict detection. - **Storage is swappable.** Modules talk to a small `KVStore` interface — Cloudflare KV today, a different backend tomorrow, with a one-file change. - **Zero admin surface.** No in-Worker `/admin/*` routes, no admin secret. `setWebhook` + `setMyCommands` run at deploy time from a local node script. -- **Tested.** 110 vitest unit tests cover registry, storage, dispatcher, help renderer, validators, HTML escaping, and the trading module. +- **Tested.** 105 vitest unit tests cover registry, storage, dispatcher, help renderer, validators, HTML escaping, and the trading module. ## How a request flows @@ -54,7 +54,7 @@ src/ │ ├── dispatcher.js # wires every command via bot.command() │ ├── validate-command.js │ ├── util/ # /info, /help (fully implemented) -│ ├── trading/ # fake paper trading — crypto, stocks, forex, gold +│ ├── trading/ # paper trading — VN stocks (dynamic symbol resolution) │ ├── wordle/ # stub — proves plugin system │ ├── loldle/ # stub │ └── misc/ # stub diff --git a/docs/architecture.md b/docs/architecture.md index e272356..9bd061e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -29,7 +29,7 @@ src/ │ ├── dispatcher.js ── bot.command() for every visibility │ ├── validate-command.js ── shared validators │ ├── util/ ── fully implemented: /info + /help -│ ├── trading/ ── paper trading: crypto, VN stocks, forex, gold +│ ├── trading/ ── paper trading: VN stocks (dynamic symbol resolution) │ ├── wordle/ loldle/ ── stub modules proving the plugin system │ └── misc/ ── stub that exercises the DB (ping/mstats) └── util/ @@ -278,7 +278,7 @@ A previous design sketched a `POST /admin/setup` route inside the Worker, gated ## 12. Testing philosophy -Pure-logic unit tests only. No `workerd` pool, no Telegram fixtures, no integration-level tooling. 110 tests run in ~500ms. +Pure-logic unit tests only. No `workerd` pool, no Telegram fixtures, no integration-level tooling. 105 tests run in ~500ms. Test seams: diff --git a/docs/code-standards.md b/docs/code-standards.md index 9bf157c..22efed6 100644 --- a/docs/code-standards.md +++ b/docs/code-standards.md @@ -33,7 +33,7 @@ Run `npm run format` before committing. - **Files:** lowercase, hyphens for multi-word (`stats-handler.js`, `fake-kv-namespace.js`) - **Directories:** lowercase, single word preferred (`trading/`, `util/`) - **Functions/variables:** camelCase -- **Constants:** UPPER_SNAKE_CASE for frozen config objects (`SYMBOLS`, `CURRENCIES`) +- **Constants:** UPPER_SNAKE_CASE for frozen config objects (e.g. `CURRENCIES`) - **Command names:** lowercase + digits + underscore, 1-32 chars, no leading slash ## Module Conventions diff --git a/docs/codebase-summary.md b/docs/codebase-summary.md index bdbee7c..a2ed2e5 100644 --- a/docs/codebase-summary.md +++ b/docs/codebase-summary.md @@ -20,7 +20,7 @@ Telegram bot on Cloudflare Workers with a plug-n-play module system. grammY hand | Module | Status | Commands | Description | |--------|--------|----------|-------------| | `util` | Complete | `/info`, `/help` | Bot info and command help renderer | -| `trading` | Complete | `/trade_topup`, `/trade_buy`, `/trade_sell`, `/trade_convert`, `/trade_stats` | Paper trading with crypto, VN stocks, forex, gold | +| `trading` | Complete | `/trade_topup`, `/trade_buy`, `/trade_sell`, `/trade_convert`, `/trade_stats` | Paper trading — VN stocks with dynamic symbol resolution. Crypto/gold/forex coming soon. | | `misc` | Stub | `/ping`, `/mstats`, `/fortytwo` | Health check + DB demo | | `wordle` | Stub | `/wordle`, `/wstats`, `/konami` | Placeholder for word game | | `loldle` | Stub | `/loldle`, `/ggwp` | Placeholder for LoL game | @@ -57,11 +57,11 @@ Each module maintains its own `README.md` with commands, data model, and impleme ## Test Coverage -110 tests across 11 test files: +105 tests across 11 test files: | Area | Tests | What's Covered | |------|-------|---------------| | DB layer | 19 | KV store, prefixing, JSON helpers, pagination | | Module framework | 33 | Registry, dispatcher, validators, help renderer | | Utilities | 4 | HTML escaping | -| Trading module | 54 | Symbols, formatters, portfolio CRUD, all 5 command handlers | +| Trading module | 49 | Dynamic symbol resolution, formatters, flat portfolio CRUD, command handlers |