Co.Revington.Sightline 0.5.0

{
  "servers": {
    "Co.Revington.Sightline": {
      "type": "stdio",
      "command": "dnx",
      "args": ["Co.Revington.Sightline@0.5.0", "--yes", "--", "mcp"]
    }
  }
}
                    
This package contains an MCP Server. The server can be used in VS Code by copying the generated JSON to your VS Code workspace's .vscode/mcp.json settings file.
dotnet tool install --global Co.Revington.Sightline --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Co.Revington.Sightline --version 0.5.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Co.Revington.Sightline&version=0.5.0
                    
nuke :add-package Co.Revington.Sightline --version 0.5.0
                    

Sightline

NuGet Downloads Release License: MIT

A live, editable map of your code: C#, TypeScript and JavaScript, alone or side by side in one repository. It reads each language with its own compiler (Roslyn for C#, the TypeScript compiler for TypeScript and JavaScript) and shows, in one page:

  • projects, npm and NuGet packages, and how projects use each other
  • namespaces, folders and types
  • dependency injection: which class is registered for which service, and with what lifetime (also NestJS providers)
  • HTTP endpoints (controllers, minimal APIs, SignalR hubs, gRPC services; Express, Fastify, Koa, Hono, NestJS and Next.js routes)
  • the flow behind each endpoint: handler, services, repositories, database and outbound HTTP calls, which go on into the endpoint they reach when it is part of the code too
  • problems: a singleton that holds a scoped service, a service nobody registered, circular dependencies, broken layer rules

The map redraws while you edit, and with your .NET app running it also shows what the app really does: the services it registered, the endpoints it mapped, and every request it handles, down to the SQL it ran.

Sightline: an edit in the code panel adds a step to the flow of an endpoint

Try the live demo at sightline.revington.co. It runs in the browser; nothing to install.

Get started

Sightline is installed with .NET, whatever language your code is in: it needs the .NET 10 SDK or newer, and Node.js 18 or newer to read TypeScript and JavaScript. The package is Co.Revington.Sightline; the command is sightline.

Try it without installing anything. In a folder with a .sln, or a package.json:

dnx Co.Revington.Sightline

Set it up for your repository, so the whole team has it. In the folder with your code, usually the root of the repository:

dnx Co.Revington.Sightline init

init pins Sightline in the repository's tool manifest (dotnet-tools.json), writes sightline.json with what to open, and adds a "Sightline: open the map" task to .vscode/tasks.json when the folder uses VS Code. Running it again changes nothing that is already set up. Commit the files it lists; from then on, anyone who clones the repository runs:

dotnet tool restore
dotnet sightline

dotnet sightline works from any folder in the repository. C# projects that were never restored are restored first, as dotnet build does.

Add it to the .NET app you run, so the map opens beside it every time you run a Debug build:

dotnet add package Co.Revington.Sightline.Hosting
Sightline: the live map of this solution is at http://localhost:5210 (or open /sightline on this app)

With the app running, the map gets what the app really does: its real registrations and endpoints, every request it handles, and Try it on each endpoint. Only Debug builds of apps get the package's code; Release builds, test projects, CI runs and tools that load the app (such as dotnet ef) are left alone, and no assembly is added to the app. The map stays open across restarts (dotnet watch, a new debug session) and closes 10 seconds after the app stops. Turn it off with <SightlineAutoStart>false</SightlineAutoStart> in the project file, or SIGHTLINE_AUTOSTART=0 for one run; <SightlineOpenBrowser>true</SightlineOpenBrowser> also opens the browser.

