Skip to content

[Docs] Create REST API Reference (docs/reference/API_REFERENCE.md) for repowise serve endpoints #2093

Description

@akshatmalik-bruh

Problem Statement

While Repowise maintains dedicated reference documentation for the CLI (CLI_REFERENCE.md), configuration schema (CONFIG.md), and MCP tools (MCP_TOOLS.md) under docs/reference/, there is currently no REST API Reference document (API_REFERENCE.md).

The FastAPI backend (repowise serve) powers both the Next.js web dashboard and external HTTP clients, exposing 33 router modules under packages/server/src/repowise/server/routers/. While individual endpoints are mentioned in passing across architecture deep-dives, developers building custom integrations or querying repowise serve programmatically lack a single, authoritative API reference detailing request/response schemas, parameters, authentication, and status codes.


Undocumented Endpoint Clusters

Below is the breakdown of the 33 router modules that require OpenAPI / Markdown documentation:

1. Repository Management & Sync (routers/repos.py, routers/jobs.py)

  • GET /api/repos — List registered repositories
  • GET /api/repos/summary — Aggregate stats for all repositories in one call
  • POST /api/repos — Register a new repository
  • POST /api/repos/{id}/sync — Trigger structural graph sync (no LLM calls)
  • POST /api/repos/{id}/full-resync — Full regeneration of wiki pages and vector embeddings
  • GET /api/jobs & GET /api/jobs/{id}/stream — Background job status and live SSE progress stream

2. Workspace & Multi-Repo Architecture (routers/workspace.py, routers/coupling.py)

  • GET /api/workspace/system-graph — System-wide cross-repo dependency graph
  • GET /api/workspace/contracts & /detail — Extracted API contract links and schemas
  • GET /api/workspace/blast-radius — Cross-repository blast radius analysis
  • GET /api/workspace/breaking-changes — Incompatible cross-repo contract report
  • GET /api/workspace/conformance — Architectural boundary conformance report
  • GET /api/workspace/architecture — System score and role metrics per repo/service
  • GET /api/workspace/diagnostics — Workspace health and drift diagnostics

3. Refactoring & Code Health (routers/refactoring.py, routers/code_health/)

  • GET /api/repos/{id}/refactoring/opportunities — Ranked refactoring suggestions
  • GET /api/repos/{id}/refactoring/opportunities/{opportunity_id} — Detailed refactoring plan
  • POST /api/repos/{id}/refactoring/{suggestion_id}/generate-code — Generate refactored diff
  • GET/PUT /api/repos/{id}/refactoring/settings — Toggle LLM refactoring settings
  • GET /api/repos/{id}/health/overview — Defect, maintainability, and performance scores
  • GET /api/repos/{id}/health/coverage — Coverage ingestion stats and per-file test coverage

4. Architecture Visualization & C4 (routers/c4.py)

  • GET /api/graph/{id}/c4/l1 — L1 System Context diagram payload
  • GET /api/graph/{id}/c4/l2 — L2 Container diagram payload
  • GET /api/graph/{id}/c4/l3 — L3 Component diagram payload
  • GET /api/graph/{id}/c4/structurizr — Structurizr DSL export
  • GET /api/graph/{id}/c4/mermaid — Mermaid SVG/diagram export

5. Search, Symbols & Documentation (routers/search.py, routers/pages.py, routers/symbols.py)

  • GET /api/search — Hybrid search (semantic vector + FTS5/tsvector full-text)
  • GET /api/pages — Wiki page retrieval (supports fields=summary or fields=full)
  • GET /api/symbols — Symbol index and filterable call graph

6. Architectural Decisions & Episodes (routers/decisions.py, routers/episodes.py)

  • GET /api/repos/{id}/decisions — ADR list and candidates
  • GET /api/repos/{id}/decisions/lane-counts — Decision counts by lifecycle lane
  • GET /api/repos/{id}/episodes — Mined transcripts and decisions over HTTP

7. Codebase Chat (routers/chat.py)

  • POST /api/repos/{id}/chat/messages — SSE streaming agentic Q&A loop
  • GET/DELETE /api/repos/{id}/chat/conversations — Conversation history persistence

8. Webhooks & System Operations (routers/webhooks.py, routers/meta.py, routers/mcp.py)

  • POST /api/webhooks/github — GitHub push webhook (HMAC verified)
  • POST /api/webhooks/gitlab — GitLab push webhook
  • GET/PATCH /api/mcp/tools — Read/toggle active MCP tool surface per repo
  • GET /health & GET /metrics — Liveness/readiness probes and Prometheus metrics

Proposed Solution

  1. Create docs/reference/API_REFERENCE.md structured by resource area:
    • Authentication (REPOWISE_API_KEY bearer token requirements)
    • Response envelope formats and error payload shapes
    • Endpoint reference tables (HTTP method, route, parameters, return type)
    • Code examples (curl / fetch)
  2. Add a cross-link to API_REFERENCE.md in docs/README.md and docs/architecture/ARCHITECTURE.md.

Tasks

  • Draft docs/reference/API_REFERENCE.md
  • Document authentication headers and error responses
  • Document all 33 router endpoint groups
  • Cross-link from main documentation navigation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions