Delphi-RAG-Lint
Delphi tooling · documentation

An API Reference from the Index

drag-lint 1.60 writes a static API reference of a Delphi project from its index: a page per unit, class and interface with its DocInsight text, its members and a chart, and the same bytes every time for the same index. The result is a folder of plain HTML files. You open it from disk or copy it to any web server; there is no server process, no database and nothing to install for the reader.

Availability

The site verb is new in drag-lint 1.60.0-alpha, released 2026-11-30. It needs Graphviz dot.exe to lay out the charts. Every output below is real output of 1.60.0-alpha on the four-file project in section 01 (paths shortened to ..., progress lines left out).

Our own coding rules for Micronite, the quality and production-control software we make for manufacturers, ask for a DocInsight comment on every public type and method. Those comments are mostly read one at a time, in a Help Insight tooltip, by someone who already has the unit open. A developer new to the code, or a tester, needs them the other way round: all of them at once, sorted by unit and class, without starting the IDE. drag-lint already holds every one of those comments in its index, so 1.60 writes them out.

01 — The fixture

A small project with documented code

Billing is a program with three units. Billing.Types declares an interface for an invoice store, Billing.Invoice an exception, an invoice class and a credit note that inherits from it, and Billing.Store a class that stores invoices as text files. Every public declaration has a DocInsight comment. This is the interface:

type
  /// <summary>Keeps invoices by number.</summary>
  /// <remarks>Implementations are not thread-safe; use one store per thread.</remarks>
  IInvoiceStore = interface
    ['{6F1C2B7E-3D4A-4E8B-9C21-5A7D0E4F8B13}']
    /// <summary>Saves the text of one invoice.</summary>
    /// <param name="pNumber">Invoice number; must be greater than zero.</param>
    /// <param name="pText">The rendered invoice.</param>
    procedure Save(pNumber: Integer; const pText: string);
    /// <summary>Loads the text of one invoice.</summary>
    /// <param name="pNumber">Invoice number.</param>
    /// <returns>The text stored by <see cref="Save"/>.</returns>
    /// <exception cref="EInvoiceNotFound">No invoice has that number.</exception>
    function Load(pNumber: Integer): string;
  end;
02 — Two commands

Index the project, then write the site

Step 1. Index the folder into a database of its own. The site is exactly as current as this index, so on a real project you reindex first.

drag-lint index . --db billing.sqlite
Done. Files: 4, Symbols: 33, Refs: 87, 6.68s, parse-errors=0

Step 2. Write the site into a new folder.

drag-lint site --db billing.sqlite --output site
site: 9 page(s) (4 unit, 5 class / interface), 9 chart(s) written to ...\site

Four unit pages (the program counts as one), five class and interface pages, one chart on each. The folder holds 15 files:

.drag-lint-site
index.html
search-index.js
search-index.json
site.css
viewer.js
types\Billing.Invoice.EInvoiceNotFound.html
types\Billing.Invoice.TCreditNote.html
types\Billing.Invoice.TInvoice.html
types\Billing.Store.TFileInvoiceStore.html
types\Billing.Types.IInvoiceStore.html
units\Billing.html
units\Billing.Invoice.html
units\Billing.Store.html
units\Billing.Types.html

index.html is the hub. With the tags removed, it reads:

API reference billing
4 units   5 classes / interfaces   index billing.sqlite   drag-lint 1.60.0-alpha
[search units, classes, interfaces and members]

Billing           program
Billing.Invoice   unit       Invoices and credit notes.
  EInvoiceNotFound  class    Raised when a store has no invoice with the requested number.
  TCreditNote       class    A credit note: an invoice whose total is paid back.
  TInvoice          class    An invoice: a number and a total in cents.
Billing.Store     unit       An invoice store that keeps one text file per invoice.
  TFileInvoiceStore class    Stores each invoice as <number>.txt in one folder.
Billing.Types     unit       Shared types of the billing example: the store contract.
  IInvoiceStore     interface  Keeps invoices by number.

Each one-line summary is the <summary> of that declaration. The search box covers every page and every listed member; its index is in the two search-index files beside the pages.

03 — A page

The DocInsight text, member by member

This is types\Billing.Types.IInvoiceStore.html with the tags removed and the chart left out:

index / Billing.Types
interface Billing.Types.IInvoiceStore
declared Billing.Types.pas:9   section interface   2 listed

Keeps invoices by number.
Remarks  Implementations are not thread-safe; use one store per thread.

inherited by  Billing.Store.TFileInvoiceStore

Members
method Save  public  :14
  method Save(pNumber: Integer; const pText: string)
  Saves the text of one invoice.
  Parameters  pNumber  Invoice number; must be greater than zero.
              pText    The rendered invoice.
method Load  public  :19
  method Load(pNumber: Integer): string
  Loads the text of one invoice.
  Parameters  pNumber  Invoice number.
  Returns     The text stored by Save.
  Exceptions  EInvoiceNotFound  No invoice has that number.
  See also    Save

Every tag of the comment has its own place: summary, remarks, parameters, returns and exceptions. A cref with a short name becomes a link when exactly one page carries that name. EInvoiceNotFound has one page, so the exception links to it. Two pages list a Save, the interface and TFileInvoiceStore, so it stays plain code rather than a link that might point at the wrong one.

