Skip to content

feat(hackernews): add new, best, ask, show, jobs, search, user commands#290

Merged
jackwener merged 2 commits intojackwener:mainfrom
Astro-Han:worktree-feat-hackernews-expansion
Mar 23, 2026
Merged

feat(hackernews): add new, best, ask, show, jobs, search, user commands#290
jackwener merged 2 commits intojackwener:mainfrom
Astro-Han:worktree-feat-hackernews-expansion

Conversation

@Astro-Han
Copy link
Contributor

Description

Expand HackerNews from 1 command to 8, covering all major HN use cases. All commands use public APIs (strategy: public, browser: false) — no login or browser required.

Command API Description
hackernews new Firebase newstories.json Newest stories
hackernews best Firebase beststories.json Best stories
hackernews ask Firebase askstories.json Ask HN posts
hackernews show Firebase showstories.json Show HN posts
hackernews jobs Firebase jobstories.json Job postings
hackernews search <query> Algolia Search API Full-text search with --sort relevance/date
hackernews user <username> Firebase user/{id}.json User profile (karma, created date, about)

Also improves existing top command with deleted/dead item filtering and dynamic pre-fetch limit.

Example output

$ opencli hackernews search "typescript" --limit 3
┌──────┬──────────────────────────────────┬───────┬────────┬──────────┐
│ Rank │ Title                            │ Score │ Author │ Comments │
├──────┼──────────────────────────────────┼───────┼────────┼──────────┤
│ 1    │ TypeScript types can run DOOM    │ 1328  │ franky │ 360      │
│ 2    │ Why Discord is switching to Rust │ 1582  │ Sikul  │ 642      │
│ 3    │ TypeScript is more popular...    │ 876   │ hk__2  │ 544      │
└──────┴──────────────────────────────────┴───────┴────────┴──────────┘

$ opencli hackernews user pg
┌──────────┬────────┬────────────┬─────────────┐
│ Username │ Karma  │ Created    │ About       │
├──────────┼────────┼────────────┼─────────────┤
│ pg       │ 157316 │ 2006-10-09 │ Bug fixer.  │
└──────────┴────────┴────────────┴─────────────┘

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Testing

  • All 7 new commands verified with npm run dev (returns valid JSON)
  • 9 E2E tests pass in tests/e2e/public-commands.test.ts (2 existing + 7 new)
  • npm run typecheck passes
  • npm run build — 300 manifest entries (293 → 300)

Documentation

  • Updated README.md hackernews command table
  • Updated README.zh-CN.md hackernews command table
  • Updated docs/adapters/browser/hackernews.md with all 8 commands
  • Updated docs/adapters/index.md command list

Astro-Han and others added 2 commits March 23, 2026 14:53
Expand HackerNews from 1 command to 8, covering all major HN use cases.
All YAML adapters, strategy: public, browser: false.

- new/best/ask/show/jobs: Firebase API list endpoints with deleted/dead filtering
- search: Algolia API with query + sort (relevance/date)
- user: Firebase user profile with date formatting
- top.yaml: add filter for deleted/dead items + dynamic pre-fetch limit
- E2E tests for all 7 new commands
- Update README, README.zh-CN, adapter docs
@jackwener jackwener merged commit 127a974 into jackwener:main Mar 23, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants