hn-brief

Hacker News hot-comment briefing demo built with MoonBit async and Wasm

agent
skill
wasm
async
moon add peter-jerry-ye/hn-brief@0.1.1
Download zip
Version
0.1.1
License
Apache-2.0
Last updated
last month
Downloads
22

Dependencies

README

#HN Brief

Fetch Hacker News top stories, ranked comments, and summarize them with DeepSeek.

moon runwasm peter-jerry-ye/hn-brief@0.1.1

The default run fetches 10 stories, 3 ranked comments per story, and asks DeepSeek for a Simplified Chinese brief. It reads DEEPSEEK_API_KEY from the environment.

To print the HN stories and comments that were sent to DeepSeek:

moon runwasm peter-jerry-ye/hn-brief@0.1.1 -- --raw

Optional flags:

moon runwasm peter-jerry-ye/hn-brief@0.1.1 -- --limit 5 --comments 4 --lang "Simplified Chinese"

To verify runtime network policy, allow Hacker News but deny DeepSeek:

moon runwasm --experimental-policy deny-deepseek.toml peter-jerry-ye/hn-brief@0.1.1 -- --limit 1 --comments 0

#
BriefStats

pub(all) struct BriefStats {
stories : Int
hot_comments : Int
total_score : Int
total_discussion_comments : Int
} derive(ToJson,
Debug
)

#
CommentBrief

pub(all) struct CommentBrief {
id : Int
by : String
text : String
replies : Int
} derive(ToJson,
Debug
)

#
HnItem

pub(all) struct HnItem {
id : Int
by : String?
time : Int?
text : String?
deleted : Bool?
dead : Bool?
kids : Array[Int]?
url : String?
score : Int?
title : String?
descendants : Int?
} derive(ToJson,
Debug
,
FromJson
)

#
HnItem::is_visible

fn HnItem::is_visible(self : HnItem) -> Bool

#
HnItem::reply_count

fn HnItem::reply_count(self : HnItem) -> Int

#
HnItem::to_comment_brief

fn HnItem::to_comment_brief(self : HnItem) -> CommentBrief

#
HnItem::to_story_brief

fn HnItem::to_story_brief(self : HnItem, hot_comments : Array[CommentBrief]) -> StoryBrief

#
Options

type Options

#
StoryBrief

pub(all) struct StoryBrief {
id : Int
title : String
url : String
score : Int
comments : Int
hot_comments : Array[CommentBrief]
} derive(ToJson,
Debug
)

#
clean_hn_text

fn clean_hn_text(text : String) -> String

#
render_markdown

fn render_markdown(stories : ArrayView[StoryBrief], summary : String, model_label~ : String, show_context? : Bool) -> String

#
stats

fn stats(stories : ArrayView[StoryBrief]) -> BriefStats

#
summary_prompt

fn summary_prompt(stories : ArrayView[StoryBrief], lang : String) -> String

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io