This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A publishable Wippy Hub package (butschster/telegram) that provides Telegram bot webhook handling with registry-based
command routing. It is a library package, not a standalone app — consumers provide infrastructure (HTTP router, env
storage, process host) via ns.dependency parameters.
# Start the dev server (uses dev/ as the app entry point via wippy.lock)
wippy run
# Register webhook with Telegram
wippy run register-webhook
# Remove webhook
wippy run delete-webhook
# Lint a specific namespace
wippy lint --ns=telegram
wippy lint --ns=telegram.*
wippy lint --ns=telegram.sdktelegram(root) —ns.definition,ns.requirementdeclarations, env variable entriestelegram.handler— Webhook HTTP endpoint + CLI process commandstelegram.commands— Built-in/startand/helpcommand handlers (registered viaregistry.entry)telegram.sdk— Telegram Bot API client functions (send_message,set_webhook,delete_webhook,get_me)
Registry-based dispatch: The webhook handler (src/handler/webhook.lua) uses
registry.find({kind = "registry.entry"}) to discover commands (meta.type == "telegram.command") and update
handlers (meta.type == "telegram.handler"). Consumers add commands by creating registry.entry entries in their own
namespace — no modification of this package needed.
Dependency injection via ns.requirement: The package declares three requirements in src/_index.yaml:
webhook_router→ injected intotelegram.handler:webhook.endpointat.meta.routerenv_storage→ injected into env variable entries at.storageprocess_host→ reserved for future stateful handlers (targets currently empty)
Cross-entry function calls: Handlers call SDK functions via funcs.call("telegram.sdk:send_message", params). The
SDK (src/sdk/client.lua) wraps the Telegram Bot API with http_client.post().
| Kind | Purpose |
|---|---|
ns.definition |
Package metadata |
ns.requirement |
Declares what consumers must provide |
env.variable |
Bot token, webhook URL, webhook secret |
http.endpoint |
POST /webhook |
function.lua |
Webhook handler, SDK functions, command handlers |
process.lua |
CLI commands (register/delete webhook) |
registry.entry |
Command registration (/start, /help) |
library.lua |
Type definitions |
- Handlers are Lua modules returning a table of named functions (e.g.,
return { handler = handler }) - Modules are declared in
_index.yamlentry definitions (modules: [http, json, registry, funcs, env, logger]) and loaded viarequire() - Error handling follows the
result, errtwo-return pattern — always checkerrbefore usingresult - CLI processes (
process.lua) return an integer exit code frommain() - Type definitions use Luau-style type annotations (
type Chat = { id: number, ... })
The context.yaml file defines tools for querying Wippy documentation at home.wj.wippy.ai/llm/. Key doc paths:
lua/core/process, lua/core/funcs, lua/core/registry, lua/http/http, lua/http/client, http/server,
http/router, http/endpoint, guides/publishing, guides/dependency-management.
- Docs site: https://home.wj.wippy.ai/
- LLM-friendly index: https://home.wj.wippy.ai/llms.txt
- Batch fetch pages:
https://home.wj.wippy.ai/llm/context?paths=<comma-separated-paths> - Search:
https://home.wj.wippy.ai/llm/search?q=<query>