[WIP] Post Roulette feed where it sends you random posts by users you follow, unbiased by post age.
AGENTS.md#
Repository summary#
- Ruby gem that provides a BlueFactory feed implementation.
- Main entrypoint:
lib/bskypostroulettefeed.rb. - Feed definition and server configuration live in
lib/bskypostroulettefeed/feed/. - Tests use Minitest in
test/. - Linting/formatting uses StandardRB via
standardgem. - Build/release tasks come from
bundler/gem_tasks.
Setup#
- Install dependencies:
bin/setup(runsbundle install). - Use
bundle execfor all Ruby tooling. - Ruby version must satisfy the gemspec requirement (
>= 3.2.0).
Common commands#
- Default checks:
bundle exec rake(runs tests + StandardRB). - Tests (all):
bundle exec rake test. - Tests (single file):
bundle exec rake test TEST=test/test_bskypostroulettefeed.rb. - Tests (single test name):
bundle exec ruby -Itest test/test_bskypostroulettefeed.rb -n test_name. - Lint/format:
bundle exec standardrb. - Lint via rake:
bundle exec rake standard. - Build gem:
bundle exec rake build. - Install gem locally:
bundle exec rake install. - Interactive console:
bin/console. - Run feed server (local dev):
bin/dev-feed(requires env vars).
Environment variables#
PUBLISHER_DID: DID used by BlueFactory publisher.HOSTNAME: hostname for feed endpoints.- Configure via shell env before running
bin/dev-feed.
Code layout#
lib/bskypostroulettefeed.rbdefines the gem module.lib/bskypostroulettefeed/version.rbstoresVERSION.lib/bskypostroulettefeed/feed/contains feed config and implementation.sig/stores RBS type signatures.test/contains Minitest suites andtest_helper.
Formatting and linting (StandardRB)#
- Use StandardRB conventions; do not manually fight the formatter.
- Run
bundle exec standardrbafter edits that touch Ruby files. - Prefer StandardRB defaults (2-space indent, no semicolons).
- Let StandardRB manage trailing commas and hash formatting.
Requires and file loading#
- Use
# frozen_string_literal: trueat top of Ruby files. - Order requires as: stdlib, gem dependencies, then
require_relative. - Prefer
require_relativefor internal library files. - Keep require blocks minimal and scoped to file needs.
Naming conventions#
- Modules/classes: CamelCase (
PostRouletteFeed,Bskypostroulettefeed). - Methods/variables: snake_case.
- Constants: SCREAMING_SNAKE_CASE.
- Files: snake_case, mirroring module paths.
- Test classes:
Test*subclasses ofMinitest::Test. - Test methods:
test_*names.
Types and signatures#
- Public API changes should be reflected in
sig/*.rbs. - Keep RBS modules/classes aligned with Ruby implementation.
- Use
String,Integer,Array[String]style RBS types. - If adding new public classes, add matching RBS stubs.
Error handling#
- Define custom errors under
Bskypostroulettefeed::Errorwhen needed. - Raise specific errors rather than generic
StandardError. - Avoid rescuing broad exceptions unless you re-raise with context.
- Include actionable messages for runtime errors.
Configuration and environment#
- Use
ENV.fetchwhen a variable is required. - Use
ENV["NAME"]when optional. - Keep configuration centralized in
lib/bskypostroulettefeed/feed/config.rb.
Feed implementation guidance#
Feed#get_postsshould return a hash withposts:array.display_nameanddescriptionshould return plain strings.- Keep network calls isolated; prefer small helper methods.
Testing style#
- Require
test_helperat the top of test files. - Use
refute_nil,assert,assert_equal, etc. from Minitest. - Prefer small, focused tests over large integration cases.
- Use fixture helpers in
test/if new ones are introduced.
Dependencies#
- Add runtime dependencies in
bskypostroulettefeed.gemspec. - Add dev/test dependencies in
Gemfile. - Prefer adding only what is needed to keep the gem slim.
Documentation updates#
- Update
README.mdwhen public usage or CLI behavior changes. - Update
CHANGELOG.mdfor noteworthy changes.
Git and release notes#
- Use
bundle exec rake buildto verify packaging. - Avoid running
bundle exec rake releaseunless instructed. - Do not update gemspec metadata unless asked.
Editor and agent rules#
- No
.cursor/rules/,.cursorrules, or Copilot instructions found. - If such files are added later, follow them for their scope.
Writing new files#
- Match existing folder structure (
lib/,test/,sig/). - Keep file names aligned with module names.
Performance and clarity#
- Favor clear, readable Ruby over micro-optimizations.
- Keep methods short and single-purpose.
- Extract helpers when logic grows beyond a few lines.
Security and secrets#
- Never commit API keys or tokens.
- Use environment variables or local config files for secrets.
Optional tooling (if needed)#
- Use
bundle exec rake -Tto list available rake tasks. - Use
bundle exec irb -r ./lib/bskypostroulettefeedfor quick REPL.
Quick troubleshooting#
- Run
bundle exec rakeif unsure which checks to run. - If StandardRB fails, fix offenses then re-run.
- If tests fail, run single tests with
-nfor isolation.
Conventions to keep#
- Maintain
# frozen_string_literal: truein Ruby source. - Keep
require_relativepaths consistent and minimal. - Keep module nesting aligned with folder structure.
- Avoid monkey-patching global classes unless requested.
Versioning#
- Update
lib/bskypostroulettefeed/version.rbfor releases. - Keep version as a semantic version string.
BlueFactory specifics#
BlueFactory.add_feedis configured infeed/config.rb.BlueFactory::Server.run!is used inbin/dev-feed.- Keep feed registration centralized in config.
New tests checklist#
- Add tests under
test/and name filestest_*.rb. - Ensure new tests run under
bundle exec rake test.
Summary for agents#
- Use StandardRB and Minitest.
- Use
bundle execand update RBS with API changes. - Ask before running release-related commands.