Skip to content

add Alignment Forum commands: posts, post, search, tags, user - #1

Open
tamnd wants to merge 1 commit into
mainfrom
feat/pr1-alignmentforum-commands
Open

add Alignment Forum commands: posts, post, search, tags, user#1
tamnd wants to merge 1 commit into
mainfrom
feat/pr1-alignmentforum-commands

Conversation

@tamnd

@tamnd tamnd commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Implements alignmentforum-cli (binary af) reading the Alignment Forum via its public GraphQL API.

Commands

  • top -- list top-scored posts (last N days, configurable via --days)
  • new -- list most recently published posts
  • best -- list best-of-all-time posts
  • search <query> -- full-text search with relevance ranking
  • post <id> -- single post by internal ID
  • user <slug> -- user profile and stats
  • tags -- list curated AI safety research tags (25 entries)
  • version -- version information

Design

  • GraphQL API at alignmentforum.org/graphql, no auth required for public content
  • Single POST per command; server returns N results in one round trip so no concurrency pool is needed
  • Rate pacing (500ms default), retry on 429/5xx with linear backoff (500ms per attempt, cap 5s)
  • All output via shared reflection renderer: table (TTY auto), JSONL (piped auto), JSON, CSV, TSV, URL, raw
  • Exit code 3 for empty result or not found, distinguishable from error exit code 1

Tests

Four transport-layer tests using httptest.Server:

  • TestGraphQLSendsUserAgent -- User-Agent header present on every request
  • TestGraphQLRetriesOn503 -- 503 twice then 200, verifies 3 hits and backoff elapsed
  • TestGraphQLNotFound -- null result returns ErrNotFound
  • TestGraphQLErrorField -- errors array surfaces the message text

All pass with -race.

Replace the scaffold placeholder text with the actual command list,
flag table, usage examples, and project layout now that the
implementation is complete.
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.

1 participant