reference
CLI reference
the `krispy` commands and the env vars that configure them.
krispy CLI
the self-host CLI. it manages your bot's knowledge base (system prompt) by POSTing to the
edge Worker's /api/tenant/config route โ no hand-written wrangler kv calls. single-file
core, no arg-parser dependency.
commands
| command | what it does |
|---|---|
krispy init | guided first-run wizard โ Telegram โ train โ embed โ next steps. persists each step via POST /api/tenant/config. |
krispy set-kbase <file> | write <file>'s contents as the bot's system prompt (POST /api/tenant/config). |
krispy dev | run the edge Worker locally โ a thin wrapper over wrangler dev in services/edge. |
running krispy with no command (or an unknown one) prints usage.
krispy init
the terminal-native counterpart to the Cloud dashboard onboarding. four steps, each persisted as it completes; re-run any time โ the Worker merges, so it never clobbers fields you've already set.
- connect Telegram โ BotFather guide โ paste the bot token, validated live via
Telegram's
getMe(greenโ @yourbotor red retry) โ supergroup-with-Topics + add-the-bot-as-admin guide โ chat id. persistsbotToken+chatId. - train your bot โ a knowledge-base file, a starter template, or skip. persists
systemPrompt. - embed the widget โ prints the copy-paste
<script>snippet with yourdata-api+data-tenantbaked in. - next steps โ run/deploy commands and how to test the loop.
init needs a real terminal (TTY); in CI or piped input it exits with guidance instead of
hanging. it's the only command with dependencies (@clack/prompts, picocolors), lazy-loaded
so the core stays lean.
env / config
| var | default | meaning |
|---|---|---|
KRISPY_API | http://localhost:8787 | your edge Worker base URL |
KRISPY_TENANT | self | tenant id |
TENANT_SYNC_SECRET | โ | must match the Worker's TENANT_SYNC_SECRET; sent as x-tenant-sync-secret. set-kbase/init fail with a clear message if it's missing. |