Private and strict private members are not listed, and a page says how many it left out: the TInvoice page ends with 2 private member(s) not listed. for its two fields. Each Billing.Types.pas:9 and :14 is a link that opens that line in RAD Studio through draglint://, once you have run drag-lint protocol register.

04 — The charts

One chart per page, every node a link

A unit page draws the units that use it on the left and the units it uses on the right. On the Billing.Store page, Billing is on the left. On the right are Billing.Types (interface uses, line 7) and Billing.Invoice, System.SysUtils and System.IOUtils (implementation uses, line 25, drawn dashed). The two RTL units are outside the project, so they have no page, and in the text under the chart they are plain names, not links:

uses (interface)       Billing.Types
uses (implementation)  System.SysUtils, System.IOUtils, Billing.Invoice
used by                Billing
classes and interfaces TFileInvoiceStore

A class or interface page draws its parent class and its interfaces on the left and the project types that inherit it on the right. TFileInvoiceStore has TInterfacedObject (outside the project) and Billing.Types.IInvoiceStore on the left; TInvoice has TCreditNote on the right.

Every node except the centre is a link to its own page, so moving through the project is clicking, and the browser's back button goes back. The centre node opens the declaration in the IDE. The charts are drawn by the same viewer as the IDE's chart window and drag-lint ask, with pan, zoom and fit; at most 30 nodes are drawn on each side and the rest are listed on the page.

05 — Same index, same bytes

Run it twice and compare

Write the site a second time into another folder and compare every file by its hash:

drag-lint site --db billing.sqlite --output site2
drag-lint site --db billing.sqlite --output site3
$a = (Get-ChildItem site2 -Recurse -File -Force | Get-FileHash).Hash
$b = (Get-ChildItem site3 -Recurse -File -Force | Get-FileHash).Hash
"files $($a.Count) $($b.Count) differences $((Compare-Object $a $b).Count)"
files 15 15 differences 0

No page holds a time stamp, the output folder or a random id; pages are read in name order and each chart is laid out from DOT text built in that order. That matters once the site is under version control or on a server: a new run differs from the last one only where the index differs, so the diff of the site is a readable record of what changed in the code and its comments.

06 — Writing it again

It replaces its own files and nothing else

The .drag-lint-site file marks the folder as one site wrote. A later run into that folder replaces the generated files and leaves anything else alone: a README.txt put into site by hand was still there after the next run. A folder that holds other files and no marker is refused, and nothing is written:

drag-lint site --db billing.sqlite --output notes2
site: ...\notes2 is not empty and holds no .drag-lint-site: give an empty or new folder (nothing was written)
usage: drag-lint site (--db <project.sqlite> | --project <x.dproj>) --output <dir> [--max-pages N]

The exit code is 2, and notes2 still holds only the todo.txt it held before.

07 — Large projects

A first look with fewer pages

On a large project, --max-pages writes a sample first. Pages come in a fixed order, each unit followed by its classes and interfaces:

drag-lint site --db billing.sqlite --output site-cut --max-pages 4
site: 4 page(s) (2 unit, 2 class / interface), 4 chart(s) written to ...\site-cut
site: --max-pages 4: 4 of 9 page(s) written; names without a page are not linked

The hub says 4 of 9 pages generated (--max-pages); names without a page are not linked. On the Billing.Invoice page, TInvoice, whose page was cut, is shown as code, not as a link to a page that does not exist.

08 — Why it is repeatable

A deterministic Delphi algorithm, not AI and not manual work

Every line of the site comes from the index drag-lint builds by parsing your source: the declarations, the uses clauses, the inheritance and the doc comments exactly as you wrote them. Nothing is summarised, rephrased or filled in by a model, and nobody edits the pages by hand. A declaration without a comment gets a page without a description, not an invented one. The engine is written in Delphi.

09 — Limits

What to know before you rely on it

  • Units, classes and interfaces get pages. Records, enumerations, routines and constants are listed, with their comments, on the page of their unit or type.
  • A chart shows the direct parent and the direct descendants, not the whole chain.
  • Callers, change impact, form wiring and the tables a unit touches are not on the pages in 1.60, and every run writes every page. drag-lint 1.61 adds callers, impact, the .dfm event and the tables read and written to each routine and property page, and a re-run into the same folder rewrites only what changed (--full rewrites everything).
  • Each file:line link holds the full path of the source file on the machine that wrote the site, for example draglint://open?file=C%3A%5C...%5CBilling.Types.pas&line=9. Keep that in mind before you put the folder on a public server.
  • Without Graphviz dot.exe the run stops with exit code 1. drag-lint looks for it as ask does: DRAGLINT_DOT, the dot setting, beside the engine, an installed copy, PATH.

Output measured 2026-11-30 with drag-lint 1.60.0-alpha on a four-file fixture, on a machine busy with other work, so the index time in section 02 is not a benchmark. The page texts in sections 02 and 03 are the generated HTML with the tags removed; the charts were checked in the SVG the pages carry and in a headless Edge render, and the search box was not tried.