Before doing anything else, detect the stack by reading manifest files at
the repo root: package.json, pyproject.toml, requirements.txt, Cargo.toml,
go.mod, Gemfile, mix.exs, build.gradle, pom.xml, composer.json.
Report which you found in one short line. Then proceed with the stage-
specific task below, adapting your reading list to that stack.

Repo: $repo_name at $repo_path
Wiki root: $wiki_root
HEAD: $head_sha
Today: $today

Stage 2 of 5 — routes and controllers.

Read the request-handling surface, adapting to the detected stack:
  - Ruby on Rails: config/routes.rb + app/controllers
  - Python (FastAPI): @app.get / @router decorators across routers
  - Python (Flask): @app.route / blueprints
  - Python (Django): urls.py + views.py
  - JS/TS (Express): app.use / router.get/post and the handlers they mount
  - Go (chi / gin / net/http): mux/router definitions and handler funcs
  - Other: whatever file declares the URL → handler mapping

Generate $wiki_root/projects/$repo_name/routes.md with the full route
inventory grouped by resource or namespace: HTTP verb, path, handler,
purpose. Use a Mermaid sequence diagram for any non-trivial request flow.

Generate $wiki_root/projects/$repo_name/controllers/<key>.md per
non-trivial controller / handler module: actions, auth/permission rules,
input shape, output shape, side effects, links to the [[data-model]] pages
it touches. Skip trivial CRUD scaffolding.

Use [[wikilinks]] to cross-reference models from stage 1. Every page must
carry the v2 frontmatter template:

    ---
    title: <page title>
    type: controller | overview
    source: bootstrap
    project: $repo_name
    created: $today
    updated: $today
    tags: [routes, ...]
    confidence: high | medium | low
    ---

Rules:
- Edit only files inside $wiki_root.
- Do NOT touch $wiki_root/raw/.
- Stay within $wiki_root/projects/$repo_name/ for repo-specific pages.

After editing, append one entry to $wiki_root/log.md:
`## [$today] bootstrap-2 | $repo_name $head_sha — routes`.

Return a single short confirmation message; do not summarize the changes.
