feat(cli): digest command for windowed per-channel summary#46
Open
mvanhorn wants to merge 2 commits intosteipete:mainfrom
Open
feat(cli): digest command for windowed per-channel summary#46mvanhorn wants to merge 2 commits intosteipete:mainfrom
mvanhorn wants to merge 2 commits intosteipete:mainfrom
Conversation
Adds discrawl digest, a per-channel activity summary over a time window. discrawl already has report for repo-wide README dumps and messages / search for retrieval; digest answers what happened in this guild over the last N days, per channel. Ports vincentkoc/slacrawl#9 (merged 2026-04-22). Same SQL recipe, adapted to discrawl's Discord schema (guild_id, members, mention_events) and the existing stdlib-flag CLI dispatch. This contribution was developed with AI assistance.
RankedCount is reused by digest's top_posters/top_mentions slices.
Without JSON tags, those nested entries serialized as {Name, Count}
while the rest of the digest schema uses snake_case ({channel_id,
messages, ...}). Tag the fields so --json output is consistent.
Surfaced by codex review on the previous commit.
|
To use Codex here, create a Codex account and connect to github. |
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
Adds
discrawl digest, a per-channel activity summary over a time window. discrawl already hasreportfor repo-wide README dumps andmessages/searchfor retrieval; digest answers "what happened in this guild over the last N days, per channel."Ports vincentkoc/slacrawl#9 (merged 2026-04-22). Same SQL recipe, adapted to discrawl's Discord schema (
guild_id,members,mention_events) and the existing stdlib-flag CLI dispatch.Why this matters
--mode raw|distilled|autoreader on top of discrawl's FTS5 tables. A built-in digest gives that workflow a first-class entry point.idx_messages_guild_created_id,idx_mentions_guild_event), andinternal/report/package are already exactly what digest needs. One SQL recipe away.Output
Flags
--sincelookback window. Accepts Go durations (72h) plusNdshorthand (7d,30d). Default7d.--guildfilter to one guild. When omitted, falls back todefault_guild_idfrom config when set.--channeldrill into one channel by id or name.--top-nnumber of top posters / mention targets per channel. Default3.--jsonand--plainfrom the root CLI.Scope
messages/channels/members/mention_eventstables.go.mod.internal/report/digest.go,internal/report/digest_test.go,internal/cli/digest.go,internal/cli/digest_test.go.internal/cli/cli.go(one switch case),internal/cli/output.go(text and plain renderers + usage),internal/report/report.go(added snake_case JSON tags toRankedCount),README.md,SPEC.md.Test plan
gofmt -l .cleango vet ./...cleango build ./cmd/discrawlgo test ./...passes (11 packages, all green)Self-reviewed via
codex reviewbefore pushing. Found one snake_case JSON tag inconsistency onRankedCount, fixed in a follow-up commit on this branch.Open questions
--top-n: went with3to match whatreportalready does internally for top channels and authors. Happy to change to1or5.digestmatched the natural framing vssummaryor folding intoreport --digest. The slacrawl PR went the same direction; happy to rename.internal/report/digest.go. If you'd rather factortopPosters/topMentionsstyle helpers intoreport.goso both commands share them later, easy follow-up.RankedCount: addedjson:"name"andjson:"count"so digest'stop_postersandtop_mentionsserialize as snake_case (consistent with the rest of the digest schema). The existingreportcommand renders Markdown, so this change is observable only via JSON consumers; no current caller uses JSON forRankedCount.Related work
This is the first half of a two-PR sequence. The follow-up is
discrawl analytics(subcommand group withquietandtrends), porting vincentkoc/slacrawl#13. Stacked on top of this PR soanalytics digestcan shim torunDigestand share the implementation.This contribution was developed with AI assistance.