feat: render kato summaries per-channel (markdown|json) - #2
Merged
Conversation
kato now emits a summaryFormat marker (markdown or json) with each summary. kato-bot reads it and converts either format into what each platform needs: Telegram gets a restricted HTML subset (<b>/<i>/<code>/<pre>/<a>, bullets, escaping), Lark keeps native Markdown. - internal/summaryfmt: converter (ToMarkdown, ToTelegramHTML) handling both markdown and the json block schema, with HTML escaping and code/link safety - read summaryFormat from kato (client + core.RunResult + core.ServiceResult) - single-run result: Telegram HTML render, Lark markdown render - group run: per-service Lark cards + the Telegram group summary Fixes Telegram showing raw ## / ** / backtick markdown literally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nders as markdown Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kato now emits a
summaryFormatmarker (markdownorjson) alongside each summary. This teaches kato-bot to read that marker and convert either format into what each chat platform needs — fixing Telegram showing raw Markdown (##,**,`) as literal characters.<b>/<i>/<code>/<pre>/<a>with proper escaping.What changed
internal/summaryfmt(new, tested):ToMarkdown(summary, format)andToTelegramHTML(summary, format). Handles both kato Markdown and the json{verdict, headline, blocks[]}schema. Markdown is the canonical hub: json blocks are normalized to Markdown, then Telegram HTML is produced from that single path. Code spans and links are protected so emphasis never bleeds into them;<,>,&are escaped.summaryFormatadded to the kato client,core.RunResult, andcore.ServiceResult(+ threaded through the group runner).keyboards.go) renders HTML; Lark (cards.go) renders Markdown.groupcards.go) + the Telegram group summary (dispatch.go).Before / after (Telegram)
Before:
## Diagnosis/**web**/- itemshown literally.After: Diagnosis (bold), web bold,
• itembullets,<code>/<pre>for code, entities escaped.Testing
go build ./...,go vet ./...,go test ./...— all green (existing Lark/Telegram tests included, no regressions).summaryfmttests cover markdown→HTML, json→markdown, json→HTML, escaping, fenced code, and code-span emphasis suppression.Pairs with gopaytech/kato#1 (the kato side that emits
summaryFormat).🤖 Generated with Claude Code