feat(reflow): support nested directories under equalify-docs/reflow
Previously the /reflow handler only rendered top-level .md files
in equalify-docs/reflow/ — subdirectories came back from the
GitHub Contents API as `type: "dir"` entries and got silently
filtered out. Any nested folder was invisible to the site.
## What this change does
1. **List view** (`reflowHandler`) now fetches the whole repo tree
in one call via `GET /repos/.../git/trees/<ref>?recursive=1`,
filters to `reflow/**/*.md`, and groups results by top-level
folder. Known folders (tutorials / how-to / reference /
explanation) render with friendly labels + one-line
descriptions; unknown folders still render with a
title-cased folder name. Flat files at `reflow/*.md` group
under "Overview". `README.md` is hidden (it's the index).
2. **Single-doc view** (`reflowDocHandler`) reads the rest of
the URL off `c.req.path` as a path-style slug, so
`/reflow/how-to/use-the-wordpress-plugin` resolves to
`reflow/how-to/use-the-wordpress-plugin.md`. Defends against
`..` traversal. URL-decoded once.
3. **Detail page** now shows a small category breadcrumb above
the title so readers know which group they're in. No change
for flat files.
4. **Routing** — `/reflow/:slug` → `/reflow/*` in app.tsx
(Hono wildcard, matches the pattern already used by the
repo routes).
## Additional improvements (couldn't get local preview running
without them — small, obviously-useful on their own)
- **`dev.tsx` registers reflow routes.** They were only in
app.tsx (prod) before, so `pnpm start` currently returns 404
on /reflow. This commit wires them into the local dev app
so the preview story actually works.
- **Env-file loading in local dev.** `package.json` start script
now passes `--env-file-if-exists=.env` to node. Unblocks every
env var, not just this feature's. Requires Node ≥ 20.6, which
is already implied by the existing codebase.
- **`PORT` env var in dev.tsx.** Previously hardcoded 3000.
Port 3000 collides with other local services (e.g. Metabase
from equalify-reflow-feedback), so defaulting to 3000 while
allowing override via `PORT` is a quick quality-of-life fix.
- **`EQUALIFY_DOCS_REF` env var.** Lets a local dev point the
hub at a docs branch instead of `main` — useful for previewing
a docs PR before merging it. Defaults to `main`. Documented
in .env.example.
Together, (dev-routes + env-file + PORT + DOCS_REF) is what
makes the local preview story real. Previously "run it locally"
was documented in the README but didn't actually get /reflow
in front of you.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>