Tya v0.51 Specification

Status: shipped. The tya version constant is 0.51.0. v0.51 adds the tya doc source documentation generator. The language surface is unchanged from v0.49 / v0.50.

Theme

v0.49 cut the first slice of the Toolchain track (tya new, tya task, tya lint). v0.50 extended those three. v0.51 adds the fourth toolchain subcommand: tya doc, a source-documentation generator that produces either plain text or a multi-page static HTML site.

The goal of v0.51 is to round out the toolchain so a tya project can be documented out of the box, completing the “scaffold → run → test → lint → document” loop.

tya doc — source documentation generator

CLI

tya doc [paths...]              # text output to stdout
tya doc --html <out> [paths...] # multi-page HTML static site

Doc comment format

Extracted top-level declarations

AST node Kind Signature string
ClassDecl class class <Name>
ModuleDecl module module <Name>
InterfaceDecl interface interface <Name>
AssignStmt whose RHS is *ast.FuncLit function <name>(<param1>, <param2>...)

Markdown subset

The Markdown renderer is self-contained (no external dependency). Supported elements:

Plain-text output renders headings as === … ===, lists as - … / 1. …, code fences as indented blocks. Inline markers are stripped.

HTML output renders the corresponding tags. All raw text is HTML- escaped before inline rewriting, so user content cannot inject markup.

Error codes

Code Meaning Exit
TYA-E0920 --html requires a non-empty directory argument 2
TYA-E0923 src/ not found (no explicit paths) 2

TYA-E0921 and TYA-E0922 are reserved (orphan-doc-comment and Markdown parse error). They are not implemented in v0.51.

HTML site layout

<out>/
  index.html                      # grouped binding listing
  items/
    function_<sanitized_name>.html
    class_<sanitized_name>.html
    module_<sanitized_name>.html
    interface_<sanitized_name>.html
  style.css                       # snapshot of docs/document.css

Out of scope (v0.51)

Diagnostic code registry update

v0.51 adds two codes inside the TYA-E092x toolchain band:

Code Subcommand Meaning
TYA-E0900 tya task unknown task name (v0.49)
TYA-E0901 tya task array-form task failure (v0.49)
TYA-E0902 tya task no tya.toml found (v0.49)
TYA-E0903 tya task parallel-form task failure (v0.50)
TYA-E0910 tya new invalid project name (v0.49)
TYA-E0911 tya new target already exists (v0.49)
TYA-E0912 tya new invalid --template (v0.50)
TYA-E0913 tya new --here + name conflict (v0.50)
TYA-E0920 tya doc --html needs argument (v0.51)
TYA-E0923 tya doc src/ missing on default path (v0.51)
TYAL0001 tya lint unused local (v0.49; autofix v0.50)
TYAL0003 tya lint redundant if true/false (v0.50)
TYAL0004 tya lint deeply nested block (v0.50)
TYAL0005 tya lint very long function (v0.50)

TYA-E0921, TYA-E0922, and TYAL0002 remain reserved.

Compatibility