Skip to content
RepoKnit

Understand any codebase.

Ask questions about a public GitHub repository and get answers that point to the exact lines they came from.

Try pallets/flask, fastapi/fastapi or expressjs/express. Indexing isn't live yet, so you'll land on a status page.

demo/minirouter
Demo data

How does a request get dispatched to a handler?

  1. The WSGI entry point is App.__call__. It builds a Request from the environ and passes it to dispatch.

  2. dispatch asks the router to match the method and path. With no match it returns 404 Not Found; otherwise it calls the handler with the captured params.

  3. Router.match checks routes in registration order and returns the first one whose pattern and method both match.

  4. Inference:Because method and path are checked together, a known path called with the wrong method gets a 404 rather than a 405.

Not verified: The retrieved chunks show no error handling around handler calls, so an exception in a handler probably reaches the WSGI server.

In rank order. Scores hidden in demo.

minirouter/app.pyApp.__call__, L25-29cited by 1
25    def __call__(self, environ: dict, start_response: Callable):26        request = Request.from_environ(environ)27        status, body = self.dispatch(request)28        start_response(status, [("Content-Type", "text/plain; charset=utf-8")])29        return [body.encode("utf-8")]
minirouter/app.pyApp.dispatch, L18-23cited by 2
18    def dispatch(self, request: Request) -> tuple[str, str]:19        matched = self.router.match(request.method, request.path)20        if matched is None:21            return "404 Not Found", "Not Found"22        handler, params = matched23        return "200 OK", handler(request, **params)
minirouter/routing.pyRouter.match, L23-28cited by 3, 4
23    def match(self, method: str, path: str):24        for route in self._routes:25            found = route.pattern.match(path)26            if found and method in route.methods:27                return route.handler, found.groupdict()28        return None

Import graph from the fixture's 4 import statements. Select a file to open it.

package module

__init__.pyrequest.pyrouting.pyapp.py
A demo over a small router bundled with this site. Hover a claim to follow it to the code, or select a citation to open the file. Open the full demo workspace

Understand how it fits together. Module and import graphs are parsed from the source, so every edge points at a real import statement.

Investigate with citations. Each claim in an answer links to a file and line range. Anything the code doesn't show is labelled as inference.

Measure retrieval, not prose. Score search against hand-labelled questions to see whether the right code was found before you trust an answer.

What works today

RepoKnit is early. The frontend is real; the indexing and answer backend isn't built yet. How it works covers the plan.

Working

  • Repository URL validation in the browser
  • The interactive demo above, over a bundled fixture
  • A demo workspace with file tree, code search and keyword retrieval
  • An architecture explorer over the fixture and this site's own source
  • A Search Lab that scores BM25 configurations against hand-labelled questions
  • Architecture and pipeline overview

Not built yet

  • Fetching and indexing GitHub repositories
  • Live questions and answers
  • Semantic and hybrid retrieval
  • Accounts, quotas and rate limits