Doctor reference
Doctor is Bestie’s first-class diagnostic command. It explains local setup problems in beginner-friendly language and can repair safe local issues when asked.
Commands
Section titled “Commands”bestie doctorbestie doctor --jsonbestie doctor --fixbestie doctor --telegram-connectbestie doctor --telegram-speech-testIn local development:
bestie doctorbestie doctor --jsonbestie doctor --fixWhat Doctor checks
Section titled “What Doctor checks”Doctor currently checks:
- Node.js version.
- Required project files.
- Runtime paths inside repo-local
.bestie/. - Config exists and parses.
.envexists and is not group/world readable.- LLM API key presence without printing the value.
- LLM timeout sanity.
- SQLite memory database creation, opening, and schema columns.
- Character prompt presence.
- Log directory writability.
- Existing log file permissions.
- Telegram token and owner id when Telegram is enabled.
- Telegram attachment storage size and cleanup guidance.
- Telegram transcription readiness when enabled.
- Telegram speech reply readiness when enabled.
- MCP config summary and missing tool classifications.
bestie doctor --telegram-connect performs an explicit Telegram getMe network check. Default Doctor avoids external Telegram calls.
JSON contract
Section titled “JSON contract”--json returns a structured report with:
checks[]entries containingname,status,message, and optionalfix.- check statuses:
pass,warn, orfail. fixes[]entries containingname,status, andmessagewhen--fixis used.- fix statuses:
fixed,skipped, orfailed. issueCountequal to the number of failed checks.- no secret-like values.
Exit policy:
- Exit
0whenissueCountis0. - Exit
1when failing issues remain. - Warnings alone do not make
issueCountnon-zero.
Safe fixes
Section titled “Safe fixes”--fix may:
- Create
.bestie/,.bestie/logs/, and.bestie/data/. - Initialize or migrate the local SQLite memory database.
- Restrict existing
.envand app log files to owner read/write. - Copy legacy
.ai-bestie/to.bestie/if.bestie/does not exist, rewriting legacy env/config names fromAI_BESTIE_*toBESTIE_*.
--fix does not create or overwrite config files, prompt files, or secrets.
Never silently fixed
Section titled “Never silently fixed”Doctor must not silently:
- Overwrite config.
- Delete data.
- Change keys.
- Change webhooks or public channel settings.
- Stop services.
- Use sudo.
- Send test messages externally.
Smoke coverage
Section titled “Smoke coverage”npm run smoke:doctornpm run smoke:doctor:jsonnpm run smoke:doctor:fixnpm run smoke:doctor:exit-codenpm run smoke includes Doctor human output, JSON contract smoke, and safe-fix smoke. The exit-code smoke is separate because it intentionally creates a broken temp runtime and expects Doctor to exit 1.