SLOPSHOPPER

scenario-feed

Answers the session calls of the mod under render from the statuslin.es preview scenario.

commandstatustimer
A shopper browsing a rack in a slop shop
README

statuslin.es

A community gallery of Claude Code status lines. Browse real configs as rendered previews, see which ones people copy, and copy one to your terminal. You see what each script actually renders to before you copy it, instead of guessing from the source.

Live at statuslin.es.

How it works (and why it's safe)

A status line is an arbitrary script Claude Code runs to draw the bottom strip of your terminal, so this site hosts and runs strangers' shell scripts. The safety model is the whole point:

  • Your code runs once, at submit time. Not on page views. A submitted script runs a single time in a fresh E2B sandbox with no network access by default, a hard 5-second timeout, and only COLUMNS/LINES passed in; then the sandbox is destroyed. (A script may declare network hosts it needs; those submissions are held for human review and rendered behind an egress allowlist.) Browsing the gallery serves pre-rendered HTML — no submitted script runs when you visit.
  • A human reviews every config before it's published. Rendered previews land in a review queue; nothing goes live automatically.
  • Published versions are pinned to a content hash and immutable. The exact reviewed bytes are what gets served and copied. There's no path to swap in unreviewed code after approval.

Stack

Bun · Vite · TanStack Start (React SSR) · Better Auth (GitHub) · Drizzle + Postgres · E2B.

This is an agent-first codebase: most changes are written by AI agents against mechanical gates (typecheck, lint, tests, git hooks). CLAUDE.md holds the conventions; CONTRIBUTING.md is how to get started.

Local development

Prereqs: Bun and Docker. Then bun install.

1. Local Postgres

There's no hosted dev database. Local dev runs against its own throwaway Postgres container. Port 5433 (host) so it won't clash with anything already on 5432:

docker run -d --name statuslines-postgres \
  -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=statuslines \
  -p 5433:5432 postgres:18

Later, start/stop it with docker start statuslines-postgres / docker stop statuslines-postgres.

2. Env (.env.local)

Bun auto-loads two env files in dev: the committed .env.development, which already holds working local defaults for DATABASE_URL and BETTER_AUTH_URL, and your own gitignored .env.local, which wins over it. .env.schema is the committed list of every variable, with its type and a note on where each environment sets it. (.env.staging / .env.production are just the source you push to Fly secrets; see docs/deploy.md.)

Create .env.local with the only values you fill in:

BETTER_AUTH_SECRET=        # generate with: openssl rand -base64 32
GITHUB_CLIENT_ID=          # from the GitHub OAuth app below
GITHUB_CLIENT_SECRET=      # from the GitHub OAuth app below

E2B_API_KEY is optional locally: set RENDER_RUNNER=fake instead and submitted scripts render with a built-in fake runner. The dev server renders each submission in the background as soon as it's submitted; there's no separate worker to run. The dev server's port is derived from BETTER_AUTH_URL, so the default :3100 comes from that URL; change the URL and the port moves with it.

Create a GitHub OAuth app

Sign-in is GitHub-only, so local dev needs its own free OAuth app:

  1. Go to GitHub → Settings → Developer settings → OAuth Apps → New OAuth App (<https://github.com/settings/developers>).
  2. Fill in:
  3. Application name: anything (e.g. statuslines-dev)
  4. Homepage URL: http://localhost:3100
  5. Authorization callback URL: http://localhost:3100/api/auth/callback/github
  6. Register it, copy the Client ID into GITHUB_CLIENT_ID, then Generate a new client secret and copy it into GITHUB_CLIENT_SECRET.

3. Schema, run, seed

bun run db:migrate     # create the schema in the local DB
bun run dev            # serves on the BETTER_AUTH_URL port (default http://localhost:3100)

Sign in once with GitHub to create your user, then (optionally) bun run seed:gallery for sample configs. It needs an existing user to author them, so it must come after the first sign-in.

Once you have a user, bun run dev:login mints a session and prints a cookie command so an automated browser can test signed-in pages without going through GitHub again — see docs/testing-signed-in.md. (It needs an existing user, so it doesn't replace that first GitHub sign-in.)

4. The gate

Run before every push (the pre-commit hook only runs lint + typecheck):

bun run check          # typecheck + lint + test

Tests use PGlite against the real committed migrations, so they don't need the container running.

There's also a browser smoke test — bun run smoke drives a real browser against the running app to catch hydration/auth breakage the source gates can't see. It needs agent-browser, a migrated dev DB, and a signed-in user, so it's not part of the push hook — run it locally when you touch the client or auth.

Contributing

Code contributions are welcome. See CONTRIBUTING.md. To share a status line you don't need this repo: submit it on statuslin.es. Found a security issue? See SECURITY.md.

License

MIT.

Source 1 files
hooks/register.ts 105 lines
1/** Written by the recorder before Claude Code starts: `FeedFile` in src/render/mods/scenario-feed.ts. */
2const FEED_FILE = '/home/user/.statuslines/feed.json'
3const FEED_PLUGIN = 'scenario-feed'
4/** Merged over the engine's own answer, so a requested breakdown still comes back. */
5const MERGED = new Set(['session.usage'])
6/** Well inside the terminal recorder's 2 s of quiet (`SESSION_TIMING` in recorder.ts). */
7const TICK_MS = 500
8
9type Usage = { context?: Record<string, unknown> } & Record<string, unknown>
10type Feed = { target: string | null; answers: Record<string, unknown>; busy: unknown[] }
11type Next = ((e: unknown) => Promise<unknown>) & { origin: { plugin: string } }
12type Engine = {
13  fs: { read: (path: string) => Promise<string> }
14  tool: { call: (call: never) => Promise<unknown> }
15  clock: {
16    after: (ms: number, fn: () => void) => unknown
17    every: (ms: number, fn: () => void) => { cancel: () => void }
18  }
19  command: { register: (spec: { name: string; description: string }) => Promise<unknown> }
20  ui: { status: (text: string | undefined) => void }
21}
22type Hook = ($: Engine, e: unknown, next: Next) => Promise<unknown>
23type On = {
24  (event: string, hook: Hook): void
25  (event: string, matcher: { command: string }, hook: Hook): void
26}
27type Register = (on: On) => void
28
29let feed: Feed | undefined
30
31async function readFeed($: Engine): Promise<Feed> {
32  feed ??= JSON.parse(await $.fs.read(FEED_FILE)) as Feed
33  return feed
34}
35
36/**
37 * Answers only the mod under render: Claude Code's built-in plugins call `$` too, and must get the
38 * engine's real answers.
39 */
40async function answer($: Engine, event: string, e: unknown, next: Next) {
41  const plugin = next.origin.plugin
42  if (plugin === FEED_PLUGIN) return next(e)
43  const { target, answers } = await readFeed($)
44  if (plugin !== target || !Object.hasOwn(answers, event)) return next(e)
45  if (!MERGED.has(event)) return { value: answers[event] }
46  const real = ((await next(e)) as { value?: Usage }).value ?? {}
47  const scenario = answers[event] as Usage
48  return { value: { ...real, ...scenario, context: { ...real.context, ...scenario.context } } }
49}
50
51/**
52 * One call at a time, as Claude would make them; each runs through the mod's `tool.call` hooks.
53 * The calls draw nothing, and the terminal recorder takes its frame after 2 s of quiet, so a
54 * status ticks until the last call returns, then clears: the frame comes after the whole session.
55 */
56async function playBusy($: Engine) {
57  let tick = 0
58  const ticking = $.clock.every(TICK_MS, () => {
59    tick += 1
60    $.ui.status(`preview ${'.'.repeat(tick % 4)}`)
61  })
62  try {
63    for (const call of (await readFeed($)).busy) await $.tool.call(call as never)
64  } finally {
65    ticking.cancel()
66    $.ui.status(undefined)
67  }
68}
69
70/**
71 * Each event by its literal name, because the engine refuses an `on()` whose event is not a
72 * string literal. Never a wildcard hook: it also sits in `command.run`, and the engine then
73 * credits this plugin in the mod's own command reply.
74 */
75export const register: Register = (on) => {
76  on('session.usage', ($, e, next) => answer($, 'session.usage', e, next))
77  on('session.model', ($, e, next) => answer($, 'session.model', e, next))
78  on('session.cwd', ($, e, next) => answer($, 'session.cwd', e, next))
79  on('session.root', ($, e, next) => answer($, 'session.root', e, next))
80  on('session.id', ($, e, next) => answer($, 'session.id', e, next))
81  on('session.repo', ($, e, next) => answer($, 'session.repo', e, next))
82  on('session.version', ($, e, next) => answer($, 'session.version', e, next))
83  // Registered in the baseline too, so both sessions type the same steps.
84  on('session.start', async ($, e, next) => {
85    // A failed registration must not keep the mod's own session.start from running.
86    await $.command
87      .register({
88        name: 'preview-busy',
89        description: 'Plays a short busy session for the statuslin.es preview.',
90      })
91      .catch(() => undefined)
92    return next(e)
93  })
94  // An empty text draws one bare reply row; no text at all draws nothing, but leaves no transcript
95  // line either, and Desktop's recorder waits on one to know a step was sent. The calls draw no
96  // rows of their own, and run once the command has answered.
97  on('command.run', { command: 'preview-busy' }, async ($) => {
98    $.clock.after(0, () => {
99      // A mod's hook may throw mid-sequence; the frame then shows where the sequence stopped.
100      playBusy($).catch(() => undefined)
101    })
102    return { text: '' }
103  })
104}
105