prose

Source

The package. The parser reads @prose out of a file, the tree walk finds the files, and the renderer turns them into pages, served or written out. Each file's own prose says how it works.

  • Reading a file: parser.ts finds a file's @prose comments, each with its place in the file. lexer.ts splits JS and TS into tokens, so the comments are found exactly.
  • Finding the files: tree.ts walks the repository into folders and files, each with a summary.
  • Making pages: render.ts turns a node into HTML. rail.ts makes the file tree, and nav.ts the docs linked in the bar. highlight.ts colours code, with a tokenizer for each language in languages/. page/ holds the frame, the look and the scripts. assets.ts makes the stylesheet and the script into files every page shares, and accent.ts gives each project its colour and tab icon.
  • Showing them: server.ts serves the pages for prose ., and build.ts writes them as static files. repo.ts reads the project's name and GitHub address. warnings.ts finds what the text gets wrong, for prose check, the build and a local page, with structure.ts for how it's put together and presence.ts for what's missing. style.ts gives advice on how the text reads, for prose style. rules.ts prints the rules from the docs, for prose rules, and outline.ts writes the map of every file, for prose outline.
  • Entry points: cli.ts is the command and index.ts the library.

Folders

  • languages/

    A small tokenizer for each language prose highlights. Each one turns source into coloured spans, and highlight.ts turns the spans into lines of HTML.

  • page/

    What the browser gets. That's the page's frame, its stylesheet and its scripts. They're written as ordinary HTML, CSS and JS, so the editor, the formatter and the linter treat them as code.

Code

  • accent.ts

    Each project gets its own colour, picked from eight hues by a hash of its name. So two projects open side by side look different, and one project looks the same on every machine, with no config. The colour marks links, focus and the reader's place (style.css), and fills the tab's icon.

  • assets.ts

    The stylesheet and the page's script, sent once and cached, so each page carries only its own HTML. A file's name holds a hash of its text, so a new release gets new names and a host can cache them forever.

  • build.ts

    The pages prose . serves, written as static files for any static host. The same renderRoute in server.ts writes them, so it isn't a second site. It builds one commit, HEAD, as the public repository shows it.

  • built.d.ts

    Tells TypeScript that an import ending in ?built is a file's text, ready to send to the browser, or a Markdown file as written. The built plugin in vite.config.ts does the loading.

  • cli.ts

    The command. prose serves a repository and opens it in the browser. prose build writes the same pages as static files, for any host to serve. prose check fails on what the text gets wrong, so CI can stop a merge (warnings.ts). There's no config.

  • highlight.ts

    Code is highlighted on the server, in the page's own palette. One render serves both light and dark, since each token carries a class, like keyword, and the stylesheet sets its colour for either.

  • index.ts

    What the package exports for use in code. The commands are prose [<dir>] and prose build (cli.ts). The same server, build, parser and tree walk are here for anyone who wants that view of a repository in code.

  • lexer.ts

    Splits JS or TS source into comments, strings, regexes, numbers, names and punctuation, each with its span. The parser takes the comments from it. Whitespace sits in the gaps between tokens.

  • nav.ts

    The docs a repository asks to be read first, linked in the bar on every page. They aren't then one folder among forty. It's a convention, not a site's navigation. The docs are always the ones in docs/, and the only choice is which of them, in what order.

  • outline.ts

    Writes outline.md, the repository as a tree with each file's summary, so an agent sees the whole map in one read. AGENTS.md names it, and an agent opens the part for the folder it works in. Docs, config and source are all in it, since a config file's summary says what it's for as much as a module's does.

  • parser.ts

    Finds the @prose comments in one source file, each language its own way. A file comes back as its comments in source order, each with its Markdown body and the byte span it took. The first is the file's summary, and the renderer lays out the code around them.

  • presence.ts

    prose's warnings on prose that isn't there, as the agent rules ask for it. That's a file with no @prose, a folder with no README.md, and an export a library ships with no comment. Each is one file or one export, never a share of the whole (design).

  • rail.ts

    The rail on the right of every page shows the repository's folders and files, as an editor's explorer does. Folders come first. In each folder, its README.md comes ahead of the rest.

  • render.ts

    Turns the tree's nodes into pages. A page is a folder, a Markdown file, a source file read as one document, or a plain text file. Each is one HTML string, which links the stylesheet and script every page shares (assets.ts).

  • repo.ts

    The repository's name and GitHub address, read from its origin remote, and what a branch changed. Every page shows the name. The address lets a page link to the repository, a commit and a tag.

  • rules.ts

    The rules an agent writes prose to, read from usage as it shipped with this version. The command prints them as raw text, so an agent needs no fetch, and a fetched page goes through a smaller model that drops specifics (lessons).

  • server.ts

    A small, read-only HTTP server on a repository (reading). It renders each page from the files on disk when it's asked for, so what it shows is always the working tree. It binds to loopback, serves only the files the walk lists, and writes nothing.

  • structure.ts

    prose's warnings on how a text is put together, as writing asks. Each is exact, so a warning is always something to fix (usage).

  • style.ts

    Advice on where a text's sentences break the agent rules' plain style, for prose style (usage). It's advice for the writer of a file, not a fault, so it never fails and never shows on a page.

  • tree.ts

    Walks a repository into a tree of folders and files, each with a summary. A folder's summary comes from its README.md, a Markdown file's from its first paragraph, and a source file's from its first prose comment.

  • warnings.ts

    What a repository's text gets wrong, by file and line. markz reports what it can't read in a Markdown text, like a reference link. prose adds its own, on how prose is put together (structure.ts) and on prose that's missing (presence.ts).