Service Topology
bgng commands own orchestration. Services do the reusable work. Utilities handle paths, formatting, slugs, and YouTube URL parsing.
Important services
| Module | Owns |
|---|---|
services/config.ts | config.json, v1 to v2 migration, SupaData key resolution |
services/index.ts | qmd store singleton, indexing, search, document retrieval, contexts |
services/queue.ts | Markdown queue parse, serialize, atomic write |
services/supadata.ts | SupaData REST client, rate limiting, retry, async transcript polling |
services/transcript.ts | Markdown and plain-text transcript formatting |
services/beginningdb/* | HTTP helper, target resolution, path prefix rewriting |
services/ide/* | VSIX install, profiles, sessions, secrets, runtime metadata, auth refresh |
Composition rules
- Commands call services directly; there is no dependency-injection container.
- The qmd store is lazy because embedding models load on first use.
- SupaData rate limiting is per client instance and resets when the process exits.
- BeginningDB HTTP helpers know HTTP mechanics; route-specific logic stays in
DbCommands.ts. - Testable services accept fetch functions or clocks where needed.