In VS Code, the Sightline extension opens the map from the status bar, shows the method or function under the cursor on the map (Show in Sightline, Ctrl+Alt+M, in C#, TypeScript and JavaScript files), and lists Sightline's problems in the Problems panel.

For AI assistants, sightline mcp serves the map over the Model Context Protocol, so an assistant can ask how the code fits together instead of searching files. In VS Code, .vscode/mcp.json:

{
  "servers": {
    "sightline": {
      "type": "stdio",
      "command": "dnx",
      "args": ["Co.Revington.Sightline", "--yes", "--", "mcp", "${workspaceFolder}"]
    }
  }
}

In Claude Code: claude mcp add sightline -- dnx Co.Revington.Sightline --yes -- mcp. In a repository set up with init, dotnet sightline mcp works too. The tools give an overview of the code, find symbols, list endpoints and services, trace a request or method both ways, describe a type, list problems, and show what depends on something.

In CI, sightline check fails the build on problems, and the Sightline GitHub Action comments on each pull request with what it does to the map:

on: pull_request
permissions:
  contents: read
  pull-requests: write
jobs:
  map:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: ravindu-rev/sightline-action@v1

Install it just for yourself: dotnet tool install --global Co.Revington.Sightline, then run sightline in any repository.

Commands

sightline [path] [options]            # open the map
sightline init [folder]               # set a repository up for everyone who works on it
sightline check [path]                # list problems; exit code 1 when there are errors
sightline export [path] --out <dir>   # the map as a static website anyone can open
sightline diff [path] --base <ref>    # what a change does to the map, for pull requests
sightline mcp [path]                  # serve the map to AI assistants

The path is a .sln, .slnx, .csproj or package.json file, or a folder. Without it, Sightline opens what the nearest sightline.json names, or the nearest solution in the current folder or above it, up to the top of the repository, or else the npm packages there. The map opens in the browser at http://localhost:5210.

Option What it does
--port <n> Port for the map page. The next free one is used if it is busy.
--no-open Do not open the browser.
--no-restore Do not run dotnet restore for C# projects that were never restored.
--version Show the version.
init --solution <file> The solution to open, when the folder has several. Without it, init asks.
init --vscode, init --no-vscode Add the VS Code task even without a .vscode folder, or never.
init --no-tool Do not pin Sightline in the tool manifest.
check --format text\|json\|github github writes annotations and a job summary for GitHub Actions; it is the default inside Actions.
check --fail-on error\|warning\|info\|never Which problems make the exit code 1. Default error.
export --out <folder> Write a static website. Host the folder anywhere, such as GitHub Pages; browsers do not run it straight from disk.
export --json <file> Write the map as JSON, the input of diff.
export --no-source, --source-url <url> Leave the source code out, or load it from an address with {path} in it, such as https://raw.githubusercontent.com/owner/repo/<commit>/{path}.
diff --base <ref> Compare the working tree with a commit, branch or tag. Or give two files written by export --json.
diff --format markdown\|text\|json, --out <file> Markdown is ready for a pull request comment.
diff --fail-on error\|warning\|never Exit with 1 when the change adds problems of this level.

Exported maps and diff never contain paths from your machine: files are shown relative to the repository, and load warnings are left out.

Languages

Language Read with Projects Endpoints Dependency injection
C# Roslyn, the C# compiler, through MSBuild .sln, .slnx, .slnf, .csproj ASP.NET Core controllers and minimal APIs, SignalR hubs, gRPC services, health checks IServiceCollection registrations
TypeScript, JavaScript The TypeScript compiler 6.0, which comes with Sightline and runs in Node.js package.json, with npm, yarn and pnpm workspaces Express and the routers like it (Polka, Restify), Fastify, Koa, Hono, NestJS controllers, Next.js route handlers NestJS providers

One map for a repository in several languages. JavaScript and TypeScript packages anywhere under the folder of a solution join its map, next to the C# projects. Where code sends an HTTP request (fetch, axios, got, ky, HttpClient, ...) and the address fits exactly one endpoint on the map, the line goes to that endpoint, so a flow runs from a React component through fetch('/api/orders') into the ASP.NET Core handler and down to the database. An address whose start comes from settings (`${apiUrl}/api/orders`) is matched on the rest. Requests to other hosts, and those that fit no endpoint or several, stay "HTTP (outbound)". samples/ shows this: the C# Shop, and an Express API, a NestJS API, a worker and a React client that call it.

JavaScript and TypeScript need Node.js 18 or newer, on the PATH or named in the SIGHTLINE_NODE environment variable. Without it, the rest of the map loads, with a warning that says so. Nothing is installed and no code of yours runs: the compiler only reads it. Imports of the repository's own packages lead to their source, also in a fresh clone with nothing installed or built; with node_modules installed, calls into installed packages' types are followed too. Test files, stories, configuration files, build output and installed packages are left out.

To read one language only, put "languages": ["csharp"] (or ["typescript"], which includes JavaScript) in sightline.json.

Problems

Sightline checks the dependency injection setup and your layer rules as you type. Problems show as a dot on the map, under the Problems button, in sightline check, in pull request comments and in VS Code's Problems panel.

Check Default What it finds
captive-dependency error A singleton (or a hosted service, or middleware written by convention) that receives a scoped service, directly or through transient ones. It keeps one instance for the life of the app; ASP.NET Core refuses this in Development.
missing-registration warning A class or endpoint that receives a service nobody registered. Creating it fails at run time.
dependency-cycle error Services that need each other to be created.
layer-violation error A project that uses a higher layer, or something a rule says it may not use.
unused-registration info A registration nothing in the code asks for.

Layer rules live in sightline.json:

{
  "layers": ["*.Api", "*.Infrastructure", "*.Application", "*.Domain"],
  "rules": [{ "from": "*.Domain", "mayNotUse": ["Microsoft.EntityFrameworkCore*"], "because": "the domain stays free of persistence" }],
  "checks": { "unused-registration": "off" }
}

In NestJS code the same checks read the providers of modules: a provider that no module provides (and an interface asked for by its type, which Nest cannot inject), providers that need each other, and providers nothing injects. Nest makes the classes that use a request-scoped provider request-scoped too, so that is never reported.

Layers go from the top down; a project may use its own layer and the ones below. Reading code cannot see everything, so the map also lists what it could not follow: services registered by scanning assemblies (Scrutor, MediatR, FluentValidation), services looked up by a type worked out at run time, endpoints from frameworks it does not read yet (FastEndpoints, Carter, Razor Pages), and calls that did not resolve because packages are missing. With assembly scanning in the solution, a missing registration is only a note, since the scan may register it. With the app running, its real registrations count, and the uncertainty goes away.

The running app

With Co.Revington.Sightline.Hosting in a .NET app, the app reports to the map once it has started:

  • What it registered and mapped. Endpoints the app confirms are marked; registrations and endpoints only the app knows about, such as those from assembly scanning or FastEndpoints, are added to the map and to the checks.
  • Every request it handles, under Requests: status, time, the database commands it ran (EF Core) and its outbound HTTP calls. Pick one to see it in full, and to light the path it took on the flow of its endpoint.
  • Try it on an endpoint: a request built from the handler's parameters (route, query, headers, and a sample JSON body from the body type) is sent to the app, and the answer shows beside the code. Tick "Send again whenever the code is saved" to see each change take effect.

Everything stays on your machine. Requests from the page only ever go to apps on localhost.

Settings

sightline.json holds the settings for a repository. Sightline uses the nearest one in the current folder or a folder above it, and options on the command line win over it.

{
  "$schema": "https://sightline.revington.co/sightline.schema.json",
  "solution": "Shop.sln",
  "exclude": ["*.Tests", "samples"]
}
Setting Default What it does
solution the nearest solution, or the folder of sightline.json The .sln, .slnx, .csproj or package.json file, or the folder, to open, relative to sightline.json.
languages all of them The languages to read: csharp, typescript (javascript is the same reader). See Languages.
exclude none Projects to leave off the map. Each entry is a project or package name, a folder or a path relative to sightline.json, and may use * within a folder name and ** across folders: "*.Tests", "@acme/e2e", "samples", "tools/**". Left-out .NET projects still load when others reference them, so the code that uses them is read correctly.
port 5210 Port for the map page.
openBrowser true Open the map in the browser at start.
restore true Run dotnet restore first for C# projects that were never restored. npm packages are never installed.
layers, rules, checks none Layer rules and how serious each problem is; see Problems.
editor detected The editor that Open in editor starts: vscode, cursor, rider or visualstudio. A command of your own goes in the SIGHTLINE_EDITOR environment variable, such as subl {file}:{line}; a repository cannot name a program to run.

The $schema line lets editors suggest these settings as you type. Comments and trailing commas are allowed. A misspelled setting is reported and ignored; a wrong value stops Sightline with a message saying what is expected.

The three views

View Shows Use it to answer
Map Projects as zones, types listed per namespace. Hover or select a type to see its lines. What is in this repository? Which project uses which?
Flow Every step behind an endpoint or method, numbered in source order. Interface calls continue in the registered implementation. What happens when this endpoint is hit? Who ends up calling this method?
Focus One type in the middle, between what uses it and what it depends on. What breaks if I change this class?

The left panel lists endpoints, services, types and projects. The right panel shows details of the selection, its problems, and its source code.

The address keeps the view and the selection, so a link opens the same picture for a teammate with the same code, and in an exported map. Back and Forward work.

Tours walk a new teammate through the code, one view at a time with a note on each. Write them in the page (Tours, then New tour); they are saved to .sightline/tours/<name>.json, so commit them to share.

Shortcuts: / find, 1 2 3 switch view, F fit to screen, double-click to open a project, focus a type or re-root a flow.

Editing

  • In the page: type in the code panel. The map updates as you type, before anything is saved. Ctrl+S or Save file writes to disk; Discard changes goes back to the file on disk.
  • In your editor: save the file and the map follows. With auto-save on, it follows as you type. Open in editor jumps from the page to the same line in VS Code, Cursor, Rider or Visual Studio.

The strip at the bottom logs what each edit changed, for example GetOrderHandler.Handle calls IOrderRepository.SaveAsync.

Share a map

sightline export --out site writes the map as a static website: the same page, read-only, with the code bundled. Host it on GitHub Pages or any web server, and add a badge to your README:

[![Sightline map](https://sightline.revington.co/badge.svg)](https://<you>.github.io/<repo>/)

Limits

  • C# (SDK-style projects), TypeScript and JavaScript. Other languages are not read yet; CONTRIBUTING.md says how one is added.
  • Reading C# follows constructor injection, interface implementations, overrides and MediatR-style Send/Publish to handlers. Reflection, assembly scanning and generated code are listed under "Not followed" instead; with the app running, its own report fills those gaps for registrations and endpoints.
  • Endpoint discovery in C# covers controllers, minimal APIs (including MapGroup prefixes passed through extension methods), MapHub, MapGrpcService and MapHealthChecks. Other frameworks' endpoints come from the running app.
  • Reading JavaScript and TypeScript follows what the compiler resolves: imports and require, classes and the interfaces they name in implements, objects of functions, JSX components, NestJS constructor injection and NestJS CQRS handlers. Route prefixes are followed through app.use('/api', router), register(plugin, { prefix }), route('/x', app) and routers passed to functions. A class that fits an interface without saying so, modules loaded by a computed name, and GraphQL, tRPC, WebSocket and message handlers are listed under "Not followed". Running Node apps do not report to the map.
  • Property reads and writes are not counted as calls.
  • Size: measured on jellyfin (41 projects, 2,300 types) and nopCommerce (40 projects, 4,150 types), a solution loads in 20 to 30 seconds and an edit reaches the open map in under a second. Very large flows stop at 160 steps and show "+N" where they stop.

Safety

The server listens on localhost only. Every API call needs a token that is generated at start and embedded in the page, so other websites cannot read or write your source through the browser. Only files that belong to the projects on the map can be read, saved or opened in an editor. Try it only sends requests to apps on this machine. Apps report to the map with the same token, which the map hands only to the app that started it.

Working on Sightline

dotnet run --project src/Co.Revington.Sightline -- samples/Shop/Shop.sln   # run from source on the bundled sample
dotnet run --project src/Co.Revington.Sightline -- samples                 # the C# sample and the TypeScript and JavaScript that call it
dotnet test                                                               # end-to-end tests (needs Node.js 18 or newer)
  • src/Co.Revington.Sightline/Analysis holds the facts every language reports per file (declarations, calls, DI registrations, endpoints, constructor dependencies), the C# reader that extracts them with Roslyn, the graph builder and the checks.
  • src/Co.Revington.Sightline/Languages is one workspace per language: CSharpWorkspace loads the solution through MSBuild; TypeScript/ finds npm packages and their files, and talks to the reader in analyzers/typescript.
  • src/Co.Revington.Sightline/analyzers/typescript reads JavaScript and TypeScript with the TypeScript compiler (in vendor/, put there by bash .github/scripts/vendor-typescript.sh 6.0.3). Plain JavaScript modules for Node.js, no build step; Sightline starts it and talks to it in JSON lines.
  • src/Co.Revington.Sightline/Live watches the folder. A changed file is re-read alone, the graph is rebuilt, and only the difference is pushed to the browser.
  • src/Co.Revington.Sightline/Server is the local web server: the page, the API, "Try it", and what running apps report.
  • src/Co.Revington.Sightline/Commands and Mcp are check, export, diff and mcp.
  • src/Co.Revington.Sightline/wwwroot is the page: plain JavaScript modules, ELK for layout, CodeMirror for the editor. No build step. Add --ui src/Co.Revington.Sightline/wwwroot when running to serve these files straight from source.
  • src/Co.Revington.Sightline.Hosting packs the tool with the build files that start it beside an app, and the code that reports the app's registrations, endpoints and requests.
  • vscode/ is the VS Code extension: plain JavaScript, no dependencies.
  • site/ is the website. node site/generate.mjs --serve builds it into _site/ and previews it at localhost:4173. The demo on the site is the tool's own page, fed by a recording that the script takes from the real tool running on samples/Shop, so it cannot drift from the product.

Releasing

Releases are automatic. Every push to master is built and tested by .github/workflows/release.yml. If code under src/ or vscode/ changed, a second job then:

  1. works out the next version from the commit messages since the last release
  2. publishes both NuGet packages to nuget.org from the GitHub environment production
  3. packages the VS Code extension with the same version
  4. tags the commit vX.Y.Z and creates a GitHub release with notes and the packages attached

A third job then publishes the extension from that release to the VS Code Marketplace, and to Open VSX when its token is set.

Commit message starts with Version change Example
feat!: (or the body has a BREAKING CHANGE: line) major, or minor while the version is 0.x 0.3.1 to 0.4.0
feat: minor 0.3.1 to 0.4.0
anything else patch 0.3.1 to 0.3.2

Both packages, Co.Revington.Sightline and Co.Revington.Sightline.Hosting, are released together with the same version. To jump to a specific version such as 1.0.0, set <VersionPrefix> in src/Directory.Build.props. To release without a code change, start the workflow by hand from the Actions tab. To publish only the extension of the latest release again, for example after a marketplace was down, start it by hand with Only publish the VS Code extension of the latest release ticked. Release notes leave out ci, test, chore, docs, build and style commits. Pull requests are built and tested by .github/workflows/ci.yml, get a comment with what they do to the map, and never publish.

Runner

Every workflow runs on the repository's self-hosted runner (runs-on: self-hosted), a Windows machine. The steps are bash scripts; each job first puts Git Bash ahead of the WSL bash.exe in System32 on the PATH, since that one cannot run them. The runner needs Git for Windows and the GitHub CLI (gh); each job sets up the .NET SDK and Node.js itself. Pull requests from forks run on that machine too, so keep Require approval for all external contributors chosen under Settings, Actions, General.

Publishing setup

nuget.org and the VS Code Marketplace both use trusted publishing, so no API key or token for them is stored anywhere. These settings have to agree:

Where Setting Value
nuget.org, Trusted Publishing policy Repository owner, repository ravindu-rev, sightline
nuget.org, Trusted Publishing policy Workflow file, environment release.yml, production
GitHub, repository variable NUGET_USER nuget.org user name that created the policy revington.co
VS Code Marketplace, publisher revington, Trusted Publishing policy Repository owner, repository ravindu-rev, sightline
VS Code Marketplace, publisher revington, Trusted Publishing policy Workflow file, environment release.yml, production

The GitHub environment production only accepts deployments from master. If NUGET_USER is empty, the workflow still builds and tests every push but skips the release and says why.

Optional, each one switched on by adding it in the repository's settings:

GitHub setting What it turns on
Secret OVSX_PAT Publishing the extension to Open VSX, for Cursor, VSCodium and other VS Code forks.
Variable CF_ANALYTICS_TOKEN Cloudflare Web Analytics on the website (no cookies).
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.5.0 96 11/16/2026
0.4.2 95 11/13/2026
0.4.1 94 11/12/2026
0.4.0 98 11/12/2026
0.3.0 99 11/12/2026
0.2.0 91 11/12/2026
0.1.1 91 11/12/2026
0.1.0 95 11/12/2026