mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-01 08:59:50 +02:00
feat(browser-skills): bundled hackernews-frontpage reference skill
Smallest interesting browser-skill: scrapes HN front page, returns
30 stories as JSON. No auth, stable HTML, fully fixture-tested.
Files:
SKILL.md frontmatter + prose
script.ts exports parseStoriesFromHtml(html)
main: goto + html + parse + JSON.stringify
_lib/browse-client.ts vendored copy of the SDK
fixtures/hn-2026-04-26.html captured front page (5 stories)
script.test.ts 13 assertions against the fixture
The parser is a pure function over HTML so script.test.ts runs
without a daemon (just imports parseStoriesFromHtml and asserts).
This exercises every Phase 1 component end-to-end:
- browse-client SDK (script imports browse from ./_lib/)
- 3-tier lookup (hackernews-frontpage lives in the bundled tier)
- scoped tokens (read+write is enough for goto + html)
- spawn lifecycle (\$B skill run hackernews-frontpage)
- file-fixture testing (\$B skill test hackernews-frontpage)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e6a27993fe
commit
8a60d99c74
5 files changed
+598
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html><html lang="en" op="news"><head><meta charset="utf-8"><title>Hacker News</title></head>
|
||||
<body><center><table id="hnmain" border="0" cellpadding="0" cellspacing="0" width="85%" bgcolor="#f6f6ef">
|
||||
<tr><td>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="itemlist">
|
||||
<tr class="athing submission" id="40000001">
|
||||
<td align="right" valign="top" class="title"><span class="rank">1.</span></td>
|
||||
<td valign="top" class="votelinks"><center><a id="up_40000001" href="vote?id=40000001"><div class="votearrow" title="upvote"></div></a></center></td>
|
||||
<td class="title"><span class="titleline"><a href="https://example.com/blog-post-1" rel="noreferrer">Show HN: A toy compiler in 200 lines</a> <span class="sitebit comhead"> (<a href="from?site=example.com"><span class="sitestr">example.com</span></a>)</span></span></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td><td class="subtext"><span class="subline">
|
||||
<span class="score" id="score_40000001">412 points</span> by <a href="user?id=alice" class="hnuser">alice</a> <span class="age" title="2026-04-26T08:15:00"><a href="item?id=40000001">3 hours ago</a></span> <span id="unv_40000001"></span> | <a href="hide?id=40000001&goto=news">hide</a> | <a href="item?id=40000001">87 comments</a> </span></td></tr>
|
||||
<tr class="spacer" style="height:5px"></tr>
|
||||
|
||||
<tr class="athing submission" id="40000002">
|
||||
<td align="right" valign="top" class="title"><span class="rank">2.</span></td>
|
||||
<td valign="top" class="votelinks"><center><a id="up_40000002" href="vote?id=40000002"><div class="votearrow" title="upvote"></div></a></center></td>
|
||||
<td class="title"><span class="titleline"><a href="https://example.org/database-internals" rel="noreferrer">Database internals: writing an LSM tree</a> <span class="sitebit comhead"> (<a href="from?site=example.org"><span class="sitestr">example.org</span></a>)</span></span></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td><td class="subtext"><span class="subline">
|
||||
<span class="score" id="score_40000002">298 points</span> by <a href="user?id=bob" class="hnuser">bob</a> <span class="age" title="2026-04-26T07:42:00"><a href="item?id=40000002">4 hours ago</a></span> <span id="unv_40000002"></span> | <a href="hide?id=40000002&goto=news">hide</a> | <a href="item?id=40000002">152 comments</a> </span></td></tr>
|
||||
<tr class="spacer" style="height:5px"></tr>
|
||||
|
||||
<tr class="athing submission" id="40000003">
|
||||
<td align="right" valign="top" class="title"><span class="rank">3.</span></td>
|
||||
<td valign="top" class="votelinks"><center><a id="up_40000003" href="vote?id=40000003"><div class="votearrow" title="upvote"></div></a></center></td>
|
||||
<td class="title"><span class="titleline"><a href="https://example.com/yc-w26-startup">Acme (YC W26) is hiring senior engineers (remote)</a> <span class="sitebit comhead"> (<a href="from?site=example.com"><span class="sitestr">example.com</span></a>)</span></span></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td><td class="subtext"><span class="subline">
|
||||
<span class="age" title="2026-04-26T06:00:00"><a href="item?id=40000003">5 hours ago</a></span> </span></td></tr>
|
||||
<tr class="spacer" style="height:5px"></tr>
|
||||
|
||||
<tr class="athing submission" id="40000004">
|
||||
<td align="right" valign="top" class="title"><span class="rank">4.</span></td>
|
||||
<td valign="top" class="votelinks"><center><a id="up_40000004" href="vote?id=40000004"><div class="votearrow" title="upvote"></div></a></center></td>
|
||||
<td class="title"><span class="titleline"><a href="https://example.net/ask-hn" rel="noreferrer">Ask HN: What's your most underrated tool?</a></span></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td><td class="subtext"><span class="subline">
|
||||
<span class="score" id="score_40000004">156 points</span> by <a href="user?id=carol" class="hnuser">carol</a> <span class="age" title="2026-04-26T05:30:00"><a href="item?id=40000004">6 hours ago</a></span> <span id="unv_40000004"></span> | <a href="hide?id=40000004&goto=news">hide</a> | <a href="item?id=40000004">discuss</a> </span></td></tr>
|
||||
<tr class="spacer" style="height:5px"></tr>
|
||||
|
||||
<tr class="athing submission" id="40000005">
|
||||
<td align="right" valign="top" class="title"><span class="rank">5.</span></td>
|
||||
<td valign="top" class="votelinks"><center><a id="up_40000005" href="vote?id=40000005"><div class="votearrow" title="upvote"></div></a></center></td>
|
||||
<td class="title"><span class="titleline"><a href="https://example.io/quantum&chess">Why quantum & chess engines disagree</a> <span class="sitebit comhead"> (<a href="from?site=example.io"><span class="sitestr">example.io</span></a>)</span></span></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td><td class="subtext"><span class="subline">
|
||||
<span class="score" id="score_40000005">73 points</span> by <a href="user?id=dave" class="hnuser">dave</a> <span class="age" title="2026-04-26T04:00:00"><a href="item?id=40000005">7 hours ago</a></span> <span id="unv_40000005"></span> | <a href="hide?id=40000005&goto=news">hide</a> | <a href="item?id=40000005">12 comments</a> </span></td></tr>
|
||||
<tr class="spacer" style="height:5px"></tr>
|
||||
|
||||
</table>
|
||||
</td></tr>
|
||||
</table></center></body></html>
|
||||
Reference in new issue
Block